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.json
file. You can extendPackageJson
to support these additional configurations.
Built-in types
There are many advanced types most users don't know about.
Partial<T>
- Make all properties inT
optional.Required<T>
- Make all properties inT
required.Readonly<T>
- Make all properties inT
readonly.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 propertiesK
of typeT
.Exclude<T, U>
- Exclude fromT
those types that are assignable toU
.Extract<T, U>
- Extract fromT
those types that are assignable toU
.NonNullable<T>
- Excludenull
andundefined
fromT
.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
Then run the direnv command
And, generate markdown from a twitter url
Then save video if available
Finally, add the Thread Reader App at the end with below format.
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