Skip to content

In JS, imported class type references resolve to static, not instance type. #34671

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

Closed
sandersn opened this issue Oct 23, 2019 · 1 comment · Fixed by #34683
Closed

In JS, imported class type references resolve to static, not instance type. #34671

sandersn opened this issue Oct 23, 2019 · 1 comment · Fixed by #34683
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@sandersn
Copy link
Member

// @filename: first.js
class C {
  s() { }
}
module.exports.C = C
// @filename: test.js
/** @typedef {import('./first').C} C */
/** @param {C} c */
function demo(c) {
  c.s
}

Expected: no error and c.s: () => {}.

Actual: Property 's' does not exist on 'typeof C'.

@sandersn sandersn self-assigned this Oct 23, 2019
@sandersn sandersn added this to the TypeScript 3.7.2 milestone Oct 23, 2019
@sandersn sandersn added the Bug A bug in TypeScript label Oct 23, 2019
@sandersn
Copy link
Member Author

Broken by #34515

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant