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

fs: ensure return value type of options.filter in cpSync consistent with doc #52461

Closed
wants to merge 1 commit into from

Conversation

kylo5aby
Copy link
Contributor

Ensure return type of options.filter in cpsync matches doc.
according to the documentation, the return value of options.filter has boolean type.

@nodejs-github-bot nodejs-github-bot added fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. labels Apr 11, 2024
@lpinca lpinca added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 13, 2024
@lpinca
Copy link
Member

lpinca commented Apr 13, 2024

Can you add a test?

@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 13, 2024
@nodejs-github-bot
Copy link
Collaborator

@kylo5aby
Copy link
Contributor Author

Can you add a test?

Hi, I have added related test

Comment on lines -67 to +66
if (isPromise(shouldCopy)) {
if (typeof shouldCopy !== 'boolean') {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have the feeling this was done on purpose, to support truthy values, and there's a Promise check to prevent mistakes.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your feedback. and I have a question, for

opt.filter = (value) => {
 //
}

its return type contradicts the documentation, which states Returns: <boolean>, but it wont throw an error. Should here use a more precise description, such as the type that is coercible to boolean type?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/cc @nodejs/fs @bcoe @aduh95

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with either (changing the code or the docs); if we change the code, let's land this as semver-major.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I might prefer changing the docs to changing the code here.

@aduh95 aduh95 added the semver-major PRs that contain breaking changes and should be released in the next major version. label Apr 24, 2024
@legendecas
Copy link
Member

Closed in favor of #52742.

@legendecas legendecas closed this Jun 19, 2024
nodejs-github-bot pushed a commit that referenced this pull request Jun 19, 2024
PR-URL: #52742
Refs: #52461
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
targos pushed a commit that referenced this pull request Jun 20, 2024
PR-URL: #52742
Refs: #52461
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
eliphazbouye pushed a commit to eliphazbouye/node that referenced this pull request Jun 20, 2024
PR-URL: nodejs#52742
Refs: nodejs#52461
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
bmeck pushed a commit to bmeck/node that referenced this pull request Jun 22, 2024
PR-URL: nodejs#52742
Refs: nodejs#52461
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
marco-ippolito pushed a commit that referenced this pull request Jul 19, 2024
PR-URL: #52742
Refs: #52461
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
marco-ippolito pushed a commit that referenced this pull request Jul 19, 2024
PR-URL: #52742
Refs: #52461
Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fs Issues and PRs related to the fs subsystem / file system. needs-ci PRs that need a full CI run. semver-major PRs that contain breaking changes and should be released in the next major version.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants