Skip to content

Commit 20758ba

Browse files
committed
[JS/TS]: Fix record reflection info
Apply suggestion from @dbrattli
1 parent 58ed8d7 commit 20758ba

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

src/Fable.Transforms/Fable2Babel.fs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,12 +176,15 @@ module Reflection =
176176

177177
let fields =
178178
ent.FSharpFields
179-
|> List.map (fun fi ->
180-
let fieldName = sanitizeMemberName fi.Name |> Expression.stringLiteral
179+
|> List.choose (fun fi ->
180+
if fi.IsStatic then
181+
None
182+
else
183+
let fieldName = sanitizeMemberName fi.Name |> Expression.stringLiteral
181184

182-
let typeInfo = transformTypeInfoFor Reflection com ctx r genMap fi.FieldType
185+
let typeInfo = transformTypeInfoFor Reflection com ctx r genMap fi.FieldType
183186

184-
Expression.arrayExpression ([| fieldName; typeInfo |])
187+
Some(Expression.arrayExpression ([| fieldName; typeInfo |]))
185188
)
186189
|> List.toArray
187190

0 commit comments

Comments
 (0)