chore: updated deprecation notices and fixed types#386
Merged
chaitanyapotti merged 3 commits intomasterfrom Mar 4, 2026
Merged
chore: updated deprecation notices and fixed types#386chaitanyapotti merged 3 commits intomasterfrom
chaitanyapotti merged 3 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
chaitanyapotti
approved these changes
Mar 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
Jira Link:
Description
fix: Remove deprecation notices and fix type compatibility in JRPC types
Summary
@deprecatedannotations from V1 API types, classes, and functions that are still actively used across the codebase (BasePostMessageStream,PostMessageStream,isValidStreamMessage,SerializableError,Payload,ExtendedJsonRpcRequest).ProviderEventsandSafeEventEmitterProviderfromjrpcEngine.tstosafeEventEmitter.tsto co-locate them with the base class they extend and removed their deprecation notices.MiddlewareScaffold— scaffold handlers with narrowed request params (e.g.JRPCRequest<{ foo: string }>) were not assignable to the previous generic type. The fix removes theContextgeneric fromMiddlewareScaffold, drops the intermediateScaffoldMiddlewareHandlertype, and uses anever-parameter function signature so that any handler with arbitrarily-narrowed params remains assignable.JRPCRequest<Params>generic fromParams extends JRPCParamstoParams = JRPCParamsto allow non-JRPCParamstypes (e.g.{ foo: string }) as request parameters.PostMessageStream._postMessage— the data object is now shallow-copied before mutation to avoid errors when the incoming object is frozen.Changed Files
src/jrpc/basePostMessageStream.ts@deprecatedfromisValidStreamMessageandBasePostMessageStreamsrc/jrpc/interfaces.ts@deprecatedfromPayloadandExtendedJsonRpcRequest; relaxedJRPCRequestgeneric constraintsrc/jrpc/jrpcEngine.tsProviderEventsandSafeEventEmitterProviderout; updated importssrc/jrpc/safeEventEmitter.tsProviderEventstype andSafeEventEmitterProviderinterfacesrc/jrpc/index.tsProviderEventsandSafeEventEmitterProviderfrom new locationsrc/jrpc/serializableError.ts@deprecatedfromSerializableErrorsrc/jrpc/postMessageStream.ts@deprecatedfromPostMessageStream; shallow-copy data before mutationsrc/jrpc/v2/v2interfaces.tsScaffoldMiddlewareHandler; simplifiedMiddlewareScaffoldtypesrc/jrpc/v2/createScaffoldMiddleware.tsContextgeneric fromMiddlewareScaffoldusage; added type cast for handlersrc/jrpc/v2/providerUtils.tssafeEventEmitterinstead ofjrpcEnginetest/v2/createScaffoldMiddleware.test.tsTest Plan
JRPCRequest<{ foo: string }>) works correctly at runtimeHow has this been tested?
Screenshots (if appropriate):
Types of changes
Checklist:
Note
Medium Risk
Mostly type- and export-level changes, but they affect public JRPC provider/scaffold typing and add a runtime tweak to
PostMessageStreammessage handling that could impact cross-window messaging behavior.Overview
Removes several premature
@deprecatedannotations from still-used JRPC V1 APIs (stream utilities, request types, andSerializableError).Moves
ProviderEventsandSafeEventEmitterProvidertype definitions intosafeEventEmitter.tsand updates exports/imports so both V1 and V2 provider utilities reference the shared definitions.Fixes V2 scaffold typing by simplifying
MiddlewareScaffold(dropping the context generic and using anever-arg function signature) and updatingcreateScaffoldMiddlewareaccordingly; adds a test ensuring handlers with narrowedJRPCRequestparams type-check and run.Hardens
PostMessageStream._postMessageby shallow-copying object payloads before mutating_origin, avoiding crashes when the input object is frozen.Written by Cursor Bugbot for commit b4388a7. This will update automatically on new commits. Configure here.