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(types): do not use reference tags #563

Merged
merged 1 commit into from Sep 20, 2022
Merged

fix(types): do not use reference tags #563

merged 1 commit into from Sep 20, 2022

Conversation

SuperchupuDev
Copy link
Contributor

@SuperchupuDev SuperchupuDev commented Sep 19, 2022

In TypeScript, /// <reference tags affect the whole environment, meaning that if a single dependency makes use of the tag, the user's global environment would be polluted with these types. The correct way of importing DOM types is by specifying them in the lib property of tsconfig.json, which this library already does.

Without the fix, using window in a project that installed @napi-rs/canvas that doesn't use DOM types

image

After the change, global scope is no longer polluted with DOM types for the project that installed this lib

image

Some examples of global pollution can be found at https://gist.github.com/RyanCavanaugh/702ebd1ca2fc060e58e634b4e30c1c1c

@Brooooooklyn Brooooooklyn merged commit 9e5cc29 into Brooooooklyn:main Sep 20, 2022
@SuperchupuDev SuperchupuDev deleted the patch-1 branch September 20, 2022 08:52
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.

None yet

2 participants