feat: declare support for new feature class-covariant-overrides#4924
Merged
mergify[bot] merged 1 commit intomainfrom Sep 15, 2025
Merged
feat: declare support for new feature class-covariant-overrides#4924mergify[bot] merged 1 commit intomainfrom
class-covariant-overrides#4924mergify[bot] merged 1 commit intomainfrom
Conversation
d1ad18e to
f05492d
Compare
rix0rrr
approved these changes
Sep 15, 2025
Contributor
|
Thank you for contributing! ❤️ I will now look into making sure the PR is up-to-date, then proceed to try and merge it! |
Contributor
|
Merging (with squash)... |
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.
This adds support for the new
class-covariant-overridesfeature into@jsii/spec.class-covariant-overridesrelaxes the existing restriction on covariant overrides 1. With the feature it is now allowed to override thetype of readonly class propertiesand thereturn type of class methodswhen extending other classes, as long as the changes are covariant 2 3 to the superclass. Importantly, covariant overrides are still not allowed when implementing interfaces.Compilers that are producing assemblies with covariant class overrides MUST include
class-covariant-overridesin theusedFeaturesset.This feature does not require any changes to the kernels, runtimes or packmak. All generated code already is already correct when given an appropriate assembly. We can now add support for this feature due to the upgrade to
net6.04 which was the only thing blocking it.Proof all of this is working together: #4925
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Footnotes
https://aws.github.io/jsii/user-guides/lib-author/typescript-restrictions/#covariant-overrides-parameter-list-changes ↩
https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science) ↩
As of today this feature strictly applies to class and interface types, event though some built-in types like lists might also be technically covariant. ↩
https://github.com/aws/jsii/pull/4916 ↩