Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

177
Vistas
TypeScript Convert string union type to number union type

Is it possible to convert string union type to number union type in TypeScript?

e.g. Given a union type A:

type A = '7' | '8' | '9'

Convert to:

type B = 7 | 8 | 9

The numbers in A can be any number, not just digits or integers.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Going from string to number is not possible, as far as I know. However, how about the other way around, would that work for you? You can do this by using template literals:

type B = 7 | 8 | 9;

type A = `${B}`; 

Playground Link

about 4 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 Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda