Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
HashCode
✓ import { HashCode } from 'metano-runtime'
✗ import HashCode from 'metano-runtime'
Named export, not default. ESM-only (no CJS). Types included.
HashSet
✓ import { HashSet } from 'metano-runtime'
✗ const { HashSet } = require('metano-runtime')
Named export. Not available via default import. Requires peer dep @typescript/native-preview for generics.
Enumerable
✓ import { Enumerable } from 'metano-runtime'
✗ import { Enumerable } from 'metano-runtime/enumerable'
Export is from top-level package, not subpath. Provides .NET-like LINQ operations.
UUID
✓ import { UUID } from 'metano-runtime'
✗ import { Uuid } from 'metano-runtime'
Case-sensitive: 'UUID' in all caps. Branded string type.
JsonSerializer
✓ import { JsonSerializer } from 'metano-runtime/system/json'
✗ import { JsonSerializer } from 'metano-runtime'
Located under 'system/json' subpath; not exported from main entry point.
Demonstrates core runtime features: HashCode, HashSet, Enumerable, UUID, and int32 type guard.
import { HashCode, HashSet, Enumerable, UUID, isInt32 } from 'metano-runtime';
// HashCode usage
const hc = new HashCode();
hc.add('hello');
hc.add(42);
const hash = hc.toHashCode(); // number
// HashSet with structural equality
class Point {
constructor(readonly x: number, readonly y: number) {}
equals(other: Point) { return this.x === other.x && this.y === other.y; }
hashCode() {
const hc = new HashCode();
hc.add(this.x);
hc.add(this.y);
return hc.toHashCode();
}
}
const set = new HashSet<Point>();
set.add(new Point(1, 2));
console.log(set.has(new Point(1, 2))); // true
// Enumerable (LINQ)
const result = Enumerable.from([1, 2, 3, 4, 5])
.where(x => x > 1)
.select(x => x * 2)
.toArray(); // [4, 6, 8, 10]
// UUID
const id = UUID.newUuid();
console.log(id); // "550e8400-e29b-41d4-a716-446655440000"
if (UUID.isUuid(id)) { console.log('valid UUID'); }
// Type guard
console.log(isInt32(123)); // true
console.log(isInt32(1.5)); // false
Errors
Common errors & fixes
Error: Cannot find module 'metano-runtime'
metano-runtime is not installed; Metano should add it automatically but missing npm install step.
fixRun 'npm install' after code generation, or manually add 'metano-runtime' to dependencies.
TypeError: Class extends value undefined is not a constructor or null
Missing peer dependency @typescript/native-preview v7, required for generic type utilities.
fixRun 'npm install @typescript/native-preview@^7'.
Cannot find module 'metano-runtime/system/json'
Subpath imports may not be supported by older bundlers or Node.js versions (<12).
fixUpdate Node.js to >=14 or use a bundler that supports the 'exports' field in package.json.
Audit
Dependencies
@typescript/native-previewoptionalpeer dependency (^7) required for type-level operations used by Metano-generated code