-
Notifications
You must be signed in to change notification settings - Fork 253
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat!(NODE-4862): add BSONType enum and remove internal constants from export #532
Conversation
}); | ||
}); | ||
|
||
describe('BSONType enum', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests above are old, no change except for the import
Tests here are new for the enum
} as const); | ||
|
||
/** @public */ | ||
export type BSONType = typeof BSONType[keyof typeof BSONType]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using the enum pattern here, it makes BSONType the annotation equal to a union of the values.
BSONType the runtime value is an object with properties.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we planning on removing the export in https://github.com/mongodb/node-mongodb-native/blob/main/src/mongo_types.ts to just re-export BSONType
from here as part of NODE-4701?
I expect we'll change to a re-export in this ticket: https://jira.mongodb.org/browse/NODE-4867 |
Description
What is changing?
What is the motivation for this change?
The exports are a blocker for #524 passing typescript tests
The enum is a nice to have, it provides the same information that constants did but in a consistent way the driver already does, locating the enum here puts it closer to the code that it relates to, its not used by the BSON library but if someone needs type indicators this is a consistent way to make it available.
Double check the following
npm run lint
script<type>(NODE-xxxx)<!>: <description>