Security News
Fluent Assertions Faces Backlash After Abandoning Open Source Licensing
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
@types/module-alias
Advanced tools
TypeScript definitions for module-alias
@types/module-alias is a TypeScript type definition package for the module-alias library, which allows you to create custom module paths and aliases in Node.js applications. This can help simplify and organize your import statements, making your codebase cleaner and more maintainable.
Registering Aliases
This feature allows you to register custom aliases for your modules. In this example, '@root' is aliased to the root directory and '@models' is aliased to the models directory.
const moduleAlias = require('module-alias');
moduleAlias.addAlias('@root', __dirname);
moduleAlias.addAlias('@models', __dirname + '/models');
Using Aliases in Imports
Once aliases are registered, you can use them in your import statements. This makes your import paths shorter and more readable.
const myModel = require('@models/myModel');
Configuration via package.json
You can also configure your aliases directly in your package.json file. This provides a centralized place for managing your module aliases.
{
"_moduleAliases": {
"@root": ".",
"@models": "models"
}
}
tsconfig-paths is a package that helps load modules whose location is specified in the paths section of tsconfig.json. It is specifically designed for TypeScript projects and provides similar functionality to module-alias by allowing you to define custom module paths.
babel-plugin-module-resolver is a Babel plugin that allows you to add custom module resolution paths, similar to module-alias. It is more commonly used in projects that use Babel for transpilation and offers more flexibility with Babel's ecosystem.
npm install --save @types/module-alias
This package contains type definitions for module-alias (https://github.com/ilearnio/module-alias/).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/module-alias.
These definitions were written by Kevin Ramharak.
FAQs
TypeScript definitions for module-alias
The npm package @types/module-alias receives a total of 121,964 weekly downloads. As such, @types/module-alias popularity was classified as popular.
We found that @types/module-alias demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.
Research
Security News
Socket researchers uncover the risks of a malicious Python package targeting Discord developers.
Security News
The UK is proposing a bold ban on ransomware payments by public entities to disrupt cybercrime, protect critical services, and lead global cybersecurity efforts.