Skip to content

ivy: Boolean inputs cause compile errors #17495

@asapach

Description

@asapach

Reproduction

(StackBlitz doesn't seem to support ivy)

Steps to reproduce:

  1. npm install -g @angular/cli@next
  2. ng new app
  3. ng add @angular/material
  4. ng update @angular/material --next
  5. Add a basic button example with a boolean input:
<button mat-button disabled>Disabled</button>

Expected Behavior

The build should pass

Actual Behavior

ERROR in src/app/app.component.html:339:22 - error TS2322: Type 'string' is not assignable to type 'boolean'.

339   <button mat-button disabled>Disabled</button>
                         ~~~~~~~~

  src/app/app.component.ts:5:16
    5   templateUrl: './app.component.html',
                     ~~~~~~~~~~~~~~~~~~~~~~
    Error occurs in the template of component AppComponent.

This usage is prevalent in Material and CDK (e.g. cdkTrapFocus), so it's causing a lot of errors for consumers experimenting with ivy. Any input that relies on coerceBooleanProperty() is subject to this problem.

Environment

  • Angular: 9.0.0-next.13
  • CDK/Material: 9.0.0-next.0
  • Browser(s):
  • Operating System (e.g. Windows, macOS, Ubuntu):

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions