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
typeFoo={bar: number}letfoo: Foo={bar: 1}foo.baz=1//Property 'baz' does not exist on type 'Foo'.foo={...foo,baz: 1}//Type '{ baz: number; bar: number; }' is not assignable to type 'Foo'. Object literal may only specify known properties, and 'baz' does not exist in type 'Foo'.foo={...foo, ...{baz: 1}}// no error
TypeScript Version: 4.2.0-dev.20201126
Search Terms:
spread operator type safe
Code
Expected behavior:
error on the last line as property
baz
does not exist on typeFoo
Actual behavior:
no error
Playground Link:
https://www.typescriptlang.org/play?ts=4.2.0-dev.20201126#code/C4TwDgpgBAYg9nKBeKBvARgQwE4C4oB2ArgLboTYC+AsAFAA2EwUAZgvvIihjvgIw1adNnAB0WAF7IofKAHo5ABWxxI2UFADkkzVAAmcCAGdCcZhAAeASyPM4BKKEhbOm0cITTUonyIA0UJL8UJTycgAq4NCaqIGYEvjEZBQA3HF4hKTk2GmUujamzJhGRlYA5gSY6IyOiE7RrqJQAPLoAFYQAMbM9FbAFJj0UCSYIFD29GNGkJ1WLGMA1gRwAO4OYCpqwFbGAZgEelo6+oYmy+bWtlBWDvUuCG4eXGg+ov5QrzwJMqGhCqZQCgqbBAA
Related Issues:
The text was updated successfully, but these errors were encountered: