Microsoft/TypeScript

Services for non-homomorphic mapped type

Ouverte

#25 607 ouverte le 12 juil. 2018

 (0 commentaire) (3 réactions) (0 personne assignée)TypeScript (13 395 forks)batch import
Domain: LS: Symbol NavigationDomain: Mapped TypesExperience EnhancementHelp WantedSuggestion

Métriques du dépôt

Stars
 (108 860 étoiles)
Métriques de merge PR
 (Métriques PR en attente)

Description

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.

Guide contributeur