Skip to content

Allow to generate type declaration files with tsc when the builder is swc or to skip building in nest start #2610

@ziyuang

Description

@ziyuang

Is there an existing issue that is already proposing this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe it

It seems when using swc, we cannot generate the *.d.ts files [1,2] needed by, e.g., MikroOrm's TsMorphMetadataProvider [3,4]. One of the workarounds to call tsc -p tsconfig.declaration.json, with

// tsconfig.declaration.json
{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "emitDeclarationOnly": true,
    "declaration": true,
    "declarationDir": "./dist"
  }
}

after the building step.

However, when using nest start, this will require manually splitting the start command into:

  1. Setting "deleteOutDir": false in the compilerOptions of nest-cli.json
  2. rm -rf ./dist
  3. nest build
  4. tsc -p tsconfig.declaration.json
  5. nest start

which seems cumbersome.

Describe the solution you'd like

It would be convenient if we could do something like nest --generate-declarations start or nest build && tsc -p tsconfig.declaration.json && nest --skip-builder start (or nest --builder none start). We may add some checks before the this.runBuild line in start.action.ts to achieve this.

Teachability, documentation, adoption, migration strategy

No response

What is the motivation / use case for changing the behavior?

See the first section.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions