Skip to main content

Quirks of RescriptRelay

Ahh, what would a framework be without quirks and weird stuff? RescriptRelay comes with a few gotchas that are good to keep in mind.

Field names

Since ReScript has reserved words (like type and val), none of the fields you query for can end up being called a reserved word in your views. This is simply because you won't be able to access the field since you cannot use the reserved word as an accessor.

This is more a quirk of ReScript than anything, but it does mean that you'll need to alias any field whose name is a reserved word into something that's not a reserved word. For example:

fragment UserProfile_user on User {
firstName
userType: type
}

type is a reserved word, so we alias it to userType. This means that in our view we access it like this:

user.userType

...and this will work fine.