Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to generate with a ES5 JS file that is dependent on another library? #141

Open
yaustar opened this issue Jul 23, 2020 · 0 comments
Open

Comments

@yaustar
Copy link

yaustar commented Jul 23, 2020

I'm trying to generate ts definitions for the following library: https://github.com/playcanvas/playcanvas-tween

It is dependent on the PlayCanvas engine as it adds new functionality: https://github.com/playcanvas/engine

So far, I've tried the following:

/**
 * @external "pc"
 */

/**
 * @external "pc.Application"
 */

/**
 * @external "pc.Entity"
 */

pc.extend(pc, function () {

    /**
     * @name pc.TweenManager
     * @description Handles updating tweens
     * @param {pc.Application} app  The application
     */
    var TweenManager = function (app) {
        this._app = app;
        this._tweens = [];
        this._add = []; // to be added
    };

And the following config:

{
    "source": {
        "include": ["tween.js"]
    },
    "opts": {
        "destination": "build",
        "outFile": "playcanvas-tween.d.ts",
        "recurse": true,
        "template": "node_modules/tsd-jsdoc/dist"
    }
}

And get the following error:

[TSD-JSDoc] tween.js:15:4 Failed to find parent of doclet 'pc.TweenManager' using memberof 'pc', this is likely due to invalid JSDoc.
[TSD-JSDoc] tween.js:52:4 Failed to find parent of doclet 'pc.Tween' using memberof 'pc', this is likely due to invalid JSDoc.
[TSD-JSDoc] tween.js:681:4 Failed to find parent of doclet 'pc.Application#tween' using memberof 'pc.Application', this is likely due to invalid JSDoc.
[TSD-JSDoc] tween.js:699:4 Failed to find parent of doclet 'pc.Entity#tween' using memberof 'pc.Entity', this is likely due to invalid JSDoc.
/Users/stevenyau/Dev/playcanvas-tween/node_modules/tsd-jsdoc/dist/assert_never.js:5
    throw new Error("Unexpected object: " + JSON.stringify(x));

Error: Unexpected object: {"comment":"/**\n * @external \"pc\"\n */","meta":{"filename":"tween.js","lineno":1,"columnno":0,"path":"/Users/stevenyau/Dev/playcanvas-tween","code":{}},"kind":"external","name":"\"pc\"","longname":"external:\"pc\"","scope":"global","___id":"T000002R028308","___s":true}
    at Object.assertNever (/Users/stevenyau/Dev/playcanvas-tween/node_modules/tsd-jsdoc/dist/assert_never.js:5:11)
    at Emitter._parseTreeNode (/Users/stevenyau/Dev/playcanvas-tween/node_modules/tsd-jsdoc/dist/Emitter.js:196:39)

I understand that the @external tag is not supported, what would be the best way to approach this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant