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,8 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Emit On Error'
|
|
3
|
-
oneline: 'Disable emitting files if any type checking errors are reported.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Do not emit compiler output files like JavaScript source code, source-maps or declarations if any errors were reported.
|
|
7
|
-
|
|
8
|
-
This defaults to `false`, making it easier to work with TypeScript in a watch-like environment where you may want to see results of changes to your code in another environment before making sure all errors are resolved.
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Error Truncation'
|
|
3
|
-
oneline: 'Disable truncating types in error messages.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Do not truncate error messages.
|
|
7
|
-
|
|
8
|
-
With `false`, the default.
|
|
9
|
-
|
|
10
|
-
```ts twoslash
|
|
11
|
-
// @errors: 2322 2454
|
|
12
|
-
var x: {
|
|
13
|
-
propertyWithAnExceedinglyLongName1: string;
|
|
14
|
-
propertyWithAnExceedinglyLongName2: string;
|
|
15
|
-
propertyWithAnExceedinglyLongName3: string;
|
|
16
|
-
propertyWithAnExceedinglyLongName4: string;
|
|
17
|
-
propertyWithAnExceedinglyLongName5: string;
|
|
18
|
-
propertyWithAnExceedinglyLongName6: string;
|
|
19
|
-
propertyWithAnExceedinglyLongName7: string;
|
|
20
|
-
propertyWithAnExceedinglyLongName8: string;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
// String representation of type of 'x' should be truncated in error message
|
|
24
|
-
var s: string = x;
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
With `true`
|
|
28
|
-
|
|
29
|
-
```ts twoslash
|
|
30
|
-
// @errors: 2322 2454
|
|
31
|
-
// @noErrorTruncation: true
|
|
32
|
-
var x: {
|
|
33
|
-
propertyWithAnExceedinglyLongName1: string;
|
|
34
|
-
propertyWithAnExceedinglyLongName2: string;
|
|
35
|
-
propertyWithAnExceedinglyLongName3: string;
|
|
36
|
-
propertyWithAnExceedinglyLongName4: string;
|
|
37
|
-
propertyWithAnExceedinglyLongName5: string;
|
|
38
|
-
propertyWithAnExceedinglyLongName6: string;
|
|
39
|
-
propertyWithAnExceedinglyLongName7: string;
|
|
40
|
-
propertyWithAnExceedinglyLongName8: string;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
// String representation of type of 'x' should be truncated in error message
|
|
44
|
-
var s: string = x;
|
|
45
|
-
```
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Fallthrough Cases In Switch'
|
|
3
|
-
oneline: 'Enable error reporting for fallthrough cases in switch statements.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Report errors for fallthrough cases in switch statements.
|
|
7
|
-
Ensures that any non-empty case inside a switch statement includes either `break`, `return`, or `throw`.
|
|
8
|
-
This means you won't accidentally ship a case fallthrough bug.
|
|
9
|
-
|
|
10
|
-
```ts twoslash
|
|
11
|
-
// @noFallthroughCasesInSwitch
|
|
12
|
-
// @errors: 7029
|
|
13
|
-
const a: number = 6;
|
|
14
|
-
|
|
15
|
-
switch (a) {
|
|
16
|
-
case 0:
|
|
17
|
-
console.log('even');
|
|
18
|
-
case 1:
|
|
19
|
-
console.log('odd');
|
|
20
|
-
break;
|
|
21
|
-
}
|
|
22
|
-
```
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Implicit Any'
|
|
3
|
-
oneline: 'Enable error reporting for expressions and declarations with an implied `any` type.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
In some cases where no type annotations are present, TypeScript will fall back to a type of `any` for a variable when it cannot infer the type.
|
|
7
|
-
|
|
8
|
-
This can cause some errors to be missed, for example:
|
|
9
|
-
|
|
10
|
-
```ts twoslash
|
|
11
|
-
// @noImplicitAny: false
|
|
12
|
-
function fn(s) {
|
|
13
|
-
// No error?
|
|
14
|
-
console.log(s.subtr(3));
|
|
15
|
-
}
|
|
16
|
-
fn(42);
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Turning on `noImplicitAny` however TypeScript will issue an error whenever it would have inferred `any`:
|
|
20
|
-
|
|
21
|
-
```ts twoslash
|
|
22
|
-
// @errors: 7006
|
|
23
|
-
function fn(s) {
|
|
24
|
-
console.log(s.subtr(3));
|
|
25
|
-
}
|
|
26
|
-
```
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Implicit Override'
|
|
3
|
-
oneline: 'Ensure overriding members in derived classes are marked with an override modifier.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
When working with classes which use inheritance, it's possible for a sub-class to get "out of sync" with the functions it overloads when they are renamed in the base class.
|
|
7
|
-
|
|
8
|
-
For example, imagine you are modeling a music album syncing system:
|
|
9
|
-
|
|
10
|
-
```ts twoslash
|
|
11
|
-
class Album {
|
|
12
|
-
download() {
|
|
13
|
-
// Default behavior
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
class SharedAlbum extends Album {
|
|
18
|
-
download() {
|
|
19
|
-
// Override to get info from many sources
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
Then when you add support for machine-learning generated playlists, you refactor the `Album` class to have a 'setup' function instead:
|
|
25
|
-
|
|
26
|
-
```ts twoslash
|
|
27
|
-
class Album {
|
|
28
|
-
setup() {
|
|
29
|
-
// Default behavior
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
class MLAlbum extends Album {
|
|
34
|
-
setup() {
|
|
35
|
-
// Override to get info from algorithm
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
class SharedAlbum extends Album {
|
|
40
|
-
download() {
|
|
41
|
-
// Override to get info from many sources
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
In this case, TypeScript has provided no warning that `download` on `SharedAlbum` _expected_ to override a function in the base class.
|
|
47
|
-
|
|
48
|
-
Using `noImplicitOverride` you can ensure that the sub-classes never go out of sync, by ensuring that functions which override include the keyword `override`.
|
|
49
|
-
|
|
50
|
-
The following example has `noImplicitOverride` enabled, and you can see the error received when `override` is missing:
|
|
51
|
-
|
|
52
|
-
```ts twoslash
|
|
53
|
-
// @noImplicitOverride
|
|
54
|
-
// @errors: 4114
|
|
55
|
-
class Album {
|
|
56
|
-
setup() {}
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
class MLAlbum extends Album {
|
|
60
|
-
override setup() {}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
class SharedAlbum extends Album {
|
|
64
|
-
setup() {}
|
|
65
|
-
}
|
|
66
|
-
```
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Implicit Returns'
|
|
3
|
-
oneline: 'Enable error reporting for codepaths that do not explicitly return in a function.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
When enabled, TypeScript will check all code paths in a function to ensure they return a value.
|
|
7
|
-
|
|
8
|
-
```ts twoslash
|
|
9
|
-
// @errors: 2366 2322
|
|
10
|
-
function lookupHeadphonesManufacturer(color: 'blue' | 'black'): string {
|
|
11
|
-
if (color === 'blue') {
|
|
12
|
-
return 'beats';
|
|
13
|
-
} else {
|
|
14
|
-
('bose');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
```
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Implicit This'
|
|
3
|
-
oneline: 'Enable error reporting when `this` is given the type `any`.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Raise error on 'this' expressions with an implied 'any' type.
|
|
7
|
-
|
|
8
|
-
For example, the class below returns a function which tries to access `this.width` and `this.height` – but the context
|
|
9
|
-
for `this` inside the function inside `getAreaFunction` is not the instance of the Rectangle.
|
|
10
|
-
|
|
11
|
-
```ts twoslash
|
|
12
|
-
// @errors: 2683
|
|
13
|
-
class Rectangle {
|
|
14
|
-
width: number;
|
|
15
|
-
height: number;
|
|
16
|
-
|
|
17
|
-
constructor(width: number, height: number) {
|
|
18
|
-
this.width = width;
|
|
19
|
-
this.height = height;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
getAreaFunction() {
|
|
23
|
-
return function () {
|
|
24
|
-
return this.width * this.height;
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
```
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Implicit Use Strict'
|
|
3
|
-
oneline: "Disable adding 'use strict' directives in emitted JavaScript files."
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
You shouldn't need this. By default, when emitting a module file to a non-ES6 target, TypeScript emits a `"use strict";` prologue at the top of the file.
|
|
7
|
-
This setting disables the prologue.
|
package/docs/tsconfig/noLib.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Lib'
|
|
3
|
-
oneline: 'Disable including any library files, including the default lib.d.ts.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Disables the automatic inclusion of any library files.
|
|
7
|
-
If this option is set, `lib` is ignored.
|
|
8
|
-
|
|
9
|
-
TypeScript _cannot_ compile anything without a set of interfaces for key primitives like: `Array`, `Boolean`, `Function`, `IArguments`, `Number`, `Object`, `RegExp`, and `String`. It is expected that if you use `noLib` you will be including your own type definitions for these.
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Property Access From Index Signature'
|
|
3
|
-
oneline: 'Enforces using indexed accessors for keys declared using an indexed type.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
This setting ensures consistency between accessing a field via the "dot" (`obj.key`) syntax, and "indexed" (`obj["key"]`) and the way which the property is declared in the type.
|
|
7
|
-
|
|
8
|
-
Without this flag, TypeScript will allow you to use the dot syntax to access fields which are not defined:
|
|
9
|
-
|
|
10
|
-
```ts twoslash
|
|
11
|
-
// @errors: 4111
|
|
12
|
-
declare function getSettings(): GameSettings;
|
|
13
|
-
// ---cut---
|
|
14
|
-
interface GameSettings {
|
|
15
|
-
// Known up-front properties
|
|
16
|
-
speed: 'fast' | 'medium' | 'slow';
|
|
17
|
-
quality: 'high' | 'low';
|
|
18
|
-
|
|
19
|
-
// Assume anything unknown to the interface
|
|
20
|
-
// is a string.
|
|
21
|
-
[key: string]: string;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const settings = getSettings();
|
|
25
|
-
settings.speed;
|
|
26
|
-
// ^?
|
|
27
|
-
settings.quality;
|
|
28
|
-
// ^?
|
|
29
|
-
|
|
30
|
-
// Unknown key accessors are allowed on
|
|
31
|
-
// this object, and are `string`
|
|
32
|
-
settings.username;
|
|
33
|
-
// ^?
|
|
34
|
-
```
|
|
35
|
-
|
|
36
|
-
Turning the flag on will raise an error because the unknown field uses dot syntax instead of indexed syntax.
|
|
37
|
-
|
|
38
|
-
```ts twoslash
|
|
39
|
-
// @errors: 4111
|
|
40
|
-
// @noPropertyAccessFromIndexSignature
|
|
41
|
-
declare function getSettings(): GameSettings;
|
|
42
|
-
interface GameSettings {
|
|
43
|
-
speed: 'fast' | 'medium' | 'slow';
|
|
44
|
-
quality: 'high' | 'low';
|
|
45
|
-
[key: string]: string;
|
|
46
|
-
}
|
|
47
|
-
// ---cut---
|
|
48
|
-
const settings = getSettings();
|
|
49
|
-
settings.speed;
|
|
50
|
-
settings.quality;
|
|
51
|
-
|
|
52
|
-
// This would need to be settings["username"];
|
|
53
|
-
settings.username;
|
|
54
|
-
// ^?
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
The goal of this flag is to signal intent in your calling syntax about how certain you are this property exists.
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Resolve'
|
|
3
|
-
oneline: 'Disallow `import`s, `require`s or `<reference>`s from expanding the number of files TypeScript should add to a project.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
By default, TypeScript will examine the initial set of files for `import` and `<reference` directives and add these resolved files to your program.
|
|
7
|
-
|
|
8
|
-
If `noResolve` is set, this process doesn't happen.
|
|
9
|
-
However, `import` statements are still checked to see if they resolve to a valid module, so you'll need to make sure this is satisfied by some other means.
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'No Strict Generic Checks'
|
|
3
|
-
oneline: 'Disable strict checking of generic signatures in function types.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
TypeScript will unify type parameters when comparing two generic functions.
|
|
7
|
-
|
|
8
|
-
```ts twoslash
|
|
9
|
-
// @errors: 2322
|
|
10
|
-
|
|
11
|
-
type A = <T, U>(x: T, y: U) => [T, U];
|
|
12
|
-
type B = <S>(x: S, y: S) => [S, S];
|
|
13
|
-
|
|
14
|
-
function f(a: A, b: B) {
|
|
15
|
-
b = a; // Ok
|
|
16
|
-
a = b; // Error
|
|
17
|
-
}
|
|
18
|
-
```
|
|
19
|
-
|
|
20
|
-
This flag can be used to remove that check.
|
|
@@ -1,53 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1,52 +0,0 @@
|
|
|
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`.
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
```
|
|
@@ -1,15 +0,0 @@
|
|
|
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
|
-
```
|
package/docs/tsconfig/out.md
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
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.
|
package/docs/tsconfig/outDir.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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
|
-
```
|
package/docs/tsconfig/outFile.md
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
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.
|
package/docs/tsconfig/paths.md
DELETED
|
@@ -1,39 +0,0 @@
|
|
|
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.
|
package/docs/tsconfig/plugins.md
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
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`.
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Preserve Const Enums'
|
|
3
|
-
oneline: 'Disable erasing `const enum` declarations in generated code.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
Do not erase `const enum` declarations in generated code. `const enum`s provide a way to reduce the overall memory footprint
|
|
7
|
-
of your application at runtime by emitting the enum value instead of a reference.
|
|
8
|
-
|
|
9
|
-
For example with this TypeScript:
|
|
10
|
-
|
|
11
|
-
```ts twoslash
|
|
12
|
-
const enum Album {
|
|
13
|
-
JimmyEatWorldFutures = 1,
|
|
14
|
-
TubRingZooHypothesis = 2,
|
|
15
|
-
DogFashionDiscoAdultery = 3,
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
const selectedAlbum = Album.JimmyEatWorldFutures;
|
|
19
|
-
if (selectedAlbum === Album.JimmyEatWorldFutures) {
|
|
20
|
-
console.log('That is a great choice.');
|
|
21
|
-
}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
The default `const enum` behavior is to convert any `Album.Something` to the corresponding number literal, and to remove a reference
|
|
25
|
-
to the enum from the JavaScript completely.
|
|
26
|
-
|
|
27
|
-
```ts twoslash
|
|
28
|
-
// @showEmit
|
|
29
|
-
const enum Album {
|
|
30
|
-
JimmyEatWorldFutures = 1,
|
|
31
|
-
TubRingZooHypothesis = 2,
|
|
32
|
-
DogFashionDiscoAdultery = 3,
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
const selectedAlbum = Album.JimmyEatWorldFutures;
|
|
36
|
-
if (selectedAlbum === Album.JimmyEatWorldFutures) {
|
|
37
|
-
console.log('That is a great choice.');
|
|
38
|
-
}
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
With `preserveConstEnums` set to `true`, the `enum` exists at runtime and the numbers are still emitted.
|
|
42
|
-
|
|
43
|
-
```ts twoslash
|
|
44
|
-
// @preserveConstEnums: true
|
|
45
|
-
// @showEmit
|
|
46
|
-
const enum Album {
|
|
47
|
-
JimmyEatWorldFutures = 1,
|
|
48
|
-
TubRingZooHypothesis = 2,
|
|
49
|
-
DogFashionDiscoAdultery = 3,
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
const selectedAlbum = Album.JimmyEatWorldFutures;
|
|
53
|
-
if (selectedAlbum === Album.JimmyEatWorldFutures) {
|
|
54
|
-
console.log('That is a great choice.');
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
This essentially makes such `const enums` a source-code feature only, with no runtime traces.
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
display: 'Preserve Symlinks'
|
|
3
|
-
oneline: 'Disable resolving symlinks to their realpath. This correlates to the same flag in node.'
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
This is to reflect the same flag in Node.js; which does not resolve the real path of symlinks.
|
|
7
|
-
|
|
8
|
-
This flag also exhibits the opposite behavior to Webpack’s `resolve.symlinks` option (i.e. setting TypeScript’s `preserveSymlinks` to true parallels setting Webpack’s `resolve.symlinks` to false, and vice-versa).
|
|
9
|
-
|
|
10
|
-
With this enabled, references to modules and packages (e.g. `import`s and `/// <reference type="..." />` directives) are all resolved relative to the location of the symbolic link file, rather than relative to the path that the symbolic link resolves to.
|