cap-js / docs

CAP Documentation
https://cap.cloud.sap
Apache License 2.0
45 stars 96 forks source link

CDSv8 Typescript #1162

Closed MichaelFlucher closed 1 month ago

MichaelFlucher commented 1 month ago

I just set up a new CAP Project using @sap/cds with version 8.1.0 and also @sap/cds-dk with ^8. According to https://cap.cloud.sap/docs/node.js/typescript#enable-typescript-support I should use something like

import { Request } from "@sap/cds";

But this gives an error, that the declaration is not there anymore: error TS7016: Could not find a declaration file for module '@sap/cds'.

Downgrading to v7 works again.

smahati commented 1 month ago

Hello,

This could be because of a missing dev-dependency as described in the release notes, if this doesn't help resolve your issue please share your project so that we can reproduce it.

Best regards, Maha

MichaelFlucher commented 1 month ago

Hi @smahati, Thanks for the hint. I thought cds add typescript would be enough. Adding @cap-js/cds-types fixed the issue. Should this issue stay open, to add this information to the documentation? BR, Michael

swaldmann commented 1 month ago

Hi @MichaelFlucher,

when I run cds add typescript on a project with cds-dk version 8.1 I get @cap-js/cds-types added to my devDependencies automatically. Does this behave differently for you?

Best regards, Steffen

smahati commented 1 month ago

Hello,

As we have not heard back from you, I will close this issue for now. Please create a new issue if you need further support.

Thanks & Best Regards, Mahati

MichaelFlucher commented 3 weeks ago

Hi @MichaelFlucher,

when I run cds add typescript on a project with cds-dk version 8.1 I get @cap-js/cds-types added to my devDependencies automatically. Does this behave differently for you?

Best regards, Steffen

It does indeed. Everytime I run npm install, I get the error again: error TS7016: Could not find a declaration file for module '@sap/cds'.

So the did not come from a missing @cap-js/cds-types, but the symbolic link was not created. I have to run ln -s ../@cap-js/cds-types ./node_modules/@types/sap__cds everytime.