-
Notifications
You must be signed in to change notification settings - Fork 67
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
[Plugins] Typings #39
Comments
(Ping @timbru31, who did a PR on the inappbrowser typings and is now considered a Typings expert by me) |
IMHO:
If you plan to develop with TypeScript and don't use
The "de facto" standard for typings removed the cordova ones, because some cordova-plugins provide them directly. (see DefinitelyTyped/DefinitelyTyped#22305) The main goal should be: consistency. Either remove all typings from the cordova-plugins (repo) and maintain them via DefinitelyTyped (and the npm Both approaches are fine. Sometimes the plugin/project authors don't want or use TypeScript and don't provide the typings - in this case the community can add them via DefinitelyTyped. |
Hm, we (could that include you?) could certainly take care of the typings for Cordova Core Plugins that are hosted here in the Apache repository. It makes more sense to keep them close to the actual code, as it help keeping them up to date (and e.g. can be enforced on Pull Requests). What are the processes to generate them? Any automation? What about other plugins - would our decision somehow have consequences for them? There are lots more third party Cordova plugins than Core plugins. |
Of course it's easier to enforce proper reviews or updates to existing typings when the typings are maintained here. DefinitelyTyped relies on volunteers (called maintainers) for each typing project, too. Only in case they do not review the PR for "their" package the DefinitelyTyped maintainers will do an express review (and if the CI passes merge the PR).
There are some tools (see e.g. https://stackoverflow.com/a/12695001/1902598), but some manual work is required. If you develop in TypeScript and transpile to JavaScript you get the typings for free from TypeScript. (And personally I favor the manual work or just write TypeScript over JavaScript)
No. Each plugin, which is a standalone npm package, needs to provide the typings themself or rely on e.g. DefinitelyTyped. |
Ok, from a first look at https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types it seems Which means, the others already have to be included in all our repos, or they just don't exist. Best way forward would be to confirm with the PMC that typings should stay in the Apache Cordova repos and will be considered for and included in future updates. Correct? We will probably want to create a super simple TypeScript test project that uses all the Apache Cordova packages where one can test the definitions I guess? Is there a way to CI them? |
Seems so, yes. I haven't spotted any core plugins that I'm aware of with a quick look.
Correct. Some might habe been migrated, some others deleted by the PR mentioned in my first comment. Correct about the PCM part I guess - I'm not that involved in Apache's project steering and management (yet).
Would be a good idea. The DefinitelyTyped project uses a simple "it does compile" TravisCI job. This could be adapted. |
Do you maybe want to check a handful of the active core plugins for up to date typings - I am pretty sure we can work on the "not involved in Apache" thing then ;) (No time pressure or anything, just if you have the time and motivation) |
That sounds like a plan! |
Making myself some nice list of active core plugins:
|
* deletes removed features * adds version number * format code This is part of apache/cordova#39
* deletes removed features * adds version number * format code This is part of apache/cordova#39 <!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> ### Platforms affected n/a - development with TypeScript ### What does this PR do? updates typings as discussed in apache/cordova#39 ### What testing has been done on this change? ### Checklist - [ ] [Reported an issue](http://cordova.apache.org/contribute/issues.html) in the JIRA database - [ ] Commit message follows the format: "CB-3232: (android) Fix bug with resolving file paths", where CB-xxxx is the JIRA ID & "android" is the platform affected. - [ ] Added automated test coverage as appropriate for this change.
This is part of [apache/cordova#39](apache/cordova#39)
This is part of [apache/cordova#39](apache/cordova#39)
This is part of [apache/cordova#39](apache/cordova#39
This is part of [apache/cordova#39](apache/cordova#39) <!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> ### Platforms affected n/a - development with TypeScript ### Motivation and Context updates typings as discussed in [apache/cordova#39](apache/cordova#39) ### Description Updates types to correctly use TSDoc format ### Testing Manual testing via development in VSCode. ### Checklist - [ ] I've run the tests to see all new and existing tests pass - [ ] I added automated test coverage as appropriate for this change - [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`) - [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) - [ ] I've updated the documentation if necessary
this is part of apache/cordova#39
this is part of apache/cordova#39 <!-- Please make sure the checklist boxes are all checked before submitting the PR. The checklist is intended as a quick reference, for complete details please see our Contributor Guidelines: http://cordova.apache.org/contribute/contribute_guidelines.html Thanks! --> ### Platforms affected n/a - development with TypeScript ### Motivation and Context <!-- Why is this change required? What problem does it solve? --> <!-- If it fixes an open issue, please link to the issue here. --> updates typings as discussed in apache/cordova#39 ### Description Updates type definition header, simplifies event types and correctly format the TSDoc. ### Testing Manual testing via development in VSCode. ### Checklist - [ ] I've run the tests to see all new and existing tests pass - [ ] I added automated test coverage as appropriate for this change - [ ] Commit is prefixed with `(platform)` if this change only applies to one platform (e.g. `(android)`) - [ ] If this Pull Request resolves an issue, I linked to the issue in the text above (and used the correct [keyword to close issues using keywords](https://help.github.com/articles/closing-issues-using-keywords/)) - [ ] I've updated the documentation if necessary
This is part of [apache/cordova#39](apache/cordova#39)
As far as I am aware, all core plugins where it makes sense now have typings. Agree @timbru31? |
While they might have typings they still need to be cleaned/updated/checked. See my list above. (I'm still not finished) |
Okay awesome, we'll keep this open then. |
We should have them, and make sure we keep them up to date. Another good discussion would be if we should change them to use export as proposed on apache/cordova-plugin-file#285 so people can use them like |
When developing an cordova plugin with typescript does the source typescript gets shipped with the plugin? Or does one needs to have two repos one for the typescript other for the dist? (I mean regarding the |
You can do it as you wish, but ideally you should ship the definitions with your plugin so the user don’t have to install two packages. |
That means I need to have two repos don't I? One with the generated code that can be used to install the plugin and another for development. It seems overkill :/ |
No, you use the .npmignore file to not publish the typescript source code to npm. |
Ahh I see, so if the user uses npm all is ok. And if he uses git then it is not important. Thank you @jcesarmobile ! |
Typings for TypeScript: Some plugins have them, some don't, some are kept updated, some are not. Are those still needed? What is the simplest way to keep them up to date? Do we want to support them or not?
The text was updated successfully, but these errors were encountered: