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

Add support for arbitrary external types #109

Closed
wants to merge 2 commits into from
Closed

Add support for arbitrary external types #109

wants to merge 2 commits into from

Conversation

qwtel
Copy link

@qwtel qwtel commented Jun 22, 2018

Not quite what was discussed in #69, but maybe useful anyway.

This PR adds support for the externalTypes options keys, which accepts values like

const transformer = new Transformer({
  externalTypes: {
    "@platformparity/streams": ["ReadableStream"]
  }
});

where the key is an import path, and the value is an array of named exports.

This was built with ReadableStream in mind, which is used by the Fetch API, but doesn't have a WebIDL definition itself. However, there is a reference implementation which can be used and type-checked with this change.

It can also be used to use node 10's built-in URL and URLSearchParams types without having to modify the webidl-conversions package, e.g.

  externalTypes: {
    "url": ["URL", "URLSearchParams"]
  }

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.

1 participant