Thanks for sharing this as it helps me wrap my head around working with keys and template literals in typescript. I'm good with intermediate to advanced difficulty stuff since beginner stuff is oversaturated.
I used something similar to create transient props for styled components /** * Represents a type where each key of an object is prefixed with `$`. * Useful for representing transient props in styled components. * */ export type TransientProps = { [K in keyof T as `$${string & K}`]: T[K] }
yea i thought so too. you can do a lot of stuff with typescript ..code gymnastics....but is it any useful in a rela life application? in 99% of all cases I would say no, because any other simpler solution will do the job and will be easier to maintain and to adjust. It is the same with rxjs operators..you can write a 50 lines rxjs pipe which does the same as a pipe with maybe 2 used rxjs operators...
Thanks for sharing this as it helps me wrap my head around working with keys and template literals in typescript. I'm good with intermediate to advanced difficulty stuff since beginner stuff is oversaturated.
Cool, I recently started learning typescript more deeply. It helps a lot
Can’t wait for your next video!
Where can we find more challanges like that?
Typehero.dev is great for them and free!
Are you using a VSCode extension to show the type preview with the comment „// ^?“? 😊
Yep, it’s this one marketplace.visualstudio.com/items?itemName=Orta.vscode-twoslash-queries
Hello the video was overall helpful . I request that in future you dumb it down more for beginners like me so that it's easily understandable.
Teaching is a skill Im still learning and developing so will keep working on it! Cheers for the feedback.
What are you supposed to do with this exactly? What is a use case?
I used something similar to create transient props for styled components
/**
* Represents a type where each key of an object is prefixed with `$`.
* Useful for representing transient props in styled components.
*
*/
export type TransientProps = {
[K in keyof T as `$${string & K}`]: T[K]
}
Interesting, thanks @@raellawrence7116
Sweet
i understood nothing but it looks really cool
😂 it’s a bit of an advanced/intermediate tip but I am working in my teaching style too!
Where is the power ? You have one type that you transform to an other type ok and then what ? Where do you use it in an actual code ?
Your VSCODE theme?
Github Dark
You know your language is over-engineered and convoluted when you see something like
[Property in keyof Type
as
'get${Capitalize
yea i thought so too. you can do a lot of stuff with typescript ..code gymnastics....but is it any useful in a rela life application? in 99% of all cases I would say no, because any other simpler solution will do the job and will be easier to maintain and to adjust. It is the same with rxjs operators..you can write a 50 lines rxjs pipe which does the same as a pipe with maybe 2 used rxjs operators...