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
let x = new RegExp('');
console.log(x);
x = { ...x };
console.log(x);
The spread operator in the object literal produces a new type different vom the RegExp type of x.
The bad thing happens when the type checker allows the assignment of this object to x of type RegExp.
For example x has non of the methods of RegExp afterwards.
I expect that the compiler rejects assigning a value of wrong type to x.
Compile it with tsc --lib es6,dom foo.ts && node foo.js and get the output:
Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.
Consider this example:
The spread operator in the object literal produces a new type different vom the RegExp type of x.
The bad thing happens when the type checker allows the assignment of this object to
x
of type RegExp.For example x has non of the methods of RegExp afterwards.
I expect that the compiler rejects assigning a value of wrong type to x.
Compile it with
tsc --lib es6,dom foo.ts && node foo.js
and get the output:playground
The text was updated successfully, but these errors were encountered: