What is your naming/export convention for defining and exporting a non-class type/interface and its "helper" functions (factory/constructor, `isFoo()` type guard, etc)?

This page summarizes the projects mentioned and recommended in the original post on /r/typescript

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • zod

    TypeScript-first schema validation with static type inference

  • If this particular pattern is something you do often, have you considered using Zod or another validation library? Or are your types more complex than your example or unsuited for other reasons?

  • Prisma

    Next-generation ORM for Node.js & TypeScript | PostgreSQL, MySQL, MariaDB, SQL Server, SQLite, MongoDB and CockroachDB

  • // Example with prisma ORM: https://www.prisma.io/ class PrismaCarMapper extends DataMapper { override serialize(car: Car): PrismaDatabaseCar { return new PrismaDatabaseCar({ id: car.id, mark: car.mark, model: car.model, }); }

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

    SurveyJS logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts