Skip to content

Suggestion: Add String literal types support #71

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
YuichiNukiyama opened this issue Feb 25, 2016 · 4 comments
Closed

Suggestion: Add String literal types support #71

YuichiNukiyama opened this issue Feb 25, 2016 · 4 comments

Comments

@YuichiNukiyama
Copy link
Contributor

TypeScript Version:

1.9.0-dev.20160225

Code

{
        "kind": "property",
        "interface": "HTMLTextAreaElement",
        "name": "autocomplete",
        "type": "\"on\" | \"off\""
}

Expected behavior:

generate following code.

interface HTMLTextAreaElement {
        autocomplete: "on" | "of";
}

Actual behavior:

generate nothing.

@YuichiNukiyama YuichiNukiyama changed the title Suggestion: Add Suggestion: Add String literal types support Feb 25, 2016
@DanielRosenwasser
Copy link
Member

You're bitwise-ORing two strings. Did you try just writing this?

{
        "kind": "property",
        "interface": "HTMLTextAreaElement",
        "name": "autocomplete",
        "type": "\"on\" | \"off\""
}

@YuichiNukiyama
Copy link
Contributor Author

Yes, I did.

@zhengbli
Copy link
Contributor

zhengbli commented Mar 3, 2016

I tried your code snippet, and it worked find for me. Did you add the snippet in addedTypes.json?

@YuichiNukiyama
Copy link
Contributor Author

Thank you good guys.

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

3 participants