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.
- package/bin.js +67704 -0
- package/package.json +7 -50
- package/LICENSE +0 -21
- package/README.md +0 -3
- package/dist/bin.d.ts +0 -1
- package/dist/bin.js +0 -4
- package/dist/bin.js.map +0 -1
- package/dist/command.d.ts +0 -2
- package/dist/command.js +0 -114
- package/dist/command.js.map +0 -1
- package/dist/config.d.ts +0 -15
- package/dist/config.js +0 -52
- package/dist/config.js.map +0 -1
- package/dist/model.d.ts +0 -6
- package/dist/model.js +0 -26
- package/dist/model.js.map +0 -1
- package/docs/tsconfig/allowArbitraryExtensions.md +0 -38
- package/docs/tsconfig/allowImportingTsExtensions.md +0 -9
- package/docs/tsconfig/allowJs.md +0 -41
- package/docs/tsconfig/allowSyntheticDefaultImports.md +0 -56
- package/docs/tsconfig/allowUmdGlobalAccess.md +0 -8
- package/docs/tsconfig/allowUnreachableCode.md +0 -40
- package/docs/tsconfig/allowUnusedLabels.md +0 -23
- package/docs/tsconfig/alwaysStrict.md +0 -8
- package/docs/tsconfig/assumeChangesOnlyAffectDirectDependencies.md +0 -8
- package/docs/tsconfig/baseUrl.md +0 -26
- package/docs/tsconfig/charset.md +0 -7
- package/docs/tsconfig/checkJs.md +0 -40
- package/docs/tsconfig/clean.md +0 -6
- package/docs/tsconfig/composite.md +0 -17
- package/docs/tsconfig/customConditions.md +0 -41
- package/docs/tsconfig/declaration.md +0 -32
- package/docs/tsconfig/declarationDir.md +0 -36
- package/docs/tsconfig/declarationMap.md +0 -9
- package/docs/tsconfig/diagnostics.md +0 -8
- package/docs/tsconfig/disableFilenameBasedTypeAcquisition.md +0 -16
- package/docs/tsconfig/disableReferencedProjectLoad.md +0 -8
- package/docs/tsconfig/disableSizeLimit.md +0 -6
- package/docs/tsconfig/disableSolutionSearching.md +0 -8
- package/docs/tsconfig/disableSourceOfProjectReferenceRedirect.md +0 -7
- package/docs/tsconfig/downlevelIteration.md +0 -100
- package/docs/tsconfig/emitBOM.md +0 -8
- package/docs/tsconfig/emitDeclarationOnly.md +0 -11
- package/docs/tsconfig/emitDecoratorMetadata.md +0 -81
- package/docs/tsconfig/enable.md +0 -14
- package/docs/tsconfig/erasableSyntaxOnly.md +0 -65
- package/docs/tsconfig/esModuleInterop.md +0 -74
- package/docs/tsconfig/exactOptionalPropertyTypes.md +0 -37
- package/docs/tsconfig/exclude.md +0 -11
- package/docs/tsconfig/excludeDirectories.md +0 -14
- package/docs/tsconfig/excludeFiles.md +0 -14
- package/docs/tsconfig/experimentalDecorators.md +0 -11
- package/docs/tsconfig/explainFiles.md +0 -54
- package/docs/tsconfig/extendedDiagnostics.md +0 -9
- package/docs/tsconfig/extends.md +0 -49
- package/docs/tsconfig/fallbackPolling.md +0 -11
- package/docs/tsconfig/files.md +0 -26
- package/docs/tsconfig/force.md +0 -6
- package/docs/tsconfig/forceConsistentCasingInFileNames.md +0 -10
- package/docs/tsconfig/generateCpuProfile.md +0 -15
- package/docs/tsconfig/generateTrace.md +0 -6
- package/docs/tsconfig/importHelpers.md +0 -46
- package/docs/tsconfig/importsNotUsedAsValues.md +0 -16
- package/docs/tsconfig/include.md +0 -66
- package/docs/tsconfig/incremental.md +0 -10
- package/docs/tsconfig/inlineSourceMap.md +0 -35
- package/docs/tsconfig/inlineSources.md +0 -36
- package/docs/tsconfig/isolatedDeclarations.md +0 -8
- package/docs/tsconfig/isolatedModules.md +0 -77
- package/docs/tsconfig/jsx.md +0 -111
- package/docs/tsconfig/jsxFactory.md +0 -43
- package/docs/tsconfig/jsxFragmentFactory.md +0 -69
- package/docs/tsconfig/jsxImportSource.md +0 -95
- package/docs/tsconfig/keyofStringsOnly.md +0 -8
- package/docs/tsconfig/lib.md +0 -75
- package/docs/tsconfig/libReplacement.md +0 -22
- package/docs/tsconfig/listEmittedFiles.md +0 -42
- package/docs/tsconfig/listFiles.md +0 -40
- package/docs/tsconfig/locale.md +0 -26
- package/docs/tsconfig/mapRoot.md +0 -18
- package/docs/tsconfig/maxNodeModuleJsDepth.md +0 -11
- package/docs/tsconfig/module.md +0 -125
- package/docs/tsconfig/moduleDetection.md +0 -15
- package/docs/tsconfig/moduleResolution.md +0 -13
- package/docs/tsconfig/moduleSuffixes.md +0 -26
- package/docs/tsconfig/newLine.md +0 -6
- package/docs/tsconfig/noCheck.md +0 -6
- package/docs/tsconfig/noEmit.md +0 -10
- package/docs/tsconfig/noEmitHelpers.md +0 -38
- package/docs/tsconfig/noEmitOnError.md +0 -8
- package/docs/tsconfig/noErrorTruncation.md +0 -45
- package/docs/tsconfig/noFallthroughCasesInSwitch.md +0 -22
- package/docs/tsconfig/noImplicitAny.md +0 -26
- package/docs/tsconfig/noImplicitOverride.md +0 -66
- package/docs/tsconfig/noImplicitReturns.md +0 -17
- package/docs/tsconfig/noImplicitThis.md +0 -28
- package/docs/tsconfig/noImplicitUseStrict.md +0 -7
- package/docs/tsconfig/noLib.md +0 -9
- package/docs/tsconfig/noPropertyAccessFromIndexSignature.md +0 -57
- package/docs/tsconfig/noResolve.md +0 -9
- package/docs/tsconfig/noStrictGenericChecks.md +0 -20
- package/docs/tsconfig/noUncheckedIndexedAccess.md +0 -53
- package/docs/tsconfig/noUncheckedSideEffectImports.md +0 -52
- package/docs/tsconfig/noUnusedLocals.md +0 -15
- package/docs/tsconfig/noUnusedParameters.md +0 -15
- package/docs/tsconfig/out.md +0 -9
- package/docs/tsconfig/outDir.md +0 -39
- package/docs/tsconfig/outFile.md +0 -11
- package/docs/tsconfig/paths.md +0 -39
- package/docs/tsconfig/plugins.md +0 -17
- package/docs/tsconfig/preserveConstEnums.md +0 -58
- package/docs/tsconfig/preserveSymlinks.md +0 -10
- package/docs/tsconfig/preserveValueImports.md +0 -18
- package/docs/tsconfig/preserveWatchOutput.md +0 -6
- package/docs/tsconfig/pretty.md +0 -7
- package/docs/tsconfig/reactNamespace.md +0 -6
- package/docs/tsconfig/references.md +0 -9
- package/docs/tsconfig/removeComments.md +0 -33
- package/docs/tsconfig/resolveJsonModule.md +0 -44
- package/docs/tsconfig/resolvePackageJsonExports.md +0 -8
- package/docs/tsconfig/resolvePackageJsonImports.md +0 -8
- package/docs/tsconfig/rewriteRelativeImportExtensions.md +0 -8
- package/docs/tsconfig/rootDir.md +0 -66
- package/docs/tsconfig/rootDirs.md +0 -66
- package/docs/tsconfig/skipDefaultLibCheck.md +0 -6
- package/docs/tsconfig/skipLibCheck.md +0 -19
- package/docs/tsconfig/sourceMap.md +0 -39
- package/docs/tsconfig/sourceRoot.md +0 -18
- package/docs/tsconfig/stopBuildOnErrors.md +0 -6
- package/docs/tsconfig/strict.md +0 -11
- package/docs/tsconfig/strictBindCallApply.md +0 -34
- package/docs/tsconfig/strictBuiltinIteratorReturn.md +0 -6
- package/docs/tsconfig/strictFunctionTypes.md +0 -55
- package/docs/tsconfig/strictNullChecks.md +0 -58
- package/docs/tsconfig/strictPropertyInitialization.md +0 -29
- package/docs/tsconfig/stripInternal.md +0 -60
- package/docs/tsconfig/suppressExcessPropertyErrors.md +0 -16
- package/docs/tsconfig/suppressImplicitAnyIndexErrors.md +0 -25
- package/docs/tsconfig/synchronousWatchDirectory.md +0 -14
- package/docs/tsconfig/target.md +0 -18
- package/docs/tsconfig/traceResolution.md +0 -7
- package/docs/tsconfig/tsBuildInfoFile.md +0 -17
- package/docs/tsconfig/typeAcquisition.md +0 -37
- package/docs/tsconfig/typeRoots.md +0 -21
- package/docs/tsconfig/types.md +0 -40
- package/docs/tsconfig/useDefineForClassFields.md +0 -10
- package/docs/tsconfig/useUnknownInCatchVariables.md +0 -21
- package/docs/tsconfig/verbatimModuleSyntax.md +0 -148
- package/docs/tsconfig/verbose.md +0 -6
- package/docs/tsconfig/watchDirectory.md +0 -10
- package/docs/tsconfig/watchFile.md +0 -12
- package/prompts/hows-my-tsconfig-score.md +0 -29
- package/prompts/hows-my-tsconfig.md +0 -75
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'JSX Factory'
|
|
3
|
-
oneline: "Specify the JSX factory function used when targeting React JSX emit, e.g. 'React.createElement' or 'h'."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Changes the function called in `.js` files when compiling JSX Elements using the classic JSX runtime.
|
|
7
|
-
The most common change is to use `"h"` or `"preact.h"` instead of the default `"React.createElement"` if using `preact`.
|
|
8
|
-
|
|
9
|
-
For example, this TSX file:
|
|
10
|
-
|
|
11
|
-
```tsx
|
|
12
|
-
import { h } from 'preact';
|
|
13
|
-
|
|
14
|
-
const HelloWorld = () => <div>Hello</div>;
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
With `jsxFactory: "h"` looks like:
|
|
18
|
-
|
|
19
|
-
```tsx twoslash
|
|
20
|
-
// @showEmit
|
|
21
|
-
// @showEmittedFile: index.js
|
|
22
|
-
// @jsxFactory: h
|
|
23
|
-
// @noErrors
|
|
24
|
-
// @target: esnext
|
|
25
|
-
// @module: commonjs
|
|
26
|
-
|
|
27
|
-
import { h, Fragment } from 'preact';
|
|
28
|
-
|
|
29
|
-
const HelloWorld = () => <div>Hello</div>;
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
This option can be used on a per-file basis too similar to [Babel's `/** @jsx h */` directive](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#custom).
|
|
33
|
-
|
|
34
|
-
```tsx twoslash
|
|
35
|
-
/** @jsx h */
|
|
36
|
-
import { h } from 'preact';
|
|
37
|
-
|
|
38
|
-
const HelloWorld = () => <div>Hello</div>;
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
The factory chosen will also affect where the `JSX` namespace is looked up (for type checking information) before falling back to the global one.
|
|
42
|
-
|
|
43
|
-
If the factory is defined as `React.createElement` (the default), the compiler will check for `React.JSX` before checking for a global `JSX`. If the factory is defined as `h`, it will check for `h.JSX` before a global `JSX`.
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'JSX Fragment Factory'
|
|
3
|
-
oneline: "Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Specify the JSX fragment factory function to use when targeting react JSX emit with [`jsxFactory`](#jsxFactory) compiler option is specified, e.g. `Fragment`.
|
|
7
|
-
|
|
8
|
-
For example with this TSConfig:
|
|
9
|
-
|
|
10
|
-
```json tsconfig
|
|
11
|
-
{
|
|
12
|
-
"compilerOptions": {
|
|
13
|
-
"target": "esnext",
|
|
14
|
-
"module": "commonjs",
|
|
15
|
-
"jsx": "react",
|
|
16
|
-
"jsxFactory": "h",
|
|
17
|
-
"jsxFragmentFactory": "Fragment"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
This TSX file:
|
|
23
|
-
|
|
24
|
-
```tsx
|
|
25
|
-
import { h, Fragment } from 'preact';
|
|
26
|
-
|
|
27
|
-
const HelloWorld = () => (
|
|
28
|
-
<>
|
|
29
|
-
<div>Hello</div>
|
|
30
|
-
</>
|
|
31
|
-
);
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Would look like:
|
|
35
|
-
|
|
36
|
-
```tsx twoslash
|
|
37
|
-
// @showEmit
|
|
38
|
-
// @showEmittedFile: index.js
|
|
39
|
-
// @jsxFactory: h
|
|
40
|
-
// @jsxFragmentFactory: Fragment
|
|
41
|
-
// @noErrors
|
|
42
|
-
// @target: esnext
|
|
43
|
-
// @module: commonjs
|
|
44
|
-
|
|
45
|
-
import { h, Fragment } from 'preact';
|
|
46
|
-
|
|
47
|
-
const HelloWorld = () => (
|
|
48
|
-
<>
|
|
49
|
-
<div>Hello</div>
|
|
50
|
-
</>
|
|
51
|
-
);
|
|
52
|
-
```
|
|
53
|
-
|
|
54
|
-
This option can be used on a per-file basis too similar to [Babel's `/* @jsxFrag h */` directive](https://babeljs.io/docs/en/babel-plugin-transform-react-jsx#fragments).
|
|
55
|
-
|
|
56
|
-
For example:
|
|
57
|
-
|
|
58
|
-
```tsx twoslash
|
|
59
|
-
/** @jsx h */
|
|
60
|
-
/** @jsxFrag Fragment */
|
|
61
|
-
|
|
62
|
-
import { h, Fragment } from 'preact';
|
|
63
|
-
|
|
64
|
-
const HelloWorld = () => (
|
|
65
|
-
<>
|
|
66
|
-
<div>Hello</div>
|
|
67
|
-
</>
|
|
68
|
-
);
|
|
69
|
-
```
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'JSX Import Source'
|
|
3
|
-
oneline: 'Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Declares the module specifier to be used for importing the `jsx` and `jsxs` factory functions when using [`jsx`](#jsx) as `"react-jsx"` or `"react-jsxdev"` which were introduced in TypeScript 4.1.
|
|
7
|
-
|
|
8
|
-
With [React 17](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html) the library supports a new form of JSX transformation via a separate import.
|
|
9
|
-
|
|
10
|
-
For example with this code:
|
|
11
|
-
|
|
12
|
-
```tsx
|
|
13
|
-
import React from 'react';
|
|
14
|
-
|
|
15
|
-
function App() {
|
|
16
|
-
return <h1>Hello World</h1>;
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
Using this TSConfig:
|
|
21
|
-
|
|
22
|
-
```json tsconfig
|
|
23
|
-
{
|
|
24
|
-
"compilerOptions": {
|
|
25
|
-
"target": "esnext",
|
|
26
|
-
"module": "commonjs",
|
|
27
|
-
"jsx": "react-jsx"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
The emitted JavaScript from TypeScript is:
|
|
33
|
-
|
|
34
|
-
```tsx twoslash
|
|
35
|
-
// @showEmit
|
|
36
|
-
// @noErrors
|
|
37
|
-
// @jsx: react-jsx
|
|
38
|
-
// @module: commonjs
|
|
39
|
-
// @target: esnext
|
|
40
|
-
declare module JSX {
|
|
41
|
-
interface Element {}
|
|
42
|
-
interface IntrinsicElements {
|
|
43
|
-
[s: string]: any;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
import React from 'react';
|
|
47
|
-
|
|
48
|
-
function App() {
|
|
49
|
-
return <h1>Hello World</h1>;
|
|
50
|
-
}
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
For example if you wanted to use `"jsxImportSource": "preact"`, you need a tsconfig like:
|
|
54
|
-
|
|
55
|
-
```json tsconfig
|
|
56
|
-
{
|
|
57
|
-
"compilerOptions": {
|
|
58
|
-
"target": "esnext",
|
|
59
|
-
"module": "commonjs",
|
|
60
|
-
"jsx": "react-jsx",
|
|
61
|
-
"jsxImportSource": "preact",
|
|
62
|
-
"types": ["preact"]
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Which generates code like:
|
|
68
|
-
|
|
69
|
-
```tsx twoslash
|
|
70
|
-
// @showEmit
|
|
71
|
-
// @jsxImportSource: preact
|
|
72
|
-
// @types: preact
|
|
73
|
-
// @jsx: react-jsx
|
|
74
|
-
// @target: esnext
|
|
75
|
-
// @module: commonjs
|
|
76
|
-
// @noErrors
|
|
77
|
-
|
|
78
|
-
export function App() {
|
|
79
|
-
return <h1>Hello World</h1>;
|
|
80
|
-
}
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Alternatively, you can use a per-file pragma to set this option, for example:
|
|
84
|
-
|
|
85
|
-
```tsx
|
|
86
|
-
/** @jsxImportSource preact */
|
|
87
|
-
|
|
88
|
-
export function App() {
|
|
89
|
-
return <h1>Hello World</h1>;
|
|
90
|
-
}
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
Would add `preact/jsx-runtime` as an import for the `_jsx` factory.
|
|
94
|
-
|
|
95
|
-
_Note:_ In order for this to work like you would expect, your `tsx` file must include an `export` or `import` so that it is considered a module.
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Keyof Strings Only'
|
|
3
|
-
oneline: 'Make keyof only return strings instead of string, numbers or symbols. Legacy option.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
This flag changes the `keyof` type operator to return `string` instead of `string | number` when applied to a type with a string index signature.
|
|
7
|
-
|
|
8
|
-
This flag is used to help people keep this behavior from [before TypeScript 2.9's release](/docs/handbook/release-notes/typescript-2-9.html#support-number-and-symbol-named-properties-with-keyof-and-mapped-types).
|
package/docs/tsconfig/lib.md
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Lib'
|
|
3
|
-
oneline: 'Specify a set of bundled library declaration files that describe the target runtime environment.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
TypeScript includes a default set of type definitions for built-in JS APIs (like `Math`), as well as type definitions for things found in browser environments (like `document`).
|
|
7
|
-
TypeScript also includes APIs for newer JS features matching the [`target`](#target) you specify; for example the definition for `Map` is available if [`target`](#target) is `ES6` or newer.
|
|
8
|
-
|
|
9
|
-
You may want to change these for a few reasons:
|
|
10
|
-
|
|
11
|
-
- Your program doesn't run in a browser, so you don't want the `"dom"` type definitions
|
|
12
|
-
- Your runtime platform provides certain JavaScript API objects (maybe through polyfills), but doesn't yet support the full syntax of a given ECMAScript version
|
|
13
|
-
- You have polyfills or native implementations for some, but not all, of a higher level ECMAScript version
|
|
14
|
-
|
|
15
|
-
In TypeScript 4.5, lib files can be overridden by npm modules, find out more [in the blog](https://devblogs.microsoft.com/typescript/announcing-typescript-4-5-beta/#supporting-lib-from-node_modules).
|
|
16
|
-
|
|
17
|
-
### High Level libraries
|
|
18
|
-
|
|
19
|
-
| Name | Contents |
|
|
20
|
-
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
21
|
-
| `ES5` | Core definitions for all ES5 functionality |
|
|
22
|
-
| `ES2015` | Additional APIs available in ES2015 (also known as ES6) - `array.find`, `Promise`, `Proxy`, `Symbol`, `Map`, `Set`, `Reflect`, etc. |
|
|
23
|
-
| `ES6` | Alias for "ES2015" |
|
|
24
|
-
| `ES2016` | Additional APIs available in ES2016 - `array.include`, etc. |
|
|
25
|
-
| `ES7` | Alias for "ES2016" |
|
|
26
|
-
| `ES2017` | Additional APIs available in ES2017 - `Object.entries`, `Object.values`, `Atomics`, `SharedArrayBuffer`, `date.formatToParts`, typed arrays, etc. |
|
|
27
|
-
| `ES2018` | Additional APIs available in ES2018 - `async` iterables, `promise.finally`, `Intl.PluralRules`, `regexp.groups`, etc. |
|
|
28
|
-
| `ES2019` | Additional APIs available in ES2019 - `array.flat`, `array.flatMap`, `Object.fromEntries`, `string.trimStart`, `string.trimEnd`, etc. |
|
|
29
|
-
| `ES2020` | Additional APIs available in ES2020 - `string.matchAll`, etc. |
|
|
30
|
-
| `ES2021` | Additional APIs available in ES2021 - `promise.any`, `string.replaceAll` etc. |
|
|
31
|
-
| `ES2022` | Additional APIs available in ES2022 - `array.at`, `RegExp.hasIndices`, etc. |
|
|
32
|
-
| `ES2023` | Additional APIs available in ES2023 - `array.with`, `array.findLast`, `array.findLastIndex`, `array.toSorted`, `array.toReversed`, etc. |
|
|
33
|
-
| `ESNext` | Additional APIs available in ESNext - This changes as the JavaScript specification evolves |
|
|
34
|
-
| `DOM` | [DOM](https://developer.mozilla.org/docs/Glossary/DOM) definitions - `window`, `document`, etc. |
|
|
35
|
-
| `WebWorker` | APIs available in [WebWorker](https://developer.mozilla.org/docs/Web/API/Web_Workers_API/Using_web_workers) contexts |
|
|
36
|
-
| `ScriptHost` | APIs for the [Windows Script Hosting System](https://wikipedia.org/wiki/Windows_Script_Host) |
|
|
37
|
-
|
|
38
|
-
### Individual library components
|
|
39
|
-
|
|
40
|
-
| Name |
|
|
41
|
-
| ------------------------- |
|
|
42
|
-
| `DOM.Iterable` |
|
|
43
|
-
| `ES2015.Core` |
|
|
44
|
-
| `ES2015.Collection` |
|
|
45
|
-
| `ES2015.Generator` |
|
|
46
|
-
| `ES2015.Iterable` |
|
|
47
|
-
| `ES2015.Promise` |
|
|
48
|
-
| `ES2015.Proxy` |
|
|
49
|
-
| `ES2015.Reflect` |
|
|
50
|
-
| `ES2015.Symbol` |
|
|
51
|
-
| `ES2015.Symbol.WellKnown` |
|
|
52
|
-
| `ES2016.Array.Include` |
|
|
53
|
-
| `ES2017.object` |
|
|
54
|
-
| `ES2017.Intl` |
|
|
55
|
-
| `ES2017.SharedMemory` |
|
|
56
|
-
| `ES2017.String` |
|
|
57
|
-
| `ES2017.TypedArrays` |
|
|
58
|
-
| `ES2018.Intl` |
|
|
59
|
-
| `ES2018.Promise` |
|
|
60
|
-
| `ES2018.RegExp` |
|
|
61
|
-
| `ES2019.Array` |
|
|
62
|
-
| `ES2019.Object` |
|
|
63
|
-
| `ES2019.String` |
|
|
64
|
-
| `ES2019.Symbol` |
|
|
65
|
-
| `ES2020.String` |
|
|
66
|
-
| `ES2020.Symbol.wellknown` |
|
|
67
|
-
| `ES2021.Promise` |
|
|
68
|
-
| `ES2021.String` |
|
|
69
|
-
| `ES2021.WeakRef` |
|
|
70
|
-
| `ESNext.AsyncIterable` |
|
|
71
|
-
| `ESNext.Array` |
|
|
72
|
-
| `ESNext.Intl` |
|
|
73
|
-
| `ESNext.Symbol` |
|
|
74
|
-
|
|
75
|
-
This list may be out of date, you can see the full list in the [TypeScript source code](https://github.com/microsoft/TypeScript/tree/main/src/lib).
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Lib Replacement'
|
|
3
|
-
oneline: 'Enable substitution of default `lib` files with custom ones.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
TypeScript 4.5 introduced the possibility of substituting the default `lib` files with custom ones.
|
|
7
|
-
All built-in library files would first try to be resolved from packages named `@typescript/lib-*`.
|
|
8
|
-
For example, you could lock your `dom` libraries onto a specific version of [the `@types/web` package](https://www.npmjs.com/package/@types/web?activeTab=readme) with the following `package.json`:
|
|
9
|
-
|
|
10
|
-
```json
|
|
11
|
-
{
|
|
12
|
-
"devDependencies": {
|
|
13
|
-
"@typescript/lib-dom": "npm:@types/web@0.0.199"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
When installed, a package called `@typescript/lib-dom` should exist, and TypeScript would always look there when searching for `lib.dom.d.ts`.
|
|
19
|
-
|
|
20
|
-
The `--libReplacement` flag allows you to disable this behavior.
|
|
21
|
-
If you're not using any `@typescript/lib-*` packages, you can now disable those package lookups with `--libReplacement false`.
|
|
22
|
-
In the future, `--libReplacement false` may become the default, so if you currently rely on the behavior you should consider explicitly enabling it with `--libReplacement true`.
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'List Emitted Files'
|
|
3
|
-
oneline: 'Print the names of emitted files after a compilation.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Print names of generated files part of the compilation to the terminal.
|
|
7
|
-
|
|
8
|
-
This flag is useful in two cases:
|
|
9
|
-
|
|
10
|
-
- You want to transpile TypeScript as a part of a build chain in the terminal where the filenames are processed in the next command.
|
|
11
|
-
- You are not sure that TypeScript has included a file you expected, as a part of debugging the [file inclusion settings](#Project_Files_0).
|
|
12
|
-
|
|
13
|
-
For example:
|
|
14
|
-
|
|
15
|
-
```
|
|
16
|
-
example
|
|
17
|
-
├── index.ts
|
|
18
|
-
├── package.json
|
|
19
|
-
└── tsconfig.json
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
With:
|
|
23
|
-
|
|
24
|
-
```json tsconfig
|
|
25
|
-
{
|
|
26
|
-
"compilerOptions": {
|
|
27
|
-
"declaration": true,
|
|
28
|
-
"listEmittedFiles": true
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Would echo paths like:
|
|
34
|
-
|
|
35
|
-
```
|
|
36
|
-
$ npm run tsc
|
|
37
|
-
|
|
38
|
-
path/to/example/index.js
|
|
39
|
-
path/to/example/index.d.ts
|
|
40
|
-
```
|
|
41
|
-
|
|
42
|
-
Normally, TypeScript would return silently on success.
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'List Files'
|
|
3
|
-
oneline: 'Print all of the files read during the compilation.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Print names of files part of the compilation. This is useful when you are not sure that TypeScript has
|
|
7
|
-
included a file you expected.
|
|
8
|
-
|
|
9
|
-
For example:
|
|
10
|
-
|
|
11
|
-
```
|
|
12
|
-
example
|
|
13
|
-
├── index.ts
|
|
14
|
-
├── package.json
|
|
15
|
-
└── tsconfig.json
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
With:
|
|
19
|
-
|
|
20
|
-
```json tsconfig
|
|
21
|
-
{
|
|
22
|
-
"compilerOptions": {
|
|
23
|
-
"listFiles": true
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Would echo paths like:
|
|
29
|
-
|
|
30
|
-
```
|
|
31
|
-
$ npm run tsc
|
|
32
|
-
path/to/example/node_modules/typescript/lib/lib.d.ts
|
|
33
|
-
path/to/example/node_modules/typescript/lib/lib.es5.d.ts
|
|
34
|
-
path/to/example/node_modules/typescript/lib/lib.dom.d.ts
|
|
35
|
-
path/to/example/node_modules/typescript/lib/lib.webworker.importscripts.d.ts
|
|
36
|
-
path/to/example/node_modules/typescript/lib/lib.scripthost.d.ts
|
|
37
|
-
path/to/example/index.ts
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Note if using TypeScript 4.2, prefer [`explainFiles`](#explainFiles) which offers an explanation of why a file was added too.
|
package/docs/tsconfig/locale.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Locale'
|
|
3
|
-
oneline: 'Set the language of the messaging from TypeScript. This does not affect emit.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
TypeScript supports a number of languages, however this cannot be set via the `tsconfig.json`, only
|
|
7
|
-
via the host environment or the CLI flag `--locale`. E.g. `tsc --locale ru`.
|
|
8
|
-
|
|
9
|
-
### Locales supported as of TypeScript 3.7
|
|
10
|
-
|
|
11
|
-
| Name | Locale |
|
|
12
|
-
| --------------------- | ------- |
|
|
13
|
-
| Brazilian Portuguese | `pr-BR` |
|
|
14
|
-
| Chinese (Simplified) | `zh-TW` |
|
|
15
|
-
| Chinese (Traditional) | `zh-CN` |
|
|
16
|
-
| Czech | `cs-CZ` |
|
|
17
|
-
| English (US) | `en-US` |
|
|
18
|
-
| French | `fr-FR` |
|
|
19
|
-
| German | `de-DE` |
|
|
20
|
-
| Italian | `it-IT` |
|
|
21
|
-
| Japanese | `ja-JP` |
|
|
22
|
-
| Korean | `ko-KR` |
|
|
23
|
-
| Polish | `pl-PL` |
|
|
24
|
-
| Russian | `ru-RU` |
|
|
25
|
-
| Spanish | `es-ES` |
|
|
26
|
-
| Turkish | `tr-TR` |
|
package/docs/tsconfig/mapRoot.md
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Map Root'
|
|
3
|
-
oneline: 'Specify the location where debugger should locate map files instead of generated locations.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Specify the location where debugger should locate map files instead of generated locations.
|
|
7
|
-
This string is treated verbatim inside the source-map, for example:
|
|
8
|
-
|
|
9
|
-
```json tsconfig
|
|
10
|
-
{
|
|
11
|
-
"compilerOptions": {
|
|
12
|
-
"sourceMap": true,
|
|
13
|
-
"mapRoot": "https://my-website.com/debug/sourcemaps/"
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
Would declare that `index.js` will have sourcemaps at `https://my-website.com/debug/sourcemaps/index.js.map`.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Max Node Module JS Depth'
|
|
3
|
-
oneline: 'Specify the maximum folder depth used for checking JavaScript files from `node_modules`. Only applicable with [`allowJs`](#allowJs).'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
The maximum dependency depth to search under `node_modules` and load JavaScript files.
|
|
7
|
-
|
|
8
|
-
This flag can only be used when [`allowJs`](#allowJs) is enabled, and is used if you want to have TypeScript infer types for all of the JavaScript inside your `node_modules`.
|
|
9
|
-
|
|
10
|
-
Ideally this should stay at 0 (the default), and `d.ts` files should be used to explicitly define the shape of modules.
|
|
11
|
-
However, there are cases where you may want to turn this on at the expense of speed and potential accuracy.
|
package/docs/tsconfig/module.md
DELETED
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Module'
|
|
3
|
-
oneline: 'Specify what module code is generated.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Sets the module system for the program. See the [theory behind TypeScript’s `module` option](/docs/handbook/modules/theory.html#the-module-output-format) and [its reference page](/docs/handbook/modules/reference.html#the-module-compiler-option) for more information. You very likely want `"nodenext"` for modern Node.js projects and `preserve` or `esnext` for code that will be bundled.
|
|
7
|
-
|
|
8
|
-
Changing `module` affects [`moduleResolution`](#moduleResolution) which [also has a reference page](/docs/handbook/modules/reference.html#the-moduleresolution-compiler-option).
|
|
9
|
-
|
|
10
|
-
Here's some example output for this file:
|
|
11
|
-
|
|
12
|
-
```ts twoslash
|
|
13
|
-
// @filename: constants.ts
|
|
14
|
-
export const valueOfPi = 3.142;
|
|
15
|
-
// ---cut---
|
|
16
|
-
// @filename: index.ts
|
|
17
|
-
import { valueOfPi } from './constants';
|
|
18
|
-
|
|
19
|
-
export const twoPi = valueOfPi * 2;
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
#### `CommonJS`
|
|
23
|
-
|
|
24
|
-
```ts twoslash
|
|
25
|
-
// @showEmit
|
|
26
|
-
// @module: commonjs
|
|
27
|
-
// @noErrors
|
|
28
|
-
import { valueOfPi } from './constants';
|
|
29
|
-
|
|
30
|
-
export const twoPi = valueOfPi * 2;
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
#### `UMD`
|
|
34
|
-
|
|
35
|
-
```ts twoslash
|
|
36
|
-
// @showEmit
|
|
37
|
-
// @module: umd
|
|
38
|
-
// @noErrors
|
|
39
|
-
import { valueOfPi } from './constants';
|
|
40
|
-
|
|
41
|
-
export const twoPi = valueOfPi * 2;
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
#### `AMD`
|
|
45
|
-
|
|
46
|
-
```ts twoslash
|
|
47
|
-
// @showEmit
|
|
48
|
-
// @module: amd
|
|
49
|
-
// @noErrors
|
|
50
|
-
import { valueOfPi } from './constants';
|
|
51
|
-
|
|
52
|
-
export const twoPi = valueOfPi * 2;
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
#### `System`
|
|
56
|
-
|
|
57
|
-
```ts twoslash
|
|
58
|
-
// @showEmit
|
|
59
|
-
// @module: system
|
|
60
|
-
// @noErrors
|
|
61
|
-
import { valueOfPi } from './constants';
|
|
62
|
-
|
|
63
|
-
export const twoPi = valueOfPi * 2;
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
#### `ESNext`
|
|
67
|
-
|
|
68
|
-
```ts twoslash
|
|
69
|
-
// @showEmit
|
|
70
|
-
// @module: esnext
|
|
71
|
-
// @noErrors
|
|
72
|
-
import { valueOfPi } from './constants';
|
|
73
|
-
|
|
74
|
-
export const twoPi = valueOfPi * 2;
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
#### `ES2015`/`ES6`/`ES2020`/`ES2022`
|
|
78
|
-
|
|
79
|
-
```ts twoslash
|
|
80
|
-
// @showEmit
|
|
81
|
-
// @module: es2015
|
|
82
|
-
// @noErrors
|
|
83
|
-
import { valueOfPi } from './constants';
|
|
84
|
-
|
|
85
|
-
export const twoPi = valueOfPi * 2;
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
In addition to the base functionality of `ES2015`/`ES6`, `ES2020` adds support for [dynamic `import`s](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import), and [`import.meta`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/import.meta) while `ES2022` further adds support for [top level `await`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/await#top_level_await).
|
|
89
|
-
|
|
90
|
-
#### `node16`/`node18`/`nodenext`
|
|
91
|
-
|
|
92
|
-
The `node16`, `node18`, and `nodenext` modes integrate with Node's [native ECMAScript Module support](https://nodejs.org/api/esm.html). The emitted JavaScript uses either `CommonJS` or `ES2020` output depending on the file extension and the value of the `type` setting in the nearest `package.json`. Module resolution also works differently. You can learn more in the [handbook](/docs/handbook/esm-node.html) and [Modules Reference](/docs/handbook/modules/reference.html#node16-node18-nodenext).
|
|
93
|
-
|
|
94
|
-
- `node16` is available from TypeScript 4.7
|
|
95
|
-
- `node18` is available from TypeScript 5.8 as a replacement for `node16`, with added support for import attributes.
|
|
96
|
-
- `nodenext` is available from TypeScript 4.7, but its behavior changes with the latest stable versions of Node.js. As of TypeScript 5.8, `nodenext` supports `require` of ECMAScript modules.
|
|
97
|
-
|
|
98
|
-
#### `preserve`
|
|
99
|
-
|
|
100
|
-
In `--module preserve` ([added](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-4.html#support-for-require-calls-in---moduleresolution-bundler-and---module-preserve) in TypeScript 5.4), ECMAScript imports and exports written in input files are preserved in the output, and CommonJS-style `import x = require("...")` and `export = ...` statements are emitted as CommonJS `require` and `module.exports`. In other words, the format of each individual import or export statement is preserved, rather than being coerced into a single format for the whole compilation (or even a whole file).
|
|
101
|
-
|
|
102
|
-
```ts twoslash
|
|
103
|
-
// @showEmit
|
|
104
|
-
// @module: preserve
|
|
105
|
-
// @noErrors
|
|
106
|
-
import { valueOfPi } from './constants';
|
|
107
|
-
import constants = require('./constants');
|
|
108
|
-
|
|
109
|
-
export const piSquared = valueOfPi * constants.valueOfPi;
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
While it’s rare to need to mix imports and require calls in the same file, this `module` mode best reflects the capabilities of most modern bundlers, as well as the Bun runtime.
|
|
113
|
-
|
|
114
|
-
> Why care about TypeScript’s `module` emit with a bundler or with Bun, where you’re likely also setting `noEmit`? TypeScript’s type checking and module resolution behavior are affected by the module format that it _would_ emit. Setting `module` gives TypeScript information about how your bundler or runtime will process imports and exports, which ensures that the types you see on imported values accurately reflect what will happen at runtime or after bundling.
|
|
115
|
-
|
|
116
|
-
#### `None`
|
|
117
|
-
|
|
118
|
-
```ts twoslash
|
|
119
|
-
// @showEmit
|
|
120
|
-
// @module: none
|
|
121
|
-
// @noErrors
|
|
122
|
-
import { valueOfPi } from './constants';
|
|
123
|
-
|
|
124
|
-
export const twoPi = valueOfPi * 2;
|
|
125
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Module Detection'
|
|
3
|
-
oneline: 'Specify what method is used to detect whether a file is a script or a module.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
This setting controls how TypeScript determines whether a file is a
|
|
7
|
-
[script or a module](/docs/handbook/modules/theory.html#scripts-and-modules-in-javascript).
|
|
8
|
-
|
|
9
|
-
There are three choices:
|
|
10
|
-
|
|
11
|
-
- `"auto"` (default) - TypeScript will not only look for import and export statements, but it will also check whether the `"type"` field in a `package.json` is set to `"module"` when running with [`module`](#module): `nodenext` or `node16`, and check whether the current file is a JSX file when running under [`jsx`](#jsx): `react-jsx`.
|
|
12
|
-
|
|
13
|
-
- `"legacy"` - The same behavior as 4.6 and prior, usings import and export statements to determine whether a file is a module.
|
|
14
|
-
|
|
15
|
-
- `"force"` - Ensures that every non-declaration file is treated as a module.
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Module Resolution'
|
|
3
|
-
oneline: 'Specify how TypeScript looks up a file from a given module specifier.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Specify the module resolution strategy:
|
|
7
|
-
|
|
8
|
-
- `'node16'` or `'nodenext'` for modern versions of Node.js. Node.js v12 and later supports both ECMAScript imports and CommonJS `require`, which resolve using different algorithms. These `moduleResolution` values, when combined with the corresponding [`module`](#module) values, picks the right algorithm for each resolution based on whether Node.js will see an `import` or `require` in the output JavaScript code.
|
|
9
|
-
- `'node10'` (previously called `'node'`) for Node.js versions older than v10, which only support CommonJS `require`. You probably won't need to use `node10` in modern code.
|
|
10
|
-
- `'bundler'` for use with bundlers. Like `node16` and `nodenext`, this mode supports package.json `"imports"` and `"exports"`, but unlike the Node.js resolution modes, `bundler` never requires file extensions on relative paths in imports.
|
|
11
|
-
- `'classic'` was used in TypeScript before the release of 1.6. `classic` should not be used.
|
|
12
|
-
|
|
13
|
-
There are reference pages explaining the [theory behind TypeScript’s module resolution](https://www.typescriptlang.org/docs/handbook/modules/theory.html#module-resolution) and the [details of each option](/docs/handbook/modules/reference.html#the-moduleresolution-compiler-option).
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Module Suffixes'
|
|
3
|
-
oneline: 'List of file name suffixes to search when resolving a module.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Provides a way to override the default list of file name suffixes to search when resolving a module.
|
|
7
|
-
|
|
8
|
-
```json tsconfig
|
|
9
|
-
{
|
|
10
|
-
"compilerOptions": {
|
|
11
|
-
"moduleSuffixes": [".ios", ".native", ""]
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
Given the above configuration, an import like the following:
|
|
17
|
-
|
|
18
|
-
```ts
|
|
19
|
-
import * as foo from './foo';
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
TypeScript will look for the relative files `./foo.ios.ts`, `./foo.native.ts`, and finally `./foo.ts`.
|
|
23
|
-
|
|
24
|
-
Note the empty string `""` in [`moduleSuffixes`](#moduleSuffixes) which is necessary for TypeScript to also look-up `./foo.ts`.
|
|
25
|
-
|
|
26
|
-
This feature can be useful for React Native projects where each target platform can use a separate tsconfig.json with differing `moduleSuffixes`.
|
package/docs/tsconfig/newLine.md
DELETED
package/docs/tsconfig/noCheck.md
DELETED
package/docs/tsconfig/noEmit.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Emit'
|
|
3
|
-
oneline: 'Disable emitting files from a compilation.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Do not emit compiler output files like JavaScript source code, source-maps or declarations.
|
|
7
|
-
|
|
8
|
-
This makes room for another tool like [Babel](https://babeljs.io), or [swc](https://github.com/swc-project/swc) to handle converting the TypeScript file to a file which can run inside a JavaScript environment.
|
|
9
|
-
|
|
10
|
-
You can then use TypeScript as a tool for providing editor integration, and as a source code type-checker.
|