Skip to content

Canvas2D style type doesn't work as intended #95

Open
@TheSpyder

Description

@TheSpyder

https://github.com/tinymce/rescript-webapi/blob/55f4010c35c6b1f1c9301ba3e47120dacdb5587a/tests/Webapi/Canvas/Webapi__Canvas__Canvas2d__test.res#L27-L37

In this context, s is not a string. The compiler requires it to be gradient. It also requires the _ of the third match to be a gradient. It warns if there are not 3 patterns in the switch statement, but the second element in the tuple of all 3 take on the variable type of the first. This can be proven by swapping the first and second patterns, which then fails because g is not a string.

I like the idea of using a witness type but this seems to be unusable.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions