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

161
Vistas
Typescript Angular - Recieving Type is missing following properties from type

So I'm trying to setup a model and keep getting the mentioned area. Screenshots attached show my syntax - I assumed it was an error from not passing the 'name' , 'amount' but in my array I give two new values with both of those.

EDIT - Can' post images so code below.

  ingredients: Ingredient = [
new Ingredient ('Apples', 5),
new Ingredient ('Tomatos', 10)];
export class Ingredient{

constructor(public name: string, public amount: number){ }}
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

The way you're declaring it "ingredients" variable should be an ingredient and not an array/list of ingredients.

So:

const ingredient: Ingredient = new Ingredient ('Apples', 5)

or

const ingredients: Ingredient[] = [
  new Ingredient ('Apples', 5),
  new Ingredient ('Tomatos', 10)
];

To specify an array type you can also use:

const ingredients: Array<Ingredient> = [...]
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