Typescript Tips
A curated list of awesome 🔥 TypeScript Tips 🔥
If you enjoy TypeScript and really want to use Typesafe, you can check awesome-typesafe
🏠 Homepage
✨ Gitbook
Contents
Tips
Matt Pocock
Wes Bos
Erik Rasmussen
Carlos Caballero
Ankita Kulkarni
Minko Gechev
Cory House
Tomek Sułkowski
Sebastien Lorber
Steve (Builder.io)
StackBlitz
Extending existing types
PackageJson- There are a lot of tools that place extra configurations inside thepackage.jsonfile. You can extendPackageJsonto support these additional configurations.
Built-in types
There are many advanced types most users don't know about.
Partial<T>- Make all properties inToptional.Required<T>- Make all properties inTrequired.Readonly<T>- Make all properties inTreadonly.Pick<T, K>- FromT, pick a set of properties whose keys are in the unionK.Record<K, T>- Construct a type with a set of propertiesKof typeT.Exclude<T, U>- Exclude fromTthose types that are assignable toU.Extract<T, U>- Extract fromTthose types that are assignable toU.NonNullable<T>- ExcludenullandundefinedfromT.Parameters<T>- Obtain the parameters of a function type in a tuple.ConstructorParameters<T>- Obtain the parameters of a constructor function type in a tuple.ReturnType<T>- Obtain the return type of a function type.InstanceType<T>- Obtain the instance type of a constructor function type.Omit<T, K>- Constructs a type by picking all properties from T and then removing K.Uppercase<S extends string>- Transforms every character in a string into uppercase.Lowercase<S extends string>- Transforms every character in a string into lowercase.Capitalize<S extends string>- Transforms the first character in a string into uppercase.Uncapitalize<S extends string>- Transforms the first character in a string into lowercase.
You can find some examples in the TypeScript docs.
Contribute
Contributions welcome! Read the contribution guidelines first.
Twitter to markdown file
Create .envrc and fill the value then Use tweet-to-markdown
# .envrc
export TTM_API_KEY=YOUR_API_KEYThen run the direnv command
direnv allow .And, generate markdown from a twitter url
npx tweet-to-markdown -p notes https://twitter.com/mattpocockuk/status/1509964736275927042\?s\=20\&t\=sA-g5MNM5TPjN6Ozs1qxgAThen save video if available
npx twt-dl-cli@latest https://twitter.com/mattpocockuk/status/1592130978234900484Finally, add the Thread Reader App at the end with below format.
[Thread by @USERNAME on Threadify Reader App](https://threadify.productsway.com/thread/STATUS_ID)NOTE: I have sent a pull request about this step to tweet-to-markdown repository: feat: add Thread Reader App link and the end #19 Might not need this step if this PR is accepted.
Credits
This project is made by community and especially the wonderful people and projects listed in this document
Open Source
sindresorhus/type-fest: for 2 sections (Extending existing type, Built-in types)
kbravh/tweet-to-markdown: A command line tool to convert Tweets to Markdown.
jellydn/threadify-plus: ThreadifyPlus is a simple and easy-to-use tool that helps users read and share Twitter threads with ease. (WIP)
egoist/download-twitter-video : The easiest way to download any Twitter video
Tech Twitter
Author
👤 Huynh Duc Dung
Show your support
Give a ⭐️ if this project helped you!
Stargazers over time
Last updated