From fba87e27c1cb6c679fff0d2c50be230f7e0c3e56 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Tue, 28 Dec 2021 15:30:36 +0100 Subject: Resolve enums at compile time --- shared/models/http/http-error-codes.ts | 2 +- shared/models/http/http-methods.ts | 2 +- shared/models/plugins/plugin.type.ts | 2 +- shared/models/users/user-role.ts | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) (limited to 'shared') diff --git a/shared/models/http/http-error-codes.ts b/shared/models/http/http-error-codes.ts index b2fbdfc5a..5ebff1cb5 100644 --- a/shared/models/http/http-error-codes.ts +++ b/shared/models/http/http-error-codes.ts @@ -4,7 +4,7 @@ * * WebDAV and other codes useless with regards to PeerTube are not listed. */ -export enum HttpStatusCode { +export const enum HttpStatusCode { /** * Official Documentation @ https://tools.ietf.org/html/rfc7231#section-6.2.1 diff --git a/shared/models/http/http-methods.ts b/shared/models/http/http-methods.ts index 1cfa458b9..3f4adafe2 100644 --- a/shared/models/http/http-methods.ts +++ b/shared/models/http/http-methods.ts @@ -1,5 +1,5 @@ /** HTTP request method to indicate the desired action to be performed for a given resource. */ -export enum HttpMethod { +export const enum HttpMethod { /** The CONNECT method establishes a tunnel to the server identified by the target resource. */ CONNECT = 'CONNECT', /** The DELETE method deletes the specified resource. */ diff --git a/shared/models/plugins/plugin.type.ts b/shared/models/plugins/plugin.type.ts index b6766821a..016219ceb 100644 --- a/shared/models/plugins/plugin.type.ts +++ b/shared/models/plugins/plugin.type.ts @@ -1,4 +1,4 @@ -export enum PluginType { +export const enum PluginType { PLUGIN = 1, THEME = 2 } diff --git a/shared/models/users/user-role.ts b/shared/models/users/user-role.ts index 94413abca..687a2aa0d 100644 --- a/shared/models/users/user-role.ts +++ b/shared/models/users/user-role.ts @@ -1,5 +1,5 @@ // Keep the order -export enum UserRole { +export const enum UserRole { ADMINISTRATOR = 0, MODERATOR = 1, USER = 2 -- cgit v1.2.3