Skip to content

chore: Enable strict type checking in design system - #3979

Draft
maciaszczykm wants to merge 13 commits into
masterfrom
marcin/prod-4145-enable-strict-type-checking-in-ds
Draft

chore: Enable strict type checking in design system#3979
maciaszczykm wants to merge 13 commits into
masterfrom
marcin/prod-4145-enable-strict-type-checking-in-ds

Conversation

@maciaszczykm

@maciaszczykm maciaszczykm commented Aug 7, 2026

Copy link
Copy Markdown
Member

TODO:

  • Move preview to Vercel or another platform.

Test Plan

Test environment: https://console.your-env.onplural.sh/

Checklist

  • I have added a meaningful title and summary to convey the impact of this PR to a user.
  • If required, I have updated the Plural documentation accordingly.
  • I have added tests to cover my changes.
  • I have deployed the agent to a test environment and verified that it works as expected (required only when changing agent code).

Plural Flow: console

@linear

linear Bot commented Aug 7, 2026

Copy link
Copy Markdown

PROD-4145

@soffi-ai

soffi-ai Bot commented Aug 7, 2026

Copy link
Copy Markdown

Soffi AI Summary

This PR incrementally enables strict TypeScript checking in the @pluralsh/design-system internal package, which had previously opted out of most strict compiler checks. The motivation is to improve type safety and catch latent bugs in the design system component library.

The work proceeds flag-by-flag: noImplicitAny, strictNullChecks, strictFunctionTypes, strictBindCallApply, noImplicitThis, and alwaysStrict are all turned on in sequence. Each newly enabled flag required fixing real type errors across several core components — primarily around useRef generics (changing useRef(null)useRef<T | null>(null)), optional prop types, nullable context values, and callback signatures that were relying on variadic spreads (...args) to avoid typing.

Beyond compiler flags, the stories for the design system are migrated from the legacy Storybook CSF2 format to the modern CSF3 Meta + StoryObj API, which was necessary to satisfy strictBindCallApply on StoryFn. A new GitHub Actions workflow (design-system-preview.yaml) and Firebase hosting config are added to enable preview deployments of the Storybook for the design system. A CodeEditor fix and checklist/test improvements are also included as collateral cleanup.

Commits

Commit Summary
0f5f04c Enables alwaysStrict in the design system tsconfig, ensuring all files are parsed in ECMAScript strict mode.
ab77c61 Enables strictBindCallApply and migrates Storybook stories to CSF3 StoryObj format, which was required to resolve type errors introduced by this flag on StoryFn.
0653b3b Enables noImplicitThis, fixing any component code relying on an implicitly-typed this context.
f80c11e Migrates design system stories to the modern Storybook CSF3 Meta/StoryObj API, decoupling story migration from the strict-type flag work.
18cc2f8 Enables strictFunctionTypes, fixing callback signature mismatches (e.g., ComboBox callback wrappers that used variadic ...args spreads were narrowed to their exact signatures).
ed94429 Enables strictNullChecks, the most impactful flag — fixes useRef generics across many components (e.g., `useRef<T
0a7d7ac Enables noImplicitAny in the design system, the first strict flag to be turned on.
11cdf24 Formats code to satisfy linting/Prettier rules after the type-fix changes.
246eef8 Restores the Storybook preview configuration that was inadvertently broken during story migrations.
8adf668 Fixes a runtime regression in the CodeEditor component introduced by the strict-type refactoring.
11c3570 Adds a GitHub Actions workflow and Firebase hosting config to publish Storybook preview deployments for the design system on PRs.
bbfc5ec Fixes the Checklist component after strictness-related type errors.
084d0fc Improves tests to cover the changes introduced by strict type checking.

Deploy in Soffi


Updated: 2026-08-07 13:32 UTC

@maciaszczykm maciaszczykm added the enhancement New feature or request label Aug 7, 2026
@maciaszczykm
maciaszczykm requested a balanced review from Copilot August 7, 2026 13:22
@maciaszczykm

Copy link
Copy Markdown
Member Author

@greptileai

@greptile-apps

greptile-apps Bot commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR enables strict TypeScript checking across the design system and resolves the resulting type errors while preserving existing component behavior.

  • Normalizes optional values and nullable refs throughout design-system components and stories.
  • Adds Firebase-hosted Storybook previews for design-system pull requests.
  • Pins every GitHub Action used by the preview workflow to an immutable commit SHA.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Important Files Changed

Filename Overview
assets/design-system/tsconfig.json Enables strict TypeScript checking for the design-system package.
assets/design-system/src/components/CodeEditor.tsx Correctly normalizes omitted values to an empty string when initializing, comparing, and updating editor state.
.github/workflows/design-system-preview.yaml Adds the Storybook preview deployment workflow with all third-party actions pinned to immutable commit SHAs.

Reviews (2): Last reviewed commit: "improve tests" | Re-trigger Greptile

Comment thread assets/design-system/src/components/CodeEditor.tsx Outdated
Comment thread .github/workflows/design-system-preview.yaml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables strict TypeScript checks for the design system and updates affected components, utilities, and Storybook stories.

Changes:

  • Enables inherited strict checks plus noImplicitAny.
  • Migrates stories to typed Storybook object syntax.
  • Improves nullability handling and adds Firebase Storybook previews.

Reviewed changes

Copilot reviewed 145 out of 145 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
assets/design-system/tsconfig.json Enables strict implicit-any checking.
assets/design-system/src/utils/useBimodalSelectState.ts Tightens selection nullability.
assets/design-system/src/utils/urls.ts Handles nullable URLs.
assets/design-system/src/utils/scrollIntoContainerView.ts Requires calculated scroll values.
assets/design-system/src/types.ts Handles absent severity allowlists.
assets/design-system/src/theme/focus.ts Adjusts inset focus styling.
assets/design-system/src/stories/Wizard.stories.tsx Types Wizard stories.
assets/design-system/src/stories/ValidatedInput.stories.tsx Types ValidatedInput stories.
assets/design-system/src/stories/UserDetails.stories.tsx Types UserDetails stories.
assets/design-system/src/stories/Typography.tsx Types typography story data.
assets/design-system/src/stories/TreeNavigation.stories.tsx Types TreeNavigation stories.
assets/design-system/src/stories/Tooltip.stories.tsx Types Tooltip stories.
assets/design-system/src/stories/Toast.stories.tsx Types Toast stories.
assets/design-system/src/stories/TipCarousel.stories.tsx Types TipCarousel stories.
assets/design-system/src/stories/TextSwitch.stories.tsx Types TextSwitch stories.
assets/design-system/src/stories/TagMultiselectTemplate.tsx Initializes controlled story state.
assets/design-system/src/stories/TabList.stories.tsx Types TabList stories and refs.
assets/design-system/src/stories/Table.stories.tsx Types Table stories and slices.
assets/design-system/src/stories/Tab.stories.tsx Types Tab stories.
assets/design-system/src/stories/Switch.stories.tsx Types Switch stories.
assets/design-system/src/stories/Stepper.stories.tsx Types Stepper stories.
assets/design-system/src/stories/StackCard.stories.tsx Types StackCard stories.
assets/design-system/src/stories/Slider.stories.tsx Types Slider stories.
assets/design-system/src/stories/Sidecar.stories.tsx Types Sidecar stories.
assets/design-system/src/stories/Select.stories.tsx Types Select story state.
assets/design-system/src/stories/SegmentedInput.stories.tsx Types SegmentedInput stories.
assets/design-system/src/stories/RepositoryChip.stories.tsx Types RepositoryChip stories.
assets/design-system/src/stories/RepositoryCard.stories.tsx Types RepositoryCard stories.
assets/design-system/src/stories/Radio.stories.tsx Types Radio story state.
assets/design-system/src/stories/PropWide.stories.tsx Types PropWide stories.
assets/design-system/src/stories/PropsContainer.stories.tsx Types PropsContainer stories.
assets/design-system/src/stories/Prop.stories.tsx Types Prop stories.
assets/design-system/src/stories/ProgressBar.stories.tsx Types ProgressBar stories.
assets/design-system/src/stories/PageTitle.stories.tsx Types PageTitle stories.
assets/design-system/src/stories/PageCard.stories.tsx Types PageCard stories.
assets/design-system/src/stories/NavigationContextStub.tsx Types navigation stub behavior.
assets/design-system/src/stories/Modal.stories.tsx Types Modal stories.
assets/design-system/src/stories/Markdown.stories.tsx Types Markdown stories.
assets/design-system/src/stories/LoopingLogo.stories.tsx Types LoopingLogo stories.
assets/design-system/src/stories/LoadingSpinner.stories.tsx Types LoadingSpinner stories.
assets/design-system/src/stories/ListBox.stories.tsx Types ListBox stories.
assets/design-system/src/stories/Input.stories.tsx Types Input stories.
assets/design-system/src/stories/InlineCode.stories.tsx Types InlineCode stories.
assets/design-system/src/stories/Icons.stories.tsx Types icon stories and styles.
assets/design-system/src/stories/IconFrame.stories.tsx Types IconFrame stories.
assets/design-system/src/stories/Highlight.stories.tsx Types Highlight stories.
assets/design-system/src/stories/FormTitle.stories.tsx Types FormTitle stories.
assets/design-system/src/stories/FormField.stories.tsx Types FormField stories.
assets/design-system/src/stories/Flyover.stories.tsx Types Flyover stories.
assets/design-system/src/stories/EmptyState.stories.tsx Types EmptyState stories.
assets/design-system/src/stories/Divider.stories.tsx Types Divider stories.
assets/design-system/src/stories/DiffViewer.stories.tsx Types DiffViewer stories.
assets/design-system/src/stories/Date.stories.tsx Types Date stories.
assets/design-system/src/stories/ComboBox.stories.tsx Types ComboBox stories and search results.
assets/design-system/src/stories/Colors.tsx Migrates the Colors story object.
assets/design-system/src/stories/Codeline.stories.tsx Types Codeline stories.
assets/design-system/src/stories/CodeEditor.stories.tsx Types CodeEditor stories.
assets/design-system/src/stories/Code.stories.tsx Types Code stories.
assets/design-system/src/stories/ClusterTagsTemplate.tsx Types loading and icon behavior.
assets/design-system/src/stories/ChipList.stories.tsx Types ChipList stories.
assets/design-system/src/stories/Chip.stories.tsx Types Chip stories and sizes.
assets/design-system/src/stories/Checklist.stories.tsx Types Checklist stories.
assets/design-system/src/stories/CheckBox.stories.tsx Types Checkbox stories.
assets/design-system/src/stories/CatalogCard.stories.tsx Types CatalogCard stories.
assets/design-system/src/stories/Card.stories.tsx Types Card stories.
assets/design-system/src/stories/Callout.stories.tsx Types Callout stories.
assets/design-system/src/stories/ButtonGroup.stories.tsx Types ButtonGroup stories and refs.
assets/design-system/src/stories/Button.stories.tsx Types Button stories.
assets/design-system/src/stories/Breadcrumbs.stories.tsx Types Breadcrumbs stories.
assets/design-system/src/stories/Banner.stories.tsx Types Banner stories and controls.
assets/design-system/src/stories/AWSIcons.stories.tsx Types AWS icon stories.
assets/design-system/src/stories/Avatar.stories.tsx Types Avatar stories.
assets/design-system/src/stories/AppIcon.stories.tsx Types AppIcon stories.
assets/design-system/src/stories/Accordion.stories.tsx Types Accordion stories.
assets/design-system/src/stories/A.stories.tsx Types link stories.
assets/design-system/src/stories/_SemanticSystem.stories.tsx Types semantic-system stories.
assets/design-system/src/markdoc/types.ts Specifies Markdoc component props.
assets/design-system/src/markdoc/tags/button.markdoc.ts Resolves Markdoc render typing.
assets/design-system/src/markdoc/runtimeSchema.ts Handles optional schema records.
assets/design-system/src/markdoc/components/Fence.tsx Handles optional fence content.
assets/design-system/src/hooks/useResizeObserver.ts Types observer lifecycle state.
assets/design-system/src/hooks/useRefResizeObserver.tsx Accepts nullable element refs.
assets/design-system/src/GlobalStyle.tsx Guards non-object color values.
assets/design-system/src/components/wizard/Wizard.tsx Tightens Wizard context and children handling.
assets/design-system/src/components/wizard/Stepper.tsx Types Wizard context access.
assets/design-system/src/components/wizard/Picker.tsx Handles optional labels and search.
assets/design-system/src/components/wizard/Navigation.tsx Types generic Wizard context.
assets/design-system/src/components/wizard/hooks.ts Adds Wizard state guards.
assets/design-system/src/components/wizard/context.ts Makes absent Wizard context explicit.
assets/design-system/src/components/ValidatedInput.tsx Types validation state.
assets/design-system/src/components/TreeNavigation.tsx Normalizes optional booleans and callbacks.
assets/design-system/src/components/Tooltip.tsx Handles optional trigger elements.
assets/design-system/src/components/Toast.tsx Types timers and GraphQL errors.
assets/design-system/src/components/TextSwitch.tsx Types radio state and refs.
assets/design-system/src/components/TagMultiSelect.tsx Types match selections.
assets/design-system/src/components/TabPanel.tsx Handles optional tab metadata.
assets/design-system/src/components/TabList.tsx Guards tab refs and IDs.
assets/design-system/src/components/table/Th.tsx Normalizes highlight state.
assets/design-system/src/components/table/tableUtils.ts Types virtualizer options.
assets/design-system/src/components/table/Table.tsx Tightens virtual table nullability.
assets/design-system/src/components/table/hooks.ts Makes slice callback optional.
assets/design-system/src/components/Tab.tsx Uses undefined for absent borders.
assets/design-system/src/components/Switch.tsx Defaults the switch variant.
assets/design-system/src/components/SubTab.tsx Normalizes SubTab booleans.
assets/design-system/src/components/Stepper.tsx Types the Stepper ref and width.
assets/design-system/src/components/Spinner.tsx Adds safe spinner color defaults.
assets/design-system/src/components/Slider.tsx Adds a default slider size.
assets/design-system/src/components/SelectItem.tsx Types radio state and refs.
assets/design-system/src/components/SelectComboShared.tsx Tightens shared selection callbacks.
assets/design-system/src/components/Select.tsx Types Select refs and trigger props.
assets/design-system/src/components/SegmentedInput.tsx Exposes a nullable input ref.
assets/design-system/src/components/ReactAriaPopover.tsx Types the popover ref and state.
assets/design-system/src/components/RadioGroup.tsx Types the radio context.
assets/design-system/src/components/Radio.tsx Types radio state and handlers.
assets/design-system/src/components/ProgressBar.tsx Defaults missing determinate progress.
assets/design-system/src/components/PopoverCornerScale.tsx Normalizes open state.
assets/design-system/src/components/PanZoomWrapper.tsx Uses the validated container reference.
assets/design-system/src/components/Modal.tsx Adds safe modal dimensions.
assets/design-system/src/components/Markdown.tsx Makes link metadata optional.
assets/design-system/src/components/LoopingLogoAlternative.tsx Types optional scaling styles.
assets/design-system/src/components/LoopingLogo.tsx Types optional scaling styles.
assets/design-system/src/components/LoadingSpinner.tsx Guards nullable centering refs.
assets/design-system/src/components/ListBoxItem.tsx Safely resolves theme colors.
assets/design-system/src/components/ListBox.tsx Handles optional children and refs.
assets/design-system/src/components/Input2.tsx Tightens padding and event typing.
assets/design-system/src/components/IconFrame.tsx Allows absent mapped colors.
assets/design-system/src/components/Highlight.tsx Guards optional languages.
assets/design-system/src/components/Flex.tsx Handles optional tooltip and spacing.
assets/design-system/src/components/EmptyState.tsx Removes the null icon default.
assets/design-system/src/components/contexts/BreadcrumbsContext.tsx Handles absent breadcrumb context.
assets/design-system/src/components/ComboBox.tsx Tightens ComboBox refs and callbacks.
assets/design-system/src/components/CodeEditor.tsx Normalizes optional editor values.
assets/design-system/src/components/Code.tsx Handles optional tabs and content.
assets/design-system/src/components/ChipList.tsx Guards optional click callbacks.
assets/design-system/src/components/ChecklistItem.tsx Types nullable checklist selection.
assets/design-system/src/components/Checklist.tsx Tightens checklist callback handling.
assets/design-system/src/components/Checkbox.tsx Types checkbox refs and booleans.
assets/design-system/src/components/Card.tsx Defaults the card header size.
assets/design-system/src/components/Button.tsx Normalizes disabled state.
assets/design-system/src/components/Breadcrumbs.tsx Defaults breadcrumb arrays and refs.
assets/design-system/src/components/ArrowScroll.tsx Types the container ref.
assets/design-system/src/components/AppIcon.tsx Handles optional icon styling.
assets/design-system/firebase.json Configures Storybook Firebase hosting.
assets/design-system/.firebaserc Selects the Firebase project.
.github/workflows/design-system-preview.yaml Deploys per-PR Storybook previews.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread assets/design-system/src/components/Checklist.tsx Outdated
Comment thread assets/design-system/src/utils/urls.ts
@maciaszczykm
maciaszczykm requested a balanced review from Copilot August 7, 2026 13:32
@maciaszczykm

Copy link
Copy Markdown
Member Author

@greptileai

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 146 out of 146 changed files in this pull request and generated 1 comment.

Suppressed comments (2)

assets/design-system/src/stories/Radio.stories.tsx:65

  • Resetting to undefined makes React Stately treat the radio group as uncontrolled, so its internal selected value can remain and the Reset button no longer reliably clears the selection. Use a controlled empty value (for example, '') instead.
    .github/workflows/design-system-preview.yaml:19
  • This job also runs for pull requests from forks, but GitHub withholds FIREBASE_SERVICE_ACCOUNT_PLURALSH_DESIGN for fork-triggered pull_request workflows, so the deploy step will fail every external PR that touches the design system. Skip fork PRs (or conditionally skip only the deploy step) when the credential is unavailable.
    if: ${{ github.actor != 'renovate[bot]' }}

"noImplicitThis": false,
"alwaysStrict": false
// Override parent tsconfig.app.json (keeps noImplicitAny off for console)
"noImplicitAny": true

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tsc --build already succeeds under the design system strict: true. Current @types/react has an overload for useRef<T>(initialValue: T | undefined), so this is legal under strictNullChecks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants