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
- Prepare #954 - custom type assertion error. by @samchon in #985
- Documentation of #954 by @samchon in #987
- docs: fix typo by @KhooHaoYit in #988
- Close #954 -
typia.functional.assertFunction()
. by @samchon in #989 - Complement #954 -
isFunction()
andvalidateFunction()
. by @samchon in #992 - Publish v5.5 and documentation by @samchon in #993
- Fix
typia.functional
module for async or implicit return type case. by @samchon in #994
New Contributors
- @KhooHaoYit made their first contribution in #988
Full Changelog: v5.4.14...v5.5.1