
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.
just-types
Advanced tools
A collection of handy Typescript types.
Install using npm
npm install -D just-types
Or using yarn
yarn add --dev just-types
just-types
allows you to test your own types using Is
, Equal
and other testing utils. These utils are used internally to test just-types
types. For Example, here is the source file of the Split
type:
import {Equal, Is} from '../test'
export type Split<
Text extends string,
Separator extends string
> = Text extends `${infer First}${Separator}${infer Rest}` ? [First, ...Split<Rest, Separator>] : [Text]
type Tests = [
Is<Equal<Split<'foo', '-'>, ['foo']>>,
Is<Equal<Split<'foo-bar-baz', '-'>, ['foo', 'bar', 'baz']>>,
Is<Equal<Split<'foo--', '-'>, ['foo', '', '']>>
]
As you see, we define the type, then we declare a Tests
type (can be named anything) and assign a list of assertions types to it. These types are evaluated in realtime by Typescript, so we have instant feedback if something is wrong.
import {Is, Equal, Not, Extends, StartsWith} from 'just-types/test'
Is<Equal<A, B>> // asserts that types `A` and `B` are the same.
Is<Not<Equal<A, B>>> // asserts that types `A` and `B` are different.
Is<StartsWith<A, B>> // where `A` and `B` extend `string`: asserts that all elements of `A` start with with an element of `B`.
Is<Extends<A, B>> // asserts that type `A` extends type `B`
You can contribute to this library in many ways, including:
Reporting bugs: Simply open an issue and describe the bug. Please include a code snippet to reproduce the bug, it really helps to solve the problem quickly.
Suggesting new types: If you have a common use case that you think worth having its own custom type, open an issue and we will discuss it. Do you already have an implementation for it? great, make a pull request and I will review it.
Those are just examples, any issue or pull request is welcome :)
2.0.0-alpha.2 (April 13th 2023)
common
module: Normalize
object
module: PartialKeys
, PartialValues
, RequiredKeys
and RequiredValues
2.0.0-alpha.1 (April 11th 2023)
tuple
, string
, object
, ...tsc
instead.FilterOut => tuple.Exclude
, FilterProps => object.ExtractValues
, FilterPropsOut => object.ExcludeValues
, ...1.6.0 (Sptember 24th 2022)
FilterOut
, FilterProps
, FilterOutProps
and Merge
.Extends
.Tail
to support string
types.Filter
to correctly handle union types.1.5.0 (September 2nd 2022)
Is
, Not
, Equal
, StartsWith
1.4.2 (March 21th 2022)
repository
and homepage
to package.json
(forgot to add them on 1.4.1
:P).1.4.1 (March 21th 2022)
1.4.0 (January 29th 2022)
1.3.1 (January 9th 2022)
1.3.0 (January 9th 2022)
1.2.0 (January 2nd 2022)
1.1.0 (December 01, 2021)
1.0.0 (November 22, 2021)
The first release containing the 7 types:
FAQs
A collection of handy Typescript types.
We found that just-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
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.