Skip to content

getTypeAtLocation fails on a PropertyAccessExpression in a type position #37901

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
uniqueiniquity opened this issue Apr 10, 2020 · 2 comments · Fixed by #39363
Closed

getTypeAtLocation fails on a PropertyAccessExpression in a type position #37901

uniqueiniquity opened this issue Apr 10, 2020 · 2 comments · Fixed by #39363
Assignees
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue

Comments

@uniqueiniquity
Copy link
Contributor

uniqueiniquity commented Apr 10, 2020

TypeScript Version: 3.8.3

Search Terms:
getTypeAtLocation

Code

declare class SomeClass implements NodeJS.CallSite {
  //
}

Expected behavior:
getTypeAtLocation on the PropertyAccessExpression node for NodeJS.CallSite should return CallSite.

Actual behavior:
Instead, it returns any with intrinsic name error.

Notes
Note that getTypeAtLocation on the parent ExpressionWithTypeArguments does actually succeed.

Playground Link: N/A

Related Issues: #35233

Thanks to @bradzacher for finding this!

@bradzacher
Copy link
Contributor

bradzacher commented Apr 11, 2020

Related issue: typescript-eslint/typescript-eslint#1868
Repro repo: https://github.com/bradzacher/types-node-any-repro

Absolutely minimal repro:

namespace Test {
    export interface Test {}
}
class Foo implements Test.Test {}

ts-ast-viewer repl
image

@cruhl
Copy link

cruhl commented Jul 1, 2020

I just ran into this while using TypeScript+ESLint:

Unsafe member access .toSortedLine on an any value.

Where the "any value" is a perfectly normal namespace.

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.

5 participants