How to generate Typescript declarations inside a Meteor local package for Angular 2

Greetings!

i’m currently working on an angular 2 project and its has been successfully split into feature modules (using meteor local packages and Urigo’s angular 2 compiler (https://github.com/Urigo/angular-meteor/tree/master/packages/angular2-meteor/atmosphere-packages/angular2-compilers)), and it works as expected, the only downside that we have to create typescript file declarations to help the compiler know the existing types inside each package, without the .d.ts files the compiler complains:

client/app.module.ts (25, 45): Cannot find module 'meteor/myLocalPackage'.

This approach has a maintainability issue related to the declaration files which are manually generated, if a class change inside the package, we have to remember to also change the definition file, this is not DRY.

The typescript compiler does provide a flag to auto-generate file declarations on compile, which is exactly what we need, the thing is that we only need the definition for the packages not the whole app.

i tried the build plugin api asking a new typescript compiler like so:

Plugin.registerCompiler({
    extensions: ['ts', 'tsx']
}, function ()
{
    return new TypeScriptCompiler({
        // assuming the option flag is the same as the compiler
        declaration: true
    });
});

But this fails because we use the angular 2 compilers: (https://github.com/Urigo/angular-meteor/tree/master/packages/angular2-meteor/atmosphere-packages/angular2-compilers) trying that results in:

While determining active plugins:
   error: conflict: two packages included in myLocalPackage (barbatus:typescript and myLocalPackage) are both trying to handle *.ts
   error: conflict: two packages included in myLocalPackage (barbatus:typescript and myLocalPackage) are both trying to handle *.tsx

i also tried using the declaration: true flag inside the tsconfig.json file inside the package described by the barbatus typescript compiler (https://github.com/barbatus/typescript) readme with no success.

my last resort solution is to use a gulp task on watch to make the declaration files but this defeats the isobuild purpose.

can anyone help?