Skip to content

Commit 9f2d7a0

Browse files
dummdidummSimon Holthausen
and
Simon Holthausen
authored
fix: add quotes to ts store regex (#403)
Fixes #402 Co-authored-by: Simon Holthausen <[email protected]>
1 parent d73319c commit 9f2d7a0

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

Diff for: src/transformers/typescript.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ function injectVarsToCode({
138138
// TODO investigate if it's possible to achieve this with a
139139
// TS transformer (previous attemps have failed)
140140
const codestores = Array.from(
141-
content.match(/\$[^\s();:,[\]{}.?!+-=*/~|&%<>^]+/g) || [],
141+
content.match(/\$[^\s();:,[\]{}.?!+-=*/~|&%<>^`"']+/g) || [],
142142
(name) => name.slice(1),
143143
).filter((name) => !JAVASCRIPT_RESERVED_KEYWORD_SET.has(name));
144144

Diff for: test/fixtures/TypeScriptImports.svelte

+4-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@
1919
const obj = {
2020
fn: () => "test",
2121
val: "test1" as const,
22-
$in: ""
22+
$in: "",
23+
a: "$",
24+
b: '$',
25+
c: `$`
2326
};
2427
let inputVal: string;
2528
const action = (node: Element, options: { id: string; }) => { node.id = options.id; };

0 commit comments

Comments
 (0)