From e9693fccfaffc79ccbb3d957b29019fd280f53d8 Mon Sep 17 00:00:00 2001 From: m-shaka Date: Sun, 9 Mar 2025 10:16:44 +0900 Subject: [PATCH 1/4] migrate Result.{andThen,andThrough} --- tests/typecheck-tests.ts | 133 ++++++++++++++++++++++++--------------- 1 file changed, 83 insertions(+), 50 deletions(-) diff --git a/tests/typecheck-tests.ts b/tests/typecheck-tests.ts index 55a3cd3d..3038bada 100644 --- a/tests/typecheck-tests.ts +++ b/tests/typecheck-tests.ts @@ -4,6 +4,7 @@ * This file is ran during CI to ensure that there aren't breaking changes with types */ +import { describe, expectTypeOf, it } from 'vitest'; import { err, errAsync, @@ -33,16 +34,18 @@ type CreateTuple = : never; -(function describe(_ = 'Result') { - (function describe(_ = 'andThen') { - (function it(_ = 'Combines two equal error types (native scalar types)') { - type Expectation = Result +describe('Result', () => { + describe('andThen', () => { + it('Combines two equal error types (native scalar types)', () => { + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThen((val) => err('yoooooo dude' + val)) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Combines two equal error types (custom types)') { + it('Combines two equal error types (custom types)', () => { interface MyError { stack: string code: number @@ -50,26 +53,30 @@ type CreateTuple = type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThen((val) => err({ stack: '/blah', code: 500 })) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Creates a union of error types for disjoint types') { + it('Creates a union of error types for disjoint types', () => { interface MyError { stack: string code: number } - + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThen((val) => err(['oh nooooo'])) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers error type when returning disjoint types (native scalar types)') { - type Expectation = Result + it('Infers error type when returning disjoint types (native scalar types)', () => { + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThen((val) => { switch (val) { case 1: @@ -80,16 +87,18 @@ type CreateTuple = return err(false) } }) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers error type when returning disjoint types (custom types)') { + it('Infers error type when returning disjoint types (custom types)', () => { interface MyError { stack: string code: number } - type Expectation = Result + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThen((val) => { switch (val) { case 1: @@ -100,12 +109,14 @@ type CreateTuple = return err({ stack: '/blah', code: 500 }) } }) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers new ok type when returning both Ok and Err (same as initial)') { - type Expectation = Result + it('Infers new ok type when returning both Ok and Err (same as initial)', () => { + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThen((val) => { switch (val) { case 1: @@ -114,13 +125,15 @@ type CreateTuple = return ok(val + 456) } }) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers new ok type when returning both Ok and Err (different from initial)') { + it('Infers new ok type when returning both Ok and Err (different from initial)', () => { const initial = ok(123) - type Expectation = Result + type Expectation = Result - const result: Expectation = initial + const result = initial .andThen((val) => { switch (val) { case 1: @@ -129,16 +142,18 @@ type CreateTuple = return ok(val + ' string') } }) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers new err type when returning both Ok and Err') { + it('Infers new err type when returning both Ok and Err', () => { interface MyError { stack: string code: number } - type Expectation = Result + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThen((val) => { switch (val) { case 1: @@ -149,26 +164,32 @@ type CreateTuple = return err({ stack: '/blah', code: 500 }) } }) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'allows specifying the E and T types explicitly') { + it('allows specifying the E and T types explicitly', () => { type Expectation = Result<'yo', number> - const result: Expectation = ok(123).andThen<'yo', number>(val => { + const result = ok(123).andThen<'yo', number>(val => { return ok('yo') }) + + expectTypeOf(result).toEqualTypeOf() }); }); - (function describe(_ = 'andThrough') { - (function it(_ = 'Combines two equal error types (native scalar types)') { + describe('andThrough', () => { + it('Combines two equal error types (native scalar types)', () => { type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThrough((val) => err('yoooooo dude' + val)) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Combines two equal error types (custom types)') { + it('Combines two equal error types (custom types)', () => { interface MyError { stack: string code: number @@ -176,11 +197,13 @@ type CreateTuple = type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThrough((val) => err({ stack: '/blah', code: 500 })) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Creates a union of error types for disjoint types') { + it('Creates a union of error types for disjoint types', () => { interface MyError { stack: string code: number @@ -188,14 +211,16 @@ type CreateTuple = type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThrough((val) => err(['oh nooooo'])) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers error type when returning disjoint types (native scalar types)') { + it('Infers error type when returning disjoint types (native scalar types)', () => { type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThrough((val) => { switch (val) { case 1: @@ -206,16 +231,18 @@ type CreateTuple = return err(false) } }) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers error type when returning disjoint types (custom types)') { + it('Infers error type when returning disjoint types (custom types)', () => { interface MyError { stack: string code: number } type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThrough((val) => { switch (val) { case 1: @@ -223,15 +250,17 @@ type CreateTuple = case 2: return err(123) default: - return err({ stack: '/blah', code: 500 }) + return err({ stack: '/blah', code: 500 }) } }) + + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Returns the original ok type when returning both Ok and Err (same as initial)') { - type Expectation = Result + it('Returns the original ok type when returning both Ok and Err (same as initial)', () => { + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThrough((val) => { switch (val) { case 1: @@ -240,13 +269,14 @@ type CreateTuple = return ok(val + 456) } }) + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Returns the original ok type when returning both Ok and Err (different from initial)') { + it('Returns the original ok type when returning both Ok and Err (different from initial)', () => { const initial = ok(123) - type Expectation = Result + type Expectation = Result - const result: Expectation = initial + const result = initial .andThrough((val) => { switch (val) { case 1: @@ -255,16 +285,17 @@ type CreateTuple = return ok("Hi" + val) } }) + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'Infers new err type when returning both Ok and Err') { + it('Infers new err type when returning both Ok and Err', () => { interface MyError { stack: string code: number } - type Expectation = Result + type Expectation = Result - const result: Expectation = ok(123) + const result = ok(123) .andThrough((val) => { switch (val) { case 1: @@ -275,14 +306,16 @@ type CreateTuple = return err({ stack: '/blah', code: 500 }) } }) + expectTypeOf(result).toEqualTypeOf() }); - (function it(_ = 'allows specifying the E type explicitly') { + it('allows specifying the E type explicitly', () => { type Expectation = Result - const result: Expectation = ok(123).andThrough(val => { + const result = ok(123).andThrough(val => { return ok('yo') }) + expectTypeOf(result).toEqualTypeOf() }); }); From c568f17151d222213f31820045cc3d44cf007d57 Mon Sep 17 00:00:00 2001 From: m-shaka Date: Sun, 9 Mar 2025 10:54:54 +0900 Subject: [PATCH 2/4] enable vitest type checking --- tsconfig.test.json | 8 ++++++++ vitest.config.ts | 11 +++++++++++ 2 files changed, 19 insertions(+) create mode 100644 tsconfig.test.json create mode 100644 vitest.config.ts diff --git a/tsconfig.test.json b/tsconfig.test.json new file mode 100644 index 00000000..eba62037 --- /dev/null +++ b/tsconfig.test.json @@ -0,0 +1,8 @@ +{ + "compilerOptions": { + "noUnusedParameters": false, + "noUnusedLocals": false + }, + "extends": "./tsconfig.json", + "include": ["tests/**/*.ts"], +} diff --git a/vitest.config.ts b/vitest.config.ts new file mode 100644 index 00000000..9f6120d3 --- /dev/null +++ b/vitest.config.ts @@ -0,0 +1,11 @@ +import { defineConfig } from 'vitest/config' + +export default defineConfig({ + test: { + typecheck: { + enabled: true, + include: ['tests/typecheck-tests.ts'], + tsconfig: 'tsconfig.test.json', + }, + }, +}) From cb5e2f90616580e60280c750f9fd0cad30048b50 Mon Sep 17 00:00:00 2001 From: m-shaka Date: Sun, 9 Mar 2025 11:18:43 +0900 Subject: [PATCH 3/4] replace describe and it --- package.json | 3 +- tests/tsconfig.tests.json | 2 +- tests/typecheck-tests.ts | 407 +++++++++++++++++++------------------- tsconfig.test.json | 8 - vitest.config.ts | 2 +- 5 files changed, 205 insertions(+), 217 deletions(-) delete mode 100644 tsconfig.test.json diff --git a/package.json b/package.json index ebbdd330..143c93fd 100644 --- a/package.json +++ b/package.json @@ -10,8 +10,7 @@ ], "scripts": { "local-ci": "npm run typecheck && npm run lint && npm run test && npm run format && npm run build", - "test": "vitest run && npm run test-types", - "test-types": "tsc --noEmit -p ./tests/tsconfig.tests.json", + "test": "vitest run", "lint": "eslint ./src --ext .ts", "format": "prettier --write 'src/**/*.ts?(x)' && npm run lint -- --fix", "typecheck": "tsc --noEmit", diff --git a/tests/tsconfig.tests.json b/tests/tsconfig.tests.json index 4c72b473..cb934497 100644 --- a/tests/tsconfig.tests.json +++ b/tests/tsconfig.tests.json @@ -21,7 +21,7 @@ "skipLibCheck": true }, "include": [ - "./index.test.ts", + "./*.test.ts", "./typecheck-tests.ts" ] } diff --git a/tests/typecheck-tests.ts b/tests/typecheck-tests.ts index 3038bada..6818d9ff 100644 --- a/tests/typecheck-tests.ts +++ b/tests/typecheck-tests.ts @@ -319,8 +319,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'orElse') { - (function it(_ = 'the type of the argument is the error type of the result') { + describe('orElse', () => { + it('the type of the argument is the error type of the result', () => { type Expectation = string const result = ok(123) @@ -335,7 +335,7 @@ describe('Result', () => { }); - (function it(_ = 'infers the err return type with multiple returns (same type) ') { + it('infers the err return type with multiple returns (same type) ', () => { type Expectation = Result const result: Expectation = ok(123) @@ -349,7 +349,7 @@ describe('Result', () => { }) }); - (function it(_ = 'infers the err return type with multiple returns (different type) ') { + it('infers the err return type with multiple returns (different type) ', () => { type Expectation = Result const result: Expectation = ok(123) @@ -363,7 +363,7 @@ describe('Result', () => { }) }); - (function it(_ = 'infers ok and err return types with multiple returns ') { + it('infers ok and err return types with multiple returns ', () => { type Expectation = Result const result: Expectation = ok(123) @@ -379,7 +379,7 @@ describe('Result', () => { }) }); - (function it(_ = 'allows specifying the E and T types explicitly') { + it('allows specifying the E and T types explicitly', () => { type Expectation = Result<'yo', string> const result: Expectation = ok<'yo', number>('yo').orElse<'yo', string>(val => { @@ -387,14 +387,14 @@ describe('Result', () => { }) }); - (function it(_ = 'Creates a union of ok types for disjoint types') { + it('Creates a union of ok types for disjoint types', () => { type Expectation = Result const result: Expectation = err([true]) .orElse((val) => ok('recovered!')) }); - (function it(_ = 'Infers ok type when returning disjoint types') { + it('Infers ok type when returning disjoint types', () => { type Expectation = Result const result: Expectation = err(123) @@ -410,7 +410,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new type when returning both Ok and Err') { + it('Infers new type when returning both Ok and Err', () => { const initial = err(123) type Expectation = Result @@ -426,8 +426,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'match') { - (function it(_ = 'the type of the arguments match the types of the result') { + describe('match', () => { + it('the type of the arguments match the types of the result', () => { type OKExpectation = number type ErrExpectation = string @@ -443,7 +443,7 @@ describe('Result', () => { ); }); - (function it(_ = 'infers the resulting value from match callbacks (same type)') { + it('infers the resulting value from match callbacks (same type)', () => { type Expectation = boolean const okResult: Expectation = ok(123) @@ -458,7 +458,7 @@ describe('Result', () => { ); }); - (function it(_ = 'infers the resulting value from match callbacks (different type)') { + it('infers the resulting value from match callbacks (different type)', () => { type Expectation = boolean | bigint const okResult: Expectation = ok('123') @@ -474,15 +474,15 @@ describe('Result', () => { }); }); - (function describe(_ = 'asyncAndThen') { - (function it(_ = 'Combines two equal error types (native scalar types)') { + describe('asyncAndThen', () => { + it('Combines two equal error types (native scalar types)', () => { type Expectation = ResultAsync const result: Expectation = ok(123) .asyncAndThen((val) => errAsync('yoooooo dude' + val)) }); - (function it(_ = 'Combines two equal error types (custom types)') { + it('Combines two equal error types (custom types)', () => { interface MyError { stack: string code: number @@ -494,7 +494,7 @@ describe('Result', () => { .asyncAndThen((val) => errAsync({ stack: '/blah', code: 500 })) }); - (function it(_ = 'Creates a union of error types for disjoint types') { + it('Creates a union of error types for disjoint types', () => { interface MyError { stack: string code: number @@ -507,15 +507,15 @@ describe('Result', () => { }); }); - (function describe(_ = 'asyncAndThrough') { - (function it(_ = 'Combines two equal error types (native scalar types)') { + describe('asyncAndThrough', () => { + it('Combines two equal error types (native scalar types)', () => { type Expectation = ResultAsync const result: Expectation = ok(123) .asyncAndThrough((val) => errAsync('yoooooo dude' + val)) }); - (function it(_ = 'Combines two equal error types (custom types)') { + it('Combines two equal error types (custom types)', () => { interface MyError { stack: string code: number @@ -527,7 +527,7 @@ describe('Result', () => { .asyncAndThrough((val) => errAsync({ stack: '/blah', code: 500 })) }); - (function it(_ = 'Creates a union of error types for disjoint types') { + it('Creates a union of error types for disjoint types', () => { interface MyError { stack: string code: number @@ -539,7 +539,7 @@ describe('Result', () => { .asyncAndThrough((val) => errAsync(['oh nooooo'])) }); - (function it(_ = 'Infers error type when returning disjoint types (native scalar types)') { + it('Infers error type when returning disjoint types (native scalar types)', () => { type Expectation = ResultAsync const result: Expectation = ok(123) @@ -555,7 +555,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers error type when returning disjoint types (custom types)') { + it('Infers error type when returning disjoint types (custom types)', () => { interface MyError { stack: string code: number @@ -575,7 +575,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Returns the original ok type when returning both Ok and Err (same as initial)') { + it('Returns the original ok type when returning both Ok and Err (same as initial)', () => { type Expectation = Result const result: Expectation = ok(123) @@ -589,7 +589,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Returns the original ok type when returning both Ok and Err (different from initial)') { + it('Returns the original ok type when returning both Ok and Err (different from initial)', () => { const initial = ok(123) type Expectation = Result @@ -604,7 +604,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new err type when returning both Ok and Err') { + it('Infers new err type when returning both Ok and Err', () => { interface MyError { stack: string code: number @@ -624,7 +624,7 @@ describe('Result', () => { }) }); - (function it(_ = 'allows specifying the E type explicitly') { + it('allows specifying the E type explicitly', () => { type Expectation = Result const result: Expectation = ok(123).andThrough(val => { @@ -633,7 +633,7 @@ describe('Result', () => { }); - (function it(_ = 'Infers new err type when returning both Ok and Err') { + it('Infers new err type when returning both Ok and Err', () => { interface MyError { stack: string code: number @@ -656,8 +656,8 @@ describe('Result', () => { }); - (function describe(_ = 'combine') { - (function it(_ = 'combines different results into one') { + describe('combine', () => { + it('combines different results into one', () => { type Expectation = Result<[ number, string, boolean, boolean ], Error | string | string[]>; const result = Result.combine([ @@ -671,7 +671,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only ok results into one') { + it('combines only ok results into one', () => { type Expectation = Result<[ number, string ], never>; const result = Result.combine([ @@ -683,7 +683,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only err results into one') { + it('combines only err results into one', () => { type Expectation = Result<[ never, never ], number | 'abc'>; const result = Result.combine([ @@ -695,7 +695,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines empty list results into one') { + it('combines empty list results into one', () => { type Expectation = Result; const results: [] = []; @@ -705,7 +705,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines arrays of results to a result of an array') { + it('combines arrays of results to a result of an array', () => { type Expectation = Result; const results: Result[] = []; @@ -715,8 +715,8 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function describe(_ = 'inference on large tuples') { - (function it(_ = 'Should correctly infer the type on tuples with 6 elements') { + describe('inference on large tuples', () => { + it('Should correctly infer the type on tuples with 6 elements', () => { type Input = CreateTuple<6, Result> type Expectation = Result, never> @@ -728,7 +728,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 7 elements') { + it('Should correctly infer the type on tuples with 7 elements', () => { type Input = CreateTuple<7, Result> type Expectation = Result, never> @@ -740,7 +740,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 8 elements') { + it('Should correctly infer the type on tuples with 8 elements', () => { type Input = CreateTuple<8, Result> type Expectation = Result, never> @@ -752,7 +752,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 9 elements') { + it('Should correctly infer the type on tuples with 9 elements', () => { type Input = CreateTuple<9, Result> type Expectation = Result, never> @@ -764,7 +764,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 10 elements') { + it('Should correctly infer the type on tuples with 10 elements', () => { type Input = CreateTuple<10, Result> type Expectation = Result, never> @@ -776,7 +776,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 11 elements') { + it('Should correctly infer the type on tuples with 11 elements', () => { type Input = CreateTuple<11, Result> type Expectation = Result, never> @@ -788,7 +788,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 12 elements') { + it('Should correctly infer the type on tuples with 12 elements', () => { type Input = CreateTuple<12, Result> type Expectation = Result, never> @@ -800,7 +800,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 13 elements') { + it('Should correctly infer the type on tuples with 13 elements', () => { type Input = CreateTuple<13, Result> type Expectation = Result, never> @@ -812,7 +812,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 14 elements') { + it('Should correctly infer the type on tuples with 14 elements', () => { type Input = CreateTuple<14, Result> type Expectation = Result, never> @@ -824,7 +824,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 15 elements') { + it('Should correctly infer the type on tuples with 15 elements', () => { type Input = CreateTuple<15, Result> type Expectation = Result, never> @@ -836,7 +836,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 16 elements') { + it('Should correctly infer the type on tuples with 16 elements', () => { type Input = CreateTuple<16, Result> type Expectation = Result, never> @@ -848,7 +848,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 17 elements') { + it('Should correctly infer the type on tuples with 17 elements', () => { type Input = CreateTuple<17, Result> type Expectation = Result, never> @@ -860,7 +860,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 18 elements') { + it('Should correctly infer the type on tuples with 18 elements', () => { type Input = CreateTuple<18, Result> type Expectation = Result, never> @@ -872,7 +872,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 19 elements') { + it('Should correctly infer the type on tuples with 19 elements', () => { type Input = CreateTuple<19, Result> type Expectation = Result, never> @@ -884,7 +884,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 20 elements') { + it('Should correctly infer the type on tuples with 20 elements', () => { type Input = CreateTuple<20, Result> type Expectation = Result, never> @@ -896,7 +896,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 21 elements') { + it('Should correctly infer the type on tuples with 21 elements', () => { type Input = CreateTuple<21, Result> type Expectation = Result, never> @@ -908,7 +908,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 22 elements') { + it('Should correctly infer the type on tuples with 22 elements', () => { type Input = CreateTuple<22, Result> type Expectation = Result, never> @@ -920,7 +920,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 23 elements') { + it('Should correctly infer the type on tuples with 23 elements', () => { type Input = CreateTuple<23, Result> type Expectation = Result, never> @@ -932,7 +932,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 24 elements') { + it('Should correctly infer the type on tuples with 24 elements', () => { type Input = CreateTuple<24, Result> type Expectation = Result, never> @@ -944,7 +944,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 25 elements') { + it('Should correctly infer the type on tuples with 25 elements', () => { type Input = CreateTuple<25, Result> type Expectation = Result, never> @@ -956,7 +956,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 26 elements') { + it('Should correctly infer the type on tuples with 26 elements', () => { type Input = CreateTuple<26, Result> type Expectation = Result, never> @@ -968,7 +968,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 27 elements') { + it('Should correctly infer the type on tuples with 27 elements', () => { type Input = CreateTuple<27, Result> type Expectation = Result, never> @@ -980,7 +980,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 28 elements') { + it('Should correctly infer the type on tuples with 28 elements', () => { type Input = CreateTuple<28, Result> type Expectation = Result, never> @@ -992,7 +992,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 29 elements') { + it('Should correctly infer the type on tuples with 29 elements', () => { type Input = CreateTuple<29, Result> type Expectation = Result, never> @@ -1004,7 +1004,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 30 elements') { + it('Should correctly infer the type on tuples with 30 elements', () => { type Input = CreateTuple<30, Result> type Expectation = Result, never> @@ -1016,7 +1016,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 31 elements') { + it('Should correctly infer the type on tuples with 31 elements', () => { type Input = CreateTuple<31, Result> type Expectation = Result, never> @@ -1028,7 +1028,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 32 elements') { + it('Should correctly infer the type on tuples with 32 elements', () => { type Input = CreateTuple<32, Result> type Expectation = Result, never> @@ -1040,7 +1040,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 33 elements') { + it('Should correctly infer the type on tuples with 33 elements', () => { type Input = CreateTuple<33, Result> type Expectation = Result, never> @@ -1052,7 +1052,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 34 elements') { + it('Should correctly infer the type on tuples with 34 elements', () => { type Input = CreateTuple<34, Result> type Expectation = Result, never> @@ -1064,7 +1064,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 35 elements') { + it('Should correctly infer the type on tuples with 35 elements', () => { type Input = CreateTuple<35, Result> type Expectation = Result, never> @@ -1076,7 +1076,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 36 elements') { + it('Should correctly infer the type on tuples with 36 elements', () => { type Input = CreateTuple<36, Result> type Expectation = Result, never> @@ -1088,7 +1088,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 37 elements') { + it('Should correctly infer the type on tuples with 37 elements', () => { type Input = CreateTuple<37, Result> type Expectation = Result, never> @@ -1100,7 +1100,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 38 elements') { + it('Should correctly infer the type on tuples with 38 elements', () => { type Input = CreateTuple<38, Result> type Expectation = Result, never> @@ -1112,7 +1112,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 39 elements') { + it('Should correctly infer the type on tuples with 39 elements', () => { type Input = CreateTuple<39, Result> type Expectation = Result, never> @@ -1124,7 +1124,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 40 elements') { + it('Should correctly infer the type on tuples with 40 elements', () => { type Input = CreateTuple<40, Result> type Expectation = Result, never> @@ -1136,7 +1136,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 41 elements') { + it('Should correctly infer the type on tuples with 41 elements', () => { type Input = CreateTuple<41, Result> type Expectation = Result, never> @@ -1148,7 +1148,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 42 elements') { + it('Should correctly infer the type on tuples with 42 elements', () => { type Input = CreateTuple<42, Result> type Expectation = Result, never> @@ -1160,7 +1160,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 43 elements') { + it('Should correctly infer the type on tuples with 43 elements', () => { type Input = CreateTuple<43, Result> type Expectation = Result, never> @@ -1172,7 +1172,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 44 elements') { + it('Should correctly infer the type on tuples with 44 elements', () => { type Input = CreateTuple<44, Result> type Expectation = Result, never> @@ -1184,7 +1184,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 45 elements') { + it('Should correctly infer the type on tuples with 45 elements', () => { type Input = CreateTuple<45, Result> type Expectation = Result, never> @@ -1196,7 +1196,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 46 elements') { + it('Should correctly infer the type on tuples with 46 elements', () => { type Input = CreateTuple<46, Result> type Expectation = Result, never> @@ -1208,7 +1208,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 47 elements') { + it('Should correctly infer the type on tuples with 47 elements', () => { type Input = CreateTuple<47, Result> type Expectation = Result, never> @@ -1220,7 +1220,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 48 elements') { + it('Should correctly infer the type on tuples with 48 elements', () => { type Input = CreateTuple<48, Result> type Expectation = Result, never> @@ -1232,7 +1232,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 49 elements') { + it('Should correctly infer the type on tuples with 49 elements', () => { type Input = CreateTuple<49, Result> type Expectation = Result, never> @@ -1246,8 +1246,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'combineWithAllErrors') { - (function it(_ = 'combines different results into one') { + describe('combineWithAllErrors', () => { + it('combines different results into one', () => { type Expectation = Result<[ number, string, never, never ], (string[] | Error)[]>; const result = Result.combineWithAllErrors([ @@ -1261,7 +1261,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only ok results into one') { + it('combines only ok results into one', () => { type Expectation = Result<[ number, string ], never[]>; const result = Result.combineWithAllErrors([ @@ -1273,7 +1273,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only err results into one') { + it('combines only err results into one', () => { type Expectation = Result<[ never, never ], (number | 'string')[]>; const result = Result.combineWithAllErrors([ @@ -1285,7 +1285,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines arrays of results to a result of an array') { + it('combines arrays of results to a result of an array', () => { type Expectation = Result; const results: Result[] = []; @@ -1295,7 +1295,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines arrays of different results to a result of an array') { + it('combines arrays of different results to a result of an array', () => { type Expectation = Result<(string | boolean)[], (number | string)[]>; const results: (Result | Result)[] = []; @@ -1305,8 +1305,8 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function describe(_ = 'inference on large tuples') { - (function it(_ = 'Should correctly infer the type on tuples with 6 elements') { + describe('inference on large tuples', () => { + it('Should correctly infer the type on tuples with 6 elements', () => { type Input = CreateTuple<6, Result> type Expectation = Result, number[]> @@ -1318,7 +1318,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 15 elements') { + it('Should correctly infer the type on tuples with 15 elements', () => { type Input = CreateTuple<15, Result> type Expectation = Result, number[]> @@ -1330,7 +1330,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 30 elements') { + it('Should correctly infer the type on tuples with 30 elements', () => { type Input = CreateTuple<30, Result> type Expectation = Result, number[]> @@ -1342,7 +1342,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 49 elements') { + it('Should correctly infer the type on tuples with 49 elements', () => { type Input = CreateTuple<49 , Result> type Expectation = Result, number[]> @@ -1356,8 +1356,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'err') { - (function it(_ = 'infers the error type narrowly when it is a string') { + describe('err', () => { + it('infers the error type narrowly when it is a string', () => { type Expectation = Result const result = err('error') @@ -1365,7 +1365,7 @@ describe('Result', () => { const assignableToCheck: Expectation = result; }); - (function it(_ = 'infers the error type widely when it is not a string') { + it('infers the error type widely when it is not a string', () => { type Expectation = Result const result = err({ abc: 123 }) @@ -1376,16 +1376,16 @@ describe('Result', () => { }); -(function describe(_ = 'ResultAsync') { - (function describe(_ = 'andThen') { - (function it(_ = 'Combines two equal error types (native scalar types)') { +describe('ResultAsync', () => { + describe('andThen', () => { + it('Combines two equal error types (native scalar types)', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) .andThen((val) => err('yoooooo dude' + val)) }); - (function it(_ = 'Combines two equal error types (custom types)') { + it('Combines two equal error types (custom types)', () => { interface MyError { stack: string code: number @@ -1397,7 +1397,7 @@ describe('Result', () => { .andThen((val) => err({ stack: '/blah', code: 500 })) }); - (function it(_ = 'Creates a union of error types for disjoint types') { + it('Creates a union of error types for disjoint types', () => { interface MyError { stack: string code: number @@ -1409,8 +1409,8 @@ describe('Result', () => { .andThen((val) => err(['oh nooooo'])) }); - (function describe(_ = 'when returning Result types') { - (function it(_ = 'Infers error type when returning disjoint types (native scalar types)') { + describe('when returning Result types', () => { + it('Infers error type when returning disjoint types (native scalar types)', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1426,7 +1426,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers error type when returning disjoint types (custom types)') { + it('Infers error type when returning disjoint types (custom types)', () => { interface MyError { stack: string code: number @@ -1446,7 +1446,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new ok type when returning both Ok and Err (same as initial)') { + it('Infers new ok type when returning both Ok and Err (same as initial)', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1460,7 +1460,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new ok type when returning both Ok and Err (different from initial)') { + it('Infers new ok type when returning both Ok and Err (different from initial)', () => { const initial = okAsync(123) type Expectation = ResultAsync @@ -1475,7 +1475,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new err type when returning both Ok and Err') { + it('Infers new err type when returning both Ok and Err', () => { interface MyError { stack: string code: number @@ -1496,8 +1496,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'when returning ResultAsync types') { - (function it(_ = 'Infers error type when returning disjoint types (native scalar types)') { + describe('when returning ResultAsync types', () => { + it('Infers error type when returning disjoint types (native scalar types)', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1513,7 +1513,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers error type when returning disjoint types (custom types)') { + it('Infers error type when returning disjoint types (custom types)', () => { interface MyError { stack: string code: number @@ -1533,7 +1533,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new ok type when returning both Ok and Err (same as initial)') { + it('Infers new ok type when returning both Ok and Err (same as initial)', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1547,7 +1547,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new ok type when returning both Ok and Err (different from initial)') { + it('Infers new ok type when returning both Ok and Err (different from initial)', () => { const initial = okAsync(123) type Expectation = ResultAsync @@ -1562,7 +1562,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new err type when returning both Ok and Err') { + it('Infers new err type when returning both Ok and Err', () => { interface MyError { stack: string code: number @@ -1583,8 +1583,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'when returning a mix of Result and ResultAsync types') { - (function it(_ = 'allows for explicitly specifying the Ok and Err types when inference fails') { + describe('when returning a mix of Result and ResultAsync types', () => { + it('allows for explicitly specifying the Ok and Err types when inference fails', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1601,8 +1601,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'fromSafePromise') { - (function it(_ = 'infers err type from usage') { + describe('fromSafePromise', () => { + it('infers err type from usage', () => { type Expectation = ResultAsync const result: Expectation = fromSafePromise(new Promise((resolve) => resolve(123))) @@ -1611,8 +1611,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'orElse') { - (function it(_ = 'the type of the argument is the error type of the result') { + describe('orElse', () => { + it('the type of the argument is the error type of the result', () => { type Expectation = string const result = okAsync(123) @@ -1627,7 +1627,7 @@ describe('Result', () => { }); - (function it(_ = 'infers the err return type with multiple returns (same type) ') { + it('infers the err return type with multiple returns (same type) ', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1641,7 +1641,7 @@ describe('Result', () => { }) }); - (function it(_ = 'infers the err return type with multiple returns (different type) ') { + it('infers the err return type with multiple returns (different type) ', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1655,7 +1655,7 @@ describe('Result', () => { }) }); - (function it(_ = 'infers ok and err return types with multiple returns ') { + it('infers ok and err return types with multiple returns ', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1671,7 +1671,7 @@ describe('Result', () => { }) }); - (function it(_ = 'allows specifying ok and err return types when mixing Result and ResultAsync in returns ') { + it('allows specifying ok and err return types when mixing Result and ResultAsync in returns ', () => { type Expectation = ResultAsync const result: Expectation = okAsync(123) @@ -1687,14 +1687,14 @@ describe('Result', () => { }) }); - (function it(_ = 'Creates a union of ok types for disjoint types') { + it('Creates a union of ok types for disjoint types', () => { type Expectation = ResultAsync const result: Expectation = errAsync([true]) .orElse((val) => ok('recovered!')) }); - (function it(_ = 'Infers ok type when returning disjoint types') { + it('Infers ok type when returning disjoint types', () => { type Expectation = ResultAsync const result: Expectation = errAsync(123) @@ -1710,7 +1710,7 @@ describe('Result', () => { }) }); - (function it(_ = 'Infers new type when returning both Ok and Err') { + it('Infers new type when returning both Ok and Err', () => { const initial = errAsync(123) type Expectation = ResultAsync @@ -1726,8 +1726,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'combine') { - (function it(_ = 'combines different result asyncs into one') { + describe('combine', () => { + it('combines different result asyncs into one', () => { type Expectation = ResultAsync<[ number, string, boolean, boolean ], Error | string | string[]>; const result = ResultAsync.combine([ @@ -1741,7 +1741,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only ok result asyncs into one') { + it('combines only ok result asyncs into one', () => { type Expectation = ResultAsync<[ number, string ], never>; const result = ResultAsync.combine([ @@ -1753,7 +1753,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only err results into one') { + it('combines only err results into one', () => { type Expectation = ResultAsync<[ never, never ], number | string>; const result = ResultAsync.combine([ @@ -1765,7 +1765,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines empty list result asyncs into one') { + it('combines empty list result asyncs into one', () => { type Expectation = ResultAsync; const results: [] = []; @@ -1775,7 +1775,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines arrays of result asyncs to a result async of an array') { + it('combines arrays of result asyncs to a result async of an array', () => { type Expectation = ResultAsync; const results: ResultAsync[] = []; @@ -1785,8 +1785,8 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function describe(_ = 'inference on large tuples') { - (function it(_ = 'Should correctly infer the type on tuples with 6 elements') { + describe('inference on large tuples', () => { + it('Should correctly infer the type on tuples with 6 elements', () => { type Input = CreateTuple<6, ResultAsync> type Expectation = ResultAsync, never> @@ -1798,7 +1798,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 7 elements') { + it('Should correctly infer the type on tuples with 7 elements', () => { type Input = CreateTuple<7, ResultAsync> type Expectation = ResultAsync, never> @@ -1810,7 +1810,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 8 elements') { + it('Should correctly infer the type on tuples with 8 elements', () => { type Input = CreateTuple<8, ResultAsync> type Expectation = ResultAsync, never> @@ -1822,7 +1822,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 9 elements') { + it('Should correctly infer the type on tuples with 9 elements', () => { type Input = CreateTuple<9, ResultAsync> type Expectation = ResultAsync, never> @@ -1834,7 +1834,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 10 elements') { + it('Should correctly infer the type on tuples with 10 elements', () => { type Input = CreateTuple<10, ResultAsync> type Expectation = ResultAsync, never> @@ -1846,7 +1846,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 11 elements') { + it('Should correctly infer the type on tuples with 11 elements', () => { type Input = CreateTuple<11, ResultAsync> type Expectation = ResultAsync, never> @@ -1858,7 +1858,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 12 elements') { + it('Should correctly infer the type on tuples with 12 elements', () => { type Input = CreateTuple<12, ResultAsync> type Expectation = ResultAsync, never> @@ -1870,7 +1870,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 13 elements') { + it('Should correctly infer the type on tuples with 13 elements', () => { type Input = CreateTuple<13, ResultAsync> type Expectation = ResultAsync, never> @@ -1882,7 +1882,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 14 elements') { + it('Should correctly infer the type on tuples with 14 elements', () => { type Input = CreateTuple<14, ResultAsync> type Expectation = ResultAsync, never> @@ -1894,7 +1894,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 15 elements') { + it('Should correctly infer the type on tuples with 15 elements', () => { type Input = CreateTuple<15, ResultAsync> type Expectation = ResultAsync, never> @@ -1906,7 +1906,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 16 elements') { + it('Should correctly infer the type on tuples with 16 elements', () => { type Input = CreateTuple<16, ResultAsync> type Expectation = ResultAsync, never> @@ -1918,7 +1918,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 17 elements') { + it('Should correctly infer the type on tuples with 17 elements', () => { type Input = CreateTuple<17, ResultAsync> type Expectation = ResultAsync, never> @@ -1930,7 +1930,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 18 elements') { + it('Should correctly infer the type on tuples with 18 elements', () => { type Input = CreateTuple<18, ResultAsync> type Expectation = ResultAsync, never> @@ -1942,7 +1942,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 19 elements') { + it('Should correctly infer the type on tuples with 19 elements', () => { type Input = CreateTuple<19, ResultAsync> type Expectation = ResultAsync, never> @@ -1954,7 +1954,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 20 elements') { + it('Should correctly infer the type on tuples with 20 elements', () => { type Input = CreateTuple<20, ResultAsync> type Expectation = ResultAsync, never> @@ -1966,7 +1966,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 21 elements') { + it('Should correctly infer the type on tuples with 21 elements', () => { type Input = CreateTuple<21, ResultAsync> type Expectation = ResultAsync, never> @@ -1978,7 +1978,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 22 elements') { + it('Should correctly infer the type on tuples with 22 elements', () => { type Input = CreateTuple<22, ResultAsync> type Expectation = ResultAsync, never> @@ -1990,7 +1990,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 23 elements') { + it('Should correctly infer the type on tuples with 23 elements', () => { type Input = CreateTuple<23, ResultAsync> type Expectation = ResultAsync, never> @@ -2002,7 +2002,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 24 elements') { + it('Should correctly infer the type on tuples with 24 elements', () => { type Input = CreateTuple<24, ResultAsync> type Expectation = ResultAsync, never> @@ -2014,7 +2014,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 25 elements') { + it('Should correctly infer the type on tuples with 25 elements', () => { type Input = CreateTuple<25, ResultAsync> type Expectation = ResultAsync, never> @@ -2026,7 +2026,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 26 elements') { + it('Should correctly infer the type on tuples with 26 elements', () => { type Input = CreateTuple<26, ResultAsync> type Expectation = ResultAsync, never> @@ -2038,7 +2038,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 27 elements') { + it('Should correctly infer the type on tuples with 27 elements', () => { type Input = CreateTuple<27, ResultAsync> type Expectation = ResultAsync, never> @@ -2050,7 +2050,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 28 elements') { + it('Should correctly infer the type on tuples with 28 elements', () => { type Input = CreateTuple<28, ResultAsync> type Expectation = ResultAsync, never> @@ -2062,7 +2062,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 29 elements') { + it('Should correctly infer the type on tuples with 29 elements', () => { type Input = CreateTuple<29, ResultAsync> type Expectation = ResultAsync, never> @@ -2074,7 +2074,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 30 elements') { + it('Should correctly infer the type on tuples with 30 elements', () => { type Input = CreateTuple<30, ResultAsync> type Expectation = ResultAsync, never> @@ -2086,7 +2086,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 31 elements') { + it('Should correctly infer the type on tuples with 31 elements', () => { type Input = CreateTuple<31, ResultAsync> type Expectation = ResultAsync, never> @@ -2098,7 +2098,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 32 elements') { + it('Should correctly infer the type on tuples with 32 elements', () => { type Input = CreateTuple<32, ResultAsync> type Expectation = ResultAsync, never> @@ -2110,7 +2110,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 33 elements') { + it('Should correctly infer the type on tuples with 33 elements', () => { type Input = CreateTuple<33, ResultAsync> type Expectation = ResultAsync, never> @@ -2122,7 +2122,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 34 elements') { + it('Should correctly infer the type on tuples with 34 elements', () => { type Input = CreateTuple<34, ResultAsync> type Expectation = ResultAsync, never> @@ -2134,7 +2134,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 35 elements') { + it('Should correctly infer the type on tuples with 35 elements', () => { type Input = CreateTuple<35, ResultAsync> type Expectation = ResultAsync, never> @@ -2146,7 +2146,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 36 elements') { + it('Should correctly infer the type on tuples with 36 elements', () => { type Input = CreateTuple<36, ResultAsync> type Expectation = ResultAsync, never> @@ -2158,7 +2158,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 37 elements') { + it('Should correctly infer the type on tuples with 37 elements', () => { type Input = CreateTuple<37, ResultAsync> type Expectation = ResultAsync, never> @@ -2170,7 +2170,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 38 elements') { + it('Should correctly infer the type on tuples with 38 elements', () => { type Input = CreateTuple<38, ResultAsync> type Expectation = ResultAsync, never> @@ -2182,7 +2182,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 39 elements') { + it('Should correctly infer the type on tuples with 39 elements', () => { type Input = CreateTuple<39, ResultAsync> type Expectation = ResultAsync, never> @@ -2194,7 +2194,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 40 elements') { + it('Should correctly infer the type on tuples with 40 elements', () => { type Input = CreateTuple<40, ResultAsync> type Expectation = ResultAsync, never> @@ -2206,7 +2206,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 41 elements') { + it('Should correctly infer the type on tuples with 41 elements', () => { type Input = CreateTuple<41, ResultAsync> type Expectation = ResultAsync, never> @@ -2218,7 +2218,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 42 elements') { + it('Should correctly infer the type on tuples with 42 elements', () => { type Input = CreateTuple<42, ResultAsync> type Expectation = ResultAsync, never> @@ -2230,7 +2230,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 43 elements') { + it('Should correctly infer the type on tuples with 43 elements', () => { type Input = CreateTuple<43, ResultAsync> type Expectation = ResultAsync, never> @@ -2242,7 +2242,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 44 elements') { + it('Should correctly infer the type on tuples with 44 elements', () => { type Input = CreateTuple<44, ResultAsync> type Expectation = ResultAsync, never> @@ -2254,7 +2254,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 45 elements') { + it('Should correctly infer the type on tuples with 45 elements', () => { type Input = CreateTuple<45, ResultAsync> type Expectation = ResultAsync, never> @@ -2266,7 +2266,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 46 elements') { + it('Should correctly infer the type on tuples with 46 elements', () => { type Input = CreateTuple<46, ResultAsync> type Expectation = ResultAsync, never> @@ -2278,7 +2278,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 47 elements') { + it('Should correctly infer the type on tuples with 47 elements', () => { type Input = CreateTuple<47, ResultAsync> type Expectation = ResultAsync, never> @@ -2290,7 +2290,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 48 elements') { + it('Should correctly infer the type on tuples with 48 elements', () => { type Input = CreateTuple<48, ResultAsync> type Expectation = ResultAsync, never> @@ -2302,7 +2302,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 49 elements') { + it('Should correctly infer the type on tuples with 49 elements', () => { type Input = CreateTuple<49, ResultAsync> type Expectation = ResultAsync, never> @@ -2316,8 +2316,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'combineWithAllErrors') { - (function it(_ = 'combines different result asyncs into one') { + describe('combineWithAllErrors', () => { + it('combines different result asyncs into one', () => { type Expectation = ResultAsync<[ number, string, never, never ], (string[] | Error)[]>; const result = ResultAsync.combineWithAllErrors([ @@ -2331,7 +2331,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only ok result asyncs into one') { + it('combines only ok result asyncs into one', () => { type Expectation = ResultAsync<[ number, string ], never[]>; const result = ResultAsync.combineWithAllErrors([ @@ -2343,7 +2343,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines only err result asyncs into one') { + it('combines only err result asyncs into one', () => { type Expectation = ResultAsync<[ never, never ], (number | string)[]>; const result = ResultAsync.combineWithAllErrors([ @@ -2355,7 +2355,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines arrays of result asyncs to a result of an array') { + it('combines arrays of result asyncs to a result of an array', () => { type Expectation = ResultAsync; const results: ResultAsync[] = []; @@ -2365,7 +2365,7 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function it(_ = 'combines arrays of different result asyncs to a result of an array') { + it('combines arrays of different result asyncs to a result of an array', () => { type Expectation = ResultAsync<(string | boolean)[], (number | string)[]>; const results: (ResultAsync | ResultAsync)[] = []; @@ -2375,8 +2375,8 @@ describe('Result', () => { const assignablefromCheck: typeof result = assignableToCheck; }); - (function describe(_ = 'inference on large tuples') { - (function it(_ = 'Should correctly infer the type on tuples with 6 elements') { + describe('inference on large tuples', () => { + it('Should correctly infer the type on tuples with 6 elements', () => { type Input = CreateTuple<6, ResultAsync> type Expectation = ResultAsync, number[]> @@ -2388,7 +2388,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 15 elements') { + it('Should correctly infer the type on tuples with 15 elements', () => { type Input = CreateTuple<15, ResultAsync> type Expectation = ResultAsync, number[]> @@ -2400,7 +2400,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 30 elements') { + it('Should correctly infer the type on tuples with 30 elements', () => { type Input = CreateTuple<30, ResultAsync> type Expectation = ResultAsync, number[]> @@ -2412,7 +2412,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'Should correctly infer the type on tuples with 49 elements') { + it('Should correctly infer the type on tuples with 49 elements', () => { type Input = CreateTuple<49 , ResultAsync> type Expectation = ResultAsync, number[]> @@ -2424,16 +2424,13 @@ describe('Result', () => { ]) }); }); - - - }); }); -(function describe(_ = 'Utility types') { - (function describe(_ = 'safeTry') { - (function describe(_ = 'sync generator') { - (function it(_ = 'should correctly infer the result type when generator returns Ok') { +describe('Utility types', () => { + describe('safeTry', () => { + describe('sync generator', () => { + it('should correctly infer the result type when generator returns Ok', () => { interface ReturnMyError { name: 'ReturnMyError' } @@ -2448,7 +2445,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'should correctly infer the result type when generator returns Err') { + it('should correctly infer the result type when generator returns Err', () => { interface ReturnMyError { name: 'ReturnMyError'; } @@ -2463,7 +2460,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'infers the value type when calling "yield*"') { + it('infers the value type when calling "yield*"', () => { interface YieldMyError { name: 'YieldMyError'; } @@ -2483,7 +2480,7 @@ describe('Result', () => { }) }); - (function it(_ = 'should correctly infer the result type with multiple "yield*"') { + it('should correctly infer the result type with multiple "yield*"', () => { interface FirstYieldMyError { name: 'FirstYieldMyError'; } @@ -2507,8 +2504,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'async generator') { - (function it(_ = 'should correctly infer the result type when generator returns OkAsync') { + describe('async generator', () => { + it('should correctly infer the result type when generator returns OkAsync', () => { interface ReturnMyError { name: 'ReturnMyError' } @@ -2523,7 +2520,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'should correctly infer the result type when generator returns ErrAsync') { + it('should correctly infer the result type when generator returns ErrAsync', () => { interface ReturnMyError { name: 'ReturnMyError'; } @@ -2538,7 +2535,7 @@ describe('Result', () => { ]) }); - (function it(_ = 'infers the value type when calling "yield*"') { + it('infers the value type when calling "yield*"', () => { interface YieldMyError { name: 'YieldMyError'; } @@ -2558,7 +2555,7 @@ describe('Result', () => { }) }); - (function it(_ = 'should correctly infer the result type with multiple "yield*"') { + it('should correctly infer the result type with multiple "yield*"', () => { interface FirstYieldMyError { name: 'FirstYieldMyError'; } @@ -2583,8 +2580,8 @@ describe('Result', () => { }); }); - (function describe(_ = 'Transpose') { - (function it(_ = 'should transpose an array') { + describe('Transpose', () => { + it('should transpose an array', () => { const input: [ [ 1, 2 ], [ 3, 4 ], @@ -2603,7 +2600,7 @@ describe('Result', () => { const transposed: Expectation = transpose(input) }); - (function it(_ = 'should transpose an empty array') { + it('should transpose an empty array', () => { const input: [] = [] type Expectation = [] @@ -2611,7 +2608,7 @@ describe('Result', () => { const transposed: Expectation = transpose(input) }); - (function it(_ = 'should transpose incomplete array') { + it('should transpose incomplete array', () => { const input: [ [ 1, 3 ], [ 2, ] @@ -2625,7 +2622,7 @@ describe('Result', () => { const transposed: Expectation = transpose(input) }); }); -})(); +}); //#region Utility function declarations for type testing diff --git a/tsconfig.test.json b/tsconfig.test.json deleted file mode 100644 index eba62037..00000000 --- a/tsconfig.test.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "noUnusedParameters": false, - "noUnusedLocals": false - }, - "extends": "./tsconfig.json", - "include": ["tests/**/*.ts"], -} diff --git a/vitest.config.ts b/vitest.config.ts index 9f6120d3..bf131f8f 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -5,7 +5,7 @@ export default defineConfig({ typecheck: { enabled: true, include: ['tests/typecheck-tests.ts'], - tsconfig: 'tsconfig.test.json', + tsconfig: 'tests/tsconfig.test.json', }, }, }) From b69e27e9dba139eac2891a5eccdd444e41adb00f Mon Sep 17 00:00:00 2001 From: m-shaka Date: Sun, 9 Mar 2025 11:21:36 +0900 Subject: [PATCH 4/4] fix tsconfig name --- vitest.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vitest.config.ts b/vitest.config.ts index bf131f8f..d9097a49 100644 --- a/vitest.config.ts +++ b/vitest.config.ts @@ -5,7 +5,7 @@ export default defineConfig({ typecheck: { enabled: true, include: ['tests/typecheck-tests.ts'], - tsconfig: 'tests/tsconfig.test.json', + tsconfig: 'tests/tsconfig.tests.json', }, }, })