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

Typescript LS is preferring .js to @types .d.ts when loading types #9427

Closed
weswigham opened this issue Jun 29, 2016 · 5 comments
Closed

Typescript LS is preferring .js to @types .d.ts when loading types #9427

weswigham opened this issue Jun 29, 2016 · 5 comments
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@weswigham
Copy link
Member

weswigham commented Jun 29, 2016

TypeScript Version: nightly (2.0.0-dev.201xxxxx)

Code
npm install --save-dev gulp
npm install --save-dev @types/gulp

import gulp = require("gulp");

Expected behavior:

Right click -> Go to definition on gulp -> Opens @types/gulp/index.d.ts

Actual behavior:

Right click -> Go to definition on gulp -> Opens gulp/index.js

Using the imported gulp also makes it obvious that all the types are being loaded from the located .js and not the @types .d.ts. This causes serious editor usability issues as your included type definitions are overridden by the required js!

@weswigham
Copy link
Member Author

weswigham commented Jun 29, 2016

@billti I think this has something to do with #9384. I think it's taking priority over #8670 and #9095.

@weswigham weswigham changed the title Typescript LS is preferring .js to .d.ts when loading types Typescript LS is preferring .js to @types .d.ts when loading types Jun 29, 2016
@billti
Copy link
Member

billti commented Jun 29, 2016

Doh! Yeah, makes sense. I'll need to somehow locate the .js file, but defer using it until other type resolution from other search locations fail. Will take a look a bit later, but will revert in the meantime.

@weswigham
Copy link
Member Author

weswigham commented Jun 29, 2016

@billti I think I can make a PR fixing it - one of my other PRs already alters that area a bit, so I'm familiar with it, and I think the changes I already have only need minor tweaks to fix this.

@weswigham weswigham self-assigned this Jun 29, 2016
@billti
Copy link
Member

billti commented Jun 29, 2016

We'll need to add a project test covering a realistic NPM file layout with @types definitions installed too. That would have caught this.

@billti
Copy link
Member

billti commented Jul 1, 2016

Fixed with the above merges.

@billti billti closed this as completed Jul 1, 2016
@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
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

3 participants