-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
Bug Report
When using mapped type with key remapping, definitions for the properties of mapped types are no longer discoverable. Though, references are still in there.
🔎 Search Terms
mapped types, key remapping, language server, editor hints
🕗 Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about mapped types
⏯ Playground Link
Playground link with relevant code
💻 Code
const object = {
a: 1, // ✅ can go to definition/references, can rename
b: 2, // ✅ can go to definition/references, can rename
c: 'ok', // ✅ no references, can rename
};
/** ✅ rename of {@link object.a} and {@link object.b} will correctly rename all the references as well */
const remapByKey: {
[P in keyof typeof object as P extends 'c' ? never : P]: 0;
} = { a: 0, b: 0 };
remapByKey.a; // ❌ can't go to definition, can't rename, ✅ yet highlights definition
remapByKey.b; // ❌ can't go to definition, can't rename, ✅ yet highlights definition
remapByKey.c; // ✅ errors as expected
const remapByValue: {
[P in keyof typeof object as typeof object[P] extends string ? never : P]: 0;
} = { a: 0, b: 0 };
remapByValue.a; // ❌ can't go to definition, can't rename, ✅ yet highlights definition
remapByValue.b; // ❌ can't go to definition, can't rename, ✅ yet highlights definition
remapByValue.c; // ✅ errors as expected
🙁 Actual behavior
🙂 Expected behavior
Capability to navigate to definition of remapped property.
bentefay, thomasballinger, sachinraja and zyhou
Metadata
Metadata
Assignees
Labels
Experience EnhancementNoncontroversial enhancementsNoncontroversial enhancementsSuggestionAn idea for TypeScriptAn idea for TypeScript