-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtsconfig.json
More file actions
94 lines (75 loc) · 5.67 KB
/
tsconfig.json
File metadata and controls
94 lines (75 loc) · 5.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
{
"$schema": "https://json.schemastore.org/tsconfig.json",
"compilerOptions": {
// Foundry is on the bleeding edge of JavaScript so always having the newest version available is nice.
// If you want to target an older version of JavaScript anyways, first consider setting Vite to transpile to that version.
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Bundler",
"noEmit": true,
"outDir": ".typescript-build",
"allowImportingTsExtensions": true,
// Vite does interop with ESM and CommonJS modules so this option matches the runtime.
"esModuleInterop": true,
// `@pixi/utils/lib/index.d.mts` still depends on `allowSyntheticDefaultImports`.
"allowSyntheticDefaultImports": true,
// By default TypeScript will include all types under `@types` but fvtt-types is not under `@types` and enabling only what you need is a good idea.
// You can add types here if necessary.
"types": ["fvtt-types"],
// Strict is _highly_ recommended. It's a whole suite of options in tsc that help you catch bugs early.
// If you want to disable it for some reason, you must add "strictNullChecks": true or else foundry-vtt-types may not function correctly.
"strict": true,
// See: https://www.typescriptlang.org/tsconfig/#verbatimModuleSyntax
"verbatimModuleSyntax": true,
// This setting keeps developers with different file name case sensitivity from running into issues.
// See: https://www.typescriptlang.org/tsconfig/#forceConsistentCasingInFileNames
"forceConsistentCasingInFileNames": true,
// Vite supports importing JSON files as modules.
"resolveJsonModule": true,
// This option is makes it so that the type of `x[0]` is `T | undefined` instead of `T`.
// If you find this annoying, disable this option
"noUncheckedIndexedAccess": true,
// An import like `import "foo";` won't be type checked by default.
// This can be convenient with some bundlers but it's not necessary with Vite and it's generally safer to have this option on.
"noUncheckedSideEffectImports": true,
// It's possible for errors to be thrown like `throw 1` which obviously isn't a subclass of `Error`.
// For the greatest safety you can check if it's an instance of `Error` with `instanceof Error` but if you'd prefer not to, you can disable this rule.
"useUnknownInCatchVariables": true,
// Types like `Record<string, T>` are very unsafe.
// 1. They allow typos like `x.naem` when you really meant `x.name`.
// 2. Out of the box they don't force you to handle `undefined` (notably this is fixed by `noUncheckedIndexedAccess`).
// 3. They make it easier to make mistakes with mutation.
"noPropertyAccessFromIndexSignature": true,
"noImplicitOverride": true,
"allowJs": true,
// You might think that this option is useful to have on either for performance or to ignore errors.
// However due to how many types in fvtt-types are global this doesn't usually significantly help performance.
// Fortunately for performance, this template already builds practically instantly using Vite and incremental typechecking runs in the background.
//
// Still it wouldn't be harmful if it weren't for the two issues with `skipLibCheck`. Firstly the way its semantics works is that it skips _all_ `.d.ts` files.
// This means that even `.d.ts` files in your own repo aren't type checked which can be an issue for some repositories. Secondly `skipLibCheck` silences some of
// the most interesting errors; those which occur within fvtt-types files. When this happens it's a strong indication that the durability of fvtt-types isn't high
// enough to your configuration in this area and it's best to be reported.
"skipLibCheck": false,
// The editor always runs an incremental build but if you run tsc directly you might want to take advantage of the performance boost from incremental builds.
// This is essentially a free performance boost if you run tsc from the command line a lot.
//
// Note that occassionally an incremental build might cause "ghost errors." That is an error that only occurs due to recompilation occuring in a different order than
// the original compilation. Given that the ordering of compilation is not guaranteed anywhere this is only uncovering already existing, legitimate, issues but this can
// still be rather frustrating as tracking them down can be difficult.
"incremental": true
// Consider enabling this if you have JS files and want TypeScript to lint them.
// Most starting projects will probably want to simply write in TypeScript and most existing projects will probably not have JS files that pass typechecking so this is disabled.
// If you have individual files you want to be type checked add a comment at the start of the file `// @ts-check`.
// "checkJs": true,
// This option not enabled by default because it can be very annoying.
// Consider enabling this option if you want to catch bugs arising from stuff like `{ optionalProperty: undefined }`.
// This can occur in Foundry from cases like in a configuration object where it'll override the default value.
// However opting-in to allowing `{ optionalProperty: undefined }` means you must write `{ optionalProperty?: T | undefined }` instead of `{ optionalProperty?: T }` for the type.
// This can be a nuisance because many libraries don't properly add `| undefined` and even fvtt-types is not completely correct here.
// "exactOptionalPropertyTypes": true,
// Consider enabling this option if you switch another bundler that doesn't know how to bundle TypeScript multiple files at a time.
// "isolatedModules": true,
},
"exclude": ["dist"]
}