Given these 2 typescript files
api/Token.ts
interface Token {
code: string
}
export default Token
and index.ts
export * from './api/Token'
tsc 1.5 with the --declarations
switch will generate two .d.ts
files (with similar content)
api/Token.d.ts
interface Token {
code: string;
}
export default Token;
and index.d.ts
export * from './api/Token';
Running grunt-dts-bundle with the following options
dts_bundle: {
release: {
options: {
name: 'my-module',
main: 'index.d.ts'
}
}
}
will generate an ambient module declaration file my-module.d.ts
with the following content
declare module 'my-module' {
export * from './api/Token';
}
However this declaration does not compile due to : Import or export declaration in an ambient module declaration cannot reference module through relative module name.
How can I automatically generate an ambient module declaration for the two typescript files above ?
EDIT
Please follow latest updates on https://github.com/Microsoft/TypeScript/issues/2262