Super-fast/easy runtime validations and serializations through transformation
MIT License
Bot releases are visible (Hide)
Published by samchon over 1 year ago
Typia supports npx typia generate
command.
Therefore, you can use typia
even in non-standard TypeScript compilers like swc or babel.
`npx typia generate \
--input src/templates \
--output src/generated
//--------
// src/templates/check.ts
//--------
import typia from "typia";
export const check = typia.createIs<string | null>();
//--------
// src/generated/check.ts
//--------
import typia from "typia";
export const check =
(input: unknown): input is string | null
=> "string" === typeof input || null === input;
npx typia generate
by @samchon in https://github.com/samchon/typia/pull/510
Full Changelog: https://github.com/samchon/typia/compare/v3.5.8...v3.6.1
Published by samchon over 1 year ago
Full Changelog: https://github.com/samchon/typia/compare/v3.5.7...v3.5.8
Published by samchon over 1 year ago
Full Changelog: https://github.com/samchon/typia/compare/v3.5.5...v3.5.7
Published by samchon over 1 year ago
Full Changelog: https://github.com/samchon/typia/compare/v3.5.4...v3.5.5
Published by samchon over 1 year ago
random()
became customizable by @samchon in https://github.com/samchon/typia/pull/512
Full Changelog: https://github.com/samchon/typia/compare/v3.5.3...v3.5.4
Published by samchon over 1 year ago
Full Changelog: https://github.com/samchon/typia/compare/v3.5.0...v3.5.3
Published by samchon over 1 year ago
export function random<T>(): T; // generate random data
export function clone<T>(input: T): Primitive<T>;
export function prune<T extends object>(input: T): void;
// +) isClone, assertClone, validateClone
// +) isPrune, assertPrune, validatePrune
New functions are newly added.
Especially, you can generate test data, just by using typia.random<T>()
function.
FeatureProgrammer
by @samchon in https://github.com/samchon/typia/pull/492
prune()
functions by @samchon in https://github.com/samchon/typia/pull/493
clone()
functions by @samchon in https://github.com/samchon/typia/pull/496
random()
function by @samchon in https://github.com/samchon/typia/pull/499
Full Changelog: https://github.com/samchon/typia/compare/v3.4.28...v3.5.0
Published by samchon over 1 year ago
Full Changelog: https://github.com/samchon/typia/compare/v3.4.27...v3.4.28
Published by samchon over 1 year ago
Trivial but endless performance tunings.
Updates since v3.4.22 does not effect on logic level, but performance tuning only.
ITransformOptions.undefined
by @samchon in https://github.com/samchon/typia/pull/481
equals()
for simple object by @samchon in https://github.com/samchon/typia/pull/483
equals()
by @samchon in https://github.com/samchon/typia/pull/484
Full Changelog: https://github.com/samchon/typia/compare/v3.4.22...v3.4.27
Published by samchon almost 2 years ago
When rest typed tuple like [string, number, ...boolean]
comes, there's no way to express it through JSON schema. Also, when using swagger
mode, even expressing tuple type is not possible. Furthermore, the swagger
mode can't express IJsonComponents.patternProperties
, either.
However, as I am preparing a new library reactia
which can automatically generate frontend application just by analyzing NestJS developed backend server code, through swagger.json
file generated by nestia
SDK generator, I have to find detour way to express those unsupported types.
Therefore, enhance IJsonSchema
and IJsonComponent
types to be possible to express unsupported types in the oridnary JSON schema, through plug-in properties. The new properties would be IJsonSchema.IAttribute.x-typia-rest
, IJsonSchema.IArray.x-typia-tuple
, IJsonComponents.x-typia-patternProperties
and IJsonComponents.x-typia-additionalProperties
.
export namespace IJsonSchema {
export interface IArray extends ISignificant<"array"> {
items: IJsonSchema;
minItems?: number;
maxItems?: number;
"x-typia-tuple"?: ITuple;
}
export interface ISignificant<Literal extends string> extends IAttribute {
type: Literal;
nullable: boolean;
}
export interface IAttribute {
deprecated?: boolean;
title?: string;
description?: string;
"x-typia-metaTags"?: IMetadataTag[];
"x-typia-jsDocTags"?: IJsDocTagInfo[];
"x-typia-required"?: boolean;
"x-typia-rest"?: boolean;
}
}
export namespace IJsonComponents {
export interface IObject {
$id?: string;
$recursiveAnchor?: boolean;
type: "object";
nullable: boolean;
properties: Record<string, IJsonSchema>;
patternProperties?: Record<string, IJsonSchema>;
additionalProperties?: IJsonSchema;
required?: string[];
description?: string;
"x-typia-jsDocTags"?: IJsDocTagInfo[];
"x-typia-patternProperties"?: Record<string, IJsonSchema>;
"x-typia-additionalProperties": IJsonSchema;
}
}
Full Changelog: https://github.com/samchon/typia/compare/v3.4.20...v3.4.22
Published by samchon almost 2 years ago
Full Changelog: https://github.com/samchon/typia/compare/v3.4.18...v3.4.20
Published by samchon almost 2 years ago
From now on, you can specify tsconfig.json
file through --project
option.
npx typia setup --project tsconfig.test.json
Suffered from CLI development. It is too hard to testing before publishing.
I should find way to test CLI by simulating the published environment.
npx typia setup --project
command by @samchon in https://github.com/samchon/typia/pull/449
Full Changelog: https://github.com/samchon/typia/compare/v3.4.15...v3.4.18
Published by samchon almost 2 years ago
numeric
option to be conditionable by @samchon in https://github.com/samchon/typia/pull/443
bigint
type in JSON functions by @samchon in https://github.com/samchon/typia/pull/445
Full Changelog: https://github.com/samchon/typia/compare/v3.4.13...v3.4.15
Published by samchon almost 2 years ago
Emergent patch about !Array.isArray(Object)
checking statement.
I should be more cautious and do not decide quickly.
!Array.isArray(Object)
checking conditionally by @samchon in https://github.com/samchon/typia/pull/426
Full Changelog: https://github.com/samchon/typia/compare/v3.4.10...v3.4.11
Published by samchon almost 2 years ago
From now on, when you install and configure typia
through npx typia setup
command. you can specialize package manager by --manager
argument like below:
npx typia setup --manager npm
npx typia setup --manager pnpm
npx typia setup --manager yarn
pnpm
and yarn
setup by @samchon in https://github.com/samchon/typia/pull/419
Full Changelog: https://github.com/samchon/typia/compare/v3.4.7...v3.4.9
Published by samchon almost 2 years ago
From now on, typescript-json
has been renamed to typia
, because typia
will support Protocol Buffer (maybe v4
) and no more the word "JSON" can represent this project. Also, clone()
function is no more supported because it seems no more required (#393).
Furthermore, you can easily install and configure typia
just by typing npx typia setup
command. Do not be suffer from manual tsconfig.json
setup more. By the way, the reason why this minor update starts from v3.4.5
version is caused by I was not familiar with such automatic setup CLI supporting.
typia
by @samchon in https://github.com/samchon/typia/pull/411
typia
compatible with typescript-json
by @samchon in https://github.com/samchon/typia/pull/412
typia
with automatic setup command by @samchon in https://github.com/samchon/typia/pull/413
npx typia set
to work in typescript-json
by @samchon in https://github.com/samchon/typia/pull/415
Full Changelog: https://github.com/samchon/typia/compare/v3.3.44...v3.4.7
Published by samchon almost 2 years ago
Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.43...v3.3.44
Published by samchon almost 2 years ago
ttypescript
started supporting TS 4.9.
Therefore, typescript-json
also supports TS 4.9, too.
Thanks for @cevek and @nonara
Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.42...v3.3.43
Published by samchon almost 2 years ago
pnpm
symbolic link case by @samchon in https://github.com/samchon/typescript-json/pull/404
Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.41...v3.3.42
Published by samchon almost 2 years ago
Safe JSON.parse()
functions and some validate related functions are newly added:
TSON.isParse()
TSON.assertParse()
TSON.validateParse()
TSON.validateStringify()
TSON.validateClone()
validateStringify()
functions by @samchon in https://github.com/samchon/typescript-json/pull/396
src
directory for source mapping by @samchon in https://github.com/samchon/typescript-json/pull/397
isParse()
functions by @samchon in https://github.com/samchon/typescript-json/pull/398
Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.39...v3.3.41