TypeScript Version: 3.5.1, 3.6.3, Nightly
Search Terms:
generic type parameter, generic type constraint, variance
Code
declareconstx0 : <InTextendsboolean|null>(arg : InT)=>boolean;//Expected: Error//Actual : Errorconstx1 : <InTextendsstring>(arg : InT)=>boolean=x0;typeY<In,Out>=<InTextendsIn>(arg : InT)=>Out;declareconsty0 : Y<boolean|null,boolean>;//Expected: Error//Actual : OKconsty1 : Y<string,boolean>=y0;
Expected behavior:
y1 = y0 assignment should fail
Actual behavior:
y1 = y0 assignment passes
Playground Link:
3.5.1 Playground
3.6.3 Playground
Nightly Playground
Related Issues:
TypeScript Version: 3.5.1, 3.6.3, Nightly
Search Terms:
generic type parameter, generic type constraint, variance
Code
Expected behavior:
y1 = y0assignment should failActual behavior:
y1 = y0assignment passesPlayground Link:
3.5.1 Playground
3.6.3 Playground
Nightly Playground
Related Issues: