Cast results of removeUndefinedProps when neccessary

This commit is contained in:
Forrest Wolf 2022-05-25 17:22:10 -04:00
parent f992a9ba04
commit 5541617bc8
4 changed files with 6 additions and 8 deletions

View File

@ -42,7 +42,7 @@ export function getNewContract(
? getNumericProps(ante, bucketCount, min, max)
: getFreeAnswerProps(ante)
const contract: Contract = removeUndefinedProps({
return removeUndefinedProps({
id,
slug,
...propsByOutcomeType,
@ -71,9 +71,7 @@ export function getNewContract(
platformFee: 0,
},
manaLimitPerUser,
})
return contract as Contract
}) as Contract
}
/*

View File

@ -46,7 +46,7 @@ export function AnswerResolvePanel(props: {
resolutions:
resolveOption === 'CHOOSE_MULTIPLE' ? normalizedProbs : undefined,
contractId: contract.id,
})
}) as {outcome: string, contractId: string, resolutions: {[x: string]: number} | undefined}
const result = await resolveMarket(resolutionProps).then((r) => r.data)

View File

@ -30,7 +30,7 @@ export async function createComment(
const ref = betId
? doc(getCommentsCollection(contractId), betId)
: doc(getCommentsCollection(contractId))
const comment: Comment = removeUndefinedProps({
const comment = removeUndefinedProps({
id: ref.id,
contractId,
userId: commenter.id,
@ -42,7 +42,7 @@ export async function createComment(
betId: betId,
answerOutcome: answerOutcome,
replyToCommentId: replyToCommentId,
})
}) as Comment
return await setDoc(ref, comment)
}

View File

@ -94,5 +94,5 @@ export function toLiteMarket(contract: Contract): LiteMarket {
isResolved,
resolution,
resolutionTime,
})
}) as LiteMarket
}