ai-hero-cli 0.0.5 → 0.0.7
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/README.md +133 -2
- package/bin.js +67704 -0
- package/package.json +7 -50
- package/LICENSE +0 -21
- package/dist/bin.d.ts +0 -2
- 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,54 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Explain Files'
|
|
3
|
-
oneline: 'Print files read during the compilation including why it was included.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Print names of files which TypeScript sees as a part of your project and the reason they are part of the compilation.
|
|
7
|
-
|
|
8
|
-
For example, with this project of just a single `index.ts` file
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
example
|
|
12
|
-
├── index.ts
|
|
13
|
-
├── package.json
|
|
14
|
-
└── tsconfig.json
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Using a `tsconfig.json` which has `explainFiles` set to true:
|
|
18
|
-
|
|
19
|
-
```json
|
|
20
|
-
{
|
|
21
|
-
"compilerOptions": {
|
|
22
|
-
"target": "es5",
|
|
23
|
-
"module": "commonjs",
|
|
24
|
-
"explainFiles": true
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Running TypeScript against this folder would have output like this:
|
|
30
|
-
|
|
31
|
-
```
|
|
32
|
-
❯ tsc
|
|
33
|
-
node_modules/typescript/lib/lib.d.ts
|
|
34
|
-
Default library for target 'es5'
|
|
35
|
-
node_modules/typescript/lib/lib.es5.d.ts
|
|
36
|
-
Library referenced via 'es5' from file 'node_modules/typescript/lib/lib.d.ts'
|
|
37
|
-
node_modules/typescript/lib/lib.dom.d.ts
|
|
38
|
-
Library referenced via 'dom' from file 'node_modules/typescript/lib/lib.d.ts'
|
|
39
|
-
node_modules/typescript/lib/lib.webworker.importscripts.d.ts
|
|
40
|
-
Library referenced via 'webworker.importscripts' from
|
|
41
|
-
file 'node_modules/typescript/lib/lib.d.ts'
|
|
42
|
-
node_modules/typescript/lib/lib.scripthost.d.ts
|
|
43
|
-
Library referenced via 'scripthost'
|
|
44
|
-
from file 'node_modules/typescript/lib/lib.d.ts'
|
|
45
|
-
index.ts
|
|
46
|
-
Matched by include pattern '**/*' in 'tsconfig.json'
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
The output above show:
|
|
50
|
-
|
|
51
|
-
- The initial lib.d.ts lookup based on [`target`](#target), and the chain of `.d.ts` files which are referenced
|
|
52
|
-
- The `index.ts` file located via the default pattern of [`include`](#include)
|
|
53
|
-
|
|
54
|
-
This option is intended for debugging how a file has become a part of your compile.
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Extended Diagnostics'
|
|
3
|
-
oneline: 'Output more detailed compiler performance information after building.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You can use this flag to discover where TypeScript is spending its time when compiling.
|
|
7
|
-
This is a tool used for understanding the performance characteristics of your codebase overall.
|
|
8
|
-
|
|
9
|
-
You can learn more about how to measure and understand the output in the performance [section of the wiki](https://github.com/microsoft/TypeScript/wiki/Performance).
|
package/docs/tsconfig/extends.md
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Extends'
|
|
3
|
-
oneline: 'Specify one or more path or node module references to base configuration files from which settings are inherited.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
The value of `extends` is a string which contains a path to another configuration file to inherit from.
|
|
7
|
-
The path may use Node.js style resolution.
|
|
8
|
-
|
|
9
|
-
The configuration from the base file are loaded first, then overridden by those in the inheriting config file. All relative paths found in the configuration file will be resolved relative to the configuration file they originated in.
|
|
10
|
-
|
|
11
|
-
It's worth noting that [`files`](#files), [`include`](#include), and [`exclude`](#exclude) from the inheriting config file _overwrite_ those from the
|
|
12
|
-
base config file, and that circularity between configuration files is not allowed.
|
|
13
|
-
|
|
14
|
-
Currently, the only top-level property that is excluded from inheritance is [`references`](#references).
|
|
15
|
-
|
|
16
|
-
##### Example
|
|
17
|
-
|
|
18
|
-
`configs/base.json`:
|
|
19
|
-
|
|
20
|
-
```json tsconfig
|
|
21
|
-
{
|
|
22
|
-
"compilerOptions": {
|
|
23
|
-
"noImplicitAny": true,
|
|
24
|
-
"strictNullChecks": true
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
`tsconfig.json`:
|
|
30
|
-
|
|
31
|
-
```json tsconfig
|
|
32
|
-
{
|
|
33
|
-
"extends": "./configs/base",
|
|
34
|
-
"files": ["main.ts", "supplemental.ts"]
|
|
35
|
-
}
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
`tsconfig.nostrictnull.json`:
|
|
39
|
-
|
|
40
|
-
```json tsconfig
|
|
41
|
-
{
|
|
42
|
-
"extends": "./tsconfig",
|
|
43
|
-
"compilerOptions": {
|
|
44
|
-
"strictNullChecks": false
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
Properties with relative paths found in the configuration file, which aren't excluded from inheritance, will be resolved relative to the configuration file they originated in.
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Fallback Polling'
|
|
3
|
-
oneline: 'Specify what approach the watcher should use if the system runs out of native file watchers.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
When using file system events, this option specifies the polling strategy that gets used when the system runs out of native file watchers and/or doesn't support native file watchers.
|
|
7
|
-
|
|
8
|
-
- `fixedPollingInterval`: Check every file for changes several times a second at a fixed interval.
|
|
9
|
-
- `priorityPollingInterval`: Check every file for changes several times a second, but use heuristics to check certain types of files less frequently than others.
|
|
10
|
-
- `dynamicPriorityPolling`: Use a dynamic queue where less-frequently modified files will be checked less often.
|
|
11
|
-
- `synchronousWatchDirectory`: Disable deferred watching on directories. Deferred watching is useful when lots of file changes might occur at once (e.g. a change in `node_modules` from running `npm install`), but you might want to disable it with this flag for some less-common setups.
|
package/docs/tsconfig/files.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Files'
|
|
3
|
-
oneline: 'Include a list of files. This does not support glob patterns, as opposed to [`include`](#include).'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Specifies an allowlist of files to include in the program. An error occurs if any of the files can't be found.
|
|
7
|
-
|
|
8
|
-
```json tsconfig
|
|
9
|
-
{
|
|
10
|
-
"compilerOptions": {},
|
|
11
|
-
"files": [
|
|
12
|
-
"core.ts",
|
|
13
|
-
"sys.ts",
|
|
14
|
-
"types.ts",
|
|
15
|
-
"scanner.ts",
|
|
16
|
-
"parser.ts",
|
|
17
|
-
"utilities.ts",
|
|
18
|
-
"binder.ts",
|
|
19
|
-
"checker.ts",
|
|
20
|
-
"tsc.ts"
|
|
21
|
-
]
|
|
22
|
-
}
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
This is useful when you only have a small number of files and don't need to use a glob to reference many files.
|
|
26
|
-
If you need that then use [`include`](#include).
|
package/docs/tsconfig/force.md
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Force Consistent Casing In File Names'
|
|
3
|
-
oneline: 'Ensure that casing is correct in imports.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
TypeScript follows the case sensitivity rules of the file system it's running on.
|
|
7
|
-
This can be problematic if some developers are working in a case-sensitive file system and others aren't.
|
|
8
|
-
If a file attempts to import `fileManager.ts` by specifying `./FileManager.ts` the file will be found in a case-insensitive file system, but not on a case-sensitive file system.
|
|
9
|
-
|
|
10
|
-
When this option is set, TypeScript will issue an error if a program tries to include a file by a casing different from the casing on disk.
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Generate CPU Profile'
|
|
3
|
-
oneline: 'Emit a v8 CPU profile of the compiler run for debugging.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
This option gives you the chance to have TypeScript emit a v8 CPU profile during the compiler run. The CPU profile can provide insight into why your builds may be slow.
|
|
7
|
-
|
|
8
|
-
This option can only be used from the CLI via: `--generateCpuProfile tsc-output.cpuprofile`.
|
|
9
|
-
|
|
10
|
-
```sh
|
|
11
|
-
npm run tsc --generateCpuProfile tsc-output.cpuprofile
|
|
12
|
-
```
|
|
13
|
-
|
|
14
|
-
This file can be opened in a chromium based browser like Chrome or Edge Developer in [the CPU profiler](https://developers.google.com/web/tools/chrome-devtools/rendering-tools/js-execution) section.
|
|
15
|
-
You can learn more about understanding the compilers performance in the [TypeScript wiki section on performance](https://github.com/microsoft/TypeScript/wiki/Performance).
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Import Helpers'
|
|
3
|
-
oneline: 'Allow importing helper functions from tslib once per project, instead of including them per-file.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
For certain downleveling operations, TypeScript uses some helper code for operations like extending class, spreading arrays or objects, and async operations.
|
|
7
|
-
By default, these helpers are inserted into files which use them.
|
|
8
|
-
This can result in code duplication if the same helper is used in many different modules.
|
|
9
|
-
|
|
10
|
-
If the `importHelpers` flag is on, these helper functions are instead imported from the [tslib](https://www.npmjs.com/package/tslib) module.
|
|
11
|
-
You will need to ensure that the `tslib` module is able to be imported at runtime.
|
|
12
|
-
This only affects modules; global script files will not attempt to import modules.
|
|
13
|
-
|
|
14
|
-
For example, with this TypeScript:
|
|
15
|
-
|
|
16
|
-
```ts
|
|
17
|
-
export function fn(arr: number[]) {
|
|
18
|
-
const arr2 = [1, ...arr];
|
|
19
|
-
}
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Turning on [`downlevelIteration`](#downlevelIteration) and `importHelpers` is still false:
|
|
23
|
-
|
|
24
|
-
```ts twoslash
|
|
25
|
-
// @showEmit
|
|
26
|
-
// @target: ES5
|
|
27
|
-
// @downleveliteration
|
|
28
|
-
export function fn(arr: number[]) {
|
|
29
|
-
const arr2 = [1, ...arr];
|
|
30
|
-
}
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
Then turning on both [`downlevelIteration`](#downlevelIteration) and `importHelpers`:
|
|
34
|
-
|
|
35
|
-
```ts twoslash
|
|
36
|
-
// @showEmit
|
|
37
|
-
// @target: ES5
|
|
38
|
-
// @downleveliteration
|
|
39
|
-
// @importhelpers
|
|
40
|
-
// @noErrors
|
|
41
|
-
export function fn(arr: number[]) {
|
|
42
|
-
const arr2 = [1, ...arr];
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
You can use [`noEmitHelpers`](#noEmitHelpers) when you provide your own implementations of these functions.
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Imports Not Used As Values'
|
|
3
|
-
oneline: 'Specify emit/checking behavior for imports that are only used for types.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Deprecated in favor of [`verbatimModuleSyntax`](#verbatimModuleSyntax).
|
|
7
|
-
|
|
8
|
-
This flag controls how `import` works, there are 3 different options:
|
|
9
|
-
|
|
10
|
-
- `remove`: The default behavior of dropping `import` statements which only reference types.
|
|
11
|
-
|
|
12
|
-
- `preserve`: Preserves all `import` statements whose values or types are never used. This can cause imports/side-effects to be preserved.
|
|
13
|
-
|
|
14
|
-
- `error`: This preserves all imports (the same as the preserve option), but will error when a value import is only used as a type. This might be useful if you want to ensure no values are being accidentally imported, but still make side-effect imports explicit.
|
|
15
|
-
|
|
16
|
-
This flag works because you can use `import type` to explicitly create an `import` statement which should never be emitted into JavaScript.
|
package/docs/tsconfig/include.md
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Include'
|
|
3
|
-
oneline: 'Specify a list of glob patterns that match files to be included in compilation.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Specifies an array of filenames or patterns to include in the program.
|
|
7
|
-
These filenames are resolved relative to the directory containing the `tsconfig.json` file.
|
|
8
|
-
|
|
9
|
-
```json
|
|
10
|
-
{
|
|
11
|
-
"include": ["src/**/*", "tests/**/*"]
|
|
12
|
-
}
|
|
13
|
-
```
|
|
14
|
-
|
|
15
|
-
Which would include:
|
|
16
|
-
|
|
17
|
-
<!-- TODO: #135
|
|
18
|
-
```diff
|
|
19
|
-
.
|
|
20
|
-
- ├── scripts
|
|
21
|
-
- │ ├── lint.ts
|
|
22
|
-
- │ ├── update_deps.ts
|
|
23
|
-
- │ └── utils.ts
|
|
24
|
-
+ ├── src
|
|
25
|
-
+ │ ├── client
|
|
26
|
-
+ │ │ ├── index.ts
|
|
27
|
-
+ │ │ └── utils.ts
|
|
28
|
-
+ │ ├── server
|
|
29
|
-
+ │ │ └── index.ts
|
|
30
|
-
+ ├── tests
|
|
31
|
-
+ │ ├── app.test.ts
|
|
32
|
-
+ │ ├── utils.ts
|
|
33
|
-
+ │ └── tests.d.ts
|
|
34
|
-
- ├── package.json
|
|
35
|
-
- ├── tsconfig.json
|
|
36
|
-
- └── yarn.lock
|
|
37
|
-
``` -->
|
|
38
|
-
|
|
39
|
-
```
|
|
40
|
-
.
|
|
41
|
-
├── scripts ⨯
|
|
42
|
-
│ ├── lint.ts ⨯
|
|
43
|
-
│ ├── update_deps.ts ⨯
|
|
44
|
-
│ └── utils.ts ⨯
|
|
45
|
-
├── src ✓
|
|
46
|
-
│ ├── client ✓
|
|
47
|
-
│ │ ├── index.ts ✓
|
|
48
|
-
│ │ └── utils.ts ✓
|
|
49
|
-
│ ├── server ✓
|
|
50
|
-
│ │ └── index.ts ✓
|
|
51
|
-
├── tests ✓
|
|
52
|
-
│ ├── app.test.ts ✓
|
|
53
|
-
│ ├── utils.ts ✓
|
|
54
|
-
│ └── tests.d.ts ✓
|
|
55
|
-
├── package.json
|
|
56
|
-
├── tsconfig.json
|
|
57
|
-
└── yarn.lock
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
`include` and `exclude` support wildcard characters to make glob patterns:
|
|
61
|
-
|
|
62
|
-
- `*` matches zero or more characters (excluding directory separators)
|
|
63
|
-
- `?` matches any one character (excluding directory separators)
|
|
64
|
-
- `**/` matches any directory nested to any level
|
|
65
|
-
|
|
66
|
-
If the last path segment in a pattern does not contain a file extension or wildcard character, then it is treated as a directory, and files with supported extensions inside that directory are included (e.g. `.ts`, `.tsx`, and `.d.ts` by default, with `.js` and `.jsx` if [`allowJs`](#allowJs) is set to true).
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Incremental'
|
|
3
|
-
oneline: 'Save .tsbuildinfo files to allow for incremental compilation of projects.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Tells TypeScript to save information about the project graph from the last compilation to files stored on disk. This
|
|
7
|
-
creates a series of `.tsbuildinfo` files in the same folder as your compilation output. They are not used by your
|
|
8
|
-
JavaScript at runtime and can be safely deleted. You can read more about the flag in the [3.4 release notes](/docs/handbook/release-notes/typescript-3-4.html#faster-subsequent-builds-with-the---incremental-flag).
|
|
9
|
-
|
|
10
|
-
To control which folders you want to the files to be built to, use the config option [`tsBuildInfoFile`](#tsBuildInfoFile).
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Inline Source Map'
|
|
3
|
-
oneline: 'Include sourcemap files inside the emitted JavaScript.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
When set, instead of writing out a `.js.map` file to provide source maps, TypeScript will embed the source map content in the `.js` files.
|
|
7
|
-
Although this results in larger JS files, it can be convenient in some scenarios.
|
|
8
|
-
For example, you might want to debug JS files on a webserver that doesn't allow `.map` files to be served.
|
|
9
|
-
|
|
10
|
-
Mutually exclusive with [`sourceMap`](#sourceMap).
|
|
11
|
-
|
|
12
|
-
For example, with this TypeScript:
|
|
13
|
-
|
|
14
|
-
```ts
|
|
15
|
-
const helloWorld = 'hi';
|
|
16
|
-
console.log(helloWorld);
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Converts to this JavaScript:
|
|
20
|
-
|
|
21
|
-
```ts twoslash
|
|
22
|
-
// @showEmit
|
|
23
|
-
const helloWorld = 'hi';
|
|
24
|
-
console.log(helloWorld);
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
Then enable building it with `inlineSourceMap` enabled there is a comment at the bottom of the file which includes
|
|
28
|
-
a source-map for the file.
|
|
29
|
-
|
|
30
|
-
```ts twoslash
|
|
31
|
-
// @inlineSourceMap
|
|
32
|
-
// @showEmit
|
|
33
|
-
const helloWorld = 'hi';
|
|
34
|
-
console.log(helloWorld);
|
|
35
|
-
```
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Inline Sources'
|
|
3
|
-
oneline: 'Include source code in the sourcemaps inside the emitted JavaScript.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
When set, TypeScript will include the original content of the `.ts` file as an embedded string in the source map (using the source map's `sourcesContent` property).
|
|
7
|
-
This is often useful in the same cases as [`inlineSourceMap`](#inlineSourceMap).
|
|
8
|
-
|
|
9
|
-
Requires either [`sourceMap`](#sourceMap) or [`inlineSourceMap`](#inlineSourceMap) to be set.
|
|
10
|
-
|
|
11
|
-
For example, with this TypeScript:
|
|
12
|
-
|
|
13
|
-
```ts twoslash
|
|
14
|
-
const helloWorld = 'hi';
|
|
15
|
-
console.log(helloWorld);
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
By default converts to this JavaScript:
|
|
19
|
-
|
|
20
|
-
```ts twoslash
|
|
21
|
-
// @showEmit
|
|
22
|
-
const helloWorld = 'hi';
|
|
23
|
-
console.log(helloWorld);
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Then enable building it with `inlineSources` and [`inlineSourceMap`](#inlineSourceMap) enabled there is a comment at the bottom of the file which includes
|
|
27
|
-
a source-map for the file.
|
|
28
|
-
Note that the end is different from the example in [`inlineSourceMap`](#inlineSourceMap) because the source-map now contains the original source code also.
|
|
29
|
-
|
|
30
|
-
```ts twoslash
|
|
31
|
-
// @inlineSources
|
|
32
|
-
// @inlineSourceMap
|
|
33
|
-
// @showEmit
|
|
34
|
-
const helloWorld = 'hi';
|
|
35
|
-
console.log(helloWorld);
|
|
36
|
-
```
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'isolatedDeclarations'
|
|
3
|
-
oneline: 'Require sufficient annotation on exports so other tools can trivially generate declaration files.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Require sufficient annotation on exports so other tools can trivially generate declaration files.
|
|
7
|
-
|
|
8
|
-
For more information, see the [5.5 release notes](/docs/handbook/release-notes/typescript-5-5.html#isolated-declarations)
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Isolated Modules'
|
|
3
|
-
oneline: 'Ensure that each file can be safely transpiled without relying on other imports.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
While you can use TypeScript to produce JavaScript code from TypeScript code, it's also common to use other transpilers such as [Babel](https://babeljs.io) to do this.
|
|
7
|
-
However, other transpilers only operate on a single file at a time, which means they can't apply code transforms that depend on understanding the full type system.
|
|
8
|
-
This restriction also applies to TypeScript's `ts.transpileModule` API which is used by some build tools.
|
|
9
|
-
|
|
10
|
-
These limitations can cause runtime problems with some TypeScript features like `const enum`s and `namespace`s.
|
|
11
|
-
Setting the `isolatedModules` flag tells TypeScript to warn you if you write certain code that can't be correctly interpreted by a single-file transpilation process.
|
|
12
|
-
|
|
13
|
-
It does not change the behavior of your code, or otherwise change the behavior of TypeScript's checking and emitting process.
|
|
14
|
-
|
|
15
|
-
Some examples of code which does not work when `isolatedModules` is enabled.
|
|
16
|
-
|
|
17
|
-
#### Exports of Non-Value Identifiers
|
|
18
|
-
|
|
19
|
-
In TypeScript, you can import a _type_ and then subsequently export it:
|
|
20
|
-
|
|
21
|
-
```ts twoslash
|
|
22
|
-
// @noErrors
|
|
23
|
-
import { someType, someFunction } from 'someModule';
|
|
24
|
-
|
|
25
|
-
someFunction();
|
|
26
|
-
|
|
27
|
-
export { someType, someFunction };
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
Because there's no value for `someType`, the emitted `export` will not try to export it (this would be a runtime error in JavaScript):
|
|
31
|
-
|
|
32
|
-
```js
|
|
33
|
-
export { someFunction };
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Single-file transpilers don't know whether `someType` produces a value or not, so it's an error to export a name that only refers to a type.
|
|
37
|
-
|
|
38
|
-
#### Non-Module Files
|
|
39
|
-
|
|
40
|
-
If `isolatedModules` is set, namespaces are only allowed in _modules_ (which means it has some form of `import`/`export`). An error occurs if a namespace is found in a non-module file:
|
|
41
|
-
|
|
42
|
-
```ts twoslash
|
|
43
|
-
// @errors: 1277
|
|
44
|
-
// @isolatedModules
|
|
45
|
-
namespace Instantiated {
|
|
46
|
-
export const x = 1;
|
|
47
|
-
}
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
This restriction doesn't apply to `.d.ts` files.
|
|
51
|
-
|
|
52
|
-
#### References to `const enum` members
|
|
53
|
-
|
|
54
|
-
In TypeScript, when you reference a `const enum` member, the reference is replaced by its actual value in the emitted JavaScript. Changing this TypeScript:
|
|
55
|
-
|
|
56
|
-
```ts twoslash
|
|
57
|
-
declare const enum Numbers {
|
|
58
|
-
Zero = 0,
|
|
59
|
-
One = 1,
|
|
60
|
-
}
|
|
61
|
-
console.log(Numbers.Zero + Numbers.One);
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
To this JavaScript:
|
|
65
|
-
|
|
66
|
-
```ts twoslash
|
|
67
|
-
// @showEmit
|
|
68
|
-
// @removeComments
|
|
69
|
-
declare const enum Numbers {
|
|
70
|
-
Zero = 0,
|
|
71
|
-
One = 1,
|
|
72
|
-
}
|
|
73
|
-
console.log(Numbers.Zero + Numbers.One);
|
|
74
|
-
```
|
|
75
|
-
|
|
76
|
-
Without knowledge of the values of these members, other transpilers can't replace the references to `Numbers`, which would be a runtime error if left alone (since there are no `Numbers` object at runtime).
|
|
77
|
-
Because of this, when `isolatedModules` is set, it is an error to reference an ambient `const enum` member.
|
package/docs/tsconfig/jsx.md
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'JSX'
|
|
3
|
-
oneline: 'Specify what JSX code is generated.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Controls how JSX constructs are emitted in JavaScript files.
|
|
7
|
-
This only affects output of JS files that started in `.tsx` files.
|
|
8
|
-
|
|
9
|
-
- `react-jsx`: Emit `.js` files with the JSX changed to `_jsx` calls optimized for production
|
|
10
|
-
- `react-jsxdev`: Emit `.js` files with the JSX changed to `_jsx` calls for development only
|
|
11
|
-
- `preserve`: Emit `.jsx` files with the JSX unchanged
|
|
12
|
-
- `react-native`: Emit `.js` files with the JSX unchanged
|
|
13
|
-
- `react`: Emit `.js` files with JSX changed to the equivalent `React.createElement` calls
|
|
14
|
-
|
|
15
|
-
### For example
|
|
16
|
-
|
|
17
|
-
This sample code:
|
|
18
|
-
|
|
19
|
-
```tsx
|
|
20
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
React: `"react-jsx"`<sup>[[1]](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)</sup>
|
|
24
|
-
|
|
25
|
-
```tsx twoslash
|
|
26
|
-
declare module JSX {
|
|
27
|
-
interface Element {}
|
|
28
|
-
interface IntrinsicElements {
|
|
29
|
-
[s: string]: any;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
// @showEmit
|
|
33
|
-
// @noErrors
|
|
34
|
-
// @jsx: react-jsx
|
|
35
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
React dev transform: `"react-jsxdev"`<sup>[[1]](https://reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html)</sup>
|
|
39
|
-
|
|
40
|
-
```tsx twoslash
|
|
41
|
-
declare module JSX {
|
|
42
|
-
interface Element {}
|
|
43
|
-
interface IntrinsicElements {
|
|
44
|
-
[s: string]: any;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
// @showEmit
|
|
48
|
-
// @noErrors
|
|
49
|
-
// @jsx: react-jsxdev
|
|
50
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
Preserve: `"preserve"`
|
|
54
|
-
|
|
55
|
-
```tsx twoslash
|
|
56
|
-
declare module JSX {
|
|
57
|
-
interface Element {}
|
|
58
|
-
interface IntrinsicElements {
|
|
59
|
-
[s: string]: any;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
// @showEmit
|
|
63
|
-
// @noErrors
|
|
64
|
-
// @jsx: preserve
|
|
65
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
React Native: `"react-native"`
|
|
69
|
-
|
|
70
|
-
```tsx twoslash
|
|
71
|
-
declare module JSX {
|
|
72
|
-
interface Element {}
|
|
73
|
-
interface IntrinsicElements {
|
|
74
|
-
[s: string]: any;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// @showEmit
|
|
78
|
-
// @noErrors
|
|
79
|
-
// @jsx: react-native
|
|
80
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
81
|
-
```
|
|
82
|
-
|
|
83
|
-
Legacy React runtime: `"react"`
|
|
84
|
-
|
|
85
|
-
```tsx twoslash
|
|
86
|
-
declare module JSX {
|
|
87
|
-
interface Element {}
|
|
88
|
-
interface IntrinsicElements {
|
|
89
|
-
[s: string]: any;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
// @showEmit
|
|
93
|
-
// @noErrors
|
|
94
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
This option can be used on a per-file basis too using an `@jsxRuntime` comment.
|
|
98
|
-
|
|
99
|
-
Always use the classic runtime (`"react"`) for this file:
|
|
100
|
-
|
|
101
|
-
```tsx
|
|
102
|
-
/* @jsxRuntime classic */
|
|
103
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
Always use the automatic runtime (`"react-jsx"`) for this file:
|
|
107
|
-
|
|
108
|
-
```tsx
|
|
109
|
-
/* @jsxRuntime automatic */
|
|
110
|
-
export const HelloWorld = () => <h1>Hello world</h1>;
|
|
111
|
-
```
|
|
@@ -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`.
|