Re:TypeScript 3.7 Beta
by mcaruso on Wednesday October 02, 2019 @09:45AM
(#21136333)
`const` variables are actually inferred without widening. So in your example `dir` would be inferred as `"up"`, not `string`. If you use `let` (or `var`) however that would be true.
[ Parent
| on HN ]
My god, you are right!
(example in typescript playground: https://www.typescriptlang.org/play/#code/C4TwDgpgBAIglgJwgY...)