[TS] Implement trait_struct_inc_refcnt properly (identical to java)