Skip to content

prop type shows up as any when the type is accessed indirectly #240

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

Closed
eddiecooro opened this issue Feb 15, 2020 · 1 comment
Closed

prop type shows up as any when the type is accessed indirectly #240

eddiecooro opened this issue Feb 15, 2020 · 1 comment

Comments

@eddiecooro
Copy link

The prop type is any in the styleguidist when we, for example, are doing something like this:

import React from 'react';
interface Props {
  title: React.ReactNode;
}

but the following works without problem:

import { ReactNode } from 'react';
interface Props {
  title: ReactNode;
}
@eddiecooro
Copy link
Author

So, I tracked down this problem to this issue #71
The problem was that react-docgen-typescript uses allowSyntheticDefaultImports: false by default.
The problem solved by forcing the plugin to use our custom tsconfig.json file

require("react-docgen-typescript").withCustomConfig("./tsconfig.json");

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

1 participant