Files
Tom MoorandClaude Opus 5.5 5647621224 chore: Prune redundant comments and type suppressions (#14124)
* chore: Prune redundant comments and normalize lint directives

Removes comments that restate the following line and stale TODOs, drops
the passive event listener feature check now that all supported browsers
support it, and renames eslint directives to oxlint.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BehTjuZwKbN5csMCp3H4QH

* fix: Evaluate restricted team domains at validation time

The restricted email provider list was captured when the model loaded, so
it could not follow the hosting environment and the tests that covered it
never reached the model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BehTjuZwKbN5csMCp3H4QH

* chore: Replace type suppressions with accurate types

Adds a Concrete helper type for registries of abstract classes, declares
missing Sequelize and refractor typings, uses public ProseMirror APIs, a
typed mock context helper in middleware tests, and a StaticLink component
for sidebar rows being edited.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01BehTjuZwKbN5csMCp3H4QH

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-17 17:07:39 -04:00

53 lines
1.5 KiB
TypeScript

import "reflect-metadata";
import { isUndefined } from "es-toolkit/compat";
import type { Environment } from "@server/env";
const key = Symbol("env:public");
/**
* This decorator on an environment variable makes that variable available client-side
*/
export function Public(target: object, propertyKey: string) {
const publicVars: string[] = Reflect.getMetadata(key, target);
if (!publicVars) {
return Reflect.defineMetadata(key, [propertyKey], target);
}
publicVars.push(propertyKey);
}
/**
* Registry of environment variables marked with the `Public` decorator that
* should be made available client-side.
*/
export class PublicEnvironmentRegister {
// oxlint-disable-next-line @typescript-eslint/no-explicit-any -- consumed at runtime as a flat map of typed Environment values; tightening to unknown breaks call sites.
private static publicEnv: Record<string, any> = {};
/**
* Registers an environment's public variables with the registry.
*
* @param env the environment to register.
*/
static registerEnv(env: Environment) {
process.nextTick(() => {
const vars: string[] = Reflect.getMetadata(key, env) ?? [];
vars.forEach((k: keyof Environment) => {
if (isUndefined(this.publicEnv[k])) {
this.publicEnv[k] = env[k];
}
});
});
}
/**
* Returns the map of public environment variables.
*
* @returns the public environment variables.
*/
static getEnv() {
return this.publicEnv;
}
}