Closed eterna2 closed 5 years ago
Not sure if things have changed since then, but according to the comments in this PR, it seems like the team would like to keep the typings on DefinitelyTyped (i.e. @types
) instead of inside this repo
@Dabolus We are revisiting that decision due to our goal of making a TypeScript template of pwa-starter-kit (which requires its deps to have types, so we would have to maintain the types anyways). I made some yet-to-be-reviewed progress in the typescript branch (source in TS), but I'll take a look at this PR as well.
@keanulee happy to hear that! Having the typings maintained on DefinitelyTyped would slow up a lot the work of TypeScript developers, as new updates on pwa-helpers
would require some days to be published on @types/pwa-helpers
Sooo some brainstorming:
Robustness Having a statically typed language helps spotting and avoiding some errors during development and compilation instead of during runtime, making the code base much more robust
Consistency Most of the other modern Polymer projects are written in TypeScript (lit-html, LitElement, the entire Polymer tools repo and PRPL server). Even Material Web Components are migrating to TypeScript. Having a TS code base would make this repo consistent with others
Overkill? TypeScript might be a bit overkill for such a simple code base. However, I don't think this could be considered a real con
Additional step The code needs a build step to be converted into JavaScript. However, this might even be considered a pro, since with a build step we would be able to do more transformations to the code if needed, such as converting the helpers into a browser-ready UMD version or into a CommonJS version. Also, if we let a prepublish hook do the work we don't even have to worry about this extra step
In conclusion, I see only pros in having the source code as TS. The only "con" is that we need to configure the build steps properly, but it shouldn't give too much hassle
I totally agree with @Dabolus on his analysis on having typescript source.
Changes
redux
as dev dependencies for their typing.pwa-helpers
modules.tests
folder with a sample typescript file for all thepwa-helpers
.