holepunchto / pear

combined Peer-to-Peer (P2P) Runtime, Development & Deployment tool
https://pears.com/
Apache License 2.0
85 stars 9 forks source link

TypeScript support? #202

Closed mindplay-dk closed 6 days ago

mindplay-dk commented 1 week ago

Does Pear (and Bare) have any support for TypeScript?

Does your runtime include type declarations?

(There is no mention of TypeScript anywhere in the documentation, as far as I can tell.)

davidmarkclements commented 6 days ago

the policy is that Pear Applications do not prevent the usage of transformations, and moving forward we're looking at supporting transformations via configuration. It's also possible right now to just use webpack to create a dist folder and then run/stage/seed that folder.

As for declarations, this (both Pear and Bare) is a JavaScript runtime, the requirements of any languages or language extensions that compile to a target language should be decoupled from the language-proper - so declarations are a matter for the community/authors of that language/language extension. For example, the node project does not maintain node type declarations, the DefinitelyTyped community does.

mindplay-dk commented 3 days ago

I don't think I would trust third-party types - for an API of this size and complexity, in a codebase without types, typically only the maintainers can really be trusted to know what's what.

I understand Node gets by this way, but their type declarations have hundreds of contributors.

If you won't entertain first-party TypeScript support, perhaps you might consider JSDoc annotations? These provide good IDE support as well, for example via the TypeScript Language Service in VS Code.

You have a unique and interesting project here, but coding blind just really isn't my cup of tea. 😅

davidmarkclements commented 3 days ago

I understand where you're coming from and people have different approaches/tooling/etc when it comes to writing code - we're still stabilising so declarations/annotations is overhead I want to avoid for as long as possible but at the same time I think we should enable IDE support where possible also.

The Pear API itself is very small, and Bare even more so, keeping small cores and having functionality in libraries (e.g. bare-fs, hyperdrive) means decoupled iteration, which means faster overall iteration so this is actually more of a Pear Ecosystem discussion but I agree with you on the point of IDE integration so I think we should do something about that (maybe annotations, maybe something else)