• Jobs
  • About Us
  • professionals
    • Home
    • Jobs
    • Courses and challenges
    • Questions
    • Teachers
  • business
    • Home
    • Post vacancy
    • Our process
    • Pricing
    • Assessments
    • Payroll
    • Blog
    • Sales
    • Salary Calculator

0

141
Views
What is this format in javascript or typescript?

What is this format in javascript or typescript? I couldn't find any info.

  1. export type XXX<> = | true (= |)

  2. $ReadOnly (meanings)

  3. <{| ... |}>

export type AttributeType<T, V> =
  | true
  | $ReadOnly<{|
      diff?: (arg1: T, arg2: T) => boolean,
      process?: (arg1: V) => T,
    |}>;
almost 3 years ago · Juan Pablo Isaza
2 answers
Answer question

0

  1. The code is a typescript.
  2. The $ReadOnly Prefix is used to make a property read-only. Read-only members can be accessed outside the class, but their value cannot be changed. Since read-only members cannot be changed outside the class, they either need to be initialized at the declaration or initialized inside the class constructor.
  3. The | part is making the rest as a union, so it only returns the true or read-only . In the read only return , the diff will be identified as boolean | undefined; and process will be identified as type | undefined; Since all values has a default value of undefined, the compiler won't complain that process or diff is not assigned.
almost 3 years ago · Juan Pablo Isaza Report

0

I found it... Facebook use 'flow'. (no typescript) https://flow.org/en/

almost 3 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Our process Sales
Legal
Terms and conditions Privacy policy
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recommend me some offers
I have an error