Skip to content

Commit

Permalink
Remove internal
Browse files Browse the repository at this point in the history
  • Loading branch information
bkiac committed Nov 26, 2023
1 parent 2f7352c commit ae96054
Show file tree
Hide file tree
Showing 13 changed files with 21 additions and 53 deletions.
5 changes: 0 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/fn.ts
Original file line number Diff line number Diff line change
@@ -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<A extends any[], R extends Result<any, any>>(
f: (...args: A) => R,
Expand Down
38 changes: 11 additions & 27 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -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"
11 changes: 0 additions & 11 deletions src/internal.ts

This file was deleted.

2 changes: 1 addition & 1 deletion test/fn.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand Down
2 changes: 1 addition & 1 deletion test/group.test.ts
Original file line number Diff line number Diff line change
@@ -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()
Expand Down
2 changes: 1 addition & 1 deletion test/guard.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
guardWith,
Result,
ResultPromise,
} from "../src/internal"
} from "../src"

class MyError extends ResultError {
readonly tag = "MyError"
Expand Down
2 changes: 1 addition & 1 deletion test/option.test.ts
Original file line number Diff line number Diff line change
@@ -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<T>(value: T): Option<T> {
return Some(value) as Option<T>
Expand Down
2 changes: 1 addition & 1 deletion test/option_promise.test.ts
Original file line number Diff line number Diff line change
@@ -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<T>(value: T) {
return new OptionPromise<T>(Promise.resolve(Some<T>(value)))
Expand Down
2 changes: 1 addition & 1 deletion test/result.test.ts
Original file line number Diff line number Diff line change
@@ -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<T, E>(value: T): Result<T, E> {
return Ok(value)
Expand Down
2 changes: 1 addition & 1 deletion test/result_error.test.ts
Original file line number Diff line number Diff line change
@@ -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<Error> {
Expand Down
2 changes: 1 addition & 1 deletion test/result_promise.test.ts
Original file line number Diff line number Diff line change
@@ -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<T, E = any>(value: T) {
return new ResultPromise<T, E>(Promise.resolve(Ok<T>(value)))
Expand Down
2 changes: 1 addition & 1 deletion test/try.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
tryFnWith,
tryPromise,
tryPromiseWith,
} from "../src/internal"
} from "../src"

class MyError extends ResultError {
readonly tag = "MyError"
Expand Down

0 comments on commit ae96054

Please sign in to comment.