Skip to content

Make the conversions of parseInt and isNaN explicit - #59799

Open
SamChou19815 wants to merge 1 commit into
mainfrom
export-D129644365
Open

SamChou19815 wants to merge 1 commit into
mainfrom
export-D129644365

Conversation

@SamChou19815

Copy link
Copy Markdown
Member

Summary:
TypeScript declares parseInt(string: string, radix?: number) and isNaN(number: number), and Flow is adopting the same signatures. Calls that pass another type rely on the function's implicit conversion and start to error.

Wrap each such argument in String(...) (parseInt) or Number(...) (isNaN), the conversion the function already applies, so behavior doesn't change. The calls were found from Flow's errors and rewritten by a codemod. 8 arguments in 6 files in React Native and Metro.

Changelog: [Internal]

Differential Revision: D129644365

Summary:
TypeScript declares `parseInt(string: string, radix?: number)` and `isNaN(number: number)`, and Flow is adopting the same signatures. Calls that pass another type rely on the function's implicit conversion and start to error.

Wrap each such argument in `String(...)` (`parseInt`) or `Number(...)` (`isNaN`), the conversion the function already applies, so behavior doesn't change. The calls were found from Flow's errors and rewritten by a codemod. 8 arguments in 6 files in React Native and Metro.

Changelog: [Internal]

Differential Revision: D129644365
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Nov 4, 2026
@meta-codesync

meta-codesync Bot commented Nov 4, 2026

Copy link
Copy Markdown

@SamChou19815 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D129644365.

This branch has not been deployed

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

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant