Closed
Description
TypeScript Version:
Failing in 3.3.0-dev.20190117
Last version 3.1.6 passing the test
Search Terms:
satisfy constraint subtype FilterFlags
Code
function func1<Base extends { [key: string]: any }, Type extends Base[Key], Key extends keyof Base>(
attrName: Key,
attrType: Type
) {
console.log("func1");
}
function func1String<Base extends { [key: string]: any }, Key extends keyof Base>(attrName: Key) {
func1<Base, string, Key>(attrName, "string");
}
Expected behavior:
Compilation should pass (like it does on 3.1.6)
Actual behavior:
Compilation fails
test_ts.ts:18:15 - error TS2344: Type 'string' does not satisfy the constraint 'Base[Key]'.
18 func1<Base, string, Key>(attrName, "string");
~~~~~~
Related Issues:
Metadata
Metadata
Assignees
Labels
No labels