microsoft / microsoft/TypeScript
spreading generic type disables excess property checking
Open
Nobody has claimed this yet.
Bug
Domain: check: Excess Property Checking
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
TypeScript Version: 3.3.3333
Search Terms: generic spread
Code
function spread<T extends {foo: string}>(p: T): {foo: string} {
return {...p, bar: ''};
}
Expected behavior:
Excess property error for bar.
Actual behavior:
No error.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the TypeScript 3.3.3333 reproducer in the issue and investigate how excess-property checking handles an object spread from a generic type. Done means the sample reports an excess-property error for bar and a regression test covers the behavior; no source file or test path is named in the issue.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100