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
TypeScript Version: Nightly, 3.7.5
Search Terms: excess property, computed property
Code
const a = <T>(shape: T | (() => T)): T => { return shape instanceof Function ? shape() : shape; } //Case 1 a<{ x: string }>(() => ({ x: '', o: '' })); // I expect this to fail //Case 2 a<{ x: string }>({ x: '', o: '' }); // Fails as expected
Expected behavior: I expect Case 1 to show error similar to Case 2 because returned object contains more properties than described in generic type.
Case 1
Case 2
Actual behavior: Case 1 is a valid typescript
Playground Link: Playground Link
The text was updated successfully, but these errors were encountered:
Duplicate of #12632 which requires #241
(Sorry if couple of comments were posted - GH had issues with API)
Sorry, something went wrong.
This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.
Successfully merging a pull request may close this issue.
TypeScript Version: Nightly, 3.7.5
Search Terms: excess property, computed property
Code
Expected behavior:
I expect
Case 1
to show error similar toCase 2
because returned object contains more properties than described in generic type.Actual behavior:
Case 1
is a valid typescriptPlayground Link: Playground Link
The text was updated successfully, but these errors were encountered: