Extending tRPC context interface using typescript extends

preview_player
Показать описание
just sharing something I recently learned in typescript.

------------

Рекомендации по теме
Комментарии
Автор

Good job babe! I was late today 😬🏃🏿‍♀️

butwhothehellknows
Автор

in classes/interfaces you can put a ? at the end of the property instead adding undefined does the same thing. Another thing is that interfaces and classes are kinda different (just cause you used it once), and the extends is pretty much everything inheritance is. Everybody hates it with a passion. I'm normally like... if you don't spam it everywhere, in scenarios like this it's a totally fine scenario where it can be used.

fischi
Автор

type NewRouterContext = RouterContext & { abc: stirng }

votienhoang
Автор

Great tip, thanks for sharing.
One question, what VSCode setting / extension are you using to get inline TS errors? :D

danielzaremba
Автор

Hello, I'm one of your subscriber. Few days back I saw your video where you said that you are using AWS & Casandra database I checked the job posting and nearly 70% of the jobs profiles are under AWS, Casandra. Are you planning on teaching those stuff bro? I know mongodb. Could you please list some of the resources to learn those stuff....

vamshikrishnareddy
Автор

1:48, I belive instead of lising all the types, you can just do typeOf MiddlewareFunction.

developerspoot
visit shbcf.ru