{"id":15880,"library":"typify-parser","title":"Typify Type Parser","description":"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`.","status":"abandoned","version":"1.1.0","language":"javascript","source_language":"en","source_url":"git://github.com/phadej/typify-parser","tags":["javascript","type","signature","parser","checking","typify","data","validation"],"install":[{"cmd":"npm install typify-parser","lang":"bash","label":"npm"},{"cmd":"yarn add typify-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add typify-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"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`.","wrong":"const parser = require('typify-parser').parser;","symbol":"parser","correct":"import parser from 'typify-parser';"},{"note":"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.","symbol":"parser","correct":"const parser = require('typify-parser');"},{"note":"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.","wrong":"import { freeVars } from 'typify-parser';","symbol":"freeVars","correct":"const { freeVars } = require('typify-parser');"}],"quickstart":{"code":"const parser = require('typify-parser');\n\n// Example: Parse a complex type signature into an AST\nconst typeSignatureString = \"(name: string, age: number, ?email: string) -> User\";\nconst ast = parser(typeSignatureString);\n\nconsole.log('Parsed AST:', JSON.stringify(ast, null, 2));\n\n// Example: Parse another signature and extract free variables\nconst freeVarsAST = parser(\"rec list -> () | a & list\");\nconst variables = parser.freeVars(freeVarsAST);\n\nconsole.log('\\nFree variables for \"rec list -> () | a & list\":', variables);\n\n/* Output will resemble:\nParsed AST: {\n  \"type\": \"function\",\n  \"arg\": {\n    \"type\": \"product\",\n    \"args\": [\n      {\n        \"type\": \"ident\",\n        \"value\": \"name\",\n        \"alias\": {\n          \"type\": \"ident\",\n          \"value\": \"string\"\n        }\n      },\n      {\n        \"type\": \"ident\",\n        \"value\": \"age\",\n        \"alias\": {\n          \"type\": \"ident\",\n          \"value\": \"number\"\n        }\n      },\n      {\n        \"type\": \"ident\",\n        \"value\": \"email\",\n        \"alias\": {\n          \"type\": \"ident\",\n          \"value\": \"string\"\n        },\n        \"optional\": true\n      }\n    ]\n  },\n  \"result\": {\n    \"type\": \"ident\",\n    \"value\": \"User\"\n  }\n}\n\nFree variables for \"rec list -> () | a & list\": [\n  \"a\"\n]\n*/","lang":"javascript","description":"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."},"warnings":[{"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.","message":"The `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.","severity":"breaking","affected_versions":">=1.1.0"},{"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.","message":"This package predates widespread ES Modules adoption and only provides a CommonJS `require()` interface. It does not natively support `import` statements.","severity":"gotcha","affected_versions":">=1.1.0"},{"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.","message":"The 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+).","severity":"gotcha","affected_versions":">=1.1.0"}],"env_vars":null,"last_verified":"2026-04-21T00:00:00.000Z","next_check":"2026-07-20T00:00:00.000Z","problems":[],"ecosystem":"npm"}