refactor(superdoc): drop redundant === false checks (SD-2867 phase B)#3067
Merged
Conversation
Contributor
|
🎉 This PR is included in superdoc-cli v0.8.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.8.0 |
Contributor
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in superdoc v1.31.0 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in @superdoc-dev/mcp v0.3.0-next.33 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.75 The release is available on GitHub release |
Contributor
|
🎉 This PR is included in vscode-ext v2.3.0-next.77 |
Contributor
|
🎉 This PR is included in superdoc-sdk v1.8.0-next.37 |
Contributor
|
🎉 This PR is included in vscode-ext v2.3.0 |
Contributor
|
🎉 This PR is included in @superdoc-dev/react v1.3.0 The release is available on GitHub release |
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.
Stacked on #3066. Closes two TS2367 errors by removing comparisons that are dead under the existing truthy/falsy guards.
Modules.commentsis typed asfalse | object | undefined. Both call sites already test the value with the truthy/falsy operator, which rules outfalseandundefinedtogether — so the explicit!== falseand=== falseafterwards are redundant. TS2367 fires because after the truthy narrowing, the remaining type has no overlap withboolean, which is the engine telling us the comparison is dead.#initVueAppsimplified fromcommentsModuleConfig && commentsModuleConfig !== false ? commentsModuleConfig : {}tocommentsModuleConfig || {}(same semantics for every value of the union).scrollToCommentsimplified fromif (!commentsConfig || commentsConfig === false) return false;toif (!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:jsdocclean;pnpm --filter superdoc build:esdeclaration audit clean;node tests/consumer-typecheck/typecheck-matrix.mjs33 passed, 0 failed.