File tree 4 files changed +26
-2
lines changed
test/programs/string-template-literal
4 files changed +26
-2
lines changed Original file line number Diff line number Diff line change @@ -1445,6 +1445,24 @@ class MyObject {
1445
1445
```
1446
1446
1447
1447
1448
+ ## [ string-template-literal] ( ./test/programs/string-template-literal )
1449
+
1450
+ ``` ts
1451
+ interface MyObject {
1452
+ a: ` @${string } ` ,
1453
+ b: ` @${number } ` ,
1454
+ c: ` @${bigint } ` ,
1455
+ d: ` @${boolean } ` ,
1456
+ e: ` @${undefined } ` ,
1457
+ f: ` @${null } ` ,
1458
+ g: ` ${string }@ ` ,
1459
+ h: ` ${number }@ ` ,
1460
+ i: ` ${string }@${number } ` ,
1461
+ j: ` ${string }.${string } ` ,
1462
+ }
1463
+ ```
1464
+
1465
+
1448
1466
## [ symbol] ( ./test/programs/symbol )
1449
1467
1450
1468
``` ts
Original file line number Diff line number Diff line change @@ -8,4 +8,5 @@ interface MyObject {
8
8
g : `${string } @`,
9
9
h : `${number } @`,
10
10
i : `${string } @${number } `,
11
+ j : `${string } .${string } `,
11
12
}
Original file line number Diff line number Diff line change 39
39
"i" : {
40
40
"type" : " string" ,
41
41
"pattern" : " ^.*@[0-9]*$"
42
+ },
43
+ "j" : {
44
+ "type" : " string" ,
45
+ "pattern" : " ^.*\\ ..*$"
42
46
}
43
47
},
44
48
"additionalProperties" : false ,
51
55
" f" ,
52
56
" g" ,
53
57
" h" ,
54
- " i"
58
+ " i" ,
59
+ " j"
55
60
],
56
61
"$schema" : " http://json-schema.org/draft-07/schema#"
57
62
}
Original file line number Diff line number Diff line change @@ -753,7 +753,7 @@ export class JsonSchemaGenerator {
753
753
const { texts, types} = propertyType ;
754
754
const pattern = [ ] ;
755
755
for ( let i = 0 ; i < texts . length ; i ++ ) {
756
- const text = texts [ i ] ;
756
+ const text = texts [ i ] . replace ( / [ \\ ^ $ . * + ? ( ) [ \] { } | ] / g , "\\$&" ) ;
757
757
const type = types [ i ] ;
758
758
759
759
if ( i === 0 ) {
You can’t perform that action at this time.
0 commit comments