From e9d8c0726dfb37032f516a1c822344c5478521a1 Mon Sep 17 00:00:00 2001 From: Alexander Skvortsov Date: Thu, 7 Apr 2022 16:18:47 -0400 Subject: [PATCH] feat: update tsconfig docs --- js-packages/tsconfig/README.md | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/js-packages/tsconfig/README.md b/js-packages/tsconfig/README.md index b9db677cd..edd9e9ad8 100644 --- a/js-packages/tsconfig/README.md +++ b/js-packages/tsconfig/README.md @@ -4,6 +4,16 @@ A standardised `tsconfig.json` for use in Flarum extensions. ## Usage +### With Flarum CLI + +Flarum CLI can add/manage TypeScript configuration for you! Run: + +`flarum-cli infra typescript` in your extension's root to configure TypeScript. + +You can then re-run the same command, or use `flarum-cli audit infra [--fix]` to keep this config up to date. + +## Without Flarum CLI + You'll need to configure a `tsconfig.json` file to ensure your IDE sets up Typescript support correctly. You need to install this package as a dev dependency to your extension JS: @@ -22,7 +32,7 @@ A baseline `tsconfig.json` is provided below that you can modify as needed. This // This will match all .ts, .tsx, .d.ts, .js, .jsx files in your `src` folder // and also tells your Typescript server to read core's global typings for // access to `dayjs` and `$` in the global namespace. - "include": ["src/**/*", "../vendor/flarum/framework/js/dist-typings/@types/**/*"], + "include": ["src/**/*", "../vendor/*/*/js/dist-typings/@types/**/*"], "compilerOptions": { // This will output typings to `dist-typings` "declarationDir": "./dist-typings",