diff --git a/src/components/Doc.jsx b/src/components/Doc.tsx similarity index 80% rename from src/components/Doc.jsx rename to src/components/Doc.tsx index 3285165c..c5db0c4d 100644 --- a/src/components/Doc.jsx +++ b/src/components/Doc.tsx @@ -1,24 +1,33 @@ import React from 'react' -import PropTypes from 'prop-types' -export default class Doc extends React.Component { - static propTypes = { - fieldSpec: PropTypes.object.isRequired, +const headers = { + js: "JS", + android: "Android", + ios: "iOS", + macos: "macOS", +}; + +type DocProps = { + fieldSpec: { + doc?: string + values?: { + [key: string]: { + doc?: string + } + } + 'sdk-support'?: { + [key: string]: typeof headers + } } +}; +export default class Doc extends React.Component { render () { const {fieldSpec} = this.props; const {doc, values} = fieldSpec; const sdkSupport = fieldSpec['sdk-support']; - const headers = { - js: "JS", - android: "Android", - ios: "iOS", - macos: "macOS", - }; - const renderValues = ( !!values && // HACK: Currently we merge additional values into the style spec, so this is required @@ -61,10 +70,9 @@ export default class Doc extends React.Component { return ( {key} - {Object.keys(headers).map(k => { - const value = supportObj[k]; + {Object.keys(headers).map((k) => { if (supportObj.hasOwnProperty(k)) { - return {supportObj[k]}; + return {supportObj[k as keyof typeof headers]}; } else { return no; @@ -80,4 +88,4 @@ export default class Doc extends React.Component { ); } -} +} \ No newline at end of file diff --git a/src/components/InputButton.jsx b/src/components/InputButton.tsx similarity index 53% rename from src/components/InputButton.jsx rename to src/components/InputButton.tsx index e9c4b235..bd8aaaa1 100644 --- a/src/components/InputButton.jsx +++ b/src/components/InputButton.tsx @@ -1,21 +1,20 @@ import React from 'react' -import PropTypes from 'prop-types' import classnames from 'classnames' -export default class InputButton extends React.Component { - static propTypes = { - "data-wd-key": PropTypes.string, - "aria-label": PropTypes.string, - onClick: PropTypes.func, - style: PropTypes.object, - className: PropTypes.string, - children: PropTypes.node, - disabled: PropTypes.bool, - type: PropTypes.string, - id: PropTypes.string, - title: PropTypes.string, - } +type InputButtonProps = { + "data-wd-key"?: string + "aria-label"?: string + onClick?(...args: unknown[]): unknown + style?: object + className?: string + children?: React.ReactNode + disabled?: boolean + type?: typeof HTMLButtonElement.prototype.type + id?: string + title?: string +}; +export default class InputButton extends React.Component { render() { return