Installation
-
Install
adonisjs-types
package:npm i --save-dev adonisjs-types
-
Add following
tsconfig.json
file in your project root:
This is a minimal required configuration for types to work. You can tweak it further.
Usage
Types are provided through use
method, for example: const Env = use('Env')
will be correctly typed. If you want to get intellisense on controller methods, jsDoc will help:
/** * @param */ { // } // Or, if you want destructuring: { // }