Skip to Content
0
Sep 14, 2023 at 08:26 PM

CDS Typer: @cds-models folder not generated

354 Views Last edit Sep 14, 2023 at 08:28 PM 2 rev

Hi community,

I have enabled CDS Typer in my project by `cds add typer` followed by `npm i`. Event handler imports the model type by:

const { Questions } = require('#cds-models/fullstack_dev_challenge')

However, @cds-models folder was not generated and therefor execution failed with Error: Cannot find module '/.../fullStackDevChallenge/@cds-models/fullstack_dev_challenge/index.js'.

I have tried modifying .cds files, but it did not trigger the creation of @cds-models. How can I generate the @cds-models folder ?

package.json

{
  "name": "fullstackDevChallenge",
  "version": "1.0.0",
  "description": "A simple CAP project.",
  "repository": "<Add your repository here>",
  "license": "UNLICENSED",
  "private": true,
  "dependencies": {
    "@sap/cds": "^7",
    "express": "^4"
  },
  "devDependencies": {
    "sqlite3": "^5",
    "@cap-js/cds-typer": "^0"
  },
  "scripts": {
    "start": "cds-serve"
  },
  "imports": {
    "#cds-models/*": "./@cds-models/*/index.js"
  }
}

link to my repo (branch: typeScript) : https://github.com/miyasuta/fullstackDevChallenge

Regards,

Mio