An open API service indexing awesome lists of open source software.

https://github.com/majjoha/typology

Playground for exploring type-level programming.
https://github.com/majjoha/typology

type-level-programming types typescript

Last synced: 12 days ago
JSON representation

Playground for exploring type-level programming.

Awesome Lists containing this project

README

          

# Typology
![CI](https://github.com/majjoha/typology/workflows/CI/badge.svg)

Typology is a playground for exploring type-level programming in TypeScript. The
various types range from simple representations of natural numbers to types that
can compute Fibonacci numbers.

## Examples
### Addition
```typescript
const three: Add, Succ>> = {
n: {
n: {
n: "zero"
},
},
}
```

### Factorial
```typescript
const six: Factorial = { n: { n: { n: { n: { n: { n: "zero" } } } } } }
```

### Convert strings to numbers
```typescript
const five: FromString<"{ n: { n: { n: { n: { n: zero } } } } }"> = {
n: { n: { n: { n: { n: "zero" } } } },
}
```

### Boolean logic
```typescript
const two: IfElse<
And<
LessThan,
Not>
>,
ToString>>,
never
> = "{ n: { n: zero } }"
```

### Fibonacci numbers
```typescript
const five: Fibonacci = { n: { n: { n: { n: { n: "zero" } } } } }
```

## License
See [LICENSE](./LICENSE).