question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use trim with checkSchema in Typescript

See original GitHub issue

Hello, first of all I want to thank you for an amazing library. I am currently using the checkSchema method, and I would like to use it with trim, but I receive the issue:

Object literal may only specify known properties, and ‘trim’ does not exist in type ‘ValidationParamSchema’.

This is what I am using in my code.

checkSchema({
  username: {
    exists: true,
    errorMessage: 'Invalid username name',
    in: ['params'],
    isLength: {
      errorMessage: 'username should not be longer than 30 characters',
      options: {
        min: MINIMUM_SEARCH_LENGTH,
        max: MAXIMUM_SEARCH_LENGTH
      }
    },
    trim: true
  }
})

Are you maybe missing trim as a property of checkSchema in types? or something on my end?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
gustavohenkecommented, Mar 30, 2018

🚢 v5.1.0 released with this

0reactions
lock[bot]commented, May 31, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

express-validator.checkSchema JavaScript and Node.js code ...
Best JavaScript code snippets using express-validator.checkSchema(Showing top 15 results out of 315) · app/routes/api/public.js/publicRoutes. · routes/preview.js/ ...
Read more >
Match string with values from array in express-validation
The way I do it is by using isIn() check('action') ...
Read more >
Schema validation in TypeScript with Zod - LogRocket Blog
In this article, you will learn about schema design and validation in Zod and how to run it in a TypeScript codebase at...
Read more >
Express Validator Tutorial - Auth0
Sanitizing fields with trim and escape. With Express Validator, you can also trim away spaces from your data and escape special characters using...
Read more >
A Clean Approach to Using Express Validator
Express validator is one of the many npm packages for validating a request an express application. I... Tagged with node, express.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found