microsoft / TypeScript

TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
https://www.typescriptlang.org
Apache License 2.0
99k stars 12.29k forks source link

Design Meeting Notes, 5/31/2024 #58763

Open DanielRosenwasser opened 4 weeks ago

DanielRosenwasser commented 4 weeks ago

Control Flow Analysis From Callbacks

https://github.com/microsoft/TypeScript/issues/11498

let x: string | number = "okay";

mystery(() => {

});

// Nope! TS thinks this is impossible.
if (x === 10) {
}
DanielRosenwasser commented 4 weeks ago

See #58729 for details.

jcalz commented 4 weeks ago

mystery(() => {}); would be quite mysterious if it can reassign x without an assignment in the body of the callback. I assume this is a typo?

ethanresnick commented 3 weeks ago

@DanielRosenwasser I just wanna say thank you and the team for publishing these design notes. I always learn something from them.