Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to Node 22 and clean up relevant code #32

Open
5 tasks
ecxyzzy opened this issue Nov 13, 2024 · 0 comments · May be fixed by #44
Open
5 tasks

Upgrade to Node 22 and clean up relevant code #32

ecxyzzy opened this issue Nov 13, 2024 · 0 comments · May be fixed by #44
Assignees

Comments

@ecxyzzy
Copy link
Member

ecxyzzy commented Nov 13, 2024

Node.js 22 has just hit LTS, bringing with it some additional goodies like support for Iterator.toArray and Iterator.map.

We're also no longer constrained to Node 20, since Cloudflare has confirmed that using their codegen for types (which we are) means we do not need to pin the @types/node package to v20, so we can actually upgrade to Node 22.

Context

This will be useful in cleaning up components of our data pipelines, since we use the following pattern a lot:

const theMap = new Map<string, unknown>();

const res = Array.from(theMap.keys()).map((key) => { ... });

Which can then be converted into this pattern:

const theMap = new Map<string, unknown>();

// toArray can even be omitted in cases where the function consuming res accepts an Iterator
const res = theMap.keys().map((key) => { ... }).toArray();

Action Items

  • Set version in .nvmrc to 22.11.0
  • Install latest @types/node at workspace level
  • Remove @types/node at package level
  • Refactor code using Array.from
  • Verify that nothing broke
@andrew-wang0 andrew-wang0 self-assigned this Nov 24, 2024
@andrew-wang0 andrew-wang0 linked a pull request Nov 24, 2024 that will close this issue
5 tasks
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 a pull request may close this issue.

2 participants