ProjectEvergreen / wcc

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

support tsx parsing #164

Open thescientist13 opened 5 months ago

thescientist13 commented 5 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);