Fix strict-boolean-expressions and type safety warnings in production code

Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-01-06 20:00:18 +00:00
parent 8e24a1a0fb
commit 2c2a7d06d1
8 changed files with 22 additions and 16 deletions

View File

@@ -17,7 +17,7 @@ export const addComment = async (comment: Comment): Promise<void> => {
userId: comment.userId,
content: comment.content,
createdAt: BigInt(comment.createdAt),
updatedAt: comment.updatedAt ? BigInt(comment.updatedAt) : null,
updatedAt: comment.updatedAt !== null && comment.updatedAt !== undefined ? BigInt(comment.updatedAt) : null,
parentId: comment.parentId,
},
})

View File

@@ -19,7 +19,7 @@ export const getComments = async (): Promise<Comment[]> => {
entityId: c.entityId,
content: c.content,
createdAt: Number(c.createdAt),
updatedAt: c.updatedAt ? Number(c.updatedAt) : undefined,
parentId: c.parentId || undefined,
updatedAt: c.updatedAt !== null && c.updatedAt !== undefined ? Number(c.updatedAt) : undefined,
parentId: c.parentId !== null && c.parentId !== '' ? c.parentId : undefined,
}))
}

View File

@@ -19,7 +19,7 @@ export const setComments = async (comments: Comment[]): Promise<void> => {
userId: comment.userId,
content: comment.content,
createdAt: BigInt(comment.createdAt),
updatedAt: comment.updatedAt ? BigInt(comment.updatedAt) : null,
updatedAt: comment.updatedAt !== null && comment.updatedAt !== undefined ? BigInt(comment.updatedAt) : null,
parentId: comment.parentId,
},
})

View File

@@ -5,6 +5,7 @@
import { prisma } from '@/lib/config/prisma'
import type { ComponentConfig } from './types'
import type { JsonValue } from '@/types/utility-types'
/**
* Get all component configs
@@ -17,11 +18,11 @@ export const getComponentConfigs = async (): Promise<Record<string, ComponentCon
result[config.id] = {
id: config.id,
componentId: config.componentId,
props: JSON.parse(config.props),
styles: JSON.parse(config.styles),
events: JSON.parse(config.events),
conditionalRendering: config.conditionalRendering
? JSON.parse(config.conditionalRendering)
props: JSON.parse(config.props) as Record<string, JsonValue>,
styles: JSON.parse(config.styles) as Record<string, JsonValue>,
events: JSON.parse(config.events) as Record<string, string>,
conditionalRendering: config.conditionalRendering !== null && config.conditionalRendering !== ''
? JSON.parse(config.conditionalRendering) as { condition: string; luaScriptId?: string }
: undefined,
}
}

View File

@@ -17,8 +17,8 @@ export const getComponentHierarchy = async (): Promise<Record<string, ComponentN
result[node.id] = {
id: node.id,
type: node.type,
parentId: node.parentId || undefined,
childIds: JSON.parse(node.childIds),
parentId: node.parentId !== null && node.parentId !== '' ? node.parentId : undefined,
childIds: JSON.parse(node.childIds) as string[],
order: node.order,
pageId: node.pageId,
}

View File

@@ -14,10 +14,11 @@ export function parseWorkflowRunLogsOptions(search: string | URLSearchParams): W
const params = typeof search === 'string' ? new URLSearchParams(search) : search
const tailLinesParam = params.get('tailLines')
const jobLimitParam = params.get('jobLimit')
const runNameParam = params.get('runName')
return {
tailLines: tailLinesParam !== null ? parseInt(tailLinesParam) : undefined,
failedOnly: params.get('failedOnly') === 'true',
runName: params.get('runName') || undefined,
runName: runNameParam !== null && runNameParam !== '' ? runNameParam : undefined,
includeLogs: params.get('includeLogs') === 'true',
jobLimit: jobLimitParam !== null ? parseInt(jobLimitParam) : undefined,
}

View File

@@ -10,11 +10,16 @@ export interface GitHubRepo {
export function resolveGitHubRepo(params: URLSearchParams | string): GitHubRepo {
if (typeof params === 'string') {
const [owner, repo] = params.split('/')
return { owner: owner || '', repo: repo || '' }
return {
owner: owner !== null && owner !== undefined && owner !== '' ? owner : '',
repo: repo !== null && repo !== undefined && repo !== '' ? repo : ''
}
}
const ownerParam = params.get('owner')
const repoParam = params.get('repo')
return {
owner: params.get('owner') || '',
repo: params.get('repo') || '',
owner: ownerParam !== null && ownerParam !== '' ? ownerParam : '',
repo: repoParam !== null && repoParam !== '' ? repoParam : '',
}
}

View File

@@ -30,5 +30,4 @@ declare module '@monaco-editor/react' {
export default Editor
export function useMonaco(): Monaco | null
export function loader(): Promise<Monaco>
}