webcomponents / polyfills

Web Components Polyfills
BSD 3-Clause "New" or "Revised" License
1.13k stars 166 forks source link

Add TS externs. #457

Closed bicknellr closed 2 years ago

bicknellr commented 3 years ago

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.