特定の文字列をサジェストした上で全ての文字列を受け付ける LooseAutocomplete
type LooseAutocomplete<T extends string> = T | Omit<string, T>;
🔥 TypeScript Tip #12 🔥
— Matt Pocock (@mpocock1) March 23, 2022
Ever wanted just a _bit_ of autocomplete?
Here, we create a TypeScript helped called LooseAutocomplete which gives us autocomplete while also allowing arbitrary values.
Picked up this tip from @GavinRayDev - worth a follow! pic.twitter.com/IziEdyLWkw