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

Idea: Direct module references #30

Open
jasonkuhrt opened this issue Dec 5, 2023 · 0 comments
Open

Idea: Direct module references #30

jasonkuhrt opened this issue Dec 5, 2023 · 0 comments

Comments

@jasonkuhrt
Copy link

I suspect this is out of scope for this proposal but based on my experience with namespaces in TypeScript its a DX I have come to appreciate a lot.

Example of TypeScript

export namespace A {
  export const foo = 1
  console.log(B.bar)
}

export namespace B {
  export const bar = 2
  console.log(A.foo)
}

console.log(A.foo)
console.log(B.bar)

Example with Inline Module Declarations (current)

export module A {
  export const foo = 1
  import * as B from B
  console.log(B.bar)
}

export module B {
  export const bar = 2
  import * as A from A
  console.log(A.foo)
}

import * as A from A
import * as B from B

console.log(A.foo)
console.log(B.bar)

Example with Inline Module Declarations (proposed)

export module A {
  export const foo = 1
  console.log(B.bar)
}

export module B {
  export const bar = 2
  console.log(A.foo)
}

console.log(A.foo)
console.log(B.bar)
@jasonkuhrt jasonkuhrt changed the title Idea: Direct module member references Idea: Direct module references Dec 5, 2023
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

1 participant