From b74957acdfc8d67d154bcb4698acd7575db7cc47 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 11 May 2018 17:38:51 +0200 Subject: Add missing type definitions --- packages/react-docs/src/components/badge.tsx | 4 ++-- packages/react-docs/src/components/custom_enum.tsx | 4 ++-- packages/react-docs/src/components/documentation.tsx | 18 +++++++++--------- packages/react-docs/src/components/enum.tsx | 4 ++-- .../react-docs/src/components/event_definition.tsx | 6 +++--- packages/react-docs/src/components/interface.tsx | 4 ++-- packages/react-docs/src/components/signature.tsx | 4 ++-- packages/react-docs/src/components/signature_block.tsx | 8 ++++---- packages/react-docs/src/components/source_link.tsx | 4 ++-- packages/react-docs/src/components/type_definition.tsx | 8 ++++---- packages/react-docs/src/docs_info.ts | 5 +++-- packages/react-docs/src/utils/doxity_utils.ts | 4 ++-- packages/react-docs/src/utils/typedoc_utils.ts | 2 +- packages/react-docs/src/utils/utils.ts | 2 +- 14 files changed, 39 insertions(+), 38 deletions(-) (limited to 'packages/react-docs') diff --git a/packages/react-docs/src/components/badge.tsx b/packages/react-docs/src/components/badge.tsx index b342f2dca..0137b153b 100644 --- a/packages/react-docs/src/components/badge.tsx +++ b/packages/react-docs/src/components/badge.tsx @@ -31,7 +31,7 @@ export class Badge extends React.Component { isHovering: false, }; } - public render() { + public render(): React.ReactNode { const badgeStyle = { ...styles.badge, backgroundColor: this.props.backgroundColor, @@ -48,7 +48,7 @@ export class Badge extends React.Component { ); } - private _setHoverState(isHovering: boolean) { + private _setHoverState(isHovering: boolean): void { this.setState({ isHovering, }); diff --git a/packages/react-docs/src/components/custom_enum.tsx b/packages/react-docs/src/components/custom_enum.tsx index 1fe55eedc..797372f35 100644 --- a/packages/react-docs/src/components/custom_enum.tsx +++ b/packages/react-docs/src/components/custom_enum.tsx @@ -14,7 +14,7 @@ export interface CustomEnumProps { // This component renders custom string enums that was a work-around for versions of // TypeScript <2.4.0 that did not support them natively. We keep it around to support // older versions of 0x.js <0.9.0 -export function CustomEnum(props: CustomEnumProps) { +export const CustomEnum = (props: CustomEnumProps) => { const type = props.type; if (!_.startsWith(type.defaultValue, STRING_ENUM_CODE_PREFIX)) { logUtils.log('We do not yet support `Variable` types that are not strEnums'); @@ -31,4 +31,4 @@ export function CustomEnum(props: CustomEnumProps) { {`}`} ); -} +}; diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 0a525f702..25687db67 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -71,19 +71,19 @@ export class Documentation extends React.Component ); } - private _renderLoading(mainContainersStyles: React.CSSProperties) { + private _renderLoading(mainContainersStyles: React.CSSProperties): React.ReactNode { return (
); } - private _renderNetworkBadgesIfExists(sectionName: string) { + private _renderNetworkBadgesIfExists(sectionName: string): React.ReactNode { if (this.props.docsInfo.type !== SupportedDocJson.Doxity) { return null; } @@ -368,17 +368,17 @@ export class Documentation extends React.Component ); } - private _onSidebarHover(event: React.FormEvent) { + private _onSidebarHover(event: React.FormEvent): void { this.setState({ isHoveringSidebar: true, }); } - private _onSidebarHoverOff() { + private _onSidebarHoverOff(): void { this.setState({ isHoveringSidebar: false, }); } - private _onHashChanged(event: any) { + private _onHashChanged(event: any): void { const hash = window.location.hash.slice(1); sharedUtils.scrollToHash(hash, sharedConstants.SCROLL_CONTAINER_ID); } diff --git a/packages/react-docs/src/components/enum.tsx b/packages/react-docs/src/components/enum.tsx index 37f82f26e..536385d90 100644 --- a/packages/react-docs/src/components/enum.tsx +++ b/packages/react-docs/src/components/enum.tsx @@ -7,7 +7,7 @@ export interface EnumProps { values: EnumValue[]; } -export function Enum(props: EnumProps) { +export const Enum = (props: EnumProps) => { const values = _.map(props.values, (value, i) => { const defaultValueIfAny = !_.isUndefined(value.defaultValue) ? ` = ${value.defaultValue}` : ''; return `\n\t${value.name}${defaultValueIfAny},`; @@ -20,4 +20,4 @@ export function Enum(props: EnumProps) { {`}`} ); -} +}; diff --git a/packages/react-docs/src/components/event_definition.tsx b/packages/react-docs/src/components/event_definition.tsx index 67729ac87..b4dc729a9 100644 --- a/packages/react-docs/src/components/event_definition.tsx +++ b/packages/react-docs/src/components/event_definition.tsx @@ -24,7 +24,7 @@ export class EventDefinition extends React.Component ); } - private _renderEventCode() { + private _renderEventCode(): React.ReactNode { const indexed = indexed; const eventArgs = _.map(this.props.event.eventArgs, (eventArg: EventArg) => { const type = ( @@ -76,7 +76,7 @@ export class EventDefinition extends React.Component ); } - private _setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean): void { this.setState({ shouldShowAnchor, }); diff --git a/packages/react-docs/src/components/interface.tsx b/packages/react-docs/src/components/interface.tsx index bdfdf47c4..a881c7fec 100644 --- a/packages/react-docs/src/components/interface.tsx +++ b/packages/react-docs/src/components/interface.tsx @@ -13,7 +13,7 @@ export interface InterfaceProps { docsInfo: DocsInfo; } -export function Interface(props: InterfaceProps) { +export const Interface = (props: InterfaceProps) => { const type = props.type; const properties = _.map(type.children, property => { return ( @@ -63,4 +63,4 @@ export function Interface(props: InterfaceProps) { {`}`} ); -} +}; diff --git a/packages/react-docs/src/components/signature.tsx b/packages/react-docs/src/components/signature.tsx index 1d3c90261..c4a6394fa 100644 --- a/packages/react-docs/src/components/signature.tsx +++ b/packages/react-docs/src/components/signature.tsx @@ -88,7 +88,7 @@ function renderParameters( docsInfo: DocsInfo, sectionName: string, typeDefinitionByName?: TypeDefinitionByName, -) { +): React.ReactNode[] { const params = _.map(parameters, (p: Parameter) => { const isOptional = p.isOptional; const hasDefaultValue = !_.isUndefined(p.defaultValue); @@ -116,7 +116,7 @@ function renderTypeParameter( docsInfo: DocsInfo, sectionName: string, typeDefinitionByName?: TypeDefinitionByName, -) { +): React.ReactNode { const typeParam = ( {`<${typeParameter.name} extends `} diff --git a/packages/react-docs/src/components/signature_block.tsx b/packages/react-docs/src/components/signature_block.tsx index 6475d3995..9e5198e16 100644 --- a/packages/react-docs/src/components/signature_block.tsx +++ b/packages/react-docs/src/components/signature_block.tsx @@ -42,7 +42,7 @@ export class SignatureBlock extends React.Component ); } - private _renderChip(text: string) { + private _renderChip(text: string): React.ReactNode { return (
{text}
); } - private _renderParameterDescriptions(parameters: Parameter[]) { + private _renderParameterDescriptions(parameters: Parameter[]): React.ReactNode { const descriptions = _.map(parameters, parameter => { const isOptional = parameter.isOptional; return ( @@ -146,7 +146,7 @@ export class SignatureBlock extends React.Component { const src = props.source; const sourceCodeUrl = `${props.sourceUrl}/${src.fileName}#L${src.line}`; return ( @@ -20,4 +20,4 @@ export function SourceLink(props: SourceLinkProps) {
); -} +}; diff --git a/packages/react-docs/src/components/type_definition.tsx b/packages/react-docs/src/components/type_definition.tsx index 605b58fbd..a8e601ac2 100644 --- a/packages/react-docs/src/components/type_definition.tsx +++ b/packages/react-docs/src/components/type_definition.tsx @@ -3,7 +3,7 @@ import * as _ from 'lodash'; import * as React from 'react'; import { DocsInfo } from '../docs_info'; -import { CustomType, CustomTypeChild, KindString, TypeDocTypes } from '../types'; +import { CustomType, CustomTypeChild, EnumValue, KindString, TypeDocTypes } from '../types'; import { constants } from '../utils/constants'; import { utils } from '../utils/utils'; @@ -35,7 +35,7 @@ export class TypeDefinition extends React.Component ); } - private _setAnchorVisibility(shouldShowAnchor: boolean) { + private _setAnchorVisibility(shouldShowAnchor: boolean): void { this.setState({ shouldShowAnchor, }); @@ -150,7 +150,7 @@ export class TypeDefinition extends React.Component