Description Walkthrough of JSX SFCs and IntrinsicAttributes Walkthrough of Salsa JS Class inference Type inference for intersection/union types
Grand unified theory of enums
Clear your mind and let's go on a journey of imagination 🌈 ⭐ Imagine a "string enum" enum Direction { North = 'north', South = 'south', ...} type NS = Direction.North|Direction.SouthWhat does this declaration actually mean?
It produces the following declarations
namespace Direction {const North = "north" <- const North: North or const North: Direction ?type North = "north"}type Direction = Direction.North | Direction.South | ... It's not just contextual typing that needs to apply here
But we could tweak the rules What should the assignability of strings to string literal types be? This logic applies equally well to numbers! How would we enforce enum branding in this scheme for numeric enums?
Add the ability to create 'fresh' types A general solution for many problems We could also enforce structural matching of the names What about symbols?
Still no clear approach to handling symbol identity Other primitive types are coming
Mostly numbers (UInt64, rational, bignum, struct, vector, etc...) What should we inline?
Maybe const x = 10 ? With an opt-in Mutable vs immutable widening, e.g.
let x = Direction.North; // x: Directionconst x = Direction.North; // x: Direction.NorthWhat are the effects in e.g. function f() { let/const x = Direction.North; return x; } ? Reactions are currently unavailable
You can’t perform that action at this time.
IntrinsicAttributesenum Direction { North = 'north', South = 'south', ...}type NS = Direction.North|Direction.Southnamespace Direction {const North = "north"<-const North: Northorconst North: Direction?type North = "north"}type Direction = Direction.North | Direction.South | ...symbols?UInt64,rational,bignum,struct,vector, etc...)const x = 10? With an opt-inlet x = Direction.North; // x: Directionconst x = Direction.North; // x: Direction.Northfunction f() { let/const x = Direction.North; return x; }?