measure-fn 3.10.0 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/bench.ts CHANGED
@@ -40,7 +40,7 @@ async function run() {
40
40
  const startNested = performance.now();
41
41
  for (let i = 0; i < ITERATIONS / 10; i++) { // reduce iterations
42
42
  measureSync('root', (m) => {
43
- m('child', (m2) => {
43
+ m('child', (m2: any) => {
44
44
  m2('leaf', noop);
45
45
  });
46
46
  });
package/example.ts CHANGED
@@ -116,7 +116,7 @@ async function bunServeExample() {
116
116
  return new Response(`ok: ${url.pathname}`);
117
117
  },
118
118
  (error) => new Response(`Error: ${(error as Error).message}`, { status: 500 })
119
- ),
119
+ ) as any,
120
120
  });
121
121
 
122
122
  // ✅ Pattern 2: measure.assert — throws on error (sugar for onError + throw)
package/index.test.ts CHANGED
@@ -527,7 +527,7 @@ describe("onError (3rd argument)", () => {
527
527
  throw new Error('not found');
528
528
  }, () => 'fallback');
529
529
  out.restore();
530
- expect(result).toBe('fallback');
530
+ expect(result).toBe('fallback' as any);
531
531
  });
532
532
 
533
533
  test("returns normal result on success (onError ignored)", async () => {
@@ -565,7 +565,7 @@ describe("onError (3rd argument)", () => {
565
565
  throw error;
566
566
  });
567
567
  out.restore();
568
- expect(result).toBe('recovered');
568
+ expect(result).toBe('recovered' as any);
569
569
  });
570
570
 
571
571
  test("still logs error even when onError handles it", async () => {
@@ -774,7 +774,7 @@ describe("custom logger", () => {
774
774
  const events: MeasureEvent[] = [];
775
775
  configure({ logger: (e) => events.push(e) });
776
776
  await measure({ label: "op", budget: 100 }, async () => 1);
777
- expect(events[1].budget).toBe(100);
777
+ expect(events[1]!.budget).toBe(100);
778
778
  });
779
779
  });
780
780
 
package/index.ts CHANGED
@@ -299,7 +299,7 @@ const createMeasureImpl = (prefix?: string, counterRef?: { value: number }, scop
299
299
  const effectiveMaxLen = localMaxLen ?? inheritedMaxLen;
300
300
 
301
301
  const currentId = toAlpha(Number(parentIdChain.pop() ?? 0));
302
- const fullIdChain: string[] = [...parentIdChain.map(String), currentId];
302
+ const fullIdChain: string[] = [...parentIdChain.map(v => String(v)), currentId];
303
303
  const idStr = fullIdChain.join('-');
304
304
 
305
305
  emit({
@@ -361,7 +361,7 @@ const createMeasureImpl = (prefix?: string, counterRef?: { value: number }, scop
361
361
  const effectiveMaxLen = localMaxLen ?? inheritedMaxLen;
362
362
 
363
363
  const currentId = toAlpha(Number(parentIdChain.pop() ?? 0));
364
- const fullIdChain: string[] = [...parentIdChain.map(String), currentId];
364
+ const fullIdChain: string[] = [...parentIdChain.map(v => String(v)), currentId];
365
365
  const idStr = fullIdChain.join('-');
366
366
 
367
367
  if (hasNested) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "module": "index.ts",
4
4
  "main": "./index.ts",
5
5
  "types": "./index.ts",
6
- "version": "3.10.0",
6
+ "version": "3.10.2",
7
7
  "type": "module",
8
8
  "private": false,
9
9
  "description": "Zero-dependency function performance measurement with hierarchical logging",