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.
- Host: GitHub
- URL: https://github.com/majjoha/typology
- Owner: majjoha
- License: gpl-3.0
- Created: 2021-03-31T07:04:49.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2026-03-02T11:42:33.000Z (2 months ago)
- Last Synced: 2026-03-02T15:29:28.758Z (2 months ago)
- Topics: type-level-programming, types, typescript
- Language: TypeScript
- Homepage: https://github.com/majjoha/typology
- Size: 1.59 MB
- Stars: 6
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Typology

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).