diff --git a/README.md b/README.md index 7a12a05..0c3e31a 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,5 @@ # ts-node reproductions -If you find a bug in ts-node and file an issue, it's helpful -- even necessary -- to create a minimal reproduction of the bug. +When you try to create new Array as spread from Set, you always getting empty array. -This link explains why we ask for a minimal reproduction. Thank you in advance! -https://gist.github.com/Rich-Harris/88c5fc2ac6dc941b22e7996af05d70ff - -One way to do that is opening a pull-request on this repository with your reproduction. Github Actions will execute `./run.sh`. - -You can put anything you want here: add/remove dependencies in `package.json`, change the commands in `run.sh`, change the code in `./example.ts`, -or add a hundred more `.ts` files. - -Once your pull request is submitted here, link to it in your ts-node bug report. +To reproduce, just run npm start diff --git a/example.ts b/example.ts index a201bd7..534de39 100644 --- a/example.ts +++ b/example.ts @@ -1 +1,16 @@ -console.log('Some .ts code reproducing a bug'); +const a = [ + 'Row one', + 'Row two', +]; + +const b = [ + 'Row three', + 'Row four', +]; + +const set = [ + ...new Set([ ...a, ...b ]) +]; + +// If you will see empty array - this is a bug +console.log(set); diff --git a/package.json b/package.json index 4d56496..35eaedc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,9 @@ { "dependencies": { - "ts-node": "latest", - "typescript": "latest" + "cross-env": "7.0.3", + "ts-node": "10.0.0" + }, + "scripts": { + "start": "cross-env NODE_ENV=production node -r ts-node/register index.js" } } diff --git a/run.sh b/run.sh index d553b44..77e5bcf 100644 --- a/run.sh +++ b/run.sh @@ -4,10 +4,10 @@ n lts # Install package.json dependencies -yarn +npm install # Run ts-node -yarn ts-node ./example.ts +npm start echo "Process exited with code: $?" echo diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..b18e5bc --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,5 @@ +{ + "compilerOptions": { + "allowJs": true + } +}