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);