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

Star re-export as namespace from local source files. #196

Closed
wolfram77 opened this issue Apr 17, 2022 · 1 comment
Closed

Star re-export as namespace from local source files. #196

wolfram77 opened this issue Apr 17, 2022 · 1 comment

Comments

@wolfram77
Copy link

Bug report

The program i am working on is a main interface for on top of two (raw) sub-interfaces http and websocket (they represent the nature of connection, are not the http or websocket module). Each interface has a number of functions. The main interface provides a aggregate simpler set of functions that utilize the raw http and websocket functions. I export main iterface and re-export http, websocket interfaces as below.

Input code

http.ts

export function getProfile(auth: Authorization): Promise<GetProfileResponse> { ... }
export function getFunds(auth: Authorization): Promise<GetFundsResponse> { ... }

websocket.ts

export function connectOrderUpdate(auth: Authorization, fn: OnOrderUpdateNotification): Promise<Connection> { ... }
export function subscribeOrderUpdate(conn: Connection): Promise<Response> { ... }

index.ts

export * as http      from "./http";
export * as websocket from "./websocket";

export async function getProfile(auth: Authorization): Promise<Profile> { ... }
export async function getFunds(auth: Authorization): Promise<Funds> { ... }
export function connectOrderUpdate(auth: Authorization, fn: OnOrderUpdateNotification): Promise<Connection> { ... }
export async function subscribeOrderUpdate(conn: Connection): Promise<void> { ... }

Expected output

export declare namespace http {
  export function getProfile(auth: Authorization): Promise<GetProfileResponse>;
  export function getFunds(auth: Authorization): Promise<GetFundsResponse>;
}

export declare namespace websocket {
  export function connectOrderUpdate(auth: Authorization, fn: OnOrderUpdateNotification): Promise<Connection>;
  export function subscribeOrderUpdate(conn: Connection): Promise<Response>;
}

export async function getProfile(auth: Authorization): Promise<Profile>;
export async function getFunds(auth: Authorization): Promise<Funds>;
export function connectOrderUpdate(auth: Authorization, fn: OnOrderUpdateNotification): Promise<Connection>;
export async function subscribeOrderUpdate(conn: Connection): Promise<void>;

Actual output

export async function getProfile(auth: Authorization): Promise<Profile>;
export async function getFunds(auth: Authorization): Promise<Funds>;
export function connectOrderUpdate(auth: Authorization, fn: OnOrderUpdateNotification): Promise<Connection>;
export async function subscribeOrderUpdate(conn: Connection): Promise<void>;

Additional context

I am using the following command for generating the decalrations file.

dts-bundle-generator src/index.ts --project tsconfig.json -o index.d.ts --external-imports https,ws
@wolfram77 wolfram77 changed the title Start re-export as namespace from local source files. Star re-export as namespace from local source files. Apr 17, 2022
@timocov
Copy link
Owner

timocov commented Apr 18, 2022

Duplicate of #134

@timocov timocov marked this as a duplicate of #134 Apr 18, 2022
@timocov timocov closed this as completed Apr 18, 2022
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

No branches or pull requests

2 participants