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
After we added conditional spreading behavior after the RC, we saw that it was more prone to being found.
declareletr: {[key: string]: number};letfromExpression={ ...bool&&{x: 3}};r={ ...fromExpression};// OkdeclareletfromAnnotation: {x?: number};r={ ...fromAnnotation};// Error: Type 'undefined' is not assignable to type 'number'.
Type from x includes undefined in fromAnnotation.
The behavior we're seeing right now is what's in the RC.
The behavior is not new - it existed, it was just harder to observe.
declareletz: {a: string}|{};constzz={ ...z}
Have there been any other issues filed on this in the past?
First, it is strange that an optional property is not assignable to an index signature.
It is unclear if it's actually undefined or missing.
These are "past sins" that we can't correct.
Co-mingling undefined means we can't do anything.
Maybe one rule: allow undefined to be written to an index signature.
We also just have a bug - you cannot have properties that don't have undefined in their type.
Should we allow optional properties to be assigned to an index signature?
General agreement - we had some sense of urgency because we thought it became MUCH more observable - but probably just only a little bit more observable.
Conditional Spread is More Prone to Losing
| undefined
#41418
x
includesundefined
infromAnnotation
.undefined
ormissing
.undefined
means we can't do anything.undefined
to be written to an index signature.undefined
in their type.obj2
is not assignable toa
, butq
is assignable toa
.Backing out
resolve
Changes#41497
Did you forget to include 'void' in your type argument to 'Promise'?
errors aren't related to these.void
reform.abstract
Constructor Types#36392
abstract
keyword.abstract new () => any
.lib.d.ts
, we haveConstructor
.Constructor
type.Constructor
doesn't allowabstract
classes, so you can't write a mixin on abstract classes.abstract
constructor, you must declare it to beabstract
.readonly
- promising you won't do something with the type (i.e. construct it directly).The text was updated successfully, but these errors were encountered: