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

[@types] underscore's global definition does not work with module #11156

Open
HerringtonDarkholme opened this issue Sep 10, 2016 · 2 comments
Open
Labels

Comments

@HerringtonDarkholme
Copy link
Contributor

HerringtonDarkholme commented Sep 10, 2016

I wonder whether this is an intended feature. Nevertheless I think it worth mentioning

Code:

With @types/underscore installed.

a.ts

export var a = 123

b.ts

import {a} from './a'
_ // access the global underscore variable 

tsc@2.0.2 complains that Identifier '_' must be imported from a module
If import statement is removed, everything works.

My project relies on a global underscore imported by a script tag. Indeed the build system I use(Webpack) can be configured to import underscore from global, but it requires more changes since I have used tsd to install underscore definition and that works well.

This works if I switch to underscore definition file in master branch. cc @RyanCavanaugh, any idea?

@vvakame vvakame added the @types label Sep 14, 2016
@HerringtonDarkholme
Copy link
Contributor Author

It seems this is intended. Should we close this? @vvakame

microsoft/TypeScript#10638 (comment)

@mbarakaja
Copy link

I am facing a similar issue with angular. When I import interface definition like;

import {IScope, IServiceProvider, IHttpService} from 'angular';`

The compiler throws me the same error, and not just that, the editor loses code completion for angular global variable. This wasn't happening with typings package manager.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants