Skip to content

Add TS externs. #457

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

Merged
merged 32 commits into from
Jul 28, 2021
Merged

Add TS externs. #457

merged 32 commits into from
Jul 28, 2021

Conversation

bicknellr
Copy link
Collaborator

@bicknellr bicknellr commented Jun 30, 2021

This PR adds externs for released packages in TypeScript's .d.ts format.

The original JSCompiler types from which these were converted conflate types that are used only within the package to describe internal objects or expand known built-in types for use by the package itself with types that are intended for the user of the package. The new types only expose the package's interface in the externs file and keep those intended for internal use in an env.d.ts file in each package's source folder.

The TS externs are included in the published packages next to their JSCompiler counterparts, but are not set as the types field because they aren't relevant to some of the packages' main module (i.e. Shady CSS).

This PR also generates a new webcomponents-bundle.d.ts file next to webcomponents-bundle.js, which bundles all of the individual polyfills' externs.

@bicknellr bicknellr marked this pull request as ready for review July 28, 2021 19:31
@bicknellr bicknellr requested a review from aomarks as a code owner July 28, 2021 19:31
Copy link
Contributor

@rictic rictic left a comment

Choose a reason for hiding this comment

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

Just some documentation / clarity comments. Please do address, but otherwise LGTM

@@ -0,0 +1,23 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

here and elsewhere: I don't think this file should be marked as @externs. In the internal bazel rules, a ts_declaration() automatically produces externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Removed.

@@ -0,0 +1,84 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, re @externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,57 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

@externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,71 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

@externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,31 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

@externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,37 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

@externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,60 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

@externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@@ -0,0 +1,20 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

@externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

* rights grant found at http://polymer.github.io/PATENTS.txt
*/

// This file needs to be a module for the declarations to apply globally.
Copy link
Contributor

Choose a reason for hiding this comment

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

here and elsewhere: kinda the opposite is the case. declarations in non-modules are global by default

but for consistency and our own sanity, we prefer all files to be modules

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, this comment doesn't make sense; updated.

@@ -0,0 +1,19 @@
/**
* @externs
Copy link
Contributor

Choose a reason for hiding this comment

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

@externs

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

removed

@bicknellr bicknellr merged commit dfe10a5 into master Jul 28, 2021
@bicknellr bicknellr deleted the ts-externs branch July 28, 2021 21:10
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