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.

test(sdk): the mock module's registry is part of its type

esengine70729318d85e
diff --git a/docs/astro/src/data/apiStability.generated.json b/docs/astro/src/data/apiStability.generated.json
index 1ec7159e9..eaf5a01a4 100644
--- a/docs/astro/src/data/apiStability.generated.json
+++ b/docs/astro/src/data/apiStability.generated.json
@@ -3,10 +3,10 @@
"counts": {
"public": 115,
"beta": 103,
- "experimental": 2000,
+ "experimental": 2001,
"deprecated": 3
},
- "total": 2218,
+ "total": 2219,
"subsystems": [
{
"id": "ecs",
diff --git a/sdk/tests/mocks/wasm.ts b/sdk/tests/mocks/wasm.ts
index c32991b67..8f3b80cab 100644
--- a/sdk/tests/mocks/wasm.ts
+++ b/sdk/tests/mocks/wasm.ts
@@ -11,6 +11,8 @@ import type { Entity } from '../../src/types';
*/
export interface MockModule extends ESEngineModule {
setUINodeHiddenInTree(entity: Entity, hidden: boolean): void;
+ /** The one registry this module answers for — `app.connectCpp` takes it. */
+ getRegistry(): CppRegistry;
}
export function createMockModule(): MockModule {
diff --git a/tools/baselines/sdk-test-types.json b/tools/baselines/sdk-test-types.json
index 8c8afdde3..f2be030a7 100644
--- a/tools/baselines/sdk-test-types.json
+++ b/tools/baselines/sdk-test-types.json
@@ -13,8 +13,7 @@
"TS2322|Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BufferSource'.": 12
},
"tests/aot-conformance.test.ts": {
- "TS2322|Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BufferSource'.": 1,
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
+ "TS2322|Type 'Uint8Array<ArrayBufferLike>' is not assignable to type 'BufferSource'.": 1
},
"tests/aot-dispatch.test.ts": {
"TS2739|Type '{ componentNamed: (name: string) => AnyComponentDef | undefined; resourceAt: () => undefined; }' is missing the following properties from type 'AotAddresses': resourceWriteBack, payloadRows, sendEvent, releasePayloads": 2
@@ -47,24 +46,12 @@
"tests/binding-surface.test.ts": {
"TS7016|Could not find a declaration file for module '../../build-tools/tasks/native.js'. 'build-tools/tasks/native.js' implicitly has an 'any' type.": 1
},
- "tests/camera-bounds.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/camera-director.test.ts": {
"TS2322|Type '{ entity: number; isActive: boolean; x: number; y: number; z: number; rotation: number; tilt?: { x: number; y: number; z: number; w: number; } | undefined; orbit?: { yaw: number; pitch: number; focusZ: number; } | undefined; ... 10 more ...; renderTarget?: number | undefined; }' is not assignable to type 'CameraPOV'.": 1
},
"tests/camera-pov.test.ts": {
"TS2322|Type '{ entity: number; isActive: boolean; x: number; y: number; z: number; rotation: number; tilt?: { x: number; y: number; z: number; w: number; } | undefined; orbit?: { yaw: number; pitch: number; focusZ: number; } | undefined; ... 10 more ...; renderTarget?: number | undefined; }' is not assignable to type 'CameraPOV'.": 1
},
- "tests/camera-render-order.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
- "tests/colliderEnabled.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
- "tests/collisionLayerMask.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/content-cache.test.ts": {
"TS2322|Type 'Promise<{}>' is not assignable to type 'Promise<T>'.": 1
},
@@ -80,21 +67,12 @@
"tests/entity-box.test.ts": {
"TS2698|Spread types may only be created from object types.": 5
},
- "tests/entity-order.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/fsm-agent.test.ts": {
"TS2345|Argument of type '(ctx: AiContext) => number' is not assignable to parameter of type 'AiAction<AiContext> | AiActionSpec<AiContext>'.": 1
},
"tests/fsm.test.ts": {
"TS2345|Argument of type '() => number' is not assignable to parameter of type 'AiAction<unknown> | AiActionSpec<unknown>'.": 1
},
- "tests/fx-despawn-cleanup.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
- "tests/helpers/mockApp.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/hot-swap-systems.test.ts": {
"TS2322|Type 'number' is not assignable to type 'void | Promise<void>'.": 13
},
@@ -104,14 +82,10 @@
"tests/json-asset-loader.test.ts": {
"TS2345|Argument of type '{ backend: Backend; }' is not assignable to parameter of type 'AssetsOptions'.": 1
},
- "tests/marker-component.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/minigame-entry.test.ts": {
"TS2722|Cannot invoke an object which is possibly 'undefined'.": 1
},
"tests/mocks/wasm.ts": {
- "TS2352|Conversion of type '{ getRegistry: () => CppRegistry; getResourceManager: () => CppResourceManager; getUINodeHiddenInTree: (_registry: unknown, entity: Entity) => boolean; setUINodeHiddenInTree: (entity: Entity, hidden: boolean) => void; GL: any; }' to type 'MockModule' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1,
"TS2353|Object literal may only specify known properties, and 'loadTexture' does not exist in type 'CppResourceManager'.": 1
},
"tests/native-host-bridge.test.ts": {
@@ -124,21 +98,9 @@
"TS2345|Argument of type '{ verts: Float32Array<ArrayBuffer>; polys: Int32Array<ArrayBuffer>; neis: Int32Array<ArrayBuffer>; ... 4 more ...; verticalReach: number; }' is not assignable to parameter of type 'NavMeshData'.": 1,
"TS2741|Property 'showLinks' is missing in type '{ enabled: true; showFaces: true; showBorders: true; }' but required in type 'NavDebugDrawConfig'.": 1
},
- "tests/nav-geometry.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
- "tests/physics-features.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/physics3d-ecs.test.ts": {
"TS2339|Property 'publishContacts' does not exist on type 'Physics3DWasmModule & { calls: { name: string; args: number[]; }[]; publish(records: number[]): void; publishQuery(records: number[]): void; }'.": 1
},
- "tests/physicsReconcile.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
- "tests/physicsSyncTransforms.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/playableRuntime.test.ts": {
"TS2554|Expected 1 arguments, but got 0.": 1
},
@@ -161,12 +123,6 @@
"tests/profile-recorder.test.ts": {
"TS2322|Type 'number' is not assignable to type 'void | Promise<void>'.": 1
},
- "tests/query-mixed-mut.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
- "tests/query-mut-change-tracking.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/renderPipeline.test.ts": {
"TS2339|Property '_applyScreenStack' does not exist on type 'ResourceDef<PostProcessAPI>'.": 1,
"TS2339|Property '_beginScreenCapture' does not exist on type 'ResourceDef<PostProcessAPI>'.": 2,
@@ -177,9 +133,6 @@
"TS2339|Property 'isInitialized' does not exist on type 'ResourceDef<PostProcessAPI>'.": 1,
"TS2339|Property 'resize' does not exist on type 'ResourceDef<PostProcessAPI>'.": 2
},
- "tests/runtime-only-serialize.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/scene-asset-release.test.ts": {
"TS2345|Argument of type '{ key: string; generation: number; value: null; release: () => number; }' is not assignable to parameter of type 'AssetLease<null>'.": 1
},
@@ -195,9 +148,6 @@
"tests/scene-streaming.test.ts": {
"TS2352|Conversion of type 'SystemDef' to type '{ _fn: (...a: unknown[]) => void; }' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1
},
- "tests/scene.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/sceneManager.test.ts": {
"TS2339|Property 'unbind' does not exist on type 'ResourceDef<PostProcessAPI>'.": 3,
"TS2345|Argument of type 'BuiltinComponentDef<BitmapTextData>' is not assignable to parameter of type 'symbol'.": 2,
@@ -281,9 +231,6 @@
"tests/ui-anchor-preset.test.ts": {
"TS2322|Type '{ position: number; display?: number | undefined; opacity?: number | undefined; pointerEvents?: number | undefined; width: Dimension; height: Dimension; ... 15 more ...; insetBottom: Dimension; }' is not assignable to type 'UINodeData'.": 1
},
- "tests/ui-dimension-transient.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/ui-drag-plugin.test.ts": {
"TS2322|Type 'null' is not assignable to type 'Vec2 | undefined'.": 2
},
@@ -291,9 +238,6 @@
"TS2322|Type '{ position: number; display?: number | undefined; opacity?: number | undefined; pointerEvents?: number | undefined; width: Dimension; height: Dimension; ... 15 more ...; insetBottom: Dimension; }' is not assignable to type 'UINodeData'.": 1,
"TS2352|Conversion of type 'FlexContainerData' to type 'Record<string, unknown>' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1
},
- "tests/ui-plugin-cleanup.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/ui-slider-dropdown.test.ts": {
"TS2724|'\"../src/ui\"' has no exported member named 'UIRect'. Did you mean 'Rect'?": 1
},
@@ -303,13 +247,7 @@
"tests/utf8.test.ts": {
"TS2307|Cannot find module '../src/util/utf8?fallback' or its corresponding type declarations.": 1
},
- "tests/velocity.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 1
- },
"tests/wasm-video-backend.test.ts": {
"TS2739|Type '{ name: \"wechat\"; fetch: () => Promise<any>; readFile: () => Promise<ArrayBuffer>; readTextFile: () => Promise<string>; fileExists: () => Promise<true>; ... 6 more ...; createAudioBackend: () => any; }' is missing the following properties from type 'PlatformAdapter': devicePixelRatio, getStorageItem, setStorageItem, removeStorageItem, clearStorage": 1
- },
- "tests/world.test.ts": {
- "TS2551|Property 'getRegistry' does not exist on type 'MockModule'. Did you mean 'Registry'?": 2
}
}