@@ -2,10 +2,9 @@ import type * as ts from 'typescript';
22import { Performance } from '../../profile/Performance' ;
33
44interface 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
1110function 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