-
-
Notifications
You must be signed in to change notification settings - Fork 298
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
Can be generated from a difinition file? #814
Comments
xiaosen7
changed the title
Can be generated from a type declaration file
Can be generated from a type declaration file?
Jul 4, 2023
Do you have an example? |
import { parse } from "react-docgen";
const code = `
import React from "react";
export interface Props {
/** desc for prop1 */
prop1: string;
}
export declare function FunctionDeclarationComponent(props: Props): JSX.Element;
`;
const documentation = parse(code, {
babelOptions: {},
});
console.log(documentation); I tried this, but got an error: SyntaxError: unknown: Unexpected token, expected "{" (7:7)
5 | prop1: string;
6 | }
> 7 | export declare function FunctionDeclarationComponent(props: Props): JSX.Element; code: 'BABEL_PARSE_ERROR',
reasonCode: 'UnexpectedToken',
loc: Position { line: 7, column: 7, index: 103 },
pos: [Getter/Setter]
} |
xiaosen7
changed the title
Can be generated from a type declaration file?
Can be generated from a difinition file?
Jul 7, 2023
Hi @xiaosen7 - did you ever end up finding a solution to this? I'm also getting the same error and trying to do the same. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: