Skip to content

Commit 7d27985

Browse files
fix: fix error
1 parent 16ce790 commit 7d27985

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

packages/param/encoder.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func MarshalObject[T ParamStruct](f T, underlying any) ([]byte, error) {
3535
// MarshalWithExtras is used to marshal a struct with additional properties.
3636
//
3737
// Stability for the API of MarshalWithExtras is not guaranteed.
38-
func MarshalWithExtras[T ParamStruct](f T, underlying any, extras map[string]any) ([]byte, error) {
38+
func MarshalWithExtras[T ParamStruct, R any](f T, underlying any, extras map[string]R) ([]byte, error) {
3939
if f.null() {
4040
return []byte("null"), nil
4141
} else if len(extras) > 0 {
@@ -44,7 +44,8 @@ func MarshalWithExtras[T ParamStruct](f T, underlying any, extras map[string]any
4444
return nil, err
4545
}
4646
for k, v := range extras {
47-
if v == Omit {
47+
var a any = v
48+
if a == Omit {
4849
// Errors when handling ForceOmitted are ignored.
4950
if b, e := sjson.DeleteBytes(bytes, k); e == nil {
5051
bytes = b

0 commit comments

Comments
 (0)