ai-hero-cli 0.0.3 → 0.0.4

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 (138) hide show
  1. package/docs/tsconfig/allowArbitraryExtensions.md +38 -0
  2. package/docs/tsconfig/allowImportingTsExtensions.md +9 -0
  3. package/docs/tsconfig/allowJs.md +41 -0
  4. package/docs/tsconfig/allowSyntheticDefaultImports.md +56 -0
  5. package/docs/tsconfig/allowUmdGlobalAccess.md +8 -0
  6. package/docs/tsconfig/allowUnreachableCode.md +40 -0
  7. package/docs/tsconfig/allowUnusedLabels.md +23 -0
  8. package/docs/tsconfig/alwaysStrict.md +8 -0
  9. package/docs/tsconfig/assumeChangesOnlyAffectDirectDependencies.md +8 -0
  10. package/docs/tsconfig/baseUrl.md +26 -0
  11. package/docs/tsconfig/charset.md +7 -0
  12. package/docs/tsconfig/checkJs.md +40 -0
  13. package/docs/tsconfig/clean.md +6 -0
  14. package/docs/tsconfig/composite.md +17 -0
  15. package/docs/tsconfig/customConditions.md +41 -0
  16. package/docs/tsconfig/declaration.md +32 -0
  17. package/docs/tsconfig/declarationDir.md +36 -0
  18. package/docs/tsconfig/declarationMap.md +9 -0
  19. package/docs/tsconfig/diagnostics.md +8 -0
  20. package/docs/tsconfig/disableFilenameBasedTypeAcquisition.md +16 -0
  21. package/docs/tsconfig/disableReferencedProjectLoad.md +8 -0
  22. package/docs/tsconfig/disableSizeLimit.md +6 -0
  23. package/docs/tsconfig/disableSolutionSearching.md +8 -0
  24. package/docs/tsconfig/disableSourceOfProjectReferenceRedirect.md +7 -0
  25. package/docs/tsconfig/downlevelIteration.md +100 -0
  26. package/docs/tsconfig/emitBOM.md +8 -0
  27. package/docs/tsconfig/emitDeclarationOnly.md +11 -0
  28. package/docs/tsconfig/emitDecoratorMetadata.md +81 -0
  29. package/docs/tsconfig/enable.md +14 -0
  30. package/docs/tsconfig/erasableSyntaxOnly.md +65 -0
  31. package/docs/tsconfig/esModuleInterop.md +74 -0
  32. package/docs/tsconfig/exactOptionalPropertyTypes.md +37 -0
  33. package/docs/tsconfig/exclude.md +11 -0
  34. package/docs/tsconfig/excludeDirectories.md +14 -0
  35. package/docs/tsconfig/excludeFiles.md +14 -0
  36. package/docs/tsconfig/experimentalDecorators.md +11 -0
  37. package/docs/tsconfig/explainFiles.md +54 -0
  38. package/docs/tsconfig/extendedDiagnostics.md +9 -0
  39. package/docs/tsconfig/extends.md +49 -0
  40. package/docs/tsconfig/fallbackPolling.md +11 -0
  41. package/docs/tsconfig/files.md +26 -0
  42. package/docs/tsconfig/force.md +6 -0
  43. package/docs/tsconfig/forceConsistentCasingInFileNames.md +10 -0
  44. package/docs/tsconfig/generateCpuProfile.md +15 -0
  45. package/docs/tsconfig/generateTrace.md +6 -0
  46. package/docs/tsconfig/importHelpers.md +46 -0
  47. package/docs/tsconfig/importsNotUsedAsValues.md +16 -0
  48. package/docs/tsconfig/include.md +66 -0
  49. package/docs/tsconfig/incremental.md +10 -0
  50. package/docs/tsconfig/inlineSourceMap.md +35 -0
  51. package/docs/tsconfig/inlineSources.md +36 -0
  52. package/docs/tsconfig/isolatedDeclarations.md +8 -0
  53. package/docs/tsconfig/isolatedModules.md +77 -0
  54. package/docs/tsconfig/jsx.md +111 -0
  55. package/docs/tsconfig/jsxFactory.md +43 -0
  56. package/docs/tsconfig/jsxFragmentFactory.md +69 -0
  57. package/docs/tsconfig/jsxImportSource.md +95 -0
  58. package/docs/tsconfig/keyofStringsOnly.md +8 -0
  59. package/docs/tsconfig/lib.md +75 -0
  60. package/docs/tsconfig/libReplacement.md +22 -0
  61. package/docs/tsconfig/listEmittedFiles.md +42 -0
  62. package/docs/tsconfig/listFiles.md +40 -0
  63. package/docs/tsconfig/locale.md +26 -0
  64. package/docs/tsconfig/mapRoot.md +18 -0
  65. package/docs/tsconfig/maxNodeModuleJsDepth.md +11 -0
  66. package/docs/tsconfig/module.md +125 -0
  67. package/docs/tsconfig/moduleDetection.md +15 -0
  68. package/docs/tsconfig/moduleResolution.md +13 -0
  69. package/docs/tsconfig/moduleSuffixes.md +26 -0
  70. package/docs/tsconfig/newLine.md +6 -0
  71. package/docs/tsconfig/noCheck.md +6 -0
  72. package/docs/tsconfig/noEmit.md +10 -0
  73. package/docs/tsconfig/noEmitHelpers.md +38 -0
  74. package/docs/tsconfig/noEmitOnError.md +8 -0
  75. package/docs/tsconfig/noErrorTruncation.md +45 -0
  76. package/docs/tsconfig/noFallthroughCasesInSwitch.md +22 -0
  77. package/docs/tsconfig/noImplicitAny.md +26 -0
  78. package/docs/tsconfig/noImplicitOverride.md +66 -0
  79. package/docs/tsconfig/noImplicitReturns.md +17 -0
  80. package/docs/tsconfig/noImplicitThis.md +28 -0
  81. package/docs/tsconfig/noImplicitUseStrict.md +7 -0
  82. package/docs/tsconfig/noLib.md +9 -0
  83. package/docs/tsconfig/noPropertyAccessFromIndexSignature.md +57 -0
  84. package/docs/tsconfig/noResolve.md +9 -0
  85. package/docs/tsconfig/noStrictGenericChecks.md +20 -0
  86. package/docs/tsconfig/noUncheckedIndexedAccess.md +53 -0
  87. package/docs/tsconfig/noUncheckedSideEffectImports.md +52 -0
  88. package/docs/tsconfig/noUnusedLocals.md +15 -0
  89. package/docs/tsconfig/noUnusedParameters.md +15 -0
  90. package/docs/tsconfig/out.md +9 -0
  91. package/docs/tsconfig/outDir.md +39 -0
  92. package/docs/tsconfig/outFile.md +11 -0
  93. package/docs/tsconfig/paths.md +39 -0
  94. package/docs/tsconfig/plugins.md +17 -0
  95. package/docs/tsconfig/preserveConstEnums.md +58 -0
  96. package/docs/tsconfig/preserveSymlinks.md +10 -0
  97. package/docs/tsconfig/preserveValueImports.md +18 -0
  98. package/docs/tsconfig/preserveWatchOutput.md +6 -0
  99. package/docs/tsconfig/pretty.md +7 -0
  100. package/docs/tsconfig/reactNamespace.md +6 -0
  101. package/docs/tsconfig/references.md +9 -0
  102. package/docs/tsconfig/removeComments.md +33 -0
  103. package/docs/tsconfig/resolveJsonModule.md +44 -0
  104. package/docs/tsconfig/resolvePackageJsonExports.md +8 -0
  105. package/docs/tsconfig/resolvePackageJsonImports.md +8 -0
  106. package/docs/tsconfig/rewriteRelativeImportExtensions.md +8 -0
  107. package/docs/tsconfig/rootDir.md +66 -0
  108. package/docs/tsconfig/rootDirs.md +66 -0
  109. package/docs/tsconfig/skipDefaultLibCheck.md +6 -0
  110. package/docs/tsconfig/skipLibCheck.md +19 -0
  111. package/docs/tsconfig/sourceMap.md +39 -0
  112. package/docs/tsconfig/sourceRoot.md +18 -0
  113. package/docs/tsconfig/stopBuildOnErrors.md +6 -0
  114. package/docs/tsconfig/strict.md +11 -0
  115. package/docs/tsconfig/strictBindCallApply.md +34 -0
  116. package/docs/tsconfig/strictBuiltinIteratorReturn.md +6 -0
  117. package/docs/tsconfig/strictFunctionTypes.md +55 -0
  118. package/docs/tsconfig/strictNullChecks.md +58 -0
  119. package/docs/tsconfig/strictPropertyInitialization.md +29 -0
  120. package/docs/tsconfig/stripInternal.md +60 -0
  121. package/docs/tsconfig/suppressExcessPropertyErrors.md +16 -0
  122. package/docs/tsconfig/suppressImplicitAnyIndexErrors.md +25 -0
  123. package/docs/tsconfig/synchronousWatchDirectory.md +14 -0
  124. package/docs/tsconfig/target.md +18 -0
  125. package/docs/tsconfig/traceResolution.md +7 -0
  126. package/docs/tsconfig/tsBuildInfoFile.md +17 -0
  127. package/docs/tsconfig/typeAcquisition.md +37 -0
  128. package/docs/tsconfig/typeRoots.md +21 -0
  129. package/docs/tsconfig/types.md +40 -0
  130. package/docs/tsconfig/useDefineForClassFields.md +10 -0
  131. package/docs/tsconfig/useUnknownInCatchVariables.md +21 -0
  132. package/docs/tsconfig/verbatimModuleSyntax.md +148 -0
  133. package/docs/tsconfig/verbose.md +6 -0
  134. package/docs/tsconfig/watchDirectory.md +10 -0
  135. package/docs/tsconfig/watchFile.md +12 -0
  136. package/package.json +4 -2
  137. package/prompts/hows-my-tsconfig-score.md +29 -0
  138. package/prompts/hows-my-tsconfig.md +75 -0
