From da4963d2c1b69f36d41afab752ebd0847187bb5e Mon Sep 17 00:00:00 2001 From: Jordan Eldredge Date: Wed, 10 Oct 2018 20:34:41 -0700 Subject: [PATCH] Type RunningTimeDisplay --- .../{RunningTimeDisplay.js => RunningTimeDisplay.tsx} | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) rename js/components/PlaylistWindow/{RunningTimeDisplay.js => RunningTimeDisplay.tsx} (74%) diff --git a/js/components/PlaylistWindow/RunningTimeDisplay.js b/js/components/PlaylistWindow/RunningTimeDisplay.tsx similarity index 74% rename from js/components/PlaylistWindow/RunningTimeDisplay.js rename to js/components/PlaylistWindow/RunningTimeDisplay.tsx index 74e1fe4a..53c99463 100644 --- a/js/components/PlaylistWindow/RunningTimeDisplay.js +++ b/js/components/PlaylistWindow/RunningTimeDisplay.tsx @@ -3,18 +3,23 @@ import { connect } from "react-redux"; import CharacterString from "../CharacterString"; import { getRunningTimeMessage } from "../../selectors"; +import { AppState } from "../../types"; // While all the browsers I care about support String.prototype.padEnd, // Not all node versions do, and I want tests to pass in Jest... // Sigh. -function rightPad(str, len, fillChar) { +function rightPad(str: string, len: number, fillChar: string): string { while (str.length < len) { str += fillChar; } return str; } -const RunningTimeDisplay = props => ( +interface Props { + runningTimeMessage: string; +} + +const RunningTimeDisplay = (props: Props) => (
{/* This div is probably not strictly needed */}
@@ -25,7 +30,7 @@ const RunningTimeDisplay = props => (
); -const mapStateToProps = state => ({ +const mapStateToProps = (state: AppState): Props => ({ runningTimeMessage: getRunningTimeMessage(state) });