-
Notifications
You must be signed in to change notification settings - Fork 1
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
Rich APIs for Duration and Datasize types #15
Comments
Hello can you please elaborate, what do you mean by |
@DmitryPR Have you used these types in Pkl? I've linked the API documentation above - there are functions like Here's how But it would be useful if we had a Currently, the pkl-typescript If you're intested in helping contribute to |
Allright, now I see what you mean |
The
Duration
andDataSize
types in the Pkl standard library have excellent rich APIs (see Duration and DataSize) for converting between units and comparing (or eg. summing) valuesWe have basic support for creating TS objects with the properties that come over the wire from
pkl server
(see here) but those are just key-value pair objects withunit
andvalue
properties.We could consider writing custom class implementations that have similar helper APIs to the Pkl equivalents. We could also consider using
valueOf
or Proxy to allow mathematical operators (eg.myDataSizeA - myDataSizeB
).The text was updated successfully, but these errors were encountered: