Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
_s
on Nov 5, 2019
|
parent
|
context
|
favorite
| on:
TypeScript 3.7
Perhaps explicitly setting the types might do it?
const x: number[]= [1,2] const y: number | undefined = x[666] const z: number = y + 3
EDIT: Just tried, still works
ht85
on Nov 5, 2019
[–]
It works because `undefined + number -> NaN`, and NaN is a number.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: