Skip to content

Commit

Permalink
fix: add quotes to ts store regex (#403)
Browse files Browse the repository at this point in the history
Fixes #402

Co-authored-by: Simon Holthausen <[email protected]>
  • Loading branch information
dummdidumm and Simon Holthausen authored Sep 8, 2021
1 parent d73319c commit 9f2d7a0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/transformers/typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function injectVarsToCode({
// TODO investigate if it's possible to achieve this with a
// TS transformer (previous attemps have failed)
const codestores = Array.from(
content.match(/\$[^\s();:,[\]{}.?!+-=*/~|&%<>^]+/g) || [],
content.match(/\$[^\s();:,[\]{}.?!+-=*/~|&%<>^`"']+/g) || [],
(name) => name.slice(1),
).filter((name) => !JAVASCRIPT_RESERVED_KEYWORD_SET.has(name));

Expand Down
5 changes: 4 additions & 1 deletion test/fixtures/TypeScriptImports.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@
const obj = {
fn: () => "test",
val: "test1" as const,
$in: ""
$in: "",
a: "$",
b: '$',
c: `$`
};
let inputVal: string;
const action = (node: Element, options: { id: string; }) => { node.id = options.id; };
Expand Down

0 comments on commit 9f2d7a0

Please sign in to comment.