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,58 +0,0 @@
1
- ---
2
- display: 'Preserve Const Enums'
3
- oneline: 'Disable erasing `const enum` declarations in generated code.'
4
- ---
5
-
6
- Do not erase `const enum` declarations in generated code. `const enum`s provide a way to reduce the overall memory footprint
7
- of your application at runtime by emitting the enum value instead of a reference.
8
-
9
- For example with this TypeScript:
10
-
11
- ```ts twoslash
12
- const enum Album {
13
- JimmyEatWorldFutures = 1,
14
- TubRingZooHypothesis = 2,
15
- DogFashionDiscoAdultery = 3,
16
- }
17
-
18
- const selectedAlbum = Album.JimmyEatWorldFutures;
19
- if (selectedAlbum === Album.JimmyEatWorldFutures) {
20
- console.log('That is a great choice.');
21
- }
22
- ```
23
-
24
- The default `const enum` behavior is to convert any `Album.Something` to the corresponding number literal, and to remove a reference
25
- to the enum from the JavaScript completely.
26
-
27
- ```ts twoslash
28
- // @showEmit
29
- const enum Album {
30
- JimmyEatWorldFutures = 1,
31
- TubRingZooHypothesis = 2,
32
- DogFashionDiscoAdultery = 3,
33
- }
34
-
35
- const selectedAlbum = Album.JimmyEatWorldFutures;
36
- if (selectedAlbum === Album.JimmyEatWorldFutures) {
37
- console.log('That is a great choice.');
38
- }
39
- ```
40
-
41
- With `preserveConstEnums` set to `true`, the `enum` exists at runtime and the numbers are still emitted.
42
-
43
- ```ts twoslash
44
- // @preserveConstEnums: true
45
- // @showEmit
46
- const enum Album {
47
- JimmyEatWorldFutures = 1,
48
- TubRingZooHypothesis = 2,
49
- DogFashionDiscoAdultery = 3,
50
- }
51
-
52
- const selectedAlbum = Album.JimmyEatWorldFutures;
53
- if (selectedAlbum === Album.JimmyEatWorldFutures) {
54
- console.log('That is a great choice.');
55
- }
56
- ```
57
-
58
- This essentially makes such `const enums` a source-code feature only, with no runtime traces.
@@ -1,10 +0,0 @@
1
- ---
2
- display: 'Preserve Symlinks'
3
- oneline: 'Disable resolving symlinks to their realpath. This correlates to the same flag in node.'
4
- ---
5
-
6
- This is to reflect the same flag in Node.js; which does not resolve the real path of symlinks.
7
-
8
- This flag also exhibits the opposite behavior to Webpack’s `resolve.symlinks` option (i.e. setting TypeScript’s `preserveSymlinks` to true parallels setting Webpack’s `resolve.symlinks` to false, and vice-versa).
9
-
10
- With this enabled, references to modules and packages (e.g. `import`s and `/// <reference type="..." />` directives) are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to.
@@ -1,18 +0,0 @@
1
- ---
2
- display: 'Preserve Value Imports'
3
- oneline: 'Preserve unused imported values in the JavaScript output that would otherwise be removed.'
4
- ---
5
-
6
- Deprecated in favor of [`verbatimModuleSyntax`](#verbatimModuleSyntax).
7
-
8
- There are some cases where TypeScript can't detect that you're using an import. For example, take the following code:
9
-
10
- ```ts
11
- import { Animal } from './animal.js';
12
-
13
- eval('console.log(new Animal().isDangerous())');
14
- ```
15
-
16
- or code using 'Compiles to HTML' languages like Svelte or Vue. `preserveValueImports` will prevent TypeScript from removing the import, even if it appears unused.
17
-
18
- When combined with [`isolatedModules`](#isolatedModules): imported types _must_ be marked as type-only because compilers that process single files at a time have no way of knowing whether imports are values that appear unused, or a type that must be removed in order to avoid a runtime crash.
@@ -1,6 +0,0 @@
1
- ---
2
- display: 'Preserve Watch Output'
3
- oneline: 'Disable wiping the console in watch mode.'
4
- ---
5
-
6
- Whether to keep outdated console output in watch mode instead of clearing the screen every time a change happened.
@@ -1,7 +0,0 @@
1
- ---
2
- display: 'Pretty'
3
- oneline: "Enable color and formatting in TypeScript's output to make compiler errors easier to read."
4
- ---
5
-
6
- Stylize errors and messages using color and context, this is on by default &mdash; offers you a chance to have less terse,
7
- single colored messages from the compiler.
@@ -1,6 +0,0 @@
1
- ---
2
- display: 'React Namespace'
3
- oneline: 'Specify the object invoked for `createElement`. This only applies when targeting `react` JSX emit.'
4
- ---
5
-
6
- Use [`jsxFactory`](#jsxFactory) instead. Specify the object invoked for `createElement` when targeting `react` for TSX files.
@@ -1,9 +0,0 @@
1
- ---
2
- display: 'References'
3
- oneline: 'Specify an array of objects that specify paths for projects. Used in project references.'
4
- ---
5
-
6
- Project references are a way to structure your TypeScript programs into smaller pieces.
7
- Using Project References can greatly improve build and editor interaction times, enforce logical separation between components, and organize your code in new and improved ways.
8
-
9
- You can read more about how references works in the [Project References](/docs/handbook/project-references.html) section of the handbook
@@ -1,33 +0,0 @@
1
- ---
2
- display: 'Remove Comments'
3
- oneline: 'Disable emitting comments.'
4
- ---
5
-
6
- Strips all comments from TypeScript files when converting into JavaScript. Defaults to `false`.
7
-
8
- For example, this is a TypeScript file which has a JSDoc comment:
9
-
10
- ```ts
11
- /** The translation of 'Hello world' into Portuguese */
12
- export const helloWorldPTBR = 'Olá Mundo';
13
- ```
14
-
15
- When `removeComments` is set to `true`:
16
-
17
- ```ts twoslash
18
- // @showEmit
19
- // @removeComments: true
20
- /** The translation of 'Hello world' into Portuguese */
21
- export const helloWorldPTBR = 'Olá Mundo';
22
- ```
23
-
24
- Without setting `removeComments` or having it as `false`:
25
-
26
- ```ts twoslash
27
- // @showEmit
28
- // @removeComments: false
29
- /** The translation of 'Hello world' into Portuguese */
30
- export const helloWorldPTBR = 'Olá Mundo';
31
- ```
32
-
33
- This means that your comments will show up in the JavaScript code.
@@ -1,44 +0,0 @@
1
- ---
2
- display: 'Resolve JSON Module'
3
- oneline: 'Enable importing .json files.'
4
- ---
5
-
6
- Allows importing modules with a `.json` extension, which is a common practice in node projects. This includes
7
- generating a type for the `import` based on the static JSON shape.
8
-
9
- TypeScript does not support resolving JSON files by default:
10
-
11
- ```ts twoslash
12
- // @errors: 2732
13
- // @filename: settings.json
14
- {
15
- "repo": "TypeScript",
16
- "dry": false,
17
- "debug": false
18
- }
19
- // @filename: index.ts
20
- import settings from "./settings.json";
21
-
22
- settings.debug === true;
23
- settings.dry === 2;
24
- ```
25
-
26
- Enabling the option allows importing JSON, and validating the types in that JSON file.
27
-
28
- ```ts twoslash
29
- // @errors: 2367
30
- // @resolveJsonModule
31
- // @module: commonjs
32
- // @moduleResolution: node
33
- // @filename: settings.json
34
- {
35
- "repo": "TypeScript",
36
- "dry": false,
37
- "debug": false
38
- }
39
- // @filename: index.ts
40
- import settings from "./settings.json";
41
-
42
- settings.debug === true;
43
- settings.dry === 2;
44
- ```
@@ -1,8 +0,0 @@
1
- ---
2
- display: 'Resolve package.json Exports'
3
- oneline: "Use the package.json 'exports' field when resolving package imports."
4
- ---
5
-
6
- `--resolvePackageJsonExports` forces TypeScript to consult [the `exports` field of `package.json` files](https://nodejs.org/api/packages.html#exports) if it ever reads from a package in `node_modules`.
7
-
8
- This option defaults to `true` under the `node16`, `nodenext`, and `bundler` options for [`--moduleResolution`](#moduleResolution).
@@ -1,8 +0,0 @@
1
- ---
2
- display: 'Resolve package.json Imports'
3
- oneline: "Use the package.json 'imports' field when resolving imports."
4
- ---
5
-
6
- `--resolvePackageJsonImports` forces TypeScript to consult [the `imports` field of `package.json` files](https://nodejs.org/api/packages.html#imports) when performing a lookup that starts with `#` from a file whose ancestor directory contains a `package.json`.
7
-
8
- This option defaults to `true` under the `node16`, `nodenext`, and `bundler` options for [`--moduleResolution`](#moduleResolution).
@@ -1,8 +0,0 @@
1
- ---
2
- display: 'rewriteRelativeImportExtensions'
3
- oneline: 'Rewrite `.ts`, `.tsx`, `.mts`, and `.cts` file extensions in relative import paths to their JavaScript equivalent in output files.'
4
- ---
5
-
6
- Rewrite `.ts`, `.tsx`, `.mts`, and `.cts` file extensions in relative import paths to their JavaScript equivalent in output files.
7
-
8
- For more information, see the [TypeScript 5.7 release notes](/docs/handbook/release-notes/typescript-5-7.html#path-rewriting-for-relative-paths).
@@ -1,66 +0,0 @@
1
- ---
2
- display: 'Root Dir'
3
- oneline: 'Specify the root folder within your source files.'
4
- ---
5
-
6
- **Default**: The longest common path of all non-declaration input files. If [`composite`](#composite) is set, the default is instead the directory containing the `tsconfig.json` file.
7
-
8
- When TypeScript compiles files, it keeps the same directory structure in the output directory as exists in the input directory.
9
-
10
- For example, let's say you have some input files:
11
-
12
- ```
13
- MyProj
14
- ├── tsconfig.json
15
- ├── core
16
- │ ├── a.ts
17
- │ ├── b.ts
18
- │ ├── sub
19
- │ │ ├── c.ts
20
- ├── types.d.ts
21
- ```
22
-
23
- The inferred value for `rootDir` is the longest common path of all non-declaration input files, which in this case is `core/`.
24
-
25
- If your [`outDir`](#outDir) was `dist`, TypeScript would write this tree:
26
-
27
- ```
28
- MyProj
29
- ├── dist
30
- │ ├── a.js
31
- │ ├── b.js
32
- │ ├── sub
33
- │ │ ├── c.js
34
- ```
35
-
36
- However, you may have intended for `core` to be part of the output directory structure.
37
- By setting `rootDir: "."` in `tsconfig.json`, TypeScript would write this tree:
38
-
39
- ```
40
- MyProj
41
- ├── dist
42
- │ ├── core
43
- │ │ ├── a.js
44
- │ │ ├── b.js
45
- │ │ ├── sub
46
- │ │ │ ├── c.js
47
- ```
48
-
49
- Importantly, `rootDir` **does not affect which files become part of the compilation**.
50
- It has no interaction with the [`include`](#include), [`exclude`](#exclude), or [`files`](#files) `tsconfig.json` settings.
51
-
52
- Note that TypeScript will never write an output file to a directory outside of [`outDir`](#outDir), and will never skip emitting a file.
53
- For this reason, `rootDir` also enforces that all files which need to be emitted are underneath the `rootDir` path.
54
-
55
- For example, let's say you had this tree:
56
-
57
- ```
58
- MyProj
59
- ├── tsconfig.json
60
- ├── core
61
- │ ├── a.ts
62
- │ ├── b.ts
63
- ├── helpers.ts
64
- ```
65
-
66
- It would be an error to specify `rootDir` as `core` _and_ [`include`](#include) as `*` because it creates a file (`helpers.ts`) that would need to be emitted _outside_ the [`outDir`](#outDir) (i.e. `../helpers.js`).
@@ -1,66 +0,0 @@
1
- ---
2
- display: 'Root Dirs'
3
- oneline: 'Allow multiple folders to be treated as one when resolving modules.'
4
- ---
5
-
6
- Using `rootDirs`, you can inform the compiler that there are many "virtual" directories acting as a single root.
7
- This allows the compiler to resolve relative module imports within these "virtual" directories, as if they were merged in to one directory.
8
-
9
- For example:
10
-
11
- ```
12
- src
13
- └── views
14
- └── view1.ts (can import "./template1", "./view2`)
15
- └── view2.ts (can import "./template1", "./view1`)
16
-
17
- generated
18
- └── templates
19
- └── views
20
- └── template1.ts (can import "./view1", "./view2")
21
- ```
22
-
23
- ```json tsconfig
24
- {
25
- "compilerOptions": {
26
- "rootDirs": ["src/views", "generated/templates/views"]
27
- }
28
- }
29
- ```
30
-
31
- This does not affect how TypeScript emits JavaScript, it only emulates the assumption that they will be able to
32
- work via those relative paths at runtime.
33
-
34
- `rootDirs` can be used to provide a separate "type layer" to files that are not TypeScript or JavaScript by providing a home for generated `.d.ts` files in another folder. This technique is useful for bundled applications where you use `import` of files that aren't necessarily code:
35
-
36
- ```sh
37
- src
38
- └── index.ts
39
- └── css
40
- └── main.css
41
- └── navigation.css
42
-
43
- generated
44
- └── css
45
- └── main.css.d.ts
46
- └── navigation.css.d.ts
47
- ```
48
-
49
- ```json tsconfig
50
- {
51
- "compilerOptions": {
52
- "rootDirs": ["src", "generated"]
53
- }
54
- }
55
- ```
56
-
57
- This technique lets you generate types ahead of time for the non-code source files. Imports then work naturally based off the source file's location.
58
- For example `./src/index.ts` can import the file `./src/css/main.css` and TypeScript will be aware of the bundler's behavior for that filetype via the corresponding generated declaration file.
59
-
60
- ```ts twoslash
61
- // @filename: main.css.d.ts
62
- export const appClass = 'mainClassF3EC2';
63
- // ---cut---
64
- // @filename: index.ts
65
- import { appClass } from './main.css';
66
- ```
@@ -1,6 +0,0 @@
1
- ---
2
- display: 'Skip Default Lib Check'
3
- oneline: 'Skip type checking .d.ts files that are included with TypeScript.'
4
- ---
5
-
6
- Use [`skipLibCheck`](#skipLibCheck) instead. Skip type checking of default library declaration files.
@@ -1,19 +0,0 @@
1
- ---
2
- display: 'Skip Lib Check'
3
- oneline: 'Skip type checking all .d.ts files.'
4
- ---
5
-
6
- Skip type checking of declaration files.
7
-
8
- This can save time during compilation at the expense of type-system accuracy. For example, two libraries could
9
- define two copies of the same `type` in an inconsistent way. Rather than doing a full check of all `d.ts` files, TypeScript
10
- will type check the code you specifically refer to in your app's source code.
11
-
12
- A common case where you might think to use `skipLibCheck` is when there are two copies of a library's types in
13
- your `node_modules`. In these cases, you should consider using a feature like [yarn's resolutions](https://yarnpkg.com/lang/en/docs/selective-version-resolutions/)
14
- to ensure there is only one copy of that dependency in your tree or investigate how to ensure there is
15
- only one copy by understanding the dependency resolution to fix the issue without additional tooling.
16
-
17
- Another possibility is when you are migrating between TypeScript releases and the changes cause breakages in node_modules and the JS standard libraries which you do not want to deal with during the TypeScript update.
18
-
19
- Note, that if these issues come from the TypeScript standard library you can replace the library using [TypeScript 4.5's lib replacement](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-4-5.html#supporting-lib-from-node_modules) technique.
@@ -1,39 +0,0 @@
1
- ---
2
- display: 'Source Map'
3
- oneline: 'Create source map files for emitted JavaScript files.'
4
- ---
5
-
6
- Enables the generation of [sourcemap files](https://developer.mozilla.org/docs/Tools/Debugger/How_to/Use_a_source_map).
7
- These files allow debuggers and other tools to display the original TypeScript source code when actually working with the emitted JavaScript files.
8
- Source map files are emitted as `.js.map` (or `.jsx.map`) files next to the corresponding `.js` output file.
9
-
10
- The `.js` files will in turn contain a sourcemap comment to indicate where the files are to external tools, for example:
11
-
12
- ```ts
13
- // helloWorld.ts
14
- export declare const helloWorld = 'hi';
15
- ```
16
-
17
- Compiling with `sourceMap` set to `true` creates the following JavaScript file:
18
-
19
- ```js
20
- // helloWorld.js
21
- 'use strict';
22
- Object.defineProperty(exports, '__esModule', { value: true });
23
- exports.helloWorld = 'hi';
24
- //# sourceMappingURL=// helloWorld.js.map
25
- ```
26
-
27
- And this also generates this json map:
28
-
29
- ```json
30
- // helloWorld.js.map
31
- {
32
- "version": 3,
33
- "file": "ex.js",
34
- "sourceRoot": "",
35
- "sources": ["../ex.ts"],
36
- "names": [],
37
- "mappings": ";;AAAa,QAAA,UAAU,GAAG,IAAI,CAAA"
38
- }
39
- ```
@@ -1,18 +0,0 @@
1
- ---
2
- display: 'Source Root'
3
- oneline: 'Specify the root path for debuggers to find the reference source code.'
4
- ---
5
-
6
- Specify the location where a debugger should locate TypeScript files instead of relative source locations.
7
- This string is treated verbatim inside the source-map where you can use a path or a URL:
8
-
9
- ```json tsconfig
10
- {
11
- "compilerOptions": {
12
- "sourceMap": true,
13
- "sourceRoot": "https://my-website.com/debug/source/"
14
- }
15
- }
16
- ```
17
-
18
- Would declare that `index.js` will have a source file at `https://my-website.com/debug/source/index.ts`.
@@ -1,6 +0,0 @@
1
- ---
2
- display: 'stopBuildOnErrors'
3
- oneline: 'Skip building downstream projects on error in upstream project.'
4
- ---
5
-
6
- Skip building downstream projects on error in upstream project.
@@ -1,11 +0,0 @@
1
- ---
2
- display: 'Strict'
3
- oneline: 'Enable all strict type-checking options.'
4
- ---
5
-
6
- The `strict` flag enables a wide range of type checking behavior that results in stronger guarantees of program correctness.
7
- Turning this on is equivalent to enabling all of the _strict mode family_ options, which are outlined below.
8
- You can then turn off individual strict mode family checks as needed.
9
-
10
- Future versions of TypeScript may introduce additional stricter checking under this flag, so upgrades of TypeScript might result in new type errors in your program.
11
- When appropriate and possible, a corresponding flag will be added to disable that behavior.
@@ -1,34 +0,0 @@
1
- ---
2
- display: 'Strict Bind Call Apply'
3
- oneline: 'Check that the arguments for `bind`, `call`, and `apply` methods match the original function.'
4
- ---
5
-
6
- When set, TypeScript will check that the built-in methods of functions `call`, `bind`, and `apply` are invoked with correct argument for the underlying function:
7
-
8
- ```ts twoslash
9
- // @strictBindCallApply: true
10
- // @errors: 2345
11
-
12
- // With strictBindCallApply on
13
- function fn(x: string) {
14
- return parseInt(x);
15
- }
16
-
17
- const n1 = fn.call(undefined, '10');
18
-
19
- const n2 = fn.call(undefined, false);
20
- ```
21
-
22
- Otherwise, these functions accept any arguments and will return `any`:
23
-
24
- ```ts twoslash
25
- // @strictBindCallApply: false
26
-
27
- // With strictBindCallApply off
28
- function fn(x: string) {
29
- return parseInt(x);
30
- }
31
-
32
- // Note: No error; return type is 'any'
33
- const n = fn.call(undefined, false);
34
- ```
@@ -1,6 +0,0 @@
1
- ---
2
- display: 'strictBuiltinIteratorReturn'
3
- oneline: 'Built-in iterators are instantiated with a TReturn type of undefined instead of any.'
4
- ---
5
-
6
- Built-in iterators are instantiated with a `TReturn` type of undefined instead of `any`.
@@ -1,55 +0,0 @@
1
- ---
2
- display: 'Strict Function Types'
3
- oneline: 'When assigning functions, check to ensure parameters and the return values are subtype-compatible.'
4
- ---
5
-
6
- When enabled, this flag causes functions parameters to be checked more correctly.
7
-
8
- Here's a basic example with `strictFunctionTypes` off:
9
-
10
- ```ts twoslash
11
- // @strictFunctionTypes: false
12
- function fn(x: string) {
13
- console.log('Hello, ' + x.toLowerCase());
14
- }
15
-
16
- type StringOrNumberFunc = (ns: string | number) => void;
17
-
18
- // Unsafe assignment
19
- let func: StringOrNumberFunc = fn;
20
- // Unsafe call - will crash
21
- func(10);
22
- ```
23
-
24
- With `strictFunctionTypes` _on_, the error is correctly detected:
25
-
26
- ```ts twoslash
27
- // @errors: 2322
28
- function fn(x: string) {
29
- console.log('Hello, ' + x.toLowerCase());
30
- }
31
-
32
- type StringOrNumberFunc = (ns: string | number) => void;
33
-
34
- // Unsafe assignment is prevented
35
- let func: StringOrNumberFunc = fn;
36
- ```
37
-
38
- During development of this feature, we discovered a large number of inherently unsafe class hierarchies, including some in the DOM.
39
- Because of this, the setting only applies to functions written in _function_ syntax, not to those in _method_ syntax:
40
-
41
- ```ts twoslash
42
- type Methodish = {
43
- func(x: string | number): void;
44
- };
45
-
46
- function fn(x: string) {
47
- console.log('Hello, ' + x.toLowerCase());
48
- }
49
-
50
- // Ultimately an unsafe assignment, but not detected
51
- const m: Methodish = {
52
- func: fn,
53
- };
54
- m.func(10);
55
- ```
@@ -1,58 +0,0 @@
1
- ---
2
- display: 'Strict Null Checks'
3
- oneline: 'When type checking, take into account `null` and `undefined`.'
4
- ---
5
-
6
- When `strictNullChecks` is `false`, `null` and `undefined` are effectively ignored by the language.
7
- This can lead to unexpected errors at runtime.
8
-
9
- When `strictNullChecks` is `true`, `null` and `undefined` have their own distinct types and you'll get a type error if you try to use them where a concrete value is expected.
10
-
11
- For example with this TypeScript code, `users.find` has no guarantee that it will actually find a user, but you can
12
- write code as though it will:
13
-
14
- ```ts twoslash
15
- // @strictNullChecks: false
16
- // @target: ES2015
17
- declare const loggedInUsername: string;
18
-
19
- const users = [
20
- { name: 'Oby', age: 12 },
21
- { name: 'Heera', age: 32 },
22
- ];
23
-
24
- const loggedInUser = users.find((u) => u.name === loggedInUsername);
25
- console.log(loggedInUser.age);
26
- ```
27
-
28
- Setting `strictNullChecks` to `true` will raise an error that you have not made a guarantee that the `loggedInUser` exists before trying to use it.
29
-
30
- ```ts twoslash
31
- // @errors: 2339 2532 18048
32
- // @target: ES2020
33
- // @strictNullChecks
34
- declare const loggedInUsername: string;
35
-
36
- const users = [
37
- { name: 'Oby', age: 12 },
38
- { name: 'Heera', age: 32 },
39
- ];
40
-
41
- const loggedInUser = users.find((u) => u.name === loggedInUsername);
42
- console.log(loggedInUser.age);
43
- ```
44
-
45
- The second example failed because the array's `find` function looks a bit like this simplification:
46
-
47
- ```ts
48
- // When strictNullChecks: true
49
- type Array = {
50
- find(predicate: (value: any, index: number) => boolean): S | undefined;
51
- };
52
-
53
- // When strictNullChecks: false the undefined is removed from the type system,
54
- // allowing you to write code which assumes it always found a result
55
- type Array = {
56
- find(predicate: (value: any, index: number) => boolean): S;
57
- };
58
- ```
@@ -1,29 +0,0 @@
1
- ---
2
- display: 'Strict Property Initialization'
3
- oneline: 'Check for class properties that are declared but not set in the constructor.'
4
- ---
5
-
6
- When set to true, TypeScript will raise an error when a class property was declared but not set in the constructor.
7
-
8
- ```ts twoslash
9
- // @errors: 2564
10
- class UserAccount {
11
- name: string;
12
- accountType = 'user';
13
-
14
- email: string;
15
- address: string | undefined;
16
-
17
- constructor(name: string) {
18
- this.name = name;
19
- // Note that this.email is not set
20
- }
21
- }
22
- ```
23
-
24
- In the above case:
25
-
26
- - `this.name` is set specifically.
27
- - `this.accountType` is set by default.
28
- - `this.email` is not set and raises an error.
29
- - `this.address` is declared as potentially `undefined` which means it does not have to be set.