🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@isl-lang/typechecker

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isl-lang/typechecker

Semantic analyzer for ISL - validates AST, resolves types, builds symbol table

Source
npmnpm
Version
0.1.0
Version published
Weekly downloads
6
-71.43%
Maintainers
1
Weekly downloads
 
Created
Source

@isl-lang/typechecker

Semantic analyzer for ISL - validates AST, resolves types, and builds symbol tables.

Installation

npm install @isl-lang/typechecker
# or
pnpm add @isl-lang/typechecker

Usage

import { parse } from '@isl-lang/parser';
import { typecheck, TypeChecker } from '@isl-lang/typechecker';

const ast = parse(`
  domain UserManagement {
    type User {
      id: uuid
      name: string
      email: email
    }

    intent CreateUser {
      input { name: string, email: email }
      output { user: User }
    }
  }
`);

// Quick validation
const result = typecheck(ast);

if (result.errors.length > 0) {
  result.errors.forEach(err => console.error(err.message));
} else {
  console.log('Type checking passed!');
  console.log('Symbol table:', result.symbolTable);
}

// Or use the TypeChecker class for more control
const checker = new TypeChecker();
const checked = checker.check(ast);

API

typecheck(ast: AST): TypeCheckResult

Perform type checking on an AST.

Returns:

  • errors - Array of type errors found
  • warnings - Array of type warnings
  • symbolTable - Resolved symbol table
  • typeMap - Map of nodes to their resolved types

TypeChecker

Class for incremental type checking with caching.

const checker = new TypeChecker();

// Check multiple files
checker.addFile('user.isl', userAst);
checker.addFile('order.isl', orderAst);

// Get all errors
const errors = checker.getAllErrors();

// Get type for a specific node
const type = checker.getType(node);

Features

  • Type inference - Infers types for expressions
  • Contract validation - Validates pre/postconditions
  • Cross-reference resolution - Resolves type references across domains
  • Import validation - Validates imports and exports
  • Incremental checking - Efficient re-checking of modified files

Error Types

import { TypeError, TypeErrorCode } from '@isl-lang/typechecker';

// Error codes
TypeErrorCode.UNDEFINED_TYPE
TypeErrorCode.TYPE_MISMATCH
TypeErrorCode.DUPLICATE_DEFINITION
TypeErrorCode.INVALID_CONTRACT

Documentation

Full documentation: https://isl-lang.dev/docs/typechecker

License

MIT

Keywords

isl

FAQs

Package last updated on 01 Feb 2026

Did you know?

Socket

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.

Install

Related posts