We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Search Terms:
conditional keys object properties not checked
Code
interface MyInterface { a: number; b: number; } const myFunc = (): Partial<MyInterface> => { return { a: 1, b: 2, ...(true && { c: 'oops, no error' }), } }
Expected behavior:
I should have an error saying "c key does not exist in MyInterface".
c
MyInterface
Actual behavior:
I do not get an error.
Playground Link:
Playground Link
Related Issues:
I could not find any.
Please note that the values are checked. This does produce an error:
interface MyInterface { a: number; b: number; } const myFunc = (): Partial<MyInterface> => { return { a: 1, ...(true && { b: 'okay I get an error' }), } }
The text was updated successfully, but these errors were encountered:
Excess property checks do not occur for spread objects. This is intentional, see #19775.
Sorry, something went wrong.
Oh! Indeed. I did not pinpoint the problem precisely enough, I should've known it was related to spread operators.
Thank you for your very quick and helpful answer! We may close the issue! Sorry about the duplicate 😊
No branches or pull requests
Search Terms:
conditional keys object properties not checked
Code
Expected behavior:
I should have an error saying "
c
key does not exist inMyInterface
".Actual behavior:
I do not get an error.
Playground Link:
Playground Link
Related Issues:
I could not find any.
Please note that the values are checked. This does produce an error:
The text was updated successfully, but these errors were encountered: