diff --git a/src/transformers/typescript.ts b/src/transformers/typescript.ts index 675429a0..8123fdd3 100644 --- a/src/transformers/typescript.ts +++ b/src/transformers/typescript.ts @@ -152,7 +152,8 @@ function injectVarsToCode({ // TODO investigate if it's possible to achieve this with a // TS transformer (previous attemps have failed) const codestores = Array.from( - contentForCodestores.match(/\$[^\s();:,[\]{}.?!+-=*/~|&%<>^`"']+/g) || [], + contentForCodestores.match(/\$[^\s();:,[\]{}.?!+-=*/\\~|&%<>^`"'°§]+/g) || + [], (name) => name.slice(1), ).filter((name) => !JAVASCRIPT_RESERVED_KEYWORD_SET.has(name)); diff --git a/test/fixtures/TypeScriptImports.svelte b/test/fixtures/TypeScriptImports.svelte index 2a6abcde..72e5ca81 100644 --- a/test/fixtures/TypeScriptImports.svelte +++ b/test/fixtures/TypeScriptImports.svelte @@ -39,6 +39,11 @@ } $storeScriptOnly; $storeModuleScriptOnly; + + // These shouldn't count as store values: + // $\\; $$; $§; $%; $°; $(; $); $[; $]; $<; $>; $ ; $^; $`; $"; $'; + // These don't need to be tested explicitly, the test will throw and error + // at the TypeScript parsing stage if they are part of the false positives