Imports
Development standards for this project
Import Shortcuts
In this project, you will find the Node.js feature called import alias.
You can import anything using alias in package.json
.
With this, you can export everything from an index
file of these alias and easily import it anywhere in your code. See the example below:
Let's export this simple function from the functions folder:
Export it in theindex
file of the functions folder, as defined in the package.json and tsconfig.json files.
Note that since this project uses the module
type, we need to add the .js
extension at the end.
With this, we can easily import this function in any file, regardless of its depth in our code.
Without this, it would be necessary to use a relative path. See how it would look:
In summary, import shortcuts make it easier to import anything and make the code more readable and organized.