Learn how to develop your first plugin in CAP Node.js and connect it with a CAP application. Enrich the plugin with functionality, learning the different techniques on how a plugin can interact with the base app.
Speakers: Daniel Schlachter, Ram Prasad and Robin De Silva
Validation tutorial for todays sessions will be available by the end of the day here: https://developers.sap.com/tutorials/devtoberfest2024-week3-cap-session-validation.html
Hello everyone,
I was wondering if it is possible to develop design time plugins (e.g. cds add <plugin>) using TypeScript. I couldn't find a way to use the @Priya0/cds-dk package since it doesn't come with type definitions. Am I missing something obvious or it isn't effectively possible (possibly without allowing Js code and any types in the tsconfig π )?
Thanks
Hi @FedericoBelotti ,
you have to manually install the type definitions :).
https://cap.cloud.sap/docs/tools/cds-typer
You can also take a look at the following sessions and blog posts:
- https://community.sap.com/t5/devtoberfest/it-s-time-for-typescript-cap-edition/ev-p/13856083
- https://community.sap.com/t5/technology-blogs-by-members/why-the-typescript-sheriff-has-come-to-clea...
- https://cap.cloud.sap/docs/node.js/typescript#using-typescript
Hope this helps.
Hello @KevinR,
I may have been explained myself poorly. What I meant wasn't that I couldn't use TypeScript at all within a CAP application, but rather that I couldn't use the '@sap/cds-dk' package imports inside a .ts file to create a CDS plugin with TypeScript rather than the '@sap/cds' package. The resources you suggested are fine and I can have them working in a CAP application.
I have set up an empty, dummy node application that uses TypeScript and inside the cds-plugin.ts file I tried to import something from '@sap/cds-dk' trying to replicate what is explained here but all I get is:
"Could not find a declaration file for module '@sap/cds-dk'. '<PATH>/cap-plugin-ts/node_modules/@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';`"
@types/sap__cds-dk declarations do not exist as they do for '@sap/cds', so it doesn't seem to be possible to use the sdk in a .ts file.
Thanks for any help,
Federico