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

182
Vistas
What method(s) does the ts Function interface declare

I recently started learning typescript & angular and then, I came across a short code like this interface transform extends Function{ (param:string):string; }

So I'm wondering, what kind of methods or return types the transform interface inherited from the Function interface? Again if I decide to have a method that returns transform like so: coordinate ():transform { }, what are the types expected of coordinate to return aside string?

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

0

extends Function adds Function methods like call apply etc... and also the Function behavior, but it's redundant as you have a function definition inside the interface:

interface ExtendedFunction extends Function { }

declare const extendedFunction: ExtendedFunction;

extendedFunction.apply // Works
extendedFunction('bla', 1, true); // Works

interface Transform {
  (param: string): string;
}

declare const transform: Transform;

transform.apply // Works
transform('bla', 1, true) // Fails
transform('bla') // Works

TypeScript playground

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