You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sdk-recorder): fix CapRecorder.on unsubscribe type error and add tsconfig reference - #2917
Fixes the TypeScript type error (TS2345) in CapRecorder.on's unsubscribe callback (packages/sdk-recorder/src/index.ts:88) by casting handler to EventHandler<keyof RecorderEventMap> before passing it to Set.add and Set.delete.
Enables "composite": true and "emitDeclarationOnly": true in packages/sdk-recorder/tsconfig.json and adds { "path": "./packages/sdk-recorder" } to the root tsconfig.jsonreferences so bun run typecheck checks @cap/sdk-recorder.
Thanks @ryder777777, nice catch on #2915! The castHandler change in packages/sdk-recorder/src/index.ts is right: add and delete now get the same reference, and tsc --noEmit passes on this branch. One problem though: adding "composite": true to packages/sdk-recorder/tsconfig.json breaks the package's own build. tsup's DTS step reads that tsconfig, and with composite on, bun run --cwd packages/sdk-recorder build now fails with TS6307: File '.../src/core/mime-types.ts' is not listed within the file list of project '' (same for stream-manager.ts and upload/multipart-client.ts). So the build from #2915 still exits 1, it just fails on a different error now. Could you turn composite off for the tsup DTS pass in packages/sdk-recorder/tsup.config.ts, i.e. replace dts: true, with dts: { compilerOptions: { composite: false } },? With that change tsup emits dist/index.d.ts, dist/react/index.d.ts and the shared types chunk, and tsc -b from the root still covers the package through the new reference. Thanks!
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
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.
Summary
TS2345) inCapRecorder.on's unsubscribe callback (packages/sdk-recorder/src/index.ts:88) by castinghandlertoEventHandler<keyof RecorderEventMap>before passing it toSet.addandSet.delete."composite": trueand"emitDeclarationOnly": trueinpackages/sdk-recorder/tsconfig.jsonand adds{ "path": "./packages/sdk-recorder" }to the roottsconfig.jsonreferencessobun run typecheckchecks@cap/sdk-recorder.Closes #2915


Confidence Score: 5/5
The PR appears safe to merge; no actionable issues were found.Summary
Fixes the unsubscribe type error in
CapRecorder.onand adds@cap/sdk-recorderto root typechecking.Reviews (1) · Last reviewed commit: "fix(sdk-recorder): fix CapRecorder.on un..." · Reviewed by Greptile