Skip to content

ng cli build --prod fails when activating noUnusedParameters in tsconfig.json #4443

@reppners

Description

@reppners

Bug, feature request, or proposal:

Bug/Improvement

What is the expected behavior?

Should be able to build with ng build --prod when having compilerOptions.noUnusedParameters: true in tsconfig.json

What is the current behavior?

Build fails with

ERROR in my-project/src/$$_gendir/node_modules/@angular/material/typings/index.ngfactory.ts (2252,41): 'l' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdButton.html (8,1): 'v' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdAnchor.html (8,1): 'v' is declared but never used.

ERROR in my-project/src/$$_gendir/node_modules/@angular/material/typings/index.ngfactory.ts (3345,31): 'l' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdInputContainer_Host.html (2,1): '$event' is declared but never used.

ERROR in my-project/src/$$_gendir/node_modules/@angular/material/typings/index.ngfactory.ts (4539,31): 'l' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdListItem_Host.html (2,1): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdSelect.html (23,5): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdSelect.html (2,1): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdSelect.html (15,7): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdSidenavContainer.html (2,1): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdTabGroup.html (5,3): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdTabHeader.html (2,1): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdTabHeader.html (12,3): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdTabHeader.html (20,1): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdButtonToggle.html (17,1): 'v' is declared but never used.

ERROR in my-project/src/$$_gendir/node_modules/@angular/material/typings/index.ngfactory.ts (7426,31): 'l' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.MdSlideToggle_Host.html (2,1): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.SimpleSnackBar.html (3,1): '$event' is declared but never used.

ERROR in my-project/node_modules/@angular/material/typings/index.d.ts.TooltipComponent_Host.html (2,1): '$event' is declared but never used.

What are the steps to reproduce?

  • create fresh project ng new my-project
  • install and include @angular/material as per the docs
  • set "noUnusedParameters": true in the projects tsconfig.json
  • run ng build --prod

What is the use-case or motivation for changing an existing behavior?

Apps using material should be able to compile with noUnusedParameters: true in tsconfig.json.

Which versions of Angular, Material, OS, browsers are affected?

"@angular/animations": "^4.1.0",
"@angular/common": "^4.0.0",
"@angular/compiler": "^4.0.0",
"@angular/core": "^4.0.0",
"@angular/material": "^2.0.0-beta.3",
"@angular/cli": "1.0.1",

Is there anything else we should know?

Looks like this is some generated code from html templates. I don't know if it's even the fault of angular material.

The fix would be to define parameters with a leading _. See microsoft/TypeScript#9860.

Metadata

Metadata

Assignees

Labels

P5The team acknowledges the request but does not plan to address it, it remains open for discussionfeatureThis issue represents a new feature or feature request rather than a bug or bug fixrefactoringThis issue is related to a refactoring

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions