Skip to content
This repository has been archived by the owner on Jun 1, 2023. It is now read-only.

Add ability to specify entry point type #121

Open
sindresorhus opened this issue May 21, 2020 · 2 comments
Open

Add ability to specify entry point type #121

sindresorhus opened this issue May 21, 2020 · 2 comments
Labels
question Further information is requested

Comments

@sindresorhus
Copy link

In my project, I use a an enum as namespacing and nest all my types inside it.

The main page looks like this: https://sindresorhus.com/playground/ However, I would like to make https://sindresorhus.com/playground/KeyboardShortcuts/ the main page. Maybe some config where I could specify the KeyboardShortcuts enum as the entry type.

@mattt
Copy link
Contributor

mattt commented May 23, 2020

Honestly, I think this is something we should solve at the language level.

It looks like you could avoid the redundant namespace by using the @warn_unqualified_access annotation. Unfortunately, this only applies to function declarations, but I think we should extend that to top-level variables and constants, too

@mattt mattt added the question Further information is requested label May 23, 2020
@sindresorhus
Copy link
Author

Honestly, I think this is something we should solve at the language level.

I agree. Swift needs proper support for namespacing.

https://forums.swift.org/search?q=namespacing

It looks like you could avoid the redundant namespace by using the @warn_unqualified_access annotation. Unfortunately, this only applies to function declarations, but I think we should extend that to top-level variables and constants, too

That feels like a hack, and I assume the types would still be imported into the global namespace, just not usable without a warning.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants