Fix some typescript typing issues

This commit is contained in:
Dane Everitt 2019-09-28 13:29:49 -07:00
parent 79571e1928
commit 0108035c05
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -10,13 +10,15 @@ import { faMicrochip } from '@fortawesome/free-solid-svg-icons/faMicrochip';
import { bytesToHuman } from '@/helpers'; import { bytesToHuman } from '@/helpers';
import Spinner from '@/components/elements/Spinner'; import Spinner from '@/components/elements/Spinner';
type PowerAction = 'start' | 'stop' | 'restart' | 'kill';
const GreyBox = styled.div` const GreyBox = styled.div`
${tw`mt-4 shadow-md bg-neutral-700 rounded p-3 flex text-xs`} ${tw`mt-4 shadow-md bg-neutral-700 rounded p-3 flex text-xs`}
`; `;
const ChunkedConsole = lazy(() => import('@/components/server/Console')); 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 [ clicked, setClicked ] = useState(false);
const status = ServerContext.useStoreState(state => state.status.value); const status = ServerContext.useStoreState(state => state.status.value);
@ -60,7 +62,7 @@ export default () => {
setCpu(stats.cpu_absolute); setCpu(stats.cpu_absolute);
}; };
const sendPowerCommand = (command: 'start' | 'stop' | 'restart' | 'kill') => { const sendPowerCommand = (command: PowerAction) => {
instance && instance.send('set state', command); instance && instance.send('set state', command);
}; };