Skip to content

fix: accept Asset attributes with engine 2.23+ generic Asset type - #76

Merged
kpal81xd merged 1 commit into
mainfrom
fix/generic-asset-attribute
Oct 22, 2026
Merged

kpal81xd merged 1 commit into
mainfrom
fix/generic-asset-attribute

Conversation

@kpal81xd

Copy link
Copy Markdown
Collaborator

Fixes #75

Engine 2.23 made Asset generic (Asset<K extends AssetType | (string & {}) = string>), so @type {Asset} resolves to an instantiated Asset<string> reference rather than the declared class type the parser registers as supported. Asset attributes were therefore rejected with "{Asset}" is not a valid attribute type.

Changes

  • getType now resolves generic class instances (e.g. Asset<string>, Asset<'texture'>) to their declared class type and uses the class name as the type name, so they output type: 'asset'. Arrays, tuples and generic interfaces are unaffected.
  • Bump the playcanvas devDependency to 2.23.3 so the existing Asset tests exercise the generic declaration (12 of them fail on these types without the fix). The newer engine no longer depends on canvas, which accounts for the lockfile shrink.

Manual smoke test

  1. In a project using engine 2.23+, create an ESM script with /** @attribute @type {Asset} */ myAsset = null; and /** @attribute @type {Entity} */ myEntity = null;, then parse it.
    • Expected: no "not a valid attribute type" error; both attributes appear in the inspector as Asset and Entity pickers.
  2. Add /** @attribute @type {Asset} @resource texture */ tex = null; and parse.
    • Expected: an Asset picker restricted to textures.

@kpal81xd
kpal81xd merged commit 25a86b1 into main Oct 22, 2026
3 checks passed
@kpal81xd
kpal81xd deleted the fix/generic-asset-attribute branch October 22, 2026 10:33
@kpal81xd kpal81xd self-assigned this Oct 22, 2026
@kpal81xd kpal81xd added the bug Something isn't working label Oct 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Asset attributes no longer supported

1 participant