@@ -0,0 +1,26 @@
1
+ ---
2
+ display: 'Locale'
3
+ oneline: 'Set the language of the messaging from TypeScript. This does not affect emit.'
4
+ ---
5
+
6
+ TypeScript supports a number of languages, however this cannot be set via the `tsconfig.json`, only
7
+ via the host environment or the CLI flag `--locale`. E.g. `tsc --locale ru`.
8
+
9
+ ### Locales supported as of TypeScript 3.7
10
+
11
+ | Name | Locale |
12
+ | --------------------- | ------- |
13
+ | Brazilian Portuguese | `pr-BR` |
14
+ | Chinese (Simplified) | `zh-TW` |
15
+ | Chinese (Traditional) | `zh-CN` |
16
+ | Czech | `cs-CZ` |
17
+ | English (US) | `en-US` |
18
+ | French | `fr-FR` |
19
+ | German | `de-DE` |
20
+ | Italian | `it-IT` |
21
+ | Japanese | `ja-JP` |
22
+ | Korean | `ko-KR` |
23
+ | Polish | `pl-PL` |
24
+ | Russian | `ru-RU` |
25
+ | Spanish | `es-ES` |
26
+ | Turkish | `tr-TR` |
@@ -0,0 +1,18 @@
1
+ ---
2
+ display: 'Map Root'
3
+ oneline: 'Specify the location where debugger should locate map files instead of generated locations.'
4
+ ---
5
+
6
+ Specify the location where debugger should locate map files instead of generated locations.
7
+ This string is treated verbatim inside the source-map, for example:
8
+
9
+ ```json tsconfig
10
+ {
11
+ "compilerOptions": {
12
+ "sourceMap": true,
13
+ "mapRoot": "https://my-website.com/debug/sourcemaps/"
14
+ }
15
+ }
16
+ ```
17
+
18
+ Would declare that `index.js` will have sourcemaps at `https://my-website.com/debug/sourcemaps/index.js.map`.
@@ -0,0 +1,11 @@
1
+ ---
2
+ display: 'Max Node Module JS Depth'
3
+ oneline: 'Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with [`allowJs`](#allowJs).'
4
+ ---
5
+
6
+ The maximum dependency depth to search under `node_modules` and load JavaScript files.
7
+
8
+ This flag can only be used when [`allowJs`](#allowJs) is enabled, and is used if you want to have TypeScript infer types for all of the JavaScript inside your `node_modules`.
9
+
10
+ Ideally this should stay at 0 (the default), and `d.ts` files should be used to explicitly define the shape of modules.
11
+ However, there are cases where you may want to turn this on at the expense of speed and potential accuracy.
@@ -0,0 +1,125 @@
1
+ ---
2
+ display: 'Module'
3
+ oneline: 'Specify what module code is generated.'
4
+ ---
5
+
6
+ Sets the module system for the program. See the [theory behind TypeScript’s `module` option](/docs/handbook/modules/theory.html#the-module-output-format) and [its reference page](/docs/handbook/modules/reference.html#the-module-compiler-option) for more information. You very likely want `"nodenext"` for modern Node.js projects and `preserve` or `esnext` for code that will be bundled.
7
+
8
+ Changing `module` affects [`moduleResolution`](#moduleResolution) which [also has a reference page](/docs/handbook/modules/reference.html#the-moduleresolution-compiler-option).
9
+
10
+ Here's some example output for this file:
11
+
12
+ ```ts twoslash
13
+ // @filename: constants.ts
14
+ export const valueOfPi = 3.142;
15
+ // ---cut---
16
+ // @filename: index.ts
17
+ import { valueOfPi } from './constants';
18
+
19
+ export const twoPi = valueOfPi * 2;
20
+ ```
21
+
22
+ #### `CommonJS`
23
+
24
+ ```ts twoslash
25
+ // @showEmit
26
+ // @module: commonjs
27
+ // @noErrors
28
+ import { valueOfPi } from './constants';
29
+
30
+ export const twoPi = valueOfPi * 2;
31
+ ```
32
+
33
+ #### `UMD`
34
+
35
+ ```ts twoslash
36
+ // @showEmit
37
+ // @module: umd
38
+ // @noErrors
39
+ import { valueOfPi } from './constants';
40
+
41
+ export const twoPi = valueOfPi * 2;
42
+ ```
43
+
44
+ #### `AMD`
45
+
46
+ ```ts twoslash
47
+ // @showEmit
48
+ // @module: amd
49
+ // @noErrors
50
+ import { valueOfPi } from './constants';
51
+
52
+ export const twoPi = valueOfPi * 2;
53
+ ```
54
+
55
+ #### `System`
56
+
57
+ ```ts twoslash
58
+ // @showEmit
59
+ // @module: system
60
+ // @noErrors
61
+ import { valueOfPi } from './constants';
62
+
63
+ export const twoPi = valueOfPi * 2;
64
+ ```
65
+
66
+ #### `ESNext`
67
+
68
+ ```ts twoslash
69
+ // @showEmit
70
+ // @module: esnext
71
+ // @noErrors
72
+ import { valueOfPi } from './constants';
73
+
74
+ export const twoPi = valueOfPi * 2;
75
+ ```
76
+
77
+ #### `ES2015`/`ES6`/`ES2020`/`ES2022`
78
+
79
+ ```ts twoslash
80
+ // @showEmit
81
+ // @module: es2015
82
+ // @noErrors
83
+ import { valueOfPi } from './constants';
84
+
85
+ export const twoPi = valueOfPi * 2;
86
+ ```
87
+
88
+ In addition to the base functionality of `ES2015`/`ES6`, `ES2020` adds support for [dynamic `import`s](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import), and [`import.meta`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) while `ES2022` further adds support for [top level `await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#top_level_await).
89
+
90
+ #### `node16`/`node18`/`nodenext`
91
+
92
+ The `node16`, `node18`, and `nodenext` modes integrate with Node's [native ECMAScript Module support](https://nodejs.org/api/esm.html). The emitted JavaScript uses either `CommonJS` or `ES2020` output depending on the file extension and the value of the `type` setting in the nearest `package.json`. Module resolution also works differently. You can learn more in the [handbook](/docs/handbook/esm-node.html) and [Modules Reference](/docs/handbook/modules/reference.html#node16-node18-nodenext).
93
+
94
+ - `node16` is available from TypeScript 4.7
95
+ - `node18` is available from TypeScript 5.8 as a replacement for `node16`, with added support for import attributes.
96
+ - `nodenext` is available from TypeScript 4.7, but its behavior changes with the latest stable versions of Node.js. As of TypeScript 5.8, `nodenext` supports `require` of ECMAScript modules.
97
+
98
+ #### `preserve`
99
+
100
+ In `--module preserve` ([added](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html#support-for-require-calls-in---moduleresolution-bundler-and---module-preserve) in TypeScript 5.4), ECMAScript imports and exports written in input files are preserved in the output, and CommonJS-style `import x = require("...")` and `export = ...` statements are emitted as CommonJS `require` and `module.exports`. In other words, the format of each individual import or export statement is preserved, rather than being coerced into a single format for the whole compilation (or even a whole file).
101
+
102
+ ```ts twoslash
103
+ // @showEmit
104
+ // @module: preserve
105
+ // @noErrors
106
+ import { valueOfPi } from './constants';
107
+ import constants = require('./constants');
108
+
109
+ export const piSquared = valueOfPi * constants.valueOfPi;
110
+ ```
111
+
112
+ While it’s rare to need to mix imports and require calls in the same file, this `module` mode best reflects the capabilities of most modern bundlers, as well as the Bun runtime.
113
+
114
+ > Why care about TypeScript’s `module` emit with a bundler or with Bun, where you’re likely also setting `noEmit`? TypeScript’s type checking and module resolution behavior are affected by the module format that it _would_ emit. Setting `module` gives TypeScript information about how your bundler or runtime will process imports and exports, which ensures that the types you see on imported values accurately reflect what will happen at runtime or after bundling.
115
+
116
+ #### `None`
117
+
118
+ ```ts twoslash
119
+ // @showEmit
120
+ // @module: none
121
+ // @noErrors
122
+ import { valueOfPi } from './constants';
123
+
124
+ export const twoPi = valueOfPi * 2;
125
+ ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ display: 'Module Detection'
3
+ oneline: 'Specify what method is used to detect whether a file is a script or a module.'
4
+ ---
5
+
6
+ This setting controls how TypeScript determines whether a file is a
7
+ [script or a module](/docs/handbook/modules/theory.html#scripts-and-modules-in-javascript).
8
+
9
+ There are three choices:
10
+
11
+ - `"auto"` (default) - TypeScript will not only look for import and export statements, but it will also check whether the `"type"` field in a `package.json` is set to `"module"` when running with [`module`](#module): `nodenext` or `node16`, and check whether the current file is a JSX file when running under [`jsx`](#jsx): `react-jsx`.
12
+
13
+ - `"legacy"` - The same behavior as 4.6 and prior, usings import and export statements to determine whether a file is a module.
14
+
15
+ - `"force"` - Ensures that every non-declaration file is treated as a module.
@@ -0,0 +1,13 @@
1
+ ---
2
+ display: 'Module Resolution'
3
+ oneline: 'Specify how TypeScript looks up a file from a given module specifier.'
4
+ ---
5
+
6
+ Specify the module resolution strategy:
7
+
8
+ - `'node16'` or `'nodenext'` for modern versions of Node.js. Node.js v12 and later supports both ECMAScript imports and CommonJS `require`, which resolve using different algorithms. These `moduleResolution` values, when combined with the corresponding [`module`](#module) values, picks the right algorithm for each resolution based on whether Node.js will see an `import` or `require` in the output JavaScript code.
9
+ - `'node10'` (previously called `'node'`) for Node.js versions older than v10, which only support CommonJS `require`. You probably won't need to use `node10` in modern code.
10
+ - `'bundler'` for use with bundlers. Like `node16` and `nodenext`, this mode supports package.json `"imports"` and `"exports"`, but unlike the Node.js resolution modes, `bundler` never requires file extensions on relative paths in imports.
11
+ - `'classic'` was used in TypeScript before the release of 1.6. `classic` should not be used.
12
+
13
+ There are reference pages explaining the [theory behind TypeScript’s module resolution](https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution) and the [details of each option](/docs/handbook/modules/reference.html#the-moduleresolution-compiler-option).
@@ -0,0 +1,26 @@
1
+ ---
2
+ display: 'Module Suffixes'
3
+ oneline: 'List of file name suffixes to search when resolving a module.'
4
+ ---
5
+
6
+ Provides a way to override the default list of file name suffixes to search when resolving a module.
7
+
8
+ ```json tsconfig
9
+ {
10
+ "compilerOptions": {
11
+ "moduleSuffixes": [".ios", ".native", ""]
12
+ }
13
+ }
14
+ ```
15
+
16
+ Given the above configuration, an import like the following:
17
+
18
+ ```ts
19
+ import * as foo from './foo';
20
+ ```
21
+
22
+ TypeScript will look for the relative files `./foo.ios.ts`, `./foo.native.ts`, and finally `./foo.ts`.
23
+
24
+ Note the empty string `""` in [`moduleSuffixes`](#moduleSuffixes) which is necessary for TypeScript to also look-up `./foo.ts`.
25
+
26
+ This feature can be useful for React Native projects where each target platform can use a separate tsconfig.json with differing `moduleSuffixes`.
@@ -0,0 +1,6 @@
1
+ ---
2
+ display: 'New Line'
3
+ oneline: 'Set the newline character for emitting files.'
4
+ ---
5
+
6
+ Specify the end of line sequence to be used when emitting files: 'CRLF' (dos) or 'LF' (unix).
@@ -0,0 +1,6 @@
1
+ ---
2
+ display: 'noCheck'
3
+ oneline: 'Disable full type checking (only critical parse and emit errors will be reported).'
4
+ ---
5
+
6
+ Disable full type checking (only critical parse and emit errors will be reported).
@@ -0,0 +1,10 @@
1
+ ---
2
+ display: 'No Emit'
3
+ oneline: 'Disable emitting files from a compilation.'
4
+ ---
5
+
6
+ Do not emit compiler output files like JavaScript source code, source-maps or declarations.
7
+
8
+ This makes room for another tool like [Babel](https://babeljs.io), or [swc](https://github.com/swc-project/swc) to handle converting the TypeScript file to a file which can run inside a JavaScript environment.
9
+
10
+ You can then use TypeScript as a tool for providing editor integration, and as a source code type-checker.
@@ -0,0 +1,38 @@
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
+ ```
@@ -0,0 +1,8 @@
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.
@@ -0,0 +1,45 @@
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
+ ```
@@ -0,0 +1,22 @@
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
+ ```
@@ -0,0 +1,26 @@
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
+ ```
@@ -0,0 +1,66 @@
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
+ ```
@@ -0,0 +1,17 @@
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
+ ```
@@ -0,0 +1,28 @@
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
+ ```
@@ -0,0 +1,7 @@
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.
@@ -0,0 +1,9 @@
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.
@@ -0,0 +1,57 @@
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.
@@ -0,0 +1,9 @@
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.
@@ -0,0 +1,20 @@
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.