Skip to content

Instantly share code, notes, and snippets.

@samuraijane
Created October 28, 2021 22:03
Show Gist options
  • Save samuraijane/b7a5bbf4272637357da860960506bf82 to your computer and use it in GitHub Desktop.
Save samuraijane/b7a5bbf4272637357da860960506bf82 to your computer and use it in GitHub Desktop.
In order to run TypeScript code in a shell from the command line, you need NPM's `ts-node` package.
`npm install -g @[email protected]`
`npm install -g @[email protected]`
If you see a warning or an error that TypeScript has an unmet peer dependency for `@type/node`, then install it directly.
`npm install -g @types/node`
Initiate a TypeScript Node Shell
`ts-node`
At the prompt, enter code that TypeScript recognizes
`let name: string = 'Anna'`
If you do not see any errors, then the TypeScript Node shell is working correctly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment