Update checked-in dependencies

This commit is contained in:
github-actions[bot] 2023-07-13 09:09:17 +00:00
parent 4fad06f438
commit 40a500c743
4168 changed files with 298222 additions and 374905 deletions

41
node_modules/get-tsconfig/README.md generated vendored
View file

@ -97,6 +97,47 @@ console.log(parseTsconfig('./path/to/tsconfig.custom.json'))
---
### createFileMatcher(tsconfig: TsconfigResult, caseSensitivePaths?: boolean)
Given a `tsconfig.json` file, it returns a file-matcher function that determines whether it should apply to a file path.
```ts
type FileMatcher = (filePath: string) => TsconfigResult['config'] | undefined
```
#### tsconfig
Type: `TsconfigResult`
Pass in the return value from `getTsconfig`, or a `TsconfigResult` object.
#### caseSensitivePaths
Type: `boolean`
By default, it uses [`is-fs-case-sensitive`](https://github.com/privatenumber/is-fs-case-sensitive) to detect whether the file-system is case-sensitive.
Pass in `true` to make it case-sensitive.
#### Example
For example, if it's called with a `tsconfig.json` file that has `include`/`exclude`/`files` defined, the file-matcher will return the config for files that match `include`/`files`, and return `undefined` for files that don't match or match `exclude`.
```ts
const tsconfig = getTsconfig()
const fileMatcher = tsconfig && createFileMatcher(tsconfig)
/*
* Returns tsconfig.json if it matches the file,
* undefined if not
*/
const configForFile = fileMatcher?.('/path/to/file.ts')
const distCode = compileTypescript({
code: sourceCode,
tsconfig: configForFile
})
```
---
### createPathsMatcher(tsconfig: TsconfigResult)
Given a tsconfig with [`compilerOptions.paths`](https://www.typescriptlang.org/tsconfig#paths) defined, it returns a matcher function.

File diff suppressed because one or more lines are too long

View file

@ -10,10 +10,30 @@ Returns a boolean for whether the two given types are equal.
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
Use-cases:
- If you want to make a conditional branch based on the result of a comparison of two types.
@example
```
import type {IsEqual} from 'type-fest';
// This type returns a boolean for whether the given array includes the given item.
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
type Includes<Value extends readonly any[], Item> =
Value extends readonly [Value[0], ...infer rest]
? IsEqual<Value[0], Item> extends true
? true
: Includes<rest, Item>
: false;
```
@category Type Guard
@category Utilities
*/
type IsEqual<T, U> =
(<G>() => G extends T ? 1 : 2) extends
(<G>() => G extends U ? 1 : 2)
type IsEqual<A, B> =
(<G>() => G extends A ? 1 : 2) extends
(<G>() => G extends B ? 1 : 2)
? true
: false;
@ -46,9 +66,22 @@ type Filtered = Filter<'bar', 'foo'>;
*/
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
type ExceptOptions = {
/**
Disallow assigning non-specified properties.
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
@default false
*/
requireExactProps?: boolean;
};
/**
Create a type from an object type without certain keys.
We recommend setting the `requireExactProps` option to `true`.
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
@ -60,18 +93,28 @@ import type {Except} from 'type-fest';
type Foo = {
a: number;
b: string;
c: boolean;
};
type FooWithoutA = Except<Foo, 'a' | 'c'>;
//=> {b: string};
type FooWithoutA = Except<Foo, 'a'>;
//=> {b: string}
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
//=> errors: 'a' does not exist in type '{ b: string; }'
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
//=> {a: number} & Partial<Record<"b", never>>
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
```
@category Object
*/
type Except<ObjectType, KeysType extends keyof ObjectType> = {
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
};
} & (Options['requireExactProps'] extends true
? Partial<Record<KeysType, never>>
: {});
declare namespace TsConfigJson {
namespace CompilerOptions {
@ -127,6 +170,7 @@ declare namespace TsConfigJson {
| 'ES2019'
| 'ES2020'
| 'ES2021'
| 'ES2022'
| 'ESNext'
// Lowercase alternatives
| 'es3'
@ -139,6 +183,7 @@ declare namespace TsConfigJson {
| 'es2019'
| 'es2020'
| 'es2021'
| 'es2022'
| 'esnext';
export type Lib =
@ -261,11 +306,10 @@ declare namespace TsConfigJson {
| 'webworker.iterable';
export type Plugin = {
[key: string]: unknown;
/**
Plugin name.
*/
name?: string;
name: string;
};
export type ImportsNotUsedAsValues =
@ -296,6 +340,27 @@ declare namespace TsConfigJson {
| 'useFsEventsOnParentDirectory'
| 'fixedChunkSizePolling';
export type ModuleResolution =
| 'classic'
| 'node'
| 'node10'
| 'node16'
| 'nodenext'
| 'bundler'
// Pascal-cased alternatives
| 'Classic'
| 'Node'
| 'Node10'
| 'Node16'
| 'NodeNext'
| 'Bundler';
export type ModuleDetection =
| 'auto'
| 'legacy'
| 'force';
export type IgnoreDeprecations = '5.0';
}
export type CompilerOptions = {
@ -303,6 +368,7 @@ declare namespace TsConfigJson {
The character set of the input files.
@default 'utf8'
@deprecated This option will be removed in TypeScript 5.5.
*/
charset?: string;
@ -322,8 +388,6 @@ declare namespace TsConfigJson {
/**
Specify output directory for generated declaration files.
Requires TypeScript version 2.0 or later.
*/
declarationDir?: string;
@ -337,8 +401,6 @@ declare namespace TsConfigJson {
/**
Reduce the number of projects loaded automatically by TypeScript.
Requires TypeScript version 4.0 or later.
@default false
*/
disableReferencedProjectLoad?: boolean;
@ -346,8 +408,6 @@ declare namespace TsConfigJson {
/**
Enforces using indexed accessors for keys declared using an indexed type.
Requires TypeScript version 4.2 or later.
@default false
*/
noPropertyAccessFromIndexSignature?: boolean;
@ -369,8 +429,6 @@ declare namespace TsConfigJson {
/**
Differentiate between undefined and not present when type checking.
Requires TypeScript version 4.4 or later.
@default false
*/
exactOptionalPropertyTypes?: boolean;
@ -422,8 +480,6 @@ declare namespace TsConfigJson {
/**
Specify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`.
Requires TypeScript version 2.1 or later.
@default 'React.createElement'
*/
jsxFactory?: string;
@ -431,8 +487,6 @@ declare namespace TsConfigJson {
/**
Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.
Requires TypeScript version 4.0 or later.
@default 'React.Fragment'
*/
jsxFragmentFactory?: string;
@ -440,8 +494,6 @@ declare namespace TsConfigJson {
/**
Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.
Requires TypeScript version 4.1 or later.
@default 'react'
*/
jsxImportSource?: string;
@ -470,12 +522,12 @@ declare namespace TsConfigJson {
@default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'
*/
moduleResolution?: 'classic' | 'node';
moduleResolution?: CompilerOptions.ModuleResolution;
/**
Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
Default: Platform specific
@default 'LF'
*/
newLine?: CompilerOptions.NewLine;
@ -517,8 +569,6 @@ declare namespace TsConfigJson {
/**
Report errors on unused locals.
Requires TypeScript version 2.0 or later.
@default false
*/
noUnusedLocals?: boolean;
@ -526,8 +576,6 @@ declare namespace TsConfigJson {
/**
Report errors on unused parameters.
Requires TypeScript version 2.0 or later.
@default false
*/
noUnusedParameters?: boolean;
@ -550,6 +598,7 @@ declare namespace TsConfigJson {
Disable strict checking of generic signatures in function types.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
noStrictGenericChecks?: boolean;
@ -561,8 +610,6 @@ declare namespace TsConfigJson {
/**
Skip type checking of declaration files.
Requires TypeScript version 2.0 or later.
@default false
*/
skipLibCheck?: boolean;
@ -642,6 +689,7 @@ declare namespace TsConfigJson {
Suppress excess property checks for object literals.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
suppressExcessPropertyErrors?: boolean;
@ -649,6 +697,7 @@ declare namespace TsConfigJson {
Suppress noImplicitAny errors for indexing objects lacking index signatures.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
suppressImplicitAnyIndexErrors?: boolean;
@ -667,8 +716,6 @@ declare namespace TsConfigJson {
/**
Default catch clause variables as `unknown` instead of `any`.
Requires TypeScript version 4.4 or later.
@default false
*/
useUnknownInCatchVariables?: boolean;
@ -684,8 +731,6 @@ declare namespace TsConfigJson {
/**
Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
Requires TypeScript version 3.8 or later.
@deprecated Use watchOptions.fallbackPolling instead.
*/
fallbackPolling?: CompilerOptions.FallbackPolling;
@ -693,8 +738,6 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
Requires TypeScript version 3.8 or later.
@default 'useFsEvents'
@deprecated Use watchOptions.watchDirectory instead.
*/
@ -703,8 +746,6 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching individual files.
Requires TypeScript version 3.8 or later.
@default 'useFsEvents'
@deprecated Use watchOptions.watchFile instead.
*/
@ -741,8 +782,6 @@ declare namespace TsConfigJson {
/**
Add `undefined` to a type when accessed using an index.
Requires TypeScript version 4.1 or later.
@default false
*/
noUncheckedIndexedAccess?: boolean;
@ -771,15 +810,13 @@ declare namespace TsConfigJson {
/**
Disallow inconsistently-cased references to the same file.
@default false
@default true
*/
forceConsistentCasingInFileNames?: boolean;
/**
Emit a v8 CPU profile of the compiler run for debugging.
Requires TypeScript version 3.7 or later.
@default 'profile.cpuprofile'
*/
generateCpuProfile?: string;
@ -796,8 +833,6 @@ declare namespace TsConfigJson {
/**
List of TypeScript language server plugins to load.
Requires TypeScript version 2.3 or later.
*/
plugins?: CompilerOptions.Plugin[];
@ -808,15 +843,11 @@ declare namespace TsConfigJson {
/**
Specify list of directories for type definition files to be included.
Requires TypeScript version 2.0 or later.
*/
typeRoots?: string[];
/**
Type declaration files to be included in compilation.
Requires TypeScript version 2.0 or later.
*/
types?: string[];
@ -852,14 +883,13 @@ declare namespace TsConfigJson {
Do not emit `'use strict'` directives in module output.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
noImplicitUseStrict?: boolean;
/**
Enable to list all emitted files.
Requires TypeScript version 2.0 or later.
@default false
*/
listEmittedFiles?: boolean;
@ -867,24 +897,18 @@ declare namespace TsConfigJson {
/**
Disable size limit for JavaScript project.
Requires TypeScript version 2.0 or later.
@default false
*/
disableSizeLimit?: boolean;
/**
List of library files to be included in the compilation.
Requires TypeScript version 2.0 or later.
*/
lib?: CompilerOptions.Lib[];
/**
Enable strict null checks.
Requires TypeScript version 2.0 or later.
@default false
*/
strictNullChecks?: boolean;
@ -899,8 +923,6 @@ declare namespace TsConfigJson {
/**
Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.
Requires TypeScript version 2.1 or later.
@default false
*/
importHelpers?: boolean;
@ -909,14 +931,13 @@ declare namespace TsConfigJson {
Specify emit/checking behavior for imports that are only used for types.
@default 'remove'
@deprecated Use `verbatimModuleSyntax` instead.
*/
importsNotUsedAsValues?: CompilerOptions.ImportsNotUsedAsValues;
/**
Parse in strict mode and emit `'use strict'` for each source file.
Requires TypeScript version 2.1 or later.
@default false
*/
alwaysStrict?: boolean;
@ -924,8 +945,6 @@ declare namespace TsConfigJson {
/**
Enable all strict type checking options.
Requires TypeScript version 2.3 or later.
@default false
*/
strict?: boolean;
@ -940,8 +959,6 @@ declare namespace TsConfigJson {
/**
Provide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`.
Requires TypeScript version 2.3 or later.
@default false
*/
downlevelIteration?: boolean;
@ -949,8 +966,6 @@ declare namespace TsConfigJson {
/**
Report errors in `.js` files.
Requires TypeScript version 2.3 or later.
@default false
*/
checkJs?: boolean;
@ -958,8 +973,6 @@ declare namespace TsConfigJson {
/**
Disable bivariant parameter checking for function types.
Requires TypeScript version 2.6 or later.
@default false
*/
strictFunctionTypes?: boolean;
@ -967,8 +980,6 @@ declare namespace TsConfigJson {
/**
Ensure non-undefined class properties are initialized in the constructor.
Requires TypeScript version 2.7 or later.
@default false
*/
strictPropertyInitialization?: boolean;
@ -976,8 +987,6 @@ declare namespace TsConfigJson {
/**
Emit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility.
Requires TypeScript version 2.7 or later.
@default false
*/
esModuleInterop?: boolean;
@ -992,17 +1001,14 @@ declare namespace TsConfigJson {
/**
Resolve `keyof` to string valued property names only (no numbers or symbols).
Requires TypeScript version 2.9 or later.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
keyofStringsOnly?: boolean;
/**
Emit ECMAScript standard class fields.
Requires TypeScript version 3.7 or later.
@default false
*/
useDefineForClassFields?: boolean;
@ -1010,8 +1016,6 @@ declare namespace TsConfigJson {
/**
Generates a sourcemap for each corresponding `.d.ts` file.
Requires TypeScript version 2.9 or later.
@default false
*/
declarationMap?: boolean;
@ -1019,8 +1023,6 @@ declare namespace TsConfigJson {
/**
Include modules imported with `.json` extension.
Requires TypeScript version 2.9 or later.
@default false
*/
resolveJsonModule?: boolean;
@ -1028,8 +1030,6 @@ declare namespace TsConfigJson {
/**
Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.
Requires TypeScript version 3.8 or later.
@default false
*/
assumeChangesOnlyAffectDirectDependencies?: boolean;
@ -1058,8 +1058,6 @@ declare namespace TsConfigJson {
/**
Opt a project out of multi-project reference checking when editing.
Requires TypeScript version 3.8 or later.
@default false
*/
disableSolutionSearching?: boolean;
@ -1067,11 +1065,74 @@ declare namespace TsConfigJson {
/**
Print names of files which TypeScript sees as a part of your project and the reason they are part of the compilation.
Requires TypeScript version 4.2 or later.
@default false
*/
explainFiles?: boolean;
/**
Preserve unused imported values in the JavaScript output that would otherwise be removed.
@default true
@deprecated Use `verbatimModuleSyntax` instead.
*/
preserveValueImports?: boolean;
/**
List of file name suffixes to search when resolving a module.
*/
moduleSuffixes?: string[];
/**
Control what method is used to detect module-format JS files.
@default 'auto'
*/
moduleDetection?: CompilerOptions.ModuleDetection;
/**
Allows TypeScript files to import each other with a TypeScript-specific extension like .ts, .mts, or .tsx.
@default false
*/
allowImportingTsExtensions?: boolean;
/**
Forces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.
@default false
*/
resolvePackageJsonExports?: boolean;
/**
Forces TypeScript to consult the imports field of package.json files when performing a lookup that starts with # from a file whose ancestor directory contains a package.json.
@default false
*/
resolvePackageJsonImports?: boolean;
/**
Suppress errors for file formats that TypeScript does not understand.
@default false
*/
allowArbitraryExtensions?: boolean;
/**
List of additional conditions that should succeed when TypeScript resolves from package.json.
*/
customConditions?: string[];
/**
Anything that uses the type modifier is dropped entirely.
@default false
*/
verbatimModuleSyntax?: boolean;
/**
Suppress deprecation warnings
*/
ignoreDeprecations?: CompilerOptions.IgnoreDeprecations;
};
namespace WatchOptions {
@ -1101,8 +1162,6 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching individual files.
Requires TypeScript version 3.8 or later.
@default 'UseFsEvents'
*/
watchFile?: WatchOptions.WatchFileKind | Lowercase<WatchOptions.WatchFileKind>;
@ -1110,16 +1169,12 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
Requires TypeScript version 3.8 or later.
@default 'UseFsEvents'
*/
watchDirectory?: WatchOptions.WatchDirectoryKind | Lowercase<WatchOptions.WatchDirectoryKind>;
/**
Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
Requires TypeScript version 3.8 or later.
*/
fallbackPolling?: WatchOptions.PollingWatchKind | Lowercase<WatchOptions.PollingWatchKind>;
@ -1141,8 +1196,6 @@ declare namespace TsConfigJson {
/**
Auto type (.d.ts) acquisition options for this project.
Requires TypeScript version 2.1 or later.
*/
export type TypeAcquisition = {
/**
@ -1176,6 +1229,7 @@ declare namespace TsConfigJson {
True if the output of this reference should be prepended to the output of this project.
Only valid for `--outFile` compilations.
@deprecated This option will be removed in TypeScript 5.5.
*/
prepend?: boolean;
@ -1204,8 +1258,6 @@ type TsConfigJson = {
/**
Auto type (.d.ts) acquisition options for this project.
Requires TypeScript version 2.1 or later.
*/
typeAcquisition?: TsConfigJson.TypeAcquisition;
@ -1216,10 +1268,8 @@ type TsConfigJson = {
/**
Path to base configuration file to inherit from.
Requires TypeScript version 2.1 or later.
*/
extends?: string;
extends?: string | string[];
/**
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. When a `files` property is specified, only those files and those specified by `include` are included.
@ -1237,15 +1287,11 @@ type TsConfigJson = {
Specifies a list of glob patterns that match files to be included in compilation.
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`.
Requires TypeScript version 2.0 or later.
*/
include?: string[];
/**
Referenced projects.
Requires TypeScript version 3.0 or later.
*/
references?: TsConfigJson.References[];
};
@ -1262,14 +1308,17 @@ type TsConfigResult = {
config: TsConfigJsonResolved;
};
declare function getTsconfig(searchPath?: string, configName?: string): TsConfigResult | null;
declare const getTsconfig: (searchPath?: string, configName?: string) => TsConfigResult | null;
declare function parseTsconfig(tsconfigPath: string): TsConfigJsonResolved;
declare const parseTsconfig: (tsconfigPath: string) => TsConfigJsonResolved;
/**
* Reference:
* https://github.com/microsoft/TypeScript/blob/3ccbe804f850f40d228d3c875be952d94d39aa1d/src/compiler/moduleNameResolver.ts#L2465
*/
declare function createPathsMatcher(tsconfig: TsConfigResult): ((specifier: string) => string[]) | null;
declare const createPathsMatcher: (tsconfig: TsConfigResult) => ((specifier: string) => string[]) | null;
export { TsConfigJson, TsConfigJsonResolved, TsConfigResult, createPathsMatcher, getTsconfig, parseTsconfig };
type FileMatcher = (filePath: string) => (TsConfigJsonResolved | undefined);
declare const createFilesMatcher: ({ config, path: tsconfigPath, }: TsConfigResult, caseSensitivePaths?: boolean) => FileMatcher;
export { FileMatcher, TsConfigJson, TsConfigJsonResolved, TsConfigResult, createFilesMatcher, createPathsMatcher, getTsconfig, parseTsconfig };

View file

@ -10,10 +10,30 @@ Returns a boolean for whether the two given types are equal.
@link https://github.com/microsoft/TypeScript/issues/27024#issuecomment-421529650
@link https://stackoverflow.com/questions/68961864/how-does-the-equals-work-in-typescript/68963796#68963796
Use-cases:
- If you want to make a conditional branch based on the result of a comparison of two types.
@example
```
import type {IsEqual} from 'type-fest';
// This type returns a boolean for whether the given array includes the given item.
// `IsEqual` is used to compare the given array at position 0 and the given item and then return true if they are equal.
type Includes<Value extends readonly any[], Item> =
Value extends readonly [Value[0], ...infer rest]
? IsEqual<Value[0], Item> extends true
? true
: Includes<rest, Item>
: false;
```
@category Type Guard
@category Utilities
*/
type IsEqual<T, U> =
(<G>() => G extends T ? 1 : 2) extends
(<G>() => G extends U ? 1 : 2)
type IsEqual<A, B> =
(<G>() => G extends A ? 1 : 2) extends
(<G>() => G extends B ? 1 : 2)
? true
: false;
@ -46,9 +66,22 @@ type Filtered = Filter<'bar', 'foo'>;
*/
type Filter<KeyType, ExcludeType> = IsEqual<KeyType, ExcludeType> extends true ? never : (KeyType extends ExcludeType ? never : KeyType);
type ExceptOptions = {
/**
Disallow assigning non-specified properties.
Note that any omitted properties in the resulting type will be present in autocomplete as `undefined`.
@default false
*/
requireExactProps?: boolean;
};
/**
Create a type from an object type without certain keys.
We recommend setting the `requireExactProps` option to `true`.
This type is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type). The `Omit` type does not restrict the omitted keys to be keys present on the given type, while `Except` does. The benefits of a stricter type are avoiding typos and allowing the compiler to pick up on rename refactors automatically.
This type was proposed to the TypeScript team, which declined it, saying they prefer that libraries implement stricter versions of the built-in types ([microsoft/TypeScript#30825](https://github.com/microsoft/TypeScript/issues/30825#issuecomment-523668235)).
@ -60,18 +93,28 @@ import type {Except} from 'type-fest';
type Foo = {
a: number;
b: string;
c: boolean;
};
type FooWithoutA = Except<Foo, 'a' | 'c'>;
//=> {b: string};
type FooWithoutA = Except<Foo, 'a'>;
//=> {b: string}
const fooWithoutA: FooWithoutA = {a: 1, b: '2'};
//=> errors: 'a' does not exist in type '{ b: string; }'
type FooWithoutB = Except<Foo, 'b', {requireExactProps: true}>;
//=> {a: number} & Partial<Record<"b", never>>
const fooWithoutB: FooWithoutB = {a: 1, b: '2'};
//=> errors at 'b': Type 'string' is not assignable to type 'undefined'.
```
@category Object
*/
type Except<ObjectType, KeysType extends keyof ObjectType> = {
type Except<ObjectType, KeysType extends keyof ObjectType, Options extends ExceptOptions = {requireExactProps: false}> = {
[KeyType in keyof ObjectType as Filter<KeyType, KeysType>]: ObjectType[KeyType];
};
} & (Options['requireExactProps'] extends true
? Partial<Record<KeysType, never>>
: {});
declare namespace TsConfigJson {
namespace CompilerOptions {
@ -127,6 +170,7 @@ declare namespace TsConfigJson {
| 'ES2019'
| 'ES2020'
| 'ES2021'
| 'ES2022'
| 'ESNext'
// Lowercase alternatives
| 'es3'
@ -139,6 +183,7 @@ declare namespace TsConfigJson {
| 'es2019'
| 'es2020'
| 'es2021'
| 'es2022'
| 'esnext';
export type Lib =
@ -261,11 +306,10 @@ declare namespace TsConfigJson {
| 'webworker.iterable';
export type Plugin = {
[key: string]: unknown;
/**
Plugin name.
*/
name?: string;
name: string;
};
export type ImportsNotUsedAsValues =
@ -296,6 +340,27 @@ declare namespace TsConfigJson {
| 'useFsEventsOnParentDirectory'
| 'fixedChunkSizePolling';
export type ModuleResolution =
| 'classic'
| 'node'
| 'node10'
| 'node16'
| 'nodenext'
| 'bundler'
// Pascal-cased alternatives
| 'Classic'
| 'Node'
| 'Node10'
| 'Node16'
| 'NodeNext'
| 'Bundler';
export type ModuleDetection =
| 'auto'
| 'legacy'
| 'force';
export type IgnoreDeprecations = '5.0';
}
export type CompilerOptions = {
@ -303,6 +368,7 @@ declare namespace TsConfigJson {
The character set of the input files.
@default 'utf8'
@deprecated This option will be removed in TypeScript 5.5.
*/
charset?: string;
@ -322,8 +388,6 @@ declare namespace TsConfigJson {
/**
Specify output directory for generated declaration files.
Requires TypeScript version 2.0 or later.
*/
declarationDir?: string;
@ -337,8 +401,6 @@ declare namespace TsConfigJson {
/**
Reduce the number of projects loaded automatically by TypeScript.
Requires TypeScript version 4.0 or later.
@default false
*/
disableReferencedProjectLoad?: boolean;
@ -346,8 +408,6 @@ declare namespace TsConfigJson {
/**
Enforces using indexed accessors for keys declared using an indexed type.
Requires TypeScript version 4.2 or later.
@default false
*/
noPropertyAccessFromIndexSignature?: boolean;
@ -369,8 +429,6 @@ declare namespace TsConfigJson {
/**
Differentiate between undefined and not present when type checking.
Requires TypeScript version 4.4 or later.
@default false
*/
exactOptionalPropertyTypes?: boolean;
@ -422,8 +480,6 @@ declare namespace TsConfigJson {
/**
Specify the JSX factory function to use when targeting React JSX emit, e.g. `React.createElement` or `h`.
Requires TypeScript version 2.1 or later.
@default 'React.createElement'
*/
jsxFactory?: string;
@ -431,8 +487,6 @@ declare namespace TsConfigJson {
/**
Specify the JSX Fragment reference used for fragments when targeting React JSX emit e.g. 'React.Fragment' or 'Fragment'.
Requires TypeScript version 4.0 or later.
@default 'React.Fragment'
*/
jsxFragmentFactory?: string;
@ -440,8 +494,6 @@ declare namespace TsConfigJson {
/**
Specify module specifier used to import the JSX factory functions when using `jsx: react-jsx*`.
Requires TypeScript version 4.1 or later.
@default 'react'
*/
jsxImportSource?: string;
@ -470,12 +522,12 @@ declare namespace TsConfigJson {
@default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'
*/
moduleResolution?: 'classic' | 'node';
moduleResolution?: CompilerOptions.ModuleResolution;
/**
Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
Default: Platform specific
@default 'LF'
*/
newLine?: CompilerOptions.NewLine;
@ -517,8 +569,6 @@ declare namespace TsConfigJson {
/**
Report errors on unused locals.
Requires TypeScript version 2.0 or later.
@default false
*/
noUnusedLocals?: boolean;
@ -526,8 +576,6 @@ declare namespace TsConfigJson {
/**
Report errors on unused parameters.
Requires TypeScript version 2.0 or later.
@default false
*/
noUnusedParameters?: boolean;
@ -550,6 +598,7 @@ declare namespace TsConfigJson {
Disable strict checking of generic signatures in function types.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
noStrictGenericChecks?: boolean;
@ -561,8 +610,6 @@ declare namespace TsConfigJson {
/**
Skip type checking of declaration files.
Requires TypeScript version 2.0 or later.
@default false
*/
skipLibCheck?: boolean;
@ -642,6 +689,7 @@ declare namespace TsConfigJson {
Suppress excess property checks for object literals.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
suppressExcessPropertyErrors?: boolean;
@ -649,6 +697,7 @@ declare namespace TsConfigJson {
Suppress noImplicitAny errors for indexing objects lacking index signatures.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
suppressImplicitAnyIndexErrors?: boolean;
@ -667,8 +716,6 @@ declare namespace TsConfigJson {
/**
Default catch clause variables as `unknown` instead of `any`.
Requires TypeScript version 4.4 or later.
@default false
*/
useUnknownInCatchVariables?: boolean;
@ -684,8 +731,6 @@ declare namespace TsConfigJson {
/**
Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
Requires TypeScript version 3.8 or later.
@deprecated Use watchOptions.fallbackPolling instead.
*/
fallbackPolling?: CompilerOptions.FallbackPolling;
@ -693,8 +738,6 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
Requires TypeScript version 3.8 or later.
@default 'useFsEvents'
@deprecated Use watchOptions.watchDirectory instead.
*/
@ -703,8 +746,6 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching individual files.
Requires TypeScript version 3.8 or later.
@default 'useFsEvents'
@deprecated Use watchOptions.watchFile instead.
*/
@ -741,8 +782,6 @@ declare namespace TsConfigJson {
/**
Add `undefined` to a type when accessed using an index.
Requires TypeScript version 4.1 or later.
@default false
*/
noUncheckedIndexedAccess?: boolean;
@ -771,15 +810,13 @@ declare namespace TsConfigJson {
/**
Disallow inconsistently-cased references to the same file.
@default false
@default true
*/
forceConsistentCasingInFileNames?: boolean;
/**
Emit a v8 CPU profile of the compiler run for debugging.
Requires TypeScript version 3.7 or later.
@default 'profile.cpuprofile'
*/
generateCpuProfile?: string;
@ -796,8 +833,6 @@ declare namespace TsConfigJson {
/**
List of TypeScript language server plugins to load.
Requires TypeScript version 2.3 or later.
*/
plugins?: CompilerOptions.Plugin[];
@ -808,15 +843,11 @@ declare namespace TsConfigJson {
/**
Specify list of directories for type definition files to be included.
Requires TypeScript version 2.0 or later.
*/
typeRoots?: string[];
/**
Type declaration files to be included in compilation.
Requires TypeScript version 2.0 or later.
*/
types?: string[];
@ -852,14 +883,13 @@ declare namespace TsConfigJson {
Do not emit `'use strict'` directives in module output.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
noImplicitUseStrict?: boolean;
/**
Enable to list all emitted files.
Requires TypeScript version 2.0 or later.
@default false
*/
listEmittedFiles?: boolean;
@ -867,24 +897,18 @@ declare namespace TsConfigJson {
/**
Disable size limit for JavaScript project.
Requires TypeScript version 2.0 or later.
@default false
*/
disableSizeLimit?: boolean;
/**
List of library files to be included in the compilation.
Requires TypeScript version 2.0 or later.
*/
lib?: CompilerOptions.Lib[];
/**
Enable strict null checks.
Requires TypeScript version 2.0 or later.
@default false
*/
strictNullChecks?: boolean;
@ -899,8 +923,6 @@ declare namespace TsConfigJson {
/**
Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.
Requires TypeScript version 2.1 or later.
@default false
*/
importHelpers?: boolean;
@ -909,14 +931,13 @@ declare namespace TsConfigJson {
Specify emit/checking behavior for imports that are only used for types.
@default 'remove'
@deprecated Use `verbatimModuleSyntax` instead.
*/
importsNotUsedAsValues?: CompilerOptions.ImportsNotUsedAsValues;
/**
Parse in strict mode and emit `'use strict'` for each source file.
Requires TypeScript version 2.1 or later.
@default false
*/
alwaysStrict?: boolean;
@ -924,8 +945,6 @@ declare namespace TsConfigJson {
/**
Enable all strict type checking options.
Requires TypeScript version 2.3 or later.
@default false
*/
strict?: boolean;
@ -940,8 +959,6 @@ declare namespace TsConfigJson {
/**
Provide full support for iterables in `for-of`, spread, and destructuring when targeting `ES5` or `ES3`.
Requires TypeScript version 2.3 or later.
@default false
*/
downlevelIteration?: boolean;
@ -949,8 +966,6 @@ declare namespace TsConfigJson {
/**
Report errors in `.js` files.
Requires TypeScript version 2.3 or later.
@default false
*/
checkJs?: boolean;
@ -958,8 +973,6 @@ declare namespace TsConfigJson {
/**
Disable bivariant parameter checking for function types.
Requires TypeScript version 2.6 or later.
@default false
*/
strictFunctionTypes?: boolean;
@ -967,8 +980,6 @@ declare namespace TsConfigJson {
/**
Ensure non-undefined class properties are initialized in the constructor.
Requires TypeScript version 2.7 or later.
@default false
*/
strictPropertyInitialization?: boolean;
@ -976,8 +987,6 @@ declare namespace TsConfigJson {
/**
Emit `__importStar` and `__importDefault` helpers for runtime Babel ecosystem compatibility and enable `--allowSyntheticDefaultImports` for typesystem compatibility.
Requires TypeScript version 2.7 or later.
@default false
*/
esModuleInterop?: boolean;
@ -992,17 +1001,14 @@ declare namespace TsConfigJson {
/**
Resolve `keyof` to string valued property names only (no numbers or symbols).
Requires TypeScript version 2.9 or later.
@default false
@deprecated This option will be removed in TypeScript 5.5.
*/
keyofStringsOnly?: boolean;
/**
Emit ECMAScript standard class fields.
Requires TypeScript version 3.7 or later.
@default false
*/
useDefineForClassFields?: boolean;
@ -1010,8 +1016,6 @@ declare namespace TsConfigJson {
/**
Generates a sourcemap for each corresponding `.d.ts` file.
Requires TypeScript version 2.9 or later.
@default false
*/
declarationMap?: boolean;
@ -1019,8 +1023,6 @@ declare namespace TsConfigJson {
/**
Include modules imported with `.json` extension.
Requires TypeScript version 2.9 or later.
@default false
*/
resolveJsonModule?: boolean;
@ -1028,8 +1030,6 @@ declare namespace TsConfigJson {
/**
Have recompiles in '--incremental' and '--watch' assume that changes within a file will only affect files directly depending on it.
Requires TypeScript version 3.8 or later.
@default false
*/
assumeChangesOnlyAffectDirectDependencies?: boolean;
@ -1058,8 +1058,6 @@ declare namespace TsConfigJson {
/**
Opt a project out of multi-project reference checking when editing.
Requires TypeScript version 3.8 or later.
@default false
*/
disableSolutionSearching?: boolean;
@ -1067,11 +1065,74 @@ declare namespace TsConfigJson {
/**
Print names of files which TypeScript sees as a part of your project and the reason they are part of the compilation.
Requires TypeScript version 4.2 or later.
@default false
*/
explainFiles?: boolean;
/**
Preserve unused imported values in the JavaScript output that would otherwise be removed.
@default true
@deprecated Use `verbatimModuleSyntax` instead.
*/
preserveValueImports?: boolean;
/**
List of file name suffixes to search when resolving a module.
*/
moduleSuffixes?: string[];
/**
Control what method is used to detect module-format JS files.
@default 'auto'
*/
moduleDetection?: CompilerOptions.ModuleDetection;
/**
Allows TypeScript files to import each other with a TypeScript-specific extension like .ts, .mts, or .tsx.
@default false
*/
allowImportingTsExtensions?: boolean;
/**
Forces TypeScript to consult the exports field of package.json files if it ever reads from a package in node_modules.
@default false
*/
resolvePackageJsonExports?: boolean;
/**
Forces TypeScript to consult the imports field of package.json files when performing a lookup that starts with # from a file whose ancestor directory contains a package.json.
@default false
*/
resolvePackageJsonImports?: boolean;
/**
Suppress errors for file formats that TypeScript does not understand.
@default false
*/
allowArbitraryExtensions?: boolean;
/**
List of additional conditions that should succeed when TypeScript resolves from package.json.
*/
customConditions?: string[];
/**
Anything that uses the type modifier is dropped entirely.
@default false
*/
verbatimModuleSyntax?: boolean;
/**
Suppress deprecation warnings
*/
ignoreDeprecations?: CompilerOptions.IgnoreDeprecations;
};
namespace WatchOptions {
@ -1101,8 +1162,6 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching individual files.
Requires TypeScript version 3.8 or later.
@default 'UseFsEvents'
*/
watchFile?: WatchOptions.WatchFileKind | Lowercase<WatchOptions.WatchFileKind>;
@ -1110,16 +1169,12 @@ declare namespace TsConfigJson {
/**
Specify the strategy for watching directories under systems that lack recursive file-watching functionality.
Requires TypeScript version 3.8 or later.
@default 'UseFsEvents'
*/
watchDirectory?: WatchOptions.WatchDirectoryKind | Lowercase<WatchOptions.WatchDirectoryKind>;
/**
Specify the polling strategy to use when the system runs out of or doesn't support native file watchers.
Requires TypeScript version 3.8 or later.
*/
fallbackPolling?: WatchOptions.PollingWatchKind | Lowercase<WatchOptions.PollingWatchKind>;
@ -1141,8 +1196,6 @@ declare namespace TsConfigJson {
/**
Auto type (.d.ts) acquisition options for this project.
Requires TypeScript version 2.1 or later.
*/
export type TypeAcquisition = {
/**
@ -1176,6 +1229,7 @@ declare namespace TsConfigJson {
True if the output of this reference should be prepended to the output of this project.
Only valid for `--outFile` compilations.
@deprecated This option will be removed in TypeScript 5.5.
*/
prepend?: boolean;
@ -1204,8 +1258,6 @@ type TsConfigJson = {
/**
Auto type (.d.ts) acquisition options for this project.
Requires TypeScript version 2.1 or later.
*/
typeAcquisition?: TsConfigJson.TypeAcquisition;
@ -1216,10 +1268,8 @@ type TsConfigJson = {
/**
Path to base configuration file to inherit from.
Requires TypeScript version 2.1 or later.
*/
extends?: string;
extends?: string | string[];
/**
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`. When a `files` property is specified, only those files and those specified by `include` are included.
@ -1237,15 +1287,11 @@ type TsConfigJson = {
Specifies a list of glob patterns that match files to be included in compilation.
If no `files` or `include` property is present in a `tsconfig.json`, the compiler defaults to including all files in the containing directory and subdirectories except those specified by `exclude`.
Requires TypeScript version 2.0 or later.
*/
include?: string[];
/**
Referenced projects.
Requires TypeScript version 3.0 or later.
*/
references?: TsConfigJson.References[];
};
@ -1262,14 +1308,17 @@ type TsConfigResult = {
config: TsConfigJsonResolved;
};
declare function getTsconfig(searchPath?: string, configName?: string): TsConfigResult | null;
declare const getTsconfig: (searchPath?: string, configName?: string) => TsConfigResult | null;
declare function parseTsconfig(tsconfigPath: string): TsConfigJsonResolved;
declare const parseTsconfig: (tsconfigPath: string) => TsConfigJsonResolved;
/**
* Reference:
* https://github.com/microsoft/TypeScript/blob/3ccbe804f850f40d228d3c875be952d94d39aa1d/src/compiler/moduleNameResolver.ts#L2465
*/
declare function createPathsMatcher(tsconfig: TsConfigResult): ((specifier: string) => string[]) | null;
declare const createPathsMatcher: (tsconfig: TsConfigResult) => ((specifier: string) => string[]) | null;
export { TsConfigJson, TsConfigJsonResolved, TsConfigResult, createPathsMatcher, getTsconfig, parseTsconfig };
type FileMatcher = (filePath: string) => (TsConfigJsonResolved | undefined);
declare const createFilesMatcher: ({ config, path: tsconfigPath, }: TsConfigResult, caseSensitivePaths?: boolean) => FileMatcher;
export { FileMatcher, TsConfigJson, TsConfigJsonResolved, TsConfigResult, createFilesMatcher, createPathsMatcher, getTsconfig, parseTsconfig };

File diff suppressed because one or more lines are too long

View file

@ -1,6 +1,6 @@
{
"name": "get-tsconfig",
"version": "4.3.0",
"version": "4.6.2",
"description": "Find and parse the tsconfig.json file from a directory path",
"keywords": [
"get-tsconfig",
@ -39,5 +39,8 @@
"development": "./src/index.ts",
"default": "./dist/index.mjs"
}
},
"dependencies": {
"resolve-pkg-maps": "^1.0.0"
}
}