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

Any way to define a new parameterized (generic) type? #781

Open
tolmasky opened this issue Jun 3, 2024 · 0 comments
Open

Any way to define a new parameterized (generic) type? #781

tolmasky opened this issue Jun 3, 2024 · 0 comments

Comments

@tolmasky
Copy link

tolmasky commented Jun 3, 2024

I am just trying to do something like this:

interface Something<T>
{
    T function();
}

I can't for the life of me figure out how to do this though, so figured I'd ask before filing a WebIDL syntax change. I see in lib/productions/type.js that the generic types seem to be special-cased and hard-coded, so I figure that I am out of luck for introducing new ones. I only really care about introducing a new "opaque" types. That is to say, I'd be perfectly satisfied with something like:

interface Something<T> { };

If not at the WebIDL level, I'd at least like to be able to add to the list of "known" parameterized types at the API level, something like:

WebIDL.parse(string, { extraParameterizedTypes: "Something" });

And then have that added to the existing static list.

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