-
-
Notifications
You must be signed in to change notification settings - Fork 57
Closed
Milestone
Description
There seems to be some issue where it's impossible to use bs.as
without bs.string
.
The following code:
type document
type style
external document : document = "document" [@@bs.val]
external get_by_id : document -> string -> Dom.element = "getElementById"
[@@bs.send]
external style : Dom.element -> style = "style" [@@bs.get]
external transition_timing_function :
style ->
[ `ease
| `easeIn [@bs.as "ease-in"]
| `easeOut [@bs.as "ease-out"]
| `easeInOut [@bs.as "ease-in-out"]
| `linear
] ->
unit = "transitionTimingFunction"
[@@bs.set]
let element_style = style (get_by_id document "my-id")
let () = transition_timing_function element_style `easeIn
Fails with:
13 | | `easeInOut [@bs.as "ease-in-out"]
^^^^^
Error (warning 101 [unused-bs-attributes]): Unused attribute: bs.as
This means such annotation is not annotated properly.
for example, some annotations is only meaningful in externals
It can be fixed by adding bs.string
attribute:
type document
type style
external document : document = "document" [@@bs.val]
external get_by_id : document -> string -> Dom.element = "getElementById"
[@@bs.send]
external style : Dom.element -> style = "style" [@@bs.get]
external transition_timing_function :
style ->
([ `ease
| `easeIn [@bs.as "ease-in"]
| `easeOut [@bs.as "ease-out"]
| `easeInOut [@bs.as "ease-in-out"]
| `linear
]
[@bs.string]) ->
unit = "transitionTimingFunction"
[@@bs.set]
let element_style = style (get_by_id document "my-id")
let () = transition_timing_function element_style `easeIn
But this should not be necessary, as poly variants already compile to strings.
Metadata
Metadata
Assignees
Labels
No labels