Skip to content

Consider type-safe configuration instead of window globals. #477

Description

@Eriikah

64-65: Consider type-safe configuration instead of window global.

Using (window as any).WS_DEBOUNCE_PERIOD_MS works but bypasses type checking. For better maintainability, consider a typed configuration approach:

declare global {
  interface Window {
    WS_DEBOUNCE_PERIOD_MS?: number;
  }
}

const debouncePeriod = window.WS_DEBOUNCE_PERIOD_MS ?? DEFAULT_DEBOUNCE_MS;

This makes the global explicit and allows TypeScript to catch typos.

Originally posted by @coderabbitai[bot] in #476 (review)

It would improve our code quality to have a type safe configuration for the .env variables

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions