PolymerElements / platinum-sw

Service Worker Polymer element
67 stars 16 forks source link

Add TypeScript declarations to platinum-sw. #120

Closed aomarks closed 6 years ago

aomarks commented 6 years ago

This PR adds TypeScript declarations generated by https://github.com/Polymer/gen-typescript-declarations/

These declarations can be re-generated by running npm run update-types.

Tracker: https://github.com/Polymer/gen-typescript-declarations/issues/79

aomarks commented 6 years ago

@aomarks is there some way to prevent the generation of useless files such as the ones in this PR

Yep, we could add a gen-tsd.json to this repo and set the exclude flag: https://github.com/Polymer/gen-typescript-declarations/#config-options

I assume you mean all the .js files? Yeah I guess we probably shouldn't include those. I also wonder if we should be excluding .js files in general for this hybrid pass of type generation. Obviously for the 3.0 elements we'll only be looking at .js files.

e111077 commented 6 years ago

I think if the pass doesn't produce anything then it should probably just skip. But if it finds something in a JS file, I say that's a-okay to keep.

aomarks commented 6 years ago

I think if the pass doesn't produce anything then it should probably just skip. But if it finds something in a JS file, I say that's a-okay to keep.

In general we want to emit empty declarations for anything you might HTML import, even if they are empty, because that really simplifies the process of generating declaration references that mirror the HTML import tree (we can say that for every HTML import, generate a type declaration import for <that file>.d.ts). I think for this repo I'll just add the excludes for now.

aomarks commented 6 years ago

I think for this repo I'll just add the excludes for now.

Done. PTAL!