Repository navigation
Conversation
The declarations imported `Throws` from @livekit/throws-transformer and used sdp-transform types, but both type packages were devDependencies, so consumers that check library types could not resolve them. Two optional properties also conflicted with their overrides under exactOptionalPropertyTypes. - copy the `Throws` type into src/utils/throws.ts (the transformer matches its `__throws` brand, not the import path) - move @types/sdp-transform to dependencies - declare IDataTrack.info and LocalTrack.processor as `| undefined` - add check:published-types, which type-checks the packed tarball in a temp project outside the repo, and run it in CI Fixes #2164 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
size-limit report 📦
|
🦋 Changeset detectedLatest commit: fd1ede4 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
1egoman
reviewed
Oct 21, 2026
Comment on lines
+1
to
+15
| // A copy of `Throws` from `@livekit/throws-transformer/throws`. The published declarations name | ||
| // this type, and the transformer is a devDependency, so a consumer could not resolve an import | ||
| // of it. The transformer matches the `__throws` brand, not the import path: keep the brand as is. | ||
|
|
||
| type Primitives = void | null | undefined | string | number | bigint | boolean | symbol; | ||
|
|
||
| /** | ||
| * Branded type that encodes possible thrown errors in the return type. The error types are | ||
| * phantom types for static analysis; the runtime value is just T. | ||
| */ | ||
| export type Throws<T, E extends Error> = | ||
| | (T & { | ||
| readonly __throws?: E; | ||
| }) | ||
| | Extract<T, Primitives>; |
Contributor
There was a problem hiding this comment.
suggestion: Is there some way these could pull from the npm package implementation still, but get resolved at build time into effectively the contents of this file?
This branch has not been deployed
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.
The published declarations fail to type-check in a project with
skipLibCheck: false. Thirteen source files importThrowsfrom@livekit/throws-transformer/throws, and the type stays in the emitted.d.tsfiles. That package is a devDependency, so a consumer never installs it.PCTransport.d.tsusessdp-transformtypes, but@types/sdp-transformis also a devDependency. WithexactOptionalPropertyTypeson, two declarations also contradict each other.IDataTrackdeclaresinfo?: DataTrackInfo, but theLocalDataTrackgetter returnsDataTrackInfo | undefined.LocalTrackdeclaresprocessor?: TrackProcessor<…>, butLocalAudioTrackadds| undefined. Both entries are affected:dist/srcanddist/core/types.This change adds a local copy of
Throwsinsrc/utils/throws.tsand points the 13 imports at it. The transformer detects the type by its__throwsbrand, not by the module it comes from, sopnpm throws:checkgives the same result.@types/sdp-transformmoves todependencies.IDataTrack.infoandLocalTrack.processorare declared with| undefined. WithoutexactOptionalPropertyTypes, these are the same types.The existing
check:corescript did not catch this, although it runs withskipLibCheckoff. It runs inside the repo, so module resolution walks up to the repo'snode_modulesand finds the devDependencies. The newpnpm check:published-typesscript packs the built package and installs the tarball with npm into a temp directory outside the repo. Then it type-checks all four type entries withstrict,skipLibCheck: falseandexactOptionalPropertyTypes. CI runs it intest.yamlafterbuild:clean.No runtime code changes. Consumers get one more types-only dependency,
@types/sdp-transform.Fixes #2164
🤖 Generated with Claude Code