Skip to content

Commit fdeb9aa

Browse files
committed
Use 'as const' instead of readonly class object
1 parent 08d9dd2 commit fdeb9aa

6 files changed

Lines changed: 8 additions & 8 deletions

File tree

extensions/typescript-language-features/src/typescriptService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export namespace ServerResponse {
2121
) { }
2222
}
2323

24-
export const NoContent = new class { readonly type = 'noContent'; };
24+
export const NoContent = { type: 'noContent' } as const;
2525

2626
export type Response<T extends Proto.Response> = T | Cancelled | typeof NoContent;
2727
}

extensions/typescript-language-features/src/typescriptServiceClient.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ namespace ServerState {
4747
Errored
4848
}
4949

50-
export const None = new class { readonly type = Type.None; };
50+
export const None = { type: Type.None } as const;
5151

5252
export class Running {
5353
readonly type = Type.Running;

src/vs/editor/contrib/codeAction/codeActionModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export namespace CodeActionsState {
141141
Triggered,
142142
}
143143

144-
export const Empty = new class { readonly type = Type.Empty; };
144+
export const Empty = { type: Type.Empty } as const;
145145

146146
export class Triggered {
147147
readonly type = Type.Triggered;

src/vs/editor/contrib/codeAction/lightBulbWidget.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ namespace LightBulbState {
2525
Showing,
2626
}
2727

28-
export const Hidden = new class { readonly type = Type.Hidden; };
28+
export const Hidden = { type: Type.Hidden } as const;
2929

3030
export class Showing {
3131
readonly type = Type.Showing;

src/vs/editor/contrib/parameterHints/parameterHintsModel.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ namespace ParameterHintState {
2626
Pending,
2727
}
2828

29-
export const Default = new class { readonly type = Type.Default; };
29+
export const Default = { type: Type.Default } as const;
3030

3131
export class Pending {
3232
readonly type = Type.Pending;

src/vs/workbench/services/progress/browser/progressIndicator.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,9 @@ namespace ProgressIndicatorState {
117117
Work
118118
}
119119

120-
export const None = new class { readonly type = Type.None; };
121-
export const Done = new class { readonly type = Type.Done; };
122-
export const Infinite = new class { readonly type = Type.Infinite; };
120+
export const None = { type: Type.None } as const;
121+
export const Done = { type: Type.Done } as const;
122+
export const Infinite = { type: Type.Infinite } as const;
123123

124124
export class While {
125125
readonly type = Type.While;

0 commit comments

Comments
 (0)