Skip to content
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

fix: add all accessor tags to exported symbols #2649

Merged
merged 4 commits into from
Dec 3, 2020

Conversation

nbbeeken
Copy link
Contributor

@nbbeeken nbbeeken commented Dec 1, 2020

The mongodb.d.ts now only includes the public API.

NODE-2783

API-extractor enforces that things that are public can only depend upon types and symbols that are also public unless stated otherwise. So for example our ChangeStreams API hides the underlying cursor it uses from the public API so we can make both the ChangeStreamsCursor and its Options type internal which deletes them from the final type definition, implicitly (but not literally) making them inaccessible to type checking users.
Some symbols needed to be made public since they are exposed to users. For example BulkWriteResult has a result property that had an internal BulkResult type but since the public definitions file would have that removed you would get a compilation error when it tries to type the public result property as the deleted BulkResult type.

Copy link
Contributor

@emadum emadum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There were a lot of changes from internal => public or from public => internal in this PR that I don't fully understand. For example, AbstractCursor became public but ChangeStreamCursorOptions became internal.

Could you update the description to explain the general reasoning behind why these had to change?

tsdoc.json Outdated Show resolved Hide resolved
Comment on lines -94 to +99
"build:dts": "npm run build:ts && api-extractor run --typescript-compiler-folder node_modules/typescript --local && rimraf 'lib/**/*.d.ts*'",
"build:dts": "npm run build:ts && api-extractor run && rimraf 'lib/**/*.d.ts*'",
"build:docs": "npm run build:dts && typedoc",
"check:bench": "node test/benchmarks/driverBench",
"check:coverage": "nyc npm run check:test",
"check:lint": "npm run check:ts && eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
"check:lint": "npm run build:dts && npm run check:eslint",
"check:eslint": "eslint -v && eslint --max-warnings=0 --ext '.js,.ts' src test",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@emadum @mbroadst
I figure we should add api-extractor to our linting now if we want to maintain access modifiers going forward, does this seem ok to y'all? If we think its overkill for now, I can roll this back

@nbbeeken nbbeeken requested a review from emadum December 3, 2020 19:30
@nbbeeken nbbeeken merged commit 55534c9 into master Dec 3, 2020
@nbbeeken nbbeeken deleted the NODE-2783/access-symbols branch December 3, 2020 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants