Skip to content

Commit 9bd6a64

Browse files
committed
feat: escape names containing $ or #
[converter]
1 parent 98aff7e commit 9bd6a64

File tree

5 files changed

+38
-1
lines changed

5 files changed

+38
-1
lines changed

src/Glutinum.Converter/Utils/Naming.fs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ let startWithDigit (name: string) : bool =
2525
let escapeName (name: string) : string =
2626
if
2727
name.Contains("-")
28+
|| name.Contains("$")
29+
|| name.Contains("#")
2830
|| startWithDigit name
2931
|| Keywords.fsharp.Contains name
30-
|| name.StartsWith("#")
3132
then
3233
$"``%s{name}``"
3334
else
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export type FuseSortFunctionItem = {
2+
$: string,
3+
a$: string,
4+
a$b: string
5+
}
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module rec Glutinum
2+
3+
open Fable.Core
4+
open Fable.Core.JsInterop
5+
open System
6+
7+
[<AllowNullLiteral>]
8+
[<Interface>]
9+
type FuseSortFunctionItem =
10+
abstract member ``$``: string with get, set
11+
abstract member ``a$``: string with get, set
12+
abstract member ``a$b``: string with get, set
13+
14+
(***)
15+
#r "nuget: Fable.Core"
16+
(***)
+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export type FuseSortFunctionItem = { #dd: string }
+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
module rec Glutinum
2+
3+
open Fable.Core
4+
open Fable.Core.JsInterop
5+
open System
6+
7+
[<AllowNullLiteral>]
8+
[<Interface>]
9+
type FuseSortFunctionItem =
10+
abstract member ``#dd``: string with get, set
11+
12+
(***)
13+
#r "nuget: Fable.Core"
14+
(***)

0 commit comments

Comments
 (0)