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

Hybrid compatibility for PolymerDomApi and Polymer.Iconset types. #5413

Merged
merged 2 commits into from
Nov 2, 2018

Conversation

aomarks
Copy link
Member

@aomarks aomarks commented Oct 25, 2018

Polymer V1 applications are compiled with hand-written externs at https://github.com/google/closure-compiler/blob/master/contrib/externs/polymer-1.0.js. These externs contain some types that do not exist in the V2 code.

PolymerDomApi is the type returned by the V1 Polymer.dom API, but in V2 it returns Polymer.DomApi. This adds the PolymerDomApi interface to the V2 externs, and annotates that Polymer.DomApi implements it. This allows both V1 and V2 code to use the PolymerDomApi type. Similar story for
PolymerDomApi.ObserveCallback.

Polymer.Iconset would ideally live in the iron-iconset repo, but many packages reference the type without actually depending on that library, so its simpler to just include it here, similar to how it worked for
Polymer V1.

@dfreedm
Copy link
Member

dfreedm commented Oct 26, 2018

Looks like the type generator didn't like this.

Polymer V1 applications are compiled with hand-written externs at
https://github.com/google/closure-compiler/blob/master/contrib/externs/polymer-1.0.js.
These externs contain some types that do not exist in the V2 code.

PolymerDomApi is the type returned by the V1 Polymer.dom API, but in V2
it returns Polymer.DomApi. This adds the PolymerDomApi interface to the
V2 externs, and annotates that Polymer.DomApi implements it. This allows
both V1 and V2 code to use the PolymerDomApi type. Similar story for
PolymerDomApi.ObserveCallback.

Polymer.Iconset would ideally live in the iron-iconset repo, but many
packages reference the type without actually depending on that library,
so its simpler to just include it here, similar to how it worked for
Polymer V1.
…pes.

These interface types only exist for Closure compilation compatibility
between V1 and V2/3, but there's no reason to have them in our
TypeScript types.

- PolymerDomApi -> DomApi
- PolymerDomApi.ObserveHandle -> FlattenedNodesObserver
@aomarks aomarks force-pushed the polymer-dom-externs branch from c4fa92a to b34b6fc Compare October 31, 2018 22:05
@aomarks
Copy link
Member Author

aomarks commented Oct 31, 2018

Looks like the type generator didn't like this.

We don't need these types in TypeScript, so I just updated the generator config to map those types back to their original names. PTAL.

@dfreedm dfreedm merged commit 5341dbd into master Nov 2, 2018
@dfreedm dfreedm deleted the polymer-dom-externs branch November 2, 2018 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants