From 0108035c05c45708e65436e0fcdb066ed1c6449e Mon Sep 17 00:00:00 2001 From: Dane Everitt Date: Sat, 28 Sep 2019 13:29:49 -0700 Subject: [PATCH] Fix some typescript typing issues --- resources/scripts/components/server/ServerConsole.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/resources/scripts/components/server/ServerConsole.tsx b/resources/scripts/components/server/ServerConsole.tsx index 344862743..2fe11e42a 100644 --- a/resources/scripts/components/server/ServerConsole.tsx +++ b/resources/scripts/components/server/ServerConsole.tsx @@ -10,13 +10,15 @@ import { faMicrochip } from '@fortawesome/free-solid-svg-icons/faMicrochip'; import { bytesToHuman } from '@/helpers'; import Spinner from '@/components/elements/Spinner'; +type PowerAction = 'start' | 'stop' | 'restart' | 'kill'; + const GreyBox = styled.div` ${tw`mt-4 shadow-md bg-neutral-700 rounded p-3 flex text-xs`} `; const ChunkedConsole = lazy(() => import('@/components/server/Console')); -const StopOrKillButton = ({ onPress }: { onPress: (action: string) => void }) => { +const StopOrKillButton = ({ onPress }: { onPress: (action: PowerAction) => void }) => { const [ clicked, setClicked ] = useState(false); const status = ServerContext.useStoreState(state => state.status.value); @@ -60,7 +62,7 @@ export default () => { setCpu(stats.cpu_absolute); }; - const sendPowerCommand = (command: 'start' | 'stop' | 'restart' | 'kill') => { + const sendPowerCommand = (command: PowerAction) => { instance && instance.send('set state', command); };