Remove unused import flagged by CI lint, then harden the toolchain so such issues are caught before push: - lint-staged now also matches .tsx/.jsx (previously .tsx files skipped the pre-commit eslint pass, which is how the error reached CI) - eslint ignores generated client bundles (gitignored, not worth linting) - typecheck now also runs the client tsconfig; the hand-written browser source was excluded from the root config and never type-checked - consolidate the window global augmentations (showToast, parseJsonResponseOrThrow) into a single client globals.d.ts; the inline declare-global blocks failed (non-module files) and masked real errors Co-Authored-By: Claude Opus 4.7 <[email protected]>
33 lines
869 B
TypeScript
33 lines
869 B
TypeScript
// Ambient declarations for browser globals injected at runtime via inline
|
|
// <script> bundles (see src/scripts/toast.ts and src/scripts/httpErrors.ts).
|
|
// Those helpers attach themselves to window rather than being importable, so the
|
|
// client TypeScript needs them declared here to type-check.
|
|
|
|
interface ToastOptions {
|
|
type?: "info" | "success" | "warning" | "error" | (string & {});
|
|
loading?: boolean;
|
|
duration?: number;
|
|
}
|
|
|
|
interface ToastHandle {
|
|
dismiss: () => void;
|
|
update: (message: string, opts?: ToastOptions) => void;
|
|
}
|
|
|
|
interface ParseJsonOptions {
|
|
prefix?: string;
|
|
allowText?: boolean;
|
|
}
|
|
|
|
declare global {
|
|
interface Window {
|
|
showToast: (message: string, opts?: ToastOptions) => ToastHandle;
|
|
parseJsonResponseOrThrow: (
|
|
res: Response,
|
|
opts?: ParseJsonOptions,
|
|
) => Promise<Record<string, unknown>>;
|
|
}
|
|
}
|
|
|
|
export {};
|