Search code examples
typescriptts-loadertype-declaration

Adding my type declaration throws an error "Typescript emitted no output for my.d.ts"


Compiling TypeScript with my own type declaration file (let's say my.d.ts) gives me an error saying "Typescript emitted no output for my.d.ts". Of course, I don't expect any code generated from this type declaration file.

my.d.ts has only interface definition like this.

interface JQueryStatic {
    request(handler: string, options: any): any;
}

Solution

  • There might be many other cases, but the problem in my case was that the location of my .d.ts file.

    I put my .d.ts file in the same directory as other .ts files, and my configuration included the .d.ts file as compile target.

    Moving .d.ts file to outside of the directory of compile target fixed this problem.