react-native-typescript-transformer icon indicating copy to clipboard operation
react-native-typescript-transformer copied to clipboard

#29 respect noEmitOnError

Open simonhoss opened this issue 5 years ago • 5 comments

Hi

This is a implementation to respect the noEmitOnError config. If any problem exists (not only syntax errors) it will report the first error and stop compiling.

Please review and give me feedback.

Greets

simonhoss avatar Jul 28 '18 20:07 simonhoss

So if I get compile error does it show red screen on my app or something?

henrikra avatar Jul 30 '18 17:07 henrikra

It shows an error on the react-native packager, but I was not able to make a build without errors. It seems that createProgram is a bit different than tsc -p tsconfig.json or maybe my tsconfig.json is wrong?!

simonhoss avatar Jul 30 '18 18:07 simonhoss

Can you show Gif/video of the this feature?

henrikra avatar Jul 30 '18 18:07 henrikra

@simonhoss I was able to fix the Unexpected moduleResolution: node error by using

const moduleResolution = compilerOptions.moduleResolution === 'node'
  ? ts.ModuleResolutionKind.NodeJs
  : ts.ModuleResolutionKind.Classic

const program = ts.createProgram([filename], {
  ...compilerOptions,
  moduleResolution
})

(Source)

But after this it will throw Cannot find global type 'Array'.. It really looks like the ts.createProgram() takes a different type of compiler options then ts.transpileModule().

I will also try to find a solution for this somewhere this week because we really need this! Please let me know if you know more (already).

mvdam avatar Aug 07 '18 13:08 mvdam

I found a solution and made a PR for this (on top of the changes of @simonhoss -> https://github.com/simonhoss/react-native-typescript-transformer/pull/1). If you guys can provide some feedback that would be great!

mvdam avatar Aug 08 '18 08:08 mvdam