u/oxy1sin r/typescript • Recommends
On “Newbie TS Question”
check out this vid it might be what you want, if you need the type to change based on a property: link to this video
#typescript#react#conditionaltypes
174K subscribers • 1 video on Hallway
Intermediate. Assumes working knowledge.
234K views3 years ago2 recommendations
Programming languagesWeb developmentTypeScriptReact
Josh explains how to conditionally include types in TypeScript, which is especially useful for defining dynamic React component props.
This TypeScript trick to conditionally include types is so useful, especially for React props. I've asked myself how this is done many times before, and it's just really cool to learn something so simple yet useful. -- links Discord: discord.gg/4vCRMyzgA5 My GitHub: github.com/joschan21What people say. Recommended for developers who need to change a component's type based on the value of a specific property.
u/oxy1sin r/typescript • Recommends
On “Newbie TS Question”
u/cardyetin r/typescript • Recommends
On “How do I make sure that data is of type URL or Code only if action is of value URL or Code?”