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

View File

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

View File

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

View File

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