Use 'as const' instead of readonly class object

This commit is contained in:
Matt Bierner 2019-11-07 20:31:32 -08:00
parent 08d9dd2c83
commit fdeb9aa9b8
6 changed files with 8 additions and 8 deletions

View file

@ -21,7 +21,7 @@ export namespace ServerResponse {
) { }
}
export const NoContent = new class { readonly type = 'noContent'; };
export const NoContent = { type: 'noContent' } as const;
export type Response<T extends Proto.Response> = T | Cancelled | typeof NoContent;
}

View file

@ -47,7 +47,7 @@ namespace ServerState {
Errored
}
export const None = new class { readonly type = Type.None; };
export const None = { type: Type.None } as const;
export class Running {
readonly type = Type.Running;

View file

@ -141,7 +141,7 @@ export namespace CodeActionsState {
Triggered,
}
export const Empty = new class { readonly type = Type.Empty; };
export const Empty = { type: Type.Empty } as const;
export class Triggered {
readonly type = Type.Triggered;

View file

@ -25,7 +25,7 @@ namespace LightBulbState {
Showing,
}
export const Hidden = new class { readonly type = Type.Hidden; };
export const Hidden = { type: Type.Hidden } as const;
export class Showing {
readonly type = Type.Showing;

View file

@ -26,7 +26,7 @@ namespace ParameterHintState {
Pending,
}
export const Default = new class { readonly type = Type.Default; };
export const Default = { type: Type.Default } as const;
export class Pending {
readonly type = Type.Pending;

View file

@ -117,9 +117,9 @@ namespace ProgressIndicatorState {
Work
}
export const None = new class { readonly type = Type.None; };
export const Done = new class { readonly type = Type.Done; };
export const Infinite = new class { readonly type = Type.Infinite; };
export const None = { type: Type.None } as const;
export const Done = { type: Type.Done } as const;
export const Infinite = { type: Type.Infinite } as const;
export class While {
readonly type = Type.While;