Skip to content

Add disableExit option #818

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

Merged
merged 1 commit into from
Apr 15, 2019
Merged

Add disableExit option #818

merged 1 commit into from
Apr 15, 2019

Conversation

tenorok
Copy link
Contributor

@tenorok tenorok commented Apr 6, 2019

Ts-node is a development tool, and during development sometimes you need to quickly change the code and check the result. Of course, in the final form the code types should be corrected and this can be controlled by pre-commit hook like tsc --noEmit, for example.

Thus, it happens that in the development process, you have to place // @ts-ignore, before every error, which is inconvenient. Given that TSC transpile the code even if it presence types errors, I would like to have the same opportunity in the ts-node too.

This pull request shows the --disableExit option (and TS_NODE_DISABLE_EXIT environment variable), which allows you not to stop the process when typing errors occur, but only to output these errors to the console and continue execution.

It looks like this:
ts-node-disbleexit

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.8%) to 85.242% when pulling 2666ce0 on tenorok:disableExit into 8706c31 on TypeStrong:master.

@coveralls
Copy link

coveralls commented Apr 6, 2019

Coverage Status

Coverage decreased (-0.8%) to 85.242% when pulling 58697e2 on tenorok:disableExit into 8706c31 on TypeStrong:master.

@blakeembrey
Copy link
Member

@tenorok Can you verify the behavior is what you expect when it's non-type errors (e.g. syntactic instead of semantic)? Also, I think it'd be better to name this feature differently - maybe --log-error or something similar?

@tenorok
Copy link
Contributor Author

tenorok commented Apr 7, 2019

@blakeembrey Thank you for quick answer! I did two checks, which expected led to process crashing.

  1. I called un existing method console.bar()

Снимок экрана 2019-04-07 в 16 46 18

  1. I simulated situation when iterator of cycle went over the array length limit.
const arr: string[] = [];
for (let i = 0; i <= 1; i++) {
    console.log(arr[i].length);
}

Снимок экрана 2019-04-07 в 16 53 04

Now option renamed. I have doubted about naming, thank you for suggestion.

@tenorok
Copy link
Contributor Author

tenorok commented Apr 13, 2019

@blakeembrey Can I do anything else?

@blakeembrey
Copy link
Member

@tenorok No, sorry. This seems great. One thing I did notice is that the TypeScript compiler completely omits the invalid line instead of, in regular JS, it'd throw a syntax error. We may want to separate syntax and semantic issues later.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants