typescript-is
nestia
typescript-is | nestia | |
---|---|---|
9 | 38 | |
951 | 1,627 | |
- | - | |
4.2 | 9.6 | |
10 months ago | 3 days ago | |
TypeScript | TypeScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
typescript-is
- Good bye "typescript-is" (ancestor of "typia", 20,000x faster validator)
-
Typing for JSON Payloads
I'll throw https://github.com/woutervh-/typescript-is in the mix as well.
-
Handling json input in an express app
I'm a fan of typescript-is. Provides both compile time and run time validations
-
What can I *use* Rust for?
For what it's worth, thanks to TypeScript transformers (a feature baked into the compiler), one can create a transformer library that verifies an object is valid for any TypeScript type and conveys that information to the typechecker. And indeed, it's already been made. It allows to parse unknown into a given T. This is nice, because one can generate a JSON schema out of a TS type, for other languages/codebases to integrate safely.
-
Do you use code generators? If so, which ones?
But to make it worth the comment, I’ll point people to typescript-is which uses transformations at compile-time to generate run-time type checking code.
-
TypeScript runtime type-checking - designed for simple use, through to enforcing API payload schema
Then there's also typescript-is, which is pretty neat because it converts actual compile-time type definitions to runtime type checks, so it doesn't require changing the type definitions.
-
JSON Schema === Runtime Type System for TypeScript
typescript-is. This uses a compile-time transformer to generate code for type-checking. You'll need to use ttypescript instead of typescript to compile your code (I recommend setting this up with ts-patch). It won't work if your build pipeline is actually using something like esbuild or Babel to transpile TS->JS.
-
How an Anti-TypeScript “JavaScript developer” like me became a TypeScript fan
If you're not using a bunch of generics, check out typescript-is [1]. It takes little work to get it setup, but it generates run time type checks for you. I understand why typescript decided to not add this functionality to the core of the language, but it's starting to feel like the largest missing piece of typescript is a built-in way to generate run-time type-checks for user-defined types from just the type definition.
The happy medium we've found with that module is using the runtime type-check on anything "unsafe" to bless the result using typescript-is's equals functionality, but still allowing programmers to use casting with a comment justifying its necessity. For us our list of unsafe is results pulled from the db, anything parsed from JSON, and incoming request bodies (which can be a special case of parsing from JSON, but not always).
[1]: https://github.com/woutervh-/typescript-is
nestia
-
I made Swagger/OpenAPI type definitions and converter library
However, lacking of typia and nestia libraries is obvious. If you also need detailed Swagger/OpenAPI spec like me, but you need more detailed types/properties, or found something missed, please take a contribution.
-
I made "TypeScript Swagger Editor", new type of Swagger UI writing TypeScript code in the browser
For reference, if your backend application utilizes nestia (NestJS), you don't need to build the SDK (Software Development Kit) library by converting from the Swagger Documents. The nestia will automatically generate the much advanced SDK library, just by analyzing your backend application's source code.
-
[Typia] I made Protocol Buffer library of TypeScript, easiest in the world
Also, I'd introduced my another library nestia, which utilizes typia in the NestJS framework, so that boosts up backend server performance 30x up. And since typia analyzes the NestJS backend source code at the compiler level, I also provided convenient generators such as SDK and Mockup Simulator.
-
Good bye "typescript-is" (ancestor of "typia", 20,000x faster validator)
nestia: https://github.com/samchon/nestia
-
Migration tool from Swagger to NestJS - SDK generator and Mockup simulator for every backend stacks
/** * @controller BodyController.post() * @path POST /body * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function post( connection: IConnection, body: IBbsArticle.IStore, ): Promise { return !!connection.simulate ? post.simulate( connection, body, ) : Fetcher.fetch( connection, post.ENCRYPTED, post.METHOD, post.path(), body, ); } export namespace post { export type Input = IBbsArticle.IStore; export type Output = IBbsArticle;
-
[Nestia] I made backend simulator for frontend developers (similar with MSW, but fully automated)
When you build backend simulator of nestia, nestia analyzes your backend server source codes, and writes fake scripts simulating the NestJS backend server. The simulator even includes request data validator and random mock-up data generator.
-
[NestJS] I made backend server simulator without backend server
/** * @packageDocumentation * @module api.functional.bbs.articles * @nestia Generated by Nestia - https://github.com/samchon/nestia */ //================================================================ import { Fetcher } from "@nestia/fetcher"; import type { IConnection } from "@nestia/fetcher"; import typia from "typia"; import { NestiaSimulator } from "./../../../utils/NestiaSimulator"; import type { IBbsArticle } from "./../../../structures/IBbsArticle"; /** * Update an article. * * @param section Section code * @param id Target article ID * @param input Content to update * @returns Updated content * * @controller BbsArticlesController.update() * @path PUT /bbs/:section/articles/:id * @nestia Generated by Nestia - https://github.com/samchon/nestia */ export async function update( connection: IConnection, section: string, id: string, input: update.Input, ): Promise { return !!connection.random ? update.simulate( connection, section, id, input, ) : Fetcher.fetch( connection, update.ENCRYPTED, update.METHOD, update.path(section, id), input, ); } export namespace update { export type Input = IBbsArticle.IStore; export type Output = IBbsArticle; export const METHOD = "PUT" as const; export const PATH: string = "/bbs/:section/articles/:id"; export const ENCRYPTED: Fetcher.IEncrypted = { request: false, response: false, }; export const path = (section: string, id: string): string => { return `/bbs/${encodeURIComponent(section ?? "null")}/articles/${encodeURIComponent(id ?? "null")}`; } export const random = (g?: Partial): Output => typia.random(g); export const simulate = async ( connection: IConnection, section: string, id: string, input: update.Input, ): Promise => { const assert = NestiaSimulator.assert({ method: METHOD, host: connection.host, path: path(section, id) }); assert.param("section")("string")(() => typia.assert(section)); assert.param("id")("uuid")(() => typia.assert(id)); assert.body(() => typia.assert(input)); return typia.random( typeof connection.random === 'object' && connection.random !== null ? connection.random : undefined ); } }
-
[Nestia] Make NestJS 30x faster with fastify
For reference, you can run the benchmark program on your computer by following below commands. After the benchmark, a report would be issued under nestia/benchmark/results/{YOUR-CPU-NAME} directory. If you send the result PR on my repo (https://github.com/samchon/nestia), I'd pleasure and appreciate it even more.
-
[Nestia] I made automatic e2e test functions generator for NestJS
I made automatic e2e test functions generator for NestJS, corresponding to every API endpoints. Just setup nestia following the guide documents, and run npx nestia e2e comnand, then you can get the automatically generated e2e functions.
- Nestia, make NestJS super-fast and super-easy
What are some alternatives?
runtypes - Runtime validation for static types
Nest - A progressive Node.js framework for building efficient, scalable, and enterprise-grade server-side applications with TypeScript/JavaScript 🚀
class-transformer - Decorator-based transformation, serialization, and deserialization between objects and classes.
typia - Super-fast/easy runtime validations and serializations through transformation
class-validator - Decorator-based property validation for classes.
GraphQL-NestJS-MongoDB-TypeScript-Tutorial - A GraphQL API build on top of NextJS
typebox - Json Schema Type Builder with Static Type Resolution for TypeScript
trpc-fe-boilerplate-next - ⚒️ Minimal tRPC frontend Nextjs boilerplate for separate BE-FE repositories. Easily consume fully typesafe APIs.
ts-node - TypeScript execution and REPL for node.js
typescript-starter - Quickly create and configure a new library or Node.js project
zod - TypeScript-first schema validation with static type inference
blockfrost-js - Node.js SDK for the Blockfrost.io API.