Skip to content

refactor(superdoc): drop redundant === false checks (SD-2867 phase B)#3067

Merged
caio-pizzol merged 4 commits into
mainfrom
caio/SD-2867-phase-b-redundant-false-checks
May 1, 2026
Merged

refactor(superdoc): drop redundant === false checks (SD-2867 phase B)#3067
caio-pizzol merged 4 commits into
mainfrom
caio/SD-2867-phase-b-redundant-false-checks

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Stacked on #3066. Closes two TS2367 errors by removing comparisons that are dead under the existing truthy/falsy guards.

Modules.comments is typed as false | object | undefined. Both call sites already test the value with the truthy/falsy operator, which rules out false and undefined together — so the explicit !== false and === false afterwards are redundant. TS2367 fires because after the truthy narrowing, the remaining type has no overlap with boolean, which is the engine telling us the comparison is dead.

  • #initVueApp simplified from commentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {} to commentsModuleConfig || {} (same semantics for every value of the union).
  • scrollToComment simplified from if (!commentsConfig || commentsConfig === false) return false; to if (!commentsConfig) return false; (same behavior).

Behavior is preserved for every value the union can take. Added short comments at each site so future readers see why the simpler form is sufficient under the typedef.

Verified: pnpm --filter superdoc check:jsdoc clean; pnpm --filter superdoc build:es declaration audit clean; node tests/consumer-typecheck/typecheck-matrix.mjs 33 passed, 0 failed.

@caio-pizzol caio-pizzol requested a review from a team as a code owner May 1, 2026 21:25
@linear
Copy link
Copy Markdown

linear Bot commented May 1, 2026

Base automatically changed from caio/SD-2867-phase-b-setlocked-ydoc to main May 1, 2026 21:28
@caio-pizzol caio-pizzol merged commit c3a155e into main May 1, 2026
46 checks passed
@caio-pizzol caio-pizzol deleted the caio/SD-2867-phase-b-redundant-false-checks branch May 1, 2026 21:51
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 1, 2026

🎉 This PR is included in superdoc-cli v0.8.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 1, 2026

🎉 This PR is included in superdoc-sdk v1.8.0

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 1, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.3.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 1, 2026

🎉 This PR is included in superdoc v1.31.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 2, 2026

🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.33

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 2, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.75

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 2, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.77

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 2, 2026

🎉 This PR is included in superdoc-sdk v1.8.0-next.37

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 5, 2026

🎉 This PR is included in vscode-ext v2.3.0

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented May 7, 2026

🎉 This PR is included in @superdoc-dev/react v1.3.0

The release is available on GitHub release

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant