https://github.com/akutruff/typescript-needs-types Skip to content Toggle navigation Sign up * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Case Studies + Customer Stories + Resources * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. {{ message }} akutruff / typescript-needs-types Public * Notifications * Fork 11 * Star 275 TypeScript please give us types. www.typescriptneedstypes.com License MIT license 275 stars 11 forks Star Notifications * Code * Issues 7 * Pull requests 4 * Discussions * Actions * Projects 0 * Wiki * Security * Insights More * Code * Issues * Pull requests * Discussions * Actions * Projects * Wiki * Security * Insights akutruff/typescript-needs-types This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main Switch branches/tags [ ] Branches Tags Could not load branches Nothing to show {{ refName }} default View all branches Could not load tags Nothing to show {{ refName }} default View all tags Name already in use A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch? Cancel Create 2 branches 0 tags Code * Local * Codespaces * Clone HTTPS GitHub CLI [https://github.com/a] Use Git or checkout with SVN using the web URL. [gh repo clone akutru] Work fast with our official CLI. Learn more about the CLI. * Open with GitHub Desktop * Download ZIP Sign In Required Please sign in to use Codespaces. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching GitHub Desktop If nothing happens, download GitHub Desktop and try again. Launching Xcode If nothing happens, download Xcode and try again. Launching Visual Studio Code Your codespace will open once ready. There was a problem preparing your codespace, please try again. Latest commit @akutruff akutruff Update README.md ... 5e8ea4c Jul 8, 2023 Update README.md 5e8ea4c Git stats * 65 commits Files Permalink Failed to load latest commit information. Type Name Latest commit message Commit time CNAME Create CNAME January 22, 2021 14:29 LICENSE Initial commit January 22, 2021 10:47 README.md Update README.md July 8, 2023 00:48 _config.yml Set theme jekyll-theme-slate January 22, 2021 14:09 index.md update index.md August 11, 2022 14:36 View code TypeScript Needs to Emit Runtime Type Information The Unfortunate List of Projects Working Around this Issue Type Mapping Projects Code Generation / External Tool Projects Adapter Projects The Problem README.md TypeScript Needs to Emit Runtime Type Information * The Problem * The 7 year old Github issue The Unfortunate List of Projects Working Around this Issue Type Mapping Projects Project Stars io-ts GitHub stars zod GitHub stars redux-orm GitHub stars runtypes GitHub stars class-transformer GitHub stars class-validator GitHub stars ow GitHub stars reflect-metadata GitHub stars typebox GitHub stars myzod GitHub stars morphic-ts GitHub stars monocle-ts GitHub stars ts.validator GitHub stars tson-schema GitHub stars json-type-validation GitHub stars class-transformer-validator GitHub stars typescript-schema GitHub stars ts-brand GitHub stars narrows GitHub stars cleaners GitHub stars yup GitHub stars joi GitHub stars TypeGraphQL GitHub stars Deepkit GitHub stars Gubu GitHub stars typescript-rtti GitHub stars Code Generation / External Tool Projects Project Stars ts-morph GitHub stars typescript-json-schema GitHub stars typescript-is GitHub stars tsnameof GitHub stars ts-auto-guard GitHub stars ts-validate-type GitHub stars tsmirror GitHub stars typeonly GitHub stars ts-runtime GitHub stars ts-di-transformer GitHub stars typson GitHub stars ts-json-schema-generator GitHub stars ts-type-checked GitHub stars tst-reflect GitHub stars ttype-safe GitHub stars Please send a PR to add to this list. Even if it's your own project and it has zero stars, you had to deal with this, so it goes on the list. Adapter Projects Project Stars typeschema GitHub stars The Problem Dear TS team, I love you. You do amazing work. You are gods among mortals. You have brought JavaScript from the darkness, and given it the warm light of strong typing. Look upon us, the cowering meek masses, and understand that we live in the muck and mire of a world where we are doomed to endlessly crawl on our bellies through the alleys of Github seeking the one true npm. We will forever wander in the dark, until we have a type reflection model. Serialization and validation without a reflective type system just doesn't work in the real world without endless boilerplate, or shiver , bespoke code generation from a schema file. The best solutions I could find are io-ts, zod, etc. The ever growing list above. The most courageous of us even resort to babel, but only to face the consequences. Someone even wrote a new language extending TypeScript to work around this. We have to declare our types in a round about library-bespoke way that is foreign to the uninitiated, and the libraries aren't even able to support all the wonderful type magic you work so hard to provide. This is a case, where we urge you to take a step back and holistically look at what TypeScript users have to do to in the majority of modern projects, and list them out in priority order. The decision of how to tackle serialization, and what actually has to be done to have TypeScript still work with it is at the top of the list. Even if you still don't want to support reflection, please write a detailed doc, and put it in the official TypeScript documentation that explains how TypeScript users should tackle this problem or what library you recommend, so we don't have endlessly reinvent the wheel. There seems to be a conflict between the design goals of TypeScript that is blocking this for some reason. Type erasure is good! It means JavaScript projects can consume TypeScript projects without any knowledge of TypeScript. It's just emitted JavaScript. This does not mean you can't emit the type information in a consumable lookup table that's separate from the code. The lack of this type information means we use esoteric libraries which ultimately pollute the JavaScript with all the convoluted typing workarounds... soo... type erasure has defeated the purpose of type erasure. It's a second order effect, where the design goal defeats the design goal. :( Side note, please don't solve this with decorators. A lot of us want to use interfaces. Decorators, like C# attributes are so coupling, and we can't add them to types from other libraries. A higher order function that's known to the compiler like: typescript.generateRuntimeType() with options for discriminators etc. means it would even work with external libs. Something like F# Type Providers, or C# Source Generators would also be welcome. Last thing. If you do this, I will send you cake. If it's in TypeScript 4.3, there will be ice-cream. Love, A humble disciple ATTN: @ahejlsberg About TypeScript please give us types. www.typescriptneedstypes.com Topics typescript schema strongly-typed runtime-verification Resources Readme License MIT license Stars 275 stars Watchers 8 watching Forks 11 forks Report repository Releases No releases published Packages 0 No packages published Contributors 12 * @akutruff * @decs * @Hookyns * @rjrodger * @rezonant * @marcj * @donflopez * @ianobermiller * @smichel17 * @hellerve * @BenjD90 * @MichalLytek Footer (c) 2023 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact GitHub * Pricing * API * Training * Blog * About You can't perform that action at this time.