microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
101.21k stars 12.51k forks source link

Missing `Go to definition` links when accessing properties after `jsdoc` typecast #60562

Open Ilanaya opened 2 days ago

Ilanaya commented 2 days ago

πŸ”Ž Search Terms

jsdoc typecast, typecast property access, jsdoc go to definition

πŸ•— Version & Regression Information

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.6.3&filetype=js#code/PQKhAIAEBcE8AcCmATRAzcBvT4B2BDAW0QC5wBnaAJwEtcBzcAXyfADEB7D8EYAKD4BjDrkrgOAIwBW4ALzhQEGAkRZOHVrwAUmJgEoA3H2DBwACQ4A3RFXAB3GtAAW4AAaDqAG1fjrt1+o+EoieHHbgyByI5LgA5NDgVIjC9Lg0AF6qzlkqEeh0jjQiQiJiklIAjHIKYFBwSGpcmsA6+gB0BMRGwqIJ5QBM1Yp1uZjqza16ANqxnYixALpGfEA

πŸ’» Code

/** @typedef {{ name: string }} Foo */

const obj = /** @type {Foo} */({});
// Hover with `ctrl` over `Foo` below doesn't recognize the type definition
const obj1 = /** @type {Foo} */({}).name;
const obj2 = /** @type {Foo} */({})['name'];

πŸ™ Actual behavior

Hovering over Foo with ctrl pressed doesn't recognize the type definition

πŸ™‚ Expected behavior

Hovering over Foo with ctrl pressed recognizes the type definition

Additional information about the issue

No response