Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
user-agent-data-types
Advanced tools
Type definition for navigator.userAgentData
$ npm i -D user-agent-data-types
Add a TypesScript triple-slash directive as follows in any code-containing '.ts' file you want these types to be available in:
// Add data types to window.navigator for use in this file. See https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types- for more info.
/// <reference types="user-agent-data-types" />
console.log(window.navigator.userAgentData) // no type error!
Create a .d.ts
file anywhere in your project so that it is visible to TypeScript according to your tsconfig.json
settings. For
example, it could be at src/global.d.ts
or src/user-agent-data-types.d.ts
.
Add a TypesScript triple-slash directive as follows:
// Add data types to window.navigator ambiently for implicit use in the entire project. See https://www.typescriptlang.org/docs/handbook/triple-slash-directives.html#-reference-types- for more info.
/// <reference types="user-agent-data-types" />
This exposes the types ambiently so they are available without any import
or require
statements. TypeScript will simply know about them everywhere.
Important: do not add any import
or export
statements to this file, or it will stop working ambiently. Doing that
changes it in TypeScript's view from a "script" to a "module", and the rules about ambient types change in that case.
This project is licensed under the MIT License.
FAQs
Type definition for navigator.userAgentData
The npm package user-agent-data-types receives a total of 59,261 weekly downloads. As such, user-agent-data-types popularity was classified as popular.
We found that user-agent-data-types 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.