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

add prop types to tsx components #3035

Open
wants to merge 5 commits into
base: dev
Choose a base branch
from
Open

add prop types to tsx components #3035

wants to merge 5 commits into from

Conversation

T4rk1n
Copy link
Contributor

@T4rk1n T4rk1n commented Oct 11, 2024

Fix #3014

We use the propTypes defined on the react components to provide runtime prop validation on dash components. This property is missing from typescript components as they don't define that attribute, this PR generate propTypes for the components using the extracted metadata and saves it in a proptypes.js in the package directory. This file should be added as a dev dependencies in the package __init__.py _js_dist like this:

_js_dist = [
...,
"dev_package_path": "proptypes.js",
"namespace": "package"
]

@alexcjohnson
Copy link
Collaborator

Ah ok - so after that can we remove metadata.json from the packages entierly?

@T4rk1n
Copy link
Contributor Author

T4rk1n commented Oct 11, 2024

Ah ok - so after that can we remove metadata.json from the packages entierly?

It hasn't been needed since the components are generated in files, think it was only kept around in the libraries after for compatibilities with older version. The runtime component loader will be removed too. There might be some usage with docs.

@gvwilson gvwilson changed the title [WIP] Add prop types to tsx components. add prop types to tsx components Oct 15, 2024
@gvwilson gvwilson added feature something new P1 needed for current cycle labels Oct 15, 2024
@gvwilson
Copy link
Contributor

@T4rk1n do you want this one in the release or save it for after?

@T4rk1n T4rk1n added the dash-3.0 Going in dash-3.0 release. label Oct 29, 2024
@T4rk1n
Copy link
Contributor Author

T4rk1n commented Oct 29, 2024

Yes this shouldl go into dash 3.0 since it requires components dev to regenerate it would go at the same as the typing generation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dash-3.0 Going in dash-3.0 release. feature something new P1 needed for current cycle
Projects
None yet
Development

Successfully merging this pull request may close these issues.

No runtime type checking with TypeScript components
3 participants