Skip to content

error TS4060: Return type of exported function has or is using private name #5284

Closed
@tommyZZM

Description

@tommyZZM
namespace game{
    class Stage{
        constructor(canvas:HTMLElement) {

        }
    }

    function checkCanvasVaild(canvas:HTMLElement) {
        return canvas.hasAttribute(HTMLData.id)
    }

    export function startUpAt(canvas:HTMLElement) {
        if (!CentralCore.instance.isStartUp) {
            CentralCore.instance.startUp();
        }

        var id = checkCanvasVaild(canvas);

        if (id) {

        } else {

        }

        return new Stage(canvas);
    }
}

solution

namespace game{
    export interface IStage{

    }

    class Stage implements IStage{
        constructor(canvas:HTMLElement) {

        }
    }

    function checkCanvasVaild(canvas:HTMLElement) {
        return canvas.hasAttribute(HTMLData.id)
    }

    export function startUpAt(canvas:HTMLElement):IStage {
        if (!CentralCore.instance.isStartUp) {
            CentralCore.instance.startUp();
        }

        var id = checkCanvasVaild(canvas);

        if (id) {

        } else {

        }

        var stage:IStage = new Stage(canvas);

        return stage;
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions