Git Product home page Git Product logo

typescript-needs-types's People

Contributors

akutruff avatar beenotung avatar benjd90 avatar decs avatar donflopez avatar edobrb avatar hellerve avatar hookyns avatar ianobermiller avatar marcj avatar michallytek avatar mirek avatar rezonant avatar rjrodger avatar ryoppippi avatar smichel17 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

typescript-needs-types's Issues

superstruct

Superstruct https://docs.superstructjs.org/ often gets overlooked because it wasn't picked up by large frontend libraries. It's been around longer than some of the popular options today like Zod and Yup and offers better speed in a smaller package in most circumstances.

One Typescript Transformer to run them All

Discussion: One Typescript Transformer to run them All

Hello, I been reading a bit after discovering the typescript-needs-types repo and Looks like the TS team will never emit type data to be used at runtime.

There are currently 2 approaches to solve validation which i suppose is the main use case.
1 - Libraries that that declare an schema and then infer a type from that schema. i.e: zod, valibot, etc...
2 - Libraries that use Typescript Transformers to read the AST and either modify the js output or emit type metadata.

As the TS team would never emit types metadata Think we could identify the libraries that use Typescript Transformers and create a single package that suits every current existing library requirements and use that single one instead duplicated efforts. (Just for the part that parses the AST and eemits code or metadata)

I've personally have investigated two libraries that uses typescript transformers, Typia and Deepkit (from what I can see these two are that mayor players using typescript transformers).
These two as well have different approaches. Typia emmits custom validation functions while Deepkit emits bytecode representing the type metadata.

Maybe we could create a well documented package that boths emits metadata and use a visitor pattern or similar so can emit custom code when traversing the AST, this would cover both typia and deepkit requirement and would be the base for any other project trying to achieve something similar.

We would nne to chat with @samchom and @marcj and check if they are up to the task. I'm not that expert on using the AST but happy to collaborate on what i can ๐Ÿ‘

Note I've opened this same Issue in the involved repos:

Another library - tst-reflect

I just want to inform you about the existence of another reflection system I have been working on. tst-reflect

It's quite complex project, the most advanced IMHO. It handles almost all the types (even unions, intersections of types) and collects all their information (constructors, methods and their parameters and types, their overloads, properties, access modifier, accessors, decorators, inheritance information and much more) and it has runtime generic types which really works!
It is Object Oriented and inspired by C#'s reflection.

It has no extra features like automatic type-guards etc.. it is clear reflection emitting Type class instances which should be de facto standard. A lot of packages can be built on top of that.

Yet another new library: rutypi

Hey,
I just wanted to give you a heads up that there is a new runtime type info/validation library:
https://github.com/WolverinDEV/rutypi

Rutypi is a library which allows you to automatically export type information for runtime usage.
Additionally, it provides a mechanism to check if an object matches it's declared type out of the box.
It currently works with webpack 5 (single compile and watch mode!) and ts-loader for TypeScript version 4.

The aim is to provide most possible accurate type information to validate objects against their type declaration (type literals, primitives, interfaces, and enums) without a need for large overhead due to typing information. Type information will only emit if actually needed. On top comes that duplicates (e. g. a globally available/exported type used multiple times) will only be emitted once to ensure minimal bundle size.

Disclaimer:
I'm the author of that library.

Suggestions

Thanks for the project mention and thanks for consolidating all the options out there. It's great to see a list of the community projects all in one place. Great work.

Just a quick thing, would it be possible to rename tsbox to typebox (that's a project I'm maintaining) Also as possible a suggestion, I wonder if it might be good to group projects based on their approach. There are two main approaches that I'm currently aware of.

  • Compile Time Transformations | Build tooling.
  • Type Mapping | Conditional Types.

Having a quick list of available options grouped this way might be helpful for others looking to approach runtime type validation in TypeScript.

Thanks again!

reflec-ts

It's a little bit old, but should still work: https://github.com/pcan/reflec-ts
It's the only project that interacts with the ast in the early stages, so the reflection 'primitives' can be detected and suggested by the compiler even during code editing. My 2c :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.