From 7e99413ee20b79aa3ec54412bdbf010b323b1688 Mon Sep 17 00:00:00 2001 From: Justin Edmund Date: Mon, 19 Oct 2020 05:11:42 -0700 Subject: [PATCH] Update to accommodate Character type --- src/components/SummonUnit/index.tsx | 6 +++--- src/components/WeaponUnit/index.tsx | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/components/SummonUnit/index.tsx b/src/components/SummonUnit/index.tsx index bcae2b01..56c0cff0 100644 --- a/src/components/SummonUnit/index.tsx +++ b/src/components/SummonUnit/index.tsx @@ -21,7 +21,6 @@ interface Props { const SummonUnit = (props: Props) => { const [imageUrl, setImageUrl] = useState('') - const { open, openModal, closeModal } = useModal() const openModalIfEditable = (props.editable) ? openModal : () => {} @@ -63,13 +62,13 @@ const SummonUnit = (props: Props) => { setImageUrl(imgSrc) } - function sendData(object: Weapon | Summon, position: number) { + function sendData(object: Character | Weapon | Summon, position: number) { if (isSummon(object)) { props.onReceiveData(object, position) } } - function isSummon(object: Weapon | Summon): object is Summon { + function isSummon(object: Character | Weapon | Summon): object is Summon { // There aren't really any unique fields here return (object as Summon).granblue_id !== undefined } @@ -87,6 +86,7 @@ const SummonUnit = (props: Props) => { { (props.editable) ? : '' } { setImageUrl(imgSrc) } - function sendData(object: Weapon | Summon, position: number) { + function sendData(object: Character | Weapon | Summon, position: number) { if (isWeapon(object)) { props.onReceiveData(object, position) } } - function isWeapon(object: Weapon | Summon): object is Weapon { + function isWeapon(object: Character | Weapon | Summon): object is Weapon { return (object as Weapon).proficiency !== undefined } @@ -85,6 +85,7 @@ const WeaponUnit = (props: Props) => { { (props.editable) ? : '' }