From 293b5cdf9cab3c57df53fdf0c18058240f745df0 Mon Sep 17 00:00:00 2001 From: Andrew Bradley Date: Tue, 17 May 2022 14:33:24 -0400 Subject: [PATCH] tricky types --- src/ts-compiler-types.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/ts-compiler-types.ts b/src/ts-compiler-types.ts index 3b23e1c88..2f961b853 100644 --- a/src/ts-compiler-types.ts +++ b/src/ts-compiler-types.ts @@ -19,7 +19,7 @@ export interface TSCommon { getPreEmitDiagnostics: typeof _ts.getPreEmitDiagnostics; flattenDiagnosticMessageText: typeof _ts.flattenDiagnosticMessageText; transpileModule: typeof _ts.transpileModule; - ModuleKind: typeof _ts.ModuleKind; + ModuleKind: TSCommon.ModuleKindEnum; ScriptTarget: typeof _ts.ScriptTarget; findConfigFile: typeof _ts.findConfigFile; readConfigFile: typeof _ts.readConfigFile; @@ -73,10 +73,12 @@ export namespace TSCommon { _ts.ResolvedModuleWithFailedLookupLocations; export type FileReference = _ts.FileReference; export type SourceFile = _ts.SourceFile; - export namespace ModuleKind { - // Hack until we start building against TS >= 4.7.0 - export declare const Node16: 100 | undefined; - } + // Hack until we start building against TS >= 4.7.0 + export type ModuleKindEnum = typeof _ts.ModuleKind & { + Node16: typeof _ts.ModuleKind extends { Node16: any } + ? typeof _ts.ModuleKind['Node16'] + : 100; + }; } /**