chore: scope docsite tsconfig types so ambient typings don't leak into Storybook props tables - #36607
Open
Dmytro Kirpa (dmytrokirpa) wants to merge 1 commit into
Conversation
…o Storybook props tables react-docgen-typescript resolves the tsconfig.json at the Storybook cwd. These solution configs had no 'types' array, so TypeScript auto-included every package under the repo's typeRoots (including typings/focusgroup, which augments React's HTMLAttributes). That surfaced 'focusgroup' and 'focusgroupstart' as props on every documented component. Declare the types the docsites actually need, matching the library/stories tsconfigs.
📊 Bundle size report✅ No changes found |
|
Pull request demo site: URL |
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.
Description
focusgroupandfocusgroupstartwere showing up in the props table of every component documented inpublic-docsite-v9andpublic-docsite-v9-headless.Root cause
react-docgen-typescriptresolves./tsconfig.jsonrelative to the Storybook cwd — the docsite project root. Those are solution-style configs (include: [],files: []) that extendtsconfig.base.all.jsonand inherit:Because they declared no
typesarray, TypeScript auto-included every package folder undertypeRoots— includingtypings/focusgroup, which does a globaldeclare module 'react'augmentation addingfocusgroup/focusgroupstarttoHTMLAttributes. Storybook's default docgenpropFilteronly excludes props declared undernode_modules, and this typing lives in the repo, so it passed straight through onto every component.https://storybooks.fluentui.dev/react/?path=/docs/components-accordion--docs
Fix
Declare the types the docsites actually need, mirroring what the
library/storiestsconfigs already use:This is a no-op for type-checking (the configs contain no files) and stops the ambient auto-inclusion that docgen was picking up.
Note: published
.d.tsfiles were not affected — verified there is no/// <reference types=\"focusgroup\" />indist, since no public API references a symbol declared by that typing.https://fluentuipr.z22.web.core.windows.net/pull/36607/public-docsite-v9/react/index.html?path=/docs/components-accordion--docs
Verification
focusgroup/focusgroupstartfocusgroupprop) still render