Skip to content

Commit

Permalink
TS: explicit any on object index. (#556)
Browse files Browse the repository at this point in the history
  • Loading branch information
Caparow authored Oct 17, 2024
1 parent 0553367 commit 01c6c26
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class TypeScriptTypeConverter() {

def deserializeGenericType(variable: String, target: Generic, ts: Typespace, asAny: Boolean = false): String = target match {
case gm: Generic.TMap =>
s"Object.keys($variable).reduce<any>((previous, current) => {previous[current] = ${deserializeType(s"$variable[current]", gm.valueType, ts, asAny)}; return previous; }, {})"
s"Object.keys($variable).reduce<any>((previous, current) => {previous[current] = ${deserializeType(s"$variable[current as any]", gm.valueType, ts, asAny)}; return previous; }, {})"
case gl: Generic.TList =>
gl.valueType match {
case _: Primitive => s"$variable.slice()"
Expand Down Expand Up @@ -239,7 +239,7 @@ class TypeScriptTypeConverter() {

def serializeGeneric(name: String, id: TypeId, ts: Typespace, asAny: Boolean = false): String = id match {
case m: Generic.TMap =>
s"Object.keys($name).reduce<any>((previous, current) => {previous[current] = ${serializeValue(s"$name[current]", m.valueType, ts, nonMember = true)}; return previous; }, {})"
s"Object.keys($name).reduce<any>((previous, current) => {previous[current] = ${serializeValue(s"$name[current as any]", m.valueType, ts, nonMember = true)}; return previous; }, {})"
case s: Generic.TSet =>
s.valueType match {
case _: Primitive => s"$name.slice()"
Expand Down

0 comments on commit 01c6c26

Please sign in to comment.