diff --git a/app/src/types/fields.ts b/app/src/types/fields.ts index 7726896a02..03decabbee 100644 --- a/app/src/types/fields.ts +++ b/app/src/types/fields.ts @@ -27,15 +27,6 @@ export const types = [ 'unknown', ] as const; -export function parseTypes(type: typeof types[number]) { - if (['bigInteger', 'integer', 'float', 'decimal'].includes(type)) return 'number'; - if (['string', 'text', 'uuid'].includes(type)) return 'string'; - if (['boolean'].includes(type)) return 'boolean'; - if (['time', 'timestamp', 'date', 'dateTime'].includes(type)) return 'string'; - if (['json', 'csv'].includes(type)) return 'object'; - return 'undefined'; -} - export type FieldSchema = { /** @todo import this from knex-schema-inspector when that's launched */ name: string; diff --git a/app/src/utils/get-js-type.ts b/app/src/utils/get-js-type.ts new file mode 100644 index 0000000000..aed687ef92 --- /dev/null +++ b/app/src/utils/get-js-type.ts @@ -0,0 +1,10 @@ +import { types } from '@/types'; + +export function getJSType(type: typeof types[number]) { + if (['bigInteger', 'integer', 'float', 'decimal'].includes(type)) return 'number'; + if (['string', 'text', 'uuid'].includes(type)) return 'string'; + if (['boolean'].includes(type)) return 'boolean'; + if (['time', 'timestamp', 'date', 'dateTime'].includes(type)) return 'string'; + if (['json', 'csv'].includes(type)) return 'object'; + return 'undefined'; +}