Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

124
Views
Función para ajustar la función y proporcionar una propiedad del objeto

Quiero crear una nueva función a partir de una función inicial, con la función inicial tomando un argumento de un solo objeto y la nueva función tomando el mismo argumento de un solo objeto aparte de los campos poblados. Tengo algo como esto hasta ahora:

 function returnNewFunc<TArg extends { b?: string }>( initialFunc: (arg: TArg) => void ) { const newFunc = (arg: Omit<TArg, "b">) => initialFunc({ ...arg, b: "hello" }); return newFunc } const funcA = ({ b, c }: { b: string; c: string }) => { console.log(b, c); }; const funcB = returnNewFunc(funcA) funcB({c: "test"}) // funcB should have 'c' as the only field in its argument

El problema aquí es que se could be instantiated with a different subtype of constraint , por lo que debo estar haciendo algo mal.

about 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!