Coming soon - Get a detailed view of why an account is flagged as spam!
view details

This post has been de-listed

It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.

1
"Go To Definition" difference between JS and TS?
Post Body

Given a file structure like this:

├── main.js
└── util
    └── stuff.js

And with files something like this:

// stuff.js
export function add(a, b) {
    return a   b;
}

// main.js
import * as maths from './util/stuff.js'

maths.add(1, 2)

With the .js file extension, the language server is able to pick up on function signature and any types via JSDoc for type checking and completion, but when using Go To Definition on the add call in main, it loads forever. Switching files to .ts makes Go To Definition work as expected.

Is there some difference in the way the VSCode language server handles these cases that causes it to not work correctly. It is at most able to "Go To Definition" of the maths object that is imported. I tried this with a LSP plugin in Sublime Text and it is able to properly go to the definition.

Author
Account Strength
100%
Account Age
10 years
Verified Email
Yes
Verified Flair
No
Total Karma
6,408
Link Karma
1,360
Comment Karma
5,002
Profile updated: 4 days ago
Posts updated: 1 year ago

Subreddit

Post Details

We try to extract some basic information from the post title. This is not always successful or accurate, please use your best judgement and compare these values to the post title and body for confirmation.
Posted
4 years ago