Microsoft/TypeScript
GitHub ã§èŠãString completions for `keyof T` not shown when an object literal `T` was provided in a prior argument
Open
#47,479 opened on 2022幎1æ17æ¥
Domain: LS: Completion ListsExperience EnhancementHelp WantedSuggestion
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
Bug Report
ð Search Terms
Incorrect suggestions
ð Version & Regression Information
This bug occurs in v4.5.4 and nightly version. (Possibly every version)
⯠Playground Link
Playground link with relevant code
ð» Code
type Methods = {
[key: string]: (param: {
apple: 'apple'
}) => any
}
function testFunc<M extends Methods>(options: {
methods: M,
keys: keyof M
}): void {}
testFunc({
methods: {
myMethod: (param) => {
console.log(param.apple)
}
},
keys:
})
ð Actual behavior
When hovering the word "keys" in line 18, it shows its type is "myMethod". And when i start typing for its value, "myMethod" is not being suggested.
ð Expected behavior
"myMethod" should be suggested when typing the value in line 18.