Add node modules and compiled JavaScript from main (#57)
Co-authored-by: Oliver King <oking3@uncc.edu>
This commit is contained in:
parent
d893f27da9
commit
7f7e5ba5ea
6750 changed files with 1745644 additions and 10860 deletions
248
node_modules/ansi-escapes/index.d.ts
generated
vendored
Normal file
248
node_modules/ansi-escapes/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,248 @@
|
|||
/// <reference types="node"/>
|
||||
import {LiteralUnion} from 'type-fest';
|
||||
|
||||
declare namespace ansiEscapes {
|
||||
interface ImageOptions {
|
||||
/**
|
||||
The width is given as a number followed by a unit, or the word `'auto'`.
|
||||
|
||||
- `N`: N character cells.
|
||||
- `Npx`: N pixels.
|
||||
- `N%`: N percent of the session's width or height.
|
||||
- `auto`: The image's inherent size will be used to determine an appropriate dimension.
|
||||
*/
|
||||
readonly width?: LiteralUnion<'auto', number | string>;
|
||||
|
||||
/**
|
||||
The height is given as a number followed by a unit, or the word `'auto'`.
|
||||
|
||||
- `N`: N character cells.
|
||||
- `Npx`: N pixels.
|
||||
- `N%`: N percent of the session's width or height.
|
||||
- `auto`: The image's inherent size will be used to determine an appropriate dimension.
|
||||
*/
|
||||
readonly height?: LiteralUnion<'auto', number | string>;
|
||||
|
||||
readonly preserveAspectRatio?: boolean;
|
||||
}
|
||||
|
||||
interface AnnotationOptions {
|
||||
/**
|
||||
Nonzero number of columns to annotate.
|
||||
|
||||
Default: The remainder of the line.
|
||||
*/
|
||||
readonly length?: number;
|
||||
|
||||
/**
|
||||
Starting X coordinate.
|
||||
|
||||
Must be used with `y` and `length`.
|
||||
|
||||
Default: The cursor position
|
||||
*/
|
||||
readonly x?: number;
|
||||
|
||||
/**
|
||||
Starting Y coordinate.
|
||||
|
||||
Must be used with `x` and `length`.
|
||||
|
||||
Default: Cursor position.
|
||||
*/
|
||||
readonly y?: number;
|
||||
|
||||
/**
|
||||
Create a "hidden" annotation.
|
||||
|
||||
Annotations created this way can be shown using the "Show Annotations" iTerm command.
|
||||
*/
|
||||
readonly isHidden?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare const ansiEscapes: {
|
||||
/**
|
||||
Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
|
||||
*/
|
||||
cursorTo(x: number, y?: number): string;
|
||||
|
||||
/**
|
||||
Set the position of the cursor relative to its current position.
|
||||
*/
|
||||
cursorMove(x: number, y?: number): string;
|
||||
|
||||
/**
|
||||
Move cursor up a specific amount of rows.
|
||||
|
||||
@param count - Count of rows to move up. Default is `1`.
|
||||
*/
|
||||
cursorUp(count?: number): string;
|
||||
|
||||
/**
|
||||
Move cursor down a specific amount of rows.
|
||||
|
||||
@param count - Count of rows to move down. Default is `1`.
|
||||
*/
|
||||
cursorDown(count?: number): string;
|
||||
|
||||
/**
|
||||
Move cursor forward a specific amount of rows.
|
||||
|
||||
@param count - Count of rows to move forward. Default is `1`.
|
||||
*/
|
||||
cursorForward(count?: number): string;
|
||||
|
||||
/**
|
||||
Move cursor backward a specific amount of rows.
|
||||
|
||||
@param count - Count of rows to move backward. Default is `1`.
|
||||
*/
|
||||
cursorBackward(count?: number): string;
|
||||
|
||||
/**
|
||||
Move cursor to the left side.
|
||||
*/
|
||||
cursorLeft: string;
|
||||
|
||||
/**
|
||||
Save cursor position.
|
||||
*/
|
||||
cursorSavePosition: string;
|
||||
|
||||
/**
|
||||
Restore saved cursor position.
|
||||
*/
|
||||
cursorRestorePosition: string;
|
||||
|
||||
/**
|
||||
Get cursor position.
|
||||
*/
|
||||
cursorGetPosition: string;
|
||||
|
||||
/**
|
||||
Move cursor to the next line.
|
||||
*/
|
||||
cursorNextLine: string;
|
||||
|
||||
/**
|
||||
Move cursor to the previous line.
|
||||
*/
|
||||
cursorPrevLine: string;
|
||||
|
||||
/**
|
||||
Hide cursor.
|
||||
*/
|
||||
cursorHide: string;
|
||||
|
||||
/**
|
||||
Show cursor.
|
||||
*/
|
||||
cursorShow: string;
|
||||
|
||||
/**
|
||||
Erase from the current cursor position up the specified amount of rows.
|
||||
|
||||
@param count - Count of rows to erase.
|
||||
*/
|
||||
eraseLines(count: number): string;
|
||||
|
||||
/**
|
||||
Erase from the current cursor position to the end of the current line.
|
||||
*/
|
||||
eraseEndLine: string;
|
||||
|
||||
/**
|
||||
Erase from the current cursor position to the start of the current line.
|
||||
*/
|
||||
eraseStartLine: string;
|
||||
|
||||
/**
|
||||
Erase the entire current line.
|
||||
*/
|
||||
eraseLine: string;
|
||||
|
||||
/**
|
||||
Erase the screen from the current line down to the bottom of the screen.
|
||||
*/
|
||||
eraseDown: string;
|
||||
|
||||
/**
|
||||
Erase the screen from the current line up to the top of the screen.
|
||||
*/
|
||||
eraseUp: string;
|
||||
|
||||
/**
|
||||
Erase the screen and move the cursor the top left position.
|
||||
*/
|
||||
eraseScreen: string;
|
||||
|
||||
/**
|
||||
Scroll display up one line.
|
||||
*/
|
||||
scrollUp: string;
|
||||
|
||||
/**
|
||||
Scroll display down one line.
|
||||
*/
|
||||
scrollDown: string;
|
||||
|
||||
/**
|
||||
Clear the terminal screen. (Viewport)
|
||||
*/
|
||||
clearScreen: string;
|
||||
|
||||
/**
|
||||
Clear the whole terminal, including scrollback buffer. (Not just the visible part of it)
|
||||
*/
|
||||
clearTerminal: string;
|
||||
|
||||
/**
|
||||
Output a beeping sound.
|
||||
*/
|
||||
beep: string;
|
||||
|
||||
/**
|
||||
Create a clickable link.
|
||||
|
||||
[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.
|
||||
*/
|
||||
link(text: string, url: string): string;
|
||||
|
||||
/**
|
||||
Display an image.
|
||||
|
||||
_Currently only supported on iTerm2 >=3_
|
||||
|
||||
See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
|
||||
|
||||
@param buffer - Buffer of an image. Usually read in with `fs.readFile()`.
|
||||
*/
|
||||
image(buffer: Buffer, options?: ansiEscapes.ImageOptions): string;
|
||||
|
||||
iTerm: {
|
||||
/**
|
||||
[Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
|
||||
|
||||
@param cwd - Current directory. Default: `process.cwd()`.
|
||||
*/
|
||||
setCwd(cwd?: string): string;
|
||||
|
||||
/**
|
||||
An annotation looks like this when shown:
|
||||
|
||||

|
||||
|
||||
See the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.
|
||||
|
||||
@param message - The message to display within the annotation. The `|` character is disallowed and will be stripped.
|
||||
@returns An escape code which will create an annotation when printed in iTerm2.
|
||||
*/
|
||||
annotation(message: string, options?: ansiEscapes.AnnotationOptions): string;
|
||||
};
|
||||
|
||||
// TODO: remove this in the next major version
|
||||
default: typeof ansiEscapes;
|
||||
};
|
||||
|
||||
export = ansiEscapes;
|
157
node_modules/ansi-escapes/index.js
generated
vendored
Normal file
157
node_modules/ansi-escapes/index.js
generated
vendored
Normal file
|
@ -0,0 +1,157 @@
|
|||
'use strict';
|
||||
const ansiEscapes = module.exports;
|
||||
// TODO: remove this in the next major version
|
||||
module.exports.default = ansiEscapes;
|
||||
|
||||
const ESC = '\u001B[';
|
||||
const OSC = '\u001B]';
|
||||
const BEL = '\u0007';
|
||||
const SEP = ';';
|
||||
const isTerminalApp = process.env.TERM_PROGRAM === 'Apple_Terminal';
|
||||
|
||||
ansiEscapes.cursorTo = (x, y) => {
|
||||
if (typeof x !== 'number') {
|
||||
throw new TypeError('The `x` argument is required');
|
||||
}
|
||||
|
||||
if (typeof y !== 'number') {
|
||||
return ESC + (x + 1) + 'G';
|
||||
}
|
||||
|
||||
return ESC + (y + 1) + ';' + (x + 1) + 'H';
|
||||
};
|
||||
|
||||
ansiEscapes.cursorMove = (x, y) => {
|
||||
if (typeof x !== 'number') {
|
||||
throw new TypeError('The `x` argument is required');
|
||||
}
|
||||
|
||||
let ret = '';
|
||||
|
||||
if (x < 0) {
|
||||
ret += ESC + (-x) + 'D';
|
||||
} else if (x > 0) {
|
||||
ret += ESC + x + 'C';
|
||||
}
|
||||
|
||||
if (y < 0) {
|
||||
ret += ESC + (-y) + 'A';
|
||||
} else if (y > 0) {
|
||||
ret += ESC + y + 'B';
|
||||
}
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
ansiEscapes.cursorUp = (count = 1) => ESC + count + 'A';
|
||||
ansiEscapes.cursorDown = (count = 1) => ESC + count + 'B';
|
||||
ansiEscapes.cursorForward = (count = 1) => ESC + count + 'C';
|
||||
ansiEscapes.cursorBackward = (count = 1) => ESC + count + 'D';
|
||||
|
||||
ansiEscapes.cursorLeft = ESC + 'G';
|
||||
ansiEscapes.cursorSavePosition = isTerminalApp ? '\u001B7' : ESC + 's';
|
||||
ansiEscapes.cursorRestorePosition = isTerminalApp ? '\u001B8' : ESC + 'u';
|
||||
ansiEscapes.cursorGetPosition = ESC + '6n';
|
||||
ansiEscapes.cursorNextLine = ESC + 'E';
|
||||
ansiEscapes.cursorPrevLine = ESC + 'F';
|
||||
ansiEscapes.cursorHide = ESC + '?25l';
|
||||
ansiEscapes.cursorShow = ESC + '?25h';
|
||||
|
||||
ansiEscapes.eraseLines = count => {
|
||||
let clear = '';
|
||||
|
||||
for (let i = 0; i < count; i++) {
|
||||
clear += ansiEscapes.eraseLine + (i < count - 1 ? ansiEscapes.cursorUp() : '');
|
||||
}
|
||||
|
||||
if (count) {
|
||||
clear += ansiEscapes.cursorLeft;
|
||||
}
|
||||
|
||||
return clear;
|
||||
};
|
||||
|
||||
ansiEscapes.eraseEndLine = ESC + 'K';
|
||||
ansiEscapes.eraseStartLine = ESC + '1K';
|
||||
ansiEscapes.eraseLine = ESC + '2K';
|
||||
ansiEscapes.eraseDown = ESC + 'J';
|
||||
ansiEscapes.eraseUp = ESC + '1J';
|
||||
ansiEscapes.eraseScreen = ESC + '2J';
|
||||
ansiEscapes.scrollUp = ESC + 'S';
|
||||
ansiEscapes.scrollDown = ESC + 'T';
|
||||
|
||||
ansiEscapes.clearScreen = '\u001Bc';
|
||||
|
||||
ansiEscapes.clearTerminal = process.platform === 'win32' ?
|
||||
`${ansiEscapes.eraseScreen}${ESC}0f` :
|
||||
// 1. Erases the screen (Only done in case `2` is not supported)
|
||||
// 2. Erases the whole screen including scrollback buffer
|
||||
// 3. Moves cursor to the top-left position
|
||||
// More info: https://www.real-world-systems.com/docs/ANSIcode.html
|
||||
`${ansiEscapes.eraseScreen}${ESC}3J${ESC}H`;
|
||||
|
||||
ansiEscapes.beep = BEL;
|
||||
|
||||
ansiEscapes.link = (text, url) => {
|
||||
return [
|
||||
OSC,
|
||||
'8',
|
||||
SEP,
|
||||
SEP,
|
||||
url,
|
||||
BEL,
|
||||
text,
|
||||
OSC,
|
||||
'8',
|
||||
SEP,
|
||||
SEP,
|
||||
BEL
|
||||
].join('');
|
||||
};
|
||||
|
||||
ansiEscapes.image = (buffer, options = {}) => {
|
||||
let ret = `${OSC}1337;File=inline=1`;
|
||||
|
||||
if (options.width) {
|
||||
ret += `;width=${options.width}`;
|
||||
}
|
||||
|
||||
if (options.height) {
|
||||
ret += `;height=${options.height}`;
|
||||
}
|
||||
|
||||
if (options.preserveAspectRatio === false) {
|
||||
ret += ';preserveAspectRatio=0';
|
||||
}
|
||||
|
||||
return ret + ':' + buffer.toString('base64') + BEL;
|
||||
};
|
||||
|
||||
ansiEscapes.iTerm = {
|
||||
setCwd: (cwd = process.cwd()) => `${OSC}50;CurrentDir=${cwd}${BEL}`,
|
||||
|
||||
annotation: (message, options = {}) => {
|
||||
let ret = `${OSC}1337;`;
|
||||
|
||||
const hasX = typeof options.x !== 'undefined';
|
||||
const hasY = typeof options.y !== 'undefined';
|
||||
if ((hasX || hasY) && !(hasX && hasY && typeof options.length !== 'undefined')) {
|
||||
throw new Error('`x`, `y` and `length` must be defined when `x` or `y` is defined');
|
||||
}
|
||||
|
||||
message = message.replace(/\|/g, '');
|
||||
|
||||
ret += options.isHidden ? 'AddHiddenAnnotation=' : 'AddAnnotation=';
|
||||
|
||||
if (options.length > 0) {
|
||||
ret +=
|
||||
(hasX ?
|
||||
[message, options.length, options.x, options.y] :
|
||||
[options.length, message]).join('|');
|
||||
} else {
|
||||
ret += message;
|
||||
}
|
||||
|
||||
return ret + BEL;
|
||||
}
|
||||
};
|
9
node_modules/ansi-escapes/license
generated
vendored
Normal file
9
node_modules/ansi-escapes/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (https://sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
26
node_modules/ansi-escapes/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
26
node_modules/ansi-escapes/node_modules/type-fest/index.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,26 @@
|
|||
// Basic
|
||||
export * from './source/basic';
|
||||
|
||||
// Utilities
|
||||
export {Except} from './source/except';
|
||||
export {Mutable} from './source/mutable';
|
||||
export {Merge} from './source/merge';
|
||||
export {MergeExclusive} from './source/merge-exclusive';
|
||||
export {RequireAtLeastOne} from './source/require-at-least-one';
|
||||
export {RequireExactlyOne} from './source/require-exactly-one';
|
||||
export {PartialDeep} from './source/partial-deep';
|
||||
export {ReadonlyDeep} from './source/readonly-deep';
|
||||
export {LiteralUnion} from './source/literal-union';
|
||||
export {Promisable} from './source/promisable';
|
||||
export {Opaque} from './source/opaque';
|
||||
export {SetOptional} from './source/set-optional';
|
||||
export {SetRequired} from './source/set-required';
|
||||
export {PromiseValue} from './source/promise-value';
|
||||
export {AsyncReturnType} from './source/async-return-type';
|
||||
export {ConditionalExcept} from './source/conditional-except';
|
||||
export {ConditionalKeys} from './source/conditional-keys';
|
||||
export {ConditionalPick} from './source/conditional-pick';
|
||||
|
||||
// Miscellaneous
|
||||
export {PackageJson} from './source/package-json';
|
||||
export {TsConfigJson} from './source/tsconfig-json';
|
9
node_modules/ansi-escapes/node_modules/type-fest/license
generated
vendored
Normal file
9
node_modules/ansi-escapes/node_modules/type-fest/license
generated
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) Sindre Sorhus <sindresorhus@gmail.com> (sindresorhus.com)
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
54
node_modules/ansi-escapes/node_modules/type-fest/package.json
generated
vendored
Normal file
54
node_modules/ansi-escapes/node_modules/type-fest/package.json
generated
vendored
Normal file
|
@ -0,0 +1,54 @@
|
|||
{
|
||||
"name": "type-fest",
|
||||
"version": "0.11.0",
|
||||
"description": "A collection of essential TypeScript types",
|
||||
"license": "(MIT OR CC0-1.0)",
|
||||
"repository": "sindresorhus/type-fest",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"source"
|
||||
],
|
||||
"keywords": [
|
||||
"typescript",
|
||||
"ts",
|
||||
"types",
|
||||
"utility",
|
||||
"util",
|
||||
"utilities",
|
||||
"omit",
|
||||
"merge",
|
||||
"json"
|
||||
],
|
||||
"devDependencies": {
|
||||
"@sindresorhus/tsconfig": "^0.7.0",
|
||||
"@typescript-eslint/eslint-plugin": "2.17.0",
|
||||
"@typescript-eslint/parser": "2.17.0",
|
||||
"eslint-config-xo-typescript": "^0.24.1",
|
||||
"tsd": "^0.7.3",
|
||||
"typescript": "3.7.5",
|
||||
"xo": "^0.25.3"
|
||||
},
|
||||
"types": "index.d.ts",
|
||||
"xo": {
|
||||
"extends": "xo-typescript",
|
||||
"extensions": [
|
||||
"ts"
|
||||
],
|
||||
"rules": {
|
||||
"import/no-unresolved": "off",
|
||||
"@typescript-eslint/indent": "off"
|
||||
}
|
||||
}
|
||||
}
|
637
node_modules/ansi-escapes/node_modules/type-fest/readme.md
generated
vendored
Normal file
637
node_modules/ansi-escapes/node_modules/type-fest/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,637 @@
|
|||
<div align="center">
|
||||
<br>
|
||||
<br>
|
||||
<img src="media/logo.svg" alt="type-fest" height="300">
|
||||
<br>
|
||||
<br>
|
||||
<b>A collection of essential TypeScript types</b>
|
||||
<br>
|
||||
<hr>
|
||||
</div>
|
||||
<br>
|
||||
<br>
|
||||
|
||||
[](https://travis-ci.com/sindresorhus/type-fest)
|
||||
[](https://www.youtube.com/watch?v=9auOCbH5Ns4)
|
||||
<!-- Commented out until they actually show anything
|
||||
[](https://www.npmjs.com/package/type-fest?activeTab=dependents) [](https://www.npmjs.com/package/type-fest)
|
||||
-->
|
||||
|
||||
Many of the types here should have been built-in. You can help by suggesting some of them to the [TypeScript project](https://github.com/Microsoft/TypeScript/blob/master/CONTRIBUTING.md).
|
||||
|
||||
Either add this package as a dependency or copy-paste the needed types. No credit required. 👌
|
||||
|
||||
PR welcome for additional commonly needed types and docs improvements. Read the [contributing guidelines](.github/contributing.md) first.
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install type-fest
|
||||
```
|
||||
|
||||
*Requires TypeScript >=3.2*
|
||||
|
||||
## Usage
|
||||
|
||||
```ts
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
unicorn: string;
|
||||
rainbow: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutRainbow = Except<Foo, 'rainbow'>;
|
||||
//=> {unicorn: string}
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
Click the type names for complete docs.
|
||||
|
||||
### Basic
|
||||
|
||||
- [`Primitive`](source/basic.d.ts) - Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
- [`Class`](source/basic.d.ts) - Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
- [`TypedArray`](source/basic.d.ts) - Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
- [`JsonObject`](source/basic.d.ts) - Matches a JSON object.
|
||||
- [`JsonArray`](source/basic.d.ts) - Matches a JSON array.
|
||||
- [`JsonValue`](source/basic.d.ts) - Matches any valid JSON value.
|
||||
- [`ObservableLike`](source/basic.d.ts) - Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
|
||||
### Utilities
|
||||
|
||||
- [`Except`](source/except.d.ts) - Create a type from an object type without certain keys. This is a stricter version of [`Omit`](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-5.html#the-omit-helper-type).
|
||||
- [`Mutable`](source/mutable.d.ts) - Convert an object with `readonly` keys into a mutable object. The inverse of `Readonly<T>`.
|
||||
- [`Merge`](source/merge.d.ts) - Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
- [`MergeExclusive`](source/merge-exclusive.d.ts) - Create a type that has mutually exclusive keys.
|
||||
- [`RequireAtLeastOne`](source/require-at-least-one.d.ts) - Create a type that requires at least one of the given keys.
|
||||
- [`RequireExactlyOne`](source/require-exactly-one.d.ts) - Create a type that requires exactly a single key of the given keys and disallows more.
|
||||
- [`PartialDeep`](source/partial-deep.d.ts) - Create a deeply optional version of another type. Use [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) if you only need one level deep.
|
||||
- [`ReadonlyDeep`](source/readonly-deep.d.ts) - Create a deeply immutable version of an `object`/`Map`/`Set`/`Array` type. Use [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) if you only need one level deep.
|
||||
- [`LiteralUnion`](source/literal-union.d.ts) - Create a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union. Workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729).
|
||||
- [`Promisable`](source/promisable.d.ts) - Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
- [`Opaque`](source/opaque.d.ts) - Create an [opaque type](https://codemix.com/opaque-types-in-javascript/).
|
||||
- [`SetOptional`](source/set-optional.d.ts) - Create a type that makes the given keys optional.
|
||||
- [`SetRequired`](source/set-required.d.ts) - Create a type that makes the given keys required.
|
||||
- [`PromiseValue`](source/promise-value.d.ts) - Returns the type that is wrapped inside a `Promise`.
|
||||
- [`AsyncReturnType`](source/async-return-type.d.ts) - Unwrap the return type of a function that returns a `Promise`.
|
||||
- [`ConditionalKeys`](source/conditional-keys.d.ts) - Extract keys from a shape where values extend the given `Condition` type.
|
||||
- [`ConditionalPick`](source/conditional-pick.d.ts) - Like `Pick` except it selects properties from a shape where the values extend the given `Condition` type.
|
||||
- [`ConditionalExcept`](source/conditional-except.d.ts) - Like `Omit` except it removes properties from a shape where the values extend the given `Condition` type.
|
||||
|
||||
### Miscellaneous
|
||||
|
||||
- [`PackageJson`](source/package-json.d.ts) - Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file).
|
||||
- [`TsConfigJson`](source/tsconfig-json.d.ts) - Type for [TypeScript's `tsconfig.json` file](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html) (TypeScript 3.7).
|
||||
|
||||
## Declined types
|
||||
|
||||
*If we decline a type addition, we will make sure to document the better solution here.*
|
||||
|
||||
- [`Diff` and `Spread`](https://github.com/sindresorhus/type-fest/pull/7) - The PR author didn't provide any real-world use-cases and the PR went stale. If you think this type is useful, provide some real-world use-cases and we might reconsider.
|
||||
- [`Dictionary`](https://github.com/sindresorhus/type-fest/issues/33) - You only save a few characters (`Dictionary<number>` vs `Record<string, number>`) from [`Record`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434), which is more flexible and well-known. Also, you shouldn't use an object as a dictionary. We have `Map` in JavaScript now.
|
||||
|
||||
## Tips
|
||||
|
||||
### Built-in types
|
||||
|
||||
There are many advanced types most users don't know about.
|
||||
|
||||
- [`Partial<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1401-L1406) - Make all properties in `T` optional.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://www.typescriptlang.org/play/#code/JYOwLgpgTgZghgYwgAgHIHsAmEDC6QzADmyA3gLABQyycADnanALYQBcyAzmFKEQNxUaddFDAcQAV2YAjaIMoBfKlQQAbOJ05osEAIIMAQpOBrsUMkOR1eANziRkCfISKSoD4Pg4ZseAsTIALyW1DS0DEysHADkvvoMMQA0VsKi4sgAzAAMuVaKClY2wPaOknSYDrguADwA0sgQAB6QIJjaANYQAJ7oMDp+LsQAfAAUXd0cdUnI9mo+uv6uANp1ALoAlKHhyGAAFsCcAHTOAW4eYF4gyxNrwbNwago0ypRWp66jH8QcAApwYmAjxq8SWIy2FDCNDA3ToKFBQyIdR69wmfQG1TOhShyBgomQX3w3GQE2Q6IA8jIAFYQBBgI4TTiEs5bTQYsFInrLTbbHZOIlgZDlSqQABqj0kKBC3yINx6a2xfOQwH6o2FVXFaklwSCIUkbQghBAEEwENSfNOlykEGefNe5uhB2O6sgS3GPRmLogmslG1tLxUOKgEDA7hAuydtteryAA)
|
||||
|
||||
```ts
|
||||
interface NodeConfig {
|
||||
appName: string;
|
||||
port: number;
|
||||
}
|
||||
|
||||
class NodeAppBuilder {
|
||||
private configuration: NodeConfig = {
|
||||
appName: 'NodeApp',
|
||||
port: 3000
|
||||
};
|
||||
|
||||
private updateConfig<Key extends keyof NodeConfig>(key: Key, value: NodeConfig[Key]) {
|
||||
this.configuration[key] = value;
|
||||
}
|
||||
|
||||
config(config: Partial<NodeConfig>) {
|
||||
type NodeConfigKey = keyof NodeConfig;
|
||||
|
||||
for (const key of Object.keys(config) as NodeConfigKey[]) {
|
||||
const updateValue = config[key];
|
||||
|
||||
if (updateValue === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
this.updateConfig(key, updateValue);
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
// `Partial<NodeConfig>`` allows us to provide only a part of the
|
||||
// NodeConfig interface.
|
||||
new NodeAppBuilder().config({appName: 'ToDoApp'});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Required<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1408-L1413) - Make all properties in `T` required.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgGED21VQGJZwC2wA3gFCjXAzFJgA2A-AFzADOUckA5gNxUaIYjA4ckvGG07c+g6gF8KQkAgCuEFFDA5O6gEbEwUbLm2ESwABQIixACJIoSdgCUYAR3Vg4MACYAPGYuFvYAfACU5Ko0APRxwADKMBD+wFAAFuh2Vv7OSBlYGdmc8ABu8LHKsRyGxqY4oQT21pTCIHQMjOwA5DAAHgACxAAOjDAAdChYxL0ANLHUouKSMH0AEmAAhJhY6ozpAJ77GTCMjMCiV0ToSAb7UJPPC9WRgrEJwAAqR6MwSRQPFGUFocDgRHYxnEfGAowh-zgUCOwF6KwkUl6tXqJhCeEsxDaS1AXSYfUGI3GUxmc0WSneQA)
|
||||
|
||||
```ts
|
||||
interface ContactForm {
|
||||
email?: string;
|
||||
message?: string;
|
||||
}
|
||||
|
||||
function submitContactForm(formData: Required<ContactForm>) {
|
||||
// Send the form data to the server.
|
||||
}
|
||||
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
message: 'Hi! Could you tell me more about…',
|
||||
});
|
||||
|
||||
// TypeScript error: missing property 'message'
|
||||
submitContactForm({
|
||||
email: 'ex@mple.com',
|
||||
});
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Readonly<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1415-L1420) - Make all properties in `T` readonly.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4UwOwVwW2AZA9gc3mAbmANsA3gKFCOAHkAzMgGkOJABEwAjKZa2kAUQCcvEu32AMQCGAF2FYBIAL4BufDRABLCKLBcywgMZgEKZOoDCiCGSXI8i4hGEwwALmABnUVxXJ57YFgzZHSVF8sT1BpBSItLGEnJz1kAy5LLy0TM2RHACUwYQATEywATwAeAITjU3MAPnkrCJMXLigtUT4AClxgGztKbyDgaX99I1TzAEokr1BRAAslJwA6FIqLAF48TtswHp9MHDla9hJGACswZvmyLjAwAC8wVpm5xZHkUZDaMKIwqyWXYCW0oN4sNlsA1h0ug5gAByACyBQAggAHJHQ7ZBIFoXbzBjMCz7OoQP5YIaJNYQMAAdziCVaALGNSIAHomcAACoFJFgADKWjcSNEwG4vC4ji0wggEEQguiTnMEGALWAV1yAFp8gVgEjeFyuKICvMrCTgVxnst5jtsGC4ljsPNhXxGaAWcAAOq6YRXYDCRg+RWIcA5JSC+kWdCepQ+v3RYCU3RInzRMCGwlpC19NYBW1Ye08R1AA)
|
||||
|
||||
```ts
|
||||
enum LogLevel {
|
||||
Off,
|
||||
Debug,
|
||||
Error,
|
||||
Fatal
|
||||
};
|
||||
|
||||
interface LoggerConfig {
|
||||
name: string;
|
||||
level: LogLevel;
|
||||
}
|
||||
|
||||
class Logger {
|
||||
config: Readonly<LoggerConfig>;
|
||||
|
||||
constructor({name, level}: LoggerConfig) {
|
||||
this.config = {name, level};
|
||||
Object.freeze(this.config);
|
||||
}
|
||||
}
|
||||
|
||||
const config: LoggerConfig = {
|
||||
name: 'MyApp',
|
||||
level: LogLevel.Debug
|
||||
};
|
||||
|
||||
const logger = new Logger(config);
|
||||
|
||||
// TypeScript Error: cannot assign to read-only property.
|
||||
logger.config.level = LogLevel.Error;
|
||||
|
||||
// We are able to edit config variable as we please.
|
||||
config.level = LogLevel.Error;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Pick<T, K>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1422-L1427) - From `T`, pick a set of properties whose keys are in the union `K`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4SwOwFwUwJwGYEMDGNgEE5TCgNugN4BQoZwOUBAXMAM5RyQDmA3KeSFABYCuAtgCMISMHloMmENh04oA9tBjQJjFuzIBfYrOAB6PcADCcGElh1gEGAHcKATwAO6ebyjB5CTNlwFwSxFR0BX5HeToYABNgBDh5fm8cfBg6AHIKG3ldA2BHOOcfFNpUygJ0pAhokr4hETFUgDpswywkggAFUwA3MFtgAF5gQgowKhhVKTYKGuFRcXo1aVZgbTIoJ3RW3xhOmB6+wfbcAGsAHi3kgBpgEtGy4AAfG54BWfqAPnZm4AAlZUj4MAkMA8GAGB4vEgfMlLLw6CwPBA8PYRmMgZVgAC6CgmI4cIommQELwICh8RBgKZKvALh1ur0bHQABR5PYMui0Wk7em2ADaAF0AJS0AASABUALIAGQAogR+Mp3CROCAFBBwVC2ikBpj5CgBIqGjizLA5TAFdAmalImAuqlBRoVQh5HBgEy1eDWfs7J5cjzGYKhroVfpDEhHM4MV6GRR5NN0JrtnRg6BVirTFBeHAKYmYY6QNpdB73LmCJZBlSAXAubtvczeSmQMNSuMbmKNgBlHFgPEUNwusBIPAAQlS1xetTmxT0SDoESgdD0C4aACtHMwxytLrohawgA)
|
||||
|
||||
```ts
|
||||
interface Article {
|
||||
title: string;
|
||||
thumbnail: string;
|
||||
content: string;
|
||||
}
|
||||
|
||||
// Creates new type out of the `Article` interface composed
|
||||
// from the Articles' two properties: `title` and `thumbnail`.
|
||||
// `ArticlePreview = {title: string; thumbnail: string}`
|
||||
type ArticlePreview = Pick<Article, 'title' | 'thumbnail'>;
|
||||
|
||||
// Render a list of articles using only title and description.
|
||||
function renderArticlePreviews(previews: ArticlePreview[]): HTMLElement {
|
||||
const articles = document.createElement('div');
|
||||
|
||||
for (const preview of previews) {
|
||||
// Append preview to the articles.
|
||||
}
|
||||
|
||||
return articles;
|
||||
}
|
||||
|
||||
const articles = renderArticlePreviews([
|
||||
{
|
||||
title: 'TypeScript tutorial!',
|
||||
thumbnail: '/assets/ts.jpg'
|
||||
}
|
||||
]);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Record<K, T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1429-L1434) - Construct a type with a set of properties `K` of type `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/AQ4ejYAUHsGcCWAXBMB2dgwGbAKYC2ADgDYwCeeemCaWArgE7ADGMxAhmuQHQBQoYEnJE8wALKEARnkaxEKdMAC8wAOS0kstGuAAfdQBM8ANzxlRjXQbVaWACwC0JPB0NqA3HwGgIwAJJoWozYHCxixnAsjAhStADmwESMMJYo1Fi4HMCIaPEu+MRklHj8gpqyoeHAAKJFFFTAAN4+giDYCIxwSAByHAR4AFw5SDF5Xm2gJBzdfQPD3WPxE5PAlBxdAPLYNQAelgh4aOHDaPQEMowrIAC+3oJ+AMKMrlrAXFhSAFZ4LEhC9g4-0BmA4JBISXgiCkBQABpILrJ5MhUGhYcATGD6Bk4Hh-jNgABrPDkOBlXyQAAq9ngYmJpOAAHcEOCRjAXqwYODfoo6DhakUSph+Uh7GI4P0xER4Cj0OSQGwMP8tP1hgAlX7swwAHgRl2RvIANALSA08ABtAC6AD4VM1Wm0Kow0MMrYaHYJjGYLLJXZb3at1HYnC43Go-QHQDcvA6-JsmEJXARgCDgMYWAhjIYhDAU+YiMAAFIwex0ZmilMITCGF79TLAGRsAgJYAAZRwSEZGzEABFTOZUrJ5Yn+jwnWgeER6HB7AAKJrADpdXqS4ZqYultTG6azVfqHswPBbtauLY7fayQ7HIbAAAMwBuAEoYw9IBq2Ixs9h2eFMOQYPQObALQKJgggABeYhghCIpikkKRpOQRIknAsZUiIeCttECBEP8NSMCkjDDAARMGziuIYxHwYOjDCMBmDNnAuTxA6irdCOBB1Lh5Dqpqn66tISIykawBnOCtqqC0gbjqc9DgpGkxegOliyfJDrRkAA)
|
||||
|
||||
```ts
|
||||
// Positions of employees in our company.
|
||||
type MemberPosition = 'intern' | 'developer' | 'tech-lead';
|
||||
|
||||
// Interface describing properties of a single employee.
|
||||
interface Employee {
|
||||
firstName: string;
|
||||
lastName: string;
|
||||
yearsOfExperience: number;
|
||||
}
|
||||
|
||||
// Create an object that has all possible `MemberPosition` values set as keys.
|
||||
// Those keys will store a collection of Employees of the same position.
|
||||
const team: Record<MemberPosition, Employee[]> = {
|
||||
intern: [],
|
||||
developer: [],
|
||||
'tech-lead': [],
|
||||
};
|
||||
|
||||
// Our team has decided to help John with his dream of becoming Software Developer.
|
||||
team.intern.push({
|
||||
firstName: 'John',
|
||||
lastName: 'Doe',
|
||||
yearsOfExperience: 0
|
||||
});
|
||||
|
||||
// `Record` forces you to initialize all of the property keys.
|
||||
// TypeScript Error: "tech-lead" property is missing
|
||||
const teamEmpty: Record<MemberPosition, null> = {
|
||||
intern: null,
|
||||
developer: null,
|
||||
};
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Exclude<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1436-L1439) - Exclude from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgMrQG7QMIHsQzADmyA3gFDLIAOuUYAXMiAK4A2byAPsgM5hRQJHqwC2AI2gBucgF9y5MAE9qKAEoQAjiwj8AEnBAATNtGQBeZAAooWphu26wAGmS3e93bRC8IASgsAPmRDJRlyAHoI5ABRAA8ENhYjFFYOZGVVZBgoXFFkAAM0zh5+QRBhZhYJaAKAOkjogEkQZAQ4X2QAdwALCFbaemRgXmQtFjhOMFwq9K6ULuB0lk6U+HYwZAxJnQaYFhAEMGB8ZCIIMAAFOjAANR2IK0HGWISklIAedCgsKDwCYgAbQA5M9gQBdVzFQJ+JhiSRQMiUYYwayZCC4VHPCzmSzAspCYEBWxgFhQAZwKC+FpgJ43VwARgADH4ZFQSWSBjcZPJyPtDsdTvxKWBvr8rD1DCZoJ5HPopaYoK4EPhCEQmGKcKriLCtrhgEYkVQVT5Nr4fmZLLZtMBbFZgT0wGBqES6ghbHBIJqoBKFdBWQpjfh+DQbhY2tqiHVsbjLMVkAB+ZAAZiZaeQTHOVxu9ySjxNaujNwDVHNvzqbBGkBAdPoAfkQA)
|
||||
|
||||
```ts
|
||||
interface ServerConfig {
|
||||
port: null | string | number;
|
||||
}
|
||||
|
||||
type RequestHandler = (request: Request, response: Response) => void;
|
||||
|
||||
// Exclude `null` type from `null | string | number`.
|
||||
// In case the port is equal to `null`, we will use default value.
|
||||
function getPortValue(port: Exclude<ServerConfig['port'], null>): number {
|
||||
if (typeof port === 'string') {
|
||||
return parseInt(port, 10);
|
||||
}
|
||||
|
||||
return port;
|
||||
}
|
||||
|
||||
function startServer(handler: RequestHandler, config: ServerConfig): void {
|
||||
const server = require('http').createServer(handler);
|
||||
|
||||
const port = config.port === null ? 3000 : getPortValue(config.port);
|
||||
server.listen(port);
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Extract<T, U>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1441-L1444) - Extract from `T` those types that are assignable to `U`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/CYUwxgNghgTiAEAzArgOzAFwJYHtXzSwEdkQBJYACgEoAueVZAWwCMQYBuAKDDwGcM8MgBF4AXngBlAJ6scESgHIRi6ty5ZUGdoihgEABXZ888AN5d48ANoiAuvUat23K6ihMQ9ATE0BzV3goPy8GZjZOLgBfLi4Aejj4AEEICBwAdz54MAALKFQQ+BxEeAAHY1NgKAwoIKy0grr4DByEUpgccpgMaXgAaxBerCzi+B9-ZulygDouFHRsU1z8kKMYE1RhaqgAHkt4AHkWACt4EAAPbVRgLLWNgBp9gGlBs8uQa6yAUUuYPQwdgNpKM7nh7mMML4CgA+R5WABqUAgpDeVxuhxO1he0jsXGh8EoOBO9COx3BQPo2PBADckaR6IjkSA6PBqTgsMBzPsicdrEC7OJWXSQNwYvFEgAVTS9JLXODpeDpKBZFg4GCoWa8VACIJykAKiQWKy2YQOAioYikCg0OEMDyhRSy4DyxS24KhAAMjyi6gS8AAwjh5OD0iBFHAkJoEOksC1mnkMJq8gUQKDNttKPlnfrwYp3J5XfBHXqoKpfYkAOI4ansTxaeDADmoRSCCBYAbxhC6TDx6rwYHIRX5bScjA4bLJwoDmDwDkfbA9JMrVMVdM1TN69LgkTgwgkchUahqIA)
|
||||
|
||||
```ts
|
||||
declare function uniqueId(): number;
|
||||
|
||||
const ID = Symbol('ID');
|
||||
|
||||
interface Person {
|
||||
[ID]: number;
|
||||
name: string;
|
||||
age: number;
|
||||
}
|
||||
|
||||
// Allows changing the person data as long as the property key is of string type.
|
||||
function changePersonData<
|
||||
Obj extends Person,
|
||||
Key extends Extract<keyof Person, string>,
|
||||
Value extends Obj[Key]
|
||||
> (obj: Obj, key: Key, value: Value): void {
|
||||
obj[key] = value;
|
||||
}
|
||||
|
||||
// Tiny Andrew was born.
|
||||
const andrew = {
|
||||
[ID]: uniqueId(),
|
||||
name: 'Andrew',
|
||||
age: 0,
|
||||
};
|
||||
|
||||
// Cool, we're fine with that.
|
||||
changePersonData(andrew, 'name', 'Pony');
|
||||
|
||||
// Goverment didn't like the fact that you wanted to change your identity.
|
||||
changePersonData(andrew, ID, uniqueId());
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`NonNullable<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1446-L1449) - Exclude `null` and `undefined` from `T`.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
Works with <code>strictNullChecks</code> set to <code>true</code>. (Read more <a href="https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-0.html">here</a>)
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/C4TwDgpgBACg9gJ2AOQK4FsBGEFQLxQDOwCAlgHYDmUAPlORtrnQwDasDcAUFwPQBU-WAEMkUOADMowqAGNWwwoSgATCBIqlgpOOSjAAFsOBRSy1IQgr9cKJlSlW1mZYQA3HFH68u8xcoBlHA8EACEHJ08Aby4oKDBUTFZSWXjEFEYcAEIALihkXTR2YSSIAB54JDQsHAA+blj4xOTUsHSACkMzPKD3HHDHNQQAGjSkPMqMmoQASh7g-oihqBi4uNIpdraxPAI2VhmVxrX9AzMAOm2ppnwoAA4ABifuE4BfKAhWSyOTuK7CS7pao3AhXF5rV48E4ICDAVAIPT-cGQyG+XTEIgLMJLTx7CAAdygvRCA0iCHaMwarhJOIQjUBSHaACJHk8mYdeLwxtdcVAAOSsh58+lXdr7Dlcq7A3n3J4PEUdADMcspUE53OluAIUGVTx46oAKuAIAFZGQwCYAKIIBCILjUxaDHAMnla+iodjcIA)
|
||||
|
||||
```ts
|
||||
type PortNumber = string | number | null;
|
||||
|
||||
/** Part of a class definition that is used to build a server */
|
||||
class ServerBuilder {
|
||||
portNumber!: NonNullable<PortNumber>;
|
||||
|
||||
port(this: ServerBuilder, port: PortNumber): ServerBuilder {
|
||||
if (port == null) {
|
||||
this.portNumber = 8000;
|
||||
} else {
|
||||
this.portNumber = port;
|
||||
}
|
||||
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
const serverBuilder = new ServerBuilder();
|
||||
|
||||
serverBuilder
|
||||
.port('8000') // portNumber = '8000'
|
||||
.port(null) // portNumber = 8000
|
||||
.port(3000); // portNumber = 3000
|
||||
|
||||
// TypeScript error
|
||||
serverBuilder.portNumber = null;
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Parameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1451-L1454) - Obtain the parameters of a function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/GYVwdgxgLglg9mABAZwBYmMANgUwBQxgAOIUAXIgIZgCeA2gLoCUFAbnDACaIDeAUIkQB6IYgCypSlBxUATrMo1ECsJzgBbLEoipqAc0J7EMKMgDkiHLnU4wp46pwAPHMgB0fAL58+oSLARECEosLAA5ABUYG2QAHgAxJGdpVWREPDdMylk9ZApqemZEAF4APipacrw-CApEgBogkKwAYThwckQwEHUAIxxZJl4BYVEImiIZKF0oZRwiWVdbeygJmThgOYgcGFYcbhqApCJsyhtpWXcR1cnEePBoeDAABVPzgbTixFeFd8uEsClADcIxGiygIFkSEOT3SmTc2VydQeRx+ZxwF2QQ34gkEwDgsnSuFmMBKiAADEDjIhYk1Qm0OlSYABqZnYka4xA1DJZHJYkGc7yCbyeRA+CAIZCzNAYbA4CIAdxg2zJwVCkWirjwMswuEaACYmCCgA)
|
||||
|
||||
```ts
|
||||
function shuffle(input: any[]): void {
|
||||
// Mutate array randomly changing its' elements indexes.
|
||||
}
|
||||
|
||||
function callNTimes<Fn extends (...args: any[]) => any> (func: Fn, callCount: number) {
|
||||
// Type that represents the type of the received function parameters.
|
||||
type FunctionParameters = Parameters<Fn>;
|
||||
|
||||
return function (...args: FunctionParameters) {
|
||||
for (let i = 0; i < callCount; i++) {
|
||||
func(...args);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const shuffleTwice = callNTimes(shuffle, 2);
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ConstructorParameters<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1456-L1459) - Obtain the parameters of a constructor function type in a tuple.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECCBOAXAlqApgWQPYBM0mgG8AoaaFRENALmgkXmQDsBzAblOmCycTV4D8teo1YdO3JiICuwRFngAKClWENmLAJRFOZRAAtkEAHQq00ALzlklNBzIBfYk+KhIMAJJTEYJsDQAwmDA+mgAPAAq0GgAHnxMODCKTGgA7tCKxllg8CwQtL4AngDaALraFgB80EWa1SRkAA6MAG5gfNAB4FABPDJyCrQR9tDNyG0dwMGhtBhgjWEiGgA00F70vv4RhY3hEZXVVinpc42KmuJkkv3y8Bly8EPaDWTkhiZd7r3e8LK3llwGCMXGQWGhEOsfH5zJlsrl8p0+gw-goAAo5MAAW3BaHgEEilU0tEhmzQ212BJ0ry4SOg+kg+gBBiMximIGA0nAfAQLGk2N4EAAEgzYcYcnkLsRdDTvNEYkYUKwSdCme9WdM0MYwYhFPSIPpJdTkAAzDKxBUaZX+aAAQgsVmkCTQxuYaBw2ng4Ok8CYcotSu8pMur09iG9vuObxZnx6SN+AyUWTF8MN0CcZE4Ywm5jZHK5aB5fP4iCFIqT4oRRTKRLo6lYVNeAHpG50wOzOe1zHr9NLQ+HoABybsD4HOKXXRA1JCoKhBELmI5pNaB6Fz0KKBAodDYPAgSUTmqYsAALx4m5nC6nW9nGq14KtaEUA9gR9PvuNCjQ9BgACNvcwNBtAcLiAA)
|
||||
|
||||
```ts
|
||||
class ArticleModel {
|
||||
title: string;
|
||||
content?: string;
|
||||
|
||||
constructor(title: string) {
|
||||
this.title = title;
|
||||
}
|
||||
}
|
||||
|
||||
class InstanceCache<T extends (new (...args: any[]) => any)> {
|
||||
private ClassConstructor: T;
|
||||
private cache: Map<string, InstanceType<T>> = new Map();
|
||||
|
||||
constructor (ctr: T) {
|
||||
this.ClassConstructor = ctr;
|
||||
}
|
||||
|
||||
getInstance (...args: ConstructorParameters<T>): InstanceType<T> {
|
||||
const hash = this.calculateArgumentsHash(...args);
|
||||
|
||||
const existingInstance = this.cache.get(hash);
|
||||
if (existingInstance !== undefined) {
|
||||
return existingInstance;
|
||||
}
|
||||
|
||||
return new this.ClassConstructor(...args);
|
||||
}
|
||||
|
||||
private calculateArgumentsHash(...args: any[]): string {
|
||||
// Calculate hash.
|
||||
return 'hash';
|
||||
}
|
||||
}
|
||||
|
||||
const articleCache = new InstanceCache(ArticleModel);
|
||||
const amazonArticle = articleCache.getInstance('Amazon forests burining!');
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`ReturnType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1461-L1464) – Obtain the return type of a function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
/** Provides every element of the iterable `iter` into the `callback` function and stores the results in an array. */
|
||||
function mapIter<
|
||||
Elem,
|
||||
Func extends (elem: Elem) => any,
|
||||
Ret extends ReturnType<Func>
|
||||
>(iter: Iterable<Elem>, callback: Func): Ret[] {
|
||||
const mapped: Ret[] = [];
|
||||
|
||||
for (const elem of iter) {
|
||||
mapped.push(callback(elem));
|
||||
}
|
||||
|
||||
return mapped;
|
||||
}
|
||||
|
||||
const setObject: Set<string> = new Set();
|
||||
const mapObject: Map<number, string> = new Map();
|
||||
|
||||
mapIter(setObject, (value: string) => value.indexOf('Foo')); // number[]
|
||||
|
||||
mapIter(mapObject, ([key, value]: [number, string]) => {
|
||||
return key % 2 === 0 ? value : 'Odd';
|
||||
}); // string[]
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`InstanceType<T>`](https://github.com/Microsoft/TypeScript/blob/2961bc3fc0ea1117d4e53bc8e97fa76119bc33e3/src/lib/es5.d.ts#L1466-L1469) – Obtain the instance type of a constructor function type.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/MYGwhgzhAECSAmICmBlJAnAbgS2E6A3gFDTTwD2AcuQC4AW2AdgOYAUAlAFzSbnbyEAvkWFFQkGJSQB3GMVI1sNZNwg10TZgG4S0YOUY0kh1es07d+xmvQBXYDXLpWi5UlMaWAGj0GjJ6BtNdkJdBQYIADpXZGgAXmgYpB1ScOwoq38aeN9DYxoU6GFRKzVoJjUwRjwAYXJbPPRuAFkwAAcAHgAxBodsAx9GWwBbACMMAD4cxhloVraOCyYjdAAzMDxoOut1e0d0UNIZ6WhWSPOwdGYIbiqATwBtAF0uaHudUQB6ACpv6ABpJBINqJdAbADW0Do5BOw3u5R2VTwMHIq2gAANtjZ0bkbHsnFCwJh8ONjHp0EgwEZ4JFoN9PkRVr1FAZoMwkDRYIjqkgOrosepoEgAB7+eAwAV2BxOLy6ACCVxgIrFEoMeOl6AACpcwMMORgIB1JRMiBNWKVdhruJKfOdIpdrtwFddXlzKjyACp3Nq842HaDIbL6BrZBIVGhIpB1EMYSLsmjmtWW-YhAA+qegAAYLKQLQj3ZsEsdccmnGcLor2Dn8xGedHGpEIBzEzspfsfMHDNAANTQACMVaIljV5GQkRA5DYmIpVKQAgAJARO9le33BDXIyi0YuLW2nJFGLqkOvxFB0YPdBSaLZ0IwNzyPkO8-xkGgsLh8Al427a3hWAhXwwHA8EHT5PmgAB1bAQBAANJ24adKWpft72RaBUTgRBUCAj89HAM8xCTaBjggABRQx0DuHJv25P9dCkWRZVIAAiBjoFImpmjlFBgA0NpsjadByDacgIDAEAIAAQmYpjoGYgAZSBsmGPw6DtZiiFA8CoJguDmAQmoZ2QvtUKQLdoAYmBTwgdEiCAA)
|
||||
|
||||
```ts
|
||||
class IdleService {
|
||||
doNothing (): void {}
|
||||
}
|
||||
|
||||
class News {
|
||||
title: string;
|
||||
content: string;
|
||||
|
||||
constructor(title: string, content: string) {
|
||||
this.title = title;
|
||||
this.content = content;
|
||||
}
|
||||
}
|
||||
|
||||
const instanceCounter: Map<Function, number> = new Map();
|
||||
|
||||
interface Constructor {
|
||||
new(...args: any[]): any;
|
||||
}
|
||||
|
||||
// Keep track how many instances of `Constr` constructor have been created.
|
||||
function getInstance<
|
||||
Constr extends Constructor,
|
||||
Args extends ConstructorParameters<Constr>
|
||||
>(constructor: Constr, ...args: Args): InstanceType<Constr> {
|
||||
let count = instanceCounter.get(constructor) || 0;
|
||||
|
||||
const instance = new constructor(...args);
|
||||
|
||||
instanceCounter.set(constructor, count + 1);
|
||||
|
||||
console.log(`Created ${count + 1} instances of ${Constr.name} class`);
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
|
||||
const idleService = getInstance(IdleService);
|
||||
// Will log: `Created 1 instances of IdleService class`
|
||||
const newsEntry = getInstance(News, 'New ECMAScript proposals!', 'Last month...');
|
||||
// Will log: `Created 1 instances of News class`
|
||||
```
|
||||
</details>
|
||||
|
||||
- [`Omit<T, K>`](https://github.com/microsoft/TypeScript/blob/71af02f7459dc812e85ac31365bfe23daf14b4e4/src/lib/es5.d.ts#L1446) – Constructs a type by picking all properties from T and then removing K.
|
||||
<details>
|
||||
<summary>
|
||||
Example
|
||||
</summary>
|
||||
|
||||
[Playground](https://typescript-play.js.org/?target=6#code/JYOwLgpgTgZghgYwgAgIImAWzgG2QbwChlks4BzCAVShwC5kBnMKUcgbmKYAcIFgIjBs1YgOXMpSFMWbANoBdTiW5woFddwAW0kfKWEAvoUIB6U8gDCUCHEiNkICAHdkYAJ69kz4GC3JcPG4oAHteKDABBxCYNAxsPFBIWEQUCAAPJG4wZABySUFcgJAAEzMLXNV1ck0dIuCw6EjBADpy5AB1FAQ4EGQAV0YUP2AHDy8wEOQbUugmBLwtEIA3OcmQnEjuZBgQqE7gAGtgZAhwKHdkHFGwNvGUdDIcAGUliIBJEF3kAF5kAHlML4ADyPBIAGjyBUYRQAPnkqho4NoYQA+TiEGD9EAISIhPozErQMG4AASK2gn2+AApek9pCSXm8wFSQooAJQMUkAFQAsgAZACiOAgmDOOSIJAQ+OYyGl4DgoDmf2QJRCCH6YvALQQNjsEGFovF1NyJWAy1y7OUyHMyE+yRAuFImG4Iq1YDswHxbRINjA-SgfXlHqVUE4xiAA)
|
||||
|
||||
```ts
|
||||
interface Animal {
|
||||
imageUrl: string;
|
||||
species: string;
|
||||
images: string[];
|
||||
paragraphs: string[];
|
||||
}
|
||||
|
||||
// Creates new type with all properties of the `Animal` interface
|
||||
// except 'images' and 'paragraphs' properties. We can use this
|
||||
// type to render small hover tooltip for a wiki entry list.
|
||||
type AnimalShortInfo = Omit<Animal, 'images' | 'paragraphs'>;
|
||||
|
||||
function renderAnimalHoverInfo (animals: AnimalShortInfo[]): HTMLElement {
|
||||
const container = document.createElement('div');
|
||||
// Internal implementation.
|
||||
return container;
|
||||
}
|
||||
```
|
||||
</details>
|
||||
|
||||
You can find some examples in the [TypeScript docs](https://www.typescriptlang.org/docs/handbook/advanced-types.html#predefined-conditional-types).
|
||||
|
||||
## Maintainers
|
||||
|
||||
- [Sindre Sorhus](https://github.com/sindresorhus)
|
||||
- [Jarek Radosz](https://github.com/CvX)
|
||||
- [Dimitri Benin](https://github.com/BendingBender)
|
||||
|
||||
## License
|
||||
|
||||
(MIT OR CC0-1.0)
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-type-fest?utm_source=npm-type-fest&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
23
node_modules/ansi-escapes/node_modules/type-fest/source/async-return-type.d.ts
generated
vendored
Normal file
23
node_modules/ansi-escapes/node_modules/type-fest/source/async-return-type.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
import {PromiseValue} from './promise-value';
|
||||
|
||||
type AsyncFunction = (...args: unknown[]) => Promise<unknown>;
|
||||
|
||||
/**
|
||||
Unwrap the return type of a function that returns a `Promise`.
|
||||
|
||||
There has been [discussion](https://github.com/microsoft/TypeScript/pull/35998) about implementing this type in TypeScript.
|
||||
|
||||
@example
|
||||
```ts
|
||||
import {AsyncReturnType} from 'type-fest';
|
||||
import {asyncFunction} from 'api';
|
||||
|
||||
// This type resolves to the unwrapped return type of `asyncFunction`.
|
||||
type Value = AsyncReturnType<typeof asyncFunction>;
|
||||
|
||||
async function doSomething(value: Value) {}
|
||||
|
||||
asyncFunction().then(value => doSomething(value));
|
||||
```
|
||||
*/
|
||||
export type AsyncReturnType<Target extends AsyncFunction> = PromiseValue<ReturnType<Target>>;
|
67
node_modules/ansi-escapes/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
67
node_modules/ansi-escapes/node_modules/type-fest/source/basic.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,67 @@
|
|||
/// <reference lib="esnext"/>
|
||||
|
||||
// TODO: This can just be `export type Primitive = not object` when the `not` keyword is out.
|
||||
/**
|
||||
Matches any [primitive value](https://developer.mozilla.org/en-US/docs/Glossary/Primitive).
|
||||
*/
|
||||
export type Primitive =
|
||||
| null
|
||||
| undefined
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| symbol
|
||||
| bigint;
|
||||
|
||||
// TODO: Remove the `= unknown` sometime in the future when most users are on TS 3.5 as it's now the default
|
||||
/**
|
||||
Matches a [`class` constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes).
|
||||
*/
|
||||
export type Class<T = unknown, Arguments extends any[] = any[]> = new(...arguments_: Arguments) => T;
|
||||
|
||||
/**
|
||||
Matches any [typed array](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray), like `Uint8Array` or `Float64Array`.
|
||||
*/
|
||||
export type TypedArray =
|
||||
| Int8Array
|
||||
| Uint8Array
|
||||
| Uint8ClampedArray
|
||||
| Int16Array
|
||||
| Uint16Array
|
||||
| Int32Array
|
||||
| Uint32Array
|
||||
| Float32Array
|
||||
| Float64Array
|
||||
| BigInt64Array
|
||||
| BigUint64Array;
|
||||
|
||||
/**
|
||||
Matches a JSON object.
|
||||
|
||||
This type can be useful to enforce some input to be JSON-compatible or as a super-type to be extended from. Don't use this as a direct return type as the user would have to double-cast it: `jsonObject as unknown as CustomResponse`. Instead, you could extend your CustomResponse type from it to ensure your type only uses JSON-compatible types: `interface CustomResponse extends JsonObject { … }`.
|
||||
*/
|
||||
export type JsonObject = {[Key in string]?: JsonValue};
|
||||
|
||||
/**
|
||||
Matches a JSON array.
|
||||
*/
|
||||
export interface JsonArray extends Array<JsonValue> {}
|
||||
|
||||
/**
|
||||
Matches any valid JSON value.
|
||||
*/
|
||||
export type JsonValue = string | number | boolean | null | JsonObject | JsonArray;
|
||||
|
||||
declare global {
|
||||
interface SymbolConstructor {
|
||||
readonly observable: symbol;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Matches a value that is like an [Observable](https://github.com/tc39/proposal-observable).
|
||||
*/
|
||||
export interface ObservableLike {
|
||||
subscribe(observer: (value: unknown) => void): void;
|
||||
[Symbol.observable](): ObservableLike;
|
||||
}
|
43
node_modules/ansi-escapes/node_modules/type-fest/source/conditional-except.d.ts
generated
vendored
Normal file
43
node_modules/ansi-escapes/node_modules/type-fest/source/conditional-except.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
import {Except} from './except';
|
||||
import {ConditionalKeys} from './conditional-keys';
|
||||
|
||||
/**
|
||||
Exclude keys from a shape that matches the given `Condition`.
|
||||
|
||||
This is useful when you want to create a new type with a specific set of keys from a shape. For example, you might want to exclude all the primitive properties from a class and form a new shape containing everything but the primitive properties.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Primitive, ConditionalExcept} from 'type-fest';
|
||||
|
||||
class Awesome {
|
||||
name: string;
|
||||
successes: number;
|
||||
failures: bigint;
|
||||
|
||||
run() {}
|
||||
}
|
||||
|
||||
type ExceptPrimitivesFromAwesome = ConditionalExcept<Awesome, Primitive>;
|
||||
//=> {run: () => void}
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import {ConditionalExcept} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
a: string;
|
||||
b: string | number;
|
||||
c: () => void;
|
||||
d: {};
|
||||
}
|
||||
|
||||
type NonStringKeysOnly = ConditionalExcept<Example, string>;
|
||||
//=> {b: string | number; c: () => void; d: {}}
|
||||
```
|
||||
*/
|
||||
export type ConditionalExcept<Base, Condition> = Except<
|
||||
Base,
|
||||
ConditionalKeys<Base, Condition>
|
||||
>;
|
43
node_modules/ansi-escapes/node_modules/type-fest/source/conditional-keys.d.ts
generated
vendored
Normal file
43
node_modules/ansi-escapes/node_modules/type-fest/source/conditional-keys.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,43 @@
|
|||
/**
|
||||
Extract the keys from a type where the value type of the key extends the given `Condition`.
|
||||
|
||||
Internally this is used for the `ConditionalPick` and `ConditionalExcept` types.
|
||||
|
||||
@example
|
||||
```
|
||||
import {ConditionalKeys} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
a: string;
|
||||
b: string | number;
|
||||
c?: string;
|
||||
d: {};
|
||||
}
|
||||
|
||||
type StringKeysOnly = ConditionalKeys<Example, string>;
|
||||
//=> 'a'
|
||||
```
|
||||
|
||||
To support partial types, make sure your `Condition` is a union of undefined (for example, `string | undefined`) as demonstrated below.
|
||||
|
||||
@example
|
||||
```
|
||||
type StringKeysAndUndefined = ConditionalKeys<Example, string | undefined>;
|
||||
//=> 'a' | 'c'
|
||||
```
|
||||
*/
|
||||
export type ConditionalKeys<Base, Condition> = NonNullable<
|
||||
// Wrap in `NonNullable` to strip away the `undefined` type from the produced union.
|
||||
{
|
||||
// Map through all the keys of the given base type.
|
||||
[Key in keyof Base]:
|
||||
// Pick only keys with types extending the given `Condition` type.
|
||||
Base[Key] extends Condition
|
||||
// Retain this key since the condition passes.
|
||||
? Key
|
||||
// Discard this key since the condition fails.
|
||||
: never;
|
||||
|
||||
// Convert the produced object into a union type of the keys which passed the conditional test.
|
||||
}[keyof Base]
|
||||
>;
|
42
node_modules/ansi-escapes/node_modules/type-fest/source/conditional-pick.d.ts
generated
vendored
Normal file
42
node_modules/ansi-escapes/node_modules/type-fest/source/conditional-pick.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
import {ConditionalKeys} from './conditional-keys';
|
||||
|
||||
/**
|
||||
Pick keys from the shape that matches the given `Condition`.
|
||||
|
||||
This is useful when you want to create a new type from a specific subset of an existing type. For example, you might want to pick all the primitive properties from a class and form a new automatically derived type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Primitive, ConditionalPick} from 'type-fest';
|
||||
|
||||
class Awesome {
|
||||
name: string;
|
||||
successes: number;
|
||||
failures: bigint;
|
||||
|
||||
run() {}
|
||||
}
|
||||
|
||||
type PickPrimitivesFromAwesome = ConditionalPick<Awesome, Primitive>;
|
||||
//=> {name: string; successes: number; failures: bigint}
|
||||
```
|
||||
|
||||
@example
|
||||
```
|
||||
import {ConditionalPick} from 'type-fest';
|
||||
|
||||
interface Example {
|
||||
a: string;
|
||||
b: string | number;
|
||||
c: () => void;
|
||||
d: {};
|
||||
}
|
||||
|
||||
type StringKeysOnly = ConditionalPick<Example, string>;
|
||||
//=> {a: string}
|
||||
```
|
||||
*/
|
||||
export type ConditionalPick<Base, Condition> = Pick<
|
||||
Base,
|
||||
ConditionalKeys<Base, Condition>
|
||||
>;
|
22
node_modules/ansi-escapes/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
22
node_modules/ansi-escapes/node_modules/type-fest/source/except.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
Create a type from an object type without certain keys.
|
||||
|
||||
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.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/30825) if you want to have the stricter version as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Except} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
c: boolean;
|
||||
};
|
||||
|
||||
type FooWithoutA = Except<Foo, 'a' | 'c'>;
|
||||
//=> {b: string};
|
||||
```
|
||||
*/
|
||||
export type Except<ObjectType, KeysType extends keyof ObjectType> = Pick<ObjectType, Exclude<keyof ObjectType, KeysType>>;
|
33
node_modules/ansi-escapes/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
33
node_modules/ansi-escapes/node_modules/type-fest/source/literal-union.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,33 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Allows creating a union type by combining primitive types and literal types without sacrificing auto-completion in IDEs for the literal type part of the union.
|
||||
|
||||
Currently, when a union type of a primitive type is combined with literal types, TypeScript loses all information about the combined literals. Thus, when such type is used in an IDE with autocompletion, no suggestions are made for the declared literals.
|
||||
|
||||
This type is a workaround for [Microsoft/TypeScript#29729](https://github.com/Microsoft/TypeScript/issues/29729). It will be removed as soon as it's not needed anymore.
|
||||
|
||||
@example
|
||||
```
|
||||
import {LiteralUnion} from 'type-fest';
|
||||
|
||||
// Before
|
||||
|
||||
type Pet = 'dog' | 'cat' | string;
|
||||
|
||||
const pet: Pet = '';
|
||||
// Start typing in your TypeScript-enabled IDE.
|
||||
// You **will not** get auto-completion for `dog` and `cat` literals.
|
||||
|
||||
// After
|
||||
|
||||
type Pet2 = LiteralUnion<'dog' | 'cat', string>;
|
||||
|
||||
const pet: Pet2 = '';
|
||||
// You **will** get auto-completion for `dog` and `cat` literals.
|
||||
```
|
||||
*/
|
||||
export type LiteralUnion<
|
||||
LiteralType extends BaseType,
|
||||
BaseType extends Primitive
|
||||
> = LiteralType | (BaseType & {_?: never});
|
39
node_modules/ansi-escapes/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
39
node_modules/ansi-escapes/node_modules/type-fest/source/merge-exclusive.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,39 @@
|
|||
// Helper type. Not useful on its own.
|
||||
type Without<FirstType, SecondType> = {[KeyType in Exclude<keyof FirstType, keyof SecondType>]?: never};
|
||||
|
||||
/**
|
||||
Create a type that has mutually exclusive keys.
|
||||
|
||||
This type was inspired by [this comment](https://github.com/Microsoft/TypeScript/issues/14094#issuecomment-373782604).
|
||||
|
||||
This type works with a helper type, called `Without`. `Without<FirstType, SecondType>` produces a type that has only keys from `FirstType` which are not present on `SecondType` and sets the value type for these keys to `never`. This helper type is then used in `MergeExclusive` to remove keys from either `FirstType` or `SecondType`.
|
||||
|
||||
@example
|
||||
```
|
||||
import {MergeExclusive} from 'type-fest';
|
||||
|
||||
interface ExclusiveVariation1 {
|
||||
exclusive1: boolean;
|
||||
}
|
||||
|
||||
interface ExclusiveVariation2 {
|
||||
exclusive2: string;
|
||||
}
|
||||
|
||||
type ExclusiveOptions = MergeExclusive<ExclusiveVariation1, ExclusiveVariation2>;
|
||||
|
||||
let exclusiveOptions: ExclusiveOptions;
|
||||
|
||||
exclusiveOptions = {exclusive1: true};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive2: 'hi'};
|
||||
//=> Works
|
||||
exclusiveOptions = {exclusive1: true, exclusive2: 'hi'};
|
||||
//=> Error
|
||||
```
|
||||
*/
|
||||
export type MergeExclusive<FirstType, SecondType> =
|
||||
(FirstType | SecondType) extends object ?
|
||||
(Without<FirstType, SecondType> & SecondType) | (Without<SecondType, FirstType> & FirstType) :
|
||||
FirstType | SecondType;
|
||||
|
22
node_modules/ansi-escapes/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
22
node_modules/ansi-escapes/node_modules/type-fest/source/merge.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Merge two types into a new type. Keys of the second type overrides keys of the first type.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Merge} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b: string;
|
||||
};
|
||||
|
||||
type Bar = {
|
||||
b: number;
|
||||
};
|
||||
|
||||
const ab: Merge<Foo, Bar> = {a: 1, b: 2};
|
||||
```
|
||||
*/
|
||||
export type Merge<FirstType, SecondType> = Except<FirstType, Extract<keyof FirstType, keyof SecondType>> & SecondType;
|
22
node_modules/ansi-escapes/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
22
node_modules/ansi-escapes/node_modules/type-fest/source/mutable.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,22 @@
|
|||
/**
|
||||
Convert an object with `readonly` keys into a mutable object. Inverse of `Readonly<T>`.
|
||||
|
||||
This can be used to [store and mutate options within a class](https://github.com/sindresorhus/pageres/blob/4a5d05fca19a5fbd2f53842cbf3eb7b1b63bddd2/source/index.ts#L72), [edit `readonly` objects within tests](https://stackoverflow.com/questions/50703834), and [construct a `readonly` object within a function](https://github.com/Microsoft/TypeScript/issues/24509).
|
||||
|
||||
@example
|
||||
```
|
||||
import {Mutable} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
readonly a: number;
|
||||
readonly b: string;
|
||||
};
|
||||
|
||||
const mutableFoo: Mutable<Foo> = {a: 1, b: '2'};
|
||||
mutableFoo.a = 3;
|
||||
```
|
||||
*/
|
||||
export type Mutable<ObjectType> = {
|
||||
// For each `Key` in the keys of `ObjectType`, make a mapped type by removing the `readonly` modifier from the key.
|
||||
-readonly [KeyType in keyof ObjectType]: ObjectType[KeyType];
|
||||
};
|
65
node_modules/ansi-escapes/node_modules/type-fest/source/opaque.d.ts
generated
vendored
Normal file
65
node_modules/ansi-escapes/node_modules/type-fest/source/opaque.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,65 @@
|
|||
/**
|
||||
Create an opaque type, which hides its internal details from the public, and can only be created by being used explicitly.
|
||||
|
||||
The generic type parameter can be anything. It doesn't have to be an object.
|
||||
|
||||
[Read more about opaque types.](https://codemix.com/opaque-types-in-javascript/)
|
||||
|
||||
There have been several discussions about adding this feature to TypeScript via the `opaque type` operator, similar to how Flow does it. Unfortunately, nothing has (yet) moved forward:
|
||||
- [Microsoft/TypeScript#15408](https://github.com/Microsoft/TypeScript/issues/15408)
|
||||
- [Microsoft/TypeScript#15807](https://github.com/Microsoft/TypeScript/issues/15807)
|
||||
|
||||
@example
|
||||
```
|
||||
import {Opaque} from 'type-fest';
|
||||
|
||||
type AccountNumber = Opaque<number, 'AccountNumber'>;
|
||||
type AccountBalance = Opaque<number, 'AccountBalance'>;
|
||||
|
||||
// The Token parameter allows the compiler to differentiate between types, whereas "unknown" will not. For example, consider the following structures:
|
||||
type ThingOne = Opaque<string>;
|
||||
type ThingTwo = Opaque<string>;
|
||||
|
||||
// To the compiler, these types are allowed to be cast to each other as they have the same underlying type. They are both `string & { __opaque__: unknown }`.
|
||||
// To avoid this behaviour, you would instead pass the "Token" parameter, like so.
|
||||
type NewThingOne = Opaque<string, 'ThingOne'>;
|
||||
type NewThingTwo = Opaque<string, 'ThingTwo'>;
|
||||
|
||||
// Now they're completely separate types, so the following will fail to compile.
|
||||
function createNewThingOne (): NewThingOne {
|
||||
// As you can see, casting from a string is still allowed. However, you may not cast NewThingOne to NewThingTwo, and vice versa.
|
||||
return 'new thing one' as NewThingOne;
|
||||
}
|
||||
|
||||
// This will fail to compile, as they are fundamentally different types.
|
||||
const thingTwo = createNewThingOne() as NewThingTwo;
|
||||
|
||||
// Here's another example of opaque typing.
|
||||
function createAccountNumber(): AccountNumber {
|
||||
return 2 as AccountNumber;
|
||||
}
|
||||
|
||||
function getMoneyForAccount(accountNumber: AccountNumber): AccountBalance {
|
||||
return 4 as AccountBalance;
|
||||
}
|
||||
|
||||
// This will compile successfully.
|
||||
getMoneyForAccount(createAccountNumber());
|
||||
|
||||
// But this won't, because it has to be explicitly passed as an `AccountNumber` type.
|
||||
getMoneyForAccount(2);
|
||||
|
||||
// You can use opaque values like they aren't opaque too.
|
||||
const accountNumber = createAccountNumber();
|
||||
|
||||
// This will not compile successfully.
|
||||
const newAccountNumber = accountNumber + 2;
|
||||
|
||||
// As a side note, you can (and should) use recursive types for your opaque types to make them stronger and hopefully easier to type.
|
||||
type Person = {
|
||||
id: Opaque<number, Person>;
|
||||
name: string;
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type Opaque<Type, Token = unknown> = Type & {readonly __opaque__: Token};
|
585
node_modules/ansi-escapes/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
585
node_modules/ansi-escapes/node_modules/type-fest/source/package-json.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,585 @@
|
|||
import {LiteralUnion} from '..';
|
||||
|
||||
declare namespace PackageJson {
|
||||
/**
|
||||
A person who has been involved in creating or maintaining the package.
|
||||
*/
|
||||
export type Person =
|
||||
| string
|
||||
| {
|
||||
name: string;
|
||||
url?: string;
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export type BugsLocation =
|
||||
| string
|
||||
| {
|
||||
/**
|
||||
The URL to the package's issue tracker.
|
||||
*/
|
||||
url?: string;
|
||||
|
||||
/**
|
||||
The email address to which issues should be reported.
|
||||
*/
|
||||
email?: string;
|
||||
};
|
||||
|
||||
export interface DirectoryLocations {
|
||||
[directoryType: string]: unknown;
|
||||
|
||||
/**
|
||||
Location for executable scripts. Sugar to generate entries in the `bin` property by walking the folder.
|
||||
*/
|
||||
bin?: string;
|
||||
|
||||
/**
|
||||
Location for Markdown files.
|
||||
*/
|
||||
doc?: string;
|
||||
|
||||
/**
|
||||
Location for example scripts.
|
||||
*/
|
||||
example?: string;
|
||||
|
||||
/**
|
||||
Location for the bulk of the library.
|
||||
*/
|
||||
lib?: string;
|
||||
|
||||
/**
|
||||
Location for man pages. Sugar to generate a `man` array by walking the folder.
|
||||
*/
|
||||
man?: string;
|
||||
|
||||
/**
|
||||
Location for test files.
|
||||
*/
|
||||
test?: string;
|
||||
}
|
||||
|
||||
export type Scripts = {
|
||||
/**
|
||||
Run **before** the package is published (Also run on local `npm install` without any arguments).
|
||||
*/
|
||||
prepublish?: string;
|
||||
|
||||
/**
|
||||
Run both **before** the package is packed and published, and on local `npm install` without any arguments. This is run **after** `prepublish`, but **before** `prepublishOnly`.
|
||||
*/
|
||||
prepare?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is prepared and packed, **only** on `npm publish`.
|
||||
*/
|
||||
prepublishOnly?: string;
|
||||
|
||||
/**
|
||||
Run **before** a tarball is packed (on `npm pack`, `npm publish`, and when installing git dependencies).
|
||||
*/
|
||||
prepack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the tarball has been generated and moved to its final destination.
|
||||
*/
|
||||
postpack?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
publish?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is published.
|
||||
*/
|
||||
postpublish?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is installed.
|
||||
*/
|
||||
preinstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed.
|
||||
*/
|
||||
install?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is installed and after `install`.
|
||||
*/
|
||||
postinstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled and before `uninstall`.
|
||||
*/
|
||||
preuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** the package is uninstalled.
|
||||
*/
|
||||
uninstall?: string;
|
||||
|
||||
/**
|
||||
Run **after** the package is uninstalled.
|
||||
*/
|
||||
postuninstall?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version and before `version`.
|
||||
*/
|
||||
preversion?: string;
|
||||
|
||||
/**
|
||||
Run **before** bump the package version.
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Run **after** bump the package version.
|
||||
*/
|
||||
postversion?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, before `test`.
|
||||
*/
|
||||
pretest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command.
|
||||
*/
|
||||
test?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm test` command, after `test`.
|
||||
*/
|
||||
posttest?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, before `stop`.
|
||||
*/
|
||||
prestop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command.
|
||||
*/
|
||||
stop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm stop` command, after `stop`.
|
||||
*/
|
||||
poststop?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, before `start`.
|
||||
*/
|
||||
prestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command.
|
||||
*/
|
||||
start?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm start` command, after `start`.
|
||||
*/
|
||||
poststart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, before `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
prerestart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
restart?: string;
|
||||
|
||||
/**
|
||||
Run with the `npm restart` command, after `restart`. Note: `npm restart` will run the `stop` and `start` scripts if no `restart` script is provided.
|
||||
*/
|
||||
postrestart?: string;
|
||||
} & {
|
||||
[scriptName: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Dependencies of the package. The version range is a string which has one or more space-separated descriptors. Dependencies can also be identified with a tarball or Git URL.
|
||||
*/
|
||||
export interface Dependency {
|
||||
[packageName: string]: string;
|
||||
}
|
||||
|
||||
export interface NonStandardEntryPoints {
|
||||
/**
|
||||
An ECMAScript module ID that is the primary entry point to the program.
|
||||
*/
|
||||
module?: string;
|
||||
|
||||
/**
|
||||
A module ID with untranspiled code that is the primary entry point to the program.
|
||||
*/
|
||||
esnext?:
|
||||
| string
|
||||
| {
|
||||
[moduleName: string]: string | undefined;
|
||||
main?: string;
|
||||
browser?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
A hint to JavaScript bundlers or component tools when packaging modules for client side use.
|
||||
*/
|
||||
browser?:
|
||||
| string
|
||||
| {
|
||||
[moduleName: string]: string | false;
|
||||
};
|
||||
|
||||
/**
|
||||
Denote which files in your project are "pure" and therefore safe for Webpack to prune if unused.
|
||||
|
||||
[Read more.](https://webpack.js.org/guides/tree-shaking/)
|
||||
*/
|
||||
sideEffects?: boolean | string[];
|
||||
}
|
||||
|
||||
export interface TypeScriptConfiguration {
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file.
|
||||
*/
|
||||
types?: string;
|
||||
|
||||
/**
|
||||
Location of the bundled TypeScript declaration file. Alias of `types`.
|
||||
*/
|
||||
typings?: string;
|
||||
}
|
||||
|
||||
/**
|
||||
An alternative configuration for Yarn workspaces.
|
||||
*/
|
||||
export interface WorkspaceConfig {
|
||||
/**
|
||||
An array of workspace pattern strings which contain the workspace packages.
|
||||
*/
|
||||
packages?: WorkspacePattern[];
|
||||
|
||||
/**
|
||||
Designed to solve the problem of packages which break when their `node_modules` are moved to the root workspace directory - a process known as hoisting. For these packages, both within your workspace, and also some that have been installed via `node_modules`, it is important to have a mechanism for preventing the default Yarn workspace behavior. By adding workspace pattern strings here, Yarn will resume non-workspace behavior for any package which matches the defined patterns.
|
||||
|
||||
[Read more](https://classic.yarnpkg.com/blog/2018/02/15/nohoist/)
|
||||
*/
|
||||
nohoist?: WorkspacePattern[];
|
||||
}
|
||||
|
||||
/**
|
||||
A workspace pattern points to a directory or group of directories which contain packages that should be included in the workspace installation process.
|
||||
|
||||
The patterns are handled with [minimatch](https://github.com/isaacs/minimatch).
|
||||
|
||||
@example
|
||||
`docs` → Include the docs directory and install its dependencies.
|
||||
`packages/*` → Include all nested directories within the packages directory, like `packages/cli` and `packages/core`.
|
||||
*/
|
||||
type WorkspacePattern = string;
|
||||
|
||||
export interface YarnConfiguration {
|
||||
/**
|
||||
Used to configure [Yarn workspaces](https://classic.yarnpkg.com/docs/workspaces/).
|
||||
|
||||
Workspaces allow you to manage multiple packages within the same repository in such a way that you only need to run `yarn install` once to install all of them in a single pass.
|
||||
|
||||
Please note that the top-level `private` property of `package.json` **must** be set to `true` in order to use workspaces.
|
||||
*/
|
||||
workspaces?: WorkspacePattern[] | WorkspaceConfig;
|
||||
|
||||
/**
|
||||
If your package only allows one version of a given dependency, and you’d like to enforce the same behavior as `yarn install --flat` on the command-line, set this to `true`.
|
||||
|
||||
Note that if your `package.json` contains `"flat": true` and other packages depend on yours (e.g. you are building a library rather than an app), those other packages will also need `"flat": true` in their `package.json` or be installed with `yarn install --flat` on the command-line.
|
||||
*/
|
||||
flat?: boolean;
|
||||
|
||||
/**
|
||||
Selective version resolutions. Allows the definition of custom package versions inside dependencies without manual edits in the `yarn.lock` file.
|
||||
*/
|
||||
resolutions?: Dependency;
|
||||
}
|
||||
|
||||
export interface JSPMConfiguration {
|
||||
/**
|
||||
JSPM configuration.
|
||||
*/
|
||||
jspm?: PackageJson;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
Type for [npm's `package.json` file](https://docs.npmjs.com/creating-a-package-json-file). Also includes types for fields used by other popular projects, like TypeScript and Yarn.
|
||||
*/
|
||||
export type PackageJson = {
|
||||
/**
|
||||
The name of the package.
|
||||
*/
|
||||
name?: string;
|
||||
|
||||
/**
|
||||
Package version, parseable by [`node-semver`](https://github.com/npm/node-semver).
|
||||
*/
|
||||
version?: string;
|
||||
|
||||
/**
|
||||
Package description, listed in `npm search`.
|
||||
*/
|
||||
description?: string;
|
||||
|
||||
/**
|
||||
Keywords associated with package, listed in `npm search`.
|
||||
*/
|
||||
keywords?: string[];
|
||||
|
||||
/**
|
||||
The URL to the package's homepage.
|
||||
*/
|
||||
homepage?: LiteralUnion<'.', string>;
|
||||
|
||||
/**
|
||||
The URL to the package's issue tracker and/or the email address to which issues should be reported.
|
||||
*/
|
||||
bugs?: PackageJson.BugsLocation;
|
||||
|
||||
/**
|
||||
The license for the package.
|
||||
*/
|
||||
license?: string;
|
||||
|
||||
/**
|
||||
The licenses for the package.
|
||||
*/
|
||||
licenses?: Array<{
|
||||
type?: string;
|
||||
url?: string;
|
||||
}>;
|
||||
|
||||
author?: PackageJson.Person;
|
||||
|
||||
/**
|
||||
A list of people who contributed to the package.
|
||||
*/
|
||||
contributors?: PackageJson.Person[];
|
||||
|
||||
/**
|
||||
A list of people who maintain the package.
|
||||
*/
|
||||
maintainers?: PackageJson.Person[];
|
||||
|
||||
/**
|
||||
The files included in the package.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
The module ID that is the primary entry point to the program.
|
||||
*/
|
||||
main?: string;
|
||||
|
||||
/**
|
||||
The executable files that should be installed into the `PATH`.
|
||||
*/
|
||||
bin?:
|
||||
| string
|
||||
| {
|
||||
[binary: string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Filenames to put in place for the `man` program to find.
|
||||
*/
|
||||
man?: string | string[];
|
||||
|
||||
/**
|
||||
Indicates the structure of the package.
|
||||
*/
|
||||
directories?: PackageJson.DirectoryLocations;
|
||||
|
||||
/**
|
||||
Location for the code repository.
|
||||
*/
|
||||
repository?:
|
||||
| string
|
||||
| {
|
||||
type: string;
|
||||
url: string;
|
||||
|
||||
/**
|
||||
Relative path to package.json if it is placed in non-root directory (for example if it is part of a monorepo).
|
||||
|
||||
[Read more.](https://github.com/npm/rfcs/blob/latest/implemented/0010-monorepo-subdirectory-declaration.md)
|
||||
*/
|
||||
directory?: string;
|
||||
};
|
||||
|
||||
/**
|
||||
Script commands that are run at various times in the lifecycle of the package. The key is the lifecycle event, and the value is the command to run at that point.
|
||||
*/
|
||||
scripts?: PackageJson.Scripts;
|
||||
|
||||
/**
|
||||
Is used to set configuration parameters used in package scripts that persist across upgrades.
|
||||
*/
|
||||
config?: {
|
||||
[configKey: string]: unknown;
|
||||
};
|
||||
|
||||
/**
|
||||
The dependencies of the package.
|
||||
*/
|
||||
dependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Additional tooling dependencies that are not required for the package to work. Usually test, build, or documentation tooling.
|
||||
*/
|
||||
devDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that are skipped if they fail to install.
|
||||
*/
|
||||
optionalDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Dependencies that will usually be required by the package user directly or via another dependency.
|
||||
*/
|
||||
peerDependencies?: PackageJson.Dependency;
|
||||
|
||||
/**
|
||||
Indicate peer dependencies that are optional.
|
||||
*/
|
||||
peerDependenciesMeta?: {
|
||||
[packageName: string]: {
|
||||
optional: true;
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
Package names that are bundled when the package is published.
|
||||
*/
|
||||
bundledDependencies?: string[];
|
||||
|
||||
/**
|
||||
Alias of `bundledDependencies`.
|
||||
*/
|
||||
bundleDependencies?: string[];
|
||||
|
||||
/**
|
||||
Engines that this package runs on.
|
||||
*/
|
||||
engines?: {
|
||||
[EngineName in 'npm' | 'node' | string]: string;
|
||||
};
|
||||
|
||||
/**
|
||||
@deprecated
|
||||
*/
|
||||
engineStrict?: boolean;
|
||||
|
||||
/**
|
||||
Operating systems the module runs on.
|
||||
*/
|
||||
os?: Array<LiteralUnion<
|
||||
| 'aix'
|
||||
| 'darwin'
|
||||
| 'freebsd'
|
||||
| 'linux'
|
||||
| 'openbsd'
|
||||
| 'sunos'
|
||||
| 'win32'
|
||||
| '!aix'
|
||||
| '!darwin'
|
||||
| '!freebsd'
|
||||
| '!linux'
|
||||
| '!openbsd'
|
||||
| '!sunos'
|
||||
| '!win32',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
CPU architectures the module runs on.
|
||||
*/
|
||||
cpu?: Array<LiteralUnion<
|
||||
| 'arm'
|
||||
| 'arm64'
|
||||
| 'ia32'
|
||||
| 'mips'
|
||||
| 'mipsel'
|
||||
| 'ppc'
|
||||
| 'ppc64'
|
||||
| 's390'
|
||||
| 's390x'
|
||||
| 'x32'
|
||||
| 'x64'
|
||||
| '!arm'
|
||||
| '!arm64'
|
||||
| '!ia32'
|
||||
| '!mips'
|
||||
| '!mipsel'
|
||||
| '!ppc'
|
||||
| '!ppc64'
|
||||
| '!s390'
|
||||
| '!s390x'
|
||||
| '!x32'
|
||||
| '!x64',
|
||||
string
|
||||
>>;
|
||||
|
||||
/**
|
||||
If set to `true`, a warning will be shown if package is installed locally. Useful if the package is primarily a command-line application that should be installed globally.
|
||||
|
||||
@deprecated
|
||||
*/
|
||||
preferGlobal?: boolean;
|
||||
|
||||
/**
|
||||
If set to `true`, then npm will refuse to publish it.
|
||||
*/
|
||||
private?: boolean;
|
||||
|
||||
/**
|
||||
A set of config values that will be used at publish-time. It's especially handy to set the tag, registry or access, to ensure that a given package is not tagged with 'latest', published to the global public registry or that a scoped module is private by default.
|
||||
*/
|
||||
publishConfig?: {
|
||||
[config: string]: unknown;
|
||||
};
|
||||
|
||||
/**
|
||||
Describes and notifies consumers of a package's monetary support information.
|
||||
|
||||
[Read more.](https://github.com/npm/rfcs/blob/latest/accepted/0017-add-funding-support.md)
|
||||
*/
|
||||
funding?: string | {
|
||||
/**
|
||||
The type of funding.
|
||||
*/
|
||||
type?: LiteralUnion<
|
||||
| 'github'
|
||||
| 'opencollective'
|
||||
| 'patreon'
|
||||
| 'individual'
|
||||
| 'foundation'
|
||||
| 'corporation',
|
||||
string
|
||||
>;
|
||||
/**
|
||||
The URL to the funding page.
|
||||
*/
|
||||
url: string;
|
||||
};
|
||||
} &
|
||||
PackageJson.NonStandardEntryPoints &
|
||||
PackageJson.TypeScriptConfiguration &
|
||||
PackageJson.YarnConfiguration &
|
||||
PackageJson.JSPMConfiguration & {
|
||||
[key: string]: unknown;
|
||||
};
|
72
node_modules/ansi-escapes/node_modules/type-fest/source/partial-deep.d.ts
generated
vendored
Normal file
72
node_modules/ansi-escapes/node_modules/type-fest/source/partial-deep.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,72 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Create a type from another type with all keys and nested keys set to optional.
|
||||
|
||||
Use-cases:
|
||||
- Merging a default settings/config object with another object, the second object would be a deep partial of the default object.
|
||||
- Mocking and testing complex entities, where populating an entire object with its keys would be redundant in terms of the mock or test.
|
||||
|
||||
@example
|
||||
```
|
||||
import {PartialDeep} from 'type-fest';
|
||||
|
||||
const settings: Settings = {
|
||||
textEditor: {
|
||||
fontSize: 14;
|
||||
fontColor: '#000000';
|
||||
fontWeight: 400;
|
||||
}
|
||||
autocomplete: false;
|
||||
autosave: true;
|
||||
};
|
||||
|
||||
const applySavedSettings = (savedSettings: PartialDeep<Settings>) => {
|
||||
return {...settings, ...savedSettings};
|
||||
}
|
||||
|
||||
settings = applySavedSettings({textEditor: {fontWeight: 500}});
|
||||
```
|
||||
*/
|
||||
export type PartialDeep<T> = T extends Primitive
|
||||
? Partial<T>
|
||||
: T extends Map<infer KeyType, infer ValueType>
|
||||
? PartialMapDeep<KeyType, ValueType>
|
||||
: T extends Set<infer ItemType>
|
||||
? PartialSetDeep<ItemType>
|
||||
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
||||
? PartialReadonlyMapDeep<KeyType, ValueType>
|
||||
: T extends ReadonlySet<infer ItemType>
|
||||
? PartialReadonlySetDeep<ItemType>
|
||||
: T extends ((...arguments: any[]) => unknown)
|
||||
? T | undefined
|
||||
: T extends object
|
||||
? PartialObjectDeep<T>
|
||||
: unknown;
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `Map`s and as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialMapDeep<KeyType, ValueType> extends Map<PartialDeep<KeyType>, PartialDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `Set`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialSetDeep<T> extends Set<PartialDeep<T>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialReadonlyMapDeep<KeyType, ValueType> extends ReadonlyMap<PartialDeep<KeyType>, PartialDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
interface PartialReadonlySetDeep<T> extends ReadonlySet<PartialDeep<T>> {}
|
||||
|
||||
/**
|
||||
Same as `PartialDeep`, but accepts only `object`s as inputs. Internal helper for `PartialDeep`.
|
||||
*/
|
||||
type PartialObjectDeep<ObjectType extends object> = {
|
||||
[KeyType in keyof ObjectType]?: PartialDeep<ObjectType[KeyType]>
|
||||
};
|
23
node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
23
node_modules/ansi-escapes/node_modules/type-fest/source/promisable.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,23 @@
|
|||
/**
|
||||
Create a type that represents either the value or the value wrapped in `PromiseLike`.
|
||||
|
||||
Use-cases:
|
||||
- A function accepts a callback that may either return a value synchronously or may return a promised value.
|
||||
- This type could be the return type of `Promise#then()`, `Promise#catch()`, and `Promise#finally()` callbacks.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/31394) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
import {Promisable} from 'type-fest';
|
||||
|
||||
async function logger(getLogEntry: () => Promisable<string>): Promise<void> {
|
||||
const entry = await getLogEntry();
|
||||
console.log(entry);
|
||||
}
|
||||
|
||||
logger(() => 'foo');
|
||||
logger(() => Promise.resolve('bar'));
|
||||
```
|
||||
*/
|
||||
export type Promisable<T> = T | PromiseLike<T>;
|
20
node_modules/ansi-escapes/node_modules/type-fest/source/promise-value.d.ts
generated
vendored
Normal file
20
node_modules/ansi-escapes/node_modules/type-fest/source/promise-value.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,20 @@
|
|||
/**
|
||||
Returns the type that is wrapped inside a `Promise` type.
|
||||
If the type is not a `Promise`, the type itself is returned.
|
||||
|
||||
@example
|
||||
```
|
||||
import {PromiseValue} from 'type-fest';
|
||||
|
||||
type AsyncData = Promise<string>;
|
||||
let asyncData: PromiseValue<AsyncData> = Promise.resolve('ABC');
|
||||
|
||||
type Data = PromiseValue<AsyncData>;
|
||||
let data: Data = await asyncData;
|
||||
|
||||
// Here's an example that shows how this type reacts to non-Promise types.
|
||||
type SyncData = PromiseValue<string>;
|
||||
let syncData: SyncData = getSyncData();
|
||||
```
|
||||
*/
|
||||
export type PromiseValue<PromiseType, Otherwise = PromiseType> = PromiseType extends Promise<infer Value> ? Value : Otherwise;
|
59
node_modules/ansi-escapes/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
59
node_modules/ansi-escapes/node_modules/type-fest/source/readonly-deep.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
import {Primitive} from './basic';
|
||||
|
||||
/**
|
||||
Convert `object`s, `Map`s, `Set`s, and `Array`s and all of their keys/elements into immutable structures recursively.
|
||||
|
||||
This is useful when a deeply nested structure needs to be exposed as completely immutable, for example, an imported JSON module or when receiving an API response that is passed around.
|
||||
|
||||
Please upvote [this issue](https://github.com/microsoft/TypeScript/issues/13923) if you want to have this type as a built-in in TypeScript.
|
||||
|
||||
@example
|
||||
```
|
||||
// data.json
|
||||
{
|
||||
"foo": ["bar"]
|
||||
}
|
||||
|
||||
// main.ts
|
||||
import {ReadonlyDeep} from 'type-fest';
|
||||
import dataJson = require('./data.json');
|
||||
|
||||
const data: ReadonlyDeep<typeof dataJson> = dataJson;
|
||||
|
||||
export default data;
|
||||
|
||||
// test.ts
|
||||
import data from './main';
|
||||
|
||||
data.foo.push('bar');
|
||||
//=> error TS2339: Property 'push' does not exist on type 'readonly string[]'
|
||||
```
|
||||
*/
|
||||
export type ReadonlyDeep<T> = T extends Primitive | ((...arguments: any[]) => unknown)
|
||||
? T
|
||||
: T extends ReadonlyMap<infer KeyType, infer ValueType>
|
||||
? ReadonlyMapDeep<KeyType, ValueType>
|
||||
: T extends ReadonlySet<infer ItemType>
|
||||
? ReadonlySetDeep<ItemType>
|
||||
: T extends object
|
||||
? ReadonlyObjectDeep<T>
|
||||
: unknown;
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlyMap`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlyMapDeep<KeyType, ValueType>
|
||||
extends ReadonlyMap<ReadonlyDeep<KeyType>, ReadonlyDeep<ValueType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `ReadonlySet`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
interface ReadonlySetDeep<ItemType>
|
||||
extends ReadonlySet<ReadonlyDeep<ItemType>> {}
|
||||
|
||||
/**
|
||||
Same as `ReadonlyDeep`, but accepts only `object`s as inputs. Internal helper for `ReadonlyDeep`.
|
||||
*/
|
||||
type ReadonlyObjectDeep<ObjectType extends object> = {
|
||||
readonly [KeyType in keyof ObjectType]: ReadonlyDeep<ObjectType[KeyType]>
|
||||
};
|
32
node_modules/ansi-escapes/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
32
node_modules/ansi-escapes/node_modules/type-fest/source/require-at-least-one.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
import {Except} from './except';
|
||||
|
||||
/**
|
||||
Create a type that requires at least one of the given keys. The remaining keys are kept as is.
|
||||
|
||||
@example
|
||||
```
|
||||
import {RequireAtLeastOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text?: () => string;
|
||||
json?: () => string;
|
||||
|
||||
secure?: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireAtLeastOne<Responder, 'text' | 'json'> = {
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type RequireAtLeastOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
||||
{
|
||||
// For each Key in KeysType make a mapped type
|
||||
[Key in KeysType]: (
|
||||
// …by picking that Key's type and making it required
|
||||
Required<Pick<ObjectType, Key>>
|
||||
)
|
||||
}[KeysType]
|
||||
// …then, make intersection types by adding the remaining keys to each mapped type.
|
||||
& Except<ObjectType, KeysType>;
|
36
node_modules/ansi-escapes/node_modules/type-fest/source/require-exactly-one.d.ts
generated
vendored
Normal file
36
node_modules/ansi-escapes/node_modules/type-fest/source/require-exactly-one.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
// TODO: Remove this when we target TypeScript >=3.5.
|
||||
// eslint-disable-next-line @typescript-eslint/generic-type-naming
|
||||
type _Omit<T, K extends keyof any> = Pick<T, Exclude<keyof T, K>>;
|
||||
|
||||
/**
|
||||
Create a type that requires exactly one of the given keys and disallows more. The remaining keys are kept as is.
|
||||
|
||||
Use-cases:
|
||||
- Creating interfaces for components that only need one of the keys to display properly.
|
||||
- Declaring generic keys in a single place for a single use-case that gets narrowed down via `RequireExactlyOne`.
|
||||
|
||||
The caveat with `RequireExactlyOne` is that TypeScript doesn't always know at compile time every key that will exist at runtime. Therefore `RequireExactlyOne` can't do anything to prevent extra keys it doesn't know about.
|
||||
|
||||
@example
|
||||
```
|
||||
import {RequireExactlyOne} from 'type-fest';
|
||||
|
||||
type Responder = {
|
||||
text: () => string;
|
||||
json: () => string;
|
||||
secure: boolean;
|
||||
};
|
||||
|
||||
const responder: RequireExactlyOne<Responder, 'text' | 'json'> = {
|
||||
// Adding a `text` key here would cause a compile error.
|
||||
|
||||
json: () => '{"message": "ok"}',
|
||||
secure: true
|
||||
};
|
||||
```
|
||||
*/
|
||||
export type RequireExactlyOne<ObjectType, KeysType extends keyof ObjectType = keyof ObjectType> =
|
||||
{[Key in KeysType]: (
|
||||
Required<Pick<ObjectType, Key>> &
|
||||
Partial<Record<Exclude<KeysType, Key>, never>>
|
||||
)}[KeysType] & _Omit<ObjectType, KeysType>;
|
32
node_modules/ansi-escapes/node_modules/type-fest/source/set-optional.d.ts
generated
vendored
Normal file
32
node_modules/ansi-escapes/node_modules/type-fest/source/set-optional.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
Create a type that makes the given keys optional. The remaining keys are kept as is. The sister of the `SetRequired` type.
|
||||
|
||||
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are optional.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetOptional} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a: number;
|
||||
b?: string;
|
||||
c: boolean;
|
||||
}
|
||||
|
||||
type SomeOptional = SetOptional<Foo, 'b' | 'c'>;
|
||||
// type SomeOptional = {
|
||||
// a: number;
|
||||
// b?: string; // Was already optional and still is.
|
||||
// c?: boolean; // Is now optional.
|
||||
// }
|
||||
```
|
||||
*/
|
||||
export type SetOptional<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
||||
// Pick just the keys that are not optional from the base type.
|
||||
Pick<BaseType, Exclude<keyof BaseType, Keys>> &
|
||||
// Pick the keys that should be optional from the base type and make them optional.
|
||||
Partial<Pick<BaseType, Keys>> extends
|
||||
// If `InferredType` extends the previous, then for each key, use the inferred type key.
|
||||
infer InferredType
|
||||
? {[KeyType in keyof InferredType]: InferredType[KeyType]}
|
||||
: never;
|
32
node_modules/ansi-escapes/node_modules/type-fest/source/set-required.d.ts
generated
vendored
Normal file
32
node_modules/ansi-escapes/node_modules/type-fest/source/set-required.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
Create a type that makes the given keys required. The remaining keys are kept as is. The sister of the `SetOptional` type.
|
||||
|
||||
Use-case: You want to define a single model where the only thing that changes is whether or not some of the keys are required.
|
||||
|
||||
@example
|
||||
```
|
||||
import {SetRequired} from 'type-fest';
|
||||
|
||||
type Foo = {
|
||||
a?: number;
|
||||
b: string;
|
||||
c?: boolean;
|
||||
}
|
||||
|
||||
type SomeRequired = SetRequired<Foo, 'b' | 'c'>;
|
||||
// type SomeRequired = {
|
||||
// a?: number;
|
||||
// b: string; // Was already required and still is.
|
||||
// c: boolean; // Is now required.
|
||||
// }
|
||||
```
|
||||
*/
|
||||
export type SetRequired<BaseType, Keys extends keyof BaseType = keyof BaseType> =
|
||||
// Pick just the keys that are not required from the base type.
|
||||
Pick<BaseType, Exclude<keyof BaseType, Keys>> &
|
||||
// Pick the keys that should be required from the base type and make them required.
|
||||
Required<Pick<BaseType, Keys>> extends
|
||||
// If `InferredType` extends the previous, then for each key, use the inferred type key.
|
||||
infer InferredType
|
||||
? {[KeyType in keyof InferredType]: InferredType[KeyType]}
|
||||
: never;
|
872
node_modules/ansi-escapes/node_modules/type-fest/source/tsconfig-json.d.ts
generated
vendored
Normal file
872
node_modules/ansi-escapes/node_modules/type-fest/source/tsconfig-json.d.ts
generated
vendored
Normal file
|
@ -0,0 +1,872 @@
|
|||
declare namespace TsConfigJson {
|
||||
namespace CompilerOptions {
|
||||
export type JSX =
|
||||
| 'preserve'
|
||||
| 'react'
|
||||
| 'react-native';
|
||||
|
||||
export type Module =
|
||||
| 'CommonJS'
|
||||
| 'AMD'
|
||||
| 'System'
|
||||
| 'UMD'
|
||||
| 'ES6'
|
||||
| 'ES2015'
|
||||
| 'ESNext'
|
||||
| 'None'
|
||||
// Lowercase alternatives
|
||||
| 'commonjs'
|
||||
| 'amd'
|
||||
| 'system'
|
||||
| 'umd'
|
||||
| 'es6'
|
||||
| 'es2015'
|
||||
| 'esnext'
|
||||
| 'none';
|
||||
|
||||
export type NewLine =
|
||||
| 'CRLF'
|
||||
| 'LF'
|
||||
// Lowercase alternatives
|
||||
| 'crlf'
|
||||
| 'lf';
|
||||
|
||||
export type Target =
|
||||
| 'ES3'
|
||||
| 'ES5'
|
||||
| 'ES6'
|
||||
| 'ES2015'
|
||||
| 'ES2016'
|
||||
| 'ES2017'
|
||||
| 'ES2018'
|
||||
| 'ES2019'
|
||||
| 'ES2020'
|
||||
| 'ESNext'
|
||||
// Lowercase alternatives
|
||||
| 'es3'
|
||||
| 'es5'
|
||||
| 'es6'
|
||||
| 'es2015'
|
||||
| 'es2016'
|
||||
| 'es2017'
|
||||
| 'es2018'
|
||||
| 'es2019'
|
||||
| 'es2020'
|
||||
| 'esnext';
|
||||
|
||||
export type Lib =
|
||||
| 'ES5'
|
||||
| 'ES6'
|
||||
| 'ES7'
|
||||
| 'ES2015'
|
||||
| 'ES2015.Collection'
|
||||
| 'ES2015.Core'
|
||||
| 'ES2015.Generator'
|
||||
| 'ES2015.Iterable'
|
||||
| 'ES2015.Promise'
|
||||
| 'ES2015.Proxy'
|
||||
| 'ES2015.Reflect'
|
||||
| 'ES2015.Symbol.WellKnown'
|
||||
| 'ES2015.Symbol'
|
||||
| 'ES2016'
|
||||
| 'ES2016.Array.Include'
|
||||
| 'ES2017'
|
||||
| 'ES2017.Intl'
|
||||
| 'ES2017.Object'
|
||||
| 'ES2017.SharedMemory'
|
||||
| 'ES2017.String'
|
||||
| 'ES2017.TypedArrays'
|
||||
| 'ES2018'
|
||||
| 'ES2018.AsyncIterable'
|
||||
| 'ES2018.Intl'
|
||||
| 'ES2018.Promise'
|
||||
| 'ES2018.Regexp'
|
||||
| 'ES2019'
|
||||
| 'ES2019.Array'
|
||||
| 'ES2019.Object'
|
||||
| 'ES2019.String'
|
||||
| 'ES2019.Symbol'
|
||||
| 'ES2020'
|
||||
| 'ES2020.String'
|
||||
| 'ES2020.Symbol.WellKnown'
|
||||
| 'ESNext'
|
||||
| 'ESNext.Array'
|
||||
| 'ESNext.AsyncIterable'
|
||||
| 'ESNext.BigInt'
|
||||
| 'ESNext.Intl'
|
||||
| 'ESNext.Symbol'
|
||||
| 'DOM'
|
||||
| 'DOM.Iterable'
|
||||
| 'ScriptHost'
|
||||
| 'WebWorker'
|
||||
| 'WebWorker.ImportScripts'
|
||||
// Lowercase alternatives
|
||||
| 'es5'
|
||||
| 'es6'
|
||||
| 'es7'
|
||||
| 'es2015'
|
||||
| 'es2015.collection'
|
||||
| 'es2015.core'
|
||||
| 'es2015.generator'
|
||||
| 'es2015.iterable'
|
||||
| 'es2015.promise'
|
||||
| 'es2015.proxy'
|
||||
| 'es2015.reflect'
|
||||
| 'es2015.symbol.wellknown'
|
||||
| 'es2015.symbol'
|
||||
| 'es2016'
|
||||
| 'es2016.array.include'
|
||||
| 'es2017'
|
||||
| 'es2017.intl'
|
||||
| 'es2017.object'
|
||||
| 'es2017.sharedmemory'
|
||||
| 'es2017.string'
|
||||
| 'es2017.typedarrays'
|
||||
| 'es2018'
|
||||
| 'es2018.asynciterable'
|
||||
| 'es2018.intl'
|
||||
| 'es2018.promise'
|
||||
| 'es2018.regexp'
|
||||
| 'es2019'
|
||||
| 'es2019.array'
|
||||
| 'es2019.object'
|
||||
| 'es2019.string'
|
||||
| 'es2019.symbol'
|
||||
| 'es2020'
|
||||
| 'es2020.string'
|
||||
| 'es2020.symbol.wellknown'
|
||||
| 'esnext'
|
||||
| 'esnext.array'
|
||||
| 'esnext.asynciterable'
|
||||
| 'esnext.bigint'
|
||||
| 'esnext.intl'
|
||||
| 'esnext.symbol'
|
||||
| 'dom'
|
||||
| 'dom.iterable'
|
||||
| 'scripthost'
|
||||
| 'webworker'
|
||||
| 'webworker.importscripts';
|
||||
|
||||
export interface Plugin {
|
||||
[key: string]: unknown;
|
||||
/**
|
||||
Plugin name.
|
||||
*/
|
||||
name?: string;
|
||||
}
|
||||
}
|
||||
|
||||
export interface CompilerOptions {
|
||||
/**
|
||||
The character set of the input files.
|
||||
|
||||
@default 'utf8'
|
||||
*/
|
||||
charset?: string;
|
||||
|
||||
/**
|
||||
Enables building for project references.
|
||||
|
||||
@default true
|
||||
*/
|
||||
composite?: boolean;
|
||||
|
||||
/**
|
||||
Generates corresponding d.ts files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
declaration?: boolean;
|
||||
|
||||
/**
|
||||
Specify output directory for generated declaration files.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
*/
|
||||
declarationDir?: string;
|
||||
|
||||
/**
|
||||
Show diagnostic information.
|
||||
|
||||
@default false
|
||||
*/
|
||||
diagnostics?: boolean;
|
||||
|
||||
/**
|
||||
Emit a UTF-8 Byte Order Mark (BOM) in the beginning of output files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
emitBOM?: boolean;
|
||||
|
||||
/**
|
||||
Only emit `.d.ts` declaration files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
emitDeclarationOnly?: boolean;
|
||||
|
||||
/**
|
||||
Enable incremental compilation.
|
||||
|
||||
@default `composite`
|
||||
*/
|
||||
incremental?: boolean;
|
||||
|
||||
/**
|
||||
Specify file to store incremental compilation information.
|
||||
|
||||
@default '.tsbuildinfo'
|
||||
*/
|
||||
tsBuildInfoFile?: string;
|
||||
|
||||
/**
|
||||
Emit a single file with source maps instead of having a separate file.
|
||||
|
||||
@default false
|
||||
*/
|
||||
inlineSourceMap?: boolean;
|
||||
|
||||
/**
|
||||
Emit the source alongside the sourcemaps within a single file.
|
||||
|
||||
Requires `--inlineSourceMap` to be set.
|
||||
|
||||
@default false
|
||||
*/
|
||||
inlineSources?: boolean;
|
||||
|
||||
/**
|
||||
Specify JSX code generation: `'preserve'`, `'react'`, or `'react-native'`.
|
||||
|
||||
@default 'preserve'
|
||||
*/
|
||||
jsx?: CompilerOptions.JSX;
|
||||
|
||||
/**
|
||||
Specifies the object invoked for `createElement` and `__spread` when targeting `'react'` JSX emit.
|
||||
|
||||
@default 'React'
|
||||
*/
|
||||
reactNamespace?: string;
|
||||
|
||||
/**
|
||||
Print names of files part of the compilation.
|
||||
|
||||
@default false
|
||||
*/
|
||||
listFiles?: boolean;
|
||||
|
||||
/**
|
||||
Specifies the location where debugger should locate map files instead of generated locations.
|
||||
*/
|
||||
mapRoot?: string;
|
||||
|
||||
/**
|
||||
Specify module code generation: 'None', 'CommonJS', 'AMD', 'System', 'UMD', 'ES6', 'ES2015' or 'ESNext'. Only 'AMD' and 'System' can be used in conjunction with `--outFile`. 'ES6' and 'ES2015' values may be used when targeting 'ES5' or lower.
|
||||
|
||||
@default ['ES3', 'ES5'].includes(target) ? 'CommonJS' : 'ES6'
|
||||
*/
|
||||
module?: CompilerOptions.Module;
|
||||
|
||||
/**
|
||||
Specifies the end of line sequence to be used when emitting files: 'crlf' (Windows) or 'lf' (Unix).
|
||||
|
||||
Default: Platform specific
|
||||
*/
|
||||
newLine?: CompilerOptions.NewLine;
|
||||
|
||||
/**
|
||||
Do not emit output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noEmit?: boolean;
|
||||
|
||||
/**
|
||||
Do not generate custom helper functions like `__extends` in compiled output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noEmitHelpers?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit outputs if any type checking errors were reported.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noEmitOnError?: boolean;
|
||||
|
||||
/**
|
||||
Warn on expressions and declarations with an implied 'any' type.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitAny?: boolean;
|
||||
|
||||
/**
|
||||
Raise error on 'this' expressions with an implied any type.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitThis?: boolean;
|
||||
|
||||
/**
|
||||
Report errors on unused locals.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noUnusedLocals?: boolean;
|
||||
|
||||
/**
|
||||
Report errors on unused parameters.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noUnusedParameters?: boolean;
|
||||
|
||||
/**
|
||||
Do not include the default library file (lib.d.ts).
|
||||
|
||||
@default false
|
||||
*/
|
||||
noLib?: boolean;
|
||||
|
||||
/**
|
||||
Do not add triple-slash references or module import targets to the list of compiled files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noResolve?: boolean;
|
||||
|
||||
/**
|
||||
Disable strict checking of generic signatures in function types.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noStrictGenericChecks?: boolean;
|
||||
|
||||
/**
|
||||
@deprecated use `skipLibCheck` instead.
|
||||
*/
|
||||
skipDefaultLibCheck?: boolean;
|
||||
|
||||
/**
|
||||
Skip type checking of declaration files.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
skipLibCheck?: boolean;
|
||||
|
||||
/**
|
||||
Concatenate and emit output to single file.
|
||||
*/
|
||||
outFile?: string;
|
||||
|
||||
/**
|
||||
Redirect output structure to the directory.
|
||||
*/
|
||||
outDir?: string;
|
||||
|
||||
/**
|
||||
Do not erase const enum declarations in generated code.
|
||||
|
||||
@default false
|
||||
*/
|
||||
preserveConstEnums?: boolean;
|
||||
|
||||
/**
|
||||
Do not resolve symlinks to their real path; treat a symlinked file like a real one.
|
||||
|
||||
@default false
|
||||
*/
|
||||
preserveSymlinks?: boolean;
|
||||
|
||||
/**
|
||||
Keep outdated console output in watch mode instead of clearing the screen.
|
||||
|
||||
@default false
|
||||
*/
|
||||
preserveWatchOutput?: boolean;
|
||||
|
||||
/**
|
||||
Stylize errors and messages using color and context (experimental).
|
||||
|
||||
@default true // Unless piping to another program or redirecting output to a file.
|
||||
*/
|
||||
pretty?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit comments to output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
removeComments?: boolean;
|
||||
|
||||
/**
|
||||
Specifies the root directory of input files.
|
||||
|
||||
Use to control the output directory structure with `--outDir`.
|
||||
*/
|
||||
rootDir?: string;
|
||||
|
||||
/**
|
||||
Unconditionally emit imports for unresolved files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
isolatedModules?: boolean;
|
||||
|
||||
/**
|
||||
Generates corresponding '.map' file.
|
||||
|
||||
@default false
|
||||
*/
|
||||
sourceMap?: boolean;
|
||||
|
||||
/**
|
||||
Specifies the location where debugger should locate TypeScript files instead of source locations.
|
||||
*/
|
||||
sourceRoot?: string;
|
||||
|
||||
/**
|
||||
Suppress excess property checks for object literals.
|
||||
|
||||
@default false
|
||||
*/
|
||||
suppressExcessPropertyErrors?: boolean;
|
||||
|
||||
/**
|
||||
Suppress noImplicitAny errors for indexing objects lacking index signatures.
|
||||
|
||||
@default false
|
||||
*/
|
||||
suppressImplicitAnyIndexErrors?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit declarations for code that has an `@internal` annotation.
|
||||
*/
|
||||
stripInternal?: boolean;
|
||||
|
||||
/**
|
||||
Specify ECMAScript target version.
|
||||
|
||||
@default 'es3'
|
||||
*/
|
||||
target?: CompilerOptions.Target;
|
||||
|
||||
/**
|
||||
Watch input files.
|
||||
|
||||
@default false
|
||||
*/
|
||||
watch?: boolean;
|
||||
|
||||
/**
|
||||
Enables experimental support for ES7 decorators.
|
||||
|
||||
@default false
|
||||
*/
|
||||
experimentalDecorators?: boolean;
|
||||
|
||||
/**
|
||||
Emit design-type metadata for decorated declarations in source.
|
||||
|
||||
@default false
|
||||
*/
|
||||
emitDecoratorMetadata?: boolean;
|
||||
|
||||
/**
|
||||
Specifies module resolution strategy: 'node' (Node) or 'classic' (TypeScript pre 1.6).
|
||||
|
||||
@default ['AMD', 'System', 'ES6'].includes(module) ? 'classic' : 'node'
|
||||
*/
|
||||
moduleResolution?: 'classic' | 'node';
|
||||
|
||||
/**
|
||||
Do not report errors on unused labels.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowUnusedLabels?: boolean;
|
||||
|
||||
/**
|
||||
Report error when not all code paths in function return a value.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitReturns?: boolean;
|
||||
|
||||
/**
|
||||
Report errors for fallthrough cases in switch statement.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noFallthroughCasesInSwitch?: boolean;
|
||||
|
||||
/**
|
||||
Do not report errors on unreachable code.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowUnreachableCode?: boolean;
|
||||
|
||||
/**
|
||||
Disallow inconsistently-cased references to the same file.
|
||||
|
||||
@default false
|
||||
*/
|
||||
forceConsistentCasingInFileNames?: boolean;
|
||||
|
||||
/**
|
||||
Base directory to resolve non-relative module names.
|
||||
*/
|
||||
baseUrl?: string;
|
||||
|
||||
/**
|
||||
Specify path mapping to be computed relative to baseUrl option.
|
||||
*/
|
||||
paths?: {
|
||||
[key: string]: string[];
|
||||
};
|
||||
|
||||
/**
|
||||
List of TypeScript language server plugins to load.
|
||||
|
||||
Requires TypeScript version 2.3 or later.
|
||||
*/
|
||||
plugins?: CompilerOptions.Plugin[];
|
||||
|
||||
/**
|
||||
Specify list of root directories to be used when resolving modules.
|
||||
*/
|
||||
rootDirs?: string[];
|
||||
|
||||
/**
|
||||
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[];
|
||||
|
||||
/**
|
||||
Enable tracing of the name resolution process.
|
||||
|
||||
@default false
|
||||
*/
|
||||
traceResolution?: boolean;
|
||||
|
||||
/**
|
||||
Allow javascript files to be compiled.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowJs?: boolean;
|
||||
|
||||
/**
|
||||
Do not truncate error messages.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noErrorTruncation?: boolean;
|
||||
|
||||
/**
|
||||
Allow default imports from modules with no default export. This does not affect code emit, just typechecking.
|
||||
|
||||
@default module === 'system' || esModuleInterop
|
||||
*/
|
||||
allowSyntheticDefaultImports?: boolean;
|
||||
|
||||
/**
|
||||
Do not emit `'use strict'` directives in module output.
|
||||
|
||||
@default false
|
||||
*/
|
||||
noImplicitUseStrict?: boolean;
|
||||
|
||||
/**
|
||||
Enable to list all emitted files.
|
||||
|
||||
Requires TypeScript version 2.0 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
listEmittedFiles?: boolean;
|
||||
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
The maximum dependency depth to search under `node_modules` and load JavaScript files. Only applicable with `--allowJs`.
|
||||
|
||||
@default 0
|
||||
*/
|
||||
maxNodeModuleJsDepth?: number;
|
||||
|
||||
/**
|
||||
Import emit helpers (e.g. `__extends`, `__rest`, etc..) from tslib.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
importHelpers?: boolean;
|
||||
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
Parse in strict mode and emit `'use strict'` for each source file.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
alwaysStrict?: boolean;
|
||||
|
||||
/**
|
||||
Enable all strict type checking options.
|
||||
|
||||
Requires TypeScript version 2.3 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strict?: boolean;
|
||||
|
||||
/**
|
||||
Enable stricter checking of of the `bind`, `call`, and `apply` methods on functions.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strictBindCallApply?: boolean;
|
||||
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
Report errors in `.js` files.
|
||||
|
||||
Requires TypeScript version 2.3 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
checkJs?: boolean;
|
||||
|
||||
/**
|
||||
Disable bivariant parameter checking for function types.
|
||||
|
||||
Requires TypeScript version 2.6 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strictFunctionTypes?: boolean;
|
||||
|
||||
/**
|
||||
Ensure non-undefined class properties are initialized in the constructor.
|
||||
|
||||
Requires TypeScript version 2.7 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
strictPropertyInitialization?: boolean;
|
||||
|
||||
/**
|
||||
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;
|
||||
|
||||
/**
|
||||
Allow accessing UMD globals from modules.
|
||||
|
||||
@default false
|
||||
*/
|
||||
allowUmdGlobalAccess?: boolean;
|
||||
|
||||
/**
|
||||
Resolve `keyof` to string valued property names only (no numbers or symbols).
|
||||
|
||||
Requires TypeScript version 2.9 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
keyofStringsOnly?: boolean;
|
||||
|
||||
/**
|
||||
Emit ECMAScript standard class fields.
|
||||
|
||||
Requires TypeScript version 3.7 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
useDefineForClassFields?: boolean;
|
||||
|
||||
/**
|
||||
Generates a sourcemap for each corresponding `.d.ts` file.
|
||||
|
||||
Requires TypeScript version 2.9 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
declarationMap?: boolean;
|
||||
|
||||
/**
|
||||
Include modules imported with `.json` extension.
|
||||
|
||||
Requires TypeScript version 2.9 or later.
|
||||
|
||||
@default false
|
||||
*/
|
||||
resolveJsonModule?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
Auto type (.d.ts) acquisition options for this project.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
*/
|
||||
export interface TypeAcquisition {
|
||||
/**
|
||||
Enable auto type acquisition.
|
||||
*/
|
||||
enable?: boolean;
|
||||
|
||||
/**
|
||||
Specifies a list of type declarations to be included in auto type acquisition. For example, `['jquery', 'lodash']`.
|
||||
*/
|
||||
include?: string[];
|
||||
|
||||
/**
|
||||
Specifies a list of type declarations to be excluded from auto type acquisition. For example, `['jquery', 'lodash']`.
|
||||
*/
|
||||
exclude?: string[];
|
||||
}
|
||||
|
||||
export interface References {
|
||||
/**
|
||||
A normalized path on disk.
|
||||
*/
|
||||
path: string;
|
||||
|
||||
/**
|
||||
The path as the user originally wrote it.
|
||||
*/
|
||||
originalPath?: string;
|
||||
|
||||
/**
|
||||
True if the output of this reference should be prepended to the output of this project.
|
||||
|
||||
Only valid for `--outFile` compilations.
|
||||
*/
|
||||
prepend?: boolean;
|
||||
|
||||
/**
|
||||
True if it is intended that this reference form a circularity.
|
||||
*/
|
||||
circular?: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export interface TsConfigJson {
|
||||
/**
|
||||
Instructs the TypeScript compiler how to compile `.ts` files.
|
||||
*/
|
||||
compilerOptions?: TsConfigJson.CompilerOptions;
|
||||
|
||||
/**
|
||||
Auto type (.d.ts) acquisition options for this project.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
*/
|
||||
typeAcquisition?: TsConfigJson.TypeAcquisition;
|
||||
|
||||
/**
|
||||
Enable Compile-on-Save for this project.
|
||||
*/
|
||||
compileOnSave?: boolean;
|
||||
|
||||
/**
|
||||
Path to base configuration file to inherit from.
|
||||
|
||||
Requires TypeScript version 2.1 or later.
|
||||
*/
|
||||
extends?: 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.
|
||||
*/
|
||||
files?: string[];
|
||||
|
||||
/**
|
||||
Specifies a list of files to be excluded from compilation. The `exclude` property only affects the files included via the `include` property and not the `files` property.
|
||||
|
||||
Glob patterns require TypeScript version 2.0 or later.
|
||||
*/
|
||||
exclude?: string[];
|
||||
|
||||
/**
|
||||
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[];
|
||||
}
|
57
node_modules/ansi-escapes/package.json
generated
vendored
Normal file
57
node_modules/ansi-escapes/package.json
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
{
|
||||
"name": "ansi-escapes",
|
||||
"version": "4.3.1",
|
||||
"description": "ANSI escape codes for manipulating the terminal",
|
||||
"license": "MIT",
|
||||
"repository": "sindresorhus/ansi-escapes",
|
||||
"funding": "https://github.com/sponsors/sindresorhus",
|
||||
"author": {
|
||||
"name": "Sindre Sorhus",
|
||||
"email": "sindresorhus@gmail.com",
|
||||
"url": "https://sindresorhus.com"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=8"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "xo && ava && tsd"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"index.d.ts"
|
||||
],
|
||||
"keywords": [
|
||||
"ansi",
|
||||
"terminal",
|
||||
"console",
|
||||
"cli",
|
||||
"string",
|
||||
"tty",
|
||||
"escape",
|
||||
"escapes",
|
||||
"formatting",
|
||||
"shell",
|
||||
"xterm",
|
||||
"log",
|
||||
"logging",
|
||||
"command-line",
|
||||
"text",
|
||||
"vt100",
|
||||
"sequence",
|
||||
"control",
|
||||
"code",
|
||||
"codes",
|
||||
"cursor",
|
||||
"iterm",
|
||||
"iterm2"
|
||||
],
|
||||
"dependencies": {
|
||||
"type-fest": "^0.11.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^13.7.7",
|
||||
"ava": "^2.1.0",
|
||||
"tsd": "^0.11.0",
|
||||
"xo": "^0.25.3"
|
||||
}
|
||||
}
|
245
node_modules/ansi-escapes/readme.md
generated
vendored
Normal file
245
node_modules/ansi-escapes/readme.md
generated
vendored
Normal file
|
@ -0,0 +1,245 @@
|
|||
# ansi-escapes [](https://travis-ci.org/sindresorhus/ansi-escapes)
|
||||
|
||||
> [ANSI escape codes](http://www.termsys.demon.co.uk/vtansi.htm) for manipulating the terminal
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
$ npm install ansi-escapes
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
```js
|
||||
const ansiEscapes = require('ansi-escapes');
|
||||
|
||||
// Moves the cursor two rows up and to the left
|
||||
process.stdout.write(ansiEscapes.cursorUp(2) + ansiEscapes.cursorLeft);
|
||||
//=> '\u001B[2A\u001B[1000D'
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### cursorTo(x, y?)
|
||||
|
||||
Set the absolute position of the cursor. `x0` `y0` is the top left of the screen.
|
||||
|
||||
### cursorMove(x, y?)
|
||||
|
||||
Set the position of the cursor relative to its current position.
|
||||
|
||||
### cursorUp(count)
|
||||
|
||||
Move cursor up a specific amount of rows. Default is `1`.
|
||||
|
||||
### cursorDown(count)
|
||||
|
||||
Move cursor down a specific amount of rows. Default is `1`.
|
||||
|
||||
### cursorForward(count)
|
||||
|
||||
Move cursor forward a specific amount of columns. Default is `1`.
|
||||
|
||||
### cursorBackward(count)
|
||||
|
||||
Move cursor backward a specific amount of columns. Default is `1`.
|
||||
|
||||
### cursorLeft
|
||||
|
||||
Move cursor to the left side.
|
||||
|
||||
### cursorSavePosition
|
||||
|
||||
Save cursor position.
|
||||
|
||||
### cursorRestorePosition
|
||||
|
||||
Restore saved cursor position.
|
||||
|
||||
### cursorGetPosition
|
||||
|
||||
Get cursor position.
|
||||
|
||||
### cursorNextLine
|
||||
|
||||
Move cursor to the next line.
|
||||
|
||||
### cursorPrevLine
|
||||
|
||||
Move cursor to the previous line.
|
||||
|
||||
### cursorHide
|
||||
|
||||
Hide cursor.
|
||||
|
||||
### cursorShow
|
||||
|
||||
Show cursor.
|
||||
|
||||
### eraseLines(count)
|
||||
|
||||
Erase from the current cursor position up the specified amount of rows.
|
||||
|
||||
### eraseEndLine
|
||||
|
||||
Erase from the current cursor position to the end of the current line.
|
||||
|
||||
### eraseStartLine
|
||||
|
||||
Erase from the current cursor position to the start of the current line.
|
||||
|
||||
### eraseLine
|
||||
|
||||
Erase the entire current line.
|
||||
|
||||
### eraseDown
|
||||
|
||||
Erase the screen from the current line down to the bottom of the screen.
|
||||
|
||||
### eraseUp
|
||||
|
||||
Erase the screen from the current line up to the top of the screen.
|
||||
|
||||
### eraseScreen
|
||||
|
||||
Erase the screen and move the cursor the top left position.
|
||||
|
||||
### scrollUp
|
||||
|
||||
Scroll display up one line.
|
||||
|
||||
### scrollDown
|
||||
|
||||
Scroll display down one line.
|
||||
|
||||
### clearScreen
|
||||
|
||||
Clear the terminal screen. (Viewport)
|
||||
|
||||
### clearTerminal
|
||||
|
||||
Clear the whole terminal, including scrollback buffer. (Not just the visible part of it)
|
||||
|
||||
### beep
|
||||
|
||||
Output a beeping sound.
|
||||
|
||||
### link(text, url)
|
||||
|
||||
Create a clickable link.
|
||||
|
||||
[Supported terminals.](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda) Use [`supports-hyperlinks`](https://github.com/jamestalmage/supports-hyperlinks) to detect link support.
|
||||
|
||||
### image(filePath, options?)
|
||||
|
||||
Display an image.
|
||||
|
||||
*Currently only supported on iTerm2 >=3*
|
||||
|
||||
See [term-img](https://github.com/sindresorhus/term-img) for a higher-level module.
|
||||
|
||||
#### input
|
||||
|
||||
Type: `Buffer`
|
||||
|
||||
Buffer of an image. Usually read in with `fs.readFile()`.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### width
|
||||
##### height
|
||||
|
||||
Type: `string | number`
|
||||
|
||||
The width and height are given as a number followed by a unit, or the word "auto".
|
||||
|
||||
- `N`: N character cells.
|
||||
- `Npx`: N pixels.
|
||||
- `N%`: N percent of the session's width or height.
|
||||
- `auto`: The image's inherent size will be used to determine an appropriate dimension.
|
||||
|
||||
##### preserveAspectRatio
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `true`
|
||||
|
||||
### iTerm.setCwd(path?)
|
||||
|
||||
Type: `string`\
|
||||
Default: `process.cwd()`
|
||||
|
||||
[Inform iTerm2](https://www.iterm2.com/documentation-escape-codes.html) of the current directory to help semantic history and enable [Cmd-clicking relative paths](https://coderwall.com/p/b7e82q/quickly-open-files-in-iterm-with-cmd-click).
|
||||
|
||||
### iTerm.annotation(message, options?)
|
||||
|
||||
Creates an escape code to display an "annotation" in iTerm2.
|
||||
|
||||
An annotation looks like this when shown:
|
||||
|
||||
<img src="https://user-images.githubusercontent.com/924465/64382136-b60ac700-cfe9-11e9-8a35-9682e8dc4b72.png" width="500">
|
||||
|
||||
See the [iTerm Proprietary Escape Codes documentation](https://iterm2.com/documentation-escape-codes.html) for more information.
|
||||
|
||||
#### message
|
||||
|
||||
Type: `string`
|
||||
|
||||
The message to display within the annotation.
|
||||
|
||||
The `|` character is disallowed and will be stripped.
|
||||
|
||||
#### options
|
||||
|
||||
Type: `object`
|
||||
|
||||
##### length
|
||||
|
||||
Type: `number`\
|
||||
Default: The remainder of the line
|
||||
|
||||
Nonzero number of columns to annotate.
|
||||
|
||||
##### x
|
||||
|
||||
Type: `number`\
|
||||
Default: Cursor position
|
||||
|
||||
Starting X coordinate.
|
||||
|
||||
Must be used with `y` and `length`.
|
||||
|
||||
##### y
|
||||
|
||||
Type: `number`\
|
||||
Default: Cursor position
|
||||
|
||||
Starting Y coordinate.
|
||||
|
||||
Must be used with `x` and `length`.
|
||||
|
||||
##### isHidden
|
||||
|
||||
Type: `boolean`\
|
||||
Default: `false`
|
||||
|
||||
Create a "hidden" annotation.
|
||||
|
||||
Annotations created this way can be shown using the "Show Annotations" iTerm command.
|
||||
|
||||
## Related
|
||||
|
||||
- [ansi-styles](https://github.com/chalk/ansi-styles) - ANSI escape codes for styling strings in the terminal
|
||||
|
||||
---
|
||||
|
||||
<div align="center">
|
||||
<b>
|
||||
<a href="https://tidelift.com/subscription/pkg/npm-ansi-escapes?utm_source=npm-ansi-escapes&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
|
||||
</b>
|
||||
<br>
|
||||
<sub>
|
||||
Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
|
||||
</sub>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue