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
- Close samchon/nestia#346 - support inifite repeated union Array type. by @samchon in #642
- Support JsDoc
type
tag like@type {int}
by @samchon in #643 - Fix typo in json/parse.mdx by @rapsealk in #641
- Fix #644 - swagger allows only
components.schemas
property by @samchon in #645 - Complement #644 - access key from
$ref
also had to be changed. by @samchon in #646 - Complement #644 - alias object type by @samchon in #647
- Fix #639 -
Required<T>
problem by @samchon in #648
New Contributors
Full Changelog: v3.8.9...v4.0.3