From 8057f4a678f5e4c00241ec9b15bd9d4dfc3588df Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Thu, 8 Mar 2018 16:19:39 +0100 Subject: Add back strict null checks to react-shared package and fix issues --- .../react-shared/src/ts/components/markdown_section.tsx | 17 ++++++++++++----- .../src/ts/components/nested_sidebar_menu.tsx | 7 +++++-- .../react-shared/src/ts/components/section_header.tsx | 16 ++++++++++++---- packages/react-shared/src/ts/utils/utils.ts | 2 +- packages/react-shared/tsconfig.json | 1 - 5 files changed, 30 insertions(+), 13 deletions(-) (limited to 'packages') diff --git a/packages/react-shared/src/ts/components/markdown_section.tsx b/packages/react-shared/src/ts/components/markdown_section.tsx index 682b6ef8f..95dc83eaf 100644 --- a/packages/react-shared/src/ts/components/markdown_section.tsx +++ b/packages/react-shared/src/ts/components/markdown_section.tsx @@ -19,6 +19,12 @@ export interface MarkdownSectionProps { githubLink?: string; } +interface DefaultMarkdownSectionProps { + headerSize: HeaderSizes; +} + +type PropsWithDefaults = MarkdownSectionProps & DefaultMarkdownSectionProps; + export interface MarkdownSectionState { shouldShowAnchor: boolean; } @@ -34,7 +40,8 @@ export class MarkdownSection extends React.Component
- {!_.isUndefined(this.props.githubLink) && ( + {!_.isUndefined(githubLink) && ( @@ -68,7 +75,7 @@ export class MarkdownSection extends React.Component
{this.props.sidebarHeader} {!_.isUndefined(this.props.versions) && - !_.isUndefined(this.props.selectedVersion) && ( + !_.isUndefined(this.props.selectedVersion) && + !_.isUndefined(this.props.onVersionSelected) && (
- {sectionName} + {finalSectionName} } id={id} diff --git a/packages/react-shared/src/ts/utils/utils.ts b/packages/react-shared/src/ts/utils/utils.ts index ebe896bbc..9e848392f 100644 --- a/packages/react-shared/src/ts/utils/utils.ts +++ b/packages/react-shared/src/ts/utils/utils.ts @@ -30,7 +30,7 @@ export const utils = { const id = name.replace(/ /g, '-'); return id; }, - getEtherScanLinkIfExists(addressOrTxHash: string, networkId: number, suffix: EtherscanLinkSuffixes): string { + getEtherScanLinkIfExists(addressOrTxHash: string, networkId: number, suffix: EtherscanLinkSuffixes): string|undefined { const networkName = constants.NETWORK_NAME_BY_ID[networkId]; if (_.isUndefined(networkName)) { return undefined; diff --git a/packages/react-shared/tsconfig.json b/packages/react-shared/tsconfig.json index 44055a037..de87aa45b 100644 --- a/packages/react-shared/tsconfig.json +++ b/packages/react-shared/tsconfig.json @@ -4,7 +4,6 @@ "outDir": "./lib/", "jsx": "react", "baseUrl": "./", - "strictNullChecks": false, "paths": { "*": ["node_modules/@types/*", "*"] } -- cgit v1.2.3