ai-hero-cli 0.0.3 → 0.0.5

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 (141) hide show
  1. package/dist/bin.d.ts +1 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/bin.js.map +1 -1
  4. package/docs/tsconfig/allowArbitraryExtensions.md +38 -0
  5. package/docs/tsconfig/allowImportingTsExtensions.md +9 -0
  6. package/docs/tsconfig/allowJs.md +41 -0
  7. package/docs/tsconfig/allowSyntheticDefaultImports.md +56 -0
  8. package/docs/tsconfig/allowUmdGlobalAccess.md +8 -0
  9. package/docs/tsconfig/allowUnreachableCode.md +40 -0
  10. package/docs/tsconfig/allowUnusedLabels.md +23 -0
  11. package/docs/tsconfig/alwaysStrict.md +8 -0
  12. package/docs/tsconfig/assumeChangesOnlyAffectDirectDependencies.md +8 -0
  13. package/docs/tsconfig/baseUrl.md +26 -0
  14. package/docs/tsconfig/charset.md +7 -0
  15. package/docs/tsconfig/checkJs.md +40 -0
  16. package/docs/tsconfig/clean.md +6 -0
  17. package/docs/tsconfig/composite.md +17 -0
  18. package/docs/tsconfig/customConditions.md +41 -0
  19. package/docs/tsconfig/declaration.md +32 -0
  20. package/docs/tsconfig/declarationDir.md +36 -0
  21. package/docs/tsconfig/declarationMap.md +9 -0
  22. package/docs/tsconfig/diagnostics.md +8 -0
  23. package/docs/tsconfig/disableFilenameBasedTypeAcquisition.md +16 -0
  24. package/docs/tsconfig/disableReferencedProjectLoad.md +8 -0
  25. package/docs/tsconfig/disableSizeLimit.md +6 -0
  26. package/docs/tsconfig/disableSolutionSearching.md +8 -0
  27. package/docs/tsconfig/disableSourceOfProjectReferenceRedirect.md +7 -0
  28. package/docs/tsconfig/downlevelIteration.md +100 -0
  29. package/docs/tsconfig/emitBOM.md +8 -0
  30. package/docs/tsconfig/emitDeclarationOnly.md +11 -0
  31. package/docs/tsconfig/emitDecoratorMetadata.md +81 -0
  32. package/docs/tsconfig/enable.md +14 -0
  33. package/docs/tsconfig/erasableSyntaxOnly.md +65 -0
  34. package/docs/tsconfig/esModuleInterop.md +74 -0
  35. package/docs/tsconfig/exactOptionalPropertyTypes.md +37 -0
  36. package/docs/tsconfig/exclude.md +11 -0
  37. package/docs/tsconfig/excludeDirectories.md +14 -0
  38. package/docs/tsconfig/excludeFiles.md +14 -0
  39. package/docs/tsconfig/experimentalDecorators.md +11 -0
  40. package/docs/tsconfig/explainFiles.md +54 -0
  41. package/docs/tsconfig/extendedDiagnostics.md +9 -0
  42. package/docs/tsconfig/extends.md +49 -0
  43. package/docs/tsconfig/fallbackPolling.md +11 -0
  44. package/docs/tsconfig/files.md +26 -0
  45. package/docs/tsconfig/force.md +6 -0
  46. package/docs/tsconfig/forceConsistentCasingInFileNames.md +10 -0
  47. package/docs/tsconfig/generateCpuProfile.md +15 -0
  48. package/docs/tsconfig/generateTrace.md +6 -0
  49. package/docs/tsconfig/importHelpers.md +46 -0
  50. package/docs/tsconfig/importsNotUsedAsValues.md +16 -0
  51. package/docs/tsconfig/include.md +66 -0
  52. package/docs/tsconfig/incremental.md +10 -0
  53. package/docs/tsconfig/inlineSourceMap.md +35 -0
  54. package/docs/tsconfig/inlineSources.md +36 -0
  55. package/docs/tsconfig/isolatedDeclarations.md +8 -0
  56. package/docs/tsconfig/isolatedModules.md +77 -0
  57. package/docs/tsconfig/jsx.md +111 -0
  58. package/docs/tsconfig/jsxFactory.md +43 -0
  59. package/docs/tsconfig/jsxFragmentFactory.md +69 -0
  60. package/docs/tsconfig/jsxImportSource.md +95 -0
  61. package/docs/tsconfig/keyofStringsOnly.md +8 -0
  62. package/docs/tsconfig/lib.md +75 -0
  63. package/docs/tsconfig/libReplacement.md +22 -0
  64. package/docs/tsconfig/listEmittedFiles.md +42 -0
  65. package/docs/tsconfig/listFiles.md +40 -0
  66. package/docs/tsconfig/locale.md +26 -0
  67. package/docs/tsconfig/mapRoot.md +18 -0
  68. package/docs/tsconfig/maxNodeModuleJsDepth.md +11 -0
  69. package/docs/tsconfig/module.md +125 -0
  70. package/docs/tsconfig/moduleDetection.md +15 -0
  71. package/docs/tsconfig/moduleResolution.md +13 -0
  72. package/docs/tsconfig/moduleSuffixes.md +26 -0
  73. package/docs/tsconfig/newLine.md +6 -0
  74. package/docs/tsconfig/noCheck.md +6 -0
  75. package/docs/tsconfig/noEmit.md +10 -0
  76. package/docs/tsconfig/noEmitHelpers.md +38 -0
  77. package/docs/tsconfig/noEmitOnError.md +8 -0
  78. package/docs/tsconfig/noErrorTruncation.md +45 -0
  79. package/docs/tsconfig/noFallthroughCasesInSwitch.md +22 -0
  80. package/docs/tsconfig/noImplicitAny.md +26 -0
  81. package/docs/tsconfig/noImplicitOverride.md +66 -0
  82. package/docs/tsconfig/noImplicitReturns.md +17 -0
  83. package/docs/tsconfig/noImplicitThis.md +28 -0
  84. package/docs/tsconfig/noImplicitUseStrict.md +7 -0
  85. package/docs/tsconfig/noLib.md +9 -0
  86. package/docs/tsconfig/noPropertyAccessFromIndexSignature.md +57 -0
  87. package/docs/tsconfig/noResolve.md +9 -0
  88. package/docs/tsconfig/noStrictGenericChecks.md +20 -0
  89. package/docs/tsconfig/noUncheckedIndexedAccess.md +53 -0
  90. package/docs/tsconfig/noUncheckedSideEffectImports.md +52 -0
  91. package/docs/tsconfig/noUnusedLocals.md +15 -0
  92. package/docs/tsconfig/noUnusedParameters.md +15 -0
  93. package/docs/tsconfig/out.md +9 -0
  94. package/docs/tsconfig/outDir.md +39 -0
  95. package/docs/tsconfig/outFile.md +11 -0
  96. package/docs/tsconfig/paths.md +39 -0
  97. package/docs/tsconfig/plugins.md +17 -0
  98. package/docs/tsconfig/preserveConstEnums.md +58 -0
  99. package/docs/tsconfig/preserveSymlinks.md +10 -0
  100. package/docs/tsconfig/preserveValueImports.md +18 -0
  101. package/docs/tsconfig/preserveWatchOutput.md +6 -0
  102. package/docs/tsconfig/pretty.md +7 -0
  103. package/docs/tsconfig/reactNamespace.md +6 -0
  104. package/docs/tsconfig/references.md +9 -0
  105. package/docs/tsconfig/removeComments.md +33 -0
  106. package/docs/tsconfig/resolveJsonModule.md +44 -0
  107. package/docs/tsconfig/resolvePackageJsonExports.md +8 -0
  108. package/docs/tsconfig/resolvePackageJsonImports.md +8 -0
  109. package/docs/tsconfig/rewriteRelativeImportExtensions.md +8 -0
  110. package/docs/tsconfig/rootDir.md +66 -0
  111. package/docs/tsconfig/rootDirs.md +66 -0
  112. package/docs/tsconfig/skipDefaultLibCheck.md +6 -0
  113. package/docs/tsconfig/skipLibCheck.md +19 -0
  114. package/docs/tsconfig/sourceMap.md +39 -0
  115. package/docs/tsconfig/sourceRoot.md +18 -0
  116. package/docs/tsconfig/stopBuildOnErrors.md +6 -0
  117. package/docs/tsconfig/strict.md +11 -0
  118. package/docs/tsconfig/strictBindCallApply.md +34 -0
  119. package/docs/tsconfig/strictBuiltinIteratorReturn.md +6 -0
  120. package/docs/tsconfig/strictFunctionTypes.md +55 -0
  121. package/docs/tsconfig/strictNullChecks.md +58 -0
  122. package/docs/tsconfig/strictPropertyInitialization.md +29 -0
  123. package/docs/tsconfig/stripInternal.md +60 -0
  124. package/docs/tsconfig/suppressExcessPropertyErrors.md +16 -0
  125. package/docs/tsconfig/suppressImplicitAnyIndexErrors.md +25 -0
  126. package/docs/tsconfig/synchronousWatchDirectory.md +14 -0
  127. package/docs/tsconfig/target.md +18 -0
  128. package/docs/tsconfig/traceResolution.md +7 -0
  129. package/docs/tsconfig/tsBuildInfoFile.md +17 -0
  130. package/docs/tsconfig/typeAcquisition.md +37 -0
  131. package/docs/tsconfig/typeRoots.md +21 -0
  132. package/docs/tsconfig/types.md +40 -0
  133. package/docs/tsconfig/useDefineForClassFields.md +10 -0
  134. package/docs/tsconfig/useUnknownInCatchVariables.md +21 -0
  135. package/docs/tsconfig/verbatimModuleSyntax.md +148 -0
  136. package/docs/tsconfig/verbose.md +6 -0
  137. package/docs/tsconfig/watchDirectory.md +10 -0
  138. package/docs/tsconfig/watchFile.md +12 -0
  139. package/package.json +4 -2
  140. package/prompts/hows-my-tsconfig-score.md +29 -0
  141. package/prompts/hows-my-tsconfig.md +75 -0
