Generated definition file (.d.ts) by typescript not working with package.json typings
<p>I have created a definition file (d.ts) from my typescript project using the --declaration argument from the tsc compiler.</p>

<p>But this generated definition file apparently not work when i try to publish the package with the property <strong>typings</strong> at the npm <strong>package.json</strong>. I have created another project to test it.</p>

<p>It complains with the message: "<strong>Exported external package file typings file '...d.ts' is not a module. Please contact the package author to update the package definition</strong>".</p>

<p>This are my source files:</p>

<p><strong>MyInterface.ts</strong></p>

<pre><code>export interface MyInterface
{
    MyProperty: string;
}
</code></pre>

<p><strong>MyClass.ts</strong></p>

<pre><code>import {MyInterface} from './MyInterface';

export class MyClass implements MyInterface
{
    get MyProperty(): string
    {
        return "MyString";
    }
}
</code></pre>

<p><strong>MyInheritedClass.ts</strong></p>

<pre><code>import {MyClass} from './MyClass';

export class MyInheritedClass extends MyClass
{
    public MyMethod(): number
    {
        return 1;
    }
}
</code></pre>

<p><strong>The tsc command is this:</strong> </p>

<pre><code>tsc MyClass.ts MyInterface.ts MyInheritedClass.ts --declaration -t es5 -outFile "mydefinition.js" --module "system"
</code></pre>

<p>This is the generated definition:</p>

<p><strong>mydefinition.d.ts</strong></p>

<pre><code>declare module "MyInterface" {
    export interface MyInterface {
        MyProperty: string;
    }
}
declare module "MyClass" {
    import { MyInterface } from "MyInterface";
    export class MyClass implements MyInterface {
        MyProperty: string;
    }
}
declare module "MyInheritedClass" {
    import { MyClass } from "MyClass";
    export class MyInheritedClass extends MyClass {
        MyMethod(): number;
    }
}
</code></pre>

<p>Is there another thing i have to do or the generated definition supposedly not work in the package.json typings ??</p>

<p><strong>Update for more details:</strong></p>

<p>The scenario is that i have 2 projects:</p>

<ul>
<li><p>The First project is where i generate the library where i will publish to npm, and the package.json is where i put the typings property linking to the mydefinition.d.ts file generated by the tsc -d command. </p></li>
<li><p>The Second project i create to test the first one by adding the package (with typings) generated. </p></li>
</ul>

<p>A link with the 2 projects and another links for the scenario :</p>

<p><a href="https://github.com/jvitor83/typings-packagejson" rel="nofollow">https://github.com/jvitor83/typings-packagejson</a></p>

<p>I think the problem is with the "Your definition files should be written as external modules" at the first link.
But i want to know if there is a way to get those definitions generated to put at the typings property of the package.json.</p>

<p><strong>To reproduce the problem:</strong></p>

<ul>
<li><p>Clone this repo: <a href="https://github.com/jvitor83/test-typings-packagejson" rel="nofollow">https://github.com/jvitor83/test-typings-packagejson</a></p></li>
<li><p>Do 'npm install', open with VSCode and go to the file 'src/test.ts'.</p></li>
</ul>