spiderfire icon indicating copy to clipboard operation
spiderfire copied to clipboard

Add Typescript Support

Open Gers2017 opened this issue 2 years ago • 9 comments

I know, I know this is a deno thing but I really think it would improve the project by attracting all the typescript folks. Personally is something node.js needs and I'd use it without doubt. I'm not suggesting get rid of javascript, not at all, what I'm suggesting is let the users use typescript or javascript without too much configuration or boilerplate. I'm still learning rust but I'd like to work/collaborate on this feature.

Gers2017 avatar Oct 07 '21 16:10 Gers2017

For this, we should probably use swc to transpile the TypeScript to JavaScript. In order to prevent unnecessary transpilation, the SHA of the TS file and the transpiled JS need to cached somewhere.

Redfire75369 avatar Oct 07 '21 16:10 Redfire75369

And the next logical step would be to provide ts definitions of spiderfire functions.

sagudev avatar Oct 07 '21 17:10 sagudev

All modules already have TypeScript (and Flow) definitions created, I think it's mostly a matter of integrating those into IDEs and stuff.

Redfire75369 avatar Oct 09 '21 15:10 Redfire75369

Yes, I totally forgot it.

sagudev avatar Oct 09 '21 15:10 sagudev

I can make a PR for this with some guidance, if you would like.

gimbling-away avatar Jan 02 '22 06:01 gimbling-away

Maybe swc-project/swc for bundling TS compiler within?

sagudev avatar Jan 02 '22 06:01 sagudev

That's the plan for the future, it's just that I don't want to deal with caching, which is going to be almost certainly required.

Redfire75369 avatar Jan 02 '22 09:01 Redfire75369

I completely forgot about mentioning this here, but until full support is added, I've moved all TypeScript (and Flow) bindings to a seperate folder (https://github.com/Redfire75369/spiderfire/commit/00c02d41f122f06a2b364ccbaddb8aa0973f9191). This will be published as a zip file in each prerelease.

Bindings: https://github.com/Redfire75369/spiderfire/tree/master/bindings

Redfire75369 avatar Mar 19 '22 10:03 Redfire75369

As of https://github.com/Redfire75369/spiderfire/commit/9e05f8c12da3c1b0d1805cfaa83119ecf2b12b2e, typescript support has been added! You'll still need the global declaration files for your IDE but this is a good step forward. There's also no support for something like tsconfig.json or .swcrc for now, that will be added later, The latest prerelease with support for TypeScript was also released.

Redfire75369 avatar Aug 04 '22 01:08 Redfire75369