Add typecheck
This commit is contained in:
@@ -76,11 +76,11 @@ export default defineEventHandler(async (event) => {
|
||||
if (quest.hunt.teams.length <= 0) {
|
||||
throw createError({ status: 403, statusText: 'No team yet!' });
|
||||
}
|
||||
if (quest.answers.length > 0 && quest.answers[0].final) {
|
||||
if (quest.answers.length > 0 && quest.answers![0]?.final) {
|
||||
throw createError({ status: 418, statusText: 'Already marked as final!' });
|
||||
}
|
||||
|
||||
const team = quest.hunt.teams[0];
|
||||
const team = quest.hunt.teams![0]!;
|
||||
|
||||
const body = await readFormData(event);
|
||||
const formDataObj = Object.fromEntries(body.entries());
|
||||
@@ -101,7 +101,7 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
const prevAnswer =
|
||||
quest.answers.length > 0
|
||||
? quest.answers[0]
|
||||
? quest.answers![0]!
|
||||
: {
|
||||
updatedAt: null,
|
||||
id: null
|
||||
|
||||
Reference in New Issue
Block a user