I am trying to learn how to use the cool bs-css library. However, there is some part in my code where I need to use the CSS calc feature. Naturally, the library offers a strongly typed version of it, with both addition and subtraction functions. The problem is when I am trying to use it. As code is worth a thousands words:
let tooltip = style(. [
translateY(Calc.-(-100.->pct, 5->px)),
])
ReScript compiler then complains about I'm not sure what to parse here when looking at "-".
The signature from the .rei file suggests that the functions names are actually the + and - symbols.
This works too and seems more convenient. I am thinking if it is worth opening it in my Styles module without any “risk”. For example, one might want to create their variables files, holding a header height and later want to set a height minus this header height and forget about the open module.
As long as you don’t need the “normal” -, opening Calc in a Style module should be safe.
And even if you need it, but maybe not as often as the Calc -, you can still assign it to a let binding and use it as a function.