Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
how to convert all optional object fields into non-optional

I have the following Object type in Flow:

type Identity = {
  name: string,
  lastName: string
};

type ExtraInfo = {
   favoriteColor: string,
   age: number
};

type Person = {
   a: Identity,
   b?: ExtraInfo
};

Is there a way to define from Person a type without any maybe type?:

// final result, but I don't want to redeclare all the properties, I want to derive from the Person type
type PersonWithExtraInfo = {
   a: Identity,
   b: ExtraInfo
};

I thought that by applying this would work, but apparently, not. Maybe becuase it's not a maybe type what's defined, but an optional property:

type NonMaybeType = <Type>(Type) => $NonMaybeType<Type>;
export type PersonWithExtraInfo = $ObjMap<Person, NonMaybeType>;
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!