-
Notifications
You must be signed in to change notification settings - Fork 25.5k
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
fix(compiler-cli): libraries compiled with v16.1+ breaking with framework v16.0.x apps #50714
Conversation
…ar framework v16.0.x If a library is compiling with Angular v16.1.0, the library will break for users that are still on Angular v16.0.x. This happens because the `DirectiveDeclaration` or `ComponentDeclaration` types are not expecting an extra field for `signals` metadata. This field was only added to the generic types in `16.1.0`- so compilations fail with errors like this: ``` Error: node_modules/@angular/material/icon/index.d.ts:204:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 9 type arguments. ``` To fix this, we quickly roll back the code for inserting this metadata field. That way, libraries remain compatible with all v16.x framework versions. We continue to include the `signals` metadata if `signals: true` is set. This is not public API anyway right now- so cannot happen- but imagine we expose some signal APIs in e.g. 16.2.x, then we'd need this metadata and can reasonably expect signal-component library users to use a more recent framework core version.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// TODO(signals): Always include this metadata starting with v17. Right | ||
// now Angular v16.0.x does not support this field and library distributions | ||
// would then be incompatible with v16.0.x framework users. | ||
if (meta.isSignal) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'm not sure we'd even need to revert this until we add another parameter after it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, although I think making all optional fields required over time is beneficial as we can then introduce required fields in the future, without having to re-order.
…h Angular framework v16.0.x Update golden
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it mean "forward compatibility"? I mean, we don't have guarantees for libraries compiled with 16.1 when it comes to working with 16.0. Things might work by accident, but I don't think we should go out of our ways to support this situation. Doing so would send a precedent / expectations and I'm not sure we want to find ourselves there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After discussing it further we want to maintain backward compatibility across the same set of major versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed-for: global-approvers
This PR was merged into the repository by commit 12bad65. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
…ar framework v16.0.x (angular#50714) If a library is compiling with Angular v16.1.0, the library will break for users that are still on Angular v16.0.x. This happens because the `DirectiveDeclaration` or `ComponentDeclaration` types are not expecting an extra field for `signals` metadata. This field was only added to the generic types in `16.1.0`- so compilations fail with errors like this: ``` Error: node_modules/@angular/material/icon/index.d.ts:204:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 9 type arguments. ``` To fix this, we quickly roll back the code for inserting this metadata field. That way, libraries remain compatible with all v16.x framework versions. We continue to include the `signals` metadata if `signals: true` is set. This is not public API anyway right now- so cannot happen- but imagine we expose some signal APIs in e.g. 16.2.x, then we'd need this metadata and can reasonably expect signal-component library users to use a more recent framework core version. PR Close angular#50714
…ar framework v16.0.x (angular#50714) If a library is compiling with Angular v16.1.0, the library will break for users that are still on Angular v16.0.x. This happens because the `DirectiveDeclaration` or `ComponentDeclaration` types are not expecting an extra field for `signals` metadata. This field was only added to the generic types in `16.1.0`- so compilations fail with errors like this: ``` Error: node_modules/@angular/material/icon/index.d.ts:204:18 - error TS2707: Generic type 'ɵɵComponentDeclaration' requires between 7 and 9 type arguments. ``` To fix this, we quickly roll back the code for inserting this metadata field. That way, libraries remain compatible with all v16.x framework versions. We continue to include the `signals` metadata if `signals: true` is set. This is not public API anyway right now- so cannot happen- but imagine we expose some signal APIs in e.g. 16.2.x, then we'd need this metadata and can reasonably expect signal-component library users to use a more recent framework core version. PR Close angular#50714
If a library is compiling with Angular v16.1.0, the library will break for users that are still on Angular v16.0.x. This happens because the
DirectiveDeclaration
orComponentDeclaration
types are not expecting an extra field forsignals
metadata. This field was only added to the generic types in16.1.0
- so compilations fail with errors like this:To fix this, we quickly roll back the code for inserting this metadata field. That way, libraries remain compatible with all v16.x framework versions.
We continue to include the
signals
metadata ifsignals: true
is set. This is not public API anyway right now- so cannot happen- but imagine we expose some signal APIs in e.g. 16.2.x, then we'd need this metadata and can reasonably expect signal-component library users to use a more recent framework core version.