Open nandorojo opened 3 weeks ago
Yep! The answer to this is ata but the long answer is, whew, it's hard and we've poured days into improving type acquisition and it is still really tough. Making TypeScript and Deno get along is extremely hard - TypeScript doesn't support npm:
or jsr:
prefixes, doesn't support URLs for imports, etc. So you have to do a lot of arbitrary trickery to make the two get along.
I've been planning on refactoring our code and might be able to make it OSS, but can't promise that it'll be all that robust ðŸ˜
We're also thinking about integrating with Deno LSP run on a server somewhere.
In theory it could also be fun to try getting the Deno LSP server running in wasm on the browser but I am not very hopeful about that.
would be very cool
btw @tmcw thanks for sharing ata
, not sure how I missed that. I might just try a regex to find-and-replace the npm:
and jsr:
prefixes. As for the URL imports...well that sounds harder haha.
I'll play with this and share any updates.
I've been planning on refactoring our code and might be able to make it OSS, but can't promise that it'll be all that robust ðŸ˜
Even if it's not...anything helps!
Just as a note: I managed to get this working with @typescript/ata
. However, I haven't yet figured out a way to get the types working with deno. If there's anything you can share about the tricks you used to support these prefixes after fetching the files from ata
, would be super appreciated.
Possibly some relevant notes for Deno here: https://github.com/microsoft/TypeScript-Website/issues/2097
I managed to get this working for npm:
imports. It involves some minor hacks but it's actually quite good and uses internals from @typescript/ata
. Let me know if you'd like me to share it here and I can put it together. I think it could be worth adding as an extension to this library.
All right - here's our deno-ata
repo: https://github.com/val-town/deno-ata
Pretty unfinished/unpolished, this is derived from a refactor that I've been working on of this code.
thank you! it’s private though btw
Whoops - it's public now
A useful feature is to let you use any node modules in the editor. However, this requires 1) parsing the file, 2) querying NPM for their types (potentially
@types/package-name
) and lastly inserting the types intocodemirror-ts
. It could be useful to document the ideal way to handle 2 or maybe abstract it into a functionFor deno, these would be URLs and/or
npm:package-name
, but it could be cool to support both