Use an enum for Msg (#19773)
This commit is contained in:
parent
d79c37cd19
commit
381ca45787
3 changed files with 18 additions and 19 deletions
|
@ -200,7 +200,7 @@ namespace ts.server {
|
||||||
return this.loggingEnabled() && this.level >= level;
|
return this.loggingEnabled() && this.level >= level;
|
||||||
}
|
}
|
||||||
|
|
||||||
msg(s: string, type: Msg.Types = Msg.Err) {
|
msg(s: string, type: Msg = Msg.Err) {
|
||||||
if (!this.canWrite) return;
|
if (!this.canWrite) return;
|
||||||
|
|
||||||
s = `[${nowString()}] ${s}\n`;
|
s = `[${nowString()}] ${s}\n`;
|
||||||
|
|
|
@ -19,20 +19,19 @@ namespace ts.server {
|
||||||
info(s: string): void;
|
info(s: string): void;
|
||||||
startGroup(): void;
|
startGroup(): void;
|
||||||
endGroup(): void;
|
endGroup(): void;
|
||||||
msg(s: string, type?: Msg.Types): void;
|
msg(s: string, type?: Msg): void;
|
||||||
getLogFileName(): string;
|
getLogFileName(): string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: Use a const enum (https://github.com/Microsoft/TypeScript/issues/16804)
|
||||||
|
export enum Msg {
|
||||||
|
Err = "Err",
|
||||||
|
Info = "Info",
|
||||||
|
Perf = "Perf",
|
||||||
|
}
|
||||||
export namespace Msg {
|
export namespace Msg {
|
||||||
// tslint:disable variable-name
|
/** @deprecated Only here for backwards-compatibility. Prefer just `Msg`. */
|
||||||
export type Err = "Err";
|
export type Types = Msg;
|
||||||
export const Err: Err = "Err";
|
|
||||||
export type Info = "Info";
|
|
||||||
export const Info: Info = "Info";
|
|
||||||
export type Perf = "Perf";
|
|
||||||
export const Perf: Perf = "Perf";
|
|
||||||
export type Types = Err | Info | Perf;
|
|
||||||
// tslint:enable variable-name
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProjectRootPath(project: Project): Path {
|
function getProjectRootPath(project: Project): Path {
|
||||||
|
|
|
@ -4779,17 +4779,17 @@ declare namespace ts.server {
|
||||||
info(s: string): void;
|
info(s: string): void;
|
||||||
startGroup(): void;
|
startGroup(): void;
|
||||||
endGroup(): void;
|
endGroup(): void;
|
||||||
msg(s: string, type?: Msg.Types): void;
|
msg(s: string, type?: Msg): void;
|
||||||
getLogFileName(): string;
|
getLogFileName(): string;
|
||||||
}
|
}
|
||||||
|
enum Msg {
|
||||||
|
Err = "Err",
|
||||||
|
Info = "Info",
|
||||||
|
Perf = "Perf",
|
||||||
|
}
|
||||||
namespace Msg {
|
namespace Msg {
|
||||||
type Err = "Err";
|
/** @deprecated Only here for backwards-compatibility. Prefer just `Msg`. */
|
||||||
const Err: Err;
|
type Types = Msg;
|
||||||
type Info = "Info";
|
|
||||||
const Info: Info;
|
|
||||||
type Perf = "Perf";
|
|
||||||
const Perf: Perf;
|
|
||||||
type Types = Err | Info | Perf;
|
|
||||||
}
|
}
|
||||||
function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
|
function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
|
||||||
namespace Errors {
|
namespace Errors {
|
||||||
|
|
Loading…
Reference in a new issue