TypeStrong / dts-bundle

Export TypeScript .d.ts files as an external module definition
MIT License
308 stars 57 forks source link

classic module resolution with non-relative path. #49

Open veeramarni opened 7 years ago

veeramarni commented 7 years ago

It wasn't working if the files are in the non-relative path.

//index.ts
export {default as Foo} 'src/foo';
export {default as Foo2} 'src/foo2';

//src/foo.ts
export default class Foo
{
    bar():boolean
    {
        return true;
    }
}

//src/foo2.ts
import Foo 'src/foo';

export default class Foo2 extends Foo
{
    bar():boolean
    {
        return true;
    }
}
octatone commented 7 years ago

I just ran into this behavior. I'll elaborate since the original issue isn't super clear.

I have a ts project that uses the baseUrl compiler option to set ./src as the base import path for my ts scripts. This means my scrips have absolute imports that that look like models/Foo which is found by tsc as ./src/models/Foo.

When I use dts-bundle all of my baseUrl imports are not bundled, instead they show up in the list of dependencies in the built index.d.ts file.

If change baseUrl style imports to relative imports, then the typings are bundled in the rendered index.d.ts output file as expected.

justindra commented 6 years ago

Just added a PR to solve this.

inakiarroyo commented 5 years ago

Seems like this library has been abandoned, could we have an update about the state? We are having the same problem as @octatone comment