Registry / serialization / typify-parser

typify-parser

JSON →
library1.1.0jsnpmunverified

typify-parser is a JavaScript library designed to parse declarative type signature strings, primarily intended for use within the broader `typify` ecosystem for runtime type-checking. It takes human-readable type declarations, such as `(foo, bar 42) -> quux`, and transforms them into a structured JSON Abstract Syntax Tree (AST) representation. This AST details the type components, including function types, product types, identifiers, and literal values like numbers. Additionally, it provides utility methods like `freeVars` to extract unbound type variables from the parsed structure. The package is currently at version `1.1.0`, but it was last published in July 2015, indicating it is no longer actively maintained. Its parent project, `typify`, also appears to be dormant. Developers considering this package should be aware of its abandoned status and the potential compatibility issues with modern JavaScript environments and module systems. Its core differentiation was its ability to convert custom type signature strings into a machine-readable format for subsequent type validation by `typify`.

npm install typify-parser
INSTALL
IMPORT
SIG · TYPIFY-PARSER
T
typify-parser
serializationjavascriptv1.1.0
Install
—
Import
—
Disk
—
Pass rate
0/ 6
Env Coverage0 / 6
glibc
18–22
musl
18–22
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18–226 runs
build_error
glibc
node 18–226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

parser
✓ import parser from 'typify-parser';
✗ const parser = require('typify-parser').parser;
The package's age means it was designed for CommonJS. While Node.js may allow this ESM import, it fundamentally exports a single function. The CommonJS example in the README suggests a direct assignment from `require`.
parser
✓ const parser = require('typify-parser');
This is the primary and intended way to import the parser function in older Node.js environments. The package provides a default export, which is the parser function itself.
freeVars
✓ const { freeVars } = require('typify-parser');
✗ import { freeVars } from 'typify-parser';
The `freeVars` utility is exposed as a property on the default exported parser function. Destructuring from `require` is the idiomatic way to access it in CommonJS. Direct ESM named imports are not supported.

This quickstart demonstrates how to parse a type signature string into its Abstract Syntax Tree (AST) representation and how to extract free variables using the `freeVars` utility.

const parser = require('typify-parser'); // Example: Parse a complex type signature into an AST const typeSignatureString = "(name: string, age: number, ?email: string) -> User"; const ast = parser(typeSignatureString); console.log('Parsed AST:', JSON.stringify(ast, null, 2)); // Example: Parse another signature and extract free variables const freeVarsAST = parser("rec list -> () | a & list"); const variables = parser.freeVars(freeVarsAST); console.log('\nFree variables for "rec list -> () | a & list":', variables); /* Output will resemble: Parsed AST: { "type": "function", "arg": { "type": "product", "args": [ { "type": "ident", "value": "name", "alias": { "type": "ident", "value": "string" } }, { "type": "ident", "value": "age", "alias": { "type": "ident", "value": "number" } }, { "type": "ident", "value": "email", "alias": { "type": "ident", "value": "string" }, "optional": true } ] }, "result": { "type": "ident", "value": "User" } } Free variables for "rec list -> () | a & list": [ "a" ] */
Debug
Known issues
breakingThe `typify-parser` package has been abandoned since its last publish in July 2015. It is no longer actively maintained, meaning there will be no new features, bug fixes, or security updates.
fix
Consider alternative, actively maintained type parsing or validation libraries. If you must use it, be aware of potential compatibility issues with modern Node.js/browser environments and the lack of security patches.
affects: >=1.1.0
gotchaThis package predates widespread ES Modules adoption and only provides a CommonJS `require()` interface. It does not natively support `import` statements.
fix
For use in ESM projects, you may need to rely on Node.js's CJS-to-ESM interoperability layers or transpilation, which can add complexity and overhead.
affects: >=1.1.0
gotchaThe package specifies a Node.js engine requirement of `>= 0.10.0`, an extremely old version. It has not been tested or updated for compatibility with modern Node.js releases (e.g., Node.js 16+ or 18+).
fix
Running this package in modern Node.js environments may lead to unexpected behavior or runtime errors due to API changes or deprecations in Node.js itself. Exercise caution and thorough testing if integration is attempted.
affects: >=1.1.0
Upgrade
Version history
1.1.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
OpenAI (training)
1
Resources
typify-parser — npm install typify-parser · libregistry