question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

tsc-strict does not work with emitDeclarationOnly and build option.

See original GitHub issue

Hi,

Because tsc-strict ends up to run tsc --strict --noEmit ...process.argv.slice(2):

  • it’s not compatible with --build option:
tsc-strict -b apps/fr-app/tsconfig.json
🎯 Found 10794 strict files
⠸ Compiling with strict mode...💥 Typescript did not compile due to some errors. Errors:  [
  "error TS6369: Option '--build' must be the first command line argument."
  • it’s not compatible with emitDeclarationOnly option:
λ › tsc-strict
🎯 Found 10794 strict files
⠴ Compiling with strict mode...💥 Typescript did not compile due to some errors. Errors:  [
  "error TS5053: Option 'emitDeclarationOnly' cannot be specified with option 'noEmit'."
]

Maybe passing the process.argv before strict could be enough for the build option, but I don’t know if the noEmit option is really required.

Also, for the record, I’ve a project with 13106 ts files, and tsc-strict is very longer than tsc (mainly because of the Looking for strict files step). Maybe a cache could be considered?

I’m ready to do the PR when we agree on what to do.

Thanks for your package!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
mathieutucommented, Feb 16, 2022

Actually I think that we can leave the noEmit like this, and let devs add --emitDeclarationOnly false if they need. Also, I found out that the build option is not compatible with any config via console option (including strict), so no need to move anything.

Thanks for the cache thing!

13000 ts files

yep, and it’s only the front 😅

0reactions
KostkaBrukowacommented, Feb 13, 2022

And about the noEmit flag I’m wondering what to do. Initially I’ve added the noEmit flag, because some project use babel to compile their projects and they don’t have noEmit flag in their tsconfig. Without this flag running tsconfig would generate bunch of js files unnecessarily (default is false). So we have three options:

  1. Remove noEmit resulting in scenario above
  2. Leave like it is now resulting in error with compilation with tsconfig provided by you
  3. Search tsconfig and find if emitDeclarationOnly is present and don’t add noEmit when it is

I think option 3 would be the best in this case, but I’m worring that there would be more cases like that with different flags. What do you think?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Flag --emitDeclarationOnly not working with tsc --build · ...
I want to watch over the project and just emit declarations files and no JS. --emitDeclarationOnly is mentioned as compiler options in the...
Read more >
emitDeclarationOnly - TSConfig Option
TSConfig. emitDeclarationOnly ... An overview of building a TypeScript web app. TSConfig Options. All the configuration options for a project.
Read more >
why declaration can not be used together with ...
The reason is for the same reason you can't use const enums in isolated modules: type information. Since isolated modules compiles each file ......
Read more >
Compiler Options in MSBuild
Compiler Option MSBuild Property Name Allowed Values ‑‑allowJs Not supported in MSBuild ‑‑allowSyntheticDefaultImports TypeScriptAllowSyntheticDefaultImports boolean ‑‑allowUnreachableCode TypeScriptAllowUnreachableCode boolean
Read more >
TypeScript library tips: Rollup your types! | by Martin Hochel
NOTE: this article will not go through how to configure Rollup or how it works in detail. Rollup.js helps us bundle our library...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found