fix(react): make emitted declarations consumable - #2593
Draft
mihar-22 wants to merge 1 commit into
Draft
Conversation
The @/* paths alias let tsgo emit import("@/index").X for preset player store types reachable
through the barrel. The dts plugin then synthesized an index_d_exports namespace that drops
export * re-exports, so every preset usePlayer hook failed with TS2694 in a strict consumer.
Drop the alias, make the imports relative, and guard the emitted declarations with a strict
consumer fixture wired into CI.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
@videojs/core
@videojs/element
@videojs/html
@videojs/media
@videojs/react
@videojs/spf
@videojs/store
@videojs/utils
commit: |
Contributor
📦 Bundle Size Report🎨 @videojs/html — no changesPresets (7)
Media (18)
Extensions (2)
Players (5)
Skins (29)
UI Components (50)
⚛️ @videojs/react — no changesPresets (7)
Media (22)
Extensions (2)
Players (5)
Skins (26)
UI Components (39)
🧩 @videojs/core — no changesEntries (76)
🏷️ @videojs/element — no changesEntries (2)
📦 @videojs/store — no changesEntries (3)
🔧 @videojs/utils — no changesEntries (13)
📦 @videojs/media
Entries (23)
📦 @videojs/spf — no changesEntries (10)
ℹ️ How to interpretEach entry is independently bundled, minified, and brotli-compressed. Initial size includes its static import graph; lazy dynamic chunks are reported separately. Entries are not additive because their dependency graphs overlap. Preset rows represent realistic combined bundles. Changes of 300 B or less across initial, lazy, and total size are collapsed, not discarded. Run |
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.
Refs #2369
Depends on #2248
Summary
Applies the #2248 declaration fix to
@videojs/react. The package had the same@/*pathsalias as@videojs/html, and the same emitter behaviour: tsgo resolved the preset player store types through@/index, the dts plugin synthesized anindex_d_exportsnamespace for that barrel, and because that namespace dropsexport *re-exports every presetusePlayerhook failed to type-check in a strict consumer. This PR removes the alias, adds a strict consumer fixture that compiles against the emitteddist/devdeclarations through the packageexportsmap, and wires it into CI beside the html check.Changes
What the fixture found against the unmodified build (
tsgo --project packages/react/tests/public-types/tsconfig.json):All five preset
player.d.tsfiles carried the same shape (index_d_exports.VideoPlayerStore,index_d_exports.AudioPlayerStore,index_d_exports.PlayerStore<index_d_exports.LiveVideoFeatures>,index_d_exports.PlayerStore<index_d_exports.LiveAudioFeatures>,index_d_exports.PlayerStore<[]>); the fixture initially only imported two of them, so it now exercises every preset hook. No leaked third-party specifiers and no dropped@ts-expect-errorsuppressions were found in the react declarations; the only non-workspace specifier indist/dev/**/*.d.tsisreact.packages/react/src/**: rewrite all 387@/imports (23 files, all undersrc/presets/plussrc/ui/create-context-part.tsx) to relative paths.packages/react/tsconfig.json,packages/react/tsconfig.dts.json: drop the@/*pathsalias.packages/react/vite.config.ts: drop the now-unusedsrcAliasfrom the pack config and the vitestresolve.alias; add thecheck:public-typestask (dependsOn: ['build']) mirroring html.packages/react/tests/public-types/{index.tsx,tsconfig.json}: strict consumer (strict,skipLibCheck: false,moduleResolution: bundler,jsx: react-jsx,types: []) importing the root entry plusaudio,background,extensions/google-cast,i18n,i18n/locales/en/register,icons,icons/minimal,live-audio,live-video,media/hls-video, andvideo. It exercisescreatePlayerand every presetusePlayerwith selectors,usePlayer/useStorewithselectPlayback, component props (PlayButtonProps,Poster.Props,VideoSkinProps), compound parts (Tooltip,TimeSlider,Slider,Time,Menu), and a fewExtendsassertions..github/workflows/ci.yml: addpnpm exec vp run @videojs/react#check:public-typesnext to the html step (the html step is renamed toCheck public declarations (html)so the two are distinguishable).After the alias removal the emitted preset declarations reference
import("@videojs/core/dom").VideoPlayerStoreand friends directly, and the fixture passes with no explicit type re-exports added.Out of scope, surfaced by the fixture
@videojs/media/dom/muxleaksmux-embedtypes into its emitted declarations.packages/media/dist/dev/dom/mux/types.d.tscarries a/// <reference path="../../../../../Users/.../packages/media/node_modules/mux-embed/dist/types/mux-embed.d.ts" />(an absolute build-machine path mangled into a relative one) andmux-data.d.tsusesimport("mux-embed").Metadata, butmux-embedpublishes notypesentry, so a strict consumer gets TS6053 and TS7016 through any@videojs/react/media/mux-*or@videojs/react/extensions/mux-dataimport (the html equivalents have the same exposure; the html fixture just does not import them). That is a@videojs/mediafix, so the react fixture leaves the Mux entries out with a note and this PR does not touchpackages/media.Testing
pnpm exec tsgo --project packages/react/tests/public-types/tsconfig.jsonagainst the unmodified build: 2 errors (above).pnpm exec vp run @videojs/react#build: pass;grep -rn 'index_d_exports\.' packages/react/dist/devnow returns nothing.pnpm exec vp run @videojs/react#check:public-types: pass; second run is a 14/14 cache hit and replays.pnpm -F @videojs/react test: 65 files, 538 tests passed.pnpm lint:fix:fileon every touched file: 0 errors (4 pre-existingrequire-safety-comment-for-type-assertionwarnings increate-context-part.tsx, untouched).pnpm typecheckafter deletingpackages/*/tsconfig*.tsbuildinfoandpackages/*/types: pass.pnpm check:workspace: 10 passed.git diff --check: clean.🤖 Generated with Claude Code