Skip to content

Validate type don't allow async validation on fields. #40

Closed

Description

@richardvanbergen

Bug Report

I'm trying to get file information for an upload field so I can check for its filetype but typescript is complaining about not being able to return a promise.

Expected Behavior

I can create validate functions using async as described here: https://payloadcms.com/docs/fields/overview#validation

Current Behavior

I get typescript errors because the return type is string | boolean rather than Promise<string | boolean>.

Detailed Description

Payload version: 0.2.4

image

Activity

  1. DanRibbens commented on Jan 27, 2021

    @DanRibbens
    Contributor

    Hi @richardvanbergen, good catch! I'm looking at this now.
    I was able to reproduce it and I can have a patch up for you soon.

  2. DanRibbens commented on Jan 27, 2021

    @DanRibbens
    Contributor

    Should be good to go once you update to v0.2.9

  3. github-actions commented on Sep 8, 2024

    @github-actions
    Contributor

    This issue has been automatically locked.
    Please open a new issue if this issue persists with any additional detail.

  4. locked as resolved and limited conversation to collaborators on Sep 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions