Skip to content

A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.

build(editor): tests are type-checked, and two .d.ts files were lying

esengine30f1ff8d7aa0
diff --git a/build-tools/utils/androidAttrValues.d.ts b/build-tools/utils/androidAttrValues.d.ts
new file mode 100644
index 000000000..faa155697
--- /dev/null
+++ b/build-tools/utils/androidAttrValues.d.ts
@@ -0,0 +1,7 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/** Symbolic android:* attribute values (enums and flag sets) as their integers. */
+
+/** The integer for `android:<name>="<text>"`, or null when it is not symbolic. */
+export function symbolicAttrValue(name: string, text: string): number | null;
+export function isSymbolicAttr(name: string): boolean;
diff --git a/build-tools/utils/androidBinaryXml.d.ts b/build-tools/utils/androidBinaryXml.d.ts
new file mode 100644
index 000000000..ee04315e2
--- /dev/null
+++ b/build-tools/utils/androidBinaryXml.d.ts
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/** Android binary XML (AXML) encoding — the shape the TS side consumes. */
+
+export const ANDROID_NS: string;
+export const ANDROID_ATTR_IDS: Record<string, number>;
+export const ANDROID_STYLE_IDS: Record<string, number>;
+
+export function parseXml(text: string): unknown;
+export function encodeBinaryXml(root: unknown, references?: Record<string, number>): Buffer;
+/** Parse + encode in one step: the manifest as an APK carries it. */
+export function compileManifest(xml: string, references?: Record<string, number>): Buffer;
diff --git a/build-tools/utils/androidResources.d.ts b/build-tools/utils/androidResources.d.ts
new file mode 100644
index 000000000..9a1dfae35
--- /dev/null
+++ b/build-tools/utils/androidResources.d.ts
@@ -0,0 +1,17 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+/** The one resource an exported app carries: its launcher icon. */
+
+export const APP_PACKAGE_ID: number;
+export const ICON_RESOURCE_ID: number;
+export const ICON_REFERENCE: string;
+export const ICON_PATH: string;
+
+export function appResources(iconPng: Buffer): {
+ references: Record<string, number>;
+ files: { name: string; data: Buffer }[];
+ /** resources.arsc, for an APK. */
+ arsc: Buffer;
+ /** The protobuf table, for an AAB. */
+ pb: Buffer;
+};
diff --git a/build-tools/utils/apk.d.ts b/build-tools/utils/apk.d.ts
index c5ac761b9..164e07e61 100644
--- a/build-tools/utils/apk.d.ts
+++ b/build-tools/utils/apk.d.ts
@@ -21,6 +21,8 @@ export function assembleApk(options: {
contentDir: string;
app: ApkAppIdentity;
key: SigningKey;
+ /** The launcher icon; the template's default when absent. */
+ icon?: Buffer;
}): Buffer;
export function signApkV2(zip: Buffer, key: SigningKey): Buffer;
diff --git a/build-tools/utils/nativeTemplate.d.ts b/build-tools/utils/nativeTemplate.d.ts
index 219de960c..22e00a6a3 100644
--- a/build-tools/utils/nativeTemplate.d.ts
+++ b/build-tools/utils/nativeTemplate.d.ts
@@ -56,6 +56,17 @@ export interface TemplateEntry {
export function templateLayout(platform: NativePlatform, options?: { abis?: readonly string[] }): TemplateEntry[];
export function requiredTemplateFiles(platform: NativePlatform, options?: { abis?: readonly string[] }): string[];
export function missingTemplateFiles(dir: string, platform: NativePlatform, options?: { abis?: readonly string[] }): string[];
+/** The same question asked of a NAME LIST rather than a directory — what a zip
+ * is missing, checked before it is unpacked. */
+export function missingTemplateEntries(
+ names: readonly string[],
+ platform: NativePlatform,
+ options?: { abis?: readonly string[]; release?: boolean },
+): string[];
+export function writeTemplateManifest(
+ dir: string,
+ meta: { platform: NativePlatform; engineVersion: string; abi?: string } & Record<string, unknown>,
+): NativeTemplateManifest;
export function readTemplateManifest(dir: string): NativeTemplateManifest | null;
export function templateMatches(manifest: NativeTemplateManifest | null, want: TemplateWant): boolean;
export function templateZipName(platform: NativePlatform, engineVersion: string): string;
diff --git a/desktop/scripts/solidPng.d.mts b/desktop/scripts/solidPng.d.mts
new file mode 100644
index 000000000..d8699e3c5
--- /dev/null
+++ b/desktop/scripts/solidPng.d.mts
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: Apache-2.0
+// SPDX-FileCopyrightText: Copyright (c) 2024-present ESEngine Team
+
+/** A single-colour PNG, for fixtures that need real image bytes. */
+export function solidPng(
+ width: number,
+ height: number,
+ rgba?: readonly [number, number, number, number],
+): Buffer;
diff --git a/desktop/src/engine/prefabEnvironment.ts b/desktop/src/engine/prefabEnvironment.ts
index 32f4dfd7e..e3ddbbfca 100644
--- a/desktop/src/engine/prefabEnvironment.ts
+++ b/desktop/src/engine/prefabEnvironment.ts
@@ -31,7 +31,9 @@ export interface DocumentEntity {
name: string;
parent: number | null;
children: number[];
- components: readonly { type: string }[];
+ /** `data` is carried but not read here — this module only asks WHICH components
+ * an entity has. Declared so authored scene data types as itself. */
+ components: readonly { type: string; data?: unknown }[];
visible?: boolean;
/** Marks an environment entity. Set by {@link hostPrefab}; never on authored data. */
env?: boolean;
diff --git a/desktop/tests/agent-kernel.test.ts b/desktop/tests/agent-kernel.test.ts
index 3b9f2a6be..ceb0ea33f 100644
--- a/desktop/tests/agent-kernel.test.ts
+++ b/desktop/tests/agent-kernel.test.ts
@@ -25,6 +25,7 @@ function fakeSession(steps: StepEvent[][]): AgentSession & {
pushUser: (t) => { user.push(t); },
pushContext: (t) => { context.push(t); },
pushToolResults: (o) => { results.push([...o]); },
+ rewindTo: (n) => { user.length = n; },
step: async function* () {
for (const ev of steps[at] ?? [{ type: 'stop', reason: 'end_turn' }]) yield ev;
at++;
diff --git a/desktop/tests/agent-replay.test.ts b/desktop/tests/agent-replay.test.ts
index 258a53fd2..9071368ee 100644
--- a/desktop/tests/agent-replay.test.ts
+++ b/desktop/tests/agent-replay.test.ts
@@ -9,7 +9,7 @@
* made "re-ask this one" name a different turn on each side. Runs carry
* the session's own coordinate now, and the stream is replayed on attach.
*/
-import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
import { useAgent, attachAgentBridge } from '@/store/AgentStore';
import type { AgentEvent } from '../electron/agent/types';
import type { AgentStatus } from '../electron/agent/host';
diff --git a/desktop/tests/agent-transcript.test.ts b/desktop/tests/agent-transcript.test.ts
index 3759da4f1..2aeacfb52 100644
--- a/desktop/tests/agent-transcript.test.ts
+++ b/desktop/tests/agent-transcript.test.ts
@@ -254,11 +254,11 @@ describe('the transcript projection', () => {
describe('which entities a turn touched', () => {
const toolEntry = (over: Partial<AgentToolEntry>): AgentToolEntry => ({
kind: 'tool', id: 'c1', name: 'set_field', input: {}, effect: 'undoable',
- state: 'ok', summary: 'ok', image: null, argText: '', reason: null, ...over,
+ state: 'ok', summary: 'ok', brief: 'ok', image: null, argText: '', reason: null, ...over,
});
const turn = (entries: AgentToolEntry[], id = 0): AgentTurn => ({
- id, prompt: 'p', entries, inputTokens: 0, outputTokens: 0, steps: 1, mark: { seq: 1 },
- reason: 'end_turn', startedAt: 0, endedAt: 1,
+ id, prompt: 'p', model: 'opus-5', entries, inputTokens: 0, outputTokens: 0, steps: 1,
+ mark: { seq: 1 }, reason: 'end_turn', startedAt: 0, endedAt: 1,
});
it('reads the ids out of the argument names the catalog uses', () => {
diff --git a/desktop/tests/asset-type-suffix.test.ts b/desktop/tests/asset-type-suffix.test.ts
index aa00670f3..5cf7a15ec 100644
--- a/desktop/tests/asset-type-suffix.test.ts
+++ b/desktop/tests/asset-type-suffix.test.ts
@@ -40,7 +40,7 @@ describe('assetTypeOf — suffixes', () => {
});
it('lets a contributed type claim a suffix too', () => {
- const disposable = assetTypeRegistry.register('test-owner', {
+ const disposable = assetTypeRegistry.register('plugin:test-owner', {
id: 'testcfg',
suffixes: ['.config.yaml'],
badge: 'CFG',
diff --git a/desktop/tests/audio-cook.test.ts b/desktop/tests/audio-cook.test.ts
index 5c8b684e5..4b1e21ac6 100644
--- a/desktop/tests/audio-cook.test.ts
+++ b/desktop/tests/audio-cook.test.ts
@@ -46,7 +46,7 @@ function makeWav(opts: {
describe('parseWav', () => {
it('parses PCM16 stereo', () => {
- const wav = makeWav({ channels: 2, frames: 50, sample: (f, c) => (c === 0 ? 0.5 : -0.5) });
+ const wav = makeWav({ channels: 2, frames: 50, sample: (_f, c) => (c === 0 ? 0.5 : -0.5) });
const parsed = parseWav(wav)!;
expect(parsed.sampleRate).toBe(44100);
expect(parsed.channels).toHaveLength(2);
diff --git a/desktop/tests/autosave.test.ts b/desktop/tests/autosave.test.ts
index cd98c7391..84c27a0c2 100644
--- a/desktop/tests/autosave.test.ts
+++ b/desktop/tests/autosave.test.ts
@@ -92,7 +92,7 @@ describe('AutosaveService scheduler (renderer)', () => {
sync: vi.fn(async () => {}),
clear: vi.fn(async () => {}),
...over,
- });
+ } as AutosaveEnv & { sync: ReturnType<typeof vi.fn>; clear: ReturnType<typeof vi.fn> });
it('gates snapshotting on dirty AND not playing', () => {
expect(new AutosaveService(env({})).shouldSnapshot()).toBe(true);
diff --git a/desktop/tests/cook-assets.test.ts b/desktop/tests/cook-assets.test.ts
index ec8cf1d8d..ed4a82801 100644
--- a/desktop/tests/cook-assets.test.ts
+++ b/desktop/tests/cook-assets.test.ts
@@ -354,7 +354,7 @@ describe('cookAssets (A4)', () => {
entries: Array<{ uuid: string; path: string; sourcePath: string }>;
};
const mat = m.entries.find((e) => e.uuid === MAT)!;
- expect(mat.sourcePath).toBe('assets/materials/m.esmaterial');
+ expect((mat as { sourcePath?: string }).sourcePath).toBe('assets/materials/m.esmaterial');
expect(mat.path).toMatch(/^assets\/[0-9a-f]{16}\.esmaterial$/);
// The staged material's RELATIVE refs were rewritten to logical project
diff --git a/desktop/tests/create-catalog.test.ts b/desktop/tests/create-catalog.test.ts
index 01a0d6c04..e50bfe418 100644
--- a/desktop/tests/create-catalog.test.ts
+++ b/desktop/tests/create-catalog.test.ts
@@ -12,12 +12,12 @@ describe('Create catalog (searchable source registry)', () => {
});
it('builds one-entity presets from the registered component defaults', async () => {
- const camera = (await ENTITY_SOURCES.find((s) => s.label === 'Camera')!.build({ parent: null })).entities[0];
+ const camera = (await ENTITY_SOURCES.find((s) => s.label === 'Camera')!.build!({ parent: null })).entities[0];
expect(camera.components.map((c) => c.type)).toEqual(['Transform', 'Camera']);
const cam = camera.components.find((c) => c.type === 'Camera')!.data as Record<string, unknown>;
expect(cam.isActive).toBe(true); // orthographic + active come from Camera's defaults
- const empty = (await ENTITY_SOURCES.find((s) => s.label === 'Empty')!.build({ parent: null })).entities[0];
+ const empty = (await ENTITY_SOURCES.find((s) => s.label === 'Empty')!.build!({ parent: null })).entities[0];
expect(empty.components.map((c) => c.type)).toEqual(['Transform']);
});
@@ -48,7 +48,7 @@ describe('Create catalog (searchable source registry)', () => {
const text = ENTITY_SOURCES.find((s) => s.id === 'ui-text')!;
expect(text.placement).toBe('under-canvas');
- const built = (await text.build({ parent: null })).entities[0];
+ const built = (await text.build!({ parent: null })).entities[0];
expect(built.components.map((c) => c.type)).toEqual(['Transform', 'UINode', 'Text']);
// Seeded so a freshly-dropped label reads, not an empty invisible node.
expect((built.components.find((c) => c.type === 'Text')!.data as { content: string }).content).toBe('Text');
diff --git a/desktop/tests/dirty-registry.test.ts b/desktop/tests/dirty-registry.test.ts
index b8968cd56..939b43936 100644
--- a/desktop/tests/dirty-registry.test.ts
+++ b/desktop/tests/dirty-registry.test.ts
@@ -111,7 +111,7 @@ describe('project.open guard (Ctrl+O)', () => {
const open = vi.spyOn(ProjectStore, 'openViaDialog').mockResolvedValue(false);
DirtyRegistry.register(doc('a', true));
- const run = commands.get('project.open')!.run() as Promise<void>;
+ const run = commands.get('project.open')!.run() as unknown as Promise<void>;
await Promise.resolve(); // let confirmDiscard queue the dialog
const pending = ConfirmService.getSnapshot();
expect(pending).toHaveLength(1);
@@ -129,7 +129,7 @@ describe('project.open guard (Ctrl+O)', () => {
expect(open).toHaveBeenCalledTimes(1); // clean → straight through
DirtyRegistry.register(doc('a', true));
- const run = commands.get('project.open')!.run() as Promise<void>;
+ const run = commands.get('project.open')!.run() as unknown as Promise<void>;
await Promise.resolve();
ConfirmService.settle(ConfirmService.getSnapshot()[0].id, true); // Discard
await run;
diff --git a/desktop/tests/editor-mcp-tools.test.ts b/desktop/tests/editor-mcp-tools.test.ts
index af59cf191..fff88052f 100644
--- a/desktop/tests/editor-mcp-tools.test.ts
+++ b/desktop/tests/editor-mcp-tools.test.ts
@@ -192,7 +192,7 @@ describe('editor MCP tool registry', () => {
});
describe('apply_scene_ops program sources', () => {
- const apply = () => TOOLS.find((t) => t.name === 'apply_scene_ops');
+ const apply = () => TOOLS.find((t: { name: string }) => t.name === 'apply_scene_ops');
it('reads the program from a file when one is named, so a big panel need not fit in a message', async () => {
const js = vi.fn().mockResolvedValue({ refs: {}, created: [], applied: 3 });
@@ -218,7 +218,7 @@ describe('apply_scene_ops program sources', () => {
});
describe('open_scene guards unsaved work', () => {
- const openScene = () => TOOLS.find((t) => t.name === 'open_scene');
+ const openScene = () => TOOLS.find((t: { name: string }) => t.name === 'open_scene');
it('passes the discard flag through, defaulting to refusing', async () => {
const driver = vi.fn().mockResolvedValue(undefined);
@@ -299,7 +299,7 @@ describe('the prefab-mode doors', () => {
describe('re-running an authoring step is not a new asset', () => {
it('create_scene_file passes the overwrite decision down, defaulting to refusing', async () => {
const driver = Object.assign(vi.fn(async () => '"assets/scenes/shop.esscene"'), {
- js: vi.fn(async () => '"assets/scenes/shop.esscene"'),
+ js: vi.fn(async (_code: string) => '"assets/scenes/shop.esscene"'),
});
const tool = TOOLS.find((t: { name: string }) => t.name === 'create_scene_file');
@@ -311,7 +311,7 @@ describe('re-running an authoring step is not a new asset', () => {
});
it('create_prefab_from_entity can replace the asset it already named', async () => {
- const driver = Object.assign(vi.fn(async () => '"@uuid:x"'), { js: vi.fn(async () => '"@uuid:x"') });
+ const driver = Object.assign(vi.fn(async () => '"@uuid:x"'), { js: vi.fn(async (_code: string) => '"@uuid:x"') });
const tool = TOOLS.find((t: { name: string }) => t.name === 'create_prefab_from_entity');
await runTool(tool, driver, { entity: 7, replace: true });
@@ -319,7 +319,7 @@ describe('re-running an authoring step is not a new asset', () => {
});
it('refresh_assets is a plain renderer call — the scan a batch import needs', async () => {
- const driver = Object.assign(vi.fn(async () => 'true'), { js: vi.fn(async () => 'true') });
+ const driver = Object.assign(vi.fn(async () => 'true'), { js: vi.fn(async (_code: string) => 'true') });
const tool = TOOLS.find((t: { name: string }) => t.name === 'refresh_assets');
expect(tool).toBeTruthy();
diff --git a/desktop/tests/engine-commands.test.ts b/desktop/tests/engine-commands.test.ts
index 28f3c9009..e6b78c8d9 100644
--- a/desktop/tests/engine-commands.test.ts
+++ b/desktop/tests/engine-commands.test.ts
@@ -265,7 +265,7 @@ describe.skipIf(!HAS_WASM)('SceneCommands / SceneQuery (headless World)', () =>
it('a non-UI catalog preset (Sprite) instantiates into the World', async () => {
const sprite = ENTITY_SOURCES.find((s) => s.label === 'Sprite')!;
- const id = S.commands.createFromTemplate(await sprite.build({ parent: null }), null)!;
+ const id = S.commands.createFromTemplate(await sprite.build!({ parent: null }), null)!;
expect(id).not.toBeNull();
expect(host.world.has(rt(id), Sprite)).toBe(true);
});
diff --git a/desktop/tests/entity-sources.test.ts b/desktop/tests/entity-sources.test.ts
index 50da8aac5..4962b5118 100644
--- a/desktop/tests/entity-sources.test.ts
+++ b/desktop/tests/entity-sources.test.ts
@@ -29,7 +29,7 @@ describe('entitySources registry (Create-entity E2)', () => {
for (const comp of ['SpineAnimation', 'AudioSource', 'Text', 'BitmapText', 'ShapeRenderer', 'Mesh2D', 'TrailRenderer']) {
const src = ENTITY_SOURCES.find((s) => s.id === `anchor:${comp}`);
expect(src, `no create source for anchor ${comp}`).toBeDefined();
- const p = await src!.build({ parent: null });
+ const p = await src!.build!({ parent: null });
expect(p.entities[0].components.map((c) => c.type)).toContain(comp);
}
});
diff --git a/desktop/tests/export-playable.test.ts b/desktop/tests/export-playable.test.ts
index 4799a4956..e83a29d8a 100644
--- a/desktop/tests/export-playable.test.ts
+++ b/desktop/tests/export-playable.test.ts
@@ -157,7 +157,8 @@ describe('exportGame (playable)', () => {
expect(unpacked).toBe(readFileSync(path.join(o, 'index.html'), 'utf8'));
// `bytes` is the upload, not the page — they differ, and the compressed one is smaller.
expect(res.zipFile).toBe(zip);
- expect(res.bytes).toBeLessThan(res.htmlBytes!);
+ const sized = res as unknown as { bytes: number; htmlBytes: number };
+ expect(sized.bytes).toBeLessThan(sized.htmlBytes);
}, 60_000);
it('injects nothing and keeps the default cap with no network selected', async () => {
diff --git a/desktop/tests/external-programs.test.ts b/desktop/tests/external-programs.test.ts
index 545abd952..a32fa5d43 100644
--- a/desktop/tests/external-programs.test.ts
+++ b/desktop/tests/external-programs.test.ts
@@ -27,7 +27,7 @@ describe('the external program registry', () => {
it('registers and retracts a slot and its setting together', () => {
const id = 'test.diff';
- const disposable = externalPrograms.register({ id, label: 'Diff tool' }, 'test-owner');
+ const disposable = externalPrograms.register({ id, label: 'Diff tool' }, 'plugin:test-owner');
expect(externalPrograms.get(id)).toBeDefined();
expect(settingsRegistry.get(programSettingId(id))).toBeDefined();
diff --git a/desktop/tests/field-tooltip.test.ts b/desktop/tests/field-tooltip.test.ts
index 2e5b569f0..c34ced543 100644
--- a/desktop/tests/field-tooltip.test.ts
+++ b/desktop/tests/field-tooltip.test.ts
@@ -12,6 +12,7 @@ beforeEach(() => {
setUserSchemas([
{
name: 'Mover',
+ isTag: false,
default: { speed: 5, hp: 100 },
colorKeys: [],
fields: {
diff --git a/desktop/tests/gizmo-local-pivot.test.ts b/desktop/tests/gizmo-local-pivot.test.ts
index 83d1fe503..c05f91c9f 100644
--- a/desktop/tests/gizmo-local-pivot.test.ts
+++ b/desktop/tests/gizmo-local-pivot.test.ts
@@ -5,7 +5,7 @@
* constraint (the Local/World coordinate-space toggle).
*/
import { describe, it, expect } from 'vitest';
-import { hitTestGizmo, constrainLocalDelta, constrainWorldDelta, GIZMO } from '@/tools/gizmo';
+import { hitTestGizmo, constrainLocalDelta, GIZMO } from '@/tools/gizmo';
const pivot = { x: 100, y: 100 };
const close = (a: number, b: number, eps = 1e-9) => expect(Math.abs(a - b)).toBeLessThanOrEqual(eps);
diff --git a/desktop/tests/inspector-write-values.test.ts b/desktop/tests/inspector-write-values.test.ts
index 935644818..60c602d2f 100644
--- a/desktop/tests/inspector-write-values.test.ts
+++ b/desktop/tests/inspector-write-values.test.ts
@@ -13,6 +13,7 @@
import { describe, it, expect } from 'vitest';
import { toModelValue } from '@/engine/SceneCommands';
import { coerceFieldValue, splitFieldMember, patchFieldMember } from '@/engine/EditorControlSurface';
+import type { InspectorFieldValue } from '@/types';
describe('toModelValue', () => {
it('keeps a name-valued enum as the name', () => {
@@ -90,7 +91,7 @@ describe('structural field members (the "position.x" door)', () => {
});
it('fills a short or missing value rather than writing past its end', () => {
- expect(patchFieldMember('vec3', [], 'z', 7)).toEqual([0, 0, 7]);
+ expect(patchFieldMember('vec3', [] as unknown as InspectorFieldValue, 'z', 7)).toEqual([0, 0, 7]);
expect(patchFieldMember('dimension', null as never, 'value', 3)).toEqual({ value: 3 });
});
diff --git a/desktop/tests/platform-catalog.test.ts b/desktop/tests/platform-catalog.test.ts
index d3a1aa9db..3da69d76e 100644
--- a/desktop/tests/platform-catalog.test.ts
+++ b/desktop/tests/platform-catalog.test.ts
@@ -59,7 +59,7 @@ describe('listPlatforms — built-in readiness is probed', () => {
expect(byId.web.ready).toBe(false);
expect(byId.desktop.ready).toBe(false);
expect(byId.playable.ready).toBe(false);
- expect(byId.web.prereq?.command).toContain('build -t web');
+ expect((byId.web.prereq as { command?: string } | undefined)?.command).toContain('build -t web');
});
it('the web glue makes playable ready too — it inlines the WEB runtime, not a -t playable one', async () => {
@@ -72,7 +72,7 @@ describe('listPlatforms — built-in readiness is probed', () => {
expect(byId.playable.prereq).toBeUndefined();
// WeChat has its own runtime and is unaffected by the web one.
expect(byId.wechat.ready).toBe(false);
- expect(byId.wechat.prereq?.command).toContain('build -t wechat');
+ expect((byId.wechat.prereq as { command?: string } | undefined)?.command).toContain('build -t wechat');
});
it('WeChat accepts either its own glue or a web-aligned one', async () => {
@@ -86,7 +86,7 @@ describe('listPlatforms — built-in readiness is probed', () => {
it('reports paths with forward slashes, whatever the platform separator', async () => {
const wx = (await listPlatforms(root, dirs(), VERSION)).find((r) => r.id === 'wechat');
- expect(wx?.prereq?.dir).not.toContain('\\');
+ expect((wx?.prereq as { dir?: string } | undefined)?.dir).not.toContain('\\');
});
});
@@ -117,10 +117,10 @@ describe('listPlatforms — platforms the project defines', () => {
const acme = (await listPlatforms(root, dirs(), VERSION)).find((r) => r.id === 'acme');
expect(acme!.ready).toBe(false);
- expect(acme!.prereq?.dir).toBe('build/wasm/acme');
+ expect((acme!.prereq as { dir?: string } | undefined)?.dir).toBe('build/wasm/acme');
// The editor does not know how a project builds its own runtime, so it
// reports where it looked and offers no command.
- expect(acme!.prereq?.command).toBeUndefined();
+ expect((acme!.prereq as { command?: string } | undefined)?.command).toBeUndefined();
});
it('a broken profile is listed with its error, not silently dropped', async () => {
diff --git a/desktop/tests/play-inspect-gating.test.ts b/desktop/tests/play-inspect-gating.test.ts
index ba495bdb1..03004334d 100644
--- a/desktop/tests/play-inspect-gating.test.ts
+++ b/desktop/tests/play-inspect-gating.test.ts
@@ -116,7 +116,7 @@ describe('PlayInspect gating', () => {
const unsub = PlayInspect.subscribe(() => {});
await advance(200);
const first = PlayInspect.getTree();
- snapshotMock.mockImplementation((sel, opts) =>
+ snapshotMock.mockImplementation((_sel, opts) =>
Promise.resolve({ tree: opts?.tree === false ? null : tree([1, 2, 3]), selected: null }),
);
await advance(300);
diff --git a/desktop/tests/plugin-contributions.test.ts b/desktop/tests/plugin-contributions.test.ts
index bfb6699b5..cc8c44e50 100644
--- a/desktop/tests/plugin-contributions.test.ts
+++ b/desktop/tests/plugin-contributions.test.ts
@@ -18,10 +18,10 @@ import { toolRegistry } from '@/tools/toolRegistry';
import { useEditorStore } from '@/store/editorStore';
import { useTilemapPaint } from '@/store/tilemapPaintStore';
import type { OverlayPrimitive } from '@/plugins/overlays';
-import type { GizmoStyle, OverlayGraphics, Vec2 } from '@/plugins/types';
+import type { LocalizedString, OverlayGraphics, Vec2 } from '@/plugins/types';
const PLUGIN = 'plugin:acme';
-const id = (s: string) => s;
+const id = (v: LocalizedString) => (typeof v === 'string' ? v : v.en);
afterEach(() => {
for (const registry of [inspectorRegistry, contextMenuRegistry, assetTypeRegistry, toolRegistry]) {
diff --git a/desktop/tests/prefab-instantiate.test.ts b/desktop/tests/prefab-instantiate.test.ts
index bee3d211e..29cfe1e7a 100644
--- a/desktop/tests/prefab-instantiate.test.ts
+++ b/desktop/tests/prefab-instantiate.test.ts
@@ -63,7 +63,6 @@ describe.skipIf(!HAS_WASM)('SceneCommands.instantiatePrefab (headless World)', (
// Model: the subtree (root + barrel) is present.
const entities = S.model.current!.entities;
expect(entities).toHaveLength(2);
- const root = S.model.entityBySource(rootId!)!;
const barrel = entities.find((e) => e.name === 'Barrel')!;
expect(barrel.parent).toBe(rootId);
diff --git a/desktop/tests/project-display.test.ts b/desktop/tests/project-display.test.ts
index 9ff888af7..79165964b 100644
--- a/desktop/tests/project-display.test.ts
+++ b/desktop/tests/project-display.test.ts
@@ -14,7 +14,7 @@ import { ProjectStore } from '@/project/ProjectStore';
async function canvasDesign(): Promise<{ x: number; y: number }> {
const src = ENTITY_SOURCES.find((s) => s.id === 'canvas')!;
- const prefab = await src.build({ parent: null });
+ const prefab = await src.build!({ parent: null });
const canvas = prefab.entities[0].components.find((c) => c.type === 'Canvas')!.data as Record<string, unknown>;
return canvas.designResolution as { x: number; y: number };
}
diff --git a/desktop/tests/tile-line.test.ts b/desktop/tests/tile-line.test.ts
index 6bc3472b8..9513b26a8 100644
--- a/desktop/tests/tile-line.test.ts
+++ b/desktop/tests/tile-line.test.ts
@@ -9,7 +9,6 @@
import { describe, it, expect } from 'vitest';
import { lineCells } from '@/tools/tileTools';
-const key = (c: { x: number; y: number }) => `${c.x},${c.y}`;
describe('lineCells (Bresenham)', () => {
it('a zero-length line is the single start cell', () => {
diff --git a/desktop/tests/transform-cycle.test.ts b/desktop/tests/transform-cycle.test.ts
index 0f364106f..171aa645c 100644
--- a/desktop/tests/transform-cycle.test.ts
+++ b/desktop/tests/transform-cycle.test.ts
@@ -20,7 +20,7 @@ describe('stepCycle', () => {
let c: CycleState | null = null;
const picks: number[] = [];
for (let i = 0; i < 4; i++) {
- const r = stepCycle(STACK, c, 100, 100)!;
+ const r: { pick: number; cycle: CycleState } = stepCycle(STACK, c, 100, 100)!;
picks.push(r.pick);
c = r.cycle;
}
diff --git a/desktop/tests/user-component-sources.test.ts b/desktop/tests/user-component-sources.test.ts
index 5d259e44a..73f49963f 100644
--- a/desktop/tests/user-component-sources.test.ts
+++ b/desktop/tests/user-component-sources.test.ts
@@ -36,7 +36,7 @@ describe('userComponentSources (Create-entity E4 dynamic sources)', () => {
it('build() yields a plain entity carrying Transform + the component', async () => {
setUserSchemas([schema('Health', { hp: 100 })]);
const health = userComponentSources().find((s) => s.label === 'Health')!;
- const p = await health.build({ parent: null });
+ const p = await health.build!({ parent: null });
expect(p.entities[0].components.map((c) => c.type)).toEqual(['Transform', 'Health']);
});
diff --git a/desktop/tsconfig.json b/desktop/tsconfig.json
index d490dadd9..e05667e86 100644
--- a/desktop/tsconfig.json
+++ b/desktop/tsconfig.json
@@ -24,5 +24,5 @@
"@/*": ["./src/*"]
}
},
- "include": ["src", "electron", "vite.config.ts"]
+ "include": ["src", "electron", "tests", "vite.config.ts"]
}