Skip to content

Improve error for amendments without defaults - #1841

Open
henriquejsza wants to merge 1 commit into
apple:mainfrom
henriquejsza:improve-amend-no-default-error
Open

Improve error for amendments without defaults#1841
henriquejsza wants to merge 1 commit into
apple:mainfrom
henriquejsza:improve-amend-no-default-error

Conversation

@henriquejsza

Copy link
Copy Markdown

When prop { ... } tries to amend a property whose declared type has no default value, report:

Cannot instantiate type `...` because it has no default value.

This is limited to object-body amendments. Regular reads and undefined values from explicit property bodies keep their existing errors.

Adds snippet coverage for object and class property amendments, including a union whose selected member has no default value.

Fixes #1368

Report the missing default value only when an object body is trying to amend an implicitly defaulted property. Preserve undefined-value errors from explicit property bodies.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Amending an undefined property with a union type with no default member should produce a more specific error

1 participant