TypeScript Version: 3.1.0-dev.20180810
Code
constf=<Textends{[K0inK]: string;}&{cool: string;},KextendskeyofT>(t: T,k: K)=>{consts: string=t[k];};Expected behavior: Successful compilation
Actual behavior: I get the following error:
error TS2322: Type 'T[K]' is not assignable to type 'string'.
const s: string = t[k];
~
Playground Link:Link
Additional Notes: This compiles successfully (link):
constf=<Textends{[K0inK]: string;}&{cool: string;},KextendskeyofT>(t: T,k: K)=>{consts: string=t['cool'];};as does this (link):
constf=<Textends{[K0inK]: string;},KextendskeyofT>(t: T,k: K)=>{consts: string=t[k];};
TypeScript Version: 3.1.0-dev.20180810
Code
Expected behavior: Successful compilation
Actual behavior: I get the following error:
Playground Link:Link
Additional Notes: This compiles successfully (link):
as does this (link):