SHARE
TWEET

Untitled

a guest Jun 24th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. type Person = {
  2.   email: string
  3.   name: string
  4.   passport: { series: string, number: string } // or just Passport type
  5. }
  6.      
  7. const disabledKeys = {
  8.   email: true,
  9.   passport: {
  10.     series: true
  11.   }
  12. }
  13.      
  14. type DisabledKeys = {
  15.   [key in keyof Person]?: boolean
  16. }
  17.      
  18. type DisabledKeys = { [key in keyof Person]?: boolean } & {
  19.   passport: Record<keyof Passport, boolean>
  20.   foo: number // <---- `foo` isn't a part of Person type
  21. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top