engine icon indicating copy to clipboard operation
engine copied to clipboard

Fix AppOption types

Open slimbuck opened this issue 2 years ago • 7 comments

This PR updates AppOption types to class constructors (instead of class instances), which appears to appease typescript.

VSCode shows errors on these now, not sure how to fix that.

slimbuck avatar Sep 02 '22 09:09 slimbuck

I tried few variations of these (not this one yet), and something always does not work.

mvaligursky avatar Sep 02 '22 09:09 mvaligursky

With the latest update playcanvas.d.ts looks as follows:

    lightmapper: any;
    /**
     * The BatchManager.
     *
     * @type {typeof BatchManager}
     */
    batchManager: any;
    /**
     * The XrManager.
     *
     * @type {typeof XrManager}
     */
    xr: any;
    /**
     * The component systems the app requires.
     *
     * @type {(typeof ComponentSystem)[]}
     */
    componentSystems: (typeof ComponentSystem)[];
    /**
     * The resource handlers the app requires.
     *
     * @type {(typeof ResourceHandler)[]}
     */
    resourceHandlers: (typeof ResourceHandler)[];

slimbuck avatar Sep 02 '22 09:09 slimbuck

resource handler is being recast as an interface in types-fixup.js:

dts = dts.replace('export class ResourceHandler', 'export interface ResourceHandler');

@willeastcott any idea why this is done?

slimbuck avatar Sep 02 '22 09:09 slimbuck

also, try to build API docs from jsdocs locally, I think I had issues with this in the past as well.

mvaligursky avatar Sep 02 '22 09:09 mvaligursky

Yep, I have a feeling the docs build process fails on those typeof keywords, IIRC.

willeastcott avatar Sep 02 '22 10:09 willeastcott

The latest version (with constructor syntax) seems to work fine when compiling typescript and also generates docs.

CI fails though.

slimbuck avatar Sep 02 '22 10:09 slimbuck

related https://github.com/playcanvas/engine/pull/4324

mvaligursky avatar Sep 05 '22 10:09 mvaligursky