diff options
Diffstat (limited to 'vanilla/node_modules/expect-type')
| -rw-r--r-- | vanilla/node_modules/expect-type/LICENSE | 191 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/README.md | 925 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/SECURITY.md | 14 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/branding.d.ts | 61 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/branding.js | 2 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/index.d.ts | 897 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/index.js | 96 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/messages.d.ts | 168 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/messages.js | 66 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/overloads.d.ts | 288 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/overloads.js | 2 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/utils.d.ts | 197 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/dist/utils.js | 19 | ||||
| -rw-r--r-- | vanilla/node_modules/expect-type/package.json | 50 |
14 files changed, 0 insertions, 2976 deletions
diff --git a/vanilla/node_modules/expect-type/LICENSE b/vanilla/node_modules/expect-type/LICENSE deleted file mode 100644 index deede24..0000000 --- a/vanilla/node_modules/expect-type/LICENSE +++ /dev/null @@ -1,191 +0,0 @@ - Copyright 2024 Misha Kaletsky - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS diff --git a/vanilla/node_modules/expect-type/README.md b/vanilla/node_modules/expect-type/README.md deleted file mode 100644 index 9aaf8ca..0000000 --- a/vanilla/node_modules/expect-type/README.md +++ /dev/null @@ -1,925 +0,0 @@ -# expect-type - -[](https://github.com/mmkal/expect-type/actions/workflows/ci.yml) - -[](https://x.com/mmkalmmkal) - -Compile-time tests for types. Useful to make sure types don't regress into being overly permissive as changes go in over time. - -Similar to `expect`, but with type-awareness. Gives you access to several type-matchers that let you make assertions about the form of a reference or generic type parameter. - -```ts -import {expectTypeOf} from 'expect-type' -import {foo, bar} from '../foo' - -// make sure `foo` has type {a: number} -expectTypeOf(foo).toEqualTypeOf<{a: number}>() - -// make sure `bar` is a function taking a string: -expectTypeOf(bar).parameter(0).toBeString() -expectTypeOf(bar).returns.not.toBeAny() -``` - -It can be used in your existing test files (and is actually [built in to vitest](https://vitest.dev/guide/testing-types)). Or it can be used in any other type-checked file you'd like - it's built into existing tooling with no dependencies. No extra build step, cli tool, IDE extension, or lint plugin is needed. Just import the function and start writing tests. Failures will be at compile time - they'll appear in your IDE and when you run `tsc`. - -See below for lots more examples. - -## Contents -<!-- codegen:start {preset: markdownTOC, minDepth: 2, maxDepth: 5} --> -- [Contents](#contents) -- [Installation and usage](#installation-and-usage) -- [Documentation](#documentation) - - [Features](#features) - - [Why is my assertion failing?](#why-is-my-assertion-failing) - - [Why is `.toMatchTypeOf` deprecated?](#why-is-tomatchtypeof-deprecated) - - [Internal type helpers](#internal-type-helpers) - - [Error messages](#error-messages) - - [Concrete "expected" objects vs type arguments](#concrete-expected-objects-vs-type-arguments) - - [Overloaded functions](#overloaded-functions) - - [Within test frameworks](#within-test-frameworks) - - [Vitest](#vitest) - - [Jest & `eslint-plugin-jest`](#jest--eslint-plugin-jest) - - [Limitations](#limitations) -- [Similar projects](#similar-projects) - - [Comparison](#comparison) -- [TypeScript backwards-compatibility](#typescript-backwards-compatibility) -- [Contributing](#contributing) - - [Documentation of limitations through tests](#documentation-of-limitations-through-tests) -<!-- codegen:end --> - -## Installation and usage - -```cli -npm install expect-type --save-dev -``` - -```typescript -import {expectTypeOf} from 'expect-type' -``` - -## Documentation - -The `expectTypeOf` method takes a single argument or a generic type parameter. Neither it nor the functions chained off its return value have any meaningful runtime behaviour. The assertions you write will be _compile-time_ errors if they don't hold true. - -### Features - -<!-- codegen:start {preset: markdownFromTests, source: test/usage.test.ts} --> -Check an object's type with `.toEqualTypeOf`: - -```typescript -expectTypeOf({a: 1}).toEqualTypeOf<{a: number}>() -``` - -`.toEqualTypeOf` can check that two concrete objects have equivalent types (note: when these assertions _fail_, the error messages can be less informative vs the generic type argument syntax above - see [error messages docs](#error-messages)): - -```typescript -expectTypeOf({a: 1}).toEqualTypeOf({a: 1}) -``` - -`.toEqualTypeOf` succeeds for objects with different values, but the same type: - -```typescript -expectTypeOf({a: 1}).toEqualTypeOf({a: 2}) -``` - -`.toEqualTypeOf` fails on excess properties: - -```typescript -// @ts-expect-error -expectTypeOf({a: 1, b: 1}).toEqualTypeOf<{a: number}>() -``` - -To allow for extra properties on an object type, use `.toMatchObjectType`. This is a strict check, but only on the subset of keys that are in the expected type: - -```typescript -expectTypeOf({a: 1, b: 1}).toMatchObjectType<{a: number}>() -``` - -`.toMatchObjectType` can check partial matches on deeply nested objects: - -```typescript -const user = { - email: 'a@b.com', - name: 'John Doe', - address: {street: '123 2nd St', city: 'New York', zip: '10001', state: 'NY', country: 'USA'}, -} - -expectTypeOf(user).toMatchObjectType<{name: string; address: {city: string}}>() -``` - -To check that a type extends another type, use `.toExtend`: - -```typescript -expectTypeOf('some string').toExtend<string | boolean>() -// @ts-expect-error -expectTypeOf({a: 1}).toExtend<{b: number}>() -``` - -`.toExtend` can be used with object types, but `.toMatchObjectType` is usually a better choice when dealing with objects, since it's stricter: - -```typescript -expectTypeOf({a: 1, b: 2}).toExtend<{a: number}>() // avoid this -expectTypeOf({a: 1, b: 2}).toMatchObjectType<{a: number}>() // prefer this -``` - -`.toEqualTypeOf`, `.toMatchObjectType`, and `.toExtend` all fail on missing properties: - -```typescript -// @ts-expect-error -expectTypeOf({a: 1}).toEqualTypeOf<{a: number; b: number}>() -// @ts-expect-error -expectTypeOf({a: 1}).toMatchObjectType<{a: number; b: number}>() -// @ts-expect-error -expectTypeOf({a: 1}).toExtend<{a: number; b: number}>() -``` - -Another example of the difference between `.toExtend`, `.toMatchObjectType`, and `.toEqualTypeOf`. `.toExtend` can be used for "is-a" relationships: - -```typescript -type Fruit = {type: 'Fruit'; edible: boolean} -type Apple = {type: 'Fruit'; name: 'Apple'; edible: true} - -expectTypeOf<Apple>().toExtend<Fruit>() - -// @ts-expect-error - the `editable` property isn't an exact match. In `Apple`, it's `true`, which extends `boolean`, but they're not identical. -expectTypeOf<Apple>().toMatchObjectType<Fruit>() - -// @ts-expect-error - Apple is not an identical type to Fruit, it's a subtype -expectTypeOf<Apple>().toEqualTypeOf<Fruit>() - -// @ts-expect-error - Apple is a Fruit, but not vice versa -expectTypeOf<Fruit>().toExtend<Apple>() -``` - -Assertions can be inverted with `.not`: - -```typescript -expectTypeOf({a: 1}).not.toExtend<{b: 1}>() -expectTypeOf({a: 1}).not.toMatchObjectType<{b: 1}>() -``` - -`.not` can be easier than relying on `// @ts-expect-error`: - -```typescript -type Fruit = {type: 'Fruit'; edible: boolean} -type Apple = {type: 'Fruit'; name: 'Apple'; edible: true} - -expectTypeOf<Apple>().toExtend<Fruit>() - -expectTypeOf<Fruit>().not.toExtend<Apple>() -expectTypeOf<Apple>().not.toEqualTypeOf<Fruit>() -``` - -Catch any/unknown/never types: - -```typescript -expectTypeOf<unknown>().toBeUnknown() -expectTypeOf<any>().toBeAny() -expectTypeOf<never>().toBeNever() - -// @ts-expect-error -expectTypeOf<never>().toBeNumber() -``` - -`.toEqualTypeOf` distinguishes between deeply-nested `any` and `unknown` properties: - -```typescript -expectTypeOf<{deeply: {nested: any}}>().not.toEqualTypeOf<{deeply: {nested: unknown}}>() -``` - -You can test for basic JavaScript types: - -```typescript -expectTypeOf(() => 1).toBeFunction() -expectTypeOf({}).toBeObject() -expectTypeOf([]).toBeArray() -expectTypeOf('').toBeString() -expectTypeOf(1).toBeNumber() -expectTypeOf(true).toBeBoolean() -expectTypeOf(() => {}).returns.toBeVoid() -expectTypeOf(Promise.resolve(123)).resolves.toBeNumber() -expectTypeOf(Symbol(1)).toBeSymbol() -expectTypeOf(1n).toBeBigInt() -``` - -`.toBe...` methods allow for types that extend the expected type: - -```typescript -expectTypeOf<number>().toBeNumber() -expectTypeOf<1>().toBeNumber() - -expectTypeOf<any[]>().toBeArray() -expectTypeOf<number[]>().toBeArray() - -expectTypeOf<string>().toBeString() -expectTypeOf<'foo'>().toBeString() - -expectTypeOf<boolean>().toBeBoolean() -expectTypeOf<true>().toBeBoolean() - -expectTypeOf<bigint>().toBeBigInt() -expectTypeOf<0n>().toBeBigInt() -``` - -`.toBe...` methods protect against `any`: - -```typescript -const goodIntParser = (s: string) => Number.parseInt(s, 10) -const badIntParser = (s: string) => JSON.parse(s) // uh-oh - works at runtime if the input is a number, but return 'any' - -expectTypeOf(goodIntParser).returns.toBeNumber() -// @ts-expect-error - if you write a test like this, `.toBeNumber()` will let you know your implementation returns `any`. -expectTypeOf(badIntParser).returns.toBeNumber() -``` - -Nullable types: - -```typescript -expectTypeOf(undefined).toBeUndefined() -expectTypeOf(undefined).toBeNullable() -expectTypeOf(undefined).not.toBeNull() - -expectTypeOf(null).toBeNull() -expectTypeOf(null).toBeNullable() -expectTypeOf(null).not.toBeUndefined() - -expectTypeOf<1 | undefined>().toBeNullable() -expectTypeOf<1 | null>().toBeNullable() -expectTypeOf<1 | undefined | null>().toBeNullable() -``` - -More `.not` examples: - -```typescript -expectTypeOf(1).not.toBeUnknown() -expectTypeOf(1).not.toBeAny() -expectTypeOf(1).not.toBeNever() -expectTypeOf(1).not.toBeNull() -expectTypeOf(1).not.toBeUndefined() -expectTypeOf(1).not.toBeNullable() -expectTypeOf(1).not.toBeBigInt() -``` - -Detect assignability of unioned types: - -```typescript -expectTypeOf<number>().toExtend<string | number>() -expectTypeOf<string | number>().not.toExtend<number>() -``` - -Use `.extract` and `.exclude` to narrow down complex union types: - -```typescript -type ResponsiveProp<T> = T | T[] | {xs?: T; sm?: T; md?: T} -const getResponsiveProp = <T>(_props: T): ResponsiveProp<T> => ({}) -type CSSProperties = {margin?: string; padding?: string} - -const cssProperties: CSSProperties = {margin: '1px', padding: '2px'} - -expectTypeOf(getResponsiveProp(cssProperties)) - .exclude<unknown[]>() - .exclude<{xs?: unknown}>() - .toEqualTypeOf<CSSProperties>() - -expectTypeOf(getResponsiveProp(cssProperties)) - .extract<unknown[]>() - .toEqualTypeOf<CSSProperties[]>() - -expectTypeOf(getResponsiveProp(cssProperties)) - .extract<{xs?: any}>() - .toEqualTypeOf<{xs?: CSSProperties; sm?: CSSProperties; md?: CSSProperties}>() - -expectTypeOf<ResponsiveProp<number>>().exclude<number | number[]>().toHaveProperty('sm') -expectTypeOf<ResponsiveProp<number>>().exclude<number | number[]>().not.toHaveProperty('xxl') -``` - -`.extract` and `.exclude` return never if no types remain after exclusion: - -```typescript -type Person = {name: string; age: number} -type Customer = Person & {customerId: string} -type Employee = Person & {employeeId: string} - -expectTypeOf<Customer | Employee>().extract<{foo: string}>().toBeNever() -expectTypeOf<Customer | Employee>().exclude<{name: string}>().toBeNever() -``` - -Use `.pick` to pick a set of properties from an object: - -```typescript -type Person = {name: string; age: number} - -expectTypeOf<Person>().pick<'name'>().toEqualTypeOf<{name: string}>() -``` - -Use `.omit` to remove a set of properties from an object: - -```typescript -type Person = {name: string; age: number} - -expectTypeOf<Person>().omit<'name'>().toEqualTypeOf<{age: number}>() -``` - -Make assertions about object properties: - -```typescript -const obj = {a: 1, b: ''} - -// check that properties exist (or don't) with `.toHaveProperty` -expectTypeOf(obj).toHaveProperty('a') -expectTypeOf(obj).not.toHaveProperty('c') - -// check types of properties -expectTypeOf(obj).toHaveProperty('a').toBeNumber() -expectTypeOf(obj).toHaveProperty('b').toBeString() -expectTypeOf(obj).toHaveProperty('a').not.toBeString() -``` - -`.toEqualTypeOf` can be used to distinguish between functions: - -```typescript -type NoParam = () => void -type HasParam = (s: string) => void - -expectTypeOf<NoParam>().not.toEqualTypeOf<HasParam>() -``` - -But often it's preferable to use `.parameters` or `.returns` for more specific function assertions: - -```typescript -type NoParam = () => void -type HasParam = (s: string) => void - -expectTypeOf<NoParam>().parameters.toEqualTypeOf<[]>() -expectTypeOf<NoParam>().returns.toBeVoid() - -expectTypeOf<HasParam>().parameters.toEqualTypeOf<[string]>() -expectTypeOf<HasParam>().returns.toBeVoid() -``` - -Up to ten overloads will produce union types for `.parameters` and `.returns`: - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} - -expectTypeOf<Factorize>().parameters.not.toEqualTypeOf<[number]>() -expectTypeOf<Factorize>().parameters.toEqualTypeOf<[number] | [bigint]>() -expectTypeOf<Factorize>().returns.toEqualTypeOf<number[] | bigint[]>() - -expectTypeOf<Factorize>().parameter(0).toEqualTypeOf<number | bigint>() -``` - -Note that these aren't exactly like TypeScript's built-in Parameters<...> and ReturnType<...>: - -The TypeScript builtins simply choose a single overload (see the [Overloaded functions](#overloaded-functions) section for more information) - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} - -// overload using `number` is ignored! -expectTypeOf<Parameters<Factorize>>().toEqualTypeOf<[bigint]>() -expectTypeOf<ReturnType<Factorize>>().toEqualTypeOf<bigint[]>() -``` - -More examples of ways to work with functions - parameters using `.parameter(n)` or `.parameters`, and return values using `.returns`: - -```typescript -const f = (a: number) => [a, a] - -expectTypeOf(f).toBeFunction() - -expectTypeOf(f).toBeCallableWith(1) -expectTypeOf(f).not.toBeAny() -expectTypeOf(f).returns.not.toBeAny() -expectTypeOf(f).returns.toEqualTypeOf([1, 2]) -expectTypeOf(f).returns.toEqualTypeOf([1, 2, 3]) -expectTypeOf(f).parameter(0).not.toEqualTypeOf('1') -expectTypeOf(f).parameter(0).toEqualTypeOf(1) -expectTypeOf(1).parameter(0).toBeNever() - -const twoArgFunc = (a: number, b: string) => ({a, b}) - -expectTypeOf(twoArgFunc).parameters.toEqualTypeOf<[number, string]>() -``` - -`.toBeCallableWith` allows for overloads. You can also use it to narrow down the return type for given input parameters.: - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} - -expectTypeOf<Factorize>().toBeCallableWith(6) -expectTypeOf<Factorize>().toBeCallableWith(6n) -``` - -`.toBeCallableWith` returns a type that can be used to narrow down the return type for given input parameters.: - -```typescript -type Factorize = { - (input: number): number[] - (input: bigint): bigint[] -} -expectTypeOf<Factorize>().toBeCallableWith(6).returns.toEqualTypeOf<number[]>() -expectTypeOf<Factorize>().toBeCallableWith(6n).returns.toEqualTypeOf<bigint[]>() -``` - -`.toBeCallableWith` can be used to narrow down the parameters of a function: - -```typescript -type Delete = { - (path: string): void - (paths: string[], options?: {force: boolean}): void -} - -expectTypeOf<Delete>().toBeCallableWith('abc').parameters.toEqualTypeOf<[string]>() -expectTypeOf<Delete>() - .toBeCallableWith(['abc', 'def'], {force: true}) - .parameters.toEqualTypeOf<[string[], {force: boolean}?]>() - -expectTypeOf<Delete>().toBeCallableWith('abc').parameter(0).toBeString() -expectTypeOf<Delete>().toBeCallableWith('abc').parameter(1).toBeUndefined() - -expectTypeOf<Delete>() - .toBeCallableWith(['abc', 'def', 'ghi']) - .parameter(0) - .toEqualTypeOf<string[]>() - -expectTypeOf<Delete>() - .toBeCallableWith(['abc', 'def', 'ghi']) - .parameter(1) - .toEqualTypeOf<{force: boolean} | undefined>() -``` - -You can't use `.toBeCallableWith` with `.not` - you need to use ts-expect-error:: - -```typescript -const f = (a: number) => [a, a] - -// @ts-expect-error -expectTypeOf(f).toBeCallableWith('foo') -``` - -Use `.map` to transform types: - -This can be useful for generic functions or complex types which you can't access via `.toBeCallableWith`, `.toHaveProperty` etc. The callback function isn't called at runtime, which can make this a useful way to get complex inferred types without worrying about running code. - -```typescript -const capitalize = <S extends string>(input: S) => - (input.slice(0, 1).toUpperCase() + input.slice(1)) as Capitalize<S> - -expectTypeOf(capitalize) - .map(fn => fn('hello world')) - .toEqualTypeOf<'Hello world'>() -``` - -You can also check type guards & type assertions: - -```typescript -const assertNumber = (v: any): asserts v is number => { - if (typeof v !== 'number') { - throw new TypeError('Nope !') - } -} - -expectTypeOf(assertNumber).asserts.toBeNumber() - -const isString = (v: any): v is string => typeof v === 'string' - -expectTypeOf(isString).guards.toBeString() - -const isBigInt = (value: any): value is bigint => typeof value === 'bigint' - -expectTypeOf(isBigInt).guards.toBeBigInt() -``` - -Assert on constructor parameters: - -```typescript -expectTypeOf(Date).toBeConstructibleWith('1970') -expectTypeOf(Date).toBeConstructibleWith(0) -expectTypeOf(Date).toBeConstructibleWith(new Date()) -expectTypeOf(Date).toBeConstructibleWith() - -expectTypeOf(Date).constructorParameters.toEqualTypeOf< - | [] - | [value: string | number] - | [value: string | number | Date] - | [ - year: number, - monthIndex: number, - date?: number | undefined, - hours?: number | undefined, - minutes?: number | undefined, - seconds?: number | undefined, - ms?: number | undefined, - ] ->() -``` - -Constructor overloads: - -```typescript -class DBConnection { - constructor() - constructor(connectionString: string) - constructor(options: {host: string; port: number}) - constructor(..._: unknown[]) {} -} - -expectTypeOf(DBConnection).toBeConstructibleWith() -expectTypeOf(DBConnection).toBeConstructibleWith('localhost') -expectTypeOf(DBConnection).toBeConstructibleWith({host: 'localhost', port: 1234}) -// @ts-expect-error - as when calling `new DBConnection(...)` you can't actually use the `(...args: unknown[])` overlaod, it's purely for the implementation. -expectTypeOf(DBConnection).toBeConstructibleWith(1, 2) -``` - -Check function `this` parameters: - -```typescript -function greet(this: {name: string}, message: string) { - return `Hello ${this.name}, here's your message: ${message}` -} - -expectTypeOf(greet).thisParameter.toEqualTypeOf<{name: string}>() -``` - -Distinguish between functions with different `this` parameters: - -```typescript -function greetFormal(this: {title: string; name: string}, message: string) { - return `Dear ${this.title} ${this.name}, here's your message: ${message}` -} - -function greetCasual(this: {name: string}, message: string) { - return `Hi ${this.name}, here's your message: ${message}` -} - -expectTypeOf(greetFormal).not.toEqualTypeOf(greetCasual) -``` - -Class instance types: - -```typescript -expectTypeOf(Date).instance.toHaveProperty('toISOString') -``` - -Promise resolution types can be checked with `.resolves`: - -```typescript -const asyncFunc = async () => 123 - -expectTypeOf(asyncFunc).returns.resolves.toBeNumber() -``` - -Array items can be checked with `.items`: - -```typescript -expectTypeOf([1, 2, 3]).items.toBeNumber() -expectTypeOf([1, 2, 3]).items.not.toBeString() -``` - -You can also compare arrays directly: - -```typescript -expectTypeOf<any[]>().not.toEqualTypeOf<number[]>() -``` - -Check that functions never return: - -```typescript -const thrower = () => { - throw new Error('oh no') -} - -expectTypeOf(thrower).returns.toBeNever() -``` - -Generics can be used rather than references: - -```typescript -expectTypeOf<{a: string}>().not.toEqualTypeOf<{a: number}>() -``` - -Distinguish between missing/null/optional properties: - -```typescript -expectTypeOf<{a?: number}>().not.toEqualTypeOf<{}>() -expectTypeOf<{a?: number}>().not.toEqualTypeOf<{a: number}>() -expectTypeOf<{a?: number}>().not.toEqualTypeOf<{a: number | undefined}>() -expectTypeOf<{a?: number | null}>().not.toEqualTypeOf<{a: number | null}>() -expectTypeOf<{a: {b?: number}}>().not.toEqualTypeOf<{a: {}}>() -``` - -Detect the difference between regular and `readonly` properties: - -```typescript -type A1 = {readonly a: string; b: string} -type E1 = {a: string; b: string} - -expectTypeOf<A1>().toExtend<E1>() -expectTypeOf<A1>().not.toEqualTypeOf<E1>() - -type A2 = {a: string; b: {readonly c: string}} -type E2 = {a: string; b: {c: string}} - -expectTypeOf<A2>().toExtend<E2>() -expectTypeOf<A2>().not.toEqualTypeOf<E2>() -``` - -Distinguish between classes with different constructors: - -```typescript -class A { - value: number - constructor(a: 1) { - this.value = a - } -} -class B { - value: number - constructor(b: 2) { - this.value = b - } -} - -expectTypeOf<typeof A>().not.toEqualTypeOf<typeof B>() - -class C { - value: number - constructor(c: 1) { - this.value = c - } -} - -expectTypeOf<typeof A>().toEqualTypeOf<typeof C>() -``` - -Known limitation: Intersection types can cause issues with `toEqualTypeOf`: - -```typescript -// @ts-expect-error the following line doesn't compile, even though the types are arguably the same. -// See https://github.com/mmkal/expect-type/pull/21 -expectTypeOf<{a: 1} & {b: 2}>().toEqualTypeOf<{a: 1; b: 2}>() -``` - -To workaround for simple cases, you can use a mapped type: - -```typescript -type Simplify<T> = {[K in keyof T]: T[K]} - -expectTypeOf<Simplify<{a: 1} & {b: 2}>>().toEqualTypeOf<{a: 1; b: 2}>() -``` - -But this won't work if the nesting is deeper in the type. For these situations, you can use the `.branded` helper. Note that this comes at a performance cost, and can cause the compiler to 'give up' if used with excessively deep types, so use sparingly. This helper is under `.branded` because it deeply transforms the Actual and Expected types into a pseudo-AST: - -```typescript -// @ts-expect-error -expectTypeOf<{a: {b: 1} & {c: 1}}>().toEqualTypeOf<{a: {b: 1; c: 1}}>() - -expectTypeOf<{a: {b: 1} & {c: 1}}>().branded.toEqualTypeOf<{a: {b: 1; c: 1}}>() -``` - -Be careful with `.branded` for very deep or complex types, though. If possible you should find a way to simplify your test to avoid needing to use it: - -```typescript -// This *should* result in an error, but the "branding" mechanism produces too large a type and TypeScript just gives up! https://github.com/microsoft/TypeScript/issues/50670 -expectTypeOf<() => () => () => () => 1>().branded.toEqualTypeOf<() => () => () => () => 2>() - -// @ts-expect-error the non-branded implementation catches the error as expected. -expectTypeOf<() => () => () => () => 1>().toEqualTypeOf<() => () => () => () => 2>() -``` - -So, if you have an extremely deep type that ALSO has an intersection in it, you're out of luck and this library won't be able to test your type properly: - -```typescript -// @ts-expect-error this fails, but it should succeed. -expectTypeOf<() => () => () => () => {a: 1} & {b: 2}>().toEqualTypeOf< - () => () => () => () => {a: 1; b: 2} ->() - -// this succeeds, but it should fail. -expectTypeOf<() => () => () => () => {a: 1} & {b: 2}>().branded.toEqualTypeOf< - () => () => () => () => {a: 1; c: 2} ->() -``` - -Another limitation: passing `this` references to `expectTypeOf` results in errors.: - -```typescript -class B { - b = 'b' - - foo() { - // @ts-expect-error - expectTypeOf(this).toEqualTypeOf(this) - } -} - -// Instead of the above, try something like this: -expectTypeOf(B).instance.toEqualTypeOf<{b: string; foo: () => void}>() -``` -<!-- codegen:end --> - -Overloads limitation for TypeScript <5.3: Due to a [TypeScript bug fixed in 5.3](https://github.com/microsoft/TypeScript/issues/28867), overloaded functions which include an overload resembling `(...args: unknown[]) => unknown` will exclude `unknown[]` from `.parameters` and exclude `unknown` from `.returns`: - -```typescript -type Factorize = { - (...args: unknown[]): unknown - (input: number): number[] - (input: bigint): bigint[] -} - -expectTypeOf<Factorize>().parameters.toEqualTypeOf<[number] | [bigint]>() -expectTypeOf<Factorize>().returns.toEqualTypeOf<number[] | bigint[]>() -``` - -This overload, however, allows any input and returns an unknown output anyway, so it's not very useful. If you are worried about this for some reason, you'll have to update TypeScript to 5.3+. - -### Why is my assertion failing? - -For complex types, an assertion might fail when it should if the `Actual` type contains a deeply-nested intersection type but the `Expected` doesn't. In these cases you can use `.branded` as described above: - -```typescript -// @ts-expect-error this unfortunately fails - a TypeScript limitation prevents making this pass without a big perf hit -expectTypeOf<{a: {b: 1} & {c: 1}}>().toEqualTypeOf<{a: {b: 1; c: 1}}>() - -expectTypeOf<{a: {b: 1} & {c: 1}}>().branded.toEqualTypeOf<{a: {b: 1; c: 1}}>() -``` - -### Why is `.toMatchTypeOf` deprecated? - -The `.toMatchTypeOf` method is deprecated in favour of `.toMatchObjectType` (when strictly checking against an object type with a subset of keys), or `.toExtend` (when checking for "is-a" relationships). There are no foreseeable plans to remove `.toMatchTypeOf`, but there's no reason to continue using it - `.toMatchObjectType` is stricter, and `.toExtend` is identical. - -### Internal type helpers - -🚧 This library also exports some helper types for performing boolean operations on types, checking extension/equality in various ways, branding types, and checking for various special types like `never`, `any`, `unknown`. Use at your own risk! Nothing is stopping you from using these beyond this warning: - ->All internal types that are not documented here are _not_ part of the supported API surface, and may be renamed, modified, or removed, without warning or documentation in release notes. - -For a dedicated internal type library, feel free to look at the [source code](./src/index.ts) for inspiration - or better, use a library like [type-fest](https://npmjs.com/package/type-fest). - -### Error messages - -When types don't match, `.toEqualTypeOf` and `.toMatchTypeOf` use a special helper type to produce error messages that are as actionable as possible. But there's a bit of a nuance to understanding them. Since the assertions are written "fluently", the failure should be on the "expected" type, not the "actual" type (`expect<Actual>().toEqualTypeOf<Expected>()`). This means that type errors can be a little confusing - so this library produces a `MismatchInfo` type to try to make explicit what the expectation is. For example: - -```ts -expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>() -``` - -Is an assertion that will fail, since `{a: 1}` has type `{a: number}` and not `{a: string}`. The error message in this case will read something like this: - -``` -test/test.ts:999:999 - error TS2344: Type '{ a: string; }' does not satisfy the constraint '{ a: \\"Expected: string, Actual: number\\"; }'. - Types of property 'a' are incompatible. - Type 'string' is not assignable to type '\\"Expected: string, Actual: number\\"'. - -999 expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>() -``` - -Note that the type constraint reported is a human-readable messaging specifying both the "expected" and "actual" types. Rather than taking the sentence `Types of property 'a' are incompatible // Type 'string' is not assignable to type "Expected: string, Actual: number"` literally - just look at the property name (`'a'`) and the message: `Expected: string, Actual: number`. This will tell you what's wrong, in most cases. Extremely complex types will, of course, be more effort to debug, and may require some experimentation. Please [raise an issue](https://github.com/mmkal/expect-type) if the error messages are misleading. - -The `toBe...` methods (like `toBeString`, `toBeNumber`, `toBeVoid`, etc.) fail by resolving to a non-callable type when the `Actual` type under test doesn't match up. For example, the failure for an assertion like `expectTypeOf(1).toBeString()` will look something like this: - -``` -test/test.ts:999:999 - error TS2349: This expression is not callable. - Type 'ExpectString<number>' has no call signatures. - -999 expectTypeOf(1).toBeString() - ~~~~~~~~~~ -``` - -The `This expression is not callable` part isn't all that helpful - the meaningful error is the next line, `Type 'ExpectString<number> has no call signatures`. This essentially means you passed a number but asserted it should be a string. - -If TypeScript added support for ["throw" types](https://github.com/microsoft/TypeScript/pull/40468) these error messages could be improved. Until then they will take a certain amount of squinting. - -#### Concrete "expected" objects vs type arguments - -Error messages for an assertion like this: - -```ts -expectTypeOf({a: 1}).toEqualTypeOf({a: ''}) -``` - -Will be less helpful than for an assertion like this: - -```ts -expectTypeOf({a: 1}).toEqualTypeOf<{a: string}>() -``` - -This is because the TypeScript compiler needs to infer the type argument for the `.toEqualTypeOf({a: ''})` style and this library can only mark it as a failure by comparing it against a generic `Mismatch` type. So, where possible, use a type argument rather than a concrete type for `.toEqualTypeOf` and `toMatchTypeOf`. If it's much more convenient to compare two concrete types, you can use `typeof`: - -```ts -const one = valueFromFunctionOne({some: {complex: inputs}}) -const two = valueFromFunctionTwo({some: {other: inputs}}) - -expectTypeOf(one).toEqualTypeof<typeof two>() -``` - -### Overloaded functions - -Due to a TypeScript [design limitation](https://github.com/microsoft/TypeScript/issues/32164#issuecomment-506810756), the native TypeScript `Parameters<...>` and `ReturnType<...>` helpers only return types from one variant of an overloaded function. This limitation doesn't apply to expect-type, since it is not used to author TypeScript code, only to assert on existing types. So, we use a workaround for this TypeScript behaviour to assert on _all_ overloads as a union (actually, not necessarily _all_ - we cap out at 10 overloads). - -### Within test frameworks - -### Vitest - -`expectTypeOf` is built in to [vitest](https://vitest.dev/guide/testing-types), so you can import `expectTypeOf` from the vitest library directly if you prefer. Note that there is no set release cadence, at time of writing, so vitest may not always be using the very latest version. - -```ts -import {expectTypeOf} from 'vitest' -import {mount} from './mount.js' - -test('my types work properly', () => { - expectTypeOf(mount).toBeFunction() - expectTypeOf(mount).parameter(0).toEqualTypeOf<{name: string}>() - - expectTypeOf(mount({name: 42})).toBeString() -}) -``` - -#### Jest & `eslint-plugin-jest` - -If you're using Jest along with `eslint-plugin-jest`, and you put assertions inside `test(...)` definitions, you may get warnings from the [`jest/expect-expect`](https://github.com/jest-community/eslint-plugin-jest/blob/master/docs/rules/expect-expect.md) rule, complaining that "Test has no assertions" for tests that only use `expectTypeOf()`. - -To remove this warning, configure the ESLint rule to consider `expectTypeOf` as an assertion: - -```json -"rules": { - // ... - "jest/expect-expect": [ - "warn", - { - "assertFunctionNames": [ - "expect", "expectTypeOf" - ] - } - ], - // ... -} -``` - -### Limitations - -A summary of some of the limitations of this library. Some of these are documented more fully elsewhere. - -1. Intersection types can result in failures when the expected and actual types are not identically defined, even when they are effectively identical. See [Why is my assertion failing](#why-is-my-assertion-failing) for details. TL;DR: use `.brand` in these cases - and accept the performance hit that it comes with. -1. `toBeCallableWith` will likely fail if you try to use it with a generic function or an overload. See [this issue](https://github.com/mmkal/expect-type/issues/50) for an example and how to work around it. -1. (For now) overloaded functions might trip up the `.parameter` and `.parameters` helpers. This matches how the built-in TypeScript helper `Parameters<...>` works. This may be improved in the future though ([see related issue](https://github.com/mmkal/expect-type/issues/30)). -1. `expectTypeOf(this).toEqualTypeOf(this)` inside class methods does not work. - -## Similar projects - -Other projects with similar goals: - -- [`tsd`](https://github.com/SamVerschueren/tsd) is a CLI that runs the TypeScript type checker over assertions -- [`ts-expect`](https://github.com/TypeStrong/ts-expect) exports several generic helper types to perform type assertions -- [`dtslint`](https://github.com/Microsoft/dtslint) does type checks via comment directives and tslint -- [`type-plus`](https://github.com/unional/type-plus) comes with various type and runtime TypeScript assertions -- [`static-type-assert`](https://github.com/ksxnodemodules/static-type-assert) type assertion functions - -### Comparison - -The key differences in this project are: - -- a fluent, jest-inspired API, making the difference between `actual` and `expected` clear. This is helpful with complex types and assertions. -- inverting assertions intuitively and easily via `expectTypeOf(...).not` -- checks generics properly and strictly ([tsd doesn't](https://github.com/SamVerschueren/tsd/issues/142)) -- first-class support for: - - `any` (as well as `unknown` and `never`) (see issues outstanding at time of writing in tsd for [never](https://github.com/SamVerschueren/tsd/issues/78) and [any](https://github.com/SamVerschueren/tsd/issues/82)). - - This can be especially useful in combination with `not`, to protect against functions returning too-permissive types. For example, `const parseFile = (filename: string) => JSON.parse(readFileSync(filename).toString())` returns `any`, which could lead to errors. After giving it a proper return-type, you can add a test for this with `expect(parseFile).returns.not.toBeAny()` - - object properties - - function parameters - - function return values - - constructor parameters - - class instances - - array item values - - nullable types -- assertions on types "matching" rather than exact type equality, for "is-a" relationships e.g. `expectTypeOf(square).toExtend<Shape>()` -- built into existing tooling. No extra build step, cli tool, IDE extension, or lint plugin is needed. Just import the function and start writing tests. Failures will be at compile time - they'll appear in your IDE and when you run `tsc`. -- small implementation with no dependencies. [Take a look!](./src/index.ts) (tsd, for comparison, is [2.6MB](https://bundlephobia.com/result?p=tsd@0.13.1) because it ships a patched version of TypeScript). - -## TypeScript backwards-compatibility - -There is a CI job called `test-types` that checks whether the tests still pass with certain older TypeScript versions. To check the supported TypeScript versions, [refer to the job definition](./.github/workflows/ci.yml). - -## Contributing - -In most cases, it's worth checking existing issues or creating one to discuss a new feature or a bug fix before opening a pull request. - -Once you're ready to make a pull request: clone the repo, and install pnpm if you don't have it already with `npm install --global pnpm`. Lockfiles for `npm` and `yarn` are gitignored. - -If you're adding a feature, you should write a self-contained usage example in the form of a test, in [test/usage.test.ts](./test/usage.test.ts). This file is used to populate the bulk of this readme using [eslint-plugin-codegen](https://npmjs.com/package/eslint-plugin-codegen), and to generate an ["errors" test file](./test/errors.test.ts), which captures the error messages that are emitted for failing assertions by the TypeScript compiler. So, the test name should be written as a human-readable sentence explaining the usage example. Have a look at the existing tests for an idea of the style. - -After adding the tests, run `npm run lint -- --fix` to update the readme, and `npm test -- --updateSnapshot` to update the errors test. The generated documentation and tests should be pushed to the same branch as the source code, and submitted as a pull request. CI will test that the docs and tests are up to date if you forget to run these commands. - -### Documentation of limitations through tests - -Limitations of the library are documented through tests in `usage.test.ts`. This means that if a future TypeScript version (or library version) fixes the limitation, the test will start failing, and it will be automatically removed from the documentation once it no longer applies. diff --git a/vanilla/node_modules/expect-type/SECURITY.md b/vanilla/node_modules/expect-type/SECURITY.md deleted file mode 100644 index 3f988a6..0000000 --- a/vanilla/node_modules/expect-type/SECURITY.md +++ /dev/null @@ -1,14 +0,0 @@ -# Security Policy - -## Supported Versions - -Version 1.0.0 will be supported with security updates. - -| Version | Supported | -| ------- | ------------------ | -| 1.x.x | :white_check_mark: | -| < 1.0 | :x: | - -## Reporting a Vulnerability - -To report a security vulnerability, please use the [Tidelift security contact](https://tidelift.com/security). Tidelift will coordinate the fix and disclosure. diff --git a/vanilla/node_modules/expect-type/dist/branding.d.ts b/vanilla/node_modules/expect-type/dist/branding.d.ts deleted file mode 100644 index b59cccd..0000000 --- a/vanilla/node_modules/expect-type/dist/branding.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import type { ConstructorOverloadParameters, NumOverloads, OverloadsInfoUnion } from './overloads'; -import type { IsNever, IsAny, IsUnknown, ReadonlyKeys, RequiredKeys, OptionalKeys, MutuallyExtends, UnionToTuple } from './utils'; -/** - * Represents a deeply branded type. - * - * Recursively walk a type and replace it with a branded type related to the - * original. This is useful for equality-checking stricter than - * `A extends B ? B extends A ? true : false : false`, because it detects the - * difference between a few edge-case types that vanilla TypeScript - * doesn't by default: - * - `any` vs `unknown` - * - `{ readonly a: string }` vs `{ a: string }` - * - `{ a?: string }` vs `{ a: string | undefined }` - * - * __Note__: not very performant for complex types - this should only be used - * when you know you need it. If doing an equality check, it's almost always - * better to use {@linkcode StrictEqualUsingTSInternalIdenticalToOperator}. - */ -export type DeepBrand<T> = IsNever<T> extends true ? { - type: 'never'; -} : IsAny<T> extends true ? { - type: 'any'; -} : IsUnknown<T> extends true ? { - type: 'unknown'; -} : T extends string | number | boolean | symbol | bigint | null | undefined | void ? { - type: 'primitive'; - value: T; -} : T extends new (...args: any[]) => any ? { - type: 'constructor'; - params: ConstructorOverloadParameters<T>; - instance: DeepBrand<InstanceType<Extract<T, new (...args: any) => any>>>; -} : T extends (...args: infer P) => infer R ? NumOverloads<T> extends 1 ? { - type: 'function'; - params: DeepBrand<P>; - return: DeepBrand<R>; - this: DeepBrand<ThisParameterType<T>>; - props: DeepBrand<Omit<T, keyof Function>>; -} : UnionToTuple<OverloadsInfoUnion<T>> extends infer OverloadsTuple ? { - type: 'overloads'; - overloads: { - [K in keyof OverloadsTuple]: DeepBrand<OverloadsTuple[K]>; - }; -} : never : T extends any[] ? { - type: 'array'; - items: { - [K in keyof T]: T[K]; - }; -} : { - type: 'object'; - properties: { - [K in keyof T]: DeepBrand<T[K]>; - }; - readonly: ReadonlyKeys<T>; - required: RequiredKeys<T>; - optional: OptionalKeys<T>; - constructorParams: DeepBrand<ConstructorOverloadParameters<T>>; -}; -/** - * Checks if two types are strictly equal using branding. - */ -export type StrictEqualUsingBranding<Left, Right> = MutuallyExtends<DeepBrand<Left>, DeepBrand<Right>>; diff --git a/vanilla/node_modules/expect-type/dist/branding.js b/vanilla/node_modules/expect-type/dist/branding.js deleted file mode 100644 index c8ad2e5..0000000 --- a/vanilla/node_modules/expect-type/dist/branding.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/vanilla/node_modules/expect-type/dist/index.d.ts b/vanilla/node_modules/expect-type/dist/index.d.ts deleted file mode 100644 index 4098988..0000000 --- a/vanilla/node_modules/expect-type/dist/index.d.ts +++ /dev/null @@ -1,897 +0,0 @@ -import type { StrictEqualUsingBranding } from './branding'; -import type { ExpectAny, ExpectArray, ExpectBigInt, ExpectBoolean, ExpectFunction, ExpectNever, ExpectNull, ExpectNullable, ExpectNumber, ExpectObject, ExpectString, ExpectSymbol, ExpectUndefined, ExpectUnknown, ExpectVoid, MismatchInfo, Scolder } from './messages'; -import type { ConstructorOverloadParameters, OverloadParameters, OverloadReturnTypes, OverloadsNarrowedByParameters } from './overloads'; -import type { AValue, DeepPickMatchingProps, Extends, IsUnion, MismatchArgs, Not, StrictEqualUsingTSInternalIdenticalToOperator } from './utils'; -export * from './branding'; -export * from './messages'; -export * from './overloads'; -export * from './utils'; -/** - * Represents the positive assertion methods available for type checking in the - * {@linkcode expectTypeOf()} utility. - */ -export interface PositiveExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, { - positive: true; - branded: false; -}> { - /** - * Similar to jest's `expect(...).toMatchObject(...)` but for types. - * Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`. - * - * **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toMatchObjectType: <Expected extends IsUnion<Expected> extends true ? 'toMatchObject does not support union types' : Not<Extends<Expected, Record<string, unknown>>> extends true ? 'toMatchObject only supports object types' : StrictEqualUsingTSInternalIdenticalToOperator<DeepPickMatchingProps<Actual, Expected>, Expected> extends true ? unknown : MismatchInfo<DeepPickMatchingProps<Actual, Expected>, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<DeepPickMatchingProps<Actual, Expected>, Expected>, true>) => true; - /** - * Check if your type extends the expected type - * - * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties. - * This is roughly equivalent to an `extends` constraint in a function type argument. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>() - * - * expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toExtend: <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>) => true; - toEqualTypeOf: { - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`. - ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true; - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected extends StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, true>): true; - }; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - */ - toMatchTypeOf: { - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`. - ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of {@linkcode toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected extends Extends<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, true>): true; - }; - /** - * Checks whether an object has a given property. - * - * @example - * <caption>check that properties exist</caption> - * ```ts - * const obj = { a: 1, b: '' } - * - * expectTypeOf(obj).toHaveProperty('a') - * - * expectTypeOf(obj).not.toHaveProperty('c') - * ``` - * - * @param key - The property key to check for. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toHaveProperty: <KeyType extends keyof Actual>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, true>) => KeyType extends keyof Actual ? PositiveExpectTypeOf<Actual[KeyType]> : true; - /** - * Inverts the result of the following assertions. - * - * @example - * ```ts - * expectTypeOf({ a: 1 }).not.toMatchTypeOf({ b: 1 }) - * ``` - */ - not: NegativeExpectTypeOf<Actual>; - /** - * Intersection types can cause issues with - * {@linkcode toEqualTypeOf | .toEqualTypeOf()}: - * ```ts - * // ❌ The following line doesn't compile, even though the types are arguably the same. - * expectTypeOf<{ a: 1 } & { b: 2 }>().toEqualTypeOf<{ a: 1; b: 2 }>() - * ``` - * This helper works around this problem by using - * a more permissive but less performant check. - * - * __Note__: This comes at a performance cost, and can cause the compiler - * to 'give up' if used with excessively deep types, so use sparingly. - * - * @see {@link https://github.com/mmkal/expect-type/pull/21 | Reference} - */ - branded: { - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toEqualTypeOf: <Expected extends StrictEqualUsingBranding<Actual, Expected> extends true ? unknown : MismatchInfo<Actual, Expected>>(...MISMATCH: MismatchArgs<StrictEqualUsingBranding<Actual, Expected>, true>) => true; - }; -} -/** - * Represents the negative expectation type for the {@linkcode Actual} type. - */ -export interface NegativeExpectTypeOf<Actual> extends BaseExpectTypeOf<Actual, { - positive: false; -}> { - /** - * Similar to jest's `expect(...).toMatchObject(...)` but for types. - * Deeply "picks" the properties of the actual type based on the expected type, then performs a strict check to make sure the types match `Expected`. - * - * **Note**: optional properties on the {@linkcode Expected | expected type} are not allowed to be missing on the {@linkcode Actual | actual type}. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchObjectType<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toMatchObjectType<{ a: number; c?: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toMatchObjectType: <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Pick<Actual, keyof Actual & keyof Expected>, Expected>, false>) => true; - /** - * Check if your type extends the expected type - * - * A less strict version of {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} that allows for extra properties. - * This is roughly equivalent to an `extends` constraint in a function type argument. - * - * @example - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toExtend<{ a: number }>()] - * - * expectTypeOf({ a: 1 }).not.toExtend<{ b: number }>() - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toExtend<Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true; - toEqualTypeOf: { - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected>(value: Expected & AValue, ...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true; - /** - * Uses TypeScript's internal technique to check for type "identicalness". - * - * It will check if the types are fully equal to each other. - * It will not fail if two objects have different values, but the same type. - * It will fail however if an object is missing a property. - * - * **_Unexpected failure_**? For a more permissive but less performant - * check that accommodates for equivalent intersection types, - * use {@linkcode PositiveExpectTypeOf.branded | .branded.toEqualTypeOf()}. - * @see {@link https://github.com/mmkal/expect-type#why-is-my-assertion-failing | The documentation for details}. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf<{ a: number }>() - * - * expectTypeOf({ a: 1, b: 1 }).not.toEqualTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 1 }) - * - * expectTypeOf({ a: 1 }).toEqualTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected>(...MISMATCH: MismatchArgs<StrictEqualUsingTSInternalIdenticalToOperator<Actual, Expected>, false>): true; - }; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - */ - toMatchTypeOf: { - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of - * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param value - The value to compare against the expected type. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected>(value: Expected & AValue, // reason for `& AValue`: make sure this is only the selected overload when the end-user passes a value for an inferred typearg. The `Mismatch` type does match `AValue`. - ...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true; - /** - * @deprecated Since v1.2.0 - Use either {@linkcode toMatchObjectType} or {@linkcode toExtend} instead - * - * - Use {@linkcode toMatchObjectType} to perform a strict check on a subset of your type's keys - * - Use {@linkcode toExtend} to check if your type extends the expected type - * - * A less strict version of - * {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} - * that allows for extra properties. - * This is roughly equivalent to an `extends` constraint - * in a function type argument. - * - * @example - * <caption>Using generic type argument syntax</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf<{ a: number }>() - * ``` - * - * @example - * <caption>Using inferred type syntax by passing a value</caption> - * ```ts - * expectTypeOf({ a: 1, b: 1 }).toMatchTypeOf({ a: 2 }) - * ``` - * - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - <Expected>(...MISMATCH: MismatchArgs<Extends<Actual, Expected>, false>): true; - }; - /** - * Checks whether an object has a given property. - * - * @example - * <caption>check that properties exist</caption> - * ```ts - * const obj = { a: 1, b: '' } - * - * expectTypeOf(obj).toHaveProperty('a') - * - * expectTypeOf(obj).not.toHaveProperty('c') - * ``` - * - * @param key - The property key to check for. - * @param MISMATCH - The mismatch arguments. - * @returns `true`. - */ - toHaveProperty: <KeyType extends string | number | symbol>(key: KeyType, ...MISMATCH: MismatchArgs<Extends<KeyType, keyof Actual>, false>) => true; -} -/** - * Represents a conditional type that selects either - * {@linkcode PositiveExpectTypeOf} or {@linkcode NegativeExpectTypeOf} based - * on the value of the `positive` property in the {@linkcode Options} type. - */ -export type ExpectTypeOf<Actual, Options extends { - positive: boolean; -}> = Options['positive'] extends true ? PositiveExpectTypeOf<Actual> : NegativeExpectTypeOf<Actual>; -/** - * Represents the base interface for the - * {@linkcode expectTypeOf()} function. - * Provides a set of assertion methods to perform type checks on a value. - */ -export interface BaseExpectTypeOf<Actual, Options extends { - positive: boolean; -}> { - /** - * Checks whether the type of the value is `any`. - */ - toBeAny: Scolder<ExpectAny<Actual>, Options>; - /** - * Checks whether the type of the value is `unknown`. - */ - toBeUnknown: Scolder<ExpectUnknown<Actual>, Options>; - /** - * Checks whether the type of the value is `never`. - */ - toBeNever: Scolder<ExpectNever<Actual>, Options>; - /** - * Checks whether the type of the value is `function`. - */ - toBeFunction: Scolder<ExpectFunction<Actual>, Options>; - /** - * Checks whether the type of the value is `object`. - */ - toBeObject: Scolder<ExpectObject<Actual>, Options>; - /** - * Checks whether the type of the value is an {@linkcode Array}. - */ - toBeArray: Scolder<ExpectArray<Actual>, Options>; - /** - * Checks whether the type of the value is `number`. - */ - toBeNumber: Scolder<ExpectNumber<Actual>, Options>; - /** - * Checks whether the type of the value is `string`. - */ - toBeString: Scolder<ExpectString<Actual>, Options>; - /** - * Checks whether the type of the value is `boolean`. - */ - toBeBoolean: Scolder<ExpectBoolean<Actual>, Options>; - /** - * Checks whether the type of the value is `void`. - */ - toBeVoid: Scolder<ExpectVoid<Actual>, Options>; - /** - * Checks whether the type of the value is `symbol`. - */ - toBeSymbol: Scolder<ExpectSymbol<Actual>, Options>; - /** - * Checks whether the type of the value is `null`. - */ - toBeNull: Scolder<ExpectNull<Actual>, Options>; - /** - * Checks whether the type of the value is `undefined`. - */ - toBeUndefined: Scolder<ExpectUndefined<Actual>, Options>; - /** - * Checks whether the type of the value is `null` or `undefined`. - */ - toBeNullable: Scolder<ExpectNullable<Actual>, Options>; - /** - * Transform that type of the value via a callback. - * - * @param fn - A callback that transforms the input value. Note that this function is not actually called - it's only used for type inference. - * @returns A new type which can be used for further assertions. - */ - map: <T>(fn: (value: Actual) => T) => ExpectTypeOf<T, Options>; - /** - * Checks whether the type of the value is **`bigint`**. - * - * @example - * <caption>#### Distinguish between **`number`** and **`bigint`**</caption> - * - * ```ts - * import { expectTypeOf } from 'expect-type' - * - * const aVeryBigInteger = 10n ** 100n - * - * expectTypeOf(aVeryBigInteger).not.toBeNumber() - * - * expectTypeOf(aVeryBigInteger).toBeBigInt() - * ``` - * - * @since 1.1.0 - */ - toBeBigInt: Scolder<ExpectBigInt<Actual>, Options>; - /** - * Checks whether a function is callable with the given parameters. - * - * __Note__: You cannot negate this assertion with - * {@linkcode PositiveExpectTypeOf.not | .not}, you need to use - * `ts-expect-error` instead. - * - * @example - * ```ts - * const f = (a: number) => [a, a] - * - * expectTypeOf(f).toBeCallableWith(1) - * ``` - * - * __Known Limitation__: This assertion will likely fail if you try to use it - * with a generic function or an overload. - * @see {@link https://github.com/mmkal/expect-type/issues/50 | This issue} for an example and a workaround. - * - * @param args - The arguments to check for callability. - * @returns `true`. - */ - toBeCallableWith: Options['positive'] extends true ? <Args extends OverloadParameters<Actual>>(...args: Args) => ExpectTypeOf<OverloadsNarrowedByParameters<Actual, Args>, Options> : never; - /** - * Checks whether a class is constructible with the given parameters. - * - * @example - * ```ts - * expectTypeOf(Date).toBeConstructibleWith('1970') - * - * expectTypeOf(Date).toBeConstructibleWith(0) - * - * expectTypeOf(Date).toBeConstructibleWith(new Date()) - * - * expectTypeOf(Date).toBeConstructibleWith() - * ``` - * - * @param args - The arguments to check for constructibility. - * @returns `true`. - */ - toBeConstructibleWith: Options['positive'] extends true ? <Args extends ConstructorOverloadParameters<Actual>>(...args: Args) => true : never; - /** - * Equivalent to the {@linkcode Extract} utility type. - * Helps narrow down complex union types. - * - * @example - * ```ts - * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T } - * - * interface CSSProperties { - * margin?: string - * padding?: string - * } - * - * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> { - * return {} - * } - * - * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' } - * - * expectTypeOf(getResponsiveProp(cssProperties)) - * .extract<{ xs?: any }>() // extracts the last type from a union - * .toEqualTypeOf<{ - * xs?: CSSProperties - * sm?: CSSProperties - * md?: CSSProperties - * }>() - * - * expectTypeOf(getResponsiveProp(cssProperties)) - * .extract<unknown[]>() // extracts an array from a union - * .toEqualTypeOf<CSSProperties[]>() - * ``` - * - * __Note__: If no type is found in the union, it will return `never`. - * - * @param v - The type to extract from the union. - * @returns The type after extracting the type from the union. - */ - extract: <V>(v?: V) => ExpectTypeOf<Extract<Actual, V>, Options>; - /** - * Equivalent to the {@linkcode Exclude} utility type. - * Removes types from a union. - * - * @example - * ```ts - * type ResponsiveProp<T> = T | T[] | { xs?: T; sm?: T; md?: T } - * - * interface CSSProperties { - * margin?: string - * padding?: string - * } - * - * function getResponsiveProp<T>(_props: T): ResponsiveProp<T> { - * return {} - * } - * - * const cssProperties: CSSProperties = { margin: '1px', padding: '2px' } - * - * expectTypeOf(getResponsiveProp(cssProperties)) - * .exclude<unknown[]>() - * .exclude<{ xs?: unknown }>() // or just `.exclude<unknown[] | { xs?: unknown }>()` - * .toEqualTypeOf<CSSProperties>() - * ``` - */ - exclude: <V>(v?: V) => ExpectTypeOf<Exclude<Actual, V>, Options>; - /** - * Equivalent to the {@linkcode Pick} utility type. - * Helps select a subset of properties from an object type. - * - * @example - * ```ts - * interface Person { - * name: string - * age: number - * } - * - * expectTypeOf<Person>() - * .pick<'name'>() - * .toEqualTypeOf<{ name: string }>() - * ``` - * - * @param keyToPick - The property key to pick. - * @returns The type after picking the property. - */ - pick: <KeyToPick extends keyof Actual>(keyToPick?: KeyToPick) => ExpectTypeOf<Pick<Actual, KeyToPick>, Options>; - /** - * Equivalent to the {@linkcode Omit} utility type. - * Helps remove a subset of properties from an object type. - * - * @example - * ```ts - * interface Person { - * name: string - * age: number - * } - * - * expectTypeOf<Person>().omit<'name'>().toEqualTypeOf<{ age: number }>() - * ``` - * - * @param keyToOmit - The property key to omit. - * @returns The type after omitting the property. - */ - omit: <KeyToOmit extends keyof Actual | (PropertyKey & Record<never, never>)>(keyToOmit?: KeyToOmit) => ExpectTypeOf<Omit<Actual, KeyToOmit>, Options>; - /** - * Extracts a certain function argument with `.parameter(number)` call to - * perform other assertions on it. - * - * @example - * ```ts - * function foo(a: number, b: string) { - * return [a, b] - * } - * - * expectTypeOf(foo).parameter(0).toBeNumber() - * - * expectTypeOf(foo).parameter(1).toBeString() - * ``` - * - * @param index - The index of the parameter to extract. - * @returns The extracted parameter type. - */ - parameter: <Index extends number>(index: Index) => ExpectTypeOf<OverloadParameters<Actual>[Index], Options>; - /** - * Equivalent to the {@linkcode Parameters} utility type. - * Extracts function parameters to perform assertions on its value. - * Parameters are returned as an array. - * - * @example - * ```ts - * function noParam() {} - * - * function hasParam(s: string) {} - * - * expectTypeOf(noParam).parameters.toEqualTypeOf<[]>() - * - * expectTypeOf(hasParam).parameters.toEqualTypeOf<[string]>() - * ``` - */ - parameters: ExpectTypeOf<OverloadParameters<Actual>, Options>; - /** - * Equivalent to the {@linkcode ConstructorParameters} utility type. - * Extracts constructor parameters as an array of values and - * perform assertions on them with this method. - * - * For overloaded constructors it will return a union of all possible parameter-tuples. - * - * @example - * ```ts - * expectTypeOf(Date).constructorParameters.toEqualTypeOf< - * [] | [string | number | Date] - * >() - * ``` - */ - constructorParameters: ExpectTypeOf<ConstructorOverloadParameters<Actual>, Options>; - /** - * Equivalent to the {@linkcode ThisParameterType} utility type. - * Extracts the `this` parameter of a function to - * perform assertions on its value. - * - * @example - * ```ts - * function greet(this: { name: string }, message: string) { - * return `Hello ${this.name}, here's your message: ${message}` - * } - * - * expectTypeOf(greet).thisParameter.toEqualTypeOf<{ name: string }>() - * ``` - */ - thisParameter: ExpectTypeOf<ThisParameterType<Actual>, Options>; - /** - * Equivalent to the {@linkcode InstanceType} utility type. - * Extracts the instance type of a class to perform assertions on. - * - * @example - * ```ts - * expectTypeOf(Date).instance.toHaveProperty('toISOString') - * ``` - */ - instance: Actual extends new (...args: any[]) => infer I ? ExpectTypeOf<I, Options> : never; - /** - * Equivalent to the {@linkcode ReturnType} utility type. - * Extracts the return type of a function. - * - * @example - * ```ts - * expectTypeOf(() => {}).returns.toBeVoid() - * - * expectTypeOf((a: number) => [a, a]).returns.toEqualTypeOf([1, 2]) - * ``` - */ - returns: Actual extends Function ? ExpectTypeOf<OverloadReturnTypes<Actual>, Options> : never; - /** - * Extracts resolved value of a Promise, - * so you can perform other assertions on it. - * - * @example - * ```ts - * async function asyncFunc() { - * return 123 - * } - * - * expectTypeOf(asyncFunc).returns.resolves.toBeNumber() - * - * expectTypeOf(Promise.resolve('string')).resolves.toBeString() - * ``` - * - * Type Equivalent: - * ```ts - * type Resolves<PromiseType> = PromiseType extends PromiseLike<infer ResolvedType> - * ? ResolvedType - * : never - * ``` - */ - resolves: Actual extends PromiseLike<infer ResolvedType> ? ExpectTypeOf<ResolvedType, Options> : never; - /** - * Extracts array item type to perform assertions on. - * - * @example - * ```ts - * expectTypeOf([1, 2, 3]).items.toEqualTypeOf<number>() - * - * expectTypeOf([1, 2, 3]).items.not.toEqualTypeOf<string>() - * ``` - * - * __Type Equivalent__: - * ```ts - * type Items<ArrayType> = ArrayType extends ArrayLike<infer ItemType> - * ? ItemType - * : never - * ``` - */ - items: Actual extends ArrayLike<infer ItemType> ? ExpectTypeOf<ItemType, Options> : never; - /** - * Extracts the type guarded by a function to perform assertions on. - * - * @example - * ```ts - * function isString(v: any): v is string { - * return typeof v === 'string' - * } - * - * expectTypeOf(isString).guards.toBeString() - * ``` - */ - guards: Actual extends (v: any, ...args: any[]) => v is infer T ? ExpectTypeOf<T, Options> : never; - /** - * Extracts the type asserted by a function to perform assertions on. - * - * @example - * ```ts - * function assertNumber(v: any): asserts v is number { - * if (typeof v !== 'number') - * throw new TypeError('Nope !') - * } - * - * expectTypeOf(assertNumber).asserts.toBeNumber() - * ``` - */ - asserts: Actual extends (v: any, ...args: any[]) => asserts v is infer T ? unknown extends T ? never : ExpectTypeOf<T, Options> : never; -} -/** - * Represents a function that allows asserting the expected type of a value. - */ -export type _ExpectTypeOf = { - /** - * Asserts the expected type of a value. - * - * @param actual - The actual value being asserted. - * @returns An object representing the expected type assertion. - */ - <Actual>(actual: Actual): ExpectTypeOf<Actual, { - positive: true; - branded: false; - }>; - /** - * Asserts the expected type of a value without providing an actual value. - * - * @returns An object representing the expected type assertion. - */ - <Actual>(): ExpectTypeOf<Actual, { - positive: true; - branded: false; - }>; -}; -/** - * Similar to Jest's `expect`, but with type-awareness. - * Gives you access to a number of type-matchers that let you make assertions about the - * form of a reference or generic type parameter. - * - * @example - * ```ts - * import { foo, bar } from '../foo' - * import { expectTypeOf } from 'expect-type' - * - * test('foo types', () => { - * // make sure `foo` has type { a: number } - * expectTypeOf(foo).toMatchTypeOf({ a: 1 }) - * expectTypeOf(foo).toHaveProperty('a').toBeNumber() - * - * // make sure `bar` is a function taking a string: - * expectTypeOf(bar).parameter(0).toBeString() - * expectTypeOf(bar).returns.not.toBeAny() - * }) - * ``` - * - * @description - * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples. - */ -export declare const expectTypeOf: _ExpectTypeOf; diff --git a/vanilla/node_modules/expect-type/dist/index.js b/vanilla/node_modules/expect-type/dist/index.js deleted file mode 100644 index 55e299e..0000000 --- a/vanilla/node_modules/expect-type/dist/index.js +++ /dev/null @@ -1,96 +0,0 @@ -"use strict"; -var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - var desc = Object.getOwnPropertyDescriptor(m, k); - if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { - desc = { enumerable: true, get: function() { return m[k]; } }; - } - Object.defineProperty(o, k2, desc); -}) : (function(o, m, k, k2) { - if (k2 === undefined) k2 = k; - o[k2] = m[k]; -})); -var __exportStar = (this && this.__exportStar) || function(m, exports) { - for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); -}; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.expectTypeOf = void 0; -__exportStar(require("./branding"), exports); // backcompat, consider removing in next major version -__exportStar(require("./messages"), exports); // backcompat, consider removing in next major version -__exportStar(require("./overloads"), exports); -__exportStar(require("./utils"), exports); // backcompat, consider removing in next major version -const fn = () => true; -/** - * Similar to Jest's `expect`, but with type-awareness. - * Gives you access to a number of type-matchers that let you make assertions about the - * form of a reference or generic type parameter. - * - * @example - * ```ts - * import { foo, bar } from '../foo' - * import { expectTypeOf } from 'expect-type' - * - * test('foo types', () => { - * // make sure `foo` has type { a: number } - * expectTypeOf(foo).toMatchTypeOf({ a: 1 }) - * expectTypeOf(foo).toHaveProperty('a').toBeNumber() - * - * // make sure `bar` is a function taking a string: - * expectTypeOf(bar).parameter(0).toBeString() - * expectTypeOf(bar).returns.not.toBeAny() - * }) - * ``` - * - * @description - * See the [full docs](https://npmjs.com/package/expect-type#documentation) for lots more examples. - */ -const expectTypeOf = (_actual) => { - const nonFunctionProperties = [ - 'parameters', - 'returns', - 'resolves', - 'not', - 'items', - 'constructorParameters', - 'thisParameter', - 'instance', - 'guards', - 'asserts', - 'branded', - ]; - const obj = { - /* eslint-disable @typescript-eslint/no-unsafe-assignment */ - toBeAny: fn, - toBeUnknown: fn, - toBeNever: fn, - toBeFunction: fn, - toBeObject: fn, - toBeArray: fn, - toBeString: fn, - toBeNumber: fn, - toBeBoolean: fn, - toBeVoid: fn, - toBeSymbol: fn, - toBeNull: fn, - toBeUndefined: fn, - toBeNullable: fn, - toBeBigInt: fn, - toMatchTypeOf: fn, - toEqualTypeOf: fn, - toBeConstructibleWith: fn, - toMatchObjectType: fn, - toExtend: fn, - map: exports.expectTypeOf, - toBeCallableWith: exports.expectTypeOf, - extract: exports.expectTypeOf, - exclude: exports.expectTypeOf, - pick: exports.expectTypeOf, - omit: exports.expectTypeOf, - toHaveProperty: exports.expectTypeOf, - parameter: exports.expectTypeOf, - }; - const getterProperties = nonFunctionProperties; - getterProperties.forEach((prop) => Object.defineProperty(obj, prop, { get: () => (0, exports.expectTypeOf)({}) })); - return obj; -}; -exports.expectTypeOf = expectTypeOf; diff --git a/vanilla/node_modules/expect-type/dist/messages.d.ts b/vanilla/node_modules/expect-type/dist/messages.d.ts deleted file mode 100644 index d8de9be..0000000 --- a/vanilla/node_modules/expect-type/dist/messages.d.ts +++ /dev/null @@ -1,168 +0,0 @@ -import type { StrictEqualUsingBranding } from './branding'; -import type { And, Extends, ExtendsExcludingAnyOrNever, IsAny, IsNever, IsUnknown, Not, OptionalKeys, UsefulKeys } from './utils'; -/** - * Determines the printable type representation for a given type. - */ -export type PrintType<T> = IsUnknown<T> extends true ? 'unknown' : IsNever<T> extends true ? 'never' : IsAny<T> extends true ? never : boolean extends T ? 'boolean' : T extends boolean ? `literal boolean: ${T}` : string extends T ? 'string' : T extends string ? `literal string: ${T}` : number extends T ? 'number' : T extends number ? `literal number: ${T}` : bigint extends T ? 'bigint' : T extends bigint ? `literal bigint: ${T}` : T extends null ? 'null' : T extends undefined ? 'undefined' : T extends (...args: any[]) => any ? 'function' : '...'; -/** - * Helper for showing end-user a hint why their type assertion is failing. - * This swaps "leaf" types with a literal message about what the actual and - * expected types are. Needs to check for `Not<IsAny<Actual>>` because - * otherwise `LeafTypeOf<Actual>` returns `never`, which extends everything 🤔 - */ -export type MismatchInfo<Actual, Expected> = And<[Extends<PrintType<Actual>, '...'>, Not<IsAny<Actual>>]> extends true ? And<[Extends<any[], Actual>, Extends<any[], Expected>]> extends true ? Array<MismatchInfo<Extract<Actual, any[]>[number], Extract<Expected, any[]>[number]>> : Optionalify<{ - [K in UsefulKeys<Actual> | UsefulKeys<Expected>]: MismatchInfo<K extends keyof Actual ? Actual[K] : never, K extends keyof Expected ? Expected[K] : never>; -}, OptionalKeys<Expected>> : StrictEqualUsingBranding<Actual, Expected> extends true ? Actual : `Expected: ${PrintType<Expected>}, Actual: ${PrintType<Exclude<Actual, Expected>>}`; -/** - * Helper for making some keys of a type optional. Only useful so far for `MismatchInfo` - it makes sure we - * don't get bogus errors about optional properties mismatching, when actually it's something else that's wrong. - * - * - Note: this helper is a no-op if there are no optional keys in the type. - */ -export type Optionalify<T, TOptionalKeys> = [TOptionalKeys] extends [never] ? T : ({ - [K in Exclude<keyof T, TOptionalKeys>]: T[K]; -} & { - [K in Extract<keyof T, TOptionalKeys>]?: T[K]; -}) extends infer X ? { - [K in keyof X]: X[K]; -} : never; -/** - * @internal - */ -declare const inverted: unique symbol; -/** - * @internal - */ -type Inverted<T> = { - [inverted]: T; -}; -/** - * @internal - */ -declare const expectNull: unique symbol; -export type ExpectNull<T> = { - [expectNull]: T; - result: ExtendsExcludingAnyOrNever<T, null>; -}; -/** - * @internal - */ -declare const expectUndefined: unique symbol; -export type ExpectUndefined<T> = { - [expectUndefined]: T; - result: ExtendsExcludingAnyOrNever<T, undefined>; -}; -/** - * @internal - */ -declare const expectNumber: unique symbol; -export type ExpectNumber<T> = { - [expectNumber]: T; - result: ExtendsExcludingAnyOrNever<T, number>; -}; -/** - * @internal - */ -declare const expectString: unique symbol; -export type ExpectString<T> = { - [expectString]: T; - result: ExtendsExcludingAnyOrNever<T, string>; -}; -/** - * @internal - */ -declare const expectBoolean: unique symbol; -export type ExpectBoolean<T> = { - [expectBoolean]: T; - result: ExtendsExcludingAnyOrNever<T, boolean>; -}; -/** - * @internal - */ -declare const expectVoid: unique symbol; -export type ExpectVoid<T> = { - [expectVoid]: T; - result: ExtendsExcludingAnyOrNever<T, void>; -}; -/** - * @internal - */ -declare const expectFunction: unique symbol; -export type ExpectFunction<T> = { - [expectFunction]: T; - result: ExtendsExcludingAnyOrNever<T, (...args: any[]) => any>; -}; -/** - * @internal - */ -declare const expectObject: unique symbol; -export type ExpectObject<T> = { - [expectObject]: T; - result: ExtendsExcludingAnyOrNever<T, object>; -}; -/** - * @internal - */ -declare const expectArray: unique symbol; -export type ExpectArray<T> = { - [expectArray]: T; - result: ExtendsExcludingAnyOrNever<T, any[]>; -}; -/** - * @internal - */ -declare const expectSymbol: unique symbol; -export type ExpectSymbol<T> = { - [expectSymbol]: T; - result: ExtendsExcludingAnyOrNever<T, symbol>; -}; -/** - * @internal - */ -declare const expectAny: unique symbol; -export type ExpectAny<T> = { - [expectAny]: T; - result: IsAny<T>; -}; -/** - * @internal - */ -declare const expectUnknown: unique symbol; -export type ExpectUnknown<T> = { - [expectUnknown]: T; - result: IsUnknown<T>; -}; -/** - * @internal - */ -declare const expectNever: unique symbol; -export type ExpectNever<T> = { - [expectNever]: T; - result: IsNever<T>; -}; -/** - * @internal - */ -declare const expectNullable: unique symbol; -export type ExpectNullable<T> = { - [expectNullable]: T; - result: Not<StrictEqualUsingBranding<T, NonNullable<T>>>; -}; -/** - * @internal - */ -declare const expectBigInt: unique symbol; -export type ExpectBigInt<T> = { - [expectBigInt]: T; - result: ExtendsExcludingAnyOrNever<T, bigint>; -}; -/** - * Checks if the result of an expecter matches the specified options, and - * resolves to a fairly readable error message if not. - */ -export type Scolder<Expecter extends { - result: boolean; -}, Options extends { - positive: boolean; -}> = Expecter['result'] extends Options['positive'] ? () => true : Options['positive'] extends true ? Expecter : Inverted<Expecter>; -export {}; diff --git a/vanilla/node_modules/expect-type/dist/messages.js b/vanilla/node_modules/expect-type/dist/messages.js deleted file mode 100644 index ff4e0ae..0000000 --- a/vanilla/node_modules/expect-type/dist/messages.js +++ /dev/null @@ -1,66 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * @internal - */ -const inverted = Symbol('inverted'); -/** - * @internal - */ -const expectNull = Symbol('expectNull'); -/** - * @internal - */ -const expectUndefined = Symbol('expectUndefined'); -/** - * @internal - */ -const expectNumber = Symbol('expectNumber'); -/** - * @internal - */ -const expectString = Symbol('expectString'); -/** - * @internal - */ -const expectBoolean = Symbol('expectBoolean'); -/** - * @internal - */ -const expectVoid = Symbol('expectVoid'); -/** - * @internal - */ -const expectFunction = Symbol('expectFunction'); -/** - * @internal - */ -const expectObject = Symbol('expectObject'); -/** - * @internal - */ -const expectArray = Symbol('expectArray'); -/** - * @internal - */ -const expectSymbol = Symbol('expectSymbol'); -/** - * @internal - */ -const expectAny = Symbol('expectAny'); -/** - * @internal - */ -const expectUnknown = Symbol('expectUnknown'); -/** - * @internal - */ -const expectNever = Symbol('expectNever'); -/** - * @internal - */ -const expectNullable = Symbol('expectNullable'); -/** - * @internal - */ -const expectBigInt = Symbol('expectBigInt'); diff --git a/vanilla/node_modules/expect-type/dist/overloads.d.ts b/vanilla/node_modules/expect-type/dist/overloads.d.ts deleted file mode 100644 index ab0e22e..0000000 --- a/vanilla/node_modules/expect-type/dist/overloads.d.ts +++ /dev/null @@ -1,288 +0,0 @@ -import type { StrictEqualUsingTSInternalIdenticalToOperator, IsNever, UnionToIntersection, UnionToTuple } from './utils'; -/** - * The simple(ish) way to get overload info from a function - * {@linkcode FunctionType}. Recent versions of TypeScript will match any - * function against a generic 10-overload type, filling in slots with - * duplicates of the function. So, we can just match against a single type - * and get all the overloads. - * - * For older versions of TypeScript, we'll need to painstakingly do - * ten separate matches. - */ -export type TSPost53OverloadsInfoUnion<FunctionType> = FunctionType extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; - (...args: infer A9): infer R9; - (...args: infer A10): infer R10; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : never; -/** - * A function with `unknown` parameters and return type. - */ -export type UnknownFunction = (...args: unknown[]) => unknown; -/** - * `true` iff {@linkcode FunctionType} is - * equivalent to `(...args: unknown[]) => unknown`, - * which is what an overload variant looks like for a non-existent overload. - * This is useful because older versions of TypeScript end up with - * 9 "useless" overloads and one real one for parameterless/generic functions. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related} - */ -export type IsUselessOverloadInfo<FunctionType> = StrictEqualUsingTSInternalIdenticalToOperator<FunctionType, UnknownFunction>; -/** - * Old versions of TypeScript can sometimes seem to refuse to separate out - * union members unless you put them each in a pointless tuple and add an - * extra `infer X` expression. There may be a better way to work around this - * problem, but since it's not a problem in newer versions of TypeScript, - * it's not a priority right now. - */ -export type Tuplify<Union> = Union extends infer X ? [X] : never; -/** - * For older versions of TypeScript, we need two separate workarounds - * to get overload info. First, we need need to use - * {@linkcode DecreasingOverloadsInfoUnion} to get the overload info for - * functions with 1-10 overloads. Then, we need to filter out the - * "useless" overloads that are present in older versions of TypeScript, - * for parameterless functions. To do this we use - * {@linkcode IsUselessOverloadInfo} to remove useless overloads. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related} - */ -export type TSPre53OverloadsInfoUnion<FunctionType> = Tuplify<DecreasingOverloadsInfoUnion<FunctionType>> extends infer Tup ? Tup extends [infer Fn] ? IsUselessOverloadInfo<Fn> extends true ? never : Fn : never : never; -/** - * For versions of TypeScript below 5.3, we need to check for 10 overloads, - * then 9, then 8, etc., to get a union of the overload variants. - */ -export type DecreasingOverloadsInfoUnion<F> = F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; - (...args: infer A9): infer R9; - (...args: infer A10): infer R10; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) | ((...p: A10) => R10) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; - (...args: infer A9): infer R9; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) | ((...p: A9) => R9) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; - (...args: infer A8): infer R8; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) | ((...p: A8) => R8) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; - (...args: infer A7): infer R7; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) | ((...p: A7) => R7) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; - (...args: infer A6): infer R6; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) | ((...p: A6) => R6) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; - (...args: infer A5): infer R5; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) | ((...p: A5) => R5) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; - (...args: infer A4): infer R4; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) | ((...p: A4) => R4) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; - (...args: infer A3): infer R3; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) | ((...p: A3) => R3) : F extends { - (...args: infer A1): infer R1; - (...args: infer A2): infer R2; -} ? ((...p: A1) => R1) | ((...p: A2) => R2) : F extends (...args: infer A1) => infer R1 ? ((...p: A1) => R1) : never; -/** - * Get a union of overload variants for a function {@linkcode FunctionType}. - * Does a check for whether we can do the one-shot - * 10-overload matcher (which works for ts\>5.3), and if not, - * falls back to the more complicated utility. - */ -export type OverloadsInfoUnion<FunctionType> = IsNever<TSPost53OverloadsInfoUnion<(a: 1) => 2>> extends true ? TSPre53OverloadsInfoUnion<FunctionType> : TSPost53OverloadsInfoUnion<FunctionType>; -/** - * Allows inferring any function using the `infer` keyword. - */ -export type InferFunctionType<FunctionType extends (...args: any) => any> = FunctionType; -/** - * A union type of the parameters allowed for any - * overload of function {@linkcode FunctionType}. - */ -export type OverloadParameters<FunctionType> = OverloadsInfoUnion<FunctionType> extends InferFunctionType<infer Fn> ? Parameters<Fn> : never; -/** - * A union type of the return types for any overload of - * function {@linkcode FunctionType}. - */ -export type OverloadReturnTypes<FunctionType> = OverloadsInfoUnion<FunctionType> extends InferFunctionType<infer Fn> ? ReturnType<Fn> : never; -/** - * Takes an overload variants {@linkcode Union}, - * produced from {@linkcode OverloadsInfoUnion} and rejects - * the ones incompatible with parameters {@linkcode Args}. - */ -export type SelectOverloadsInfo<Union extends UnknownFunction, Args extends unknown[]> = Union extends InferFunctionType<infer Fn> ? (Args extends Parameters<Fn> ? Fn : never) : never; -/** - * Creates a new overload (an intersection type) from an existing one, - * which only includes variant(s) which can accept - * {@linkcode Args} as parameters. - */ -export type OverloadsNarrowedByParameters<FunctionType, Args extends OverloadParameters<FunctionType>> = UnionToIntersection<SelectOverloadsInfo<OverloadsInfoUnion<FunctionType>, Args>>; -/** - * The simple(ish) way to get overload info from a constructor - * {@linkcode ConstructorType}. Recent versions of TypeScript will match any - * constructor against a generic 10-overload type, filling in slots with - * duplicates of the constructor. So, we can just match against a single type - * and get all the overloads. - * - * For older versions of TypeScript, - * we'll need to painstakingly do ten separate matches. - */ -export type TSPost53ConstructorOverloadsInfoUnion<ConstructorType> = ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; - new (...args: infer A9): infer R9; - new (...args: infer A10): infer R10; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : never; -/** - * A constructor function with `unknown` parameters and return type. - */ -export type UnknownConstructor = new (...args: unknown[]) => unknown; -/** - * Same as {@linkcode IsUselessOverloadInfo}, but for constructors. - */ -export type IsUselessConstructorOverloadInfo<FunctionType> = StrictEqualUsingTSInternalIdenticalToOperator<FunctionType, UnknownConstructor>; -/** - * For older versions of TypeScript, we need two separate workarounds to - * get constructor overload info. First, we need need to use - * {@linkcode DecreasingConstructorOverloadsInfoUnion} to get the overload - * info for constructors with 1-10 overloads. Then, we need to filter out the - * "useless" overloads that are present in older versions of TypeScript, - * for parameterless constructors. To do this we use - * {@linkcode IsUselessConstructorOverloadInfo} to remove useless overloads. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/28867 | Related} - */ -export type TSPre53ConstructorOverloadsInfoUnion<ConstructorType> = Tuplify<DecreasingConstructorOverloadsInfoUnion<ConstructorType>> extends infer Tup ? Tup extends [infer Ctor] ? IsUselessConstructorOverloadInfo<Ctor> extends true ? never : Ctor : never : never; -/** - * For versions of TypeScript below 5.3, we need to check for 10 overloads, - * then 9, then 8, etc., to get a union of the overload variants. - */ -export type DecreasingConstructorOverloadsInfoUnion<ConstructorType> = ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; - new (...args: infer A9): infer R9; - new (...args: infer A10): infer R10; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) | (new (...p: A10) => R10) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; - new (...args: infer A9): infer R9; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) | (new (...p: A9) => R9) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; - new (...args: infer A8): infer R8; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) | (new (...p: A8) => R8) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; - new (...args: infer A7): infer R7; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) | (new (...p: A7) => R7) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; - new (...args: infer A6): infer R6; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) | (new (...p: A6) => R6) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; - new (...args: infer A5): infer R5; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) | (new (...p: A5) => R5) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; - new (...args: infer A4): infer R4; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) | (new (...p: A4) => R4) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; - new (...args: infer A3): infer R3; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) | (new (...p: A3) => R3) : ConstructorType extends { - new (...args: infer A1): infer R1; - new (...args: infer A2): infer R2; -} ? (new (...p: A1) => R1) | (new (...p: A2) => R2) : ConstructorType extends new (...args: infer A1) => infer R1 ? (new (...p: A1) => R1) : never; -/** - * Get a union of overload variants for a constructor - * {@linkcode ConstructorType}. Does a check for whether we can do the - * one-shot 10-overload matcher (which works for ts\>5.3), and if not, - * falls back to the more complicated utility. - */ -export type ConstructorOverloadsUnion<ConstructorType> = IsNever<TSPost53ConstructorOverloadsInfoUnion<new (a: 1) => any>> extends true ? TSPre53ConstructorOverloadsInfoUnion<ConstructorType> : TSPost53ConstructorOverloadsInfoUnion<ConstructorType>; -/** - * Allows inferring any constructor using the `infer` keyword. - */ -export type InferConstructor<ConstructorType extends new (...args: any) => any> = ConstructorType; -/** - * A union type of the parameters allowed for any overload - * of constructor {@linkcode ConstructorType}. - */ -export type ConstructorOverloadParameters<ConstructorType> = ConstructorOverloadsUnion<ConstructorType> extends InferConstructor<infer Ctor> ? ConstructorParameters<Ctor> : never; -/** - * Calculates the number of overloads for a given function type. - */ -export type NumOverloads<FunctionType> = UnionToTuple<OverloadsInfoUnion<FunctionType>>['length']; diff --git a/vanilla/node_modules/expect-type/dist/overloads.js b/vanilla/node_modules/expect-type/dist/overloads.js deleted file mode 100644 index c8ad2e5..0000000 --- a/vanilla/node_modules/expect-type/dist/overloads.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); diff --git a/vanilla/node_modules/expect-type/dist/utils.d.ts b/vanilla/node_modules/expect-type/dist/utils.d.ts deleted file mode 100644 index 255624b..0000000 --- a/vanilla/node_modules/expect-type/dist/utils.d.ts +++ /dev/null @@ -1,197 +0,0 @@ -/** - * Negates a boolean type. - */ -export type Not<T extends boolean> = T extends true ? false : true; -/** - * Returns `true` if at least one of the types in the - * {@linkcode Types} array is `true`, otherwise returns `false`. - */ -export type Or<Types extends boolean[]> = Types[number] extends false ? false : true; -/** - * Checks if all the boolean types in the {@linkcode Types} array are `true`. - */ -export type And<Types extends boolean[]> = Types[number] extends true ? true : false; -/** - * Represents an equality type that returns {@linkcode Right} if - * {@linkcode Left} is `true`, - * otherwise returns the negation of {@linkcode Right}. - */ -export type Eq<Left extends boolean, Right extends boolean> = Left extends true ? Right : Not<Right>; -/** - * Represents the exclusive OR operation on a tuple of boolean types. - * Returns `true` if exactly one of the boolean types is `true`, - * otherwise returns `false`. - */ -export type Xor<Types extends [boolean, boolean]> = Not<Eq<Types[0], Types[1]>>; -/** - * @internal - */ -declare const secret: unique symbol; -/** - * @internal - */ -type Secret = typeof secret; -/** - * Checks if the given type is `never`. - */ -export type IsNever<T> = [T] extends [never] ? true : false; -/** - * Checks if the given type is `any`. - */ -export type IsAny<T> = [T] extends [Secret] ? Not<IsNever<T>> : false; -/** - * Determines if the given type is `unknown`. - */ -export type IsUnknown<T> = [unknown] extends [T] ? Not<IsAny<T>> : false; -/** - * Determines if a type is either `never` or `any`. - */ -export type IsNeverOrAny<T> = Or<[IsNever<T>, IsAny<T>]>; -/** - * Subjective "useful" keys from a type. For objects it's just `keyof` but for - * tuples/arrays it's the number keys. - * - * @example - * ```ts - * UsefulKeys<{ a: 1; b: 2 }> // 'a' | 'b' - * - * UsefulKeys<['a', 'b']> // '0' | '1' - * - * UsefulKeys<string[]> // number - * ``` - */ -export type UsefulKeys<T> = T extends any[] ? { - [K in keyof T]: K; -}[number] : keyof T; -/** - * Extracts the keys from a type that are required (not optional). - */ -export type RequiredKeys<T> = Extract<{ - [K in keyof T]-?: {} extends Pick<T, K> ? never : K; -}[keyof T], keyof T>; -/** - * Gets the keys of an object type that are optional. - */ -export type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>; -/** - * Extracts the keys from a type that are not `readonly`. - */ -export type ReadonlyKeys<T> = Extract<{ - [K in keyof T]-?: ReadonlyEquivalent<{ - [_K in K]: T[K]; - }, { - -readonly [_K in K]: T[K]; - }> extends true ? never : K; -}[keyof T], keyof T>; -/** - * Determines if two types, are equivalent in a `readonly` manner. - * - * @internal - */ -type ReadonlyEquivalent<X, Y> = Extends<(<T>() => T extends X ? true : false), (<T>() => T extends Y ? true : false)>; -/** - * Checks if one type extends another. Note: this is not quite the same as `Left extends Right` because: - * 1. If either type is `never`, the result is `true` iff the other type is also `never`. - * 2. Types are wrapped in a 1-tuple so that union types are not distributed - instead we consider `string | number` to _not_ extend `number`. If we used `Left extends Right` directly you would get `Extends<string | number, number>` => `false | true` => `boolean`. - */ -export type Extends<Left, Right> = IsNever<Left> extends true ? IsNever<Right> : [Left] extends [Right] ? true : false; -/** - * Checks if the {@linkcode Left} type extends the {@linkcode Right} type, - * excluding `any` or `never`. - */ -export type ExtendsExcludingAnyOrNever<Left, Right> = IsAny<Left> extends true ? IsAny<Right> : Extends<Left, Right>; -/** - * Checks if two types are strictly equal using - * the TypeScript internal identical-to operator. - * - * @see {@link https://github.com/microsoft/TypeScript/issues/55188#issuecomment-1656328122 | much history} - */ -export type StrictEqualUsingTSInternalIdenticalToOperator<L, R> = (<T>() => T extends (L & T) | T ? true : false) extends <T>() => T extends (R & T) | T ? true : false ? IsNever<L> extends IsNever<R> ? true : false : false; -/** - * Checks that {@linkcode Left} and {@linkcode Right} extend each other. - * Not quite the same as an equality check since `any` can make it resolve - * to `true`. So should only be used when {@linkcode Left} and - * {@linkcode Right} are known to avoid `any`. - */ -export type MutuallyExtends<Left, Right> = And<[Extends<Left, Right>, Extends<Right, Left>]>; -/** - * @internal - */ -declare const mismatch: unique symbol; -/** - * @internal - */ -type Mismatch = { - [mismatch]: 'mismatch'; -}; -/** - * A type which should match anything passed as a value but *doesn't* - * match {@linkcode Mismatch}. It helps TypeScript select the right overload - * for {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} and - * {@linkcode PositiveExpectTypeOf.toMatchTypeOf | .toMatchTypeOf()}. - * - * @internal - */ -declare const avalue: unique symbol; -/** - * Represents a value that can be of various types. - */ -export type AValue = { - [avalue]?: undefined; -} | string | number | boolean | symbol | bigint | null | undefined | void; -/** - * Represents the type of mismatched arguments between - * the actual result and the expected result. - * - * If {@linkcode ActualResult} and {@linkcode ExpectedResult} are equivalent, - * the type resolves to an empty tuple `[]`, indicating no mismatch. - * If they are not equivalent, it resolves to a tuple containing the element - * {@linkcode Mismatch}, signifying a discrepancy between - * the expected and actual results. - */ -export type MismatchArgs<ActualResult extends boolean, ExpectedResult extends boolean> = Eq<ActualResult, ExpectedResult> extends true ? [] : [Mismatch]; -/** - * Represents the options for the {@linkcode ExpectTypeOf} function. - */ -export interface ExpectTypeOfOptions { - positive: boolean; - branded: boolean; -} -/** - * Convert a union to an intersection. - * `A | B | C` -\> `A & B & C` - */ -export type UnionToIntersection<Union> = (Union extends any ? (distributedUnion: Union) => void : never) extends (mergedIntersection: infer Intersection) => void ? Intersection : never; -/** - * Get the last element of a union. - * First, converts to a union of `() => T` functions, - * then uses {@linkcode UnionToIntersection} to get the last one. - */ -export type LastOf<Union> = UnionToIntersection<Union extends any ? () => Union : never> extends () => infer R ? R : never; -/** - * Intermediate type for {@linkcode UnionToTuple} which pushes the - * "last" union member to the end of a tuple, and recursively prepends - * the remainder of the union. - */ -export type TuplifyUnion<Union, LastElement = LastOf<Union>> = IsNever<Union> extends true ? [] : [...TuplifyUnion<Exclude<Union, LastElement>>, LastElement]; -/** - * Convert a union like `1 | 2 | 3` to a tuple like `[1, 2, 3]`. - */ -export type UnionToTuple<Union> = TuplifyUnion<Union>; -export type IsTuple<T> = Or<[Extends<T, []>, Extends<T, [any, ...any[]]>]>; -export type IsUnion<T> = Not<Extends<UnionToTuple<T>['length'], 1>>; -/** - * A recursive version of `Pick` that selects properties from the left type that are present in the right type. - * The "leaf" types from `Left` are used - only the keys of `Right` are considered. - * - * @example - * ```ts - * const user = {email: 'a@b.com', name: 'John Doe', address: {street: '123 2nd St', city: 'New York', zip: '10001', state: 'NY', country: 'USA'}} - * - * type Result = DeepPickMatchingProps<typeof user, {name: unknown; address: {city: unknown}}> // {name: string, address: {city: string}} - * ``` - */ -export type DeepPickMatchingProps<Left, Right> = Left extends Record<string, unknown> ? Pick<{ - [K in keyof Left]: K extends keyof Right ? DeepPickMatchingProps<Left[K], Right[K]> : never; -}, Extract<keyof Left, keyof Right>> : Left; -export {}; diff --git a/vanilla/node_modules/expect-type/dist/utils.js b/vanilla/node_modules/expect-type/dist/utils.js deleted file mode 100644 index 43407cf..0000000 --- a/vanilla/node_modules/expect-type/dist/utils.js +++ /dev/null @@ -1,19 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -/** - * @internal - */ -const secret = Symbol('secret'); -/** - * @internal - */ -const mismatch = Symbol('mismatch'); -/** - * A type which should match anything passed as a value but *doesn't* - * match {@linkcode Mismatch}. It helps TypeScript select the right overload - * for {@linkcode PositiveExpectTypeOf.toEqualTypeOf | .toEqualTypeOf()} and - * {@linkcode PositiveExpectTypeOf.toMatchTypeOf | .toMatchTypeOf()}. - * - * @internal - */ -const avalue = Symbol('avalue'); diff --git a/vanilla/node_modules/expect-type/package.json b/vanilla/node_modules/expect-type/package.json deleted file mode 100644 index 8cc48b4..0000000 --- a/vanilla/node_modules/expect-type/package.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "name": "expect-type", - "version": "1.3.0", - "engines": { - "node": ">=12.0.0" - }, - "keywords": [ - "typescript", - "type-check", - "assert", - "types", - "typings", - "test", - "testing" - ], - "homepage": "https://github.com/mmkal/expect-type#readme", - "repository": { - "type": "git", - "url": "https://github.com/mmkal/expect-type.git" - }, - "license": "Apache-2.0", - "main": "dist/index.js", - "types": "dist/index.d.ts", - "files": [ - "dist", - "*.md" - ], - "devDependencies": { - "@arethetypeswrong/cli": "0.17.3", - "@types/node": "^22.0.0", - "@typescript/native-preview": "7.0.0-dev.20250527.1", - "@vitest/ui": "^3.0.0", - "eslint": "^8.57.0", - "eslint-plugin-mmkal": "0.9.0", - "np": "^10.2.0", - "pkg-pr-new": "0.0.39", - "strip-ansi": "7.1.0", - "ts-morph": "23.0.0", - "typescript": "5.9.2", - "vitest": "^3.0.0" - }, - "scripts": { - "eslint": "eslint --max-warnings 0", - "lint": "tsc && pnpm eslint .", - "type-check": "tsc", - "build": "tsc -p tsconfig.lib.json", - "arethetypeswrong": "attw --pack", - "test": "vitest run" - } -}
\ No newline at end of file |
