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

Property 'errors' is private and only accessible within class 'Result<T>'. #1241

Closed
ctooley21 opened this issue Aug 24, 2023 · 5 comments
Closed

Comments

@ctooley21
Copy link

Describe the bug

The errors property for ResultWithContext is marked as private on package version 7.0.1 and TypeScript version 5.1.6

To Reproduce

Follow the TypeScript example on the docs site

Expected behavior

The property is accessible

Current behavior

A typescript error is generated, and typescript building fails with the error:
error TS2341: Property 'errors' is private and only accessible within class 'Result<T>'.

Environment:

  • Express-validator version: 7.0.1
  • Express version: 5.0.0-beta.1
  • Node.js version: 18.16.1
@gustavohenke
Copy link
Member

The property is accessible

Nope, that's not desired behaviour - the docs are incorrect, they should be fixed

@ctooley21
Copy link
Author

The property is accessible

Nope, that's not desired behaviour - the docs are incorrect, they should be fixed

Understood. Can you provide any guidance on how to exit a custom validation run if one of the validation chains fails?

@wmtrinu
Copy link

wmtrinu commented Mar 3, 2024

have you found a way to resolve this?

@gustavohenke
Copy link
Member

Use Result#array().

@gustavohenke
Copy link
Member

The way I wrote this docs page was a bit nonsense too, so I fixed that up. Sorry team! 🫡

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

No branches or pull requests

3 participants