Microsoft/TypeScript

Services for non-homomorphic mapped type

开放

#25,607 创建于 2018年7月12日

 (0 条评论) (3 个反应) (0 位负责人)TypeScript (13,395 个派生)batch import
Domain: LS: Symbol NavigationDomain: Mapped TypesExperience EnhancementHelp WantedSuggestion

仓库指标

星标
 (108,860 个星标)
PR 合并指标
 (PR 指标待抓取)

描述

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.

贡献者指南