Microsoft/TypeScript

Services for non-homomorphic mapped type

Open

#25.607 aperta il 12 lug 2018

Vedi su GitHub
 (0 commenti) (3 reazioni) (0 assegnatari)TypeScript (6726 fork)batch import
Domain: LS: Symbol NavigationDomain: Mapped TypesExperience EnhancementHelp WantedSuggestion

Metriche repository

Star
 (48.455 star)
Metriche merge PR
 (Merge medio 6g 17h) (9 PR mergiate in 30 g)

Descrizione

TypeScript Version: 3.0.0-dev.20180712

Code

interface I {
 a: number;
 b: number;
}
type J = { [K in "b"]: I[K] };
declare const j: J;
j.b; // Go-to-definition does not work

Expected behavior:

Since the type we're getting is I[K], the mapped property symbol should have a reference back to the corresponding property in I.

Actual behavior:

The mapped type creates an unrelated property symbol and services don't work.

Guida contributor