From a404edae384f758e604a9457a9476de613436b68 Mon Sep 17 00:00:00 2001 From: Mohamed Hegazy Date: Sat, 10 Jun 2017 11:12:09 -0700 Subject: [PATCH] Split import into var and type to avoid breaking backword compatability of tsserverlibrary (#16409) --- src/server/session.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/server/session.ts b/src/server/session.ts index 713f0a0f179..c06e33eb979 100644 --- a/src/server/session.ts +++ b/src/server/session.ts @@ -112,7 +112,13 @@ namespace ts.server { return true; } - export import CommandNames = protocol.CommandTypes; + // CommandNames used to be exposed before TS 2.4 as a namespace + // In TS 2.4 we switched to an enum, keep this for backward compatibility + // The var assignment ensures that even though CommandTypes are a const enum + // we want to ensure the value is maintained in the out since the file is + // built using --preseveConstEnum. + export type CommandNames = protocol.CommandTypes; + export const CommandNames = (protocol).CommandTypes; export function formatMessage(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string { const verboseLogging = logger.hasLevel(LogLevel.verbose);