Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compilation error: Property '"method"' is incompatible with index signature. #51

Open
xuyinofnyc opened this issue Sep 14, 2023 · 4 comments

Comments

@xuyinofnyc
Copy link

I am using Angular core 15.2.0, and tried 14.0.0, 15.0.0 and 16.0.0 versions of ngx-filesaver and all got following error:

Error: node_modules/ngx-filesaver/src/filesaver.directive.d.ts:30:94 - error TS2344: Type '{ method: { alias: "method"; required: false; }; http: { alias: "http"; required: false; }; query: { alias: "query"; required: false; }; header: { alias: "header"; required: false; }; url: { alias: "url"; required: true; }; fileName: { ...; }; fsOptions: { ...; }; }' does not satisfy the constraint '{ [key: string]: string; }'.

Property '"method"' is incompatible with index signature.

Type '{ alias: "method"; required: false; }' is not assignable to type 'string'.

30 static ɵdir: i0.ɵɵDirectiveDeclaration<FileSaverDirective, "[fileSaver]", ["fileSaver"], { "method": { "alias": "method"; "required": false; }; "http": { "alias": "http"; "required": false; }; "query": { "alias": "query"; "required": false; }; "header": { "alias": "header"; "required": false; }; "url": { "alias": "url"; "required": true; }; "fileName": { "alias": "fileName"; "required": false; }; "fsOptions": { "alias": "fsOptions"; "required": false; }; }, { "success": "success"; "error": "error"; }, never, never, true, never>;

Seems the grammar is not compatible with Angular. What am I missing?

@cipchk
Copy link
Owner

cipchk commented Sep 14, 2023

  1. Make sure to use angular, ngx-filesaver is 15.x
  2. Try to remove node_modules and package.json (or yarn.lock),
  3. Finally yarn installs dependencies

@xuyinofnyc
Copy link
Author

I tried

npm install [email protected]
Same error.
For Angular, I am using Angular cli 15.2.0.
What do you mean remove node_modules?

@xuyinofnyc
Copy link
Author

Using yarn seems working, but not npm. I have to rely on npm now. Can this be fixed?

@cipchk
Copy link
Owner

cipchk commented Sep 15, 2023

This problem should be the result of not installing dependencies correctly. It should not be directly related to ngx-filesaver. You can use npm ls -a to check whether the specific dependency version details are correct.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants