marko icon indicating copy to clipboard operation
marko copied to clipboard

Add support for Typescript

Open JarvisPrestidge opened this issue 7 years ago • 9 comments

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.

JarvisPrestidge avatar Sep 25 '17 11:09 JarvisPrestidge

Thanks for opening this issue. This is a duplicate, which we are tracking here: https://github.com/marko-js/marko/issues/325

austinkelleher avatar Sep 27 '17 04:09 austinkelleher

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).

JarvisPrestidge avatar Sep 27 '17 10:09 JarvisPrestidge

+1

linweigao avatar Dec 13 '17 18:12 linweigao

👍

suzel avatar Jan 21 '18 08:01 suzel

Indeed this does not seem a duplicate of #325

trusktr avatar Jan 25 '22 06:01 trusktr

I agree it's worth chunking up aspects of supporting typescript. Type definitions for the runtime is a good standalone ticket. Reopening this issue.

DylanPiercey avatar Jan 25 '22 13:01 DylanPiercey

Hi everyone. Please any update on this issue?

fabrice8 avatar Aug 21 '22 15:08 fabrice8

Hi everyone. Please any update on this issue?

fabrice8 avatar Aug 21 '22 15:08 fabrice8

@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!

tigt avatar Aug 31 '22 18:08 tigt

I was looking into marko for a new project but lack of typescript support is a deal break

Alexandre-Fernandez avatar Oct 02 '22 11:10 Alexandre-Fernandez

Looking forward to Typescript support ... no Typescript support is also a deal breaker for me.

mohamedmoussa89 avatar Oct 09 '22 20:10 mohamedmoussa89

@DylanPiercey any updates on this? I would like to evaluate marko as a replacement for Pug and TS support would be superb.

gioragutt avatar Oct 17 '22 23:10 gioragutt

@gioragutt its a WIP at the moment. Hopefully EOM but we'll see.

DylanPiercey avatar Oct 18 '22 04:10 DylanPiercey

@DylanPiercey sorry to bother, any updates on this?

gioragutt avatar Nov 29 '22 15:11 gioragutt

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 avatar Nov 30 '22 18:11 tigt

@tigt god that sounds awful 😂 thanks for the reply, appreciate your work guys ❤️ good luck with it!

gioragutt avatar Nov 30 '22 18:11 gioragutt

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?

fabrice8 avatar Nov 30 '22 18:11 fabrice8

📫 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

tigt avatar Nov 30 '22 19:11 tigt

Marko Typescript is here. Thanks a lot

fabrice8 avatar Mar 06 '23 15:03 fabrice8

@fabrice8 awesome! I've not been able to find any references to it in the official docs, when can that be expected?

gioragutt avatar Mar 08 '23 15:03 gioragutt

Still excited 6 years later! ❤️ Also curious where / when we can try this 👀

JarvisPrestidge avatar Mar 08 '23 15:03 JarvisPrestidge

Here: https://markojs.com/docs/typescript

According to the official docs, Types are supported in Marko v5.22.7+ and Marko v4.24.6+

fabrice8 avatar Mar 08 '23 15:03 fabrice8