@@ -6,6 +6,10 @@ import {
66 type RegistrySurfaceState ,
77} from "./runtime-state.js" ;
88
9+ function asPluginRegistry ( registry : RegistryState [ "activeRegistry" ] ) : PluginRegistry | null {
10+ return registry as PluginRegistry | null ;
11+ }
12+
913const state : RegistryState = ( ( ) => {
1014 const globalState = globalThis as typeof globalThis & {
1115 [ PLUGIN_REGISTRY_STATE ] ?: RegistryState ;
@@ -85,7 +89,7 @@ export function setActivePluginRegistry(
8589}
8690
8791export function getActivePluginRegistry ( ) : PluginRegistry | null {
88- return state . activeRegistry ;
92+ return asPluginRegistry ( state . activeRegistry ) ;
8993}
9094
9195export function getActivePluginRegistryWorkspaceDir ( ) : string | undefined {
@@ -114,7 +118,7 @@ export function releasePinnedPluginHttpRouteRegistry(registry?: PluginRegistry)
114118}
115119
116120export function getActivePluginHttpRouteRegistry ( ) : PluginRegistry | null {
117- return state . httpRoute . registry ?? state . activeRegistry ;
121+ return asPluginRegistry ( state . httpRoute . registry ?? state . activeRegistry ) ;
118122}
119123
120124export function getActivePluginHttpRouteRegistryVersion ( ) : number {
@@ -163,7 +167,7 @@ export function releasePinnedPluginChannelRegistry(registry?: PluginRegistry) {
163167 * When pinned, this returns the startup registry regardless of subsequent
164168 * `setActivePluginRegistry` calls. */
165169export function getActivePluginChannelRegistry ( ) : PluginRegistry | null {
166- return state . channel . registry ?? state . activeRegistry ;
170+ return asPluginRegistry ( state . channel . registry ?? state . activeRegistry ) ;
167171}
168172
169173export function getActivePluginChannelRegistryVersion ( ) : number {
0 commit comments