From ae96054b679871e15ee02b3a0dafa2e523e22825 Mon Sep 17 00:00:00 2001 From: bkiac Date: Sun, 26 Nov 2023 08:17:58 +0100 Subject: [PATCH] Remove internal --- package.json | 5 ----- src/fn.ts | 2 +- src/index.ts | 38 +++++++++++-------------------------- src/internal.ts | 11 ----------- test/fn.test.ts | 2 +- test/group.test.ts | 2 +- test/guard.test.ts | 2 +- test/option.test.ts | 2 +- test/option_promise.test.ts | 2 +- test/result.test.ts | 2 +- test/result_error.test.ts | 2 +- test/result_promise.test.ts | 2 +- test/try.test.ts | 2 +- 13 files changed, 21 insertions(+), 53 deletions(-) delete mode 100644 src/internal.ts diff --git a/package.json b/package.json index a2bba26..d6d53a3 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,6 @@ "require": "./lib/index.cjs", "import": "./lib/index.js" }, - "./internal": { - "types": "./lib/internal.d.ts", - "require": "./lib/internal.cjs", - "import": "./lib/internal.js" - }, "./package.json": "./package.json" }, "types": "./lib/index.d.ts", diff --git a/src/fn.ts b/src/fn.ts index fb929ca..b8761ec 100644 --- a/src/fn.ts +++ b/src/fn.ts @@ -1,6 +1,6 @@ import type {Result} from "./result" import {ResultPromise} from "./result_promise" -import type {InferErr, InferOk} from "./internal" +import type {InferErr, InferOk} from "./util" export function fn>( f: (...args: A) => R, diff --git a/src/index.ts b/src/index.ts index 1e47005..c1affd8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,27 +1,11 @@ -export { - Err, - None, - Ok, - type Option, - Panic, - OptionPromise, - ResultPromise, - type Result, - ResultError, - ResultGroup, - Some, - StdError, - asyncFn, - createGroup, - fn, - guard, - guardAsync, - guardAsyncWith, - guardWith, - tryAsyncFn, - tryAsyncFnWith, - tryFn, - tryFnWith, - tryPromise, - tryPromiseWith, -} from "./internal" +export * from "./fn" +export * from "./group" +export * from "./guard" +export * from "./option_promise" +export * from "./option" +export * from "./panic" +export * from "./result_error" +export * from "./result_promise" +export * from "./result" +export * from "./try" +export * from "./util" diff --git a/src/internal.ts b/src/internal.ts deleted file mode 100644 index c1affd8..0000000 --- a/src/internal.ts +++ /dev/null @@ -1,11 +0,0 @@ -export * from "./fn" -export * from "./group" -export * from "./guard" -export * from "./option_promise" -export * from "./option" -export * from "./panic" -export * from "./result_error" -export * from "./result_promise" -export * from "./result" -export * from "./try" -export * from "./util" diff --git a/test/fn.test.ts b/test/fn.test.ts index 6a355d1..5ac44f8 100644 --- a/test/fn.test.ts +++ b/test/fn.test.ts @@ -10,7 +10,7 @@ import { type Result, tryFn, ResultError, -} from "../src/internal" +} from "../src" describe.concurrent("fn", () => { it("returns Ok result when provided function does not throw", () => { diff --git a/test/group.test.ts b/test/group.test.ts index 3357b9f..68c0841 100644 --- a/test/group.test.ts +++ b/test/group.test.ts @@ -1,6 +1,6 @@ import {test, expect, vi} from "vitest" import {ResultGroup, createGroup} from "../src/group" -import {ResultError} from "../src/internal" +import {ResultError} from "../src" test("constructor", () => { const handleError = vi.fn() diff --git a/test/guard.test.ts b/test/guard.test.ts index a7fd644..28bb05c 100644 --- a/test/guard.test.ts +++ b/test/guard.test.ts @@ -8,7 +8,7 @@ import { guardWith, Result, ResultPromise, -} from "../src/internal" +} from "../src" class MyError extends ResultError { readonly tag = "MyError" diff --git a/test/option.test.ts b/test/option.test.ts index 1c5c520..361f86b 100644 --- a/test/option.test.ts +++ b/test/option.test.ts @@ -1,5 +1,5 @@ import {describe, expect, expectTypeOf, it, vi} from "vitest" -import {Panic, UnwrapPanic, None, Some, type Option} from "../src/internal" +import {Panic, UnwrapPanic, None, Some, type Option} from "../src" function TestSome(value: T): Option { return Some(value) as Option diff --git a/test/option_promise.test.ts b/test/option_promise.test.ts index 167a8c6..afaa4be 100644 --- a/test/option_promise.test.ts +++ b/test/option_promise.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect, vi} from "vitest" -import {Panic, UnwrapPanic, OptionPromise, Some, None} from "../src/internal" +import {Panic, UnwrapPanic, OptionPromise, Some, None} from "../src" function promiseSome(value: T) { return new OptionPromise(Promise.resolve(Some(value))) diff --git a/test/result.test.ts b/test/result.test.ts index b186680..295f1bd 100644 --- a/test/result.test.ts +++ b/test/result.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect, expectTypeOf, vi, test} from "vitest" -import {Panic, UnwrapPanic, Ok, Err, type Result} from "../src/internal" +import {Panic, UnwrapPanic, Ok, Err, type Result} from "../src" function TestOk(value: T): Result { return Ok(value) diff --git a/test/result_error.test.ts b/test/result_error.test.ts index 8732896..e323717 100644 --- a/test/result_error.test.ts +++ b/test/result_error.test.ts @@ -1,5 +1,5 @@ import {describe, expect, it, test} from "vitest" -import {ResultError, StdError, inspectSymbol} from "../src/internal" +import {ResultError, StdError, inspectSymbol} from "../src" describe.concurrent("ResultError", () => { class MyResultError extends ResultError { diff --git a/test/result_promise.test.ts b/test/result_promise.test.ts index e916aa3..3570303 100644 --- a/test/result_promise.test.ts +++ b/test/result_promise.test.ts @@ -1,5 +1,5 @@ import {describe, it, expect} from "vitest" -import {Err, Panic, ResultPromise, Ok, UnwrapPanic} from "../src/internal" +import {Err, Panic, ResultPromise, Ok, UnwrapPanic} from "../src" function promiseOk(value: T) { return new ResultPromise(Promise.resolve(Ok(value))) diff --git a/test/try.test.ts b/test/try.test.ts index 0746f5c..6342d9e 100644 --- a/test/try.test.ts +++ b/test/try.test.ts @@ -7,7 +7,7 @@ import { tryFnWith, tryPromise, tryPromiseWith, -} from "../src/internal" +} from "../src" class MyError extends ResultError { readonly tag = "MyError"