Build toolBuild tooltypeRuns at build time. Nothing of it ships in the deployed application.See every one →What this type is →independently maintainedindependently maintainedoriginPublished by one person or a small company outside SAP. Says nothing about quality; the readings say that.See every one →

cds-plugin-typescript

A CDS build task that compiles TypeScript sources during cds build, so the deployed artefact is JavaScript without a separate build step in the pipeline.

Facts

Latestv0.1.8ReleasedLast pushLicenceMIT

Where it sits

Lives in
Provides
TypeScript patternsCAPTypeScript patternscapabilityHow an application is arranged once it is written in TypeScript — where handlers live, what registers them, and how business logic is kept apart from persistence. Distinct from typing, which is about the model being visible to the compiler; this is about the shape of the code around it.
Flavors
Requires
@sap/cds≥ 8@sap/cdsartifactThe peer range, as published.

Who is behind it

Pascal WasemPascal WasemPersonMaintains this
In the atlas: maintains 1, contributes to 1
@pwasem
maintainer

What it declares

Every artifact

Type
Build tool
Origin
Independently maintained

As a build tool

Declared for
>=8
Distributed through
npm

Connections1

Install

npm add cds-plugin-typescript

Derived from the package name. No recipe recorded; the README has the configuration.

README

quoted from pwasem/cds-plugin-typescript under MIT, read
pwasem/cds-plugin-typescript/README.mdOn GitHub

cds-plugin-typescript

A CDS build plugin for SAP CAP that compiles TypeScript sources to JavaScript as part of cds build.

It is similar to cds-typer but focused exclusively on TypeScript compilation. It also supports resolving TypeScript path aliases via tsc-alias.

