express-validator / express-validator

An express.js middleware for validator.js.

Home Page:https://express-validator.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

ctooley21 opened this issue · comments

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

The property is accessible

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

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?

commented

have you found a way to resolve this?

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