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

Refined polyvariants are not accepted #172

Closed
TomiS opened this issue Nov 25, 2019 · 1 comment
Closed

Refined polyvariants are not accepted #172

TomiS opened this issue Nov 25, 2019 · 1 comment

Comments

@TomiS
Copy link
Contributor

TomiS commented Nov 25, 2019

Howdy. So the title is probably a bit unclear, but here's an example.

I'm trying to create a theme object with a field pageWidth that uses Bs-css atomic types. If I type it like below, it works nicely when used together with e.g. width function styles([width(theme##pageWidth)]).

// This works
type theme = {
  .
  "pageWidth": [
    Types.Width.t
    | Types.Percentage.t
    | Types.Length.t
    | Types.Cascading.t
  ],
};

However, if I'd like to be more specific and always require the width in millimeteres, it doesn't work.

// This doesn't work even if it should, imho
type theme = {
  .
  "pageWidth": [ | `mm(float) ]
};

The problem is probably related to upper boundaries missing somewhere. A simplified example of a similar situation here:
https://reasonml.github.io/en/try?rrjsx=true&reason=C4TwDgpgBANhB2BzYALKBeKBtKAfKABgLZEAUAZjAPYCGwAlHoWAB6kCW8DTBYwF1OowC6AKFFxgUAO7sAJqgxRSMAFzYAPLATIUwxugB8sANxQA9ACooASSjwIEOVGBUoNOc4IaCUclQAnFxR2AGcXN2lAgGsAQihLcwkIKRQIdkQUKUwVdTgkVANjGDMrKABRFhoiMDgoKnIoAGMAVwCAhCkAIwgUGgA3dkCEpOSpEnUcfGIySlpuYSUZ0gBmAAYAOjX6E3FZBRRSEh2LayiA6PDE0TSMrKOiE7K5Kghw+Copc+ioUPYidgwGgBGAgCJQFBUaRQLqhAC0TVC4Si8AA5F8YiMgA

I tried to look into actually fixing this, but the bindings were complex enough so that I didn't immediately figure it out.

I encountered the issue in width function when trying to use mm(float) polyvariant.

@TomiS
Copy link
Contributor Author

TomiS commented Nov 25, 2019

Actually, could it be as simple as that? ^

Of course, all other functions would need similar treatment too.

giraud added a commit that referenced this issue Dec 3, 2019
@giraud giraud closed this as completed Dec 3, 2019
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

2 participants