fix exact optional argument diagnostic#4228
Open
a-tarasyuk wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a regression test and adjusts diagnostic selection so that, with exactOptionalPropertyTypes, argument assignability errors include a more specific message when optional properties are unassignable due to undefined.
Changes:
- Introduces a new compiler test case + baselines for
exactOptionalPropertyTypesargument errors. - Updates relation error reporting to emit a specialized diagnostic when
exactOptionalPropertyTypescauses optional-property unassignability.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| testdata/tests/cases/compiler/exactOptionalPropertyTypesArgumentError.ts | New repro test asserting the argument error messaging under exactOptionalPropertyTypes. |
| testdata/baselines/reference/compiler/exactOptionalPropertyTypesArgumentError.types | Adds the expected type baseline for the new test. |
| testdata/baselines/reference/compiler/exactOptionalPropertyTypesArgumentError.symbols | Adds the expected symbol baseline for the new test. |
| testdata/baselines/reference/compiler/exactOptionalPropertyTypesArgumentError.errors.txt | Adds the expected error text baseline showing the specialized diagnostic. |
| internal/checker/relater.go | Emits a more specific diagnostic when exactOptionalPropertyTypes is enabled and optional-property unassignability is detected. |
Contributor
Author
|
@ahejlsberg Do we need to handle this case as Strada does, or is this a case where we're intentionally taking a different direction? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4221