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

Fix anonymous class error in docsite #1181

Open
BSFishy opened this issue Dec 12, 2023 · 2 comments
Open

Fix anonymous class error in docsite #1181

BSFishy opened this issue Dec 12, 2023 · 2 comments
Labels
discuss enhancement New feature or request

Comments

@BSFishy
Copy link
Contributor

BSFishy commented Dec 12, 2023

With PR #1104, building the docsite fails because of this line:

export default class extends Component<CustomActionsProps, CustomActionsState> {

The issue is that the proptypes-from-ts-props Babel plugin doesn't support anonymous classes. There are a few ways that I can think to resolve this:

  1. Refactor the component to a functional component. This shouldn't be too much effort and could be considered a modernization effort.
  2. Filter the plugin so it doesn't run on docsite files. The plugin is really just to make sure proptypes are generated for source components, so it doesn't make much sense that it's running on the docsite. Granted, this doesn't really fix anything, just suppresses it.
  3. Give the class a name. This is a pretty quick and simple fix, but doesn't account for if this crops up in the future. Granted, if we only accept functional components in the future, this shouldn't be an issue.
  4. Add support for this in the Babel plugin. This may require gaining some knowledge about that plugin, which seems quite large and complex, so my mind doesn't immediately run to this one.

I put these in order of what I would prefer, but I want to get more opinions on this.

@BSFishy BSFishy added enhancement New feature or request discuss labels Dec 12, 2023
@BSFishy BSFishy mentioned this issue Dec 12, 2023
7 tasks
@BSFishy BSFishy removed the untriaged label Dec 12, 2023
@ShatilKhan
Copy link
Contributor

ShatilKhan commented Dec 13, 2023

@BSFishy Should I try refactoring it to a functional component?
Just to test it out...

@BSFishy
Copy link
Contributor Author

BSFishy commented Dec 14, 2023

I believe @AMoo-Miki was doing some investigation around this. @AMoo-Miki do you have an update?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants