diff --git a/src/Fable.Transforms/Fable2Babel.fs b/src/Fable.Transforms/Fable2Babel.fs index 5eb2089740..08b0712785 100644 --- a/src/Fable.Transforms/Fable2Babel.fs +++ b/src/Fable.Transforms/Fable2Babel.fs @@ -83,7 +83,10 @@ module Lib = let tryJsConstructorFor purpose (com: IBabelCompiler) ctx (ent: Fable.Entity) = let isErased = match purpose with - | Annotation -> ent.IsMeasure || (FSharp2Fable.Util.isErasedOrStringEnumEntity ent && not ent.IsFSharpUnion) + | Annotation -> + ent.IsMeasure + || (ent.IsInterface && not com.IsTypeScript) + || (FSharp2Fable.Util.isErasedOrStringEnumEntity ent && not ent.IsFSharpUnion) // Historically we have used interfaces to represent JS classes in bindings, // so we allow explicit type references (e.g. for type testing) when the interface is global or imported. // But just in case we avoid referencing interfaces for reflection (as the type may not exist in actual code)