fix(core): profile decorator (#10476)

This commit is contained in:
farfromrefuge
2024-01-19 17:38:29 +01:00
committed by GitHub
parent b226066814
commit 135d37b9ee

View File

@ -177,10 +177,10 @@ export function disable() {
}
function profileFunction<F extends Function>(fn: F, customName?: string): F {
return profileFunctionFactory(fn, customName || fn.name);
return profileFunctionFactory<F>(fn, customName || fn.name);
}
const profileMethodUnnamed = (target, key, descriptor) => {
const profileMethodUnnamed = (target: Object, key: symbol | string, descriptor) => {
// save a reference to the original method this way we keep the values currently in the
// descriptor and don't overwrite what another decorator might have done to the descriptor.
if (descriptor === undefined) {
@ -193,7 +193,7 @@ const profileMethodUnnamed = (target, key, descriptor) => {
className = target.constructor.name + '.';
}
const name = className + key;
const name = className + key?.toString();
//editing the descriptor/value parameter
descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Instance);
@ -202,7 +202,7 @@ const profileMethodUnnamed = (target, key, descriptor) => {
return descriptor;
};
const profileStaticMethodUnnamed = (ctor, key, descriptor) => {
const profileStaticMethodUnnamed = <F extends Function>(ctor: F, key: symbol | string, descriptor) => {
// save a reference to the original method this way we keep the values currently in the
// descriptor and don't overwrite what another decorator might have done to the descriptor.
if (descriptor === undefined) {
@ -214,7 +214,7 @@ const profileStaticMethodUnnamed = (ctor, key, descriptor) => {
if (ctor && ctor.name) {
className = ctor.name + '.';
}
const name = className + key;
const name = className + key?.toString();
//editing the descriptor/value parameter
descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Static);