{"id":25933,"library":"metano-runtime","title":"Metano Runtime","description":"Runtime support library for code generated by the Metano C# → TypeScript transpiler (v1.0.3, updated April 2026). Provides C#-compatible primitives such as HashCode (xxHash32), HashSet with structural equality, a full LINQ API via Enumerable, a branded UUID type for System.Guid mapping, runtime type guards (isInt32, isString, etc.), and JSON serialization (system/json). Release cadence is active (multiple versions per month). Key differentiator: automatically added by Metano to generated projects; side-effect-free for tree-shaking. Requires @typescript/native-preview (peer dep). Only relevant for Metano users; not designed for general-purpose use.","status":"active","version":"1.0.3","language":"javascript","source_language":"en","source_url":"https://github.com/danfma/metano","tags":["javascript","typescript"],"install":[{"cmd":"npm install metano-runtime","lang":"bash","label":"npm"},{"cmd":"yarn add metano-runtime","lang":"bash","label":"yarn"},{"cmd":"pnpm add metano-runtime","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency (^7) required for type-level operations used by Metano-generated code","package":"@typescript/native-preview","optional":true}],"imports":[{"note":"Named export, not default. ESM-only (no CJS). Types included.","wrong":"import HashCode from 'metano-runtime'","symbol":"HashCode","correct":"import { HashCode } from 'metano-runtime'"},{"note":"Named export. Not available via default import. Requires peer dep @typescript/native-preview for generics.","wrong":"const { HashSet } = require('metano-runtime')","symbol":"HashSet","correct":"import { HashSet } from 'metano-runtime'"},{"note":"Export is from top-level package, not subpath. Provides .NET-like LINQ operations.","wrong":"import { Enumerable } from 'metano-runtime/enumerable'","symbol":"Enumerable","correct":"import { Enumerable } from 'metano-runtime'"},{"note":"Case-sensitive: 'UUID' in all caps. Branded string type.","wrong":"import { Uuid } from 'metano-runtime'","symbol":"UUID","correct":"import { UUID } from 'metano-runtime'"},{"note":"Located under 'system/json' subpath; not exported from main entry point.","wrong":"import { JsonSerializer } from 'metano-runtime'","symbol":"JsonSerializer","correct":"import { JsonSerializer } from 'metano-runtime/system/json'"}],"quickstart":{"code":"import { HashCode, HashSet, Enumerable, UUID, isInt32 } from 'metano-runtime';\n// HashCode usage\nconst hc = new HashCode();\nhc.add('hello');\nhc.add(42);\nconst hash = hc.toHashCode(); // number\n// HashSet with structural equality\nclass Point {\n  constructor(readonly x: number, readonly y: number) {}\n  equals(other: Point) { return this.x === other.x && this.y === other.y; }\n  hashCode() {\n    const hc = new HashCode();\n    hc.add(this.x);\n    hc.add(this.y);\n    return hc.toHashCode();\n  }\n}\nconst set = new HashSet<Point>();\nset.add(new Point(1, 2));\nconsole.log(set.has(new Point(1, 2))); // true\n// Enumerable (LINQ)\nconst result = Enumerable.from([1, 2, 3, 4, 5])\n  .where(x => x > 1)\n  .select(x => x * 2)\n  .toArray(); // [4, 6, 8, 10]\n// UUID\nconst id = UUID.newUuid();\nconsole.log(id); // \"550e8400-e29b-41d4-a716-446655440000\"\nif (UUID.isUuid(id)) { console.log('valid UUID'); }\n// Type guard\nconsole.log(isInt32(123)); // true\nconsole.log(isInt32(1.5)); // false","lang":"typescript","description":"Demonstrates core runtime features: HashCode, HashSet, Enumerable, UUID, and int32 type guard."},"warnings":[{"fix":"Only consume via generated code; do not depend on it directly.","message":"This library is auto-installed by the Metano transpiler; manual use is discouraged. The public API is unstable across Metano versions.","severity":"gotcha","affected_versions":"<1.0.0"},{"fix":"Use [NoContainer] attribute instead of [Erasable] in generated code.","message":"The 'Erasable' annotation was renamed to 'NoContainer' in v1.0.0.","severity":"deprecated","affected_versions":">=0.7.0 <1.0.0"},{"fix":"Add @typescript/native-preview@^7 as a dependency or devDependency.","message":"Peer dependency @typescript/native-preview ^7 required since v1.0.0. Older versions did not require it.","severity":"breaking","affected_versions":"<1.0.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Run 'npm install' after code generation, or manually add 'metano-runtime' to dependencies.","cause":"metano-runtime is not installed; Metano should add it automatically but missing npm install step.","error":"Error: Cannot find module 'metano-runtime'"},{"fix":"Run 'npm install @typescript/native-preview@^7'.","cause":"Missing peer dependency @typescript/native-preview v7, required for generic type utilities.","error":"TypeError: Class extends value undefined is not a constructor or null"},{"fix":"Update Node.js to >=14 or use a bundler that supports the 'exports' field in package.json.","cause":"Subpath imports may not be supported by older bundlers or Node.js versions (<12).","error":"Cannot find module 'metano-runtime/system/json'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}