npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@polyprism/ts-shared

v0.3.1

Published

Shared TypeScript rendering primitives used by PolyPrism's Prisma 6 & 7 generators (ts-interface, ts-type, ts-class, ts-domain-class). Pure ESM.

Readme

@polyprism/ts-shared

TypeScript rendering primitives shared by every ts-* pattern in PolyPrism — a Prisma 6 & 7 generator that emits TypeScript types from your schema.prisma in whichever shape fits the layer you're writing: interface, type, plain class, or an opinionated domain class with setter-driven @normalise/@coerce data laundering.

Pure ESM, Prisma 7-native, zero third-party runtime dependencies on any published @polyprism/* package.

You're probably looking for a pattern package

You don't install @polyprism/ts-shared directly — each ts-* pattern package pulls it in transitively.

| Install | What it emits | |---|---| | @polyprism/ts-interface | export interface User { ... } | | @polyprism/ts-type | export type User = { ... }; | | @polyprism/ts-class | export class User { ... } — plain class, public fields | | @polyprism/ts-domain-class | Opinionated domain class — private fields, getters/setters with @normalise/@coerce data laundering, from(), toJSON(), builder |

What lives here

The TypeScript-specific layer between @polyprism/core's language-agnostic IR and the per-pattern emitters:

  • renderModel({ declarationStyle }) — emits one model file, parameterised by "interface" | "type" | "class" | "domain-class". The three "flat" styles (interface, type, class) share one code path; only the declaration keyword and default-value handling differ. The fourth (domain-class) delegates to a sibling renderer (renderDomainClass) because private fields, accessor pairs, and the Init interface are different enough in shape that branching the flat path got messy. All four still share the same import handling, JSON-type plumbing, naming resolution, and JSDoc emission — agreement by construction, not by convention.
  • renderIndex({ declarationStyle }) — emits the optional barrel (index.ts) with class-mode awareness, so it uses export { User } for class / domain-class output and export type { User } for interface/type output.
  • mapFieldTsType — IR field → TypeScript type expression. Handles enums, Json-typed fields (with the four @json(...) annotation forms), Decimal, BigInt, Bytes, arrays, and nullability.
  • ImportCollector — deduped, sorted, type-vs-value-aware import block builder. Auto-promotes a type import to a value import when the same symbol appears as a runtime default in class mode.
  • renderJsDoc — JSDoc emission for /// docs, @deprecated tags, and @db.X(p, s) precision metadata so the schema-level info survives codegen.

Why this is split out from @polyprism/core

@polyprism/core is deliberately language-agnostic — IR, Prisma schema reader, annotation parser, naming resolver. @polyprism/ts-shared is where TypeScript-specific concerns live. Every ts-* pattern in PolyPrism shares one TypeScript rendering layer, so they agree on import handling, naming, and JSDoc emission by construction — not by convention.

Links

License

MIT © Travis Fitzgerald