dash icon indicating copy to clipboard operation
dash copied to clipboard

add prop types to tsx components

Open T4rk1n opened this issue 1 year ago • 2 comments

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"
]

T4rk1n avatar Oct 11 '24 19:10 T4rk1n

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

alexcjohnson avatar Oct 11 '24 19:10 alexcjohnson

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.

T4rk1n avatar Oct 11 '24 20:10 T4rk1n

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

gvwilson avatar Oct 29 '24 15:10 gvwilson

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.

T4rk1n avatar Oct 29 '24 18:10 T4rk1n