mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 13:54:57 +00:00
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:
@@ -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,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
},
|
||||
})
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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 : '',
|
||||
}
|
||||
}
|
||||
|
||||
@@ -30,5 +30,4 @@ declare module '@monaco-editor/react' {
|
||||
export default Editor
|
||||
|
||||
export function useMonaco(): Monaco | null
|
||||
export function loader(): Promise<Monaco>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user