-
Notifications
You must be signed in to change notification settings - Fork 184
Open
Description
Version 7.3.1 changed the type definitions. Now they seem to be incomplete or wrong for the CollectionOptions
type. For example, it used to be possible to globally disable automatic _id casting using monk('url', {collectionOptions: {castIds: false}})
. With the updated type definitions that results in an error:
TSError: ⨯ Unable to compile TypeScript:
file.ts:12:75 - error TS2322: Type '{ castIds: boolean; }' is not assignable to type 'CollectionOptions'.
Object literal may only specify known properties, and 'castIds' does not exist in type 'CollectionOptions'.
12 monk('uri', {collectionOptions: {castIds: false}});
~~~~~~~~~~~~~~
node_modules/monk/index.d.ts:356:7
356 collectionOptions?: CollectionOptions;
~~~~~~~~~~~~~~~~~
The expected type comes from property 'collectionOptions' which is declared here on type 'MongoClientOptions & { collectionOptions?: CollectionOptions; }'
Prefixing the code with // @ts-ignore
makes it work as intended again. It is really only a type problem.
(Little sidenote: Maybe castIds
could be removed alltogether if the casting was done in a smarter way. For example, only cast strings of 12 bytes or of 24 hex characters.)
ghindle and bytedeveloperr
Metadata
Metadata
Assignees
Labels
No labels