From 816743e6ffc7c343660baa4a509ae286ec0c4507 Mon Sep 17 00:00:00 2001 From: ncave <777696+ncave@users.noreply.github.com> Date: Sat, 14 Oct 2023 18:23:58 -0700 Subject: [PATCH] Fixes #3541 --- src/Fable.Transforms/Fable2Babel.fs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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)