Skip to content

To fix #2583 #44

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

Closed
wants to merge 8 commits into from
Closed

To fix #2583 #44

wants to merge 8 commits into from

Conversation

plantain-00
Copy link
Contributor

microsoft/TypeScript#2583

It seems the constructor of interface URL is not generated, is this a bug?

@msftclas
Copy link

Hi @plantain-00, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!

The agreement was validated by Microsoft and real humans are currently evaluating your PR.

TTYL, MSBOT;

@mhegazy
Copy link
Contributor

mhegazy commented Jan 12, 2016

that is not the correct change. this adds a new type called URLConstructor. what you want is to enable URL to be called with new.

the desired output is:

interface URL{
    hash: string;
    search: string;
    pathname: string;
    port: string;
    hostname: string;
    host: string;
    password: string;
    username: string;
    protocol: string;
    origin: string;
    href: string;
}
declare var URL: {
    revokeObjectURL(url: string): void;
    createObjectURL(object: any, options?: ObjectURLOptions): string;
    new(url: string, base?: string): URL;
};

@plantain-00
Copy link
Contributor Author

Did I miss something? Locally I added these into overridingTypes.json or addedTypes.json, but nothings changes:

    {
        "kind": "constructor",
        "interface": "URL",
        "signatures": [
            "new (url: string, base?: string): URL"
        ]
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "hash",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "search",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "pathname",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "port",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "hostname",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "host",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "password",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "username",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "protocol",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "origin",
        "type": "number"
    },
    {
        "kind": "property",
        "interface": "URL",
        "name": "href",
        "type": "number"
    }

I also put these into overridingTypes.json, nothing changes too:

    {
        "kind": "interface",
        "name": "URL",
        "properties": [
            {
                "name": "hash",
                "type": "string"
            },
            {
                "name": "search",
                "type": "string"
            },
            {
                "name": "pathname",
                "type": "string"
            },
            {
                "name": "port",
                "type": "string"
            },
            {
                "name": "hostname",
                "type": "string"
            },
            {
                "name": "host",
                "type": "string"
            },
            {
                "name": "password",
                "type": "string"
            },
            {
                "name": "username",
                "type": "string"
            },
            {
                "name": "protocol",
                "type": "string"
            },
            {
                "name": "origin",
                "type": "string"
            },
            {
                "name": "href",
                "type": "string"
            }
        ]
    }

@mhegazy
Copy link
Contributor

mhegazy commented Jan 13, 2016

@zhengbli ideas?

@zhengbli
Copy link
Contributor

This is because an issue in the script. Because the URL interface is marked as a static interface in the XML file, the script doesn't pick up added constructors. I'll fix soon.

@zhengbli
Copy link
Contributor

@plantain-00 Now adding the content to addedTypes.json should do the right thing. Can you give it a try? Thanks

plantain-00 and others added 5 commits January 26, 2016 09:38
Conflicts:
	inputfiles/addedTypes.json
Conflicts:
	inputfiles/addedTypes.json
	inputfiles/overridingTypes.json
	inputfiles/removedTypes.json
@plantain-00
Copy link
Contributor Author

The tests fails, but build.cmd works fine locally.

Also I have no idea how to change the type of variable URL to

{
    revokeObjectURL(url: string): void;
    createObjectURL(object: any, options?: ObjectURLOptions): string;
    new(url: string, base?: string): URL;
}

I tried to add the following into addedTypes.json or overridingTypes.json, the result is it added it into all interfaces, or changed the URL property in interface Document

{
        "kind": "property",
        "name": "URL",
        "type": "any"
    }

So need help.

@@ -21,6 +21,16 @@
},
{
"kind": "method",
"interface": "URL",
"name": "createObjectURL"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

these should be added on a new interface URLConstructor, and var URL: URLConstructor

@plantain-00
Copy link
Contributor Author

Error appears when run npm install in Typescript. See the last build: https://ci.appveyor.com/project/zhengbli/tsjs-lib-generator/build/1.0.78-oncrkjps .
The message is:

npm ERR! peerinvalid Peer [email protected] wants typescript@>=1.7.3 || >=1.7.0-dev.20151003 || >=1.8.0-dev

@mhegazy
Copy link
Contributor

mhegazy commented Jan 26, 2016

thanks. @vladima is fixing this.

@plantain-00
Copy link
Contributor Author

Can not rerun the failed build, so restart a new one at #58

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

Successfully merging this pull request may close these issues.

4 participants