Actually TypeScript errors on the second one!
-
-
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Further, this should also be a warning: const nums = [1, 2, 3]; const num: number = nums[4]; // impossible, no bounds check
Show this thread -
For arrays of unknown length, the type should be `?T`. You can support refinements of `arr.length` to avoid a majority of these.
Show this thread - 2 more replies
New conversation -
-
-
As far as I know, very few type systems of any language do the dependent type gymnastics to treat that as a specifi literal rather than just “some string”
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.
he/him 