first commit

This commit is contained in:
2024-01-19 11:09:11 +01:00
commit b18af7a943
29473 changed files with 4500547 additions and 0 deletions

60
node_modules/typed-assert/.eslintrc.js generated vendored Normal file
View File

@@ -0,0 +1,60 @@
module.exports = {
root: true,
parser: "@typescript-eslint/parser",
extends: [
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
],
settings: {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".d.ts"],
},
},
parserOptions: {
ecmaVersion: 2018,
sourceType: "module",
},
rules: {
"prettier/prettier": [1, { trailingComma: "all", endOfLine: "auto" }],
"@typescript-eslint/no-unused-vars": [1, { argsIgnorePattern: "^_" }],
"@typescript-eslint/no-unused-vars": [1, { argsIgnorePattern: "^_" }],
"@typescript-eslint/naming-convention": [
"error",
{
selector: "interface",
format: ["PascalCase"],
prefix: ["I"],
},
{
selector: "variableLike",
format: ["strictCamelCase", "UPPER_CASE"],
leadingUnderscore: "allow",
},
],
"@typescript-eslint/explicit-function-return-type": [
1,
{
allowExpressions: true,
allowTypedFunctionExpressions: true,
},
],
"import/order": [
1,
{
groups: [
"builtin",
"external",
"internal",
"parent",
"sibling",
"index",
],
"newlines-between": "always",
},
],
},
};

14
node_modules/typed-assert/.vscode/extensions.json generated vendored Normal file
View File

@@ -0,0 +1,14 @@
{
// See https://go.microsoft.com/fwlink/?LinkId=827846 to learn about workspace recommendations.
// Extension identifier format: ${publisher}.${name}. Example: vscode.csharp
// List of extensions which should be recommended for users of this workspace.
"recommendations": [
"CoenraadS.bracket-pair-colorizer-2",
"dbaeumer.vscode-eslint",
"fabiospampinato.vscode-terminals",
"GitHub.vscode-pull-request-github",
"VisualStudioExptTeam.vscodeintellicode"
],
// List of extensions recommended by VS Code that should not be recommended for users of this workspace.
"unwantedRecommendations": []
}

44
node_modules/typed-assert/.vscode/settings.json generated vendored Normal file
View File

@@ -0,0 +1,44 @@
{
"editor.fontLigatures": true,
"editor.suggestSelection": "recentlyUsed",
"editor.tabSize": 2,
"emmet.showAbbreviationSuggestions": false,
"emmet.showExpandedAbbreviation": "never",
"emmet.excludeLanguages": [
"typescript",
"javascript",
],
"eslint.enable": true,
"eslint.packageManager": "npm",
"eslint.validate": [
"javascript",
"typescript",
],
"eslint.workingDirectories": [
{
"directory": ".",
"changeProcessCWD": true
}
],
"eslint.lintTask.enable": true,
"files.associations": {
"*.md": "markdown",
"*.d.ts": "typescript"
},
"files.autoSave": "off",
"javascript.updateImportsOnFileMove.enabled": "always",
"[javascript]": {
"editor.formatOnSave": false
},
"[typescript]": {
"editor.formatOnSave": false
},
"typescript.preferences.importModuleSpecifier": "relative",
"typescript.suggest.paths": true,
"editor.codeActionsOnSave": {
"source.fixAll.eslint": true
},
"editor.suggest.showSnippets": false,
"editor.suggest.snippetsPreventQuickSuggestions": false,
"editor.snippetSuggestions": "none"
}

9
node_modules/typed-assert/.vscode/terminals.json generated vendored Normal file
View File

@@ -0,0 +1,9 @@
{
"autorun": true,
"terminals": [
{
"name": "typed-assert",
"cwd": "[workspaceFolder]"
}
]
}

753
node_modules/typed-assert/API.md generated vendored Normal file
View File

