Closed
Description
TypeScript Version: 2.0.0
Code
// file: animal.ts
abstract class Animal {
name: string;
constructor(name: string) {
this.name = name;
}
abstract shout(): string;
}
export class Snail extends Animal {
shout(): string {
return '...';
}
}
I'm trying to emit declarations files .d.ts with tsc --declaration
in order to get such a following file:
Expected behavior:
File animal.js well generated as well as file animal.d.ts:
// file: animal.d.ts
declare abstract class Animal {
name: string;
constructor(name: string);
abstract shout();
}
export declare class Snail extends Animal {
shout();
}
Actual behavior:
File animal.js well generated but no file animal.d.ts. I got an error instead:
error TS4020: Extends clause of exported class 'Snail' has or is using private name 'Animal'.
It is maybe a misunderstanding of mine, but in my mind, when a code compiles with tsc, it should also compile with the --declaration
flag.
For information, here is my tsconfig.json:
// file: tsconfig.json
{
"compilerOptions": {
"noImplicitAny": true,
"strictNullChecks": true,
"target": "es5",
"module": "amd",
"outDir": "./build"
},
"exclude" : [
"./build",
"./node_modules"
]
}