Falieson
Falieson

Reputation: 2556

allowSyntheticDefaultImports transpile configuration typescript babel?

In my tsconfig.json I would like to use the compilerOptions.allowSyntheticDefaultImports=true option. My understanding is that it allows import React from 'react' , but when I try this I get an error like "React.createElement is undefined"

From what I've read setting this just tells TypeScript to ignore erroring when it should, but how do you fix the React.createElement error?

Besides typescript I'm using meteor which uses babel

Upvotes: 2

Views: 1013

Answers (1)

basarat
basarat

Reputation: 276085

TypeScript to ignore erroring when it should, but how do you fix the React.createElement error

You can pass your code through babel that will add the synthetic import for you.

More

I would recommend against this option altogether and just use * as.

Upvotes: 1

Related Questions