
Security News
Package Maintainers Call for Improvements to GitHub’s New npm Security Plan
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
@crbroughton/ts-test-utils
Advanced tools
A collection of helper TypeScript types to test other TypeScript types. This collection so far includes:
To install ts-test-utils
with Bun, run the following command:
bun i -D @crbroughton/ts-test-utils
You can use these types to test other types:
// This should return true
type Result = Expect<Equals<{ id: number }, { id: number }>>
For testing types that are expected to not equal each-other, you can
add the //@ts-expect-error
comment to tell the TypeScript compiler
that a false
return is expected, and that a match is not expected:
// @ts-expect-error - Object / Record failing the equality checker
type ResultRecord = Expect<Equals<{ id: number }, { id: string }>>
You can combine these types with existing types. As an example, here is the 'Equals' type being used to check a functions return type:
function myFunction() {
return {
id: 1,
name: 'Craig',
}
}
type Result = Expect<Equals<ReturnType<typeof myFunction>, { id: number, name: string }>>
To install dependencies:
bun install
To run:
bun run index.ts
This project was created using bun init
in bun v1.1.3. Bun is a fast all-in-one JavaScript runtime.
FAQs
A collection of testing helper types
We found that @crbroughton/ts-test-utils 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
Maintainers back GitHub’s npm security overhaul but raise concerns about CI/CD workflows, enterprise support, and token management.
Product
Socket Firewall is a free tool that blocks malicious packages at install time, giving developers proactive protection against rising supply chain attacks.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.