Upgrade to TypeScript 6, enable strict mode, remove leetcode folders#253
Merged
Conversation
- Remove all leetcode/ folders (10 directories)
- Bump typescript 5.9.2 -> 6.0.3
- Add @types/node for Node.js globals (console, process, etc.)
- Enable strict: true in tsconfig.json (was commented out)
- Add types: ["node"] to tsconfig.json
- Fix TS2300/TS2451: add export {} to script-style files that had
duplicate global identifiers (08-typescript.ts, 11-array-chunking.ts,
13-remove-duplicates.ts, 14-array-rotation.ts)
- Fix TS2345: type reduceRight initial value in 05-transforming-array.ts
- Fix TS2322/TS7006: add explicit types in 07-multidimensional-arrays.ts
- Fix TS2538/TS2532: guard pop() result before use in decimal-to-base.ts
and decimal-to-binary.ts
- Fix TS2339: replace .toString() with String() on unconstrained generics
in stack.ts, queue.ts, deque.ts, linked-list.ts, doubly-linked-list.ts,
hash-table.ts
- Fix TS7034/TS7005: type queue variable in queue.test.ts
- Fix TS2564/TS18047/TS2322: unify node pointers on null (not undefined),
initialize head/tail/next to null, add null guards in linked-list.ts,
doubly-linked-list.ts, circular-linked-list.ts
- Fix TS7006/TS7015: type hash function parameters in hash-table.ts
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.
Summary
Adopts TypeScript 6 properly — no shortcuts, no
@ts-ignore, noanycasts.Changes
Removed
leetcode/folders (26 files deleted)Dependencies
typescript5.9.2→6.0.3@types/nodeadded (providesconsole,process, etc. for Node.js)tsconfig.json"strict": true— uncommented (was commented out; TS 6 enables it by default anyway, now it's explicit)"types": ["node"]— added for Node.js globalsoutDirlineSource fixes (by error category)
export {}to script-style files (08-typescript.ts,11-array-chunking.ts,13-remove-duplicates.ts,14-array-rotation.ts) to give each file its own module scopeanylet queue: Queue<unknown>, typed lambda params inhash-table.ts, typed array param inmultidimensional-arrays.ts).toString()on unconstrained genericT.toString()calls withString()instack.ts,queue.ts,deque.ts,linked-list.ts,doubly-linked-list.ts,hash-table.ts—String()works on any valuehead,tail,nexttonullin all three linked-list classesnullnullvsundefinedmismatch| null(was inconsistently mixingnullandundefined)undefinedbefore index/callpop()result guards indecimal-to-base.tsanddecimal-to-binary.tsreduceRightinitial value type in05-transforming-array.ts; fixed array type annotations in07-multidimensional-arrays.tsand13-remove-duplicates.tsNumber()on hash key before indexing inhash-table.tsVerification