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

x-for doesn't work with TypeScript #1

Open
Ni55aN opened this issue Oct 11, 2019 · 4 comments
Open

x-for doesn't work with TypeScript #1

Ni55aN opened this issue Oct 11, 2019 · 4 comments
Labels
bug Something isn't working

Comments

@Ni55aN
Copy link

Ni55aN commented Oct 11, 2019

As I understand, a TypeScript transformer is needed to solve this problem. Are you planning to create it in the future?

image

Application created with create-react-app --typescript

Config extended with react-app-rewired

const {
    override,
    disableEsLint,
    useBabelRc
  } = require('customize-cra')
  
  module.exports = override(
    disableEsLint(),
    useBabelRc()
  )

.babelrc

{
    "plugins": [
      "react-directives",
      "@babel/transform-react-jsx"
    ]
}
@Ni55aN Ni55aN added the bug Something isn't working label Oct 11, 2019
@peakchen90
Copy link
Owner

@Ni55aN I have reproduced this problem and will try to solve it. It may take some time.

@Ni55aN Ni55aN changed the title v-for doesn't work with TypeScript x-for doesn't work with TypeScript Oct 12, 2019
@peakchen90
Copy link
Owner

@Ni55aN
I may not be able to do anything for the typescript transformer, and not consider the syntax of typescript at the beginning of development. And for this case, you can declare item before used, like this:

declare let item: any;

It is not recommended to use x-for in typescript now.

There is a difference between Javascript and Typescript in the AST tree. For better support, it may be rewritten for Typescript in the future.

@martinszeltins
Copy link

Has this issue been fixed? Since Typescript is so popular now, it'd be nice if this worked.

@peakchen90
Copy link
Owner

@martinszeltins Haven't found a proper way to fix it yet, it is recommended not to use x-for in typescript

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants