Hello all,
now that UI5 also gets released TypeScript support, I would like to finally tackle this.
At the moment I'm stuck with the cds-typer not showing me the types according to the doc: https://cap.cloud.sap/docs/node.js/typescript#generating-model-types-automatically
This is the current code that works, what bothers me about this one?
import { A_SalesOrder } from '#cds-models/SalesOrderService'
import cds from '@sap/cds'
module.exports = class SalesOrder extends cds.ApplicationService {
async init() {
const apiSalesOrder = await cds.connect.to('ZAPI_SALES_ORDER_SRV')
this.on('*', A_SalesOrder.name, req => {
const data = req.data as A_SalesOrder
console.log(data.SoldToParty)
return apiSalesOrder.run(req.query)
})
}
}
Development happens in BAS.
user: salesorder $ npm ls salesorder@0.0.2 /home/user/projects/salesorder ├── @cap-js/cds-typer@0.6.1 ├── @sap-cloud-sdk/http-client@3.4.0 ├── @sap/cds@7.1.1 ├── @tsconfig/node18@18.2.0 ├── @types/node@20.5.0 ├── express@4.18.2 └── passport@0.6.0 user: salesorder $ node -v v18.14.2<br>
Has anyone got this working?
Is there perhaps a demo repository? The SAP samples are all a bit dusty.
Many thanks