SeedCompany / cord-api-v3

Bible translation project management API
MIT License
18 stars 4 forks source link

[EdgeDB] castToEnum QB helper #3152

Closed CarsonF closed 5 months ago

CarsonF commented 5 months ago

This is an unsafe helper to assert that the given str expression is actually a string literal union of the given enum.

const expr = e.str('red') // edgeql str literal whose TS value is `string`

castToEnum(expr, ['red', 'blue']) // expression TS value is now `'red' | 'blue'`