CuppaLabs / angular2-multiselect-dropdown

Angular 2 Dropdown Multiselect
https://cuppalabs.github.io/angular2-multiselect-dropdown
MIT License
293 stars 256 forks source link

AngularMultiSelect.html - Type 'undefined' cannot be used as an index type #577

Open jaumarar opened 3 years ago

jaumarar commented 3 years ago

Angular version: 11 angular2-multiselect-dropdown version: 5.0.*

Hi, while executing my npm run build it results on this error

> dashboard@1.3.0
> cross-env NODE_OPTIONS=--max_old_space_size=2048 ./node_modules/.bin/ng "build" "--prod"

√ Browser application bundle generation complete.

Error: node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(7,102): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(13,63): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(25,63): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(24,117): Object is possibly 'undefined'.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(34,100): Object is possibly 'undefined'.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(129,32): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(142,32): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(205,36): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(234,40): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(240,40): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(262,48): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(255,36): Type 'undefined' cannot be used as an index type.
node_modules/angular2-multiselect-dropdown/angular2-multiselect-dropdown.d.ts.AngularMultiSelect.html(34,44): Object is possibly 'undefined'.

NOTE: This error is show even if I don't use the component, it's caused only by importing the module. Also I tryied to remove node_modules, package-lock.json, cache,... and all of that tricks

package.lock

"dependencies": {
    "@angular/core": "11.0.1",
    "angular2-multiselect-dropdown": "5.0.4",
    ...
}

angular.json

{
  "projects": {
    "dashboard": {
      "architect": {
        "build": {
            "styles": [
                "node_modules/angular2-multiselect-dropdown/themes/default.theme.css"
            ],
         }
      }
  }
}

app.module.ts

import { FormsModule } from '@angular/forms';
import { AngularMultiSelectModule } from 'angular2-multiselect-dropdown';

@NgModule({
    declarations: [AppComponent],
    imports: [FormsModule, AngularMultiSelectModule, ...],
    providers: [],
    bootstrap: [AppComponent],
})
export class AppModule {}