How create project use Typescript with extension .TS

How create new project with extension .ts file ? like create-react-app --typescript ? I don’t want create project use js file :frowning:

Hi @quangthienit1994

Here is one repo with TypeScript.


You can use it, contribute to it or learn from it.

Basically all you need is to install TypeScript, add tsconfig.json file to project and rename existing files from .js to .ts. Pure JS is valid TS too so there should be no problems.

Little bit more how to setup TS:
https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html

2 Likes

Hi @McSneaky,

How steps:

  1. adonis new yardstick
  2. install repo above ?
  3. rename all file .js in project to .ts. Like server.ts in root folder ?

Do you try install repo above ? it has many errors.

Hi @quangthienit1994

Sorry I think I linked wrong project.
The one I linked has only types, but I wanted to link this:

Quick start Adonis project with TS (by same dude / dudette)

So far I have just moved projects following tutorial that I linked above (https://www.typescriptlang.org/docs/handbook/migrating-from-javascript.html)

  1. Install Adonis (or use repo above)
  2. Rename .js files to .ts
  3. Setup tsconfig.json
  4. In production run Adonis from compiled / output folder

Humm… Perhaps we need config manything when we install repo above, mistake manything in Tslint. But, thanks you.
May be i need leave Adonis typescript, because it not success.

Wait until AdonisJs version 5 is released instead of struggling with things you can avoid for now. The best fight you can do is the one you can avoid.

:rofl::rofl: OK you right.