Skip to content

Commit a404eda

Browse files
authored
Split import into var and type to avoid breaking backword compatability of tsserverlibrary (#16409)
1 parent 09321b3 commit a404eda

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/server/session.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,13 @@ namespace ts.server {
112112
return true;
113113
}
114114

115-
export import CommandNames = protocol.CommandTypes;
115+
// CommandNames used to be exposed before TS 2.4 as a namespace
116+
// In TS 2.4 we switched to an enum, keep this for backward compatibility
117+
// The var assignment ensures that even though CommandTypes are a const enum
118+
// we want to ensure the value is maintained in the out since the file is
119+
// built using --preseveConstEnum.
120+
export type CommandNames = protocol.CommandTypes;
121+
export const CommandNames = (<any>protocol).CommandTypes;
116122

117123
export function formatMessage<T extends protocol.Message>(msg: T, logger: server.Logger, byteLength: (s: string, encoding: string) => number, newLine: string): string {
118124
const verboseLogging = logger.hasLevel(LogLevel.verbose);

0 commit comments

Comments
 (0)