Typesafe floats ?

I'm trying to create a column called "weight". It needs to have values like "33.33" as floats.

I'm using PostgreSQL - and I've created a column with the following settings;
numeric('weight', { precision: 10, scale: 2 })

The thing is - when I try to insert a value like 33.33 it tells me that
number' is not assignable to type 'string'


If the numeric is a string - how can it be typesafe, as I can insert any string I want ? I mean PSQL will throw an error, but how can I make it typesafe ?

Thank you guys
Was this page helpful?