Skip to content

Commit 4b0c77a

Browse files
authored
fix: make performance API compatible with TypeScript 5
Fixes #797 by removing ts performance logging (#803)
1 parent b4f7201 commit 4b0c77a

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

src/typescript-reporter/profile/TypeScriptPerformance.ts

+5-16
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import type * as ts from 'typescript';
22
import { Performance } from '../../profile/Performance';
33

44
interface TypeScriptPerformance {
5-
enable(): void;
6-
disable(): void;
7-
mark(name: string): void;
8-
measure(name: string, startMark?: string, endMark?: string): void;
5+
enable?(): void;
6+
disable?(): void;
7+
forEachMeasure?(callback: (measureName: string, duration: number) => void): void;
98
}
109

1110
function getTypeScriptPerformance(typescript: typeof ts): TypeScriptPerformance | undefined {
@@ -20,27 +19,17 @@ function connectTypeScriptPerformance(
2019
const typeScriptPerformance = getTypeScriptPerformance(typescript);
2120

2221
if (typeScriptPerformance) {
23-
const { mark, measure } = typeScriptPerformance;
2422
const { enable, disable } = performance;
2523

26-
typeScriptPerformance.mark = (name) => {
27-
mark(name);
28-
performance.mark(name);
29-
};
30-
typeScriptPerformance.measure = (name, startMark, endMark) => {
31-
measure(name, startMark, endMark);
32-
performance.measure(name, startMark, endMark);
33-
};
34-
3524
return {
3625
...performance,
3726
enable() {
3827
enable();
39-
typeScriptPerformance.enable();
28+
typeScriptPerformance.enable?.();
4029
},
4130
disable() {
4231
disable();
43-
typeScriptPerformance.disable();
32+
typeScriptPerformance.disable?.();
4433
},
4534
};
4635
} else {

0 commit comments

Comments
 (0)