Is it possible to create a dynamic type/interface from API response

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

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.io
featured
InfluxDB - Power Real-Time Data Analytics at Scale
Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.
www.influxdata.com
featured
  • openapi-typescript-codegen

    NodeJS library that generates Typescript or Javascript clients based on the OpenAPI specification

  • Second step is to generate typescript types from the backend's spec. You can use a library like this.

  • zod

    TypeScript-first schema validation with static type inference

  • If you are doing this sort of thing a lot, then you probably want to look into Zod, which can combine your validation code and type declarations into one schema.

  • 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
  • kanel

    Generate Typescript types from Postgres

  • There are tools that will generate typescript types from a database. I made one for Postgres. But it also works at "compile time", i.e. it doesn't look at a live database. I am not sure if that is what you are asking?

  • typehole

    TypeScript development tool for Visual Studio Code that helps you automate creating the initial static typing for runtime values

  • Looks like you want a development tool, not necessarily at runtime thing, try Typehole. Looks like it's perfect for this. https://github.com/rikukissa/typehole

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

  • TypeSpec: A New Language for API-Centric Development

    11 projects | news.ycombinator.com | 29 Apr 2024
  • Django 5.0 Is Released

    11 projects | news.ycombinator.com | 4 Dec 2023
  • OpenAPI-TypeScript – OpenAPI schemas in TypeScript

    1 project | news.ycombinator.com | 24 Nov 2023
  • Show HN: Build type-safe web APIs with JavaScript, instantly

    5 projects | news.ycombinator.com | 25 Oct 2023
  • Using OpenAPI to Detect Breaking Changes in tRPC

    7 projects | dev.to | 16 Oct 2023