BugDomain: check: Type InferenceHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
Generics
ð Version & Regression Information
⯠Playground Link
ð» Code
function func<
T1,
T3 extends { [key: string]: (context: T1) => void },
T4 = {}, // Commenting out this section of code makes it work properly.
>(data: {
T: T1;
K: T3 & ThisType<T1 & T3>;
}) {
}
func({
T: {
bbb: 123,
aaa() { return 333; },
},
K: {
bbb(context) {
console.log(context.aaa());
console.log(context.bbb);
this.ccc();
},
ccc() { },
},
});
ð Actual behavior
display an error message:
'context' is of type 'unknown'. 'context' is of type 'unknown'. 'T4' is declared but its value is never read. 'data' is declared but its value is never read.
ð Expected behavior
The type of 'context' should already be determined; it shouldn't be 'unknown'.
Additional information about the issue
No response