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

Investigate NODE-3668 - Error with TypeScript 4.5

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

      NODE-3668 Description

      What problem are you facing?

      node_modules/mongodb/mongodb.d.ts(5233,89): error TS2344: Type 'Flatten<TSchema[key]>' does not satisfy the constraint '{ _id?: any; }'.
        Type 'unknown' is not assignable to type '{ _id?: any; }'.
          Type 'Flatten<TSchema[KeysOfAType<TSchema, readonly any[] | undefined>]>' is not assignable to type '{ _id?: any; }'.
            Type 'unknown' is not assignable to type '{ _id?: any; }'.
              Type 'Flatten<TSchema[NonNullable<TSchema[keyof TSchema]> extends readonly any[] | undefined ? keyof TSchema : never]>' is not assignable to type '{ _id?: any; }'.
                Type 'unknown' is not assignable to type '{ _id?: any; }'.
                  Type 'Flatten<TSchema[keyof TSchema]>' is not assignable to type '{ _id?: any; }'.
                    Type 'unknown' is not assignable to type '{ _id?: any; }'.
                      Type 'Flatten<TSchema[string | number | symbol]>' is not assignable to type '{ _id?: any; }'.
                        Type 'Flatten<TSchema[string]> | Flatten<TSchema[number]> | Flatten<TSchema[symbol]>' is not assignable to type '{ _id?: any; }'.
                          Type 'Flatten<TSchema[string]>' is not assignable to type '{ _id?: any; }'.
      node_modules/mongodb/mongodb.d.ts(5233,149): error TS2344: Type 'Flatten<TSchema[key]>' does not satisfy the constraint '{ _id?: any; }'.
      

      What driver and relevant dependency versions are you using?

      TypeScript 4.5.0-beta

      MongoDB Node 4.1.2

      Steps to reproduce?

       

      mkdir mongo-tsc && cd mongo-tsc && npm init -y
      npm install mongodb typescript@4.5.0-beta
      echo 'import("mongodb")' > index.ts
      node_modules/.bin/tsc --strict index.ts

       

            Assignee:
            Unassigned Unassigned
            Reporter:
            dbeng-pm-bot PM Bot
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: