Investigate NODE-3876 - Broken types

XMLWordPrintableJSON

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

      NODE-3876 Description
      Hi there,

      this is a follow up to https://jira.mongodb.org/projects/NODE/issues/NODE-3856.

      First of all thanks for releasing a fix version so quickly. Unfortunately I still have issues with Mongo 4.3.1. Searching for properties now seems to work  - so I can write 

      await this.collection.findOne({ a: 'a', b: 'b' } as Filter<ENTITY>)
      

      I still have to cast it - for weird reasons, but in general the compiler will accept it. However, you can also mix those queries - so it should also be allowed to write

      await this.collection.findOne({ a: 'a', b: { $in: itemIds } } as Filter<ENTITY>)
      

      (itemIds is a string array)

      This gives me a nice:

      TS2352: Conversion of type '{ a: string; b: { $in: string[]; }; }' to type 'Filter<ENTITY>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.   Type '{ a: string; b: { $in: string[]; }; }' is not comparable to type '{ [Property in Join<NestedPaths<WithId<ENTITY>>, ".">]?: Condition<PropertyType<WithId<ENTITY>, Property>> | undefined; } & RootFilterOperators<...>'.     Type '{ a: 'a', b: { $in: itemIds } }' is not comparable to type '{ [Property in Join<NestedPaths<WithId<ENTITY>>, ".">]?: Condition<PropertyType<WithId<ENTITY>, Property>> | undefined; }'.
      

      Any ideas?

            Assignee:
            Daria Pardue
            Reporter:
            TPM Jira Automations Bot
            None
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: