Skip to content

Inlined imports do not contain import statement from dependencies #199

@nsamsonov

Description

@nsamsonov

Bug report
I have my file and two libraries (libA and libB). libA imports some stuff from libB. I want libA to be inlined, while keeping import statements from libB.

Input code

myFile.ts

import { InlinedType } from "libA";

export interface MyType {
    prop: InlinedType;
}

node_modules/libA/index.d.ts

import { ImportedType } from 'libB';

export interface InlinedType {
    prop: ImportedType;
}

node_modules/libB/index.d.ts

export interface ImportedType {
    prop: number;
}

Expected output

import { ImportedType } from 'libB';

export interface InlinedType {
    prop: ImportedType;
}

export interface MyType {
    prop: InlinedType;
}

Actual output

export interface InlinedType {
    prop: ImportedType;
}

export interface MyType {
    prop: InlinedType;
}

Additional context
The import is generated using dts-bundle-generator --external-inlines=libA myFile.ts
Since the import statement is missing, the generated code is invalid. Adding --external-inlines=libB correctly inlines libB, but this is undesired behavior. Adding --external-imports=libB has no effect.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions