Skip to content

Wrong valueTypes.is type #55

@xepozz

Description

@xepozz

I've tried to customise value with usage valueTypes.is, but it shows that I'm wrong.
image
I think we need to change types declaration as the following.

declare type DataType<ValueType = unknown> = {
-    is: (value: any) => value is ValueType;
+    is: (value: ValueType) => boolean;
    Component: React.ComponentType<DataItemProps<ValueType>>;
    Editor?: React.ComponentType<EditorProps<ValueType>>;
    PreComponent?: React.ComponentType<DataItemProps<ValueType>>;
    PostComponent?: React.ComponentType<DataItemProps<ValueType>>;
};

What do you think?

And here is my workaround:

is: ((value: unknown): any => typeof value === 'string' && value.startsWith('@')) as any,

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions