ts-simple-type

Relationship type checker functions for Typescript types. (by justjake)

Ts-simple-type Alternatives

Similar projects and alternatives to ts-simple-type

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a better ts-simple-type alternative or higher similarity.

ts-simple-type reviews and mentions

Posts with mentions or reviews of ts-simple-type. We have used some of these posts to build our list of alternatives and similar projects. The last one was on 2023-08-12.
  • tRPC – Move Fast and Break Nothing. End-to-end typesafe APIs made easy
    30 projects | news.ycombinator.com | 12 Aug 2023
    We use an internal validator library that we infer request types from. It’s similar to Zod (but also predates it by a year).

    I’ve also spent some time on a Typescript type to X compiler. My first prototype is open source and targets Thrift, Proto3, Python, and JSON schema: https://github.com/justjake/ts-simple-type/tree/main/src/com...

    I’m not happy with the design decision in that codebase to try to “simplify” Typescript types before compiling, and probably won’t continue that implementation, but we have a few internal code generators that consume TS types and output test data builders and model clases we use in production.

  • Ezno
    11 projects | news.ycombinator.com | 23 Sep 2022
  • Ultra-minimal JSON schemas with TypeScript inference
    11 projects | news.ycombinator.com | 27 Jul 2022
    After some frustration with the TypeScript schema library ecosystem, I've decided that I'd prefer to declare my types using TypeScript's excellent type syntax, so I can take advantage of generics, mapped types, etc. Then, I'll take those TypeScript types and compile them to whatever alternative schema format I need.

    There are many libraries that claim to convert your Typescript types to other formats, such as ts-json-schema-generator, ts-to-zod, or typeconv/core-types-ts. These libraries work by interpreting the Typescript AST, essentially re-implementing a bare-bones type system from scratch. Most do not support advanced Typescript features like generic application, mapped types, or string literal types. So, what's the point? To avoid those limitations, I use Typescript's first-party ts.TypeChecker API to analyze types, and an existing library called ts-simple-type (which I've forked) to convert from ts.Type to a more usable intermediate format. Then, I recurse over the intermediate format and emit "AST nodes". It's pretty simple, but seems promising.

    So far, I have compilers from TypeScript type to Python 3 and Thrift. But I plan to add OpenAPI/JSONSchema, Protobuf (Proto3), Kotlin, Swift, and maybe Zod and Avro. Each target language is around ~300 LoC so they're pretty easy to put together.

    Repo: https://github.com/justjake/ts-simple-type

    Compiler input and output: https://github.com/justjake/ts-simple-type/blob/jake--compil...

    Thrift compiler: https://github.com/justjake/ts-simple-type/blob/jake--compil...

    Python compiler: https://github.com/justjake/ts-simple-type/blob/jake--compil...

  • A note from our sponsor - WorkOS
    workos.com | 18 Apr 2024
    The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning. Learn more →

Stats

Basic ts-simple-type repo stats
3
35
0.0
12 months ago
The modern identity platform for B2B SaaS
The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.
workos.com