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

Support tsc --build --noEmit #53979

Open
5 tasks done
segevfiner opened this issue Apr 24, 2023 · 4 comments
Open
5 tasks done

Support tsc --build --noEmit #53979

segevfiner opened this issue Apr 24, 2023 · 4 comments
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@segevfiner
Copy link

Suggestion

πŸ” Search Terms

tsc --build --noEmit
build noEmit

List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

Allow tsc --build --noEmit, the relevant types can be emitted to the tsbuildinfo for incremental building. This is very useful to allow type checking only for projects using project references and working with a bundler. e.g. A create-vue project, which currently has to resort to hackery such as vue-tsc --noEmit -p tsconfig.vitest.json --composite false which is not as accurate as type checking each project individually.

πŸ“ƒ Motivating Example

tsc --build --noEmit is now supported, allowing to only run type checking for projects using project references that don't also build types using tsc.

πŸ’» Use Cases

Type checking only, for projects using other build tools than tsc but still using project references for each of configuration.

@sheetalkamat
Copy link
Member

sheetalkamat commented Apr 24, 2023

tsc --build --noEmit is supported unless a project references another project which would make it difficult to support since its depending on d.ts output file from the referenced project.

@segevfiner
Copy link
Author

Note that referenced projects were not allowed to specify noEmit in TS<5, but they are allowed now, although the behavior in terms of type checking is unclear, seems like it skips them or something of that sort.

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature labels Jun 14, 2023
@thebanjomatic
Copy link

thebanjomatic commented Aug 21, 2023

I encountered this problem as well recently. You can specify noEmit: true in the tsconfig.js, but you can't pass it via the command-line. Support for --emitDeclarationOnly was added in this PR: #51164 would it be reasonable to add --noEmit as well?

@david-alpert-nl
Copy link

I got here because I am attempting to run tsc --noEmit for type checking since my build tooling (vite) explicitly transpiles only and does not validate type consistency.

I find that tsc --noEmit does what I want but emits no progress while it's running. when I tried to add --verbose it says that the progress update is only supported with --build but that --build and --noEmit are not permitted together

tsc --verbose --noemit 
error TS5093: Compiler option '--verbose' may only be used with '--build'.
tsc --build --verbose --noemit
error TS5094: Compiler option '--noemit' may not be used with '--build'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants