Advanced Cheatsheet
This Advanced Cheatsheet helps show and explain advanced usage of generic types for people writing reusable type utilities/functions/render prop/higher order components and TS+React libraries.
- It also has miscellaneous tips and tricks for pro users.
- Advice for contributing to DefinitelyTyped
- The goal is to take full advantage of TypeScript.
Creating React + TypeScript Libraries
The best tool for creating React + TS libraries right now is tsdx
. Run npx tsdx create
and select the "react" option. You can view the React User Guide for a few tips on React+TS library best practices and optimizations for production.
Another option is Rollpkg, which uses Rollup and the TypeScript compiler (not Babel) to create packages. It includes default configs for TypeScript, Prettier, ESLint, and Jest (setup for use with React), as well as Bundlephobia package stats for each build.
- Be sure to also check
basarat
's guide for library tsconfig settings. - Alec Larson: The best Rollup config for TypeScript libraries
- From the Angular world, check out https://github.com/bitjson/typescript-starter