Run Globally mean we can run ts-node
command everywhere without package.json.
Globally install ts-node
pnpm install -g typescript ts-node tslib @types/node
# verify
ts-node -v
- tslib is a runtime library for TypeScript that contains all of the TypeScript helper functions.
- @types/node contains type definitions for Node.js.
Prepare a simple sample
Create a ts file:
touch test.ts
Write a simple sample:
const teamName: string = 'π¦π¦π¦';
console.log('π', teamName);
Run ts file everywhere
ts-node test.ts
Expected output is "π π¦π¦π¦".