Quantcast
Channel: ReScript Forum - Latest posts
Viewing all articles
Browse latest Browse all 2176

Type duplication between interface file and implementation

$
0
0

Hi,
New to rescript and first post.
What do we think about type duplication between .resi interface files and implementation, I can see that becoming hard to maintain.
Did I miss a way of doing that?
I created an interface file only to export a default value (reproducing existing code to see what that looks like), but that forced me to add and duplicate all needed types. So the types are present in both the interface file and the implementation file.
Any advice?

type entitlement = {
  purchased: array<string>,
  source: string,
  failedAvailabilityChecks: array<string>,
}
type tokenType = | @as("bearer") Bearer
type authResponse = {
  entitlement: entitlement,
  emailVerified: bool,
  tokenType: tokenType,
  accessToken: string,
  refreshToken: string,
  profileToken: string,
}
let default: (string, string) => promise<authResponse>

Viewing all articles
Browse latest Browse all 2176

Trending Articles