github samchon/typia v5.5.1

latest releases: v6.11.3, v6.11.2, v6.11.1...
8 months ago

New module functional for entire function level validation.

export namespace functional {
  export function assertFunction<T extends Function>(func: T): T;

  export function isFunction<T extends (...args: any[]) => any>(
    func: T,
  ): T extends (...args: infer Arguments) => infer Output
    ? Output extends Promise<infer R>
      ? (...args: Arguments) => Promise<R | null>
      : (...args: Arguments) => Output | null
    : never;

  export function validateFunction<T extends (...args: any[]) => any>(
    func: T,
  ): T extends (...args: infer Arguments) => infer Output
    ? Output extends Promise<infer R>
      ? (...args: Arguments) => Promise<IValidation<R>>
      : (...args: Arguments) => IValidation<Output>
    : never;
}

What's Changed

New Contributors

Full Changelog: v5.4.14...v5.5.1

Don't miss a new typia release

NewReleases is sending notifications on new releases.