No Login Data Private Local Save

MySQL ENUM to TypeScript Union - Online Schema Converter

5
0
0
0

MySQL ENUM → TypeScript Union

Instantly convert MySQL ENUM definitions into TypeScript string union types. Perfect for backend → frontend type sync.

// Your union type will appear here

Frequently Asked Questions

It transforms MySQL ENUM('value1','value2',...) into a TypeScript string union type like 'value1' | 'value2', optionally wrapped as a named type alias. This keeps your frontend types in sync with database constraints.

Yes! You can input comma-separated quoted strings like 'admin','user','moderator'. The converter will automatically parse them and generate the union.

Yes, the parser strips out common column modifiers and only extracts the string literals. You can paste entire column definitions like status ENUM('active','inactive') NOT NULL DEFAULT 'active'.

Values containing single quotes escaped with backslash (\') are correctly converted to TypeScript's escaped single quotes. Double quotes inside values are preserved. The output is valid TypeScript.

Absolutely. Use the "Type alias" toggle and the "Type name" field. For example, setting name to UserRole gives type UserRole = 'admin' | 'user';

Yes, all conversion happens in your browser. No data is sent to any server. It’s 100% free with no usage limits.

The tool parses the first complete ENUM(...) block it finds. For bulk conversions, run them one by one or separate multiple ENUMs into individual inputs.