marko
marko copied to clipboard
Add support for Typescript
New Feature
Description
Add Typescript type definition files, so Marko can be used by the ever growing Typescript community.
Context
Useful for anyone who uses Typescript. Personally I love marko and want to use it in typed projects, but this is a barrier to doing so.
Thanks for opening this issue. This is a duplicate, which we are tracking here: https://github.com/marko-js/marko/issues/325
Imo that issue has wider scope than what I was looking for, which was basically just types for the current marko package and not typed templates (which seems far more sophisticated issue).
+1
👍
Indeed this does not seem a duplicate of #325
I agree it's worth chunking up aspects of supporting typescript. Type definitions for the runtime is a good standalone ticket. Reopening this issue.
Hi everyone. Please any update on this issue?
Hi everyone. Please any update on this issue?
@DylanPiercey has been working on TS support as his goal this quarter, and says:
I'm (hopefully) 2–4 weeks away from completing typescript support.
But don’t be too disappointed if it takes a little longer than that!
I was looking into marko for a new project but lack of typescript support is a deal break
Looking forward to Typescript support ... no Typescript support is also a deal breaker for me.
@DylanPiercey any updates on this? I would like to evaluate marko as a replacement for Pug and TS support would be superb.
@gioragutt its a WIP at the moment. Hopefully EOM but we'll see.
@DylanPiercey sorry to bother, any updates on this?
Progress is slow but steady. Dylan’s been learning the hard way about the dark corners of TypeScript deep in the moloch so Marko authors can have automatic useful types and tab-completion, no matter what their .marko
files get up to.
It turns out TypeScript has a lot of exciting restrictions around how far it’s willing to analyze, so usually the obvious approach doesn’t work, and neither does the next-obvious, and the proposed solution is a 200-comment GitHub issue that links to an RFC that’s been superseded by another RFC that’s hidden under a sign that says “Beware of the Leopard”, and… well, you get the idea.
We appreciate your patience, truly. Thanks for not giving up on this!
@tigt god that sounds awful 😂 thanks for the reply, appreciate your work guys ❤️ good luck with it!
Progress is slow but steady. Dylan’s been learning the hard way about the dark corners of TypeScript deep in the moloch so Marko authors can have automatic useful types and tab-completion, no matter what their
.marko
files get up to.It turns out TypeScript has a lot of exciting restrictions around how far it’s willing to analyze, so usually the obvious approach doesn’t work, and neither does the next-obvious, and the proposed solution is a 200-comment GitHub issue that links to an RFC that’s been superseded by another RFC that’s hidden under a sign that says “Beware of the Leopard”, and… well, you get the idea.
We appreciate your patience, truly. Thanks for not giving up on this!
Sound like a lot of critical work currently on one person's shoulder. Would you guys like to share a roadmap of the undergoing work so that instead of waiting, we can contribute someway somehow?
📫 Todo | 🚧 In Progress | ☑️ Done |
---|---|---|
Validate types in CLI | Generate Type Definitions from .marko files | Upgrade language server to use parser upgrades related to TypeScript support. |
Type the API exposed by Marko's runtime | Automatically strip types via @marko/compiler | |
Language Server Integration | Support TypeScript in Marko's syntax highlighting | |
Support TypeScript in Marko's parser | ||
Parser: add support for generics on Tag Parameters and Attribute Method Shorthand |
Marko Typescript is here. Thanks a lot
@fabrice8 awesome! I've not been able to find any references to it in the official docs, when can that be expected?
Still excited 6 years later! ❤️ Also curious where / when we can try this 👀
Here: https://markojs.com/docs/typescript
According to the official docs, Types are supported in Marko v5.22.7+ and Marko v4.24.6+