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

allow type functions/algebras for operators #6970

Closed
zpdDG4gta8XKpMCd opened this issue Feb 8, 2016 · 4 comments
Closed

allow type functions/algebras for operators #6970

zpdDG4gta8XKpMCd opened this issue Feb 8, 2016 · 4 comments
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript

Comments

@zpdDG4gta8XKpMCd
Copy link

interface In<a> = { __in: a };
interface Ratio<a, b> = { __ratio: [a, b]; }
let value : number & In<MHz>;
let scale : number & Ratio<Px, MHz>;
declare *<a, b>(left: number & In<a>, right: number & Ratio<b, a>): number & In<b>;
let width = value * scale; // <-- expected number & In<Px>;
@zpdDG4gta8XKpMCd
Copy link
Author

related: #4372, #4895, #5599, #6947, #6735

@DanielRosenwasser DanielRosenwasser added the Suggestion An idea for TypeScript label Feb 9, 2016
@DanielRosenwasser
Copy link
Member

In what way is this distinct from #364?

@zpdDG4gta8XKpMCd
Copy link
Author

Units of measure are governed by the rules of arithmetics. Here you define rules as you like.

Which is still 95% of arithmetics when it comes to numbers, but numbers are only a special case.

More to that, a special case in form of units of measure isn't even on the agenda of the future development, whereas a more general solution might make them worthless and unnecessary.

@DanielRosenwasser DanielRosenwasser added the Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. label Feb 9, 2016
@RyanCavanaugh RyanCavanaugh added Declined The issue was declined as something which matches the TypeScript vision and removed Needs Proposal This issue needs a plan that clarifies the finer details of how it could be implemented. labels Jul 20, 2020
@RyanCavanaugh
Copy link
Member

Closing due to lack of additional feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Declined The issue was declined as something which matches the TypeScript vision Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants