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

143
Views
¿Cómo contrarrestar el problema de pelusa de llamadas inseguras en este fragmento de código?

Algún desarrollador ha escrito un método cuya estructura se da a continuación.

 export function ClassMethodTracer(className: IMyClass, methodName: string): void { const targetClass: IMyClass = className; const targetMethod: string = methodName; const propertyName = `Custom/${targetClass.name}/${targetMethod}/tracing`; const newMethodName = `Custom${targetClass.name}${targetMethod}`; if (!targetClass.prototype[propertyName]) { targetClass[newMethodName] = targetClass[targetMethod] as IMethod; const transactionName = `Custom/${targetClass.name}/${targetMethod}`; targetClass[targetMethod] = function (...args): LooseObject { return newrelic.startBackgroundTransaction( transactionName, (): LooseObject => (targetClass[newMethodName](...args)) as LooseObject, /* line 12 */ ); }; targetClass.prototype[propertyName] = true; } }

Recibo Unsafe call of an `any` typed value en la línea número 12. ¿Cómo puedo resolver este problema de pelusa (no quiero suprimirlo)?

En el código anterior, podemos ver que hay tres tipos más IMyClass , IMethod y LooseObject cuyas estructuras son las siguientes.

 export interface IMyClass { new (name: string): any; prototype: { newMethod: IMethod; [key:string]: any; }; } export interface IMethod { (...args: any[]): LooseObject; } export interface LooseObject { [key: string]: any; }

No quiero suprimir las advertencias y errores de pelusa y no puedo encontrar ninguna forma de resolver este problema de pelusa.

about 4 years ago · Juan Pablo Isaza
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!