🕗 Version & Regression Information
This is the behavior in every version I tried.
⏯ Playground Link
Playground link with relevant code
💻 Code
// Box<T> type is invariant in TtypeBox<T>={get: ()=>T,set: (value: T)=>void}declarefunctionbox<T>(value: T): Box<T>;constbn1=box(0);// Box<number>constbn2: Box<number>=box(0);// Okconstbb1=box(false);// Box<boolean>constbb2: Box<boolean>=box(false);// Error, box<false> not assignable to Box<boolean>🙁 Actual behavior
Error on bb2 is surprising and inconsistent with lack of error on bn2.
🙂 Expected behavior
Expected the box(false) expression to have type Box<boolean> for both bb1 and bb2.
🕗 Version & Regression Information
This is the behavior in every version I tried.
⏯ Playground Link
Playground link with relevant code
💻 Code
🙁 Actual behavior
Error on
bb2is surprising and inconsistent with lack of error onbn2.🙂 Expected behavior
Expected the
box(false)expression to have typeBox<boolean>for bothbb1andbb2.