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.

貢獻者指南