Skip to content

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

Description

@federicobelotti

Is there an existing issue for this?

  • I have searched the existing issues

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions