0

I was trying to add spinner to my angular project but got weird error:

my ngx-spinner-component.d.ts line with error: ngOnDestroy(): void; static ɵfac: i0.ɵɵFactoryDeclaration<NgxSpinnerComponent, [null, null, null, { optional: true; }]>; static ɵcmp: i0.ɵɵComponentDeclaration<NgxSpinnerComponent, "ngx-spinner", never, { "bdColor": { "alias": "bdColor"; "required": false; }; "size": { "alias": "size"; "required": false; }; "color": { "alias": "color"; "required": false; }; "type": { "alias": "type"; "required": false; }; "fullScreen": { "alias": "fullScreen"; "required": false; }; "name": { "alias": "name"; "required": false; }; "zIndex": { "alias": "zIndex"; "required": false; }; "template": { "alias": "template"; "required": false; }; "showSpinner": { "alias": "showSpinner"; "required": false; }; "disableAnimation": { "alias": "disableAnimation"; "required": false; }; }, {}, never, ["*"], false, never>; }

Corresponding code with parameters in my service for spinner:

`  busy() {
    this.busyRequestCount++;
    this.spinnerService.show(undefined, {
    bdColor: 'rgba(255, 255, 255, 0.7)',
      color: '#333333',
      type: 'timer',
    });
  }`

Error:

error TS2344: Type '{ bdColor: { alias: "bdColor"; required: false; }; size: { alias: "size"; required: false; }; color: { alias: "color"; required: false; }; type: { alias: "type"; required: false; }; fullScreen: { alias: "fullScreen"; required: false; }; ... 4 more ...; disableAnimation: { ...; }; }' does not satisfy the constraint '{ [key: string]: string; }'. Property '"bdColor"' is incompatible with index signature. Type '{ alias: "bdColor"; required: false; }' is not assignable to type 'string'.

1 Answer 1

1

It is a bug in latest version of ngx-spinner. Use "ngx-spinner": "^14.0.0" instead.

Uninstall the existing version and install v14.0.0

npm remove ngx-spinner
npm install [email protected] --legacy-peer-deps
Sign up to request clarification or add additional context in comments.

1 Comment

in order for this to work i had to delete my physical folder also in my system. ~\node_modules\ngx-spinner

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.