Skip to content

v4.0.3

Compare
Choose a tag to compare
@samchon samchon released this 05 Jun 09:12
· 673 commits to master since this release

Major update due to break changes on API, and 3rd party libraries like nestia being affected.

In prisma case, its JsonValue contains infinite repeated Array type like below.

If only infinite repeated array type comes, it is not allowed in TypeScript. However, if infinite repeated array type is capsuled in an union type like below JsonValue case, TypeScript allows it. I hadn't known such spec, and none of other validator libraries had supported it, either.

However, as prisma is using such type, I've tried typia to support such special type. And today, I've succeeded to fully implement it, with new 300K line of codes. The implementation difficulty of it was terribly high, but I'm glad I succeeded in implementing it in the end.

export type JsonValue =
    | string
    | number
    | boolean
    | JsonObject
    | JsonArray
    | null;
export interface JsonObject {
    [key: string]: JsonValue | undefined;
}
export type JsonArray = Array<JsonValue>;

Furthermore, typia supports extreme union type of infinite repeated union array type. Below ArrayRepeatedUnionWithTuple type is one of such extreme type used for automated testing program of typia. From now on, I can say again that, "typia" supports every TypeScript type".

export type ArrayRepeatedUnionWithTuple =
    | boolean
    | number
    | string[]
    | ArrayRepeatedUnionWithTuple[]
    | ArrayRepeatedUnionWithTuple.IBox3D[]
    | [string, number, boolean]
    | [
          ArrayRepeatedUnionWithTuple.IBox3D,
          ArrayRepeatedUnionWithTuple.IPoint3D,
      ];
export namespace ArrayRepeatedUnionWithTuple {
    export interface IBox3D {
        scale: IPoint3D;
        position: IPoint3D;
        rotate: IPoint3D;
        pivot: IPoint3D;
    }
    export interface IPoint3D {
        x: number;
        y: number;
        z: number;
    }
}

What's Changed

New Contributors

Full Changelog: v3.8.9...v4.0.3