Use an enum for Msg (#19773)
This commit is contained in:
parent
d79c37cd19
commit
381ca45787
|
@ -200,7 +200,7 @@ namespace ts.server {
|
|||
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;
|
||||
|
||||
s = `[${nowString()}] ${s}\n`;
|
||||
|
|
|
@ -19,20 +19,19 @@ namespace ts.server {
|
|||
info(s: string): void;
|
||||
startGroup(): void;
|
||||
endGroup(): void;
|
||||
msg(s: string, type?: Msg.Types): void;
|
||||
msg(s: string, type?: Msg): void;
|
||||
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 {
|
||||
// tslint:disable variable-name
|
||||
export type Err = "Err";
|
||||
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
|
||||
/** @deprecated Only here for backwards-compatibility. Prefer just `Msg`. */
|
||||
export type Types = Msg;
|
||||
}
|
||||
|
||||
function getProjectRootPath(project: Project): Path {
|
||||
|
|
|
@ -4779,17 +4779,17 @@ declare namespace ts.server {
|
|||
info(s: string): void;
|
||||
startGroup(): void;
|
||||
endGroup(): void;
|
||||
msg(s: string, type?: Msg.Types): void;
|
||||
msg(s: string, type?: Msg): void;
|
||||
getLogFileName(): string;
|
||||
}
|
||||
enum Msg {
|
||||
Err = "Err",
|
||||
Info = "Info",
|
||||
Perf = "Perf",
|
||||
}
|
||||
namespace Msg {
|
||||
type Err = "Err";
|
||||
const Err: Err;
|
||||
type Info = "Info";
|
||||
const Info: Info;
|
||||
type Perf = "Perf";
|
||||
const Perf: Perf;
|
||||
type Types = Err | Info | Perf;
|
||||
/** @deprecated Only here for backwards-compatibility. Prefer just `Msg`. */
|
||||
type Types = Msg;
|
||||
}
|
||||
function createInstallTypingsRequest(project: Project, typeAcquisition: TypeAcquisition, unresolvedImports: SortedReadonlyArray<string>, cachePath?: string): DiscoverTypings;
|
||||
namespace Errors {
|
||||
|
|
Loading…
Reference in a new issue