From 6b6e056a8ee8804a72488beb8dee1be718c83523 Mon Sep 17 00:00:00 2001 From: Marcin Dziewulski Date: Wed, 2 Nov 2022 19:54:45 +0100 Subject: [PATCH] Use types only from namespaces --- __tests__/Function/after.test.ts | 6 +++--- __tests__/Function/tryCatch.test.ts | 14 +++++++------- src/index.ts | 3 --- 3 files changed, 10 insertions(+), 13 deletions(-) diff --git a/__tests__/Function/after.test.ts b/__tests__/Function/after.test.ts index 6658f3c0..928851f1 100644 --- a/__tests__/Function/after.test.ts +++ b/__tests__/Function/after.test.ts @@ -1,6 +1,6 @@ import { expectType } from 'ts-expect' -import { F, N, O, Option } from '../..' +import { F, N, O } from '../..' const fn = (n: number) => { return `called ${n} times` @@ -12,9 +12,9 @@ const fn2 = (n: number, x: string) => { describe('after', () => { it('provides correct types', () => { - expectType<(n: number) => Option>(F.after(2, fn)) + expectType<(n: number) => O.Option>(F.after(2, fn)) expectType<(n: number, x: string) => string>(F.after(2, fn2)) - expectType<(n: number) => Option>(F.after(2, N.add(2))) + expectType<(n: number) => O.Option>(F.after(2, N.add(2))) }) it('handles multiple parameters', function () { diff --git a/__tests__/Function/tryCatch.test.ts b/__tests__/Function/tryCatch.test.ts index 293130e5..1d46c935 100644 --- a/__tests__/Function/tryCatch.test.ts +++ b/__tests__/Function/tryCatch.test.ts @@ -1,6 +1,6 @@ import { expectType } from 'ts-expect' -import { R, Result, F, pipe, O } from '../..' +import { R, F, pipe, O } from '../..' type User = { readonly name: string @@ -12,11 +12,11 @@ const throwError = (_x: number): number => { describe('tryCatch', () => { it('provides correct types', () => { - expectType>(F.tryCatch('<>', JSON.parse)) - expectType>( + expectType>(F.tryCatch('<>', JSON.parse)) + expectType>( F.tryCatch('{"name": "Joe"}', JSON.parse), ) - expectType>(F.tryCatch(1, throwError)) + expectType>(F.tryCatch(1, throwError)) F.tryCatch('hello', str => { expectType(str) }) @@ -48,11 +48,11 @@ describe('tryCatch', () => { describe('tryCatch (pipe)', () => { it('provides correct types', () => { - expectType>(pipe('<>', F.tryCatch(JSON.parse))) - expectType>( + expectType>(pipe('<>', F.tryCatch(JSON.parse))) + expectType>( pipe('{"name": "Joe"}', F.tryCatch(JSON.parse)), ) - expectType>(F.tryCatch(1, throwError)) + expectType>(F.tryCatch(1, throwError)) pipe( 'hello', F.tryCatch(str => { diff --git a/src/index.ts b/src/index.ts index 49516367..47e48198 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,9 +1,6 @@ export { pipe } from './pipe' export { flow } from './flow' -export { Option } from './Option' -export { Result, Ok, Error } from './Result' - export * as F from './Function' export * as A from './Array' export * as R from './Result'