Open oliverjanik opened 6 years ago
@oliverjanik can you point me to an example of the way you'd prefer this to be done?
Just like any other js lib here:
https://www.npmjs.com/search?q=%40types
Lot's of cordova plugins already do this:
That doesn't mean they have their type definitions on a separated scope per se, or on a separated npm package. The one doing the magic on all of those scenarios afaik is DefinitelyTyped and tsc
inner workings, which know that each folder on the DT repo can be considered an npm package published under the @types
namespace.
However, the type definitions were migrated/duplicated from DT to here specificaly because the norm was transitioning from DT to each repo being responsible for their own type definitions
. If that was reverted and now the norm is back again to it all being centralized on DT
, then we just need to sync both worlds and remove it from our repo. I don't quite agree with that view, if it's indeed the new and nice way to handle type definitions, but I can agree with it if we get a concrete answer.
Maybe, we're (I'm) just newbs on this department and haven't been able to publish our own typings from this repo into a unique @types
npm packaged without having to separate it too much. If that's the case, which I'm willing to bet to be the case, then I'd love some guidance on how to do it, for I'm far from an expert on npm
publishing.
It appears you're on a right track I think all that needs to be done is a PR to https://github.com/DefinitelyTyped/DefinitelyTyped
Their readme explains the process. Basically their master branch gets published to @types scope in NPM.
Yeah this makes no sense at all, it's the only library that insists on you pulling down 700 kb of data just to get at a little type definition file.
Here's my situation:
My project references types in this plugin, so when I only build for the web and I don't do
cordova prepare
I get compilation errors (missing types)I don't need this plugin for the web and My CI pipeline should not concern itself with any cordova steps when building for the web.
Can we have a separate package with types, that I can include in my main package.json (as opposed to cordova package.json) ?
In my experience makeing a separate scoped NPM package is an established practice and this plugin's approach is an outlier.