Uploaded image for project: 'Node.js Driver'
  1. Node.js Driver
  2. NODE-4601

Investigate NODE-4600 - Typescript 4.8.2 errors

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • 4.10.0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
    • 2
    • Not Needed

      NODE-4600 Description
      Upgraded to TS 4.8.2 this week and seeing a bunch of new errors from the compiler. (These do not appear for TS 4.7)

      These errors all seem to be originating from the node driver.

      Node Version: 14.2.0

      Typescript Version: 4.8.2

      Mongoose Version: 5.11.1 (and 5.13.15)

      Mongo Driver Version: 2.7.3

      node_modules/@types/mongodb/index.d.ts:1198:45 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1198         callback?: MongoCallback<Collection<TSchema>>,
                                                       ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1196:16
          1196     collection<TSchema = DefaultSchema>(
                              ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1199:19 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1199     ): Collection<TSchema>;
                             ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1196:16
          1196     collection<TSchema = DefaultSchema>(
                              ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1203:45 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1203         callback?: MongoCallback<Collection<TSchema>>,
                                                       ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1200:16
          1200     collection<TSchema = DefaultSchema>(
                              ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1204:19 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1204     ): Collection<TSchema>;
                             ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1200:16
          1200     collection<TSchema = DefaultSchema>(
                              ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1244:96 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1244     createCollection<TSchema = DefaultSchema>(name: string, callback: MongoCallback<Collection<TSchema>>): void;
                                                                                                          ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1244:22
          1244     createCollection<TSchema = DefaultSchema>(name: string, callback: MongoCallback<Collection<TSchema>>): void;
                                    ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1248:27 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1248     ): Promise<Collection<TSchema>>;
                                     ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1245:22
          1245     createCollection<TSchema = DefaultSchema>(
                                    ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1252:44 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1252         callback: MongoCallback<Collection<TSchema>>,
                                                      ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1249:22
          1249     createCollection<TSchema = DefaultSchema>(
                                    ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1384:44 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1384         callback: MongoCallback<Collection<TSchema>>,
                                                      ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1381:22
          1381     renameCollection<TSchema = DefaultSchema>(
                                    ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1390:27 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1390     ): Promise<Collection<TSchema>>;
                                     ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1386:22
          1386     renameCollection<TSchema = DefaultSchema>(
                                    ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:1395:44 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ [key: string]: any; }'.1395         callback: MongoCallback<Collection<TSchema>>,
                                                      ~~~~~~~  node_modules/@types/mongodb/index.d.ts:1391:22
          1391     renameCollection<TSchema = DefaultSchema>(
                                    ~~~~~~~~~~~~~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:2559:21 - error TS2344: Type 'T' does not satisfy the constraint '{ [key: string]: any; }'.2559     ): ChangeStream<T>;
                               ~  node_modules/@types/mongodb/index.d.ts:2556:11
          2556     watch<T = TSchema>(
                         ~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:2560:111 - error TS2344: Type 'T' does not satisfy the constraint '{ [key: string]: any; }'.2560     watch<T = TSchema>(options?: ChangeStreamOptions & { session?: ClientSession | undefined }): ChangeStream<T>;
                                                                                                                         ~  node_modules/@types/mongodb/index.d.ts:2560:11
          2560     watch<T = TSchema>(options?: ChangeStreamOptions & { session?: ClientSession | undefined }): ChangeStream<T>;
                         ~~~~~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/@types/mongodb/index.d.ts:2911:30 - error TS2344: Type 'TSchema' does not satisfy the constraint '{ _id?: any; }'.2911         document: OptionalId<TSchema>;
                                        ~~~~~~~  node_modules/@types/mongodb/index.d.ts:2909:41
          2909 export type BulkWriteInsertOneOperation<TSchema> = {
                                                       ~~~~~~~
          This type parameter might need an `extends { _id?: any; }` constraint.node_modules/mongoose/index.d.ts:332:116 - error TS2344: Type 'T' does not satisfy the constraint '{ [key: string]: any; }'.332     createCollection<T = any>(name: string, options?: mongodb.CollectionCreateOptions): Promise<mongodb.Collection<T>>;
                                                                                                                             ~  node_modules/mongoose/index.d.ts:332:22
          332     createCollection<T = any>(name: string, options?: mongodb.CollectionCreateOptions): Promise<mongodb.Collection<T>>;
                                   ~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/mongoose/index.d.ts:333:77 - error TS2344: Type 'T' does not satisfy the constraint '{ [key: string]: any; }'.333     createCollection<T = any>(name: string, cb: Callback<mongodb.Collection<T>>): void;
                                                                                      ~  node_modules/mongoose/index.d.ts:333:22
          333     createCollection<T = any>(name: string, cb: Callback<mongodb.Collection<T>>): void;
                                   ~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/mongoose/index.d.ts:334:150 - error TS2344: Type 'T' does not satisfy the constraint '{ [key: string]: any; }'.334     createCollection<T = any>(name: string, options: mongodb.CollectionCreateOptions, cb?: Callback<mongodb.Collection>): Promise<mongodb.Collection<T>>;
                                                                                                                                                               ~  node_modules/mongoose/index.d.ts:334:22
          334     createCollection<T = any>(name: string, options: mongodb.CollectionCreateOptions, cb?: Callback<mongodb.Collection>): Promise<mongodb.Collection<T>>;
                                   ~~~~~~~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/mongoose/index.d.ts:833:93 - error TS2344: Type 'T' does not satisfy the constraint '{ [key: string]: any; }'.833     createCollection(options?: mongodb.CollectionCreateOptions): Promise<mongodb.Collection<T>>;
                                                                                                      ~  node_modules/mongoose/index.d.ts:781:19
          781   interface Model<T, TQueryHelpers = {}, TMethods = {}> extends NodeJS.EventEmitter, AcceptsDiscriminator {
                                ~
          This type parameter might need an `extends { [key: string]: any; }` constraint.node_modules/mongoose/index.d.ts:834:109 - error TS2344: Type 'T' does not satisfy the constraint '{ [key: string]: any; }'.834     createCollection(options: mongodb.CollectionCreateOptions | null, callback: Callback<mongodb.Collection<T>>): void;
                                                                                                                      ~  node_modules/mongoose/index.d.ts:781:19
          781   interface Model<T, TQueryHelpers = {}, TMethods = {}> extends NodeJS.EventEmitter, AcceptsDiscriminator {
                                ~
          This type parameter might need an `extends { [key: string]: any; }` constraint. 

            Assignee:
            durran.jordan@mongodb.com Durran Jordan
            Reporter:
            dbeng-pm-bot PM Bot
            Durran Jordan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: