摘要:
Create a SnakeCase<T> generic that turns a string formatted in camelCase into a string formatted in snake_case. A few examples: type res1 = SnakeCase< 阅读全文
摘要:
Let's say we want to extract query param from string: type UserPath = "/users/:id"; type UserOrganisationPath = "/users/:id/organisations/:organisatio 阅读全文
摘要:
We start with a Values interface: interface Values { email: string; firstName: string; lastName: string; } We want a union of tuple [key, value]as res 阅读全文
摘要:
We have a type Route that is a discriminated union of the possible routes in the application. Each route has the properties search and route type Rout 阅读全文
摘要:
Let's say we have: type Fruit = "apple" | "banana" | "orange"; We only want AppleOrBanana If we do as such: type Fruit = "apple" | "banana" | "orange" 阅读全文
摘要:
Let's imagine you're building a type helper to extract out the value from several different 'parsers'. const parser1 = { parse: () => 1, }; const pars 阅读全文