Upgrade to TypeScript 6, enable strict mode, remove leetcode folders by loiane · Pull Request #253 · loiane/javascript-datastructures-algorithms · GitHub
Skip to content

Upgrade to TypeScript 6, enable strict mode, remove leetcode folders#253

Merged
loiane merged 1 commit into
mainfrom
loiane/typescript-6
Jul 1, 2026
Merged

Upgrade to TypeScript 6, enable strict mode, remove leetcode folders#253
loiane merged 1 commit into
mainfrom
loiane/typescript-6

Conversation

@loiane

@loiane loiane commented Jul 1, 2026

Copy link
Copy Markdown
Owner

Summary

Adopts TypeScript 6 properly — no shortcuts, no @ts-ignore, no any casts.

Changes

Removed

  • All 10 leetcode/ folders (26 files deleted)

Dependencies

  • typescript 5.9.26.0.3
  • @types/node added (provides console, 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 globals
  • Removed commented-out outDir line

Source fixes (by error category)

Error Fix
TS2300 / TS2451 — duplicate global identifiers Added 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 scope
TS7005 / TS7006 / TS7034 — implicit any Added explicit type annotations (let queue: Queue<unknown>, typed lambda params in hash-table.ts, typed array param in multidimensional-arrays.ts)
TS2339.toString() on unconstrained generic T Replaced .toString() calls with String() in stack.ts, queue.ts, deque.ts, linked-list.ts, doubly-linked-list.ts, hash-table.tsString() works on any value
TS2564 — property not definitely assigned Initialized head, tail, next to null in all three linked-list classes
TS18047 / TS18048 — possibly null Added null guards throughout linked-list traversal/mutation methods
TS2322null vs undefined mismatch Unified all node pointer types on | null (was inconsistently mixing null and undefined)
TS2538 / TS2532undefined before index/call Added pop() result guards in decimal-to-base.ts and decimal-to-binary.ts
TS2345 — argument type mismatch Fixed reduceRight initial value type in 05-transforming-array.ts; fixed array type annotations in 07-multidimensional-arrays.ts and 13-remove-duplicates.ts
TS7015 — non-number array index Used Number() on hash key before indexing in hash-table.ts

Verification

npx tsc --noEmit  →  0 errors
npm test          →  83 tests passed, 7 suites

- 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
@loiane loiane merged commit 5d08fa5 into main Jul 1, 2026
1 check passed
@loiane loiane deleted the loiane/typescript-6 branch July 1, 2026 00:28
@loiane loiane mentioned this pull request Jul 1, 2026
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.

1 participant