Skip to content
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

getTypeAtLocation fails for import specifiers that resolve to a type alias #35233

Open
andrewbranch opened this issue Nov 20, 2019 · 0 comments
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript
Milestone

Comments

@andrewbranch
Copy link
Member

Baseline test:

// @Filename: /a.ts
class A {}
export type B = A;

// @Filename: /b.ts
import { B as C } from './a';

Types baseline:

=== /a.ts ===
class A {}
>A : A

export type B = A;
>B : A

=== /b.ts ===
import { B as C } from './a';
>B : any
>C : any

Note that during the normal course of checking, everything works fine, because we don’t ask for the type of the import specifier. If someone were to use C, we’d ask for the type of the type reference, and we’d start by resolving the alias all the way to its origin. So only when the baseline writer specifically asks for the type at B and C do we hit this bug. So, it’s fairly unimportant. I investigated this and an opening the issue to document that some any readouts in #35200 are exhibiting some existing poor behavior, and fixing it there would be out of scope.

@andrewbranch andrewbranch added Bug A bug in TypeScript API Relates to the public API for TypeScript labels Nov 20, 2019
@andrewbranch andrewbranch added this to the Backlog milestone Nov 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Relates to the public API for TypeScript Bug A bug in TypeScript
Projects
None yet
Development

No branches or pull requests

1 participant