Closed roboz0r closed 1 month ago
When writing bindings referring to System.FormattableString the resulting JavaScript string includes {{ and }} where only single characters are expected. This results in broken styles in e.g. Fable.Lit.
System.FormattableString
{{
}}
REPL
open System open Fable.Core [<Erase>] type Binding() = [<Emit("css($0, $1)")>] static member inline private cssInner(strs: string[], [<ParamArray>] args: obj[]) : obj = jsNative static member inline css(s: FormattableString) = Binding.cssInner (s.GetStrings(), s.GetArguments()) module X = let ex1 () = let color = "blue" Binding.css $""":host {{ color: {color}; }}""" let ex2 () = Binding.css $$""":host { color: blue; }""" let ex3 () = Binding.css $":host {{ color: blue; }}"
export function X_ex1() { const color = "blue"; const s = fmt`:host {{ color: ${color}; }}`; return css(s.strs, ...s.args); }
export function X_ex1() { const color = "blue"; const s = fmt`:host { color: ${color}; }`; return css(s.strs, ...s.args); }
or
export function X_ex1() { const color = "blue"; return css(`:host { color: ${color}; }`); }
dotnet fable --version 4.20.0
Description
When writing bindings referring to
System.FormattableString
the resulting JavaScript string includes{{
and}}
where only single characters are expected. This results in broken styles in e.g. Fable.Lit.Repro code
REPL
Expected and actual results
Actual
Expected
or
Related information
dotnet fable --version 4.20.0