tshm icon indicating copy to clipboard operation
tshm copied to clipboard

Namespaces

Open samhh opened this issue 4 years ago • 3 comments

export declare namespace A {
    type X = number;
    export type Y = X;
}

export declare type B = A.Y;

Should output (assuming no -a):

namespace A :: {
  Y :: number
}

B :: A.Y

samhh avatar Jan 20 '21 12:01 samhh

This should also encompass supporting the following (not limited to "namespaces" per se):

type A = B.C<D>
type A = B.C D

samhh avatar Jul 21 '21 12:07 samhh

^ Comes up with asterisk imports in docs-ts for example:

export declare const readFile: (path: string, encoding: string) => TE.TaskEither<Error, string>

samhh avatar Jul 21 '21 12:07 samhh

N.B. Nested namespaces are supported but seem to have a different generated structure in TS playground:

export namespace A {
  export type X = number

  export namespace B {
    export type Y = string
  }
}

// becomes:

export declare namespace A {
    type X = number;
    namespace B {
        type Y = string;
    }
}

samhh avatar Jul 26 '21 21:07 samhh