Skip to content

Commit 135d37b

Browse files
authored
fix(core): profile decorator (#10476)
1 parent b226066 commit 135d37b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

packages/core/profiling/index.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,10 @@ export function disable() {
177177
}
178178

179179
function profileFunction<F extends Function>(fn: F, customName?: string): F {
180-
return profileFunctionFactory(fn, customName || fn.name);
180+
return profileFunctionFactory<F>(fn, customName || fn.name);
181181
}
182182

183-
const profileMethodUnnamed = (target, key, descriptor) => {
183+
const profileMethodUnnamed = (target: Object, key: symbol | string, descriptor) => {
184184
// save a reference to the original method this way we keep the values currently in the
185185
// descriptor and don't overwrite what another decorator might have done to the descriptor.
186186
if (descriptor === undefined) {
@@ -193,7 +193,7 @@ const profileMethodUnnamed = (target, key, descriptor) => {
193193
className = target.constructor.name + '.';
194194
}
195195

196-
const name = className + key;
196+
const name = className + key?.toString();
197197

198198
//editing the descriptor/value parameter
199199
descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Instance);
@@ -202,7 +202,7 @@ const profileMethodUnnamed = (target, key, descriptor) => {
202202
return descriptor;
203203
};
204204

205-
const profileStaticMethodUnnamed = (ctor, key, descriptor) => {
205+
const profileStaticMethodUnnamed = <F extends Function>(ctor: F, key: symbol | string, descriptor) => {
206206
// save a reference to the original method this way we keep the values currently in the
207207
// descriptor and don't overwrite what another decorator might have done to the descriptor.
208208
if (descriptor === undefined) {
@@ -214,7 +214,7 @@ const profileStaticMethodUnnamed = (ctor, key, descriptor) => {
214214
if (ctor && ctor.name) {
215215
className = ctor.name + '.';
216216
}
217-
const name = className + key;
217+
const name = className + key?.toString();
218218

219219
//editing the descriptor/value parameter
220220
descriptor.value = profileFunctionFactory(originalMethod, name, MemberType.Static);

0 commit comments

Comments
 (0)