@@ -0,0 +1,53 @@
1
+ ---
2
+ display: 'No Unchecked Indexed Access'
3
+ oneline: 'Add `undefined` to a type when accessed using an index.'
4
+ ---
5
+
6
+ TypeScript has a way to describe objects which have unknown keys but known values on an object, via index signatures.
7
+
8
+ ```ts twoslash
9
+ interface EnvironmentVars {
10
+ NAME: string;
11
+ OS: string;
12
+
13
+ // Unknown properties are covered by this index signature.
14
+ [propName: string]: string;
15
+ }
16
+
17
+ declare const env: EnvironmentVars;
18
+
19
+ // Declared as existing
20
+ const sysName = env.NAME;
21
+ const os = env.OS;
22
+ // ^?
23
+
24
+ // Not declared, but because of the index
25
+ // signature, then it is considered a string
26
+ const nodeEnv = env.NODE_ENV;
27
+ // ^?
28
+ ```
29
+
30
+ Turning on `noUncheckedIndexedAccess` will add `undefined` to any un-declared field in the type.
31
+
32
+ ```ts twoslash
33
+ interface EnvironmentVars {
34
+ NAME: string;
35
+ OS: string;
36
+
37
+ // Unknown properties are covered by this index signature.
38
+ [propName: string]: string;
39
+ }
40
+ // @noUncheckedIndexedAccess
41
+ // ---cut---
42
+ declare const env: EnvironmentVars;
43
+
44
+ // Declared as existing
45
+ const sysName = env.NAME;
46
+ const os = env.OS;
47
+ // ^?
48
+
49
+ // Not declared, but because of the index
50
+ // signature, then it is considered a string
51
+ const nodeEnv = env.NODE_ENV;
52
+ // ^?
53
+ ```
@@ -0,0 +1,52 @@
1
+ ---
2
+ display: 'noUncheckedSideEffectImports'
3
+ oneline: 'Check side effect imports.'
4
+ ---
5
+
6
+ In JavaScript it's possible to `import` a module without actually importing any values from it.
7
+
8
+ ```ts
9
+ import 'some-module';
10
+ ```
11
+
12
+ These imports are often called _side effect imports_ because the only useful behavior they can provide is by executing some side effect (like registering a global variable, or adding a polyfill to a prototype).
13
+
14
+ By default, TypeScript will not check these imports for validity. If the import resolves to a valid source file, TypeScript will load and check the file.
15
+ If no source file is found, TypeScript will silently ignore the import.
16
+
17
+ This is surprising behavior, but it partially stems from modeling patterns in the JavaScript ecosystem.
18
+ For example, this syntax has also been used with special loaders in bundlers to load CSS or other assets.
19
+ Your bundler might be configured in such a way where you can include specific `.css` files by writing something like the following:
20
+
21
+ ```tsx
22
+ import './button-component.css';
23
+
24
+ export function Button() {
25
+ // ...
26
+ }
27
+ ```
28
+
29
+ Still, this masks potential typos on side effect imports.
30
+
31
+ When `--noUncheckedSideEffectImports` is enabled, TypeScript will error if it can't find a source file for a side effect import.
32
+
33
+ ```ts
34
+ import 'oops-this-module-does-not-exist';
35
+ // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
36
+ // error: Cannot find module 'oops-this-module-does-not-exist' or its corresponding
37
+ // type declarations.
38
+ ```
39
+
40
+ When enabling this option, some working code may now receive an error, like in the CSS example above.
41
+ To work around this, users who want to just write side effect `import`s for assets might be better served by writing what's called an _ambient module declaration_ with a wildcard specifier.
42
+ It would go in a global file and look something like the following:
43
+
44
+ ```ts
45
+ // ./src/globals.d.ts
46
+
47
+ // Recognize all CSS files as module imports.
48
+ declare module '*.css' {}
49
+ ```
50
+
51
+ In fact, you might already have a file like this in your project!
52
+ For example, running something like `vite init` might create a similar `vite-env.d.ts`.
@@ -0,0 +1,15 @@
1
+ ---
2
+ display: 'No Unused Locals'
3
+ oneline: "Enable error reporting when local variables aren't read."
4
+ ---
5
+
6
+ Report errors on unused local variables.
7
+
8
+ ```ts twoslash
9
+ // @noUnusedLocals
10
+ // @errors: 6133
11
+ const createKeyboard = (modelID: number) => {
12
+ const defaultModelID = 23;
13
+ return { type: 'keyboard', modelID };
14
+ };
15
+ ```
@@ -0,0 +1,15 @@
1
+ ---
2
+ display: 'No Unused Parameters'
3
+ oneline: "Raise an error when a function parameter isn't read."
4
+ ---
5
+
6
+ Report errors on unused parameters in functions.
7
+
8
+ ```ts twoslash
9
+ // @noUnusedParameters
10
+ // @errors: 6133
11
+ const createDefaultKeyboard = (modelID: number) => {
12
+ const defaultModelID = 23;
13
+ return { type: 'keyboard', modelID: defaultModelID };
14
+ };
15
+ ```
@@ -0,0 +1,9 @@
1
+ ---
2
+ display: 'Out'
3
+ oneline: 'Deprecated setting. Use [`outFile`](#outFile) instead.'
4
+ ---
5
+
6
+ Use [`outFile`](#outFile) instead.
7
+
8
+ The `out` option computes the final file location in a way that is not predictable or consistent.
9
+ This option is retained for backward compatibility only and is deprecated.
@@ -0,0 +1,39 @@
1
+ ---
2
+ display: 'Out Dir'
3
+ oneline: 'Specify an output folder for all emitted files.'
4
+ ---
5
+
6
+ If specified, `.js` (as well as `.d.ts`, `.js.map`, etc.) files will be emitted into this directory.
7
+ The directory structure of the original source files is preserved; see [`rootDir`](#rootDir) if the computed root is not what you intended.
8
+
9
+ If not specified, `.js` files will be emitted in the same directory as the `.ts` files they were generated from:
10
+
11
+ ```sh
12
+ $ tsc
13
+
14
+ example
15
+ ├── index.js
16
+ └── index.ts
17
+ ```
18
+
19
+ With a `tsconfig.json` like this:
20
+
21
+ ```json tsconfig
22
+ {
23
+ "compilerOptions": {
24
+ "outDir": "dist"
25
+ }
26
+ }
27
+ ```
28
+
29
+ Running `tsc` with these settings moves the files into the specified `dist` folder:
30
+
31
+ ```sh
32
+ $ tsc
33
+
34
+ example
35
+ ├── dist
36
+ │ └── index.js
37
+ ├── index.ts
38
+ └── tsconfig.json
39
+ ```
@@ -0,0 +1,11 @@
1
+ ---
2
+ display: 'Out File'
3
+ oneline: 'Specify a file that bundles all outputs into one JavaScript file. If [`declaration`](#declaration) is true, also designates a file that bundles all .d.ts output.'
4
+ ---
5
+
6
+ If specified, all _global_ (non-module) files will be concatenated into the single output file specified.
7
+
8
+ If `module` is `system` or `amd`, all module files will also be concatenated into this file after all global content.
9
+
10
+ Note: `outFile` cannot be used unless `module` is `None`, `System`, or `AMD`.
11
+ This option _cannot_ be used to bundle CommonJS or ES6 modules.
@@ -0,0 +1,39 @@
1
+ ---
2
+ display: 'Paths'
3
+ oneline: 'Specify a set of entries that re-map imports to additional lookup locations.'
4
+ ---
5
+
6
+ A series of entries which re-map imports to lookup locations relative to the [`baseUrl`](#baseUrl) if set, or to the tsconfig file itself otherwise. There is a larger coverage of `paths` in [the `moduleResolution` reference page](/docs/handbook/modules/reference.html#paths).
7
+
8
+ `paths` lets you declare how TypeScript should resolve an import in your `require`/`import`s.
9
+
10
+ ```json tsconfig
11
+ {
12
+ "compilerOptions": {
13
+ "paths": {
14
+ "jquery": ["./vendor/jquery/dist/jquery"]
15
+ }
16
+ }
17
+ }
18
+ ```
19
+
20
+ This would allow you to be able to write `import "jquery"`, and get all of the correct typing locally.
21
+
22
+ ```json tsconfig
23
+ {
24
+ "compilerOptions": {
25
+ "paths": {
26
+ "app/*": ["./src/app/*"],
27
+ "config/*": ["./src/app/_config/*"],
28
+ "environment/*": ["./src/environments/*"],
29
+ "shared/*": ["./src/app/_shared/*"],
30
+ "helpers/*": ["./src/helpers/*"],
31
+ "tests/*": ["./src/tests/*"]
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ In this case, you can tell the TypeScript file resolver to support a number of custom prefixes to find code.
38
+
39
+ Note that this feature does not change how import paths are emitted by `tsc`, so `paths` should only be used to inform TypeScript that another tool has this mapping and will use it at runtime or when bundling.
@@ -0,0 +1,17 @@
1
+ ---
2
+ display: 'Plugins'
3
+ oneline: 'Specify a list of language service plugins to include.'
4
+ ---
5
+
6
+ List of language service plugins to run inside the editor.
7
+
8
+ Language service plugins are a way to provide additional information to a user based on existing TypeScript files. They can enhance existing messages between TypeScript and an editor, or to provide their own error messages.
9
+
10
+ For example:
11
+
12
+ - [ts-sql-plugin](https://github.com/xialvjun/ts-sql-plugin#readme) — Adds SQL linting with a template strings SQL builder.
13
+ - [typescript-styled-plugin](https://github.com/Microsoft/typescript-styled-plugin) — Provides CSS linting inside template strings .
14
+ - [typescript-eslint-language-service](https://github.com/Quramy/typescript-eslint-language-service) — Provides eslint error messaging and fix-its inside the compiler's output.
15
+ - [ts-graphql-plugin](https://github.com/Quramy/ts-graphql-plugin) — Provides validation and auto-completion inside GraphQL query template strings.
16
+
17
+ VS Code has the ability for a extension to [automatically include language service plugins](https://code.visualstudio.com/api/references/contribution-points#contributes.typescriptServerPlugins), and so you may have some running in your editor without needing to define them in your `tsconfig.json`.
@@ -0,0 +1,58 @@
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.
@@ -0,0 +1,10 @@
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.
@@ -0,0 +1,18 @@
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.
@@ -0,0 +1,6 @@
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.
@@ -0,0 +1,7 @@
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.
@@ -0,0 +1,6 @@
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.
@@ -0,0 +1,9 @@
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
@@ -0,0 +1,33 @@
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.
@@ -0,0 +1,44 @@
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
+ ```
@@ -0,0 +1,8 @@
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).
@@ -0,0 +1,8 @@
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).
@@ -0,0 +1,8 @@
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).
@@ -0,0 +1,66 @@
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`).
@@ -0,0 +1,66 @@
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
+ ```
@@ -0,0 +1,6 @@
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.
@@ -0,0 +1,19 @@
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.