0.0.5 • Published 3 years ago

fn-io-types v0.0.5

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

🐕‍🦺 Fn I/O Types

TypeScript function I/O utility types

⚙️ Install

npm install fn-io-types

👻 Types

TypeDescription
InType<T>Type of the first argument to a function
OutType<T>Return type of a sync or async function

📽️ Example

export function helloWorld(
  { hello }: { hello: boolean }
): { world: boolean } {
  if (hello) {
    return { world: true }
  }
}

export async function hiUniverse(
  { hi }: { hi: boolean }
): Promise<{ universe: boolean }> {
  if (hi) {
    return { universe: true }
  }
}

import { InType, OutType } from "fn-io-types"

export async function helloHi({
  hello,
  hi
}: InType<typeof helloWord> &
  InType<typeof hiUniverse>
): Promise<
  OutType<typeof helloWord> &
  OutType<typeof hiUniverse>
> {
  return Object.assign(
    helloWorld({ hello }),
    await hiUniverse({ hi }),
  )
}
0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago