Skip to content

Commit

Permalink
feat: added TypeScript + ts-node/esm example
Browse files Browse the repository at this point in the history
  • Loading branch information
JoshuaKGoldberg committed Jan 21, 2024
1 parent 84c77aa commit 75473a2
Show file tree
Hide file tree
Showing 10 changed files with 10,079 additions and 0 deletions.
7,570 changes: 7,570 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

1,007 changes: 1,007 additions & 0 deletions packages/hello-world/package-lock.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions packages/typescript-ts-node-esm-loader/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
lib
4 changes: 4 additions & 0 deletions packages/typescript-ts-node-esm-loader/.mocharc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"extension": ["ts"],
"spec": "src/**/*.spec.ts"
}
16 changes: 16 additions & 0 deletions packages/typescript-ts-node-esm-loader/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# TypeScript with `ts-node/esm` Loader

A standalone project showing TypeScript source files transpiled on-the-fly with [`ts-node/esm`](ts-node/register`](https://typestrong.org/ts-node/docs/usage/#node-flags-and-other-tools) as a Node ECMAScript Modules loader.

```shell
npm i
npm run test
```

Note that the `tsconfig.json` file has `compilerOptions`:

- `"noEmit": true`: as there's no need to transpile `.ts` files on disk to `.js` files on disk before running these tests
- `"module": "ESNext`: indicating code should be transpiled in-memory as ESM

Additionally, `package.json` has `"type": "module"`.
If it didn't, TypeScript source files would need the `.mts` extension.
Loading

0 comments on commit 75473a2

Please sign in to comment.