Skip to content

feat(types): add RcpApi, SocketApi, and PluginGraph types - #144

Open
rwendell wants to merge 1 commit into
PenguLoader:feat/app-hubfrom
rwendell:feat/plugin-context-types
Open

feat(types): add RcpApi, SocketApi, and PluginGraph types#144
rwendell wants to merge 1 commit into
PenguLoader:feat/app-hubfrom
rwendell:feat/plugin-context-types

Conversation

@rwendell

Copy link
Copy Markdown

Summary

  • Replaces any on PluginInitContext.rcp and PluginInitContext.socket with proper interfaces derived from the actual source implementations in packages/preload/src/preload/rcp/.
  • Adds RcpApi (preInit, postInit, whenReady, get, graph, dependencies, dependents, names), SocketApi (observe, disconnect), SocketEventData, and PluginGraph to packages/types/index.d.ts.
  • Adds rcp: RcpApi to the Window global type (it is exposed as a frozen property on window).
  • Promotes the new types through the internal packages/preload/src/types.d.ts re-exports.

Context

The PluginInitContext interface had rcp: any and socket: any, which gave plugin authors no autocomplete or type safety for two of the most important APIs. These types are now derived directly from the runtime implementations, including the new graph/dependencies/dependents/names methods added on the feat/app-hub branch.

Replace `any` on PluginInitContext.rcp and PluginInitContext.socket
with proper interfaces: RcpApi (preInit, postInit, whenReady, get,
graph, dependencies, dependents, names), SocketApi (observe,
disconnect), SocketEventData, and PluginGraph.

Also add rcp to the Window global type, and promote the new types
through the internal preload re-exports.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant