Skip to content

Commit 02cb67a

Browse files
committed
Improve documentation and screenshot with .type
1 parent f6604da commit 02cb67a

File tree

2 files changed

+20
-18
lines changed

2 files changed

+20
-18
lines changed

README.md

+20-18
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,17 @@
1212
```sh
1313
npm install -g ts-node
1414

15-
# Make sure you install your TypeScript-compatible compiler.
15+
# Install a TypeScript compiler (requires `typescript` by default).
1616
npm install -g typescript
1717
```
1818

1919
## Features
2020

21-
* Execute TypeScript with node
21+
![TypeScript REPL](https://github.com/blakeembrey/ts-node/raw/master/screenshot.png)
22+
23+
* Execute TypeScript files with node
2224
* Interactive REPL
23-
* Execute (and print) TypeScript inline
25+
* Execute (and print) TypeScript through the CLI
2426
* Supports source maps
2527
* Supports `tsconfig.json`
2628

@@ -30,40 +32,31 @@ npm install -g typescript
3032
# Execute a script as you world normally with `node`.
3133
ts-node script.ts
3234

33-
# Start a TypeScript REPL
35+
# Start the TypeScript REPL.
3436
ts-node
3537

36-
# Execute code snippets with TypeScript
38+
# Execute code snippets with TypeScript.
3739
ts-node -e 'console.log("Hello, world!")'
3840

39-
# Execute and print code snippets with TypeScript
41+
# Execute and print code snippets with TypeScript.
4042
ts-node -p '"Hello, world!"'
4143
```
4244

43-
**With Mocha**
45+
**Mocha:**
4446

4547
```
4648
mocha test.ts --require ts-node/register src/**/*.spec.ts
4749
```
4850

49-
**With Tape:**
51+
**Tape:**
5052

5153
```
5254
ts-node tape src/**/*.spec.ts
5355
```
5456

55-
### Using TypeScript With Node Programmatically
56-
57-
```js
58-
require('ts-node').register({ /* options */ })
59-
60-
// Or using the shortcut file.
61-
require('ts-node/register')
62-
```
63-
6457
### Loading `tsconfig.json`
6558

66-
**Typescript Node** automatically loads `tsconfig.json` options and files from the current directory using [tsconfig](https://github.com/TypeStrong/tsconfig).
59+
**Typescript Node** automatically loads `tsconfig.json` options and referenced files from the current directory using [tsconfig](https://github.com/TypeStrong/tsconfig).
6760

6861
### Configuration Options
6962

@@ -78,6 +71,15 @@ ts-node --compiler ntypescript --project src --ignoreWarnings 2304 hello-world.t
7871
* **ignoreWarnings** Set an array of TypeScript diagnostic codes to ignore.
7972
* **disableWarnings** Ignore all TypeScript errors.
8073

74+
### Programmatic Usage
75+
76+
```js
77+
require('ts-node').register({ /* options */ })
78+
79+
// Or using the shortcut file.
80+
require('ts-node/register')
81+
```
82+
8183
## License
8284

8385
MIT

screenshot.png

74.7 KB
Loading

0 commit comments

Comments
 (0)