04 · Adoption
Can I use my existing TypeScript, JavaScript, and npm libraries?
Yes. Glyph compiles to ordinary TypeScript and rides npm — a
.glyph module imports from any package and is itself importable from your
existing .ts. You adopt it one file at a time.
Why it matters
Nobody rewrites a codebase to try a language. Because Glyph's output is
TypeScript, a .glyph file drops into the corner of an existing TS/React/Node
project, imports the same packages, and exports back to the .ts around it.
That gradual path is the whole reason to target TypeScript instead of shipping a new
runtime.
See it
You import packages by name — including hyphenated and npm-scoped ones — and Glyph emits the import you'd expect:
import react { useState }
import react-hook-form { useForm }
import @hookform/resolvers/zod {
zodResolver,
}
import { useState } from "react";
import { useForm } from "react-hook-form";
import { zodResolver }
from "@hookform/resolvers/zod";
For a library's types, Glyph reads ambient declarations from a
.types/ folder, the same .d.ts mechanism TypeScript already
uses — so your editor and the type-checker see the real signatures. And when you want
a library's shape as a first-class, validated Glyph type rather than a type-only
import, glyph gen dts materializes a .d.ts into real
descriptor-bearing types — see
do I have to hand-write a validator for every API?
The honest edge: interop crosses the TypeScript boundary. A
complex-typed library — one that leans on prop spreading ({...register()})
or deep conditional/mapped types — may still need a thin TS adapter today rather than
working inline. It's the sharpest friction we've found, it's being worked, and a
first-class @ffi path is planned for v2. You do not need it to use the npm
ecosystem now.
Where it stands
Shipping today
Import any npm package (hyphenated and scoped names included), .types/ ambient declarations, glyph gen dts to materialize a .d.ts into validated Glyph types, and clean .ts output that your existing TypeScript imports back.
On the way
A first-class FFI path so a complex-typed TS library is usable without a per-library adapter — the top interop priority.