on 2024 Jul 18 4:07 PM
Hello Everyone
I am using typescript with CAP
After upgrading to new version, I start getting following error
Could not find a declaration file for module '@sap/cds'. '/project/node_modules/@sap/cds/lib/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/sap__cds` if it exists or add a new declaration (.d.ts) file containing `declare module '@sap/cds';`ts(7016)
for statement
Request clarification before answering.
Hi @sandeepmalhotra ,
the types have moved to the cap-js/cds-types package. So just install it via `npm i -D @cap-js/cds-types` and there you have all your types in one .d.ts file.
BR Tom
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This seems to be a known issue. For me, running npm rebuild resolved it. See https://cap.cloud.sap/docs/get-started/troubleshooting#typescript.
Explanation
Root Cause 1 | The package @cap-js/cds-typer is not installed. |
Solution 1 | Install the package as a dev dependency. |
Root Cause 2 | Symlink is missing. |
Solution 2 | Try npm rebuild or add @cap-js/cds-types in your tsconfig.json. |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Do you use cds-ts to run commands? Otherwise, try the reply from @brian_keenan here: https://community.sap.com/t5/technology-q-a/facing-error-while-building-and-watching-cap-project/qaq...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
10 | |
9 | |
8 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.