Skip to content

Commit

Permalink
Convert other namespace + type alias in protocol.ts to const enums
Browse files Browse the repository at this point in the history
  • Loading branch information
Andy Hanson committed May 22, 2017
1 parent f94818d commit 3b56ebe
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 46 deletions.
12 changes: 6 additions & 6 deletions src/harness/unittests/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ namespace ts.server {
type: "request",
arguments: {
formatOptions: {
indentStyle: "Block"
indentStyle: protocol.IndentStyle.Block,
}
}
};
Expand All @@ -149,11 +149,11 @@ namespace ts.server {
type: "request",
arguments: {
options: {
module: "System",
target: "ES5",
jsx: "React",
newLine: "Lf",
moduleResolution: "Node"
module: protocol.ModuleKind.System,
target: protocol.ScriptTarget.ES5,
jsx: protocol.JsxEmit.React,
newLine: protocol.NewLineKind.Lf,
moduleResolution: protocol.ModuleResolutionKind.Node,
}
}
};
Expand Down
68 changes: 28 additions & 40 deletions src/server/protocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2291,14 +2291,12 @@ namespace ts.server.protocol {
body?: NavigationTree;
}

export namespace IndentStyle {
export type None = "None";
export type Block = "Block";
export type Smart = "Smart";
export const enum IndentStyle {
None = "None",
Block = "Block",
Smart = "Smart",
}

export type IndentStyle = IndentStyle.None | IndentStyle.Block | IndentStyle.Smart;

export interface EditorSettings {
baseIndentSize?: number;
indentSize?: number;
Expand Down Expand Up @@ -2395,47 +2393,37 @@ namespace ts.server.protocol {
[option: string]: CompilerOptionsValue | undefined;
}

export namespace JsxEmit {
export type None = "None";
export type Preserve = "Preserve";
export type ReactNative = "ReactNative";
export type React = "React";
export const enum JsxEmit {
None = "None",
Preserve = "Preserve",
ReactNative = "ReactNative",
React = "React",
}

export type JsxEmit = JsxEmit.None | JsxEmit.Preserve | JsxEmit.React | JsxEmit.ReactNative;

export namespace ModuleKind {
export type None = "None";
export type CommonJS = "CommonJS";
export type AMD = "AMD";
export type UMD = "UMD";
export type System = "System";
export type ES6 = "ES6";
export type ES2015 = "ES2015";
export const enum ModuleKind {
None = "None",
CommonJS = "CommonJS",
AMD = "AMD",
UMD = "UMD",
System = "System",
ES6 = "ES6",
ES2015 = "ES2015",
}

export type ModuleKind = ModuleKind.None | ModuleKind.CommonJS | ModuleKind.AMD | ModuleKind.UMD | ModuleKind.System | ModuleKind.ES6 | ModuleKind.ES2015;

export namespace ModuleResolutionKind {
export type Classic = "Classic";
export type Node = "Node";
export const enum ModuleResolutionKind {
Classic = "Classic",
Node = "Node",
}

export type ModuleResolutionKind = ModuleResolutionKind.Classic | ModuleResolutionKind.Node;

export namespace NewLineKind {
export type Crlf = "Crlf";
export type Lf = "Lf";
export const enum NewLineKind {
Crlf,
Lf,
}

export type NewLineKind = NewLineKind.Crlf | NewLineKind.Lf;

export namespace ScriptTarget {
export type ES3 = "ES3";
export type ES5 = "ES5";
export type ES6 = "ES6";
export type ES2015 = "ES2015";
export const enum ScriptTarget {
ES3 = "ES3",
ES5 = "ES5",
ES6 = "ES6",
ES2015 = "ES2015",
}

export type ScriptTarget = ScriptTarget.ES3 | ScriptTarget.ES5 | ScriptTarget.ES6 | ScriptTarget.ES2015;
}

0 comments on commit 3b56ebe

Please sign in to comment.