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 import considered valid #15540

Closed
aozgaa opened this issue May 2, 2017 · 2 comments · Fixed by singapore/lint-condo#297
Closed

@types import considered valid #15540

aozgaa opened this issue May 2, 2017 · 2 comments · Fixed by singapore/lint-condo#297
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this

Comments

@aozgaa
Copy link
Contributor

aozgaa commented May 2, 2017

TypeScript Version: 2.2.1 / nightly (2.2.0-dev.201xxxxx)

Code

// tsconfig.json
{}

// app.ts
import {x} from "@types/myLib";

// node_modules/@types/myLib/index.d.ts
export declare let x: number;

Expected behavior:
Error on import in app.ts. Perhaps with a suggestion/quickfix to remove the @types/ prefix?

Actual behavior:
No error on import.

@mhegazy mhegazy added Help Wanted You can do this Bug A bug in TypeScript labels May 3, 2017
@mhegazy mhegazy added this to the Community milestone May 3, 2017
@nowy
Copy link
Contributor

nowy commented May 15, 2017

@aozgaa I will be submitting a PR for this today

nowy added a commit to nowy/TypeScript that referenced this issue May 15, 2017
Fix issue: microsoft#15540

- Modify checker; external imports to account for imported modules
containing '@types/'.
- Add diagnostic message.
- Add test case
nowy added a commit to nowy/TypeScript that referenced this issue May 15, 2017
Fix issue: microsoft#15540

- Modify checker; external imports to account for imported modules
containing '@types/'.
- Add diagnostic message.
- Add test case
nowy added a commit to nowy/TypeScript that referenced this issue May 15, 2017
Fix issue: microsoft#15540

- Modify checker; external imports to account for imported modules
containing '@types/'.
- Add diagnostic message.
- Add test case
nowy added a commit to nowy/TypeScript that referenced this issue May 15, 2017
Fix issue: microsoft#15540

- Modify checker; external imports to account for imported modules
containing '@types/'.
- Add diagnostic message.
- Add test case
nowy added a commit to nowy/TypeScript that referenced this issue May 15, 2017
Fix issue: microsoft#15540

- Modify checker; external imports to account for imported modules
containing '@types/'.
- Add diagnostic message.
- Add test case
@mhegazy mhegazy modified the milestones: TypeScript 2.4, Community May 19, 2017
@mhegazy mhegazy added the Fixed A PR has been merged for this issue label May 19, 2017
mhegazy pushed a commit that referenced this issue May 19, 2017
* Fix #15540: Throw error when importing @types

Fix issue: #15540

- Modify checker; external imports to account for imported modules
containing '@types/'.
- Add diagnostic message.
- Add test case

* FIX-15540: Review changes

- Replace `substr` with `startsWith`
- move diagnostics message to more relevant place
- Add `removePrefix` helper function
@mhegazy
Copy link
Contributor

mhegazy commented May 19, 2017

thanks @nowy!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants