Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@skatejs/element should export ES6 class rather than compiled one #1570

Open
Quasar-Kim opened this issue Oct 13, 2019 · 0 comments
Open

@skatejs/element should export ES6 class rather than compiled one #1570

Quasar-Kim opened this issue Oct 13, 2019 · 0 comments

Comments

@Quasar-Kim
Copy link

Quasar-Kim commented Oct 13, 2019

Bug report

  • Skate version: @skatejs/element 0.0.1
  • Affected browsers (and versions): Chrome Dev 79.0.3938.0

Current behaviour

Extending Element exported by @skatejs/element triggers following error:

import Element from '@skatejs/element';

class Hello extends Element {
  render() {
    return `
      <span>
        Hello, <slot></slot>!
      </span>
    `;
  }
}
customElements.define('x-hello', Hello);

(An official example introduced here: https://skatejs.netlify.com/docs/element)
Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.
Source code on codesandbox. You can see the error on devtools console tab.

Expected behaviour

<x-hello></x-hello> element should render Helllo, !

The issue seems to occur because typescript compiles ES6 class to ES5 syntax.(Related issue)
I tried esnext build in skatejs monorepo which exports ES6 class and it worked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant