adonisjs / rfcs

πŸ’¬ Sharing big changes with community to add them to the AdonisJs eco-system
52 stars 6 forks source link

Moving core to Typescript #1

Closed thetutlage closed 4 years ago

thetutlage commented 6 years ago

Brief history

Typescript is a superset of Javascript but improves the overall quality of the entire codebase in many ways.

What problem does it solve?

  1. Strict typing does help in mitigating some initial level bugs.
  2. Typescript lovers can enjoy Adonis more, since their will be type-definitions for everything.
  3. The biggest win is automatic API documentation using typedoc. Writing API docs by hand(what we do now), is tough and harder to maintain. However, typedoc solves this for us.

Proposal

Me (Harminder Virk), will take one piece at a time and will move it to Typescript. Since this change will become part of 5.0, I can take the leverage to code new features in Typescript and migrate the old codebase at the same time.

Are you willing to work on it?

YES, YES, YES

assertchris commented 6 years ago

How will this change the experience of someone working in the framework, who doesn't want to use TS? Do I need to change my workflow or install additional tooling or serve the app any differently?

thetutlage commented 6 years ago

Nothing changes for the end user. I don’t want to enforce Typescript or any other compiled language to the end user.

The typescript is just for the core

ammezie commented 6 years ago

Will this be taking the approach of Angular? With options to either use Typescript or JavaScript?

DCzajkowski commented 6 years ago

I don't know the Angular case, but here it won't change anything for the end user. It's Node-based, all of the files will be compiled to native JS. So when you use it you won't see a difference, but Typescript-using folks will have type-safety built-in. :)

niallobrien commented 6 years ago

Will this affect startup time or as devs, will we be using the pre-compiled output?

DCzajkowski commented 6 years ago

As far as I know there is no way to run typescript without compiling it first, so there would be no changes to startup times. If you are going to use Typescript there would be compilation time involved, but that takes place only once.

thetutlage commented 6 years ago

Lemme clear some doubts.

  1. Adonis core will make use of Typescript for benefits shared above. (For me the biggest one is the typedoc).
  2. All code will be compiled to Javascript and only JS files are published on npm.
  3. Your applications can continue using Javascript, with no additional dependencies on runtime compilation.
DCzajkowski commented 6 years ago

If you are going to put only js files to npm, how are the type definitions going to be available for users? Is TypeScript gonna create some typedef files?

thetutlage commented 6 years ago

It will be the dist folder generated by Typescript. So type definitions will be included. I was trying to say that source .ts files will not be published.

DCzajkowski commented 6 years ago

Ok, makes sense :)

shirshak55 commented 6 years ago

nice :) Typescript is future of JS

borie88 commented 5 years ago

Already starting to see some benefits with auto-completion in VS Code. This is great!

SAGV commented 5 years ago

Would there be any official docs on "how-to" use adonis with typescript? I'm especially interested in some guide on how to properly compile code for production and the final project structure with typescript

RomainLanz commented 5 years ago

Hey @SAGV! πŸ‘‹

Yes, there will be!

SAGV commented 5 years ago

Hi @RomainLanz, This is awesome! Is there any update or ETA on the official typescript support? (I'm not rushing, just curious)

mtamadon commented 5 years ago

Hi , How can I create a typescript boilerplate? Will you provide that ? Me and some other folks may want to use TS for the main app too.

RomainLanz commented 5 years ago

Hey @mtamadon! πŸ‘‹

Everything will be provided and explained, we do not help people installing V5 at the moment because it's not ready yet.

aat2703 commented 4 years ago

How far is the progress on v5? Really looking forward to this... We're currently using Sequelize which is lacking so many features...

RomainLanz commented 4 years ago

Close to release. πŸ‘€

aat2703 commented 4 years ago

Okay, i'll be waiting for the release before testing it out. Typescript is a must for us... Do you have en ETA?

aat2703 commented 4 years ago

guys? πŸ˜†