I enable the option “noEmitOnError”: true in the tsconfig file and has strict:true option enabled already.
When i run tsx file (tsc test.tsx) , typescript transpile the code and emits the js file. (But as per what iu s said in the educative chapter, typescript will not emit js file if there is an error of type checking in the file).Explain plz??
@Komal_Arif here is the link of the chapter.
Course: Educative: Interactive Courses for Software Developers
Lesson: Educative: Interactive Courses for Software Developers
Thanks for sharing the lesson link. Your query will be answered soon.
Komal_Arif not replied yet??
Course: Functional Programming Patterns With RamdaJS! - Free Interactive Course
Lesson: FP's Secret Sauce - Functional Programming Patterns With RamdaJS!
Hello @rishabh_jain
The noEmitOnError
option in the TypeScript configuration file (tsconfig.json
) tells the TypeScript compiler not to emit JavaScript code if there are any type errors or compilation errors in the TypeScript code. When noEmitOnError
is set to true
, TypeScript will only generate JavaScript code if there are no type errors or compilation errors in the TypeScript code.This is the primary purpose of these options: to ensure that the generated JavaScript code is free of any type-related errors or warnings that could cause issues at runtime.
If you are encountering the issue specific to your code, please provide us with your .tsx
and tsconfig.json
files so we can understand the problem specific to your code and provide you with more precise guidance.
Thank you
@Muhammad_Ali_Shahid So when noEmitOnError
is set to false., Typescript is allowed to compile the code if there are type errors or compilation errors?
Course: https://www.educative.io/collection/10370001/4994778405011456
Lesson: https://www.educative.io/collection/page/10370001/4994778405011456/5691356803497984
Hello @rishabh_jain
Yes, when noEmitOnError
is set to false
in the TypeScript configuration file, it means that TypeScript will still emit JavaScript code even if there are type errors or compilation errors in the TypeScript code. Setting noEmitOnError
to false
allows TypeScript to generate JavaScript code regardless of any type of compilation error.
It is the default behavior of the compiler. If we don’t mention anything in the tsconfig.json
file, then noEmitOnError
on error is considered false
.
I hope this will help.
Happy Learning