Excellent
I think there’s a misunderstanding about the workflow here.
In this usage -
anyItemType LocalComputer_Cpu_SystemUptime "[JS(CPUTime.js):%s]"
the JS transformation is being used for display presentation purposes only.
It is true that the JS input and output are in string form - but that does NOT mean you can only work with String type Items.
Used with any Item type at all, the OH framework takes care of converting the Item state to a string before feeding it to the transform.
So Number Item types are okay.
As are DateTime, Dimmer etc.
(A side effect of that is that if you intend to do maths inside your transform, you may need to parse the received string into a decimal etc.)
The (string) output of the transform is used for display.
Again, if the transform returns a number, the OH framework will stringify it before use.
That means that you need a string formatter in your [presentation] parameter - the %s - something like %0.f would fail on the string transform result.
The transform here never affects the Item state in any way, only presentation. It’s a different usage to e.g.in a profile or channel.
The trick with MainUI is getting it to use the transformed state in your widget, because both transformed and raw Item states are available to you.