mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
fix(types): enhance type safety in navigateToLogin function and updateComponentNode function
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user