Prerequisites

  • Node.js >=22
  • npm >=10
  • @sap/cds >=8
  • typescript >=5
  • tsc-alias >=1 (optional — automatically detected and used if listed in your project's package.json)

Installation

npm install --save-dev cds-plugin-typescript

Usage

Once installed, the plugin is automatically discovered and activated — no manual registration needed. It's a cds-plugin and will be loaded by CAP automatically.

Simply run cds build and the plugin will:

  1. Detect your tsconfig file (see tsconfig resolution below)
  2. Compile TypeScript sources with tsc
  3. Resolve path aliases with tsc-alias (automatic — runs if tsc-alias is found in your project's dependencies or devDependencies)
  4. Remove .ts source files from the build output

Configuration

Zero configuration is required by default. Simply:

  1. Install the plugin (npm install --save-dev cds-plugin-typescript)
  2. Maintain a tsconfig file — the plugin automatically looks for tsconfig.cdsbuild.json, tsconfig.build.json, or tsconfig.json (first found wins)
  3. Run cds build

That's it — no package.json changes needed.

Custom tsConfig path

The cds.build.tasks configuration in package.json is only needed if you want to point the plugin at a tsconfig file with a non-standard name (i.e. something other than the three files listed above):

{
  "cds": {
    "build": {
      "tasks": [
        { "for": "nodejs" },
        {
          "for": "typescript",
          "options": {
            "tsConfig": "tsconfig.custom.json"
          }
        }
      ]
    }
  }
}
OptionTypeDefaultDescription
tsConfigstring—Custom TypeScript config file path. When provided, this takes highest priority in the resolution order.
tsconfig resolution

The plugin resolves the tsconfig file using the following priority order:

  1. Custom path via the tsConfig option (if provided in the build task configuration)
  2. tsconfig.cdsbuild.json — a CDS-build-specific config
  3. tsconfig.build.json — a general build-specific config
  4. tsconfig.json — the standard TypeScript config

The plugin uses the first file found in this order. This allows you to maintain separate TypeScript configurations for CDS builds, general builds, and development without conflicts.

The default/recommended tsconfig for the default CDS folder structure is:

{
  "compilerOptions": {
    "rootDir": "srv",
    "outDir": "gen/srv/srv",
    "declaration": true,
    "sourceMap": true,
    "removeComments": true
  },
  "include": [
    "srv/**/*"
  ]
}

The outDir in your tsconfig determines where compiled output lands — make sure it aligns with your CDS build target (default: gen).

Path aliases

If your project uses TypeScript path aliases (e.g. @/* → src/*), simply add tsc-alias to your project's dependencies or devDependencies:

npm install --save-dev tsc-alias

The plugin automatically detects whether tsc-alias is listed in your package.json (under dependencies or devDependencies) and runs it after tsc to rewrite the aliases in the compiled JavaScript. No additional configuration is needed.

If tsc-alias is not listed in your package.json, the path alias resolution step is skipped entirely.

How it works

The plugin extends cds.build.Plugin and is registered under the task type typescript.

Build steps:

  1. Resolve the tsconfig path (priority: tsConfig option → tsconfig.cdsbuild.json → tsconfig.build.json → tsconfig.json)
  2. Run npx tsc -p <tsconfig> from the task source directory — logs: "Compiling TypeScript using <tsconfig>"
  3. If tsc-alias is detected in package.json: run npx tsc-alias -p <tsconfig> — logs: "Resolving path aliases"
  4. Delete all .ts files (excluding .d.ts) from the build output — logs: "Removing TypeScript sources"

Clean step:

cds build --clean removes all .js and .map files emitted by this plugin from the destination directory.

TypeScript 7

TypeScript 7.0 is a native Go port and does not ship with a programmatic API yet. Tools that rely on import('typescript') (such as tsc-alias, typescript-eslint, and CAP itself) still need the TypeScript 6 API.

Microsoft provides a compatibility package @typescript/typescript6 that re-exports the TypeScript 6 API but renames its binary to tsc6, allowing TypeScript 6 and 7 to coexist. You can install both via npm aliases so that npx tsc uses TypeScript 7 while tooling that calls import('typescript') gets the TypeScript 6 API:

{
  "devDependencies": {
    "@typescript/native": "npm:typescript@^7.0.2",
    "typescript": "npm:@typescript/typescript6@^6.0.2"
  }
}

This plugin works with this setup out of the box — it shells out to npx tsc (TypeScript 7) and detects tsc-alias in your package.json (which continues to use the TypeScript 6 API transparently).

License

MIT

MIT, read

History

Latest

v0.1.8

  1. v0.1.7

  2. v0.1.6

  3. v0.1.5

  4. v0.1.4

  5. v0.1.3

  6. v0.1.2

  7. v0.1.1

  8. v0.1.0

On npm
0downloads per week, npm
Weekly downloads for cds-plugin-typescript26 complete calendar weeks from 2026-04-27 to 2026-10-25; the latest total is 0.27 Apr – 3 May: 04 May – 10 May: 011 May – 17 May: 018 May – 24 May: 57425 May – 31 May: 3131 Jun – 7 Jun: 488 Jun – 14 Jun: 1715 Jun – 21 Jun: 222 Jun – 28 Jun: 629 Jun – 5 Jul: 3396 Jul – 12 Jul: 4213 Jul – 19 Jul: 1720 Jul – 26 Jul: 1927 Jul – 2 Aug: 33 Aug – 9 Aug: 1610 Aug – 16 Aug: 3317 Aug – 23 Aug: 524 Aug – 30 Aug: 931 Aug – 6 Sept: 217 Sept – 13 Sept: 2014 Sept – 20 Sept: 1021 Sept – 27 Sept: 328 Sept – 4 Oct: 85 Oct – 11 Oct: 112 Oct – 18 Oct: 919 Oct – 25 Oct: 0
TypeScript patterns
  1. @dxfrontier/cds-ts-dispatcherDecorator-driven handler registration for CAP in TypeScript
  2. @dxfrontier/cds-ts-repositoryTyped BaseRepository over CAP entities
  3. cds-plugin-handlersOne handler file per entity in CAP services
  4. cds-routing-handlersDecorator-based routing of CAP service handlers in TypeScript
  5. cds2typesCLI generating TypeScript interfaces from a CDS model
  6. cap-handler-frameworkConvention-based handler layer for CAP with draft lifecycle hooks
  7. cds-hyper-app-serviceTyped class-based service layer over CAP ApplicationService

Details

Sources5
npm registrydiscovered herechecked
The discovery passdiscovered herechecked
npm registry, cds-plugin-typescriptversion, releases, installschecked
github.com/git+https://github.com/pwasem/cds-plugin-typescript.gittree, pushes, contributors, CIchecked
README.mdquoted, and what the entry declareschecked

Sources are graph entities: the same page may back several entries, and an unreachable source flags every row that rests on it.

Compatibility and provenance
declared for>=8
latestv0.1.8
first release
releases and cadence9, ~0d median
discovered vianpm registry, The discovery pass
first seen in the atlas
ecosystem and domaincap, developer-experience
Flavors1
Node.js
“It's a [cds-plugin](https://cap.cloud.sap/docs/node.js/cds-plugins) and will be loaded by CAP automatically.” — pwasem/cds-plugin-typescript — READMEchecked
History in the atlas4
  1. The edge carried no sentence. It now says what the plugin does at build time and that it says nothing about the arrangement of the code it compiles. Whether the edge belongs on typescript-patterns is an open editorial question recorded with the capability's review: capire now ships a cds build task for TypeScript in @cap-js/cds-typer, which puts this plugin beside the core's toolchain answer rather than beside the arrangement options. No facet values are stated, because the capability's four facets ask about the arrangement and the README answers none of them.
  2. Typed cds-plugin by placement, which defaults every candidate to that. It is not one.
  3. A CDS build task that compiles TypeScript sources during `cds build`, so the deployed artefact is JavaScript without a separate build step in the pipeline.
  4. First seen.
For your agent
Ref
artifact:pwasem-cds-plugin-typescript
JSON
/artifacts/pwasem-cds-plugin-typescript.json
MCP
Connecting an agent