Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
1 task done
ziyuang opened this issue May 27, 2024 · 0 comments
Labels

Comments

@ziyuang
Copy link

ziyuang commented May 27, 2024

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.

@ziyuang ziyuang changed the title Allow to generate type declaration files with tsc when the builder is swc Allow to generate type declaration files with tsc when the builder is swc or to skip building in nest start May 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant