typeMapper only accepts globally available types
Ericnr opened this issue · comments
Ericnr commented
Currently I need to declare global types if I want to map postgres numeric
type to a Decimal
class exported by a lib. We could have an api like importTypes: 'process.cwd() + '/src/types/slonikTypes'
so that file is imported by every type gen file.
Misha Kaletsky commented
@Ericnr you should be able to use import
, something like:
setupTypeGen({
knownTypes,
typeMapper: {
numeric: [`import('../types/slonikTypes').Decimal`, toDecimal],
},
})
Edit: closing, but feel free to reply here if you think this should be reopened.