angular2-multiselect-dropdown
angular2-multiselect-dropdown copied to clipboard
Build error when used with `strictTemplates` enabled
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]="{}"
~~~~~~~~~~~~~~~