Skip to content

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

Open
@andrewbranch

Description

@andrewbranch

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    APIRelates to the public API for TypeScriptBugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions