Security News
How Threat Actors are Abusing GitHub’s File Upload Feature to Host Malware
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
@types/resolve
Advanced tools
Package description
The @types/resolve package provides TypeScript type definitions for the 'resolve' package. This allows TypeScript developers to use the 'resolve' package, which is a utility for resolving file paths within projects, with type safety. It helps in ensuring that the usage of 'resolve' adheres to the expected types of its API, making the development process more robust and error-free.
Resolving a module path
This feature allows you to synchronously resolve the path of a module relative to a base directory. It is useful for finding the location of a module within a project.
import * as resolve from 'resolve';
resolve.sync('module_name', { basedir: process.cwd() });
Asynchronous module path resolution
This demonstrates how to asynchronously resolve the path of a module. It provides a callback-based approach to handle the result or error, making it suitable for non-blocking operations.
import * as resolve from 'resolve';
resolve('module_name', { basedir: process.cwd() }, (err, res) => {
if (err) console.error(err);
else console.log(res);
});
The 'resolve' package itself is what @types/resolve provides types for. It is a utility for resolving file paths, especially useful in complex projects where modules can be nested in various directories.
While not a direct alternative, @types/node provides TypeScript definitions for Node.js core modules, including path resolution functionalities. It's broader in scope compared to @types/resolve but includes types for resolving modules using Node.js built-in methods.
Readme
npm install --save @types/resolve
This package contains type definitions for resolve (https://github.com/browserify/resolve).
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/resolve.
These definitions were written by Mario Nebl, Klaus Meinhardt, and Jordan Harband.
FAQs
TypeScript definitions for resolve
The npm package @types/resolve receives a total of 7,387,189 weekly downloads. As such, @types/resolve popularity was classified as popular.
We found that @types/resolve demonstrated a healthy version release cadence and project activity because the last version was released less than 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
GitHub is susceptible to a CDN flaw that allows attackers to host malware on any public repository.
Security News
At Node Congress, Socket CEO Feross Aboukhadijeh uncovers the darker aspects of open source, where applications that rely heavily on third-party dependencies can be exploited in supply chain attacks.
Research
Security News
The Socket Research team found this npm package includes code for collecting sensitive developer information, including your operating system username, Git username, and Git email.