fix(types): enhance type safety in navigateToLogin function and updateComponentNode function

This commit is contained in:
2025-12-30 00:48:52 +00:00
parent eae9a8094c
commit ae3cdafb69
4 changed files with 13 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
import { expect,test } from '@playwright/test';
import { expect, test, Page } from '@playwright/test';
// Helper function to navigate to login page
async function navigateToLogin(page: any) {
async function navigateToLogin(page: Page) {
await page.goto('/');
// Click "Sign In" button to navigate to login page
await page.getByRole('button', { name: /sign in|get started/i }).first().click();

View File

@@ -1,7 +1,7 @@
import { expect,test } from '@playwright/test';
import { expect, test, Page } from '@playwright/test';
// Helper function to navigate to login page
async function navigateToLogin(page: any) {
async function navigateToLogin(page: Page) {
await page.goto('/');
// Click "Sign In" button to navigate to login page
await page.getByRole('button', { name: /sign in|get started/i }).first().click();

View File

@@ -15,7 +15,13 @@ export const updateComponentNode = async (
nodeId: string,
updates: Partial<ComponentNode>
): Promise<void> => {
const data: any = {}
const data: Partial<{
type: string
parentId: string | null
childIds: string
order: number
pageId: string
}> = {}
if (updates.type !== undefined) data.type = updates.type
if (updates.parentId !== undefined) data.parentId = updates.parentId
if (updates.childIds !== undefined) data.childIds = JSON.stringify(updates.childIds)

View File

@@ -3,8 +3,9 @@ import { executeLuaScriptWithProfile } from '@/lib/lua/execute-lua-script-with-p
import type { LuaEngine } from '@/lib/lua-engine'
import type { ComponentInstance } from '@/lib/types/builder-types'
import type { User } from '@/lib/types/level-types'
import type { JsonValue } from '@/types/utility-types'
export async function executeLuaScript(scriptId: string, context: Record<string, unknown>): Promise<unknown> {
export async function executeLuaScript(scriptId: string, context: Record<string, JsonValue>): Promise<JsonValue> {
const scripts = await Database.getLuaScripts()
const script = scripts.find(s => s.id === scriptId)
if (!script) {