Skip to content

Typing Issue with passwordPolicy validatorCallback #10471

@dalyaidan1

Description

@dalyaidan1

New Issue Checklist

Issue Description

Incorrect passwordPolicy Option validatorCallback typing.

The typing of the validatorCallback is () => void right now.

The spec uses this as () => bool
The rest prototype uses this as (password: string) => bool

Steps to reproduce

Add a passwordPolicy validatorCallback with correct typing:

const validatePassword = (password: string): boolean => {
  console.log('Validating password security');
  return password === 'badpw' ? false : true;
};

Actual Outcome

Type '(password: string) => boolean' is not assignable to type '() => void'.
  Target signature provides too few arguments. Expected 1 or more, but got 0.ts(2322)
index.d.ts(229, 5): The expected type comes from property 'validatorCallback' which is declared here on type 'PasswordPolicyOptions'

Expected Outcome

No typescript error.

Environment

I am using 9.9.0, but this is also on the alpha branch at time of writing.

Server

  • Parse Server version: 9.9.0
  • Operating system: N/A
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): Local

Database

  • System (MongoDB or Postgres): N/A
  • Database version: N/A
  • Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc): N/A

Client

  • SDK (iOS, Android, JavaScript, PHP, Unity, etc): N/A
  • SDK version: N/A

Happy to fill those out more if you think it will be helpful!

Logs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions