angular2-multiselect-dropdown icon indicating copy to clipboard operation
angular2-multiselect-dropdown copied to clipboard

Build error when used with `strictTemplates` enabled

Open devnev opened this issue 5 years ago • 0 comments

I tried enabling Angular's strict template checking on a project and a recurring failure was on all uses of angular2-multiselect-dropdown. The error was always that the object given to [settings] was missing fields. In the documentation, the settings is allowed to be partial, but the type in the library code requires all properties to be set.

Steps to reproduce

Create a new angular project with angular 9+

Edit tsconfig.json to have:

  "angularCompilerOptions": {
    "strictTemplates": true,
  },

Add angular2-multiselect-dropdown as dependency and to app component html with:

<angular2-multiselect [settings]="{}" />

Run ng build --prod (AOT/Ivy is only used for production builds)

Expected outcome:

ng build --prod passes

Actual outcome:

Fails with with an error like:

error TS2740: Type '{}' is missing the following properties from type 'DropdownSettings': singleSelection, text, enableCheckAll, selectAllText, and 13 more.

3   [settings]="{}"
    ~~~~~~~~~~~~~~~

devnev avatar Dec 01 '20 22:12 devnev