From caa6636bd23e9643265ed4022cdfe3f3bc18962d Mon Sep 17 00:00:00 2001 From: Christian Stewart Date: Sat, 14 Nov 2026 20:22:20 -0800 Subject: [PATCH] panorama: declare the Panorama calls the layout library makes The layout library calls $.GetContextPanel, $.Msg and $.RegisterForUnhandledEvent, which only src/panorama.d.ts declared. That file is not among the vendored sources, so a consumer compiling a vendored layout.ts type-checked it against whatever $ the consumer declared, or none, and failed with errors about members of $ that do not exist. layout.ts now declares the part of $ it calls, in its own module scope, so it type-checks the same in this repository and in a vendored copy. Signed-off-by: Christian Stewart --- panorama/src/layout.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/panorama/src/layout.ts b/panorama/src/layout.ts index c182f2e9..9c9b9798 100644 --- a/panorama/src/layout.ts +++ b/panorama/src/layout.ts @@ -23,6 +23,22 @@ import { routeAttribute, } from './data.js' +/** + * $ is the part of Panorama's script API this library calls. Declaring it here + * keeps the library self-contained, so a consumer that compiles this file from + * a vendored copy needs no global declarations of its own. + */ +declare const $: { + Msg(...values: unknown[]): void + GetContextPanel(): { + GetAttributeString(name: string, fallback: string): string + } + RegisterForUnhandledEvent( + event: string, + handler: (...args: never[]) => boolean | void, + ): number +} + /** Handler receives a value the mod sent, or undefined for none. */ export type Handler = (value: unknown) => void