Skip to content

feat: update Node.js types and add node: prefix to imports#1186

Merged
streamich merged 2 commits intomasterfrom
copilot/fix-1185
Sep 16, 2025
Merged

feat: update Node.js types and add node: prefix to imports#1186
streamich merged 2 commits intomasterfrom
copilot/fix-1185

Conversation

Copy link
Contributor

Copilot AI commented Sep 16, 2025

This PR updates the project to use modern Node.js import patterns and the latest type definitions.

Changes Made

Updated @types/node dependency:

  • Upgraded from ^10.17.60 to ^24.5.0 to use the latest Node.js type definitions

Modernized import statements:

  • Added node: prefix to all Node.js built-in module imports (21 total imports updated)
  • Updated imports for: buffer, events, fs, path, stream, url, and util modules
  • This follows the modern Node.js best practice of explicitly identifying built-in modules

Fixed type compatibility issues:

  • Updated function signatures to use proper BufferEncoding types instead of generic strings
  • Fixed Buffer.from() type casting for ArrayBuffer/ArrayBufferView parameters
  • Added optional chaining for process.getuid()/process.getgid() calls to handle platforms where these methods are undefined
  • Enhanced dataToBuffer function to properly handle the extended encoding type that includes 'buffer'
  • Fixed type casting in directory traversal operations

Benefits

  • Modern standards: Uses current Node.js import conventions with explicit node: prefixes
  • Better type safety: Leverages the latest Node.js type definitions for improved development experience
  • Future-proof: Ensures compatibility with modern Node.js tooling and bundlers
  • No breaking changes: All existing functionality is preserved with full test coverage

All builds pass, formatting is correct, and the complete test suite (888 tests) runs successfully with no regressions.

Fixes #1185.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Co-authored-by: streamich <9773803+streamich@users.noreply.github.com>
Copilot AI changed the title [WIP] Update Node.js types feat: update Node.js types and add node: prefix to imports Sep 16, 2025
Copilot AI requested a review from streamich September 16, 2025 13:33
@streamich streamich marked this pull request as ready for review September 16, 2025 13:37
@streamich streamich merged commit 1e5b7c3 into master Sep 16, 2025
20 checks passed
@streamich streamich deleted the copilot/fix-1185 branch September 16, 2025 13:41
@github-actions
Copy link
Contributor

🎉 This PR is included in version 4.40.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Update Node.js types

2 participants