Skip to content

Commit 39eeedd

Browse files
committed
Part 1 - Include Typescript configuration
# tsconfig.json This file is where the compilation options are set. Some important points to highlight: - In this example, I've set the code to be transformed from "es2017" into "commonjs". - The module resolution strategy chosen was "node". For older versions of typescript (1.5 and under), the mode would be "classic". - experimentalDecorators is set to true because this is a requirement for the upcoming vue typescript decorators. A crucial library for us to have strongly typed Vue components. - The "include" key is only referencing which files should the typescript transpiler pay attention to. - Every other option chosen is a matter of personal preference on how strict you want your Typescript experience to be. # global-declares.d.ts - Typescript requires imports to reference modules. This file is just informing typescript that whatever import referencing a .vue file, should be understood as a Vue object.
1 parent ed4895c commit 39eeedd

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

resources/js/global-declares.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module '*.vue' {
2+
import Vue from 'vue';
3+
export default Vue;
4+
}

tsconfig.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"compilerOptions": {
3+
"target": "es2017",
4+
"module": "commonjs",
5+
"moduleResolution": "node",
6+
"strict": true,
7+
"noImplicitAny": true,
8+
"sourceMap": true,
9+
"experimentalDecorators": true
10+
},
11+
"include": [
12+
"resources/js/**/*"
13+
]
14+
}

0 commit comments

Comments
 (0)