0

I have a class that looks like this:

class ProductChecker extends React.Component { .... }

at the bottom of the file, I have:

export default graphql(getSymbolInfoQuery)(ProductChecker);

where graphql is imported from react-apollo and getSymbolInfoQuery is a gql templated string. When compiling the project, I am getting:

src/client/gui/containers/product-checker.ts(3,10): error TS2305: Module '"../components/product-checker"' has no exported member 'ProductChecker'

but when I comment out the bottom of the file line and do:

export class ProductChecker extends React.Component {

that seems to be building just fine. So it looks like the export at the bottom of the file does not "see" class/component declaration higher up, and says that its not found. Any idea how to export a React class from a typescript source file? THank you

1 Answer 1

2

The issue is most likely your import statement where you are using this. I suspect you have:

import {ProductChecker} from "yourfilename";

but it should be:

import ProductChecker from "yourfilename";

The first assumes a named export, the second is for a default export.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.