ai-hero-cli 0.0.4 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/bin.js +67704 -0
  2. package/package.json +7 -50
  3. package/LICENSE +0 -21
  4. package/README.md +0 -3
  5. package/dist/bin.d.ts +0 -1
  6. package/dist/bin.js +0 -4
  7. package/dist/bin.js.map +0 -1
  8. package/dist/command.d.ts +0 -2
  9. package/dist/command.js +0 -114
  10. package/dist/command.js.map +0 -1
  11. package/dist/config.d.ts +0 -15
  12. package/dist/config.js +0 -52
  13. package/dist/config.js.map +0 -1
  14. package/dist/model.d.ts +0 -6
  15. package/dist/model.js +0 -26
  16. package/dist/model.js.map +0 -1
  17. package/docs/tsconfig/allowArbitraryExtensions.md +0 -38
  18. package/docs/tsconfig/allowImportingTsExtensions.md +0 -9
  19. package/docs/tsconfig/allowJs.md +0 -41
  20. package/docs/tsconfig/allowSyntheticDefaultImports.md +0 -56
  21. package/docs/tsconfig/allowUmdGlobalAccess.md +0 -8
  22. package/docs/tsconfig/allowUnreachableCode.md +0 -40
  23. package/docs/tsconfig/allowUnusedLabels.md +0 -23
  24. package/docs/tsconfig/alwaysStrict.md +0 -8
  25. package/docs/tsconfig/assumeChangesOnlyAffectDirectDependencies.md +0 -8
  26. package/docs/tsconfig/baseUrl.md +0 -26
  27. package/docs/tsconfig/charset.md +0 -7
  28. package/docs/tsconfig/checkJs.md +0 -40
  29. package/docs/tsconfig/clean.md +0 -6
  30. package/docs/tsconfig/composite.md +0 -17
  31. package/docs/tsconfig/customConditions.md +0 -41
  32. package/docs/tsconfig/declaration.md +0 -32
  33. package/docs/tsconfig/declarationDir.md +0 -36
  34. package/docs/tsconfig/declarationMap.md +0 -9
  35. package/docs/tsconfig/diagnostics.md +0 -8
  36. package/docs/tsconfig/disableFilenameBasedTypeAcquisition.md +0 -16
  37. package/docs/tsconfig/disableReferencedProjectLoad.md +0 -8
  38. package/docs/tsconfig/disableSizeLimit.md +0 -6
  39. package/docs/tsconfig/disableSolutionSearching.md +0 -8
  40. package/docs/tsconfig/disableSourceOfProjectReferenceRedirect.md +0 -7
  41. package/docs/tsconfig/downlevelIteration.md +0 -100
  42. package/docs/tsconfig/emitBOM.md +0 -8
  43. package/docs/tsconfig/emitDeclarationOnly.md +0 -11
  44. package/docs/tsconfig/emitDecoratorMetadata.md +0 -81
  45. package/docs/tsconfig/enable.md +0 -14
  46. package/docs/tsconfig/erasableSyntaxOnly.md +0 -65
  47. package/docs/tsconfig/esModuleInterop.md +0 -74
  48. package/docs/tsconfig/exactOptionalPropertyTypes.md +0 -37
  49. package/docs/tsconfig/exclude.md +0 -11
  50. package/docs/tsconfig/excludeDirectories.md +0 -14
  51. package/docs/tsconfig/excludeFiles.md +0 -14
  52. package/docs/tsconfig/experimentalDecorators.md +0 -11
  53. package/docs/tsconfig/explainFiles.md +0 -54
  54. package/docs/tsconfig/extendedDiagnostics.md +0 -9
  55. package/docs/tsconfig/extends.md +0 -49
  56. package/docs/tsconfig/fallbackPolling.md +0 -11
  57. package/docs/tsconfig/files.md +0 -26
  58. package/docs/tsconfig/force.md +0 -6
  59. package/docs/tsconfig/forceConsistentCasingInFileNames.md +0 -10
  60. package/docs/tsconfig/generateCpuProfile.md +0 -15
  61. package/docs/tsconfig/generateTrace.md +0 -6
  62. package/docs/tsconfig/importHelpers.md +0 -46
  63. package/docs/tsconfig/importsNotUsedAsValues.md +0 -16
  64. package/docs/tsconfig/include.md +0 -66
  65. package/docs/tsconfig/incremental.md +0 -10
  66. package/docs/tsconfig/inlineSourceMap.md +0 -35
  67. package/docs/tsconfig/inlineSources.md +0 -36
  68. package/docs/tsconfig/isolatedDeclarations.md +0 -8
  69. package/docs/tsconfig/isolatedModules.md +0 -77
  70. package/docs/tsconfig/jsx.md +0 -111
  71. package/docs/tsconfig/jsxFactory.md +0 -43
  72. package/docs/tsconfig/jsxFragmentFactory.md +0 -69
  73. package/docs/tsconfig/jsxImportSource.md +0 -95
  74. package/docs/tsconfig/keyofStringsOnly.md +0 -8
  75. package/docs/tsconfig/lib.md +0 -75
  76. package/docs/tsconfig/libReplacement.md +0 -22
  77. package/docs/tsconfig/listEmittedFiles.md +0 -42
  78. package/docs/tsconfig/listFiles.md +0 -40
  79. package/docs/tsconfig/locale.md +0 -26
  80. package/docs/tsconfig/mapRoot.md +0 -18
  81. package/docs/tsconfig/maxNodeModuleJsDepth.md +0 -11
  82. package/docs/tsconfig/module.md +0 -125
  83. package/docs/tsconfig/moduleDetection.md +0 -15
  84. package/docs/tsconfig/moduleResolution.md +0 -13
  85. package/docs/tsconfig/moduleSuffixes.md +0 -26
  86. package/docs/tsconfig/newLine.md +0 -6
  87. package/docs/tsconfig/noCheck.md +0 -6
  88. package/docs/tsconfig/noEmit.md +0 -10
  89. package/docs/tsconfig/noEmitHelpers.md +0 -38
  90. package/docs/tsconfig/noEmitOnError.md +0 -8
  91. package/docs/tsconfig/noErrorTruncation.md +0 -45
  92. package/docs/tsconfig/noFallthroughCasesInSwitch.md +0 -22
  93. package/docs/tsconfig/noImplicitAny.md +0 -26
  94. package/docs/tsconfig/noImplicitOverride.md +0 -66
  95. package/docs/tsconfig/noImplicitReturns.md +0 -17
  96. package/docs/tsconfig/noImplicitThis.md +0 -28
  97. package/docs/tsconfig/noImplicitUseStrict.md +0 -7
  98. package/docs/tsconfig/noLib.md +0 -9
  99. package/docs/tsconfig/noPropertyAccessFromIndexSignature.md +0 -57
  100. package/docs/tsconfig/noResolve.md +0 -9
  101. package/docs/tsconfig/noStrictGenericChecks.md +0 -20
  102. package/docs/tsconfig/noUncheckedIndexedAccess.md +0 -53
  103. package/docs/tsconfig/noUncheckedSideEffectImports.md +0 -52
  104. package/docs/tsconfig/noUnusedLocals.md +0 -15
  105. package/docs/tsconfig/noUnusedParameters.md +0 -15
  106. package/docs/tsconfig/out.md +0 -9
  107. package/docs/tsconfig/outDir.md +0 -39
  108. package/docs/tsconfig/outFile.md +0 -11
  109. package/docs/tsconfig/paths.md +0 -39
  110. package/docs/tsconfig/plugins.md +0 -17
  111. package/docs/tsconfig/preserveConstEnums.md +0 -58
  112. package/docs/tsconfig/preserveSymlinks.md +0 -10
  113. package/docs/tsconfig/preserveValueImports.md +0 -18
  114. package/docs/tsconfig/preserveWatchOutput.md +0 -6
  115. package/docs/tsconfig/pretty.md +0 -7
  116. package/docs/tsconfig/reactNamespace.md +0 -6
  117. package/docs/tsconfig/references.md +0 -9
  118. package/docs/tsconfig/removeComments.md +0 -33
  119. package/docs/tsconfig/resolveJsonModule.md +0 -44
  120. package/docs/tsconfig/resolvePackageJsonExports.md +0 -8
  121. package/docs/tsconfig/resolvePackageJsonImports.md +0 -8
  122. package/docs/tsconfig/rewriteRelativeImportExtensions.md +0 -8
  123. package/docs/tsconfig/rootDir.md +0 -66
  124. package/docs/tsconfig/rootDirs.md +0 -66
  125. package/docs/tsconfig/skipDefaultLibCheck.md +0 -6
  126. package/docs/tsconfig/skipLibCheck.md +0 -19
  127. package/docs/tsconfig/sourceMap.md +0 -39
  128. package/docs/tsconfig/sourceRoot.md +0 -18
  129. package/docs/tsconfig/stopBuildOnErrors.md +0 -6
  130. package/docs/tsconfig/strict.md +0 -11
  131. package/docs/tsconfig/strictBindCallApply.md +0 -34
  132. package/docs/tsconfig/strictBuiltinIteratorReturn.md +0 -6
  133. package/docs/tsconfig/strictFunctionTypes.md +0 -55
  134. package/docs/tsconfig/strictNullChecks.md +0 -58
  135. package/docs/tsconfig/strictPropertyInitialization.md +0 -29
  136. package/docs/tsconfig/stripInternal.md +0 -60
  137. package/docs/tsconfig/suppressExcessPropertyErrors.md +0 -16
  138. package/docs/tsconfig/suppressImplicitAnyIndexErrors.md +0 -25
  139. package/docs/tsconfig/synchronousWatchDirectory.md +0 -14
  140. package/docs/tsconfig/target.md +0 -18
  141. package/docs/tsconfig/traceResolution.md +0 -7
  142. package/docs/tsconfig/tsBuildInfoFile.md +0 -17
  143. package/docs/tsconfig/typeAcquisition.md +0 -37
  144. package/docs/tsconfig/typeRoots.md +0 -21
  145. package/docs/tsconfig/types.md +0 -40
  146. package/docs/tsconfig/useDefineForClassFields.md +0 -10
  147. package/docs/tsconfig/useUnknownInCatchVariables.md +0 -21
  148. package/docs/tsconfig/verbatimModuleSyntax.md +0 -148
  149. package/docs/tsconfig/verbose.md +0 -6
  150. package/docs/tsconfig/watchDirectory.md +0 -10
  151. package/docs/tsconfig/watchFile.md +0 -12
  152. package/prompts/hows-my-tsconfig-score.md +0 -29
  153. package/prompts/hows-my-tsconfig.md +0 -75
@@ -1,38 +0,0 @@
1
- ---
2
- display: 'No Emit Helpers'
3
- oneline: 'Disable generating custom helper functions like `__extends` in compiled output.'
4
- ---
5
-
6
- Instead of importing helpers with [`importHelpers`](#importHelpers), you can provide implementations in the global scope for the helpers you use and completely turn off emitting of helper functions.
7
-
8
- For example, using this `async` function in ES5 requires a `await`-like function and `generator`-like function to run:
9
-
10
- ```ts twoslash
11
- const getAPI = async (url: string) => {
12
- // Get API
13
- return {};
14
- };
15
- ```
16
-
17
- Which creates quite a lot of JavaScript:
18
-
19
- ```ts twoslash
20
- // @showEmit
21
- // @target: ES5
22
- const getAPI = async (url: string) => {
23
- // Get API
24
- return {};
25
- };
26
- ```
27
-
28
- Which can be switched out with your own globals via this flag:
29
-
30
- ```ts twoslash
31
- // @showEmit
32
- // @target: ES5
33
- // @noEmitHelpers
34
- const getAPI = async (url: string) => {
35
- // Get API
36
- return {};
37
- };
38
- ```
@@ -1,8 +0,0 @@
1
- ---
2
- display: 'No Emit On Error'
3
- oneline: 'Disable emitting files if any type checking errors are reported.'
4
- ---
5
-
6
- Do not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported.
7
-
8
- This defaults to `false`, making it easier to work with TypeScript in a watch-like environment where you may want to see results of changes to your code in another environment before making sure all errors are resolved.
@@ -1,45 +0,0 @@
1
- ---
2
- display: 'No Error Truncation'
3
- oneline: 'Disable truncating types in error messages.'
4
- ---
5
-
6
- Do not truncate error messages.
7
-
8
- With `false`, the default.
9
-
10
- ```ts twoslash
11
- // @errors: 2322 2454
12
- var x: {
13
- propertyWithAnExceedinglyLongName1: string;
14
- propertyWithAnExceedinglyLongName2: string;
15
- propertyWithAnExceedinglyLongName3: string;
16
- propertyWithAnExceedinglyLongName4: string;
17
- propertyWithAnExceedinglyLongName5: string;
18
- propertyWithAnExceedinglyLongName6: string;
19
- propertyWithAnExceedinglyLongName7: string;
20
- propertyWithAnExceedinglyLongName8: string;
21
- };
22
-
23
- // String representation of type of 'x' should be truncated in error message
24
- var s: string = x;
25
- ```
26
-
27
- With `true`
28
-
29
- ```ts twoslash
30
- // @errors: 2322 2454
31
- // @noErrorTruncation: true
32
- var x: {
33
- propertyWithAnExceedinglyLongName1: string;
34
- propertyWithAnExceedinglyLongName2: string;
35
- propertyWithAnExceedinglyLongName3: string;
36
- propertyWithAnExceedinglyLongName4: string;
37
- propertyWithAnExceedinglyLongName5: string;
38
- propertyWithAnExceedinglyLongName6: string;
39
- propertyWithAnExceedinglyLongName7: string;
40
- propertyWithAnExceedinglyLongName8: string;
41
- };
42
-
43
- // String representation of type of 'x' should be truncated in error message
44
- var s: string = x;
45
- ```
@@ -1,22 +0,0 @@
1
- ---
2
- display: 'No Fallthrough Cases In Switch'
3
- oneline: 'Enable error reporting for fallthrough cases in switch statements.'
4
- ---
5
-
6
- Report errors for fallthrough cases in switch statements.
7
- Ensures that any non-empty case inside a switch statement includes either `break`, `return`, or `throw`.
8
- This means you won't accidentally ship a case fallthrough bug.
9
-
10
- ```ts twoslash
11
- // @noFallthroughCasesInSwitch
12
- // @errors: 7029
13
- const a: number = 6;
14
-
15
- switch (a) {
16
- case 0:
17
- console.log('even');
18
- case 1:
19
- console.log('odd');
20
- break;
21
- }
22
- ```
@@ -1,26 +0,0 @@
1
- ---
2
- display: 'No Implicit Any'
3
- oneline: 'Enable error reporting for expressions and declarations with an implied `any` type.'
4
- ---
5
-
6
- In some cases where no type annotations are present, TypeScript will fall back to a type of `any` for a variable when it cannot infer the type.
7
-
8
- This can cause some errors to be missed, for example:
9
-
10
- ```ts twoslash
11
- // @noImplicitAny: false
12
- function fn(s) {
13
- // No error?
14
- console.log(s.subtr(3));
15
- }
16
- fn(42);
17
- ```
18
-
19
- Turning on `noImplicitAny` however TypeScript will issue an error whenever it would have inferred `any`:
20
-
21
- ```ts twoslash
22
- // @errors: 7006
23
- function fn(s) {
24
- console.log(s.subtr(3));
25
- }
26
- ```
@@ -1,66 +0,0 @@
1
- ---
2
- display: 'No Implicit Override'
3
- oneline: 'Ensure overriding members in derived classes are marked with an override modifier.'
4
- ---
5
-
6
- When working with classes which use inheritance, it's possible for a sub-class to get "out of sync" with the functions it overloads when they are renamed in the base class.
7
-
8
- For example, imagine you are modeling a music album syncing system:
9
-
10
- ```ts twoslash
11
- class Album {
12
- download() {
13
- // Default behavior
14
- }
15
- }
16
-
17
- class SharedAlbum extends Album {
18
- download() {
19
- // Override to get info from many sources
20
- }
21
- }
22
- ```
23
-
24
- Then when you add support for machine-learning generated playlists, you refactor the `Album` class to have a 'setup' function instead:
25
-
26
- ```ts twoslash
27
- class Album {
28
- setup() {
29
- // Default behavior
30
- }
31
- }
32
-
33
- class MLAlbum extends Album {
34
- setup() {
35
- // Override to get info from algorithm
36
- }
37
- }
38
-
39
- class SharedAlbum extends Album {
40
- download() {
41
- // Override to get info from many sources
42
- }
43
- }
44
- ```
45
-
46
- In this case, TypeScript has provided no warning that `download` on `SharedAlbum` _expected_ to override a function in the base class.
47
-
48
- Using `noImplicitOverride` you can ensure that the sub-classes never go out of sync, by ensuring that functions which override include the keyword `override`.
49
-
50
- The following example has `noImplicitOverride` enabled, and you can see the error received when `override` is missing:
51
-
52
- ```ts twoslash
53
- // @noImplicitOverride
54
- // @errors: 4114
55
- class Album {
56
- setup() {}
57
- }
58
-
59
- class MLAlbum extends Album {
60
- override setup() {}
61
- }
62
-
63
- class SharedAlbum extends Album {
64
- setup() {}
65
- }
66
- ```
@@ -1,17 +0,0 @@
1
- ---
2
- display: 'No Implicit Returns'
3
- oneline: 'Enable error reporting for codepaths that do not explicitly return in a function.'
4
- ---
5
-
6
- When enabled, TypeScript will check all code paths in a function to ensure they return a value.
7
-
8
- ```ts twoslash
9
- // @errors: 2366 2322
10
- function lookupHeadphonesManufacturer(color: 'blue' | 'black'): string {
11
- if (color === 'blue') {
12
- return 'beats';
13
- } else {
14
- ('bose');
15
- }
16
- }
17
- ```
@@ -1,28 +0,0 @@
1
- ---
2
- display: 'No Implicit This'
3
- oneline: 'Enable error reporting when `this` is given the type `any`.'
4
- ---
5
-
6
- Raise error on 'this' expressions with an implied 'any' type.
7
-
8
- For example, the class below returns a function which tries to access `this.width` and `this.height` – but the context
9
- for `this` inside the function inside `getAreaFunction` is not the instance of the Rectangle.
10
-
11
- ```ts twoslash
12
- // @errors: 2683
13
- class Rectangle {
14
- width: number;
15
- height: number;
16
-
17
- constructor(width: number, height: number) {
18
- this.width = width;
19
- this.height = height;
20
- }
21
-
22
- getAreaFunction() {
23
- return function () {
24
- return this.width * this.height;
25
- };
26
- }
27
- }
28
- ```
@@ -1,7 +0,0 @@
1
- ---
2
- display: 'No Implicit Use Strict'
3
- oneline: "Disable adding 'use strict' directives in emitted JavaScript files."
4
- ---
5
-
6
- You shouldn't need this. By default, when emitting a module file to a non-ES6 target, TypeScript emits a `"use strict";` prologue at the top of the file.
7
- This setting disables the prologue.
@@ -1,9 +0,0 @@
1
- ---
2
- display: 'No Lib'
3
- oneline: 'Disable including any library files, including the default lib.d.ts.'
4
- ---
5
-
6
- Disables the automatic inclusion of any library files.
7
- If this option is set, `lib` is ignored.
8
-
9
- TypeScript _cannot_ compile anything without a set of interfaces for key primitives like: `Array`, `Boolean`, `Function`, `IArguments`, `Number`, `Object`, `RegExp`, and `String`. It is expected that if you use `noLib` you will be including your own type definitions for these.
@@ -1,57 +0,0 @@
1
- ---
2
- display: 'No Property Access From Index Signature'
3
- oneline: 'Enforces using indexed accessors for keys declared using an indexed type.'
4
- ---
5
-
6
- This setting ensures consistency between accessing a field via the "dot" (`obj.key`) syntax, and "indexed" (`obj["key"]`) and the way which the property is declared in the type.
7
-
8
- Without this flag, TypeScript will allow you to use the dot syntax to access fields which are not defined:
9
-
10
- ```ts twoslash
11
- // @errors: 4111
12
- declare function getSettings(): GameSettings;
13
- // ---cut---
14
- interface GameSettings {
15
- // Known up-front properties
16
- speed: 'fast' | 'medium' | 'slow';
17
- quality: 'high' | 'low';
18
-
19
- // Assume anything unknown to the interface
20
- // is a string.
21
- [key: string]: string;
22
- }
23
-
24
- const settings = getSettings();
25
- settings.speed;
26
- // ^?
27
- settings.quality;
28
- // ^?
29
-
30
- // Unknown key accessors are allowed on
31
- // this object, and are `string`
32
- settings.username;
33
- // ^?
34
- ```
35
-
36
- Turning the flag on will raise an error because the unknown field uses dot syntax instead of indexed syntax.
37
-
38
- ```ts twoslash
39
- // @errors: 4111
40
- // @noPropertyAccessFromIndexSignature
41
- declare function getSettings(): GameSettings;
42
- interface GameSettings {
43
- speed: 'fast' | 'medium' | 'slow';
44
- quality: 'high' | 'low';
45
- [key: string]: string;
46
- }
47
- // ---cut---
48
- const settings = getSettings();
49
- settings.speed;
50
- settings.quality;
51
-
52
- // This would need to be settings["username"];
53
- settings.username;
54
- // ^?
55
- ```
56
-
57
- The goal of this flag is to signal intent in your calling syntax about how certain you are this property exists.
@@ -1,9 +0,0 @@
1
- ---
2
- display: 'No Resolve'
3
- oneline: 'Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project.'
4
- ---
5
-
6
- By default, TypeScript will examine the initial set of files for `import` and `<reference` directives and add these resolved files to your program.
7
-
8
- If `noResolve` is set, this process doesn't happen.
9
- However, `import` statements are still checked to see if they resolve to a valid module, so you'll need to make sure this is satisfied by some other means.
@@ -1,20 +0,0 @@
1
- ---
2
- display: 'No Strict Generic Checks'
3
- oneline: 'Disable strict checking of generic signatures in function types.'
4
- ---
5
-
6
- TypeScript will unify type parameters when comparing two generic functions.
7
-
8
- ```ts twoslash
9
- // @errors: 2322
10
-
11
- type A = <T, U>(x: T, y: U) => [T, U];
12
- type B = <S>(x: S, y: S) => [S, S];
13
-
14
- function f(a: A, b: B) {
15
- b = a; // Ok
16
- a = b; // Error
17
- }
18
- ```
19
-
20
- This flag can be used to remove that check.
@@ -1,53 +0,0 @@
1
- ---
2
- display: 'No Unchecked Indexed Access'
3
- oneline: 'Add `undefined` to a type when accessed using an index.'
4
- ---
5
-
6
- TypeScript has a way to describe objects which have unknown keys but known values on an object, via index signatures.
7
-
8
- ```ts twoslash
9
- interface EnvironmentVars {
10
- NAME: string;
11
- OS: string;
12
-
13
- // Unknown properties are covered by this index signature.
14
- [propName: string]: string;
15
- }
16
-
17
- declare const env: EnvironmentVars;
18
-
19
- // Declared as existing
20
- const sysName = env.NAME;
21
- const os = env.OS;
22
- // ^?
23
-
24
- // Not declared, but because of the index
25
- // signature, then it is considered a string
26
- const nodeEnv = env.NODE_ENV;
27
- // ^?
28
- ```
29
-
30
- Turning on `noUncheckedIndexedAccess` will add `undefined` to any un-declared field in the type.
31
-
32
- ```ts twoslash
33
- interface EnvironmentVars {
34
- NAME: string;
35
- OS: string;
36
-
37
- // Unknown properties are covered by this index signature.
38
- [propName: string]: string;
39
- }
40
- // @noUncheckedIndexedAccess
41
- // ---cut---
42
- declare const env: EnvironmentVars;
43
-
44
- // Declared as existing
45
- const sysName = env.NAME;
46
- const os = env.OS;
47
- // ^?
48
-
49
- // Not declared, but because of the index
50
- // signature, then it is considered a string
51
- const nodeEnv = env.NODE_ENV;
52
- // ^?
53
- ```
@@ -1,52 +0,0 @@
1
- ---
2
- display: 'noUncheckedSideEffectImports'
3
- oneline: 'Check side effect imports.'
4
- ---
5
-
6
- In JavaScript it's possible to `import` a module without actually importing any values from it.
7
-
8
- ```ts
9
- import 'some-module';
10
- ```
11
-
12
- These imports are often called _side effect imports_ because the only useful behavior they can provide is by executing some side effect (like registering a global variable, or adding a polyfill to a prototype).
13
-
14
- By default, TypeScript will not check these imports for validity. If the import resolves to a valid source file, TypeScript will load and check the file.
15
- If no source file is found, TypeScript will silently ignore the import.
16
-
17
- This is surprising behavior, but it partially stems from modeling patterns in the JavaScript ecosystem.
18
- For example, this syntax has also been used with special loaders in bundlers to load CSS or other assets.
19
- Your bundler might be configured in such a way where you can include specific `.css` files by writing something like the following:
20
-
21
- ```tsx
22
- import './button-component.css';
23
-
24
- export function Button() {
25
- // ...
26
- }
27
- ```
28
-
29
- Still, this masks potential typos on side effect imports.
30
-
31
- When `--noUncheckedSideEffectImports` is enabled, TypeScript will error if it can't find a source file for a side effect import.
32
-
33
- ```ts
34
- import 'oops-this-module-does-not-exist';
35
- // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
- // error: Cannot find module 'oops-this-module-does-not-exist' or its corresponding
37
- // type declarations.
38
- ```
39
-
40
- When enabling this option, some working code may now receive an error, like in the CSS example above.
41
- To work around this, users who want to just write side effect `import`s for assets might be better served by writing what's called an _ambient module declaration_ with a wildcard specifier.
42
- It would go in a global file and look something like the following:
43
-
44
- ```ts
45
- // ./src/globals.d.ts
46
-
47
- // Recognize all CSS files as module imports.
48
- declare module '*.css' {}
49
- ```
50
-
51
- In fact, you might already have a file like this in your project!
52
- For example, running something like `vite init` might create a similar `vite-env.d.ts`.
@@ -1,15 +0,0 @@
1
- ---
2
- display: 'No Unused Locals'
3
- oneline: "Enable error reporting when local variables aren't read."
4
- ---
5
-
6
- Report errors on unused local variables.
7
-
8
- ```ts twoslash
9
- // @noUnusedLocals
10
- // @errors: 6133
11
- const createKeyboard = (modelID: number) => {
12
- const defaultModelID = 23;
13
- return { type: 'keyboard', modelID };
14
- };
15
- ```
@@ -1,15 +0,0 @@
1
- ---
2
- display: 'No Unused Parameters'
3
- oneline: "Raise an error when a function parameter isn't read."
4
- ---
5
-
6
- Report errors on unused parameters in functions.
7
-
8
- ```ts twoslash
9
- // @noUnusedParameters
10
- // @errors: 6133
11
- const createDefaultKeyboard = (modelID: number) => {
12
- const defaultModelID = 23;
13
- return { type: 'keyboard', modelID: defaultModelID };
14
- };
15
- ```
@@ -1,9 +0,0 @@
1
- ---
2
- display: 'Out'
3
- oneline: 'Deprecated setting. Use [`outFile`](#outFile) instead.'
4
- ---
5
-
6
- Use [`outFile`](#outFile) instead.
7
-
8
- The `out` option computes the final file location in a way that is not predictable or consistent.
9
- This option is retained for backward compatibility only and is deprecated.
@@ -1,39 +0,0 @@
1
- ---
2
- display: 'Out Dir'
3
- oneline: 'Specify an output folder for all emitted files.'
4
- ---
5
-
6
- If specified, `.js` (as well as `.d.ts`, `.js.map`, etc.) files will be emitted into this directory.
7
- The directory structure of the original source files is preserved; see [`rootDir`](#rootDir) if the computed root is not what you intended.
8
-
9
- If not specified, `.js` files will be emitted in the same directory as the `.ts` files they were generated from:
10
-
11
- ```sh
12
- $ tsc
13
-
14
- example
15
- ├── index.js
16
- └── index.ts
17
- ```
18
-
19
- With a `tsconfig.json` like this:
20
-
21
- ```json tsconfig
22
- {
23
- "compilerOptions": {
24
- "outDir": "dist"
25
- }
26
- }
27
- ```
28
-
29
- Running `tsc` with these settings moves the files into the specified `dist` folder:
30
-
31
- ```sh
32
- $ tsc
33
-
34
- example
35
- ├── dist
36
- │ └── index.js
37
- ├── index.ts
38
- └── tsconfig.json
39
- ```
@@ -1,11 +0,0 @@
1
- ---
2
- display: 'Out File'
3
- oneline: 'Specify a file that bundles all outputs into one JavaScript file. If [`declaration`](#declaration) is true, also designates a file that bundles all .d.ts output.'
4
- ---
5
-
6
- If specified, all _global_ (non-module) files will be concatenated into the single output file specified.
7
-
8
- If `module` is `system` or `amd`, all module files will also be concatenated into this file after all global content.
9
-
10
- Note: `outFile` cannot be used unless `module` is `None`, `System`, or `AMD`.
11
- This option _cannot_ be used to bundle CommonJS or ES6 modules.
@@ -1,39 +0,0 @@
1
- ---
2
- display: 'Paths'
3
- oneline: 'Specify a set of entries that re-map imports to additional lookup locations.'
4
- ---
5
-
6
- A series of entries which re-map imports to lookup locations relative to the [`baseUrl`](#baseUrl) if set, or to the tsconfig file itself otherwise. There is a larger coverage of `paths` in [the `moduleResolution` reference page](/docs/handbook/modules/reference.html#paths).
7
-
8
- `paths` lets you declare how TypeScript should resolve an import in your `require`/`import`s.
9
-
10
- ```json tsconfig
11
- {
12
- "compilerOptions": {
13
- "paths": {
14
- "jquery": ["./vendor/jquery/dist/jquery"]
15
- }
16
- }
17
- }
18
- ```
19
-
20
- This would allow you to be able to write `import "jquery"`, and get all of the correct typing locally.
21
-
22
- ```json tsconfig
23
- {
24
- "compilerOptions": {
25
- "paths": {
26
- "app/*": ["./src/app/*"],
27
- "config/*": ["./src/app/_config/*"],
28
- "environment/*": ["./src/environments/*"],
29
- "shared/*": ["./src/app/_shared/*"],
30
- "helpers/*": ["./src/helpers/*"],
31
- "tests/*": ["./src/tests/*"]
32
- }
33
- }
34
- }
35
- ```
36
-
37
- In this case, you can tell the TypeScript file resolver to support a number of custom prefixes to find code.
38
-
39
- Note that this feature does not change how import paths are emitted by `tsc`, so `paths` should only be used to inform TypeScript that another tool has this mapping and will use it at runtime or when bundling.
@@ -1,17 +0,0 @@
1
- ---
2
- display: 'Plugins'
3
- oneline: 'Specify a list of language service plugins to include.'
4
- ---
5
-
6
- List of language service plugins to run inside the editor.
7
-
8
- Language service plugins are a way to provide additional information to a user based on existing TypeScript files. They can enhance existing messages between TypeScript and an editor, or to provide their own error messages.
9
-
10
- For example:
11
-
12
- - [ts-sql-plugin](https://github.com/xialvjun/ts-sql-plugin#readme) &mdash; Adds SQL linting with a template strings SQL builder.
13
- - [typescript-styled-plugin](https://github.com/Microsoft/typescript-styled-plugin) &mdash; Provides CSS linting inside template strings .
14
- - [typescript-eslint-language-service](https://github.com/Quramy/typescript-eslint-language-service) &mdash; Provides eslint error messaging and fix-its inside the compiler's output.
15
- - [ts-graphql-plugin](https://github.com/Quramy/ts-graphql-plugin) &mdash; Provides validation and auto-completion inside GraphQL query template strings.
16
-
17
- VS Code has the ability for a extension to [automatically include language service plugins](https://code.visualstudio.com/api/references/contribution-points#contributes.typescriptServerPlugins), and so you may have some running in your editor without needing to define them in your `tsconfig.json`.