Remix.run Logo
crummy 2 days ago

> For packages typed with JSDoc, CTRL/CMD clicking on a function will take you to actual code rather than a type declarations file. I much prefer this experience as a dev.

ok i didn't think about this, that's an underrated benefit

agumonkey 2 days ago | parent | next [-]

could be a customizable behavior in editor/ide though

g947o a day ago | parent [-]

There is indeed an option in VSCode "typescript.preferGoToSourceDefinition" --

Prefer Go To Source Definition

Makes `Go to Definition` avoid type declaration files when possible by triggering `Go to Source Definition` instead.

IshKebab 2 days ago | parent | prev [-]

This works with Typescript too though?

filleduchaos a day ago | parent [-]

It doesn't. You might be thinking of libraries that you wrote, not packages from e.g. npm, which are distributed as JavaScript + type definition files not as TypeScript code.

sthuck a day ago | parent | next [-]

It should work if the library was compiled with deceleration map option. Which most libraries are not and it's a shame.

It was added like 3 years ago which was probably a bit too late, not even sure why it's not the default. (File size?)

homebrewer a day ago | parent | prev [-]

In real IDEs, not glorified text editors like VSCode, it does. I use this often in IDEA, it's muscle memory so I'm not even completely sure what to press, but it's likely "go to definition" and by default is tied to ctrl+alt+b.

IDEA adds its own analysis on top of that provided by the language server.

Works on JS + every variant of type definitions I've ever seen, among many other things (not only programming languages, but also database objects, etc).

matt_kantor 16 hours ago | parent [-]

> IDEA adds its own analysis on top of that provided by the language server.

IDEA implements its own analysis and doesn't use tsserver at all. Its semantics diverge in subtle ways, I believe in both directions (some code that tsserver considers valid IDEA will consider invalid and vice versa).