-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
We would like to use dash-generate-components
on some Typescript components to allow our Python developers to use them in their Dash code. We have a custom pipeline to transpile the Typescript components to a bundle but we're currently blocked by this line of code:
Line 63 in ec1576c
if (!['.jsx', '.js'].includes(path.extname(filepath))) { |
Extracting metadata from components is currently only allowed for .js
and .jsx
files. However react-docgen has no issues extracting metadata from Flow or Typescript.
Would you support the addition of .ts
and .tsx
files to this filter. This would allow us to continue using Typescript.
Example typescript code
Dev.jsx
(Currently I am saving this as Dev.jsx
to allow the extracting of metadata.)
import React from 'react';
type Props = {
/**
* my description of what a label is
*/
label?: string,
};
export default class Test extends React.Component<Props> {
render() {
const {label} = this.props;
return <h1>{label}</h1>;
}
}
Test.py
# AUTO GENERATED FILE - DO NOT EDIT
from dash.development.base_component import Component, _explicitize_args
class Test(Component):
"""A Test component.
Keyword arguments:
- label (string; optional): my description of what a label is"""
@_explicitize_args
def __init__(self, label=Component.UNDEFINED, **kwargs):
self._prop_names = ['label']
self._type = 'Test'
self._namespace = 'something'
self._valid_wildcard_attributes = []
self.available_properties = ['label']
self.available_wildcard_properties = []
_explicit_args = kwargs.pop('_explicit_args')
_locals = locals()
_locals.update(kwargs) # For wildcard attrs
args = {k: _locals[k] for k in _explicit_args if k != 'children'}
for k in []:
if k not in args:
raise TypeError(
'Required argument `' + k + '` was not specified.')
super(Test, self).__init__(**args)
wutali, codytodonnell, olejorgenb and tuchandra
Metadata
Metadata
Assignees
Labels
No labels