Skip to content

Commit

Permalink
Work around api-extractor import bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jakebailey committed Sep 13, 2022
1 parent 413881f commit 07f5640
Showing 1 changed file with 33 additions and 1 deletion.
34 changes: 33 additions & 1 deletion src/compiler/perfLogger.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
import { noop } from "./_namespaces/ts";

type PerfLogger = typeof import("@microsoft/typescript-etw");
/** @internal */
interface PerfLogger {
logEvent(msg: string): void;
logErrEvent(msg: string): void;
logPerfEvent(msg: string): void;
logInfoEvent(msg: string): void;
logStartCommand(command: string, msg: string): void;
logStopCommand(command: string, msg: string): void;
logStartUpdateProgram(msg: string): void;
logStopUpdateProgram(msg: string): void;
logStartUpdateGraph(): void;
logStopUpdateGraph(): void;
logStartResolveModule(name: string): void;
logStopResolveModule(success: string): void;
logStartParseSourceFile(filename: string): void;
logStopParseSourceFile(): void;
logStartReadFile(filename: string): void;
logStopReadFile(): void;
logStartBindFile(filename: string): void;
logStopBindFile(): void;
logStartScheduledOperation(operationId: string): void;
logStopScheduledOperation(): void;
}

type ImportedPerfLogger = typeof import("@microsoft/typescript-etw");

// Assert that our PerfLogger type is the same as the import.
// TODO(jakebailey): remove this workaround for an api-extractor bug.
const _perfLoggerCorrectType: PerfLogger extends ImportedPerfLogger ? ImportedPerfLogger extends PerfLogger ? true : false : false = true;

// eslint-disable-next-line @typescript-eslint/no-unused-expressions
_perfLoggerCorrectType;

const nullLogger: PerfLogger = {
logEvent: noop,
logErrEvent: noop,
Expand Down

0 comments on commit 07f5640

Please sign in to comment.