-
Notifications
You must be signed in to change notification settings - Fork 10
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
Importing #37
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Specifiers
Standard Library Packages
The
import bare
syntax is reserved for packages in the standard library.Community Packages
Packages outside of the standard library will always be scoped.
Local Packages
Packages can also exist within a local project, and will follow the same scoping rules as community packages.
Local Modules
Scoping rules
Bare Namespace
When importing a module with
import ./mod
the namemod
becomes a namespace containing all of the modules exportsRenamed Namespaces
You can rename namespaces using
import ./mod as other
.Destructuring Exports
Alternatively, you can pick the exports you need without putting them on a namespace.
Just like normal destructuring, you can also use
...rest
to put any remaining exports onto a namespace.Also like normal destructuring, you can also rename within destructuring.
Spread Exports
Inversely, you can spread all exports into the local scope.
Default Exports
Modules can also have "default" exports by naming an export the same thing as the file name.
The text was updated successfully, but these errors were encountered: