Use 'as const' instead of readonly class object
This commit is contained in:
parent
08d9dd2c83
commit
fdeb9aa9b8
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue