cap-js / cds-types

Type definitions for CDS
Apache License 2.0
10 stars 10 forks source link

[BUG] Cannot find type declarations for @sap/cds-dk package for CDS Plugins development #305

Open federicobelotti opened 3 weeks ago

federicobelotti commented 3 weeks ago

Is there an existing issue for this?

Current Behavior

When importing from @sap/cds-dk package in a .ts file of a node.js application set up to use TypeScript (TypeScript set up via cds add typescript utility) I get this error: _Could not find a declaration file for module '@sap/cds-dk'. '@sap/cds-dk/lib/index.js' implicitly has an 'any' type. Try npm i --save-dev @types/sap__cds-dk if it exists or add a new declaration (.d.ts) file containing declare module '@sap/cds-dk';ts(7016)_

No @types/sap__cds-dk exists and there's also nothing regarding the SDK in the @cap-js/cds-types.

Expected Behavior

I'd expect to be able to replicate what is explained in the documentation about how to create a CDS plugin but with TypeScript, and I coudn't be able to find any online reference about a CDS plugin created using TypeScript.

References

CAPire documentation Devtoberfest session where I asked about this problem, but they brought me to the TypeScript documentation on CAPire, which didn't help me.

Versions

@cap-js/asyncapi: 1.0.2 @cap-js/cds-typer: 0.28.0 @cap-js/cds-types: 0.6.5 @cap-js/db-service: 1.14.1 @cap-js/openapi: 1.0.6 @cap-js/sqlite: 1.7.5 @sap/cds: 8.4.0 @sap/cds-compiler: 5.4.0 @sap/cds-dk: 8.3.0 @sap/cds-dk (global): 8.3.0 @sap/cds-fiori: 1.2.7 @sap/cds-foss: 5.0.1 @sap/cds-mtxs: 2.2.0 @sap/eslint-plugin-cds: 3.1.0 Node.js: v20.15.0 cap-dummy-plugin: 1.0.0

Anything else? Logs?

No response

daogrady commented 2 weeks ago

Hi Federico,

that is correct, cds-dk has no types as of today. We are currently discussing internally how to properly provide these types, hopefully without having to introduce another type package.

Best, Daniel

federicobelotti commented 2 weeks ago

Hello Daniel, thank you very much for the update.

Regards, Federico