File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed
spec/types_from_serializers
types_from_serializers/lib/types_from_serializers Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -115,5 +115,21 @@ def generate_serializers
115115
116116 expect ( ts_type ) . to eq ( :string )
117117 end
118+
119+ it "maps json type from SQL to object type in TypeScript" do
120+ db_type = :json
121+
122+ ts_type = TypesFromSerializers . config . sql_to_typescript_type_mapping [ db_type ]
123+
124+ expect ( ts_type ) . to eq ( "Record<string, any>" )
125+ end
126+
127+ it "maps jsonb type from SQL to object type in TypeScript" do
128+ db_type = :jsonb
129+
130+ ts_type = TypesFromSerializers . config . sql_to_typescript_type_mapping [ db_type ]
131+
132+ expect ( ts_type ) . to eq ( "Record<string, any>" )
133+ end
118134 end
119135end
Original file line number Diff line number Diff line change @@ -392,6 +392,8 @@ def default_config(root)
392392 string : :string ,
393393 text : :string ,
394394 citext : :string ,
395+ json : "Record<string, any>" ,
396+ jsonb : "Record<string, any>" ,
395397 } . tap do |types |
396398 types . default = :unknown
397399 end ,
You can’t perform that action at this time.
0 commit comments