Can I have a TS type that picks only the properties of an object that are optional or undefined and makes them required?
system
kya mere paas ek ts prakaar ho saktaa he jo keval ek vastu ke gunon ko chunata he jo vaikalpik yaa aparibhaashit hai or unhen aavashyak banaata he?
user
yahaan ek tipscript prakaar he jo kisi object se vaikalpik or aparibhaashit gunon ko chunegaa or unhen aavashyak bana degaa:
Type makeOptionalRequired <t> = aavashyak <{[k in keyof {[k in keyof t ke rup main aparibhaashit t [k] kaa vistaar hota he?K: kabhi nahin]-?: K}]: baahar <t [k], aparibhaashit>}>;
assistant
<|system|>
</s>
<|user|>
kya mere paas ek ts prakaar ho saktaa he jo keval ek vastu ke gunon ko chunata he jo vaikalpik yaa aparibhaashit hai or unhen aavashyak banaata he?</s>
<|assistant|>
yahaan ek tipscript prakaar he jo kisi object se vaikalpik or aparibhaashit gunon ko chunegaa or unhen aavashyak bana degaa:
Type makeOptionalRequired <t> = aavashyak <{[k in keyof {[k in keyof t ke rup main aparibhaashit t [k] kaa vistaar hota he?K: kabhi nahin]-?: K}]: baahar <t [k], aparibhaashit>}>;</s>
