Skip to content

Recursive type definition breaks @unboxed #6327

Open
@cknitt

Description

@cknitt

This works:

type x = {id: string}
@unboxed type xOrArray = X(x) | Array(array<x>)

but this doesn't:

type rec x = {id: string}
@unboxed and xOrArray = X(x) | Array(array<x>)

It gives the error

This untagged variant definition is invalid: Case X has a payload that is not of one of the recognized shapes (object, array, etc). Then it must be the only case with payloads.

(I came across the problem when creating type definitions for JSON schema.)

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