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

Move type declaration of sealed interfaces inside namespace #208

Open
OwOchle opened this issue Mar 6, 2025 · 0 comments
Open

Move type declaration of sealed interfaces inside namespace #208

OwOchle opened this issue Mar 6, 2025 · 0 comments

Comments

@OwOchle
Copy link

OwOchle commented Mar 6, 2025

Type declaration of interface should be moved inside namespace, although it then requires user to type Namespace.Interface, it avoids errors when importing both the namespace and the type.

export type TagResult =
  | TagResult.BuildErrorTagResult
  | TagResult.SuccessRightTreeTagResult
  | TagResult.TestErrorTagResult
  | TagResult.WrongFileTreeSuccessTagResult;

export namespace TagResult {
  export enum Type {
    BuildErrorTagResult = "moulinette.tag.BuildErrorTagResult",
    TestErrorTagResult = "moulinette.tag.TestErrorTagResult",
    SuccessRightTreeTagResult = "moulinette.tag.SuccessRightTreeTagResult",
    WrongFileTreeSuccessTagResult = "moulinette.tag.WrongFileTreeSuccessTagResult",
  }
}

becomes

export namespace TagResult {
    export type TagResult =
  | TagResult.BuildErrorTagResult
  | TagResult.SuccessRightTreeTagResult
  | TagResult.TestErrorTagResult
  | TagResult.WrongFileTreeSuccessTagResult;

  export enum Type {
    BuildErrorTagResult = "moulinette.tag.BuildErrorTagResult",
    TestErrorTagResult = "moulinette.tag.TestErrorTagResult",
    SuccessRightTreeTagResult = "moulinette.tag.SuccessRightTreeTagResult",
    WrongFileTreeSuccessTagResult = "moulinette.tag.WrongFileTreeSuccessTagResult",
  }
}

So that you could here use TagResult (as TagResult.TagResult) and TagResult.Type without any problems, ambiguity or IDE miscomprehension.

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