Skip to content

question: How can I validate a union of strings? #2356

@stefan-bc-ts

Description

@stefan-bc-ts

I was trying to...
use export type ValidateValues = ‘val1’ | ‘val2’ | ‘val3’;
with @type to make sure the values are correct

The problem:

@Type((_) => ValidateValues)
'ValidateValues' only refers to a type, but is being used as a value here

PS: I was trying to avoid using a enum

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: questionQuestions about the usage of the library.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions