Tag: typescript

Pacharapol Withayasakpunt Pacharapol Withayasakpunt
Thu 23 April 2020

This might not be something so special, but I bet not everyone knows.

Running *.ts files directly

Use ts-node instead of node, and ts-node-dev instead of nodemon.

Cannot run ts-node due to import syntaxes? No problemo, try this

ts-node -O '{"module": "commonjs"}' scripts/example.ts

I do not recommend you use ts-node in production.

Pacharapol Withayasakpunt Pacharapol Withayasakpunt
Tue 7 January 2020

Do you know that Visual Studio Code itself can auto-fix your code on save, to be compatible with linting rules.

Currently, I auto-fixes TypeScript, JavaScript, Vue, Markdown files.

For TypeScript, JavaScript, Vue; I simply use ESLint (there is TSLint, but it is becoming deprecated). VSCode ESLint might also be required

For Markdown, it is a little different. I use VSCode MarkdownLint to auto-fix on save.