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 export state of referenced but not directly exported namespaces/modules #241

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

Incorrect export state of referenced but not directly exported namespaces/modules #241

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

Comments

@timocov
Copy link
Owner

timocov commented Mar 28, 2023

Bug report

Input code

internals.ts

export namespace InternalNamespace {
	export type NSType = string;
}

export module InternalModule {
	export type MType = number;
}

export namespace ExportedNamespace {
	export type ENSType = 1 | 2;
}

export module ExportedModule {
	export type EMType = 3 | 4;
}

input.ts

import { InternalModule, InternalNamespace, ExportedModule, ExportedNamespace } from './internals';

export type A = InternalModule.MType;
export type B = InternalNamespace.NSType;

export { ExportedModule, ExportedNamespace };

Expected output

declare namespace InternalNamespace {
	type NSType = string;
}
declare module InternalModule {
	type MType = number;
}
export declare namespace ExportedNamespace {
	type ENSType = 1 | 2;
}
export declare module ExportedModule {
	type EMType = 3 | 4;
}
export type A = InternalModule.MType;
export type B = InternalNamespace.NSType;

export {};

Actual output

export declare namespace InternalNamespace {
	type NSType = string;
}
export declare module InternalModule {
	type MType = number;
}
export declare namespace ExportedNamespace {
	type ENSType = 1 | 2;
}
export declare module ExportedModule {
	type EMType = 3 | 4;
}
export type A = InternalModule.MType;
export type B = InternalNamespace.NSType;

export {};

(note that both InternalNamespace and InternalModule are exported but shouldn't)

@timocov timocov added the Bug label Mar 28, 2023
@timocov timocov added this to the 8.0 milestone Mar 28, 2023
@timocov timocov changed the title Incorrect export state of referenced namespaces/modules Incorrect export state of referenced but not directly exported namespaces/modules Mar 28, 2023
timocov added a commit that referenced this issue Mar 28, 2023
…quotes) and fixed wrong `export` state of references namespaces/modules

Previously, for some reason name `ModuleName` was treated the same as with quotes
i.e. it was checked whether that name should be exported.

Now every used module with such name will be inlined regardless of `--inline-declare-externals` option.

Fixes #237, #241
@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