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,38 @@
1
+ ---
2
+ display: 'Allow Arbitrary Extensions'
3
+ oneline: 'Enable importing files with any extension, provided a declaration file is present.'
4
+ ---
5
+
6
+ In TypeScript 5.0, when an import path ends in an extension that isn't a known JavaScript or TypeScript file extension, the compiler will look for a declaration file for that path in the form of `{file basename}.d.{extension}.ts`.
7
+ For example, if you are using a CSS loader in a bundler project, you might want to write (or generate) declaration files for those stylesheets:
8
+
9
+ ```css
10
+ /* app.css */
11
+ .cookie-banner {
12
+ display: none;
13
+ }
14
+ ```
15
+
16
+ ```ts
17
+ // app.d.css.ts
18
+ declare const css: {
19
+ cookieBanner: string;
20
+ };
21
+ export default css;
22
+ ```
23
+
24
+ ```ts
25
+ // App.tsx
26
+ import styles from './app.css';
27
+
28
+ styles.cookieBanner; // string
29
+ ```
30
+
31
+ By default, this import will raise an error to let you know that TypeScript doesn't understand this file type and your runtime might not support importing it.
32
+ But if you've configured your runtime or bundler to handle it, you can suppress the error with the new `--allowArbitraryExtensions` compiler option.
33
+
34
+ Note that historically, a similar effect has often been achievable by adding a declaration file named `app.css.d.ts` instead of `app.d.css.ts` - however, this just worked through Node's `require` resolution rules for CommonJS.
35
+ Strictly speaking, the former is interpreted as a declaration file for a JavaScript file named `app.css.js`.
36
+ Because relative files imports need to include extensions in Node's ESM support, TypeScript would error on our example in an ESM file under `--moduleResolution node16` or `nodenext`.
37
+
38
+ For more information, read up [the proposal for this feature](https://github.com/microsoft/TypeScript/issues/50133) and [its corresponding pull request](https://github.com/microsoft/TypeScript/pull/51435).
@@ -0,0 +1,9 @@
1
+ ---
2
+ display: 'Allow Importing TS Extensions'
3
+ oneline: 'Allow imports to include TypeScript file extensions.'
4
+ ---
5
+
6
+ `--allowImportingTsExtensions` allows TypeScript files to import each other with a TypeScript-specific extension like `.ts`, `.mts`, or `.tsx`.
7
+
8
+ This flag is only allowed when `--noEmit` or `--emitDeclarationOnly` is enabled, since these import paths would not be resolvable at runtime in JavaScript output files.
9
+ The expectation here is that your resolver (e.g. your bundler, a runtime, or some other tool) is going to make these imports between `.ts` files work.
@@ -0,0 +1,41 @@
1
+ ---
2
+ display: 'Allow JS'
3
+ oneline: 'Allow JavaScript files to be a part of your program. Use the `checkJS` option to get errors from these files.'
4
+ ---
5
+
6
+ Allow JavaScript files to be imported inside your project, instead of just `.ts` and `.tsx` files. For example, this JS file:
7
+
8
+ ```js twoslash
9
+ // @filename: card.js
10
+ export const defaultCardDeck = 'Heart';
11
+ ```
12
+
13
+ When imported into a TypeScript file will raise an error:
14
+
15
+ ```ts twoslash
16
+ // @errors: 2307
17
+ // @filename: card.js
18
+ module.exports.defaultCardDeck = 'Heart';
19
+ // ---cut---
20
+ // @filename: index.ts
21
+ import { defaultCardDeck } from './card';
22
+
23
+ console.log(defaultCardDeck);
24
+ ```
25
+
26
+ Imports fine with `allowJs` enabled:
27
+
28
+ ```ts twoslash
29
+ // @filename: card.js
30
+ module.exports.defaultCardDeck = 'Heart';
31
+ // ---cut---
32
+ // @allowJs
33
+ // @filename: index.ts
34
+ import { defaultCardDeck } from './card';
35
+
36
+ console.log(defaultCardDeck);
37
+ ```
38
+
39
+ This flag can be used as a way to incrementally add TypeScript files into JS projects by allowing the `.ts` and `.tsx` files to live along-side existing JavaScript files.
40
+
41
+ It can also be used along-side [`declaration`](#declaration) and [`emitDeclarationOnly`](#emitDeclarationOnly) to [create declarations for JS files](/docs/handbook/declaration-files/dts-from-js.html).
@@ -0,0 +1,56 @@
1
+ ---
2
+ display: 'Allow Synthetic Default Imports'
3
+ oneline: "Allow 'import x from y' when a module doesn't have a default export."
4
+ ---
5
+
6
+ When set to true, `allowSyntheticDefaultImports` allows you to write an import like:
7
+
8
+ ```ts
9
+ import React from 'react';
10
+ ```
11
+
12
+ instead of:
13
+
14
+ ```ts
15
+ import * as React from 'react';
16
+ ```
17
+
18
+ When the module **does not** explicitly specify a default export.
19
+
20
+ For example, without `allowSyntheticDefaultImports` as true:
21
+
22
+ ```ts twoslash
23
+ // @errors: 1259 1192
24
+ // @checkJs
25
+ // @allowJs
26
+ // @esModuleInterop: false
27
+ // @filename: utilFunctions.js
28
+ // @noImplicitAny: false
29
+ const getStringLength = (str) => str.length;
30
+
31
+ module.exports = {
32
+ getStringLength,
33
+ };
34
+
35
+ // @filename: index.ts
36
+ import utils from './utilFunctions';
37
+
38
+ const count = utils.getStringLength('Check JS');
39
+ ```
40
+
41
+ This code raises an error because there isn't a `default` object which you can import. Even though it feels like it should.
42
+ For convenience, transpilers like Babel will automatically create a default if one isn't created. Making the module look a bit more like:
43
+
44
+ ```js
45
+ // @filename: utilFunctions.js
46
+ const getStringLength = (str) => str.length;
47
+ const allFunctions = {
48
+ getStringLength,
49
+ };
50
+
51
+ module.exports = allFunctions;
52
+ module.exports.default = allFunctions;
53
+ ```
54
+
55
+ This flag does not affect the JavaScript emitted by TypeScript, it's only for the type checking.
56
+ This option brings the behavior of TypeScript in-line with Babel, where extra code is emitted to make using a default export of a module more ergonomic.
@@ -0,0 +1,8 @@
1
+ ---
2
+ display: 'Allow Umd Global Access'
3
+ oneline: 'Allow accessing UMD globals from modules.'
4
+ ---
5
+
6
+ When set to true, `allowUmdGlobalAccess` lets you access UMD exports as globals from inside module files. A module file is a file that has imports and/or exports. Without this flag, using an export from a UMD module requires an import declaration.
7
+
8
+ An example use case for this flag would be a web project where you know the particular library (like jQuery or Lodash) will always be available at runtime, but you can’t access it with an import.
@@ -0,0 +1,40 @@
1
+ ---
2
+ display: 'Allow Unreachable Code'
3
+ oneline: 'Disable error reporting for unreachable code.'
4
+ ---
5
+
6
+ When:
7
+
8
+ - `undefined` (default) provide suggestions as warnings to editors
9
+ - `true` unreachable code is ignored
10
+ - `false` raises compiler errors about unreachable code
11
+
12
+ These warnings are only about code which is provably unreachable due to the use of JavaScript syntax, for example:
13
+
14
+ ```ts
15
+ function fn(n: number) {
16
+ if (n > 5) {
17
+ return true;
18
+ } else {
19
+ return false;
20
+ }
21
+ return true;
22
+ }
23
+ ```
24
+
25
+ With `"allowUnreachableCode": false`:
26
+
27
+ ```ts twoslash
28
+ // @errors: 7027
29
+ // @allowUnreachableCode: false
30
+ function fn(n: number) {
31
+ if (n > 5) {
32
+ return true;
33
+ } else {
34
+ return false;
35
+ }
36
+ return true;
37
+ }
38
+ ```
39
+
40
+ This does not affect errors on the basis of code which _appears_ to be unreachable due to type analysis.
@@ -0,0 +1,23 @@
1
+ ---
2
+ display: 'Allow Unused Labels'
3
+ oneline: 'Disable error reporting for unused labels.'
4
+ ---
5
+
6
+ When:
7
+
8
+ - `undefined` (default) provide suggestions as warnings to editors
9
+ - `true` unused labels are ignored
10
+ - `false` raises compiler errors about unused labels
11
+
12
+ Labels are very rare in JavaScript and typically indicate an attempt to write an object literal:
13
+
14
+ ```ts twoslash
15
+ // @errors: 7028
16
+ // @allowUnusedLabels: false
17
+ function verifyAge(age: number) {
18
+ // Forgot 'return' statement
19
+ if (age > 18) {
20
+ verified: true;
21
+ }
22
+ }
23
+ ```
@@ -0,0 +1,8 @@
1
+ ---
2
+ display: 'Always Strict'
3
+ oneline: "Ensure 'use strict' is always emitted."
4
+ ---
5
+
6
+ Ensures that your files are parsed in the ECMAScript strict mode, and emit "use strict" for each source file.
7
+
8
+ [ECMAScript strict](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Strict_mode) mode was introduced in ES5 and provides behavior tweaks to the runtime of the JavaScript engine to improve performance, and makes a set of errors throw instead of silently ignoring them.
@@ -0,0 +1,8 @@
1
+ ---
2
+ display: 'Assume Changes Only Affect Direct Dependencies'
3
+ oneline: 'Have recompiles in projects that use [`incremental`](#incremental) and `watch` mode assume that changes within a file will only affect files directly depending on it.'
4
+ ---
5
+
6
+ When this option is enabled, TypeScript will avoid rechecking/rebuilding all truly possibly-affected files, and only recheck/rebuild files that have changed as well as files that directly import them.
7
+
8
+ This can be considered a 'fast & loose' implementation of the watching algorithm, which can drastically reduce incremental rebuild times at the expense of having to run the full build occasionally to get all compiler error messages.
@@ -0,0 +1,26 @@
1
+ ---
2
+ display: 'Base URL'
3
+ oneline: 'Specify the base directory to resolve bare specifier module names.'
4
+ ---
5
+
6
+ Sets a base directory from which to resolve bare specifier module names. For example, in the directory structure:
7
+
8
+ ```
9
+ project
10
+ ├── ex.ts
11
+ ├── hello
12
+ │ └── world.ts
13
+ └── tsconfig.json
14
+ ```
15
+
16
+ With `"baseUrl": "./"`, TypeScript will look for files starting at the same folder as the `tsconfig.json`:
17
+
18
+ ```ts
19
+ import { helloWorld } from 'hello/world';
20
+
21
+ console.log(helloWorld);
22
+ ```
23
+
24
+ This resolution has higher priority than lookups from `node_modules`.
25
+
26
+ This feature was designed for use in conjunction with AMD module loaders in the browser, and is not recommended in any other context. As of TypeScript 4.1, `baseUrl` is no longer required to be set when using [`paths`](#paths).
@@ -0,0 +1,7 @@
1
+ ---
2
+ display: 'Charset'
3
+ oneline: 'No longer supported. In early versions, manually set the text encoding for reading files.'
4
+ ---
5
+
6
+ In prior versions of TypeScript, this controlled what encoding was used when reading text files from disk.
7
+ Today, TypeScript assumes UTF-8 encoding, but will correctly detect UTF-16 (BE and LE) or UTF-8 BOMs.
@@ -0,0 +1,40 @@
1
+ ---
2
+ display: 'Check JS'
3
+ oneline: 'Enable error reporting in type-checked JavaScript files.'
4
+ ---
5
+
6
+ Works in tandem with [`allowJs`](#allowJs). When `checkJs` is enabled then errors are reported in JavaScript files. This is
7
+ the equivalent of including `// @ts-check` at the top of all JavaScript files which are included in your project.
8
+
9
+ For example, this is incorrect JavaScript according to the `parseFloat` type definition which comes with TypeScript:
10
+
11
+ ```js
12
+ // parseFloat only takes a string
13
+ module.exports.pi = parseFloat(3.142);
14
+ ```
15
+
16
+ When imported into a TypeScript module:
17
+
18
+ ```ts twoslash
19
+ // @allowJs
20
+ // @filename: constants.js
21
+ module.exports.pi = parseFloat(3.142);
22
+
23
+ // @filename: index.ts
24
+ import { pi } from './constants';
25
+ console.log(pi);
26
+ ```
27
+
28
+ You will not get any errors. However, if you turn on `checkJs` then you will get error messages from the JavaScript file.
29
+
30
+ ```ts twoslash
31
+ // @errors: 2345
32
+ // @allowjs: true
33
+ // @checkjs: true
34
+ // @filename: constants.js
35
+ module.exports.pi = parseFloat(3.142);
36
+
37
+ // @filename: index.ts
38
+ import { pi } from './constants';
39
+ console.log(pi);
40
+ ```
@@ -0,0 +1,6 @@
1
+ ---
2
+ display: 'Clean'
3
+ oneline: 'Delete the outputs of all projects.'
4
+ ---
5
+
6
+ Delete the outputs of all projects
@@ -0,0 +1,17 @@
1
+ ---
2
+ display: 'Composite'
3
+ oneline: 'Enable constraints that allow a TypeScript project to be used with project references.'
4
+ ---
5
+
6
+ The `composite` option enforces certain constraints which make it possible for build tools (including TypeScript
7
+ itself, under `--build` mode) to quickly determine if a project has been built yet.
8
+
9
+ When this setting is on:
10
+
11
+ - The [`rootDir`](#rootDir) setting, if not explicitly set, defaults to the directory containing the `tsconfig.json` file.
12
+
13
+ - All implementation files must be matched by an [`include`](#include) pattern or listed in the [`files`](#files) array. If this constraint is violated, `tsc` will inform you which files weren't specified.
14
+
15
+ - [`declaration`](#declaration) defaults to `true`
16
+
17
+ You can find documentation on TypeScript projects in [the handbook](https://www.typescriptlang.org/docs/handbook/project-references.html).
@@ -0,0 +1,41 @@
1
+ ---
2
+ display: 'Custom Conditions'
3
+ oneline: 'Conditions to set in addition to the resolver-specific defaults when resolving imports.'
4
+ ---
5
+
6
+ `--customConditions` takes a list of additional [conditions](https://nodejs.org/api/packages.html#nested-conditions) that should succeed when TypeScript resolves from an [`exports`](https://nodejs.org/api/packages.html#exports) or [`imports`](https://nodejs.org/api/packages.html#imports) field of a `package.json`.
7
+ These conditions are added to whatever existing conditions a resolver will use by default.
8
+
9
+ For example, when this field is set in a `tsconfig.json` as so:
10
+
11
+ ```jsonc
12
+ {
13
+ "compilerOptions": {
14
+ "target": "es2022",
15
+ "moduleResolution": "bundler",
16
+ "customConditions": ["my-condition"],
17
+ },
18
+ }
19
+ ```
20
+
21
+ Any time an `exports` or `imports` field is referenced in `package.json`, TypeScript will consider conditions called `my-condition`.
22
+
23
+ So when importing from a package with the following `package.json`
24
+
25
+ ```jsonc
26
+ {
27
+ // ...
28
+ "exports": {
29
+ ".": {
30
+ "my-condition": "./foo.mjs",
31
+ "node": "./bar.mjs",
32
+ "import": "./baz.mjs",
33
+ "require": "./biz.mjs",
34
+ },
35
+ },
36
+ }
37
+ ```
38
+
39
+ TypeScript will try to look for files corresponding to `foo.mjs`.
40
+
41
+ This field is only valid under the `node16`, `nodenext`, and `bundler` options for [`--moduleResolution`](#moduleResolution).
@@ -0,0 +1,32 @@
1
+ ---
2
+ display: 'Declaration'
3
+ oneline: 'Generate .d.ts files from TypeScript and JavaScript files in your project.'
4
+ ---
5
+
6
+ Generate `.d.ts` files for every TypeScript or JavaScript file inside your project.
7
+ These `.d.ts` files are type definition files which describe the external API of your module.
8
+ With `.d.ts` files, tools like TypeScript can provide intellisense and accurate types for un-typed code.
9
+
10
+ When `declaration` is set to `true`, running the compiler with this TypeScript code:
11
+
12
+ ```ts twoslash
13
+ export let helloWorld = 'hi';
14
+ ```
15
+
16
+ Will generate an `index.js` file like this:
17
+
18
+ ```ts twoslash
19
+ // @showEmit
20
+ export let helloWorld = 'hi';
21
+ ```
22
+
23
+ With a corresponding `helloWorld.d.ts`:
24
+
25
+ ```ts twoslash
26
+ // @showEmittedFile: index.d.ts
27
+ // @showEmit
28
+ // @declaration
29
+ export let helloWorld = 'hi';
30
+ ```
31
+
32
+ When working with `.d.ts` files for JavaScript files you may want to use [`emitDeclarationOnly`](#emitDeclarationOnly) or use [`outDir`](#outDir) to ensure that the JavaScript files are not overwritten.
@@ -0,0 +1,36 @@
1
+ ---
2
+ display: 'Declaration Dir'
3
+ oneline: 'Specify the output directory for generated declaration files.'
4
+ ---
5
+
6
+ Offers a way to configure the root directory for where declaration files are emitted.
7
+
8
+ ```
9
+ example
10
+ ├── index.ts
11
+ ├── package.json
12
+ └── tsconfig.json
13
+ ```
14
+
15
+ with this `tsconfig.json`:
16
+
17
+ ```json tsconfig
18
+ {
19
+ "compilerOptions": {
20
+ "declaration": true,
21
+ "declarationDir": "./types"
22
+ }
23
+ }
24
+ ```
25
+
26
+ Would place the d.ts for the `index.ts` in a `types` folder:
27
+
28
+ ```
29
+ example
30
+ ├── index.js
31
+ ├── index.ts
32
+ ├── package.json
33
+ ├── tsconfig.json
34
+ └── types
35
+ └── index.d.ts
36
+ ```
@@ -0,0 +1,9 @@
1
+ ---
2
+ display: 'Declaration Map'
3
+ oneline: 'Create sourcemaps for d.ts files.'
4
+ ---
5
+
6
+ Generates a source map for `.d.ts` files which map back to the original `.ts` source file.
7
+ This will allow editors such as VS Code to go to the original `.ts` file when using features like _Go to Definition_.
8
+
9
+ You should strongly consider turning this on if you're using project references.
@@ -0,0 +1,8 @@
1
+ ---
2
+ display: 'Diagnostics'
3
+ oneline: 'Output compiler performance information after building.'
4
+ ---
5
+
6
+ Used to output diagnostic information for debugging. This command is a subset of [`extendedDiagnostics`](#extendedDiagnostics) which are more user-facing results, and easier to interpret.
7
+
8
+ If you have been asked by a TypeScript compiler engineer to give the results using this flag in a compile, in which there is no harm in using [`extendedDiagnostics`](#extendedDiagnostics) instead.
@@ -0,0 +1,16 @@
1
+ ---
2
+ display: 'Disable Filename Based Type Acquisition'
3
+ oneline: 'Disables inference for type acquisition by looking at filenames in a project.'
4
+ ---
5
+
6
+ TypeScript's type acquisition can infer what types should be added based on filenames in a project. This means that having a file like `jquery.js` in your project would automatically download the types for JQuery from DefinitelyTyped.
7
+
8
+ You can disable this via `disableFilenameBasedTypeAcquisition`.
9
+
10
+ ```json
11
+ {
12
+ "typeAcquisition": {
13
+ "disableFilenameBasedTypeAcquisition": true
14
+ }
15
+ }
16
+ ```
@@ -0,0 +1,8 @@
1
+ ---
2
+ display: 'Disable Referenced Project Load'
3
+ oneline: 'Reduce the number of projects loaded automatically by TypeScript.'
4
+ ---
5
+
6
+ In multi-project TypeScript programs, TypeScript will load all of the available projects into memory in order to provide accurate results for editor responses which require a full knowledge graph like 'Find All References'.
7
+
8
+ If your project is large, you can use the flag `disableReferencedProjectLoad` to disable the automatic loading of all projects. Instead, projects are loaded dynamically as you open files through your editor.
@@ -0,0 +1,6 @@
1
+ ---
2
+ display: 'Disable Size Limit'
3
+ oneline: 'Remove the 20mb cap on total source code size for JavaScript files in the TypeScript language server.'
4
+ ---
5
+
6
+ To avoid a possible memory bloat issues when working with very large JavaScript projects, there is an upper limit to the amount of memory TypeScript will allocate. Turning this flag on will remove the limit.
@@ -0,0 +1,8 @@
1
+ ---
2
+ display: 'Disable Solution Searching'
3
+ oneline: 'Opt a project out of multi-project reference checking when editing.'
4
+ ---
5
+
6
+ When working with [composite TypeScript projects](/docs/handbook/project-references.html), this option provides a way to declare that you do not want a project to be included when using features like _find all references_ or _jump to definition_ in an editor.
7
+
8
+ This flag is something you can use to increase responsiveness in large composite projects.
@@ -0,0 +1,7 @@
1
+ ---
2
+ display: 'Disable Source Project Reference Redirect'
3
+ oneline: 'Disable preferring source files instead of declaration files when referencing composite projects.'
4
+ ---
5
+
6
+ When working with [composite TypeScript projects](/docs/handbook/project-references.html), this option provides a way to go [back to the pre-3.7](/docs/handbook/release-notes/typescript-3-7.html#build-free-editing-with-project-references) behavior where d.ts files were used to as the boundaries between modules.
7
+ In 3.7 the source of truth is now your TypeScript files.
@@ -0,0 +1,100 @@
1
+ ---
2
+ display: 'Downlevel Iteration'
3
+ oneline: 'Emit more compliant, but verbose and less performant JavaScript for iteration.'
4
+ ---
5
+
6
+ Downleveling is TypeScript's term for transpiling to an older version of JavaScript.
7
+ This flag is to enable support for a more accurate implementation of how modern JavaScript iterates through new concepts in older JavaScript runtimes.
8
+
9
+ ECMAScript 6 added several new iteration primitives: the `for / of` loop (`for (el of arr)`), Array spread (`[a, ...b]`), argument spread (`fn(...args)`), and `Symbol.iterator`.
10
+ `downlevelIteration` allows for these iteration primitives to be used more accurately in ES5 environments if a `Symbol.iterator` implementation is present.
11
+
12
+ #### Example: Effects on `for / of`
13
+
14
+ With this TypeScript code:
15
+
16
+ ```ts twoslash
17
+ const str = 'Hello!';
18
+ for (const s of str) {
19
+ console.log(s);
20
+ }
21
+ ```
22
+
23
+ Without `downlevelIteration` enabled, a `for / of` loop on any object is downleveled to a traditional `for` loop:
24
+
25
+ ```ts twoslash
26
+ // @target: ES5
27
+ // @showEmit
28
+ const str = 'Hello!';
29
+ for (const s of str) {
30
+ console.log(s);
31
+ }
32
+ ```
33
+
34
+ This is often what people expect, but it's not 100% compliant with ECMAScript iteration protocol.
35
+ Certain strings, such as emoji (😜), have a `.length` of 2 (or even more!), but should iterate as 1 unit in a `for-of` loop.
36
+ See [this blog post by Jonathan New](https://blog.jonnew.com/posts/poo-dot-length-equals-two) for a longer explanation.
37
+
38
+ When `downlevelIteration` is enabled, TypeScript will use a helper function that checks for a `Symbol.iterator` implementation (either native or polyfill).
39
+ If this implementation is missing, you'll fall back to index-based iteration.
40
+
41
+ ```ts twoslash
42
+ // @target: ES5
43
+ // @downlevelIteration
44
+ // @showEmit
45
+ const str = 'Hello!';
46
+ for (const s of str) {
47
+ console.log(s);
48
+ }
49
+ ```
50
+
51
+ You can use [tslib](https://www.npmjs.com/package/tslib) via [`importHelpers`](#importHelpers) to reduce the amount of inline JavaScript too:
52
+
53
+ ```ts twoslash
54
+ // @target: ES5
55
+ // @downlevelIteration
56
+ // @importHelpers
57
+ // @showEmit
58
+ const str = 'Hello!';
59
+ for (const s of str) {
60
+ console.log(s);
61
+ }
62
+ ```
63
+
64
+ **Note:** enabling `downlevelIteration` does not improve compliance if `Symbol.iterator` is not present in the runtime.
65
+
66
+ #### Example: Effects on Array Spreads
67
+
68
+ This is an array spread:
69
+
70
+ ```js
71
+ // Make a new array whose elements are 1 followed by the elements of arr2
72
+ const arr = [1, ...arr2];
73
+ ```
74
+
75
+ Based on the description, it sounds easy to downlevel to ES5:
76
+
77
+ ```js
78
+ // The same, right?
79
+ const arr = [1].concat(arr2);
80
+ ```
81
+
82
+ However, this is observably different in certain rare cases.
83
+
84
+ For example, if a source array is missing one or more items (contains a hole), the spread syntax will replace each empty item with `undefined`, whereas `.concat` will leave them intact.
85
+
86
+ ```js
87
+ // Make an array where the element at index 1 is missing
88
+ let arrayWithHole = ['a', , 'c'];
89
+ let spread = [...arrayWithHole];
90
+ let concatenated = [].concat(arrayWithHole);
91
+
92
+ console.log(arrayWithHole);
93
+ // [ 'a', <1 empty item>, 'c' ]
94
+ console.log(spread);
95
+ // [ 'a', undefined, 'c' ]
96
+ console.log(concatenated);
97
+ // [ 'a', <1 empty item>, 'c' ]
98
+ ```
99
+
100
+ Just as with `for / of`, `downlevelIteration` will use `Symbol.iterator` (if present) to more accurately emulate ES 6 behavior.
@@ -0,0 +1,8 @@
1
+ ---
2
+ display: 'Emit BOM'
3
+ oneline: 'Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.'
4
+ ---
5
+
6
+ Controls whether TypeScript will emit a [byte order mark (BOM)](https://wikipedia.org/wiki/Byte_order_mark) when writing output files.
7
+ Some runtime environments require a BOM to correctly interpret a JavaScript files; others require that it is not present.
8
+ The default value of `false` is generally best unless you have a reason to change it.
@@ -0,0 +1,11 @@
1
+ ---
2
+ display: 'Emit Declaration Only'
3
+ oneline: 'Only output d.ts files and not JavaScript files.'
4
+ ---
5
+
6
+ _Only_ emit `.d.ts` files; do not emit `.js` files.
7
+
8
+ This setting is useful in two cases:
9
+
10
+ - You are using a transpiler other than TypeScript to generate your JavaScript.
11
+ - You are using TypeScript to only generate `d.ts` files for your consumers.