TIL `JSON.stringify(undefined) === undefined`. @flowtype and @typescriptlang both have incorrect type definitions of `string` instead of `string | void`.
Flow: https://github.com/facebook/flow/blob/master/lib/core.js#L477-L481 …
TypeScript:https://github.com/Microsoft/TypeScript/blob/master/lib/lib.es5.d.ts#L1063 …
-
-
It would be a better idea to just disallow undefined as an input value for Flow. It’s not something that should be done anyway.
-
Need to disallow functions too: `JSON.stringify(function() {}) === undefined`.
- 2 more replies
New conversation -
-
-
I'd first vouch for disallowing you to pass undefined as an argument. If this causes a bug it's probably the input that's unexpectedly undefined in the first place.
-
I'm also not as worried about all the errors making it return undefined would suddenly surface as I am of the performance implications. It's just one more if, but running every time you stringify
#webspeed team amirite
End of conversation
New conversation -
-
-
A universe where stringify is typed one way in Flow and another way in TS seems worse!
Thanks. Twitter will use this to make your timeline better. UndoUndo
-
-
-
Soundness but not above all else. There are still tradeoffs made. for example, access index access is still unsound. should return undefined as well
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 