Skip to content

Stop global type leaks across commonJS modules #5346

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

Closed
ziahamza opened this issue Oct 21, 2015 · 2 comments
Closed

Stop global type leaks across commonJS modules #5346

ziahamza opened this issue Oct 21, 2015 · 2 comments
Labels
Question An issue which isn't directly actionable in code

Comments

@ziahamza
Copy link

A lot of type definitions in DefinatelyType export CommonJS module types and a global type definition for popular libraries. I.E Jquery can be used directly from the window object but also using the require syntax.

But this causes Typescript to accept faulty code as correct. E.g using $ or jQuery directly in a commonjs module without requiring the module itself is compiled correctly, when in the first place it was a bug not to require the module.

So can there be a flag where if commonjs modules is enabled then global types are not supported, and only types exported through a module name?

@weswigham
Copy link
Member

#4913 has been proposed as a possible solution to this, but we have a number of competing proposals around the node package typing space. (You can find some of them linked in that PR)

@mhegazy mhegazy added the Question An issue which isn't directly actionable in code label Oct 21, 2015
@ziahamza
Copy link
Author

Awesome, then I guess we can close the issue. will keep track of them. Thanks!

@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Question An issue which isn't directly actionable in code
Projects
None yet
Development

No branches or pull requests

3 participants