# @glas/kype

> Type Inference Library

Latest version **0.0.2** (published 2023-12-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install @glas/kype
pnpm add @glas/kype
yarn add @glas/kype
bun add @glas/kype
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.2 |
| Published | 2023-12-05 |
| First published | 2023-12-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 8 |
| Unpacked size | 283.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Kris Nye |
| Maintainers | kodyjking, krisnye |
| Keywords | type, inference |

## Links

- npm: https://www.npmjs.com/package/@glas/kype
- Repository: https://github.com/krisnye/kype
- Homepage: https://github.com/krisnye/kype#readme
- Issues: https://github.com/krisnye/kype/issues
- npm.io page: https://npm.io/package/@glas/kype

## Dependencies (8)

- [nodemon](https://npm.io/package/nodemon.md) ^2.0.20
- [z3-solver](https://npm.io/package/z3-solver.md) ^4.12.1
- [@glas/test](https://npm.io/package/@glas/test.md) ^1.0.4
- [@lume/kiwi](https://npm.io/package/@lume/kiwi.md) ^0.1.0
- [typescript](https://npm.io/package/typescript.md) ^4.8.4
- [@types/node](https://npm.io/package/@types/node.md) ^18.8.3
- [npm-run-all](https://npm.io/package/npm-run-all.md) ^4.1.5
- [@glas/traverse](https://npm.io/package/@glas/traverse.md) ^1.0.8

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 0.0.2 (latest) — 2023-12-05

## README

# kype
Type Inference Library

## TODO
[x] Infer type of an expression based upon other assertions
[x] Figure out how to type multiplied values (@ >= 5) * (@ >= 10)
Infer Type for Member Expression

## Type comparison

    { 0 .. 10 } < { 20 .. 30 }  ->  true
    { 0 .. 10 } < { 0 .. 30 }   ->  null

## Types of Runtime Errors

- divide by zero
- modulo by zero
- integer overflow
- integer underflow
- infinite loop
- infinite recursion
- out of memory
- null pointer

##  Indented Syntax

var x = 12
type Foo = 10 .. 20

//  only meta class for now.
@Meta()
class Vector
    x: Number
    y: Number
    translate(x: Number, y: Number) => Vector(this.x + x, this.y + y)

function foo(a: Type, b: Type) =>
    if a is Bar
        return 12
    else
        for i in 0 .. 20
            return 20

//  struct or some shiz?
@Meta()
@Bar()
function fooWithMeta(
    @Meta(12)
    a: Type
    @Meta()
    b: Type
) =>
    callOutline()
        12
        20
        30

##  Compiler

Folders are always lower case
Files are always upper case

    namespace/
        Foo.ion
            # var foo       namespace:Foo.foo
            # class Foo     namespace:Foo
            # type Bar      namespace:Foo.Bar

##  Phases

- Parse
- Separate each declaration
- Resolve Externals
- Compile Dependencies
- Compile Self
- Store Compiled External Details

##  Recompile

- Reparse changed file
- Separate each declaration
- Compare to previously cached values and skip unchanged
- Resolve externals
- Compile Dependencies
- Compile Self
- Compile Dependents
- Update Compiled External Details

---
_Source: https://npm.io/package/@glas/kype · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
