Skip to content
New issue

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

Model extends another allow property to become optional #3539

Closed
timotheeguerin opened this issue Jun 6, 2024 · 1 comment · Fixed by #3659
Closed

Model extends another allow property to become optional #3539

timotheeguerin opened this issue Jun 6, 2024 · 1 comment · Fixed by #3659
Assignees
Labels
bug Something isn't working compiler:core Issues for @typespec/compiler triaged:core
Milestone

Comments

@timotheeguerin
Copy link
Member

timotheeguerin commented Jun 6, 2024

 model Base {
  s: string;
}

model Foo extends Base {
  s?: string;
}

Playground Link

The same thing with template constrain fail which was fixed last sprint but seem like this case remain #3290
Playground

@markcowl
Copy link
Contributor

P2

@markcowl markcowl added triaged:core compiler:core Issues for @typespec/compiler labels Jun 11, 2024
github-merge-queue bot pushed a commit that referenced this issue Jul 10, 2024
…rty (#3659)

Closes #3539 

This change disallows overriding a required inherited property with an
optional property.

This error does not take precedence over regular property assignability
rules. In case the property _both_ is optional when the overridden
property is required _and_ has a non-assignable type, both errors will
be reported.

---------

Co-authored-by: Will Temple <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working compiler:core Issues for @typespec/compiler triaged:core
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants