vuejs / babel-plugin-transform-vue-jsx

babel plugin for vue 2.0 jsx
1.85k stars 132 forks source link

tsx dynamic tag name build error #165

Closed troy351 closed 5 years ago

troy351 commented 5 years ago

Original issue here vuejs/vue-cli#3067

Steps to reproduce

What is expected?

No Error

What is actually happening?

Error Type '{ class: string; }' is not assignable to type '{}'


However, the codes below works fine

render() {
    // this works
    const TagName = "HelloWorld";
    return <TagName class="name" />;
  }
render() {
    // this also works
    const obj = {
      tag: "HelloWorld"
    };

    const TagName = obj.tag;
    return <TagName />;
  }
nickmessing commented 5 years ago

Can you show the JSX shim you're using in your project @troy351?

troy351 commented 5 years ago

the same as shims-tsx.d.ts in vue-cli

blake-newman commented 5 years ago

This is not a JSX issue but an issue in TS.

https://github.com/Microsoft/TypeScript/issues/28806

It is on the teams radar to be fixed.

blake-newman commented 5 years ago

Solution for now is to stay behind a version, or use if statements to ensure a specific tag type.