ProjectEvergreen / wcc

Experimental native Web Components compiler.
https://merry-caramel-524e61.netlify.app
80 stars 6 forks source link

support tsx parsing #164

Open thescientist13 opened 3 months ago

thescientist13 commented 3 months ago

Summary

Currently WCC can handle .jsx and .ts file independtly, but not at the same time. Let's change that!

Details

So basically someone could a component like

interface User {
  name: string;
}

export default class Greeting extends HTMLElement {
  connectedCallback() {
    this.user: User = {
      name: this.getAttribute('name') || 'World'
    };

    this.render();
  }

  render() {
    const { name } = this;

    return (<h3>Hello ${user.name}! 👋</h3>)
  }
}

customElements.define('x-greeting', Greeting);