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

tsx dynamic tag name build error #165

Closed
troy351 opened this issue Dec 3, 2018 · 4 comments
Closed

tsx dynamic tag name build error #165

troy351 opened this issue Dec 3, 2018 · 4 comments

Comments

@troy351
Copy link

troy351 commented Dec 3, 2018

Original issue here vuejs/vue-cli#3067

Steps to reproduce

  • create a new project with vue-cli with only babel and typescript (use class style component).
  • update typescript to 3.2+. this is important !!!
  • remove template field and add render code in App.vue
render() {
    const obj = {
      tag: "HelloWorld"
    };

    const TagName = obj.tag;
    return <TagName class="name" />;
  }

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
Copy link
Member

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

@troy351
Copy link
Author

troy351 commented Dec 17, 2018

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

@blake-newman
Copy link
Member

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

microsoft/TypeScript#28806

It is on the teams radar to be fixed.

@blake-newman
Copy link
Member

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

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

3 participants