Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect handling of duplicates in augmented types #335

Open
mnaoumov opened this issue Oct 18, 2024 · 1 comment · May be fixed by #336
Open

Incorrect handling of duplicates in augmented types #335

mnaoumov opened this issue Oct 18, 2024 · 1 comment · May be fixed by #336

Comments

@mnaoumov
Copy link

Bug report

obsidian library has type Plugin

HTML DOM API also has deprecated type Plugin

It seems dts-bundle-generator trying to avoid confusion between those two Plugin types replaces the one we use with Plugin$1, but this makes the augmentation incorrect, because there aliases are not supported

Input code

import { Plugin } from 'obsidian';

export interface Plugin2 extends Plugin {}

declare module 'obsidian' {
    interface Plugin {
        someProperty: string;
    }
}

Expected output

// Generated by dts-bundle-generator v9.5.1

import { Plugin } from 'obsidian';

export interface Plugin2 extends Plugin {
}
declare module "obsidian" {
	interface Plugin {
		someProperty: string;
	}
}

export {};

Actual output

// Generated by dts-bundle-generator v9.5.1

import { Plugin as Plugin$1 } from 'obsidian';

export interface Plugin2 extends Plugin$1 {
}
declare module "obsidian" {
	interface Plugin$1 {
		someProperty: string;
	}
}

export {};

Additional context
Add any other context about the problem here (CLI options, etc)

@mnaoumov
Copy link
Author

Even more, if you have a manual alias

import { Plugin as SomeAlias } from 'obsidian';

export interface Plugin2 extends SomeAlias {}

declare module 'obsidian' {
    interface Plugin {
        someProperty: string;
    }
}

it incorrectly renames the augmented interface

// Generated by dts-bundle-generator v9.5.1

import { Plugin as SomeAlias } from 'obsidian';

export interface Plugin2 extends SomeAlias {
}
declare module "obsidian" {
	interface SomeAlias {
		someProperty: string;
	}
}

export {};

@mnaoumov mnaoumov linked a pull request Oct 19, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant