samchon/typia

[BUG] Returning type of createAssertGuard is invalid

Closed this issue · 1 comments

Bug Report

Returning types of createAssertGuard and createAssertGuardEquals are invalid.

Document

image

Actual types

typia/src/module.ts

Lines 722 to 724 in cd6ed78

function createAssertGuard<T>(
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
): (input: unknown) => AssertionGuard<T>;

typia/src/module.ts

Lines 896 to 898 in cd6ed78

function createAssertGuardEquals<T>(
errorFactory?: undefined | ((props: TypeGuardError.IProps) => Error),
): (input: unknown) => AssertionGuard<T>;

⏯ Playground Link

https://typia.io/playground/?script=JYWwDg9gTgLgBDAnmYBDANHA3g1BzAZzgF84AzKCEOAIiRVRoG4AoF4AOxgFMozUAxtzgBJALLcQAI17YWcOMAAmALjgEYUTnjgAyXIQB0AMWghUMADw0ArjeU0AfKwUdUIbmo1aOeF3HxPOA4baVldeQUDAkMAFWRua3suAGYAJic9SIUYfBixTlBQyzSABkcsqOjDAFEADwEAGxsCYAA3bjFUOqKQSwBGUvLWYhYBCA4NODwbVCglCTCoOABeBGQ0QwEobgtuAEECAl4YAHFZ+ctxSRkoRwAKAEpWccn4CCkAK1WsUZYZuYLG68e4fT6PNivAgQRrcQyNCB4e4AA2UagAJFgwYZlMRkY8gA

import typia, { tags } from "typia";

interface IMember {
  id: string & tags.Format<"uuid">;
  name: string;
  age: number &
    tags.Type<"uint32"> &
    tags.Minimum<20> &
    tags.ExclusiveMaximum<100>;
}
const guardMember: typia.AssertionGuard<IMember> = typia.createAssertGuard<IMember>();

You have to declare explicit type like above.

It is the TypeScript assertion type rule.