Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include more JS primitives for Untagged variants #7147

Open
nojaf opened this issue Nov 5, 2024 · 1 comment
Open

Include more JS primitives for Untagged variants #7147

nojaf opened this issue Nov 5, 2024 · 1 comment

Comments

@nojaf
Copy link
Contributor

nojaf commented Nov 5, 2024

I'm trying to model blobParts of https://developer.mozilla.org/en-US/docs/Web/API/Blob/Blob#blobparts for the new WebAPI bindings.

@unboxed
type blobPart =
  | String(string)
  | Blob(blob)
  | ArrayBuffer(ArrayBuffer.t)
  | TypedArray(TypedArray.t<int>)

However, I cannot use ArrayBuffer.t and TypedArray.t in combination with the @unboxed.
Could some of these be extended?

@nojaf
Copy link
Contributor Author

nojaf commented Nov 13, 2024

I'm hitting the limitations of @unboxed again for https://github.com/rescript-lang/experimental-rescript-webapi/pull/7/files#r1839785692

Modelling https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/fillStyle

It should be something like

@unboxed
type fillStyle =
  | String(string)
  | Gradient(canvasGradient)
  | Pattern(canvasPattern)

It would be great if I can input some sort of check for the unboxed via attribute, something like:

| @check("$0 instanceof CanvasGradient") Gradient(canvasGradient) // where $0 is the object in place.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant