zhaoyongjie commented on a change in pull request #17474:
URL: https://github.com/apache/superset/pull/17474#discussion_r751831949
##########
File path: superset-frontend/src/CRUD/Fieldset.tsx
##########
@@ -50,7 +50,7 @@ export default class Fieldset extends React.PureComponent {
render() {
const { title } = this.props;
- const propExtender = field => ({
+ const propExtender = (field: { props: { fieldKey: string | number } }) =>
({
Review comment:
```suggestion
const propExtender = field => ({
const propExtender = (field: { props: { fieldKey: fieldKeyType} }) => ({
```
##########
File path: superset-frontend/src/CRUD/Fieldset.tsx
##########
@@ -17,31 +17,31 @@
* under the License.
*/
import React from 'react';
-import PropTypes from 'prop-types';
import { Form } from 'src/components/Form';
import { recurseReactClone } from './utils';
import Field from './Field';
-const propTypes = {
- children: PropTypes.node.isRequired,
- onChange: PropTypes.func,
- item: PropTypes.object,
- title: PropTypes.node,
- compact: PropTypes.bool,
-};
-const defaultProps = {
- compact: false,
- title: null,
-};
+interface FieldsetProps {
+ children: React.ReactNode;
+ onChange: Function;
+ item: Record<string, any>;
+ title: React.ReactNode;
+ compact: boolean;
+}
+
+export default class Fieldset extends React.PureComponent<FieldsetProps> {
+ static defaultProps = {
+ compact: false,
+ title: null,
+ };
-export default class Fieldset extends React.PureComponent {
- constructor(props) {
+ constructor(props: FieldsetProps) {
super(props);
this.onChange = this.onChange.bind(this);
}
- onChange(fieldKey, val) {
+ onChange(fieldKey: any, val: any) {
Review comment:
```javascript
type fieldKeyType = string | number;
onChange(fieldKey, val) {
onChange(fieldKey: fieldKeyType, val: any) {
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]