
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
TypeScript static helpers for types accuracy and testing
yarn add --dev typebolt
Minimal TypeScript Version: 4.9
Not<T>
: Logical NotAnd<A, B>
: Logical AndOr<A, B>
: Logical OrXor<A, B>
: Logical Exclusive OrNor<A, B>
: Logical Not OrNand<A, B>
: Logical Not AndXnor<A, B>
: Logical Exclusive Not OrNot<true> // false
Not<false> // true
And<true, true> // true
And<true, false> // false
And<true, false> // false
Or<true, false> // true
Or<true, true> // true
// ...
Not<Or<true, false>> // false – Equivalent to Nor
Not<And<true, false>> // true – Equivalent to Nand
IsType<T, S>
: S is a Subtype of T (a.k.a. extends
)IsUnion<T>
: T an UnionIsAny<T>
: T is anyIsExactType<T1, T2>
: T1 and T2 are exact same.Assert a Type is true
or false
.
import { value Assert } from "typebolt";
Assert<true>();
Assert<false>(); // ERROR
Assert<boolean>(); // ERROR
Assert.True<true>();
Assert.True<false>(); // ERROR
Assert.True<boolean>(); // ERROR
Assert.False<false>();
Assert.False<true>(); // ERROR
Assert.False<boolean>(); // ERROR
Check S is subtype of T. (a.k.a. extends
)
Assert<IsType<number, 42>>();
Assert<IsType<number, number>>();
Assert<IsType<42, number>>(); // ERROR
Check T1 and T2 are exact same types.
Assert<IsExactType<42, 42>>();
Assert<IsExactType<any, 42>>(); // ERROR
Assert<IsExactType<number, 42>>(); // ERROR
// With unions
Assert<IsExactType<string | number, string | number>>();
Assert<IsExactType<string | number, string>>(); // ERROR
Assert<IsExactType<string, string | number>>(); // ERROR
// With any
Assert<IsExactType<any, any>>();
Assert<IsExactType<any, number>>(); // ERROR
Head<T>
: First element of TTail<T>
: All elements after head of TPrepend<X, T>
: Add element X in front of TAppend<X, T>
: Add element X at end of TReverse<T>
: Reverse TTake<N, T>
: Take N first elements of TTakeLast<N, T>
: Take N last elements of TDrop<N, T>
: Remove N first elements of TDropLast<N, T>
: Remove N last elements of THead<["Hello", "World"]> // "Hello"
Tail<["Hello", "World"]> // ["World"]
Prepend<1, [2, 3, 4]> // [1, 2, 3, 4]
Append<4, [1, 2, 3]> // [1, 2, 3, 4]
Reverse<[1, 2, 3, 4]> // [4, 3, 2, 1]
Take<2, [1, 2, 3, 4]> // [1, 2]
TakeLast<2, [1, 2, 3, 4]> // [3, 4]
Drop<2, [1, 2, 3, 4]> // [3, 4]
DropLast<2, [1, 2, 3, 4]> // [1, 2]
boolean
is always considered union of true | false
.
Union of a Type T
and a SubType S
will resolve to non-union T
.
e.g.
string | "Hello"
resolves tostring
Union with any
will always resolve to any
.
FAQs
TypeScript static helpers
We found that typebolt 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
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.