kaluma-project / kaluma

A tiny JavaScript runtime for RP2040 (Raspberry Pi Pico)
https://kalumajs.org
Apache License 2.0
648 stars 37 forks source link

TypeScript Support? #587

Open leventkaragol opened 1 year ago

leventkaragol commented 1 year ago

Any plans on typescript support? I'm not talking about directly loading typescript files with flash. But at least some type support like @types/kaluma would be nice

communix commented 1 year ago

@leventkaragol Sorry we don't have a specific plan to support Typescript now. Kaluma basically use JerryScript as a Javascript engine. So if Jerryscript support it we can consider it but no plan so far.

pclokcer commented 1 year ago

if we build typescript to javascript, I think it will work ? @communix

communix commented 1 year ago

@pclokcer Yes. it works and you can publish it to public (https://kalumajs.org/packages/) and other people can use it.

samboylett commented 1 year ago

We don't need JerryScript to support it. Same way we transpile TypeScript to JavaScript for web we can do for kaluma. Really all we need is a declaration file for the in built modules/constants. I've been building one up myself but it would be good to have an official one.

Actually looking at the source code all of this is already in javascript, so if we can convert it to typescript we can get declaration files for it (and transpile back to JS for JerryScript to use)

Happy to put in a PR for JS -> TS by the way!

jt000 commented 11 months ago

@samboylett, I started the process of creating a type definition for Kaluma in DefinitelyTyped. Still quite a few components left to do, but got a good start on many of them... Also added template site for seeing how it can be easily used at jt000/kaluma-typescript-demo

jt000 commented 11 months ago

@niklauslee or @communix, would you be interested in co-owning the typescript definition files in DefinitelyTyped with me? https://github.com/DefinitelyTyped/DefinitelyTyped/pull/67850#discussion_r1423149517

niklauslee commented 11 months ago

@jt000 Wow this is amazing contribution👍. I'm difficult to contribute or maintain.😥

jt000 commented 11 months ago

@leventkaragol, I've been using typescript\webpack with Kaluma pretty successfully with the solution provided in https://github.com/jt000/kaluma-typescript-demo... Does this satisfy your typescript needs?

leventkaragol commented 11 months ago

Thanks, I'll take a look