• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Evaluaciones
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

146
Vistas
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,
    |}>;
about 3 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

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.
about 3 years ago · Juan Pablo Isaza Denunciar

0

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

about 3 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda