Skip to content

Fix release - add nonshared uint8array and address api extractor fix#1360

Merged
1egoman merged 6 commits into
mainfrom
fix/release-api-extractor-nonshared-uint8array
Jul 8, 2026
Merged

Fix release - add nonshared uint8array and address api extractor fix#1360
1egoman merged 6 commits into
mainfrom
fix/release-api-extractor-nonshared-uint8array

Conversation

@1egoman

@1egoman 1egoman commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

Summary

Currently the release is failing with:

ERROR: Internal Error: Unable to follow symbol for "NonSharedUint8Array"

There are two independent regressions on the release path, both introduced by dependency bumps since the last release was made (#1310). The api-extractor crash happens first (the reported error); fixing only it would surface the second one immediately after in gen:docs.

  1. NonSharedUint8Array - from livekit-client 2.19 (Update LiveKit dependencies (non-major) #1348)

livekit-client >=2.19 declares an ambient global NonSharedUint8Array in its source (src/type-polyfills/non-shared-typed-arrays.d.ts) but does not include that declaration in its published dist types. Its emitted .d.ts files (Track, LocalParticipant, Room, E2eeManager, ...) reference a global that consumers can't resolve.

  • Our tsc build tolerates it via skipLibCheck: true.
  • api-extractor cannot - it must fully follow every rolled-up symbol, so it hard-crashes.

Fix: re-declare the ambient global in each package that runs api-extractor (core and react - api-extractor builds an independent program per package). We alias to plain Uint8Array rather than upstream's non-shared Uint8Array<ArrayBuffer> variant: it's only a resolution shim, and the strict variant would force a breaking narrowing of our public payload signatures (Uint8Array -> Uint8Array) for no benefit. Rationale is in the file comments.

This is fundamentally an upstream packaging bug - livekit-client should probably include its non-shared-typed-arrays.d.ts. I've committed a shim to unblock this in the meantime but I think ideally it can be fixed upstream.

  1. api-documenter crash — from @microsoft/api-extractor 7.57.6 → 7.58.8 (Fix/high critical dependabot #1334)

Once api-extractor completes, gen:docs crashes the vendored @livekit/api-documenter with Cannot read properties of undefined (reading 'kind'). api-extractor 7.58.8 changed how it represents destructured object params (useChatToggle({ props }: UseChatToggleProps)): it collapses them to a synthetic input param but leaves a phantom parameter entry with an empty type-token range, which _writeParameterList chokes on. This affected 8 hooks.

Fix: skip parameters with an empty type excerpt — the collapsed real parameter renders separately, so no docs are lost.

Alternative considered: pin @microsoft/api-extractor back to ~7.57.6 (dev-only tooling, not shipped), which also restores nicer generated docs. Went with the tool guard to keep #1334's bump.

Verification

  • turbo run build --filter=./packages/* -> ✅
  • pnpm gen:docs (runs api-extractor for both packages + api-documenter) -> ✅ 7/7 tasks, "API Extractor completed successfully" x2
  • Simulated a downstream consumer against the built dist: with skipLibCheck (the normal app setting) there are zero errors; the emitted types are as consumable as livekit-client's own.

1egoman and others added 3 commits July 8, 2026 10:48
…e it

livekit-client >=2.19 (pulled in via #1348) declares an ambient global
`NonSharedUint8Array` in its own source
(src/type-polyfills/non-shared-typed-arrays.d.ts) but does NOT ship that
declaration in its published `dist` types. Its emitted `.d.ts` files
(Track, LocalParticipant, Room, E2eeManager, ...) therefore reference a
global type that downstream consumers cannot resolve.

Our `tsc` build tolerates this because of `skipLibCheck: true`, but
api-extractor must fully follow every rolled-up symbol and hard-fails with:

    ERROR: Internal Error: Unable to follow symbol for "NonSharedUint8Array"

which broke the api-extractor step of `pnpm ci:publish` and blocked the
release.

Re-declaring the global here makes the symbol resolvable during our own
type analysis. Unlike upstream -- which aliases to the non-shared
`Uint8Array<ArrayBuffer>` variant for Web API compatibility in its own
code -- we intentionally alias to plain `Uint8Array`: this type is only a
resolution shim, and components forwards consumer-supplied `Uint8Array`
values unchanged, so tightening to the non-shared variant would only break
our public payload signatures for no benefit.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…r pass

Same root cause and fix as the core package: livekit-client >=2.19 ships
`.d.ts` files that reference an ambient `NonSharedUint8Array` global it
never emits, so api-extractor also crashes with "Unable to follow symbol"
when it rolls up the react package's types.

api-extractor builds an independent TypeScript program per package, so the
shim added to @livekit/components-core is not visible here -- the react
package needs its own copy in its own compilation. See the core package's
polyfill for the full rationale, including why we alias to plain
`Uint8Array` rather than the upstream non-shared variant.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
`@microsoft/api-extractor` 7.58.8 (bumped from 7.57.6 in #1334) changed
how it represents destructured object parameters. For a signature like
`useChatToggle({ props }: UseChatToggleProps)` it now collapses the
parameter to a synthetic `input` param but also leaves an additional
phantom parameter entry whose type-token range is empty.

`_writeParameterList` assumed `parameterTypeExcerpt.spannedTokens[0]`
always exists and read `.kind` off it, so these phantom entries crashed
markdown generation with:

    TypeError: Cannot read properties of undefined (reading 'kind')

This broke `pnpm gen:docs` for the 8 hooks that take destructured props
(useChatToggle, useTrackToggle, useFocusToggle, useMediaDevices,
useMediaDeviceSelect, useParticipantTile, useStartAudio, useStartVideo)
-- the next failure on the release path once the api-extractor crash above
is resolved.

Skip parameters with an empty type excerpt: the collapsed real parameter
is emitted separately and still renders correctly, so no documentation is
lost.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@changeset-bot

changeset-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 0dfbcbe

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@livekit/components-core Patch
@livekit/components-react Patch
@agents-ui Patch
@livekit/component-example-next Patch
@livekit/components-js-docs Patch
@livekit/component-docs-storybook Patch
@livekit/components-docs-gen Patch

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

@vercel

vercel Bot commented Jul 8, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
components-js-storybook-5kld Ready Ready Preview, Comment Jul 8, 2026 4:17pm

Request Review

@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
LiveKitRoom only 6.01 KB (0%)
LiveKitRoom with VideoConference 32.25 KB (0%)
All exports 43.69 KB (0%)

The root cause is being fixed upstream in livekit/client-sdk-js#1997, which
ships the `NonSharedUint8Array` declaration in livekit-client's published types.
Reference that PR from both shim files and document that they are a temporary
workaround: once a livekit-client release including the fix is published and
this repo's `livekit-client` catalog entry is bumped to it, the type resolves
from livekit-client itself and these files should be deleted.

Also replaces the stale `See:` link (the upstream file is being renamed from
`.d.ts` to `.ts`) with a link to the upstream PR. Comment-only change; the
`type NonSharedUint8Array = Uint8Array` shim is unchanged and still required
until the upstream fix ships.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1egoman and others added 2 commits July 8, 2026 12:16
livekit-client 2.20.1 ships the `NonSharedUint8Array` type declaration in its
published types (livekit/client-sdk-js#1997), so the local resolution shims
added earlier in this branch are no longer needed. Bump the `livekit-client`
catalog entry (a peerDependency of components-core/react) from `^2.18.2` to
`^2.20.1` and delete both `type-polyfills/non-shared-typed-arrays.d.ts` shims;
api-extractor now resolves the symbol from livekit-client itself.

Removing the permissive shim (`type NonSharedUint8Array = Uint8Array`) re-exposes
one genuine mismatch it was masking: `sendMessage` forwards a consumer-supplied
`Uint8Array` to `localParticipant.publishData`, which livekit-client >=2.19 types
as the non-shared `Uint8Array<ArrayBuffer>` variant. Cast at that internal
boundary (data-channel payloads are never shared-backed) to keep this helper's
public `Uint8Array` signature unchanged.

Verified: `turbo run build` and `pnpm gen:docs` (api-extractor for both packages
+ api-documenter) pass with livekit-client 2.20.1 and no shims.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@1egoman 1egoman merged commit 87220e4 into main Jul 8, 2026
8 checks passed
@1egoman 1egoman deleted the fix/release-api-extractor-nonshared-uint8array branch July 8, 2026 20:20
@github-actions github-actions Bot mentioned this pull request Jul 8, 2026
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.

3 participants