Closed LeCongNam closed 1 week ago
Hi @LeCongNam ,
thanks for reporting this issue. I am not quite clear on what you mean by
because this package for dev mode not for production mode
We generally recommend to deploy only transpiled JavaScript in a productive scenario, so types should not play a role once you deploy. If you choose to run TypeScript in a productive scenario, then @cap-js/cds-types
also has to be a regular dependency.
Best, Daniel
this problem occurs if the npm link ist missing, have a look on other issues... you could solve it with "npm rebuild"
You need to find this entry: npm list|grep ├── @types/sapcds@npm:@cap-js/cds-types@0.6.5 extraneous -> ./node_modules/@cap-js/cds-types
Hi @LeCongNam ,
thanks for reporting this issue. I am not quite clear on what you mean by
because this package for dev mode not for production mode
We generally recommend to deploy only transpiled JavaScript in a productive scenario, so types should not play a role once you deploy. If you choose to run TypeScript in a productive scenario, then
@cap-js/cds-types
also has to be a regular dependency.Best, Daniel
Thanks @daogrady support me. But I confure because @cap-js/cds-types
is TYPE
in typescript will install for dev-dependency and support suggest type for coding local. But you suggest for build production.
I think it not helpful for production mode with run time because cds v6 do not include type. I think if this package required for build prodction you have create Pull Request merge this package for Sap SDK. Thanks you
this problem occurs if the npm link ist missing, have a look on other issues... you could solve it with "npm rebuild"
You need to find this entry: npm list|grep ├── @types/sapcds@npm:@cap-js/cds-types@0.6.5 extraneous -> ./node_modules/@cap-js/cds-types
Thanks you suggest you. But i want npm auto install. I install like @daogrady and fixed it. But I'm don't happy install types for dependency so i ask and received answer like me :) funny
Hi @LeCongNam ,
I am still a bit unclear on your scenario.
install for dev-dependency and support suggest type for coding local. But you suggest for build production.
Yes, that is correct. We recommend you only use TypeScript (and in consequence: @cap-js/cds-types
) in your local development scenario.
Yet, you said:
Current build CICD error when build
This implies, that you are either
(a) attempting to run TypeScript productively, or (b) your CICD does not install the devDependencies.
If your CICD includes a build step from TypeScript to JavaScript, then you do need the @cap-js/cds-types
package present when the build happens. So you can either have your build step use the devDependencies, or promote @cap-js/cds-types
to a full dependency.
Best, Daniel
this problem occurs if the npm link ist missing, have a look on other issues... you could solve it with "npm rebuild"
You need to find this entry: npm list|grep ├── @types/sapcds@npm:@cap-js/cds-types@0.6.5 extraneous -> ./node_modules/@cap-js/cds-types
Hi @Markus-Schroeder-de , we had the same issue when trying to import something from @sap/cds
in typescript.
Could not find a declaration file for module '@sap/cds'. '****/ai-sdk-js/node_modules/.pnpm/@sap+cds@8.4.1_express@4.21.1/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)
Check the Known Issue section in https://github.com/SAP/ai-sdk-js/pull/273. As this creates complication for users, could this problem be solved? I can imagine almost everyone who uses CAP with typescript will face this issue.
Hi @ZhongpinWang ,
I believe you wanted to add this response to https://github.com/cap-js/cds-types/issues/251
Best, Daniel
Considering this solved due to inactivity. Feel free to open another issue if the problem persist.
Is there an existing issue for this?
Current Behavior
Expected Behavior
no error found npm run
npm run build
typescriptReferences
https://community.sap.com/t5/technology-q-a/sap-cap-typescript-error-could-not-find-a-declaration-file-for-module-sap/qaq-p/13764999
Versions
Anything else? Logs?
i'm using feature package of gitlab. when i run
npm i
i want all package install for all repository dependency. i'm used"@cap-js/cds-types": "^0.6.5"
when upgrade cds version 6 to version 8 withnpm i -D @cap-js/cds-types
Current build CICD error when build. I'm used trig installnpm i @cap-js/cds-types
work well but not true because this package for dev mode not for production mode. Please help me. Thanks you so much