Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

typelevel-ts

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

typelevel-ts - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

3

lib/index.d.ts

@@ -163,1 +163,4 @@ export declare type Bool = 'true' | 'false';

export declare type NotStringEq<L1 extends string, L2 extends string> = Not<StringEq<L1, L2>>;
export declare type Clean<T> = {
[K in keyof T]: T[K];
};

2

package.json
{
"name": "typelevel-ts",
"version": "0.0.1",
"version": "0.0.2",
"description": "Type level programming in TypeScript",

@@ -5,0 +5,0 @@ "files": [

@@ -1,3 +0,5 @@

# Example: vectors
# `Nat`urals
**Example**. Type-safe vectors
```ts

@@ -43,1 +45,49 @@ import { _1, _2, _3, Nat, Add } from 'typelevel-ts'

```
# The `Omit` operator
**Example**. A `withDefaults` function (React)
```ts
import * as React from 'react'
import { Omit, Clean } from 'typelevel-ts'
export default function withDefaults<A, D extends keyof A>(
C: React.ComponentType<A>,
defaults: Pick<A, D>
): React.SFC<Clean<Omit<A, D> & Partial<Pick<A, D>>>> {
return (props: any) => <C {...Object.assign({}, defaults, props)} />
}
class Foo extends React.Component<{ bar: string; baz: number }, void> {}
const FilledFoo = withDefaults(Foo, { baz: 1 })
const x = <FilledFoo bar="bar" /> // ok
```
**Example**. A `withProps` function (React)
```ts
import { Omit } from 'typelevel-ts'
import * as React from 'react'
function withProps<D, P extends D>(C: React.ComponentType<P>, values: D): React.SFC<Omit<P, keyof D>> {
return (props: any) => <C {...Object.assign({}, props, values)} />
}
class Foo extends React.Component<{ bar: string; baz: number }, void> {}
const FilledFoo = withProps(Foo, { baz: 1 })
const x = <FilledFoo bar="bar" /> // ok
```
# The `Diff` operator
```ts
import { Diff } from 'typelevel-ts'
type Foo = { a: string; b: number }
type Bar = { b: number }
// Baz :: { a: string, b?: number }
type Baz = Diff<Foo, Bar>
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc