-
-
Notifications
You must be signed in to change notification settings - Fork 670
radix in toString #586
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
Comments
Of course, yeah, is on todo but afaik nobody is currently working on it. Code responsible for this and similar things lives in std/internal/number. |
But this change little bit with upcoming rework runtime (#535) branch |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Is any workaround exists for it? |
This is working now, but if you wrap it in a function then the type must not be function hex(n: number): string {
return '0x' + n.toString(16)
} |
|
I see, I guess this is the correct approach: function hex<T>(n: T): string {
return '0x' + n.toString(16)
} This compiles and works fine, although I get a typescript error in the editor: "Property 'toString' does not exist on type 'T'." |
function hex<T extends number>(n: T): string {
return '0x' + n.toString(16);
} |
Is there plan to support radix in
toString
for integer types?The text was updated successfully, but these errors were encountered: