-
Notifications
You must be signed in to change notification settings - Fork 13
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
Can assign incompatible measures if they have some dimensions in common, #152
Comments
Hey, thanks for bringing this to my attention! This actually exposes a pretty fundamental issue with the library that's gonna be pretty difficult to fix since typescript is structurally typed. I definitely should've thought of this sooner. This is going to take a while to resolve but my intuition right now is that we will need to make more stringent restrictions on custom dimensions that users can create in the library. |
Actually this might be doable now. I had assumed that exact types would require a language update but it seems they are possible now! Will work on integrating this clever bit of type hackery into the code soon: |
hello @jscheiny , thanks for this wonderful library - I think I just found another case where the library allows mixing units: const a = length.times(time);
const b = length.plus(a); // <- this should not be allowed I'm happy to help. |
Hello. I joyed that you created so library and want help solve the problem. May be this trick help you. |
I deleted odd hack from my solution. |
The following, taken from the documentation
Gives a compile-time error.
But removing the
times
operation, making it justDoes not give a compile-time error, although the measures are clearly incompatible
Am I missing something? I have
strict
turned on in my tsconfig file.Thanks otherwise for a fantastic library
The text was updated successfully, but these errors were encountered: