fix(transformers): handle single string styles or styleUrl property #2186
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.
Summary
With Angular v17, the
styles
property of theComponent
decorator additionally accepts a single string value instead of an array. Also, there's a newstyleUrl
property that accepts a single string value. The change was made at angular/angular#51715.This PR updates the transformer to handle the additional use cases and strip the properties accordingly. Without these changes, tests running over components that have those properties, fail.
Test plan
I tested the fix as part of the Angular 17 support work in Nx. This particular PR nrwl/nx#20146 is currently failing due to this issue. I tested the changes in this PR over those failing tests, and the failures are resolved.
Does this PR introduce a breaking change?
Other information