Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
typelevel-ts
Advanced tools
The stable version is tested against TypeScript 2.9.1+
Returns the string literal 'T' if A
and B
are equal types, 'F' otherwise
Equals<string, string> // "T"
Equals<string, number> // "F"
Extracts a super-type of A
identified by its keys K
Omit<{ a: string; b: number }, 'a'> // { b: number }
Overwrite<{ a: string; b: number }, { b: boolean }> // { a: string; b: boolean }
Diff<{ a: string; b: number }, 'b'> // { a: string; b?: number }
Encodes the constraint that a given object A
does not contain specific keys K
declare function f(x: RowLacks<{ a: string; b: number }, 'a'>): void
// $ExpectError
f({ a: 'foo', b: 1 })
declare function f<T extends Exact<{ a: string }, T>>(a: T): void
declare const x: { a: string }
declare const y: { a: string; b: number }
f(x)
// $ExpectError
f(y)
Picks only the keys of a certain type
KeysOfType<{a: string, b: string | boolean, c: boolean, d: string}, string> // "a" | "d"
declare function f<T extends AnyTuple>(x: T): T
declare const x: [number]
declare const y: [number, string]
declare const z: [number, string, boolean]
declare const t: Array<number>
f(x)
f(y)
f(z)
// $ExpectError
f(t)
interface Foo {
bar: {
baz: string
quux: Array<{ barbaz: number }>
}
}
type ReadonlyFoo = DeepReadonly<Foo>
declare const x: ReadonlyFoo
// $ExpectError
x.bar.quux[1].barbaz = 1
Extracts the type of a member of a tagged union
type A = { tag: 'A'; a: string }
type B = { tag: 'B'; b: number }
type C = A | B
TaggedUnionMember<C, 'tag', 'A'> // A
Extracts required or optional keys as a literal type union
type A = { a: string; b: number; x?: string; y?: number }
RequiredKeys<A> // "a" | "b"
OptionalKeys<A> // "x" | "y"
0.3.3
RequiredKeys
and OptionalKeys
types, #33 (@saitonakamura)FAQs
Type level programming in TypeScript
The npm package typelevel-ts receives a total of 6,990 weekly downloads. As such, typelevel-ts popularity was classified as popular.
We found that typelevel-ts 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
Security News
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.