Why doesn’t the “tsc” transpilation command work in Create-React-App?

Thomas Francis
2 min readApr 18, 2021

The short answer is that create-react-app has the “noEmit” setting set to “true” by default.

But why?

The tsc command used by itself will look for the tsconfig.json file in the current and parent directories.

thiscomputer codefolder % tsc

Once found, the file or directories specified in “files” or “include” will be transpiled from .ts, .d.ts, or from .tsx to .js, or Javascript files.

snippet of the tsconfig.json file above
The result of tsc command without “noEmit” option

This sounds similar to compilation done in the C language by the gcc command. But it’s not the same.

For normal web development, manual transpilation from Typescript to Javascript is not needed because the final build production process (npm run build) results in Javascript files anyways. Because the “tsc” command is a transpiler and not a compiler, as long as the tsconfig.json file has the correct settings, even unfinished Typescript code does not always result in transpilation errors. (All transpilation errors will be underlined in red in vscode.)

The purpose of “noEmit” is to only use Typescript for type checking and nothing else.

--

--