{"id":13495125,"url":"https://github.com/typescript-cheatsheets/utilities","last_synced_at":"2026-01-26T21:50:54.797Z","repository":{"id":38693469,"uuid":"184517912","full_name":"typescript-cheatsheets/utilities","owner":"typescript-cheatsheets","description":"a list of typescript helper libraries","archived":false,"fork":false,"pushed_at":"2024-06-26T12:23:49.000Z","size":73,"stargazers_count":806,"open_issues_count":1,"forks_count":33,"subscribers_count":12,"default_branch":"master","last_synced_at":"2025-10-21T18:35:18.931Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/typescript-cheatsheets.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-05-02T03:55:20.000Z","updated_at":"2025-10-21T09:29:59.000Z","dependencies_parsed_at":"2024-11-10T23:30:12.367Z","dependency_job_id":"70176b24-1834-4851-9f2c-bee5824e0180","html_url":"https://github.com/typescript-cheatsheets/utilities","commit_stats":{"total_commits":34,"total_committers":4,"mean_commits":8.5,"dds":0.1470588235294118,"last_synced_commit":"5a1df26a75f05c96a23c06be0dda40e4dbc7fff1"},"previous_names":["typescript-cheatsheets/typescript-utilities-cheatsheet"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/typescript-cheatsheets/utilities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescript-cheatsheets%2Futilities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescript-cheatsheets%2Futilities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescript-cheatsheets%2Futilities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescript-cheatsheets%2Futilities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/typescript-cheatsheets","download_url":"https://codeload.github.com/typescript-cheatsheets/utilities/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/typescript-cheatsheets%2Futilities/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28789118,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-26T21:49:50.245Z","status":"ssl_error","status_checked_at":"2026-01-26T21:48:29.455Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T19:01:31.383Z","updated_at":"2026-01-26T21:50:54.775Z","avatar_url":"https://github.com/typescript-cheatsheets.png","language":null,"funding_links":[],"categories":["Others","miscellaneous"],"sub_categories":[],"readme":"# typescript-utilities-guide\n\na list of typescript helper libraries. advanced guides in `typescript-cheatsheets` will assume knowledge of these and refer people here.\n\nThere is a stage in every TypeScript journey where you struggle getting the types you want and eventually find a lifesaver blogpost like [TypeScript Types You Should Know About](https://xpbytes.com/articles/types-you-should-know-about-typescript/). This cheatsheet accumulates them.\n\n## Automated JS to TS Conversion\n\n- [TypeStat](https://github.com/JoshuaKGoldberg/TypeStat) ([used by Codecademy](https://mobile.twitter.com/JoshuaKGoldberg/status/1159090281314160640))\n- [TypeWiz](https://github.com/urish/typewiz)\n- [js-to-ts-converter](https://github.com/gregjacobs/js-to-ts-converter)\n- [TS-migrate](https://medium.com/airbnb-engineering/ts-migrate-a-tool-for-migrating-to-typescript-at-scale-cd23bfeb5cc) from Airbnb \n- [dts-gen](https://github.com/microsoft/dts-gen) - `dts-gen` is a tool that generates TypeScript definition files (.d.ts) from any JavaScript object.\n\n\nJSON to TS type inference https://jvilk.com/MakeTypes/\n\n## Utility Types\n\nBe familiar with the [Utility Types that ship with TS](https://www.typescriptlang.org/docs/handbook/utility-types.html). On top of that, here are handy Utility Types often used by TS practitioners, with explanation on what they do and how they can help. We will assume knowledge of [mapped types and conditional types](https://mariusschulz.com/blog/series/typescript-evolution) like `Exclude\u003cT, U\u003e` and `ReturnType\u003cT\u003e` but try to build progressively upon them.\n\n\u003e Note: If you are new to conditional types, I highly recommend [DJSheldrick's blogpost and talk on Conditional Types in TypeScript](https://artsy.github.io/blog/2018/11/21/conditional-types-in-typescript/)\n\n\u003cdetails\u003e\n  \u003csummary\u003e\n    \u003ccode\u003eOptionalize\u0026lt;T extends K, K\u0026gt;\u003c/code\u003e: Remove from T the keys that are in common with K\n  \u003c/summary\u003e\n  \n```ts\n/**\n * Remove from T the keys that are in common with K\n */\ntype Optionalize\u003cT extends K, K\u003e = Omit\u003cT, keyof K\u003e;\n```\n  \n  An example usage is in our HOC section below.\n  \n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\n    \u003ccode\u003eNullable\u0026lt;T\u0026gt;\u003c/code\u003e or \u003ccode\u003eMaybe\u0026lt;T\u0026gt;\u003c/code\u003e: Make a Type into a Maybe Type\n  \u003c/summary\u003e\n  \n```ts\n/**\n * Make a Type into a Maybe Type\n */\ntype Nullable\u003cT\u003e = T | null\ntype Maybe\u003cT\u003e = T | undefined\n```\n\nYour choice of `null` or `undefined` depends on your approach toward missing values. Some folks feel strongly one way or the other.\n\n\u003c/details\u003e\n\u003cdetails\u003e\n  \u003csummary\u003e\n    \u003ccode\u003eDictionary\u0026lt;T\u0026gt;\u003c/code\u003e: Dictionary of string, value pairs\n  \u003c/summary\u003e\n  \n```ts\n/**\n * Dictionary of string, value pairs\n */\ntype Dictionary\u003cT\u003e = { [key: string]: T }\n```\n\n`[key: string]` is a very handy trick in general. You can also modify dictionary fields with [Readonly](https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html) or make them optional or Omit them, etc.\n\n\u003c/details\u003e\n\nThere also exist helper type libraries:\n\n- [utility-types](https://github.com/piotrwitek/utility-types)\n- [type-zoo](https://github.com/pelotom/type-zoo)\n- 🌟 [ts-toolbelt](https://github.com/pirix-gh/ts-toolbelt) ([Reddit](https://www.reddit.com/r/typescript/comments/c2nq7k/higher_type_safety_for_typescript_with_tstoolbelt/))\n- [typesafe-actions](https://github.com/piotrwitek/typesafe-actions)\n- [type-fest](https://github.com/sindresorhus/type-fest)\n- [tsdef](https://github.com/joonhocho/tsdef)\n- [rex-tils](https://github.com/Hotell/rex-tils)\n- [tiny-types](https://github.com/jan-molak/tiny-types)\n- [ts-essentials](https://github.com/krzkaczor/ts-essentials)\n\nseriously, check some of these out, they represent a ton of accumulated typescript experience.\n\n## Type Testing\n\n- https://github.com/SamVerschueren/tsd: Check TypeScript type definitions\n- https://github.com/aikoven/typings-tester#readme\n- https://github.com/ikatyang/dts-jest\n- https://github.com/SamVerschueren/tsd\n- https://github.com/azz/jest-runner-tsc\n- https://github.com/dsherret/conditional-type-checks\n  * `IsNullable\u003cT\u003e` - Checks if `T` is possibly `null` or `undefined`.\n  * `IsExact\u003cT, U\u003e` - Checks if `T` exactly matches `U`.\n  * `Has\u003cT, U\u003e` - Checks if `T` has `U`.\n  * `NotHas\u003cT, U\u003e` - Checks if `T` does not have `U`.\n  * `IsAny\u003cT\u003e` - Checks if `T` is the `any` type.\n  * `IsNever\u003cT\u003e` - Checks if `T` is the `never` type.\n  * `IsUnknown\u003cT\u003e` - Checks if `T` is the `unknown` type.\n- https://github.com/microsoft/dtslint ([Intro to dtslint](https://www.youtube.com/watch?v=nygcFEwOG8w\u0026feature=share))\n\n## TypeScript Plugins\n\nYou can write plugins to modify typescript syntax itself. this is ADVANCED and not exactly recommended but here are some examples if you need them:\n\n- https://github.com/rimeto/ts-optchain/\n\n## types to runtime\n\n\n- https://github.com/gcanti/io-ts Runtime type system for IO decoding/encoding\n- https://github.com/nokia/ts-serialize-closures\n- https://github.com/YousefED/typescript-json-schema Generate json-schemas from your Typescript sources.\n\n## Misc\n\n- [sourcegraph chrome extension](https://chrome.google.com/webstore/detail/sourcegraph/dgjhfomjieaadpoljlnidmbgkdffpack?hl=en) - hover over types in GitHub and jump to definition/references\n- https://github.com/urish/typewiz Automatically discover and add missing types in your TypeScript code\n- https://github.com/microsoft/rushstack/tree/master/apps/api-extractor\n- You can find more [recommended TS config here](https://github.com/tsconfig/bases). \n- ts-prune - Find dead code and dead types in your project https://effectivetypescript.com/2020/10/20/tsprune/\n- The \"Loose autocomplete\" trick: https://twitter.com/mpocock1/status/1506607945445949446?s=20\u0026t=b1oRUmqyj51vZAQH6FwTNg\n- crazy TS things for science\n  - https://github.com/ronami/meta-typing\n  - https://twitter.com/buildsghost/status/1301976526603206657\n  - https://github.com/ronami/typelang\n\n\n\nAPI Extractor provides an integrated, professional-quality solution for all these problems. It is invoked at build time by your toolchain and leverages the TypeScript compiler engine to:\n\n- Detect a project's exported API surface\n- Capture the contracts in a concise report designed to facilitate review\n- Warn about common mistakes (e.g. missing exports, inconsistent visibility, etc.)\n- Generate \\*.d.ts rollups with trimming according to release type\n- Output API documentation in a portable format that's easy to integrate with your content pipeline\n\nexample https://github.com/framer/api-docs/tree/master/api \n\n## documentation\n\n- https://github.com/phryneas/remark-typescript-tools\n\n* it transpiles TypeScript code examples to JavaScript\n* it typechecks your TypeScript code examples\n* it allows you to include Docblocks from your sourcecode\n\nhttps://twitter.com/phry/status/1302662810707660801?s=20\n\n## monorepo build tooling\n\n- https://rushstack.io/ - Specific strategy that integrates popular tools like NodeJS, TypeScript, ESLint, Prettier, Webpack, Jest for large scale monorepos from Microsoft\n- https://nx.dev/react/guides/js-and-ts - Nx is a general-purpose build system and a general-purpose CLI. It works with JavaScript, TypeScript, Java, C#, Go, etc.. The core plugins Nx comes with do work best with JavaScript or TypeScript.\n- https://blog.mgechev.com/2018/11/19/introduction-bazel-typescript-tutorial/ - Bazel is a powerful tool which can keep track of the dependencies between different packages and build targets. For simplicity, we can think of a build target as a build rule - for example, “build a TypeScript library”\n\n\n## Codegen from TypeScript\n\n- https://github.com/yousefed/typescript-json-schema\n- https://github.com/apollographql/apollo-tooling/tree/master/packages/apollo-codegen-typescript\n\n## Data Structures\n\nhttps://github.com/basarat/typescript-collections\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescript-cheatsheets%2Futilities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftypescript-cheatsheets%2Futilities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftypescript-cheatsheets%2Futilities/lists"}