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

Some types are removed if they used in ambient context #243

Closed
timocov opened this issue Mar 28, 2023 · 1 comment · Fixed by #244
Closed

Some types are removed if they used in ambient context #243

timocov opened this issue Mar 28, 2023 · 1 comment · Fixed by #244
Assignees
Labels
Milestone

Comments

@timocov
Copy link
Owner

timocov commented Mar 28, 2023

Bug report

Input code

type.d.ts

export interface Type1 {}
export interface Type2 {}

export declare interface ExportedType {
	Type1: { prototype: Type1 };
	Type2: { prototype: Type2 };
}

index.d.ts

import { ExportedType, Type1, Type2 } from './type';

interface _Type1 extends Type1 {}
interface _Type2 extends Type2 {}

declare module ExportedType {
  interface Type1 extends _Type1 {}
  interface Type2 extends _Type2 {}
}

export { ExportedType };

Expected output

export interface Type1 {
}
export interface Type2 {
}
export declare interface ExportedType {
	Type1: {
		prototype: Type1;
	};
	Type2: {
		prototype: Type2;
	};
}
export interface _Type1 extends Type1 {}
export interface _Type2 extends Type2 {}
export declare module ExportedType {
	interface Type1 extends _Type1 {
	}
	interface Type2 extends _Type2 {
	}
}

export {};

Actual output

export interface Type1 {
}
export interface Type2 {
}
export declare interface ExportedType {
	Type1: {
		prototype: Type1;
	};
	Type2: {
		prototype: Type2;
	};
}
export declare module ExportedType {
	interface Type1 extends _Type1 {
	}
	interface Type2 extends _Type2 {
	}
}

export {};

Additional context

The issue came from Dexie.js (I think that is one of the reasons why they will not be able to upgrade to the latest version). The issue was introduced in v6.5.0 (see 56b22bc).

@timocov timocov added the Bug label Mar 28, 2023
@timocov timocov added this to the 8.0 milestone Mar 28, 2023
timocov added a commit that referenced this issue Mar 28, 2023
As these nodes are modules and named nodes at the same time

Broken in 56b22bc

Fixes #243
@timocov timocov self-assigned this Mar 30, 2023
@timocov
Copy link
Owner Author

timocov commented Mar 30, 2023

Released in v8.0.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant