
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
json-literal-typer
Advanced tools
There are some tools out there that will produce TypeScript Interfaces from a
given JSON structure for you. But they only give you the basic types (string
,
number
, etc.). What if there is an API where you want to get its literal
values/types?
# to add to your project
npm install json-literal-typer
# to use command line interface
npm install --global json-literal-typer
There is a live demo at https://json-literal-typer.peppnet.de
Let's assume there is an API for gas stations. It will respond with data like this:
{
"stations": [
{ "id": 1, "name": "station A", "status": "OPEN", "attributes": ["fast"] },
{
"id": 2,
"name": "station B",
"status": "OPEN",
"attributes": ["fast", "24/7"],
"operator": "Station Corp."
},
{
"id": 3,
"name": "station C",
"status": "CLOSED",
"attributes": [],
"operator": "ACME Inc."
}
]
}
What you would get from other tools is:
interface Station {
id: number;
name: string;
status: string;
attributes: string[];
operator?: string;
}
interface RootObject {
stations: Station[];
}
Nice. But what if you could get:
interface Stations {
attributes: ('24/7' | 'fast')[];
id: 1 | 2 | 3;
name: 'station A' | 'station B' | 'station C';
operator?: 'ACME Inc.' | 'Station Corp.';
status: 'CLOSED' | 'OPEN';
}
interface Root {
stations: Stations[];
}
npm show json-literal-typer versions --json | json-literal-typer
FAQs
generates literal typescript iterfaces from JSON
The npm package json-literal-typer receives a total of 41 weekly downloads. As such, json-literal-typer popularity was classified as not popular.
We found that json-literal-typer 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
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.