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
I'm seeing some inconsistent and confusing behavior regarding non-widening string literal types.
The type checker treats ... += ... differently than ... = ... + ... which looks like a bug to me.
Code:
Example 1:
constempty: ""="";letfoo=empty;foo+="bar";// OK
Example 2:
constempty: ""="";letfoo=empty;foo=foo+"bar";// Error: Type 'string' is not assignable to type '""'.
Expected behavior: Either both examples type-check correctly or none of them do.
Actual behavior: Example 1 type-checks correctly while Example 2 doesn't.
The text was updated successfully, but these errors were encountered:
TypeScript Version: 2.1.5
I'm seeing some inconsistent and confusing behavior regarding non-widening string literal types.
The type checker treats
... += ...
differently than... = ... + ...
which looks like a bug to me.Code:
Example 1:
Example 2:
Expected behavior: Either both examples type-check correctly or none of them do.
Actual behavior: Example 1 type-checks correctly while Example 2 doesn't.
The text was updated successfully, but these errors were encountered: