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

110
Vistas
Expected 1 arguments, but got 0. TS2554 - Optional Object Properties but not Object?

I believe all the object properties are optional, so I do not fully understand the errors. Because I've made the properties optional, but not the object itself?

Error

Expected 1 arguments, but got 0.  TS2554

    71 |   // Get the claims on the initial page load
    72 |   useEffect(() => {
  > 73 |     fetchClaimDetails();
       |     ^
    74 |   }, []);
    75 | 
    76 |   return (

Component

 interface fetchClaimDetailsQueryParams {
  status?: string | null;
  clientClaimId?: string | null;
}

const fetchClaimDetails = async ({
  clientClaimId = null,
  status = null
}: fetchClaimDetailsQueryParams) => {

......

useEffect(() => {
  fetchClaimDetails();
}, []);
about 4 years ago · Juan Pablo Isaza
2 Respuestas
Responde la pregunta

0

Even if every property of the object are optional, the object itself is required. If you truly want it to be optional, provide a default value of {} as the value for the object.

const fetchClaimDetails = async ({
  clientClaimId = null,
  status = null
}: fetchClaimDetailsQueryParams = {}) => { ... };
about 4 years ago · Juan Pablo Isaza Denunciar

0

Yes. Making the object optional will not fix the error, as the object is being destructured in the parameter list. You need something like this:

const fetchClaimDetails = async (paramsObj: fetchClaimDetailsQueryParams = {
  clientClaimId: null,
  status: null
}) => {
  const {
    clientClaimId,
    status
  } = paramsObject;
}

This should make the parameter optional while providing a valid default value.

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