You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Spread tends to introduce a lot of potential unsoundness and should be used with care. There's nothing really in TS currently that addresses the difference in semantics between property access and something like spread or Object.keys (at least as far as I know). Here's another example where spread can land you in trouble with properties that are unset vs explicitly undefined.
While I'd love to see the team address stuff like that at some point, I don't know how far up the priority list it really is, and what the trade offs would be in terms of complexity, perf and "false positives" (rejecting code that is actually fine) for the compiler.
This is effectively the same as #9726 (if we did anything, we would handle ownness/enumerability as part of some combined effort to address exactly this scenario)
TypeScript Version: 3.9.3
Search Terms: strictNull spread
Code
Expected behavior: should print
res=foo string
or result in a type error saying that property foo is undefined in the line marked with<==
Actual behavior: prints "res=undefined"
Playground Link:
Related Issues: no
The text was updated successfully, but these errors were encountered: