Skip to content

HTML: Breaking Angular input with a cast to number #5404

@maxime1992

Description

@maxime1992

Prettier 1.15.1
Playground link

"htmlWhitespaceSensitivity": "ignore"

Input:

  <div class="tool-svg" fxFlex="10%" fxLayout="center center">
    <cnc-tool-assembly-svg
      [tool]="toolAssembly.tool"
      [stickout]="+toolAssembly.stickoutMm"
    ></cnc-tool-assembly-svg>
  </div>

Output:

  <div class="tool-svg" fxFlex="10%" fxLayout="center center">
    <cnc-tool-assembly-svg [tool]="toolAssembly.tool" [stickout]="toolAssembly.stickoutMm - "></cnc-tool-assembly-svg>
  </div>

Problem here:

[stickout]="+toolAssembly.stickoutMm"

is updated to:

[stickout]="toolAssembly.stickoutMm - "

Expected behavior:

⚠️ Behavior shouldn't be changed ⚠️

Metadata

Metadata

Assignees

No one assigned

    Labels

    lang:angularIssues affecting Angular template (not general JS/TS issues used for Angular)locked-due-to-inactivityPlease open a new issue and fill out the template instead of commenting.priority:highCode is printed in a way that alters the AST, breaks syntax, or is a significant regression. Urgent!status:has prIssues with an accompanying pull request. These issues will probably be fixed soon!

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions