Skip to content

Conversation

@hjdivad
Copy link

@hjdivad hjdivad commented Apr 20, 2020

In TypeScript 3.8 there exists a recovery code 1007 for missing braces, which is used for expressions such as:

  async function main() {

Add this code to RECOVERY_CODES to improve the interactive (REPL) experience.

In TypeScript 3.8 there exists a recovery code 1007 for missing braces,
which is used for expressions such as:
```
  async function main() {
```

Add this code to RECOVERY_CODES to improve the interactive (REPL)
experience.
@hjdivad
Copy link
Author

hjdivad commented Apr 20, 2020

I've tested this locally and confirmed this works.

Are there existing tests for RECOVERY_CODES I should be updating? I hadn't noticed any in a cursory look.

@hjdivad
Copy link
Author

hjdivad commented Apr 20, 2020

Test failure is not introduced by this pr: it's the same as in master

@hjdivad hjdivad mentioned this pull request Apr 20, 2020
8 tasks
@cspotcode
Copy link
Collaborator

@hjdivad was this causing you problems using the latest version of ts-node? I did a test, and ts-node already handles the example you provided.

$ npm install ts-node@latest typescript@latest
$ yarn ts-node -vv
ts-node v8.8.2
node v13.8.0
compiler v3.8.3
Done in 0.33s.
$ yarn ts-node
$ /d/Personal-dev/@TypeStrong/ts-node-repros/node_modules/.bin/ts-node
> async function main() {
... }
> 

It shows me the ellipsis correctly, allowing me to finish typing the function body.

@hjdivad
Copy link
Author

hjdivad commented Apr 20, 2020

@cspotcode hmm the versions look the same as what I was doing, except that I was using node 12.16.1.

I'll take a look tonight or tomorrow and see if I've got something weird in my project or if I can create a minimal reproduction

@cspotcode
Copy link
Collaborator

@hjdivad thank you, a reproduction would be great. This seems like a simple enough thing to merge, but I still need to understand what problem it fixes.

@hjdivad
Copy link
Author

hjdivad commented Apr 21, 2020

@cspotcode looks like I was mistaken. Thanks for making me double-check 😄

I was re-evaluating a file a few times and re-defining a function. The 1007 error was showing up but it was one among several; the real fix was ts-node -D 2393 (ie ignore duplicate function declaration).

Cheers

@hjdivad hjdivad closed this Apr 21, 2020
@hjdivad hjdivad deleted the hjdivad/add-code-1007 branch April 21, 2020 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants