Skip to content

Conversation

@rivea0
Copy link

@rivea0 rivea0 commented Nov 11, 2025

Fixes #631.

With the previous example:

(arr: Array<string>) => arr.map(parseInt)

parseInt gets the indices as its second parameter for the base.

Providing a callback where we pass the item gets rid of the issue:

(arr: Array<string>) => arr.map((s) => parseInt(s))

The base now defaults to 10.

To be even more explicit, we could have also added the second argument to parseInt as well, and maybe a comment to explain it:

// Parse the number as base-10
(arr: Array<string>) => arr.map((s) => parseInt(s, 10))

I think the first option is sufficient, but I can make changes to the PR if needed.

@changeset-bot
Copy link

changeset-bot bot commented Nov 11, 2025

⚠️ No Changeset found

Latest commit: 19a96c2

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

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.

Error in the example in readme

1 participant