Skip to content

Files

Latest commit

 

History

History

typing

🧰 Utility types

JSR JSR Score NPM Coverage

📑 Examples

import type { Arg, Arrayable, Nullable, Promisable } from "./types.ts"

function foo(_: unknown, args: Arrayable<string>): Promisable<Nullable<string>> {
  return Promise.resolve(null)
}

// Get the type of arguments[1] of `foo` function
type args = Arg<typeof foo, 1>

✨ Features

  • AsyncFunction, GeneratorFunction and AsyncGeneratorFunction constructors.
  • Addtional useful type utilites.

📜 License

Copyright (c) Simon Lecoq <@lowlighter>. (MIT License)
https://github.com/lowlighter/libs/blob/main/LICENSE