
Research
2025 Report: Destructive Malware in Open Source Packages
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.
ts-http-assert
Advanced tools
TypeScript version of http-assert with Assertion Functions.
There are multiple attempts to give the http-assert assertion functions supports:
All of these attemps are failed because @types/koa refers @types/http-assert as methods, and due to https://github.com/microsoft/TypeScript/issues/36931 methods cannot simply have assertion functions.
This package is a drop-in replacement of the http-assert package with:
npm install ts-http-assert
or
yarn add ts-http-assert
Just replace all
import assert from 'http-assert'
with
import assert from 'ts-http-assert`
to give the assert function and its child functions better typings.
All parameter combinations in createHttpError, includes:
assert(value, status, message, properties)assert(value, status, message)assert(value, status, properties)assert(value, status)assert(value, message, properties)assert(value, message)assert(value, properties)assert(value)assert and assert.ok have assertion signatures to assert the condition is true,
for example:
import { IncomingMessage, ServerResponse } from 'http'
import assert from 'ts-http-assert'
function controller(req: IncomingMessage, res: ServerResponse): void {
const authorization = req.headers['authorization']
// authorization might be string | string[] | undefined
assert(typeof authorization === 'string', 401)
// or `assert.ok(typeof authorization === 'string', 401)`
// It's OK to call the following `authorization.split` because authorization
// is asserted to be string in the above line.
const [method, credentials] = authorization.split(' ', 2)
res.end(`You are in ${method} authorization.`)
}
assert.strictEqual has assertion signature to assert to 2 values are of the same type,
for example:
import { IncomingMessage, ServerResponse } from 'http'
import assert from 'ts-http-assert'
function controller(req: IncomingMessage, res: ServerResponse): void {
const contentType = req.headers['content-type']
assert.strictEqual(contentType, 'application/json')
// Now the contentType is asserted to be of type string
res.end(`You submitted in type ${contentType.splice('/')[1]}`)
}
MIT
FAQs
TypeScript version of http-assert with Assertion Functions.
We found that ts-http-assert 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
Destructive malware is rising across open source registries, using delays and kill switches to wipe code, break builds, and disrupt CI/CD.

Security News
Socket CTO Ahmad Nassri shares practical AI coding techniques, tools, and team workflows, plus what still feels noisy and why shipping remains human-led.

Research
/Security News
A five-month operation turned 27 npm packages into durable hosting for browser-run lures that mimic document-sharing portals and Microsoft sign-in, targeting 25 organizations across manufacturing, industrial automation, plastics, and healthcare for credential theft.