typia

Super-fast/easy runtime validations and serializations through transformation

MIT License

Downloads
429.9K
Stars
4.4K
Committers
87

Bot releases are hidden (Show)

typia - v3.6.1

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;

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.5.8...v3.6.1

typia - v3.5.8

Published by samchon over 1 year ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.5.7...v3.5.8

typia - v3.5.7

Published by samchon over 1 year ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.5.5...v3.5.7

typia - v3.5.5

Published by samchon over 1 year ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.5.4...v3.5.5

typia - v3.5.4

Published by samchon over 1 year ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.5.3...v3.5.4

typia - v3.5.3

Published by samchon over 1 year ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.5.0...v3.5.3

typia - v3.5.0

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.

What's Changed

New Contributors

Full Changelog: https://github.com/samchon/typia/compare/v3.4.28...v3.5.0

typia - v3.4.28

Published by samchon over 1 year ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.4.27...v3.4.28

typia - v3.4.27

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.

What's Changed

New Contributors

Full Changelog: https://github.com/samchon/typia/compare/v3.4.22...v3.4.27

typia - v3.4.22

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;
    }
}

What's Changed

New Contributors

Full Changelog: https://github.com/samchon/typia/compare/v3.4.20...v3.4.22

typia - v3.4.20

Published by samchon almost 2 years ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.4.18...v3.4.20

typia - v3.4.18

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.

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.4.15...v3.4.18

typia - v3.4.15

Published by samchon almost 2 years ago

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.4.13...v3.4.15

typia - v3.4.11

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.

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.4.10...v3.4.11

typia - v3.4.9

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

What's Changed

New Contributors

Full Changelog: https://github.com/samchon/typia/compare/v3.4.7...v3.4.9

typia - v3.4.7

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.

What's Changed

Full Changelog: https://github.com/samchon/typia/compare/v3.3.44...v3.4.7

typia - v3.3.44

Published by samchon almost 2 years ago

What's Changed

Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.43...v3.3.44

typia - v3.3.43

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

What's Changed

Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.42...v3.3.43

typia - v3.3.42

Published by samchon almost 2 years ago

What's Changed

Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.41...v3.3.42

typia - v3.3.41

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()

What's Changed

Full Changelog: https://github.com/samchon/typescript-json/compare/v3.3.39...v3.3.41

Package Rankings
Top 1.44% on Npmjs.org
Badges
Extracted from project README
GitHub license npm version Downloads Build Status Guide Documents Sponsers