@@ -0,0 +1,753 @@
typed-assert
# typed-assert
## Table of contents
### Type aliases
- [Assert](API.md#assert)
- [Check](API.md#check)
- [SubType](API.md#subtype)
- [WeakAssert](API.md#weakassert)
### Functions
- [assert](API.md#assert)
- [check](API.md#check)
- [defaultAssert](API.md#defaultassert)
- [isArray](API.md#isarray)
- [isArrayOfType](API.md#isarrayoftype)
- [isBoolean](API.md#isboolean)
- [isDate](API.md#isdate)
- [isExactly](API.md#isexactly)
- [isInstanceOf](API.md#isinstanceof)
- [isNever](API.md#isnever)
- [isNotNull](API.md#isnotnull)
- [isNotUndefined](API.md#isnotundefined)
- [isNotVoid](API.md#isnotvoid)
- [isNumber](API.md#isnumber)
- [isOneOf](API.md#isoneof)
- [isOneOfType](API.md#isoneoftype)
- [isOptionOfType](API.md#isoptionoftype)
- [isPromise](API.md#ispromise)
- [isRecord](API.md#isrecord)
- [isRecordOfType](API.md#isrecordoftype)
- [isRecordWithKeys](API.md#isrecordwithkeys)
- [isString](API.md#isstring)
- [isUnknown](API.md#isunknown)
- [safeJsonParse](API.md#safejsonparse)
- [setBaseAssert](API.md#setbaseassert)
## Type aliases
### Assert
Ƭ **Assert**<`Input`, `Output`\>: (`input`: `Input`, `message?`: `string`) => asserts input is SubType<Input, Output\>
#### Type parameters
| Name | Type |
| :------ | :------ |
| `Input` | `unknown` |
| `Output` | `Input` |
#### Type declaration
▸ (`input`, `message?`): asserts input is SubType<Input, Output\>
##### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `Input` |
| `message?` | `string` |
##### Returns
asserts input is SubType<Input, Output\>
#### Defined in
[index.ts:7](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L7)
___
### Check
Ƭ **Check**<`Input`, `Output`\>: (`input`: `Input`) => input is SubType<Input, Output\>
#### Type parameters
| Name | Type |
| :------ | :------ |
| `Input` | `unknown` |
| `Output` | `Input` |
#### Type declaration
▸ (`input`): input is SubType<Input, Output\>
##### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `Input` |
##### Returns
input is SubType<Input, Output\>
#### Defined in
[index.ts:12](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L12)
___
### SubType
Ƭ **SubType**<`Input`, `Output`\>: `Output` extends `Input` ? `Output` : `never`
#### Type parameters
| Name |
| :------ |
| `Input` |
| `Output` |
#### Defined in
[index.ts:5](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L5)
___
### WeakAssert
Ƭ **WeakAssert**: (`input`: `unknown`, `message?`: `string`) => `void`
#### Type declaration
▸ (`input`, `message?`): `void`
##### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message?` | `string` |
##### Returns
`void`
#### Defined in
[index.ts:3](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L3)
## Functions
### assert
`Const` **assert**(`input`, `message?`): asserts input is true
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `boolean` |
| `message?` | `string` |
#### Returns
asserts input is true
#### Defined in
[index.ts:24](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L24)
___
### check
**check**<`Input`, `Output`\>(`assertT`): [`Check`](API.md#check)<`Input`, `Output`\>
#### Type parameters
| Name |
| :------ |
| `Input` |
| `Output` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `assertT` | [`Assert`](API.md#assert)<`Input`, `Output`\> |
#### Returns
[`Check`](API.md#check)<`Input`, `Output`\>
#### Defined in
[index.ts:209](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L209)
___
### defaultAssert
`Const` **defaultAssert**(`input`, `message?`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message?` | `string` |
#### Returns
`void`
#### Defined in
[index.ts:16](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L16)
___
### isArray
**isArray**(`input`, `message?`): asserts input is unknown[]
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message` | `string` |
#### Returns
asserts input is unknown[]
#### Defined in
[index.ts:128](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L128)
___
### isArrayOfType
**isArrayOfType**<`T`\>(`input`, `assertT`, `message?`, `itemMessage?`): asserts input is T[]
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `assertT` | [`Assert`](API.md#assert)<`unknown`, `T`\> |
| `message` | `string` |
| `itemMessage` | `string` |
#### Returns
asserts input is T[]
#### Defined in
[index.ts:147](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L147)
___
### isBoolean
**isBoolean**(`input`, `message?`): asserts input is boolean
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message` | `string` |
#### Returns
asserts input is boolean
#### Defined in
[index.ts:76](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L76)
___
### isDate
**isDate**(`input`, `message?`): asserts input is Date
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message` | `string` |
#### Returns
asserts input is Date
#### Defined in
[index.ts:97](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L97)
___
### isExactly
**isExactly**<`Input`, `Output`\>(`input`, `value`, `message?`): asserts input is SubType<Input, Output\>
#### Type parameters
| Name |
| :------ |
| `Input` |
| `Output` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `Input` |
| `value` | `Output` |
| `message` | `string` |
#### Returns
asserts input is SubType<Input, Output\>
#### Defined in
[index.ts:68](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L68)
___
### isInstanceOf
**isInstanceOf**<`T`\>(`input`, `constructor`, `message?`): asserts input is T
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `constructor` | (...`args`: `any`[]) => `T` |
| `message` | `string` |
#### Returns
asserts input is T
#### Defined in
[index.ts:193](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L193)
___
### isNever
**isNever**(`_input`, `message?`): `never`
#### Parameters
| Name | Type |
| :------ | :------ |
| `_input` | `never` |
| `message` | `string` |
#### Returns
`never`
#### Defined in
[index.ts:40](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L40)
___
### isNotNull
**isNotNull**<`T`\>(`input`, `message?`): asserts input is T
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | ``null`` \| `T` |
| `message` | `string` |
#### Returns
asserts input is T
#### Defined in
[index.ts:47](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L47)
___
### isNotUndefined
▸ **isNotUndefined**<`T`\>(`input`, `message?`): asserts input is T
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `undefined` \| `T` |
| `message` | `string` |
#### Returns
asserts input is T
#### Defined in
[index.ts:54](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L54)
___
### isNotVoid
▸ **isNotVoid**<`T`\>(`input`, `message?`): asserts input is Exclude<T, undefined \| null \| void\>
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `T` |
| `message` | `string` |
#### Returns
asserts input is Exclude<T, undefined \| null \| void\>
#### Defined in
[index.ts:61](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L61)
___
### isNumber
▸ **isNumber**(`input`, `message?`): asserts input is number
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message` | `string` |
#### Returns
asserts input is number
#### Defined in
[index.ts:83](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L83)
___
### isOneOf
▸ **isOneOf**<`Input`, `Output`\>(`input`, `values`, `message?`): asserts input is SubType<Input, Output\>
#### Type parameters
| Name |
| :------ |
| `Input` |
| `Output` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `Input` |
| `values` | readonly `Output`[] |
| `message` | `string` |
#### Returns
asserts input is SubType<Input, Output\>
#### Defined in
[index.ts:170](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L170)
___
### isOneOfType
▸ **isOneOfType**<`T`\>(`input`, `assertT`, `message?`, `itemMessage?`): asserts input is T
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `assertT` | [`Assert`](API.md#assert)<`unknown`, `T`\>[] |
| `message` | `string` |
| `itemMessage?` | `string` |
#### Returns
asserts input is T
#### Defined in
[index.ts:178](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L178)
___
### isOptionOfType
▸ **isOptionOfType**<`Input`, `Output`\>(`input`, `assertT`, `message?`): asserts input is SubType<Input, undefined\> \| SubType<Input, Output\>
#### Type parameters
| Name |
| :------ |
| `Input` |
| `Output` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `undefined` \| `Input` |
| `assertT` | [`Assert`](API.md#assert)<`Input`, `Output`\> |
| `message` | `string` |
#### Returns
asserts input is SubType<Input, undefined\> \| SubType<Input, Output\>
#### Defined in
[index.ts:159](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L159)
___
### isPromise
▸ **isPromise**(`input`, `message?`): asserts input is Promise<unknown\>
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message` | `string` |
#### Returns
asserts input is Promise<unknown\>
#### Defined in
[index.ts:202](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L202)
___
### isRecord
▸ **isRecord**(`input`, `message?`): asserts input is Record<string, unknown\>
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message` | `string` |
#### Returns
asserts input is Record<string, unknown\>
#### Defined in
[index.ts:104](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L104)
___
### isRecordOfType
▸ **isRecordOfType**<`T`\>(`input`, `assertT`, `message?`, `itemMessage?`): asserts input is Record<string, T\>
#### Type parameters
| Name |
| :------ |
| `T` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `assertT` | [`Assert`](API.md#assert)<`unknown`, `T`\> |
| `message` | `string` |
| `itemMessage` | `string` |
#### Returns
asserts input is Record<string, T\>
#### Defined in
[index.ts:135](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L135)
___
### isRecordWithKeys
▸ **isRecordWithKeys**<`K`\>(`input`, `keys`, `message?`): asserts input is { readonly [Key in string]: unknown }
#### Type parameters
| Name | Type |
| :------ | :------ |
| `K` | extends `string` |
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `keys` | `K`[] |
| `message` | `string` |
#### Returns
asserts input is { readonly [Key in string]: unknown }
#### Defined in
[index.ts:115](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L115)
___
### isString
▸ **isString**(`input`, `message?`): asserts input is string
#### Parameters
| Name | Type |
| :------ | :------ |
| `input` | `unknown` |
| `message` | `string` |
#### Returns
asserts input is string
#### Defined in
[index.ts:90](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L90)
___
### isUnknown
▸ **isUnknown**(`_input`): \_input is unknown
#### Parameters
| Name | Type |
| :------ | :------ |
| `_input` | `unknown` |
#### Returns
\_input is unknown
#### Defined in
[index.ts:36](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L36)
___
### safeJsonParse
▸ `Const` **safeJsonParse**(`json`): `unknown`
#### Parameters
| Name | Type |
| :------ | :------ |
| `json` | `string` |
#### Returns
`unknown`
#### Defined in
[index.ts:33](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L33)
___
### setBaseAssert
▸ **setBaseAssert**(`assert?`): `void`
#### Parameters
| Name | Type |
| :------ | :------ |
| `assert?` | [`WeakAssert`](API.md#weakassert) |
#### Returns
`void`
#### Defined in
[index.ts:27](https://github.com/elierotenberg/typed-assert/blob/master/src/index.ts#L27)

241
node_modules/typed-assert/README.md generated vendored Normal file
View File

@@ -0,0 +1,241 @@
# `typed-assert`
`typed-assert` is a typesafe assertion library implementing the [TS 3.7 Assertion Functions](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-7.html#assertion-functions) API, without external dependencies.
See the [documentation](API.md).
### Consider using [`zod`](https://github.com/colinhacks/zod)
While this library does a fine job for most simple use cases, please consider using [`zod`](https://github.com/colinhacks/zod) if you need more complex assertions.
### Install
```npm install typed-assert```
or
```yarn add typed-assert```
### Why is it useful?
`typed-assert` promotes using `unknown` instead of `any` for "untrusted" values, e.g. user input, while still benefiting from incremental typing.
For example, `JSON.stringify` returns `any`, which is not typesafe. With `typed-assert`, we can instead treat the result as `unknown` and gradually check the contents at runtime and still get correct type inference:
```ts
import * as t from "typed-assert";
const parseConfigFile = (file: string): { readonly a: string, readonly b: number } => {
const contents = JSON.parse(fs.readFileSync(file, { encoding: 'utf8'})) as unknown;
// contents is "unknown" instead of any, because we don't trust the input yet
t.isRecord(contents);
// contents is "Record<string, unknown>"
t.isString(contents.a);
// contents.a is "string"
t.isNumber(contents.b):
// contents.b is "number";
return {
a: contents.a,
b: contents.b,
}; // correctly typed
}
```
### How is it different from chai, jest.expect, etc?
`typed-assert` is both a compile-time and runtime assert library. It leverages the `assertion function` feature of TypeScript to help the typechecker narrow the inferred types. In many cases, this significantly reduces the need to use `any`, and promotes using `unknown` instead.
For example:
```ts
const u: unknown = {
a: "value",
b: 12,
};
chai.assert.typeOf(u, "object");
// u is still "unknown"
chai.assert.isNotNull(u);
// u is still "unknown"
chai.assert.typeof(u.a, "string");
// TS Error (ts2571): u is "unknown"
import * as t from "typed-assert";
t.isRecord(u);
// u is Record<string, unknown>
t.isString(u.a);
// u.a is string
t.isNumber(u.b);
// u.b is number
const v: { a: string; b: number } = u;
// no need to us `as ...`
```
### Usage
`typed-assert` comes with a set of common assertions, as well as assertion combinators and utilities.
See [the documentation](./API.md) for a full reference.
```ts
import * as t from "typed-assert";
// Base asserts
t.isExactly("a", "a");
t.isNotUndefined(null);
t.isNotNull(undefined);
// Asserts combinators
t.isOneOf("b", ["a", "b", "c"]);
t.isArrayOf([2, 3, 4], t.isNumber);
// Custom composite checks
interface ICustomType {
readonly a: {
readonly b: "c";
readonly d: string;
};
readonly f?: number;
}
function assertCustomType(input: unknown): asserts input is ICustomType {
t.isRecordWithKeys(input, ["a", "f"]);
t.isRecordWithKeys(input.a, ["b", "d"]);
t.isExactly(input.a.b, "c");
t.isString(input.a.d);
t.isOption(input.f, t.isNumber);
}
const v = {
a: {
b: "c",
d: "",
},
};
assertCustomType(v);
```
This library also comes with a combinator to transform an assertion functions into a [type guard function](https://www.typescriptlang.org/docs/handbook/advanced-types.html#user-defined-type-guards):
```ts
const checkNumber = t.check(t.isNumber);
checkNumber(1) === true;
checkNumber("") === false;
```
It is especially convenient when combined with functional operations such as `Array#filter`:
```ts
const t = ["a", 3, "c", 4, null, 2]
.filter(t.check(t.isNumber))
.map(x => x % 2 === 0 ? x : null) // x: number
.filter(t.check(t.isNotNull));
// t: number[] = [4, 2]
```
To encourage using asserts when dealing with untrusted JSON input, the following function is also exported:
```ts
export const safeJsonParse = (json: string): unknown =>
JSON.parse(json) as unknown;
```
### Configuration
This library is designed to work in the browser as well as in Node without external dependencies, and by default does not use the `assert` module from the Node stdlib, so it ships with a very basic `assert` implementation:
```ts
export type WeakAssert = (input: unknown, message?: string) => void;
export const defaultAssert: WeakAssert = (condition, message) => {
if (!condition) {
throw new TypeError(message);
}
};
```
It is however possible to configure the library to use a provided base `assert` function, such as the native `assert` module:
```ts
import * as t from "typed-assert";
import nodeAssert from "assert";
t.setBaseAssert(nodeAssert);
```
### Caveats
Due to limitations in the typechecker, there are syntactic restrictions in how to define and use type assertion functions. For example, you can not dynamically define an assertion function, even if it looks like a static definition.
Thus the following code won't compile:
```ts
function createIsExactly<T>(value: T): (input: unknown) => asserts input is T {
return function isExactly(input: unknown): asserts input is T {
t.isExactly(input, value);
};
}
// No problem so far
createIsExactly("a")(null);
// Won't compile:
// Assertions require the call target to be an
// identifier or qualified name.ts(2776)
```
For similar reasons, it is not possible to use type-inferred arrow functions to define assertion functions:
```ts
const isExactlyNull = (input: unknown): asserts input is null => assert(input === value);
// No problem so far
isExactlyNull("a", null):
// Won't compile:
// Assertions require the call target to be an
// identifier or qualified name.ts(2776)
```
It is however possible to use arrow function with explicit typing of the left-hand operand:
```ts
const isExactlyNull: (input: unknown) => asserts input is null = (input) =>
assert(input === null);
isExactlyNull("a");
// No problem
```
To simplify the implementation,
To simplify this pattern, this library also exports the `Assert<Input, Output>` type as defined below:
```ts
export type Assert<T> = (
input: unknown,
message?: string,
) => asserts input is T;
const isExactlyNull: Assert<null> = (input) => assert(input === null);
isExactlyNull("a");
// No problem
```
For convenience, this library also exports the following types, used internally:
```ts
export type WeakAssert = (input: unknown, message?: string) => void;
export type SubType<Input, Output> = Output extends Input ? Output : never;
export type Assert<Input = unknown, Output = Input> = (
input: Input,
message?: string,
) => asserts input is SubType<Input, Output>;
export type Check<Input = unknown, Output = Input> = (
input: Input,
) => input is SubType<Input, Output>;
```
This way we can write:
```ts
const isExactlyNull: Assert<unknown, null> = (input) =>
assert(input === null);
isExactlyNull("a");
```

View File

@@ -0,0 +1 @@
export {};

363
node_modules/typed-assert/build/__tests__/index.test.js generated vendored Normal file
View File

@@ -0,0 +1,363 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const tslib_1 = require("tslib");
const assert_1 = (0, tslib_1.__importDefault)(require("assert"));
const t = (0, tslib_1.__importStar)(require(".."));
class C {
}
const fixtures = {
null: null,
undefined: undefined,
string: "",
number: 0,
boolean: true,
date: new Date(),
promise: Promise.resolve(null),
record: {},
array: [],
recordWithKeys: {
a: {
b: {
c: "d",
},
e: null,
},
f: "g",
},
recordOfStrings: {
a: "",
b: "",
},
recordOfNumbers: {
a: 0,
b: 1,
},
strings: ["a", "b", "c"],
numbers: [0, 1, 2],
c: new C(),
};
const entries = Object.entries(fixtures);
const orNull = (t) => t;
const orUndefined = (t) => t;
const baseAsserts = [
["default", t.defaultAssert],
["node", assert_1.default],
];
describe("typed-assert", () => {
for (const [label, baseAssert] of baseAsserts) {
describe(label, () => {
t.setBaseAssert(baseAssert);
test("isUnknown", () => {
for (const value of Object.values(fixtures)) {
expect(() => t.isUnknown(value)).not.toThrow();
}
});
test("isNever", () => {
expect(() => {
const value = "a";
switch (value) {
case "a":
case "b":
return;
}
t.isNever(value);
}).not.toThrow();
});
test("isNotNull", () => {
const v = orNull(fixtures.string);
t.isNotNull(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "null") {
expect(() => t.isNotNull(value)).toThrow();
}
else {
expect(() => t.isNotNull(value)).not.toThrow();
}
}
});
test("isNotUndefined", () => {
const v = orUndefined(fixtures.string);
t.isNotUndefined(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "undefined") {
expect(() => t.isNotUndefined(value)).toThrow();
}
else {
expect(() => t.isNotUndefined(value)).not.toThrow();
}
}
});
test("isNotVoid", () => {
const v = orNull(orUndefined(fixtures.string));
t.isNotVoid(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "null" || key === "undefined") {
expect(() => t.isNotVoid(value)).toThrow();
}
else {
expect(() => t.isNotVoid(value)).not.toThrow();
}
}
});
test("isExactly", () => {
const v = orUndefined("value");
t.isExactly(v, "value");
// v is "value"
for (const [, value] of entries) {
expect(() => t.isExactly(value, value)).not.toThrow();
for (const [, otherValue] of entries) {
if (otherValue !== value) {
expect(() => t.isExactly(value, otherValue)).toThrow();
expect(() => t.isExactly(otherValue, value)).toThrow();
}
}
}
});
test("isBoolean", () => {
const v = orNull(fixtures.boolean);
t.isBoolean(v);
// v is "boolean"
for (const [key, value] of entries) {
if (key === "boolean") {
expect(() => t.isBoolean(value)).not.toThrow();
}
else {
expect(() => t.isBoolean(value)).toThrow();
}
}
});
test("isNumber", () => {
const v = orNull(fixtures.number);
t.isNumber(v);
// v is "number"
for (const [key, value] of entries) {
if (key === "string") {
expect(() => t.isString(value)).not.toThrow();
}
else {
expect(() => t.isString(value)).toThrow();
}
}
});
test("isString", () => {
const v = orNull(fixtures.string);
t.isString(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "string") {
expect(() => t.isString(value)).not.toThrow();
}
else {
expect(() => t.isString(value)).toThrow();
}
}
});
test("isDate", () => {
const v = orNull(fixtures.date);
t.isDate(v);
// v is "Date"
for (const [key, value] of entries) {
if (key === "date") {
expect(() => t.isDate(value)).not.toThrow();
}
else {
expect(() => t.isDate(value)).toThrow();
}
}
});
test("isPromise", () => {
const v = orNull(fixtures.promise);
t.isPromise(v);
// v is "Promise<null>"
for (const [key, value] of entries) {
if (key === "promise") {
expect(() => t.isPromise(value)).not.toThrow();
}
else {
expect(() => t.isPromise(value)).toThrow();
}
}
});
test("isRecord", () => {
const v = orNull(fixtures.record);
t.isRecord(v);
// v is "Record<string, unkown>"
for (const [key, value] of entries) {
if ([
"record",
"recordOfStrings",
"recordOfNumbers",
"recordWithKeys",
"date",
"promise",
"array",
"strings",
"numbers",
"c",
].includes(key)) {
expect(() => t.isRecord(value)).not.toThrow();
}
else {
expect(() => t.isRecord(value)).toThrow();
}
}
});
test("isArray", () => {
const v = orNull(fixtures.array);
t.isArray(v);
// v is unknown[]
for (const [key, value] of entries) {
if (["array", "strings", "numbers"].includes(key)) {
expect(() => t.isArray(value)).not.toThrow();
}
else {
expect(() => t.isArray(value)).toThrow();
}
}
});
test("isRecordWithKeys", () => {
const keys = Object.keys(fixtures.recordWithKeys);
const v = orNull(fixtures.recordWithKeys);
t.isRecordWithKeys(v, keys);
// v is typeof fixtures.recordWithKeys
for (const [key, value] of entries) {
if (key === "recordWithKeys") {
expect(() => t.isRecordWithKeys(value, keys)).not.toThrow();
}
else {
expect(() => t.isRecordWithKeys(value, keys)).toThrow();
}
}
expect(() => t.isRecordWithKeys(fixtures.recordWithKeys, ["a"])).not.toThrow();
expect(() => t.isRecordWithKeys(fixtures.recordWithKeys, ["b"])).toThrow();
expect(() => t.isRecordWithKeys(fixtures.recordWithKeys, ["f"])).not.toThrow();
expect(() => t.isRecordWithKeys(fixtures.recordWithKeys.a, ["b", "e"])).not.toThrow();
expect(() => t.isRecordWithKeys(fixtures.recordWithKeys, ["a", "b"])).toThrow();
});
test("isRecordOfType", () => {
const v = orNull(fixtures.recordOfNumbers);
t.isRecordOfType(v, t.isNumber);
// v is Record<string, number>
for (const [key, value] of entries) {
if ([
"record",
"recordOfNumbers",
"array",
"numbers",
"date",
"promise",
"c",
].includes(key)) {
expect(() => t.isRecordOfType(value, t.isNumber)).not.toThrow();
}
else {
expect(() => t.isRecordOfType(value, t.isNumber)).toThrow();
}
}
});
test("isArrayOfType", () => {
const v = orNull(fixtures.numbers);
t.isArrayOfType(v, t.isNumber);
// v is number[]
for (const [key, value] of entries) {
if (["array", "numbers"].includes(key)) {
expect(() => t.isArrayOfType(value, t.isNumber)).not.toThrow();
}
else {
expect(() => t.isArrayOfType(value, t.isNumber)).toThrow();
}
}
});
test("isOptionOfType", () => {
const v = orNull(fixtures.number);
t.isOptionOfType(v, t.isNumber);
// v is "number"
for (const [key, value] of entries) {
if (["undefined", "number"].includes(key)) {
expect(() => t.isOptionOfType(value, t.isNumber)).not.toThrow();
}
else {
expect(() => t.isOptionOfType(value, t.isNumber)).toThrow();
}
}
});
test("isOneOf", () => {
const v = orNull("a");
t.isOneOf(v, ["a", "b"]);
// v is "a"
for (const [key, value] of entries) {
if (key === "number") {
expect(() => t.isOneOf(value, [fixtures.number, fixtures.number + 1])).not.toThrow();
}
else {
expect(() => t.isOneOf(value, [fixtures.number, fixtures.number + 1])).toThrow();
}
}
});
test("isOneOfType", () => {
const v = orNull(fixtures.string);
t.isOneOfType(v, [t.isString, t.isNumber]);
// v is "string"
for (const [key, value] of entries) {
if (["string", "number"].includes(key)) {
expect(() => t.isOneOfType(value, [t.isString, t.isNumber])).not.toThrow();
}
else {
expect(() => t.isOneOfType(value, [t.isString, t.isNumber])).toThrow();
}
}
});
test("isInstanceOf", () => {
const v = orNull(fixtures.date);
t.isInstanceOf(v, Date);
// v is Date
for (const [key, value] of entries) {
if (key === "c") {
expect(() => t.isInstanceOf(value, C)).not.toThrow();
}
else {
expect(() => t.isInstanceOf(value, C)).toThrow();
}
}
});
test("safeJsonParse", () => {
const input = {
a: {
b: {
c: "d",
},
e: null,
},
f: "g",
};
function assertIsInput(input) {
t.isRecordWithKeys(input, ["a", "f"]);
t.isRecordWithKeys(input.a, ["b", "e"]);
t.isRecordWithKeys(input.a.b, ["c"]);
t.isExactly(input.a.b.c, "d");
t.isExactly(input.a.e, null);
t.isExactly(input.f, "g");
}
const json = JSON.stringify(input);
const output = t.safeJsonParse(json);
assertIsInput(output);
const typedOutput = output;
expect(typedOutput).toEqual(input);
});
test("check filter", () => {
const a = entries
.map(([, value]) => value)
.filter(t.check(t.isNumber))
.map((value) => (value % 0 === 0 ? value : null))
.filter(t.check(t.isNotNull));
for (const item of a) {
expect(() => t.isNumber(item)).not.toThrow();
}
});
});
}
});
//# sourceMappingURL=index.test.js.map

File diff suppressed because one or more lines are too long

31
node_modules/typed-assert/build/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,31 @@
export declare type WeakAssert = (input: unknown, message?: string) => void;
export declare type SubType<Input, Output> = Output extends Input ? Output : never;
export declare type Assert<Input = unknown, Output = Input> = (input: Input, message?: string) => asserts input is SubType<Input, Output>;
export declare type Check<Input = unknown, Output = Input> = (input: Input) => input is SubType<Input, Output>;
export declare const defaultAssert: WeakAssert;
export declare const assert: Assert<boolean, true>;
export declare function setBaseAssert(assert?: WeakAssert): void;
export declare const safeJsonParse: (json: string) => unknown;
export declare function isUnknown(_input: unknown): _input is unknown;
export declare function isNever(_input: never, message?: string): never;
export declare function isNotNull<T>(input: null | T, message?: string): asserts input is T;
export declare function isNotUndefined<T>(input: undefined | T, message?: string): asserts input is T;
export declare function isNotVoid<T>(input: T, message?: string): asserts input is Exclude<T, undefined | null | void>;
export declare function isExactly<Input, Output>(input: Input, value: Output, message?: string): asserts input is SubType<Input, Output>;
export declare function isBoolean(input: unknown, message?: string): asserts input is boolean;
export declare function isNumber(input: unknown, message?: string): asserts input is number;
export declare function isString(input: unknown, message?: string): asserts input is string;
export declare function isDate(input: unknown, message?: string): asserts input is Date;
export declare function isRecord(input: unknown, message?: string): asserts input is Record<string, unknown>;
export declare function isRecordWithKeys<K extends string>(input: unknown, keys: K[], message?: string): asserts input is {
readonly [Key in K]: unknown;
};
export declare function isArray(input: unknown, message?: string): asserts input is unknown[];
export declare function isRecordOfType<T>(input: unknown, assertT: Assert<unknown, T>, message?: string, itemMessage?: string): asserts input is Record<string, T>;
export declare function isArrayOfType<T>(input: unknown, assertT: Assert<unknown, T>, message?: string, itemMessage?: string): asserts input is T[];
export declare function isOptionOfType<Input, Output>(input: Input | undefined, assertT: Assert<Input, Output>, message?: string): asserts input is SubType<Input, Output | undefined>;
export declare function isOneOf<Input, Output>(input: Input, values: readonly Output[], message?: string): asserts input is SubType<Input, Output>;
export declare function isOneOfType<T>(input: unknown, assertT: Assert<unknown, T>[], message?: string, itemMessage?: string): asserts input is T;
export declare function isInstanceOf<T>(input: unknown, constructor: new (...args: any[]) => T, message?: string): asserts input is T;
export declare function isPromise(input: unknown, message?: string): asserts input is Promise<unknown>;
export declare function check<Input, Output>(assertT: Assert<Input, Output>): Check<Input, Output>;

139
node_modules/typed-assert/build/index.js generated vendored Normal file
View File

@@ -0,0 +1,139 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.check = exports.isPromise = exports.isInstanceOf = exports.isOneOfType = exports.isOneOf = exports.isOptionOfType = exports.isArrayOfType = exports.isRecordOfType = exports.isArray = exports.isRecordWithKeys = exports.isRecord = exports.isDate = exports.isString = exports.isNumber = exports.isBoolean = exports.isExactly = exports.isNotVoid = exports.isNotUndefined = exports.isNotNull = exports.isNever = exports.isUnknown = exports.safeJsonParse = exports.setBaseAssert = exports.assert = exports.defaultAssert = void 0;
const expectedToBe = (type) => `expected to be ${type}`;
const defaultAssert = (condition, message) => {
if (!condition) {
throw new TypeError(message);
}
};
exports.defaultAssert = defaultAssert;
let baseAssert = exports.defaultAssert;
const assert = (condition, message) => baseAssert(condition, message);
exports.assert = assert;
function setBaseAssert(assert) {
if (assert) {
baseAssert = assert;
}
}
exports.setBaseAssert = setBaseAssert;
const safeJsonParse = (json) => JSON.parse(json);
exports.safeJsonParse = safeJsonParse;
function isUnknown(_input) {
return true;
}
exports.isUnknown = isUnknown;
function isNever(_input, message = expectedToBe("unreachable")) {
throw new TypeError(message);
}
exports.isNever = isNever;
function isNotNull(input, message = expectedToBe("not null")) {
(0, exports.assert)(input !== null, message);
}
exports.isNotNull = isNotNull;
function isNotUndefined(input, message = expectedToBe("not undefined")) {
(0, exports.assert)(input !== undefined, message);
}
exports.isNotUndefined = isNotUndefined;
function isNotVoid(input, message = expectedToBe("neither null nor undefined")) {
(0, exports.assert)(input !== null && input !== undefined, message);
}
exports.isNotVoid = isNotVoid;
function isExactly(input, value, message = expectedToBe(`exactly ${value}`)) {
(0, exports.assert)(input === value, message);
}
exports.isExactly = isExactly;
function isBoolean(input, message = expectedToBe("a boolean")) {
(0, exports.assert)(typeof input === "boolean", message);
}
exports.isBoolean = isBoolean;
function isNumber(input, message = expectedToBe("a number")) {
(0, exports.assert)(typeof input === "number", message);
}
exports.isNumber = isNumber;
function isString(input, message = expectedToBe("a string")) {
(0, exports.assert)(typeof input === "string", message);
}
exports.isString = isString;
function isDate(input, message = expectedToBe("a Date")) {
(0, exports.assert)(input instanceof Date, message);
}
exports.isDate = isDate;
function isRecord(input, message = expectedToBe("a record")) {
(0, exports.assert)(typeof input === "object", message);
isNotNull(input, message);
for (const key of Object.keys(input)) {
isString(key, message);
}
}
exports.isRecord = isRecord;
function isRecordWithKeys(input, keys, message = expectedToBe(`a record with keys ${keys.join(", ")}`)) {
isRecord(input, message);
for (const key of keys) {
isNotUndefined(input[key]);
}
}
exports.isRecordWithKeys = isRecordWithKeys;
function isArray(input, message = expectedToBe("an array")) {
(0, exports.assert)(Array.isArray(input), message);
}
exports.isArray = isArray;
function isRecordOfType(input, assertT, message = expectedToBe("a record of given type"), itemMessage = expectedToBe("of given type")) {
isRecord(input, message);
for (const item of Object.values(input)) {
assertT(item, itemMessage);
}
}
exports.isRecordOfType = isRecordOfType;
function isArrayOfType(input, assertT, message = expectedToBe("an array of given type"), itemMessage = expectedToBe("of given type")) {
isArray(input, message);
for (const item of input) {
assertT(item, itemMessage);
}
}
exports.isArrayOfType = isArrayOfType;
function isOptionOfType(input, assertT, message = expectedToBe("option of given type")) {
if (input === undefined) {
return;
}
assertT(input, message);
}
exports.isOptionOfType = isOptionOfType;
function isOneOf(input, values, message = expectedToBe(`one of ${values.join(", ")}`)) {
(0, exports.assert)(values.includes(input), message);
}
exports.isOneOf = isOneOf;
function isOneOfType(input, assertT, message = expectedToBe(`one of type`), itemMessage) {
for (const assert of assertT) {
try {
assert(input, itemMessage);
return;
}
catch (_) { }
}
throw new TypeError(message);
}
exports.isOneOfType = isOneOfType;
function isInstanceOf(input,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor, message = expectedToBe("an instance of given constructor")) {
(0, exports.assert)(input instanceof constructor, message);
}
exports.isInstanceOf = isInstanceOf;
function isPromise(input, message = expectedToBe("a promise")) {
isInstanceOf(input, Promise, message);
}
exports.isPromise = isPromise;
function check(assertT) {
return (input) => {
try {
assertT(input);
return true;
}
catch (_) {
return false;
}
};
}
exports.check = check;
//# sourceMappingURL=index.js.map

1
node_modules/typed-assert/build/index.js.map generated vendored Normal file
View File

@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}

1
node_modules/typed-assert/build/tsconfig.tsbuildinfo generated vendored Normal file

File diff suppressed because one or more lines are too long

6
node_modules/typed-assert/jest.config.js generated vendored Normal file
View File

@@ -0,0 +1,6 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "node",
maxConcurrency: 50,
moduleFileExtensions: ["js", "json", "jsx", "ts", "tsx", "d.ts"],
};

45
node_modules/typed-assert/package.json generated vendored Normal file
View File

@@ -0,0 +1,45 @@
{
"name": "typed-assert",
"version": "1.0.9",
"description": "typesafe assertion library for TypeScript 3.7+",
"main": "build/index.js",
"scripts": {
"test:src": "jest src/**/*.test.ts",
"test:build": "jest build/**/*.test.js",
"clean:doc": "rm -rf doc && rm -rf API.md",
"build:doc": "npm run clean:doc && typedoc && sed s/README.md/API.md/ doc/README.md > API.md && rm -rf doc",
"clean:ts": "rm -rf build",
"build:ts": "npm run clean:ts && tsc -p .",
"build": "npm run build:doc && npm run build:ts"
},
"repository": {
"type": "git",
"url": "git+https://github.com/elierotenberg/typed-assert.git"
},
"keywords": [
"assert",
"typescript"
],
"author": "Elie Rotenberg <elie@rotenberg.io>",
"license": "MIT",
"bugs": {
"url": "https://github.com/elierotenberg/typed-assert/issues"
},
"homepage": "https://github.com/elierotenberg/typed-assert#readme",
"devDependencies": {
"@types/jest": "^27.4.0",
"@types/node": "^17.0.18",
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-import": "^2.25.4",
"eslint-plugin-prettier": "^4.0.0",
"jest": "^27.5.1",
"prettier": "^2.5.1",
"ts-jest": "^27.1.3",
"typedoc": "^0.22.11",
"typedoc-plugin-markdown": "^3.11.14",
"typescript": "^4.5.5"
}
}

403
node_modules/typed-assert/src/__tests__/index.test.ts generated vendored Normal file
View File

@@ -0,0 +1,403 @@
import nodeAssert from "assert";
import * as t from "..";
class C {}
const fixtures = {
null: null,
undefined: undefined,
string: "",
number: 0,
boolean: true,
date: new Date(),
promise: Promise.resolve(null),
record: {} as Record<string, unknown>,
array: [] as unknown[],
recordWithKeys: {
a: {
b: {
c: "d",
},
e: null,
},
f: "g",
} as const,
recordOfStrings: {
a: "",
b: "",
} as Record<string, string>,
recordOfNumbers: {
a: 0,
b: 1,
} as Record<string, number>,
strings: ["a", "b", "c"] as string[],
numbers: [0, 1, 2] as number[],
c: new C(),
};
const entries = Object.entries(fixtures) as [
keyof typeof fixtures,
typeof fixtures[keyof typeof fixtures],
][];
const orNull = <T>(t: T): T | null => t;
const orUndefined = <T>(t: T): T | undefined => t;
const baseAsserts: [string, t.WeakAssert][] = [
["default", t.defaultAssert],
["node", nodeAssert],
];
describe("typed-assert", () => {
for (const [label, baseAssert] of baseAsserts) {
describe(label, () => {
t.setBaseAssert(baseAssert);
test("isUnknown", () => {
for (const value of Object.values(fixtures)) {
expect(() => t.isUnknown(value)).not.toThrow();
}
});
test("isNever", () => {
expect(() => {
const value = "a" as "a" | "b";
switch (value) {
case "a":
case "b":
return;
}
t.isNever(value);
}).not.toThrow();
});
test("isNotNull", () => {
const v = orNull(fixtures.string);
t.isNotNull(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "null") {
expect(() => t.isNotNull(value)).toThrow();
} else {
expect(() => t.isNotNull(value)).not.toThrow();
}
}
});
test("isNotUndefined", () => {
const v = orUndefined(fixtures.string);
t.isNotUndefined(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "undefined") {
expect(() => t.isNotUndefined(value)).toThrow();
} else {
expect(() => t.isNotUndefined(value)).not.toThrow();
}
}
});
test("isNotVoid", () => {
const v = orNull(orUndefined(fixtures.string));
t.isNotVoid(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "null" || key === "undefined") {
expect(() => t.isNotVoid(value)).toThrow();
} else {
expect(() => t.isNotVoid(value)).not.toThrow();
}
}
});
test("isExactly", () => {
const v = orUndefined("value");
t.isExactly(v, "value");
// v is "value"
for (const [, value] of entries) {
expect(() => t.isExactly(value, value)).not.toThrow();
for (const [, otherValue] of entries) {
if (otherValue !== value) {
expect(() => t.isExactly(value, otherValue)).toThrow();
expect(() => t.isExactly(otherValue, value)).toThrow();
}
}
}
});
test("isBoolean", () => {
const v = orNull(fixtures.boolean);
t.isBoolean(v);
// v is "boolean"
for (const [key, value] of entries) {
if (key === "boolean") {
expect(() => t.isBoolean(value)).not.toThrow();
} else {
expect(() => t.isBoolean(value)).toThrow();
}
}
});
test("isNumber", () => {
const v = orNull(fixtures.number);
t.isNumber(v);
// v is "number"
for (const [key, value] of entries) {
if (key === "string") {
expect(() => t.isString(value)).not.toThrow();
} else {
expect(() => t.isString(value)).toThrow();
}
}
});
test("isString", () => {
const v = orNull(fixtures.string);
t.isString(v);
// v is "string"
for (const [key, value] of entries) {
if (key === "string") {
expect(() => t.isString(value)).not.toThrow();
} else {
expect(() => t.isString(value)).toThrow();
}
}
});
test("isDate", () => {
const v = orNull(fixtures.date);
t.isDate(v);
// v is "Date"
for (const [key, value] of entries) {
if (key === "date") {
expect(() => t.isDate(value)).not.toThrow();
} else {
expect(() => t.isDate(value)).toThrow();
}
}
});
test("isPromise", () => {
const v = orNull(fixtures.promise);
t.isPromise(v);
// v is "Promise<null>"
for (const [key, value] of entries) {
if (key === "promise") {
expect(() => t.isPromise(value)).not.toThrow();
} else {
expect(() => t.isPromise(value)).toThrow();
}
}
});
test("isRecord", () => {
const v = orNull(fixtures.record);
t.isRecord(v);
// v is "Record<string, unkown>"
for (const [key, value] of entries) {
if (
[
"record",
"recordOfStrings",
"recordOfNumbers",
"recordWithKeys",
"date",
"promise",
"array",
"strings",
"numbers",
"c",
].includes(key)
) {
expect(() => t.isRecord(value)).not.toThrow();
} else {
expect(() => t.isRecord(value)).toThrow();
}
}
});
test("isArray", () => {
const v = orNull(fixtures.array);
t.isArray(v);
// v is unknown[]
for (const [key, value] of entries) {
if (["array", "strings", "numbers"].includes(key)) {
expect(() => t.isArray(value)).not.toThrow();
} else {
expect(() => t.isArray(value)).toThrow();
}
}
});
test("isRecordWithKeys", () => {
const keys = Object.keys(fixtures.recordWithKeys);
const v = orNull(fixtures.recordWithKeys);
t.isRecordWithKeys(v, keys);
// v is typeof fixtures.recordWithKeys
for (const [key, value] of entries) {
if (key === "recordWithKeys") {
expect(() => t.isRecordWithKeys(value, keys)).not.toThrow();
} else {
expect(() => t.isRecordWithKeys(value, keys)).toThrow();
}
}
expect(() =>
t.isRecordWithKeys(fixtures.recordWithKeys, ["a"]),
).not.toThrow();
expect(() =>
t.isRecordWithKeys(fixtures.recordWithKeys, ["b"]),
).toThrow();
expect(() =>
t.isRecordWithKeys(fixtures.recordWithKeys, ["f"]),
).not.toThrow();
expect(() =>
t.isRecordWithKeys(fixtures.recordWithKeys.a, ["b", "e"]),
).not.toThrow();
expect(() =>
t.isRecordWithKeys(fixtures.recordWithKeys, ["a", "b"]),
).toThrow();
});
test("isRecordOfType", () => {
const v = orNull(fixtures.recordOfNumbers);
t.isRecordOfType(v, t.isNumber);
// v is Record<string, number>
for (const [key, value] of entries) {
if (
[
"record",
"recordOfNumbers",
"array",
"numbers",
"date",
"promise",
"c",
].includes(key)
) {
expect(() => t.isRecordOfType(value, t.isNumber)).not.toThrow();
} else {
expect(() => t.isRecordOfType(value, t.isNumber)).toThrow();
}
}
});
test("isArrayOfType", () => {
const v = orNull(fixtures.numbers);
t.isArrayOfType(v, t.isNumber);
// v is number[]
for (const [key, value] of entries) {
if (["array", "numbers"].includes(key)) {
expect(() => t.isArrayOfType(value, t.isNumber)).not.toThrow();
} else {
expect(() => t.isArrayOfType(value, t.isNumber)).toThrow();
}
}
});
test("isOptionOfType", () => {
const v = orNull(fixtures.number);
t.isOptionOfType(v, t.isNumber);
// v is "number"
for (const [key, value] of entries) {
if (["undefined", "number"].includes(key)) {
expect(() => t.isOptionOfType(value, t.isNumber)).not.toThrow();
} else {
expect(() => t.isOptionOfType(value, t.isNumber)).toThrow();
}
}
});
test("isOneOf", () => {
const v = orNull("a");
t.isOneOf(v, ["a", "b"] as const);
// v is "a"
for (const [key, value] of entries) {
if (key === "number") {
expect(() =>
t.isOneOf(value, [fixtures.number, fixtures.number + 1]),
).not.toThrow();
} else {
expect(() =>
t.isOneOf(value, [fixtures.number, fixtures.number + 1]),
).toThrow();
}
}
});
test("isOneOfType", () => {
const v = orNull(fixtures.string);
t.isOneOfType(v, [t.isString, t.isNumber]);
// v is "string"
for (const [key, value] of entries) {
if (["string", "number"].includes(key)) {
expect(() =>
t.isOneOfType(value, [t.isString, t.isNumber]),
).not.toThrow();
} else {
expect(() =>
t.isOneOfType(value, [t.isString, t.isNumber]),
).toThrow();
}
}
});
test("isInstanceOf", () => {
const v = orNull(fixtures.date);
t.isInstanceOf(v, Date);
// v is Date
for (const [key, value] of entries) {
if (key === "c") {
expect(() => t.isInstanceOf(value, C)).not.toThrow();
} else {
expect(() => t.isInstanceOf(value, C)).toThrow();
}
}
});
test("safeJsonParse", () => {
const input = {
a: {
b: {
c: "d",
},
e: null,
},
f: "g",
};
function assertIsInput(
input: unknown,
): asserts input is typeof fixtures.recordWithKeys {
t.isRecordWithKeys(input, ["a", "f"]);
t.isRecordWithKeys(input.a, ["b", "e"]);
t.isRecordWithKeys(input.a.b, ["c"]);
t.isExactly(input.a.b.c, "d" as const);
t.isExactly(input.a.e, null);
t.isExactly(input.f, "g");
}
const json = JSON.stringify(input);
const output = t.safeJsonParse(json);
assertIsInput(output);
const typedOutput: typeof fixtures.recordWithKeys = output;
expect(typedOutput).toEqual(input);
});
test("check filter", () => {
const a = entries
.map(([, value]) => value)
.filter(t.check(t.isNumber))
.map((value) => (value % 0 === 0 ? value : null))
.filter(t.check(t.isNotNull));
for (const item of a) {
expect(() => t.isNumber(item)).not.toThrow();
}
});
});
}
});

220
node_modules/typed-assert/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,220 @@
const expectedToBe = (type: string): string => `expected to be ${type}`;
export type WeakAssert = (input: unknown, message?: string) => void;
export type SubType<Input, Output> = Output extends Input ? Output : never;
export type Assert<Input = unknown, Output = Input> = (
input: Input,
message?: string,
) => asserts input is SubType<Input, Output>;
export type Check<Input = unknown, Output = Input> = (
input: Input,
) => input is SubType<Input, Output>;
export const defaultAssert: WeakAssert = (condition, message) => {
if (!condition) {
throw new TypeError(message);
}
};
let baseAssert = defaultAssert;
export const assert: Assert<boolean, true> = (condition, message) =>
baseAssert(condition, message);
export function setBaseAssert(assert?: WeakAssert): void {
if (assert) {
baseAssert = assert;
}
}
export const safeJsonParse = (json: string): unknown =>
JSON.parse(json) as unknown;
export function isUnknown(_input: unknown): _input is unknown {
return true;
}
export function isNever(
_input: never,
message: string = expectedToBe("unreachable"),
): never {
throw new TypeError(message)
}
export function isNotNull<T>(
input: null | T,
message: string = expectedToBe("not null"),
): asserts input is T {
assert(input !== null, message);
}
export function isNotUndefined<T>(
input: undefined | T,
message: string = expectedToBe("not undefined"),
): asserts input is T {
assert(input !== undefined, message);
}
export function isNotVoid<T>(
input: T,
message: string = expectedToBe("neither null nor undefined"),
): asserts input is Exclude<T, undefined | null | void> {
assert(input !== null && input !== undefined, message);
}
export function isExactly<Input, Output>(
input: Input,
value: Output,
message = expectedToBe(`exactly ${value}`),
): asserts input is SubType<Input, Output> {
assert((input as unknown) === (value as unknown), message);
}
export function isBoolean(
input: unknown,
message: string = expectedToBe("a boolean"),
): asserts input is boolean {
assert(typeof input === "boolean", message);
}
export function isNumber(
input: unknown,
message: string = expectedToBe("a number"),
): asserts input is number {
assert(typeof input === "number", message);
}
export function isString(
input: unknown,
message: string = expectedToBe("a string"),
): asserts input is string {
assert(typeof input === "string", message);
}
export function isDate(
input: unknown,
message: string = expectedToBe("a Date"),
): asserts input is Date {
assert(input instanceof Date, message);
}
export function isRecord(
input: unknown,
message: string = expectedToBe("a record"),
): asserts input is Record<string, unknown> {
assert(typeof input === "object", message);
isNotNull(input, message);
for (const key of Object.keys(input as Record<string, unknown>)) {
isString(key, message);
}
}
export function isRecordWithKeys<K extends string>(
input: unknown,
keys: K[],
message = expectedToBe(`a record with keys ${keys.join(", ")}`),
): asserts input is {
readonly [Key in K]: unknown;
} {
isRecord(input, message);
for (const key of keys) {
isNotUndefined(input[key]);
}
}
export function isArray(
input: unknown,
message: string = expectedToBe("an array"),
): asserts input is unknown[] {
assert(Array.isArray(input), message);
}
export function isRecordOfType<T>(
input: unknown,
assertT: Assert<unknown, T>,
message = expectedToBe("a record of given type"),
itemMessage = expectedToBe("of given type"),
): asserts input is Record<string, T> {
isRecord(input, message);
for (const item of Object.values(input)) {
assertT(item, itemMessage);
}
}
export function isArrayOfType<T>(
input: unknown,
assertT: Assert<unknown, T>,
message = expectedToBe("an array of given type"),
itemMessage = expectedToBe("of given type"),
): asserts input is T[] {
isArray(input, message);
for (const item of input) {
assertT(item, itemMessage);
}
}
export function isOptionOfType<Input, Output>(
input: Input | undefined,
assertT: Assert<Input, Output>,
message = expectedToBe("option of given type"),
): asserts input is SubType<Input, Output | undefined> {
if (input === undefined) {
return;
}
assertT(input, message);
}
export function isOneOf<Input, Output>(
input: Input,
values: readonly Output[],
message: string = expectedToBe(`one of ${values.join(", ")}`),
): asserts input is SubType<Input, Output> {
assert(values.includes(input as SubType<Input, Output>), message);
}
export function isOneOfType<T>(
input: unknown,
assertT: Assert<unknown, T>[],
message: string = expectedToBe(`one of type`),
itemMessage?: string,
): asserts input is T {
for (const assert of assertT) {
try {
(assert as WeakAssert)(input as T, itemMessage);
return;
} catch (_) {}
}
throw new TypeError(message);
}
export function isInstanceOf<T>(
input: unknown,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
constructor: new (...args: any[]) => T,
message = expectedToBe("an instance of given constructor"),
): asserts input is T {
assert(input instanceof constructor, message);
}
export function isPromise(
input: unknown,
message = expectedToBe("a promise"),
): asserts input is Promise<unknown> {
isInstanceOf(input, Promise, message);
}
export function check<Input, Output>(
assertT: Assert<Input, Output>,
): Check<Input, Output> {
return (input: Input): input is SubType<Input, Output> => {
try {
assertT(input);
return true;
} catch (_) {
return false;
}
};
}

73
node_modules/typed-assert/tsconfig.json generated vendored Normal file
View File

@@ -0,0 +1,73 @@
{
"compilerOptions": {
/* Basic Options */
"target": "esnext" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */,
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */,
"lib": [
"es5",
"esnext"
] /* Specify library files to be included in the compilation. */,
// "allowJs": true, /* Allow javascript files to be compiled. */
// "checkJs": true /* Report errors in .js files. */,
// "jsx": "preserve" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
"declaration": true /* Generates corresponding '.d.ts' file. */,
// "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
"sourceMap": true /* Generates corresponding '.map' file. */,
// "outFile": "./", /* Concatenate and emit output to single file. */
"outDir": "build" /* Redirect output structure to the directory. */,
// "rootDir": "src" /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */,
"rootDirs": [
"src"
],
// "composite": true /* Enable project compilation */,
"incremental": true /* Enable incremental compilation */,
// "tsBuildInfoFile": "./build/tsBuildInfo", /* Specify file to store incremental compilation information */
// "removeComments": true, /* Do not emit comments to output. */
// "noEmit": true, /* Do not emit outputs. */
"importHelpers": true /* Import emit helpers from 'tslib'. */,
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
"isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,
/* Strict Type-Checking Options */
"strict": true /* Enable all strict type-checking options. */,
// "noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
// "strictNullChecks": true, /* Enable strict null checks. */
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
/* Additional Checks */
"noUnusedLocals": true /* Report errors on unused locals. */,
"noUnusedParameters": true /* Report errors on unused parameters. */,
"noImplicitReturns": true /* Report error when not all code paths in function return a value. */,
"noFallthroughCasesInSwitch": true /* Report errors for fallthrough cases in switch statement. */,
/* Module Resolution Options */
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
"baseUrl": "src" /* Base directory to resolve non-absolute module names. */,
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
// "typeRoots": [], /* List of folders to include type definitions from. */
// "types": [], /* Type declaration files to be included in compilation. */
"allowSyntheticDefaultImports": true /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
/* Source Map Options */
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
/* Experimental Options */
"experimentalDecorators": true /* Enables experimental support for ES7 decorators. */,
"emitDecoratorMetadata": true /* Enables experimental support for emitting type metadata for decorators. */
},
"include": [
"src/**/*.ts",
"src/**/*.d.ts"
],
"exclude": [
"node_modules",
"build",
"typedoc"
],
"compileOnSave": true
}

10
node_modules/typed-assert/typedoc.json generated vendored Normal file
View File

@@ -0,0 +1,10 @@
{
"entryPoints": [
"./src/index.ts"
],
"exclude": "**/__tests__/**/*",
"excludeExternals": true,
"out": "doc",
"readme": "none",
"gitRevision": "master"
}