Skip to content

chore(typescript): enable strict mode - #4690

Merged
thetaPC merged 1 commit into
mainfrom
ts-strict
Sep 2, 2026
Merged

chore(typescript): enable strict mode#4690
thetaPC merged 1 commit into
mainfrom
ts-strict

Conversation

@thetaPC

@thetaPC thetaPC commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Issue URL: internal

What is the current behavior?

strict is off. Turning it on reports 144 errors across 21 files, so much of src/ is implicitly any and unchecked.

Docusaurus v4 requires TypeScript 6, where strict defaults to on, so this work is on the critical path for that upgrade rather than optional.

What is the new behavior?

"strict": true, at zero errors.

The config change is one line. The other 25 files are the 144 errors it surfaced, and they collapse into a few causes:

  • Untyped props. Around 20 components took props with no annotation. Most became ComponentProps<'div'> or similar.
  • Types that were wrong at the source, where one fix cleared a cluster. generateColor declared it returned ColorVariable, whose fields are all optional, while it populates every one. Three iframe helpers took HTMLIFrameElement despite each already having an if (frame) guard inside. Two useState([]) calls inferred never[]. MdxContent was typed () => {}, which is not renderable.
  • Nullable refs and DOM lookups, mostly in the playground, handled by hoisting the value and guarding once rather than chaining at each use.

Does this introduce a breaking change?

  • Yes
  • No

Other information

Real bugs surfaced, all previously invisible because the surrounding code was any:

  • aria-hidden={... : null} in four places. React omits an attribute for undefined; null is not an accepted value.
  • A ref callback returning a value: ref={(tabControl) => tabRefs.push(tabControl)}. React 19 reads a returned value as a cleanup function.

@vercel

vercel Bot commented Sep 1, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Sep 1, 2026 9:56pm UTC

Request Review

@thetaPC
thetaPC marked this pull request as ready for review September 1, 2026 22:00
@thetaPC
thetaPC requested a review from a team as a code owner September 1, 2026 22:00

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good!

@thetaPC
thetaPC merged commit 07f9946 into main Sep 2, 2026
4 checks passed
@thetaPC
thetaPC deleted the ts-strict branch September 2, 2026 17:36
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.

2 participants