microsoft / microsoft/TypeScript
New error: constructor is required in Object
Open
Nobody has claimed this yet.
Bug
Domain: lib.d.ts
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Bug Report
🔎 Search Terms
Constructor, Object
🕗 Version & Regression Information
- This changed between versions 4.0.5 and 4.1.3
⏯ Playground Link
Playground link with relevant code
💻 Code
declare const x: Object | undefined;
declare const y: Object;
const a: Object = { "a": 1, ...x }; // Error (constructor required in type Object)
const b: Object = { "b": 1, ...y }; // Not an error
🙁 Actual behavior
Error
🙂 Expected 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 by opening the linked TypeScript Playground and reproducing the difference between the Object | undefined and Object spreads in the provided code. Compare the behavior across versions 4.0.5 and 4.1.3; done means the first assignment no longer reports the constructor-required error while the existing valid case remains valid.
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
- Mostly clear
- Newbie friendliness
- 35/100