Skip to content

refactor(core): Make unsupported styling type error message clearer#59563

Closed
wartab wants to merge 1 commit intoangular:mainfrom
wartab:unsupported-styling-type-error
Closed

refactor(core): Make unsupported styling type error message clearer#59563
wartab wants to merge 1 commit intoangular:mainfrom
wartab:unsupported-styling-type-error

Conversation

@wartab
Copy link
Copy Markdown
Contributor

@wartab wartab commented Jan 16, 2025

The previous message would sound like a full sentence when using a signal without () (Example: Unsupported styling type function: [Input Signal: neutral]). The new formatting makes it a bit more obvious that the type itself is the problem.

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

When using code such as this:

@Component({
    selector: "comp",
    templateUrl: "./comp.html",
    styleUrls: ["./comp.scss"],
    host: {
        "[class]": "theme",
    },
})
class Comp {
    public theme = input<string>();
}

you get the runtime error:

ERROR Error: ASSERTION ERROR: Unsupported styling type function: [Input Signal: neutral]
    at throwError (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:1936:9) [angular]
    at toStylingKeyValueArray (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:17944:18) [angular]
    at checkStylingMap (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:17811:113) [angular]
    at Module.ɵɵclassMap (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:17771:3) [angular]
    at Comp_HostBindings (http://localhost:4200/chunk-FELJIUSQ.js:100:13) [angular]
    at processHostBindingOpCodes (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:9273:9) [angular]
    at refreshView (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10503:5) [angular]
    at detectChangesInView (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10612:5) [angular]
    at detectChangesInViewIfAttached (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10595:3) [angular]
    at detectChangesInEmbeddedViews (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10571:7) [angular]
    at refreshView (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10472:5) [angular]
    at detectChangesInView (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10612:5) [angular]
    at detectChangesInViewIfAttached (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10595:3) [angular]
    at detectChangesInEmbeddedViews (http://localhost:4200/@fs/C:/Users/project/.angular/cache/19.1.0/project/vite/deps/chunk-GK5E6G5J.js?v=75de14bc:10571:7) [angular]

What is the new behavior?

ERROR Error: ASSERTION ERROR: Unsupported styling type: function ([Input Signal: neutral])

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Note that it could be desirable to have more information about where the error occurred in general. But that's out of the scope of this PR.

@pullapprove pullapprove bot requested a review from alxhub January 16, 2025 11:07
@angular-robot angular-robot bot added the area: core Issues related to the framework runtime label Jan 16, 2025
@ngbot ngbot bot added this to the Backlog milestone Jan 16, 2025
Copy link
Copy Markdown
Contributor

@thePunderWoman thePunderWoman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!

@thePunderWoman thePunderWoman added action: merge The PR is ready for merge by the caretaker target: patch This PR is targeted for the next patch release labels Mar 31, 2025
@thePunderWoman thePunderWoman removed the request for review from alxhub March 31, 2025 19:54
@thePunderWoman thePunderWoman added target: patch This PR is targeted for the next patch release and removed target: patch This PR is targeted for the next patch release labels Mar 31, 2025
@thePunderWoman thePunderWoman force-pushed the unsupported-styling-type-error branch 2 times, most recently from beb939a to 21a0e86 Compare March 31, 2025 20:44
The previous message would sound like a full sentence when using a signal without `()` (Example: Unsupported styling type function: [Input Signal: neutral]). The new formatting makes it a bit more obvious that the type itself is the problem.
@thePunderWoman thePunderWoman force-pushed the unsupported-styling-type-error branch from 21a0e86 to ebf0bf0 Compare March 31, 2025 20:49
thePunderWoman pushed a commit that referenced this pull request Mar 31, 2025
…59563)

The previous message would sound like a full sentence when using a signal without `()` (Example: Unsupported styling type function: [Input Signal: neutral]). The new formatting makes it a bit more obvious that the type itself is the problem.

PR Close #59563
@thePunderWoman
Copy link
Copy Markdown
Contributor

This PR was merged into the repository by commit d29adcc.

The changes were merged into the following branches: main, 19.2.x

@angular-automatic-lock-bot
Copy link
Copy Markdown

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 1, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker area: core Issues related to the framework runtime target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants