diff --git a/404.html b/404.html index 7ba2e68..22a66cd 100644 --- a/404.html +++ b/404.html @@ -4,7 +4,7 @@
Use literal types whenever possible to avoid creating runtime objects that add to the bundle size.
-// ❌ Avoid using enums as they increase the bundle size
enum UserRole {
GUEST = 'guest',
MODERATOR = 'moderator',
ADMINISTRATOR = 'administrator',
}
// Transpiled JavaScript
('use strict');
var UserRole;
(function (UserRole) {
UserRole['GUEST'] = 'guest';
UserRole['MODERATOR'] = 'moderator';
UserRole['ADMINISTRATOR'] = 'administrator';
})(UserRole || (UserRole = {}));
// ✅ Use literal types
type UserRole = 'guest' | 'moderator' | 'administrator';
const isGuest = (role: UserRole) => role === 'guest';
// ❌ Avoid using enums as they increase the bundle size
enum UserRole {
GUEST = 'guest',
MODERATOR = 'moderator',
ADMINISTRATOR = 'administrator',
}
// Transpiled JavaScript
('use strict');
var UserRole;
(function (UserRole) {
UserRole['GUEST'] = 'guest';
UserRole['MODERATOR'] = 'moderator';
UserRole['ADMINISTRATOR'] = 'administrator';
})(UserRole || (UserRole = {}));
// ✅ Use literal types - Types are stripped during transpilation
type UserRole = 'guest' | 'moderator' | 'administrator';
const isGuest = (role: UserRole) => role === 'guest';
Use const assertion arrays when you need to loop through the values.
diff --git a/search.html b/search.html index 73a8f61..de84853 100644 --- a/search.html +++ b/search.html @@ -4,7 +4,7 @@