fix: correct resource type ordering and type handling in sync script - #10212
Open
oscarbol09 wants to merge 2 commits into
Open
fix: correct resource type ordering and type handling in sync script#10212oscarbol09 wants to merge 2 commits into
oscarbol09 wants to merge 2 commits into
Conversation
The sort only knew about official/opensource/article/video/feed, so course, podcast, book and roadmap resources got indexOf -1 and were placed before everything else. Derive the sort order from the allowed resource types list instead. Also imports HTMLElement from node-html-parser to fix the suppressed TS2740 error (the @ts-expect-error workaround is no longer needed) and drops the 'as any' cast.
tsc --noEmit was never wired into the repo, which is how the suppressed type error went unnoticed. Add a script so the sync tooling can be typechecked.
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.
What
Fixes two issues in
scripts/sync-repo-to-database.tsand wires up type checking so they cannot regress:Resource type ordering bug — the
sort()only knew aboutofficial,opensource,article,videoandfeed. Resources of typecourse,podcast,bookandroadmapgotindexOf-1 and were therefore sorted before everything else, breaking the order documented incontributing.md. The sort order is now derived fromallowedOfficialRoadmapTopicResourceType, the single source of truth.Suppressed type error (TODO) — the
@ts-expect-error - TODO: fix thisat line 177 was masking a realTS2740:HTMLElementresolved to the DOM lib type whilequerySelectorAll('ul')returnsnode-html-parser'sHTMLElement(274+ properties missing). Fixed by importing the type fromnode-html-parser; the directive is removed. Also removed anas anycast in the same block.No typecheck script existed — the sync tooling was never typechecked (tsx skips it), which is why the suppressed error went unnoticed. Added
npm run typecheck(tsc --noEmit).Verification
npx tsc --noEmitpasses cleanly with the directive removed.node-html-parser+markdown-it): before,course, book, podcast, roadmaplinks landed first; after, output follows the canonical orderroadmap, official, opensource, article, course, podcast, video, book, feed.prettier --checkpasses.