ToolHop.

ADVERT

๐Ÿงฑ SQL to TypeScript

Paste SQL CREATE TABLE statements and generate TypeScript interfaces for your data models. Runs in your browser with no sign-up required.

SQL to TypeScript

Parse one or more CREATE TABLE statements into TypeScript models with diagnostics and relation hints.

Parsed table preview

users

ColumnSQL typeTS typeRequiredReferences
idSERIAL PRIMARYnumberYes-
nameVARCHAR(120)stringYes-
emailVARCHAR(160)stringYes-
activeBOOLEAN DEFAULTbooleanNo-
created_atTIMESTAMP NOTstringYes-
profileJSONBunknownNo-
roleTEXTstringNo-

orders

ColumnSQL typeTS typeRequiredReferences
idBIGINT PRIMARYnumberYes-
user_idINTEGER NOTnumberYesusers
totalNUMERIC(10,2)numberYes-
tagsTEXT[]string[]No-
statusENUM('pending','paid','failed')'pending' | 'paid' | 'failed'Yes-
created_atTIMESTAMP NOTstringYes-

Diagnostics

No parse diagnostics.

How to use this tool

  1. Paste one or more CREATE TABLE statements.
  2. Review parsed columns and diagnostics in the preview table.
  3. Copy or download generated TypeScript declarations.

Parser behavior

  • Supports multiple CREATE TABLE blocks in one pass.
  • Maps precision and array types to practical TS equivalents.
  • Carries REFERENCES hints into comments and preview columns.

Manual follow-up

  • Adjust unknown/custom SQL types flagged in diagnostics.
  • Refine enum unions when SQL dialects use custom patterns.
  • Model join relations and derived views separately.

FAQ

Does this support multiple tables?
Yes. It parses multiple CREATE TABLE statements and emits one model per table.
Are foreign keys represented?
Reference targets are surfaced as hints and comments, not full ORM relations.
What happens with unknown SQL types?
They default to string and are listed in diagnostics so you can correct mappings manually.

ADVERT

ADVERT