diff --git a/packages/svelte/scripts/check-treeshakeability.js b/packages/svelte/scripts/check-treeshakeability.js index 6297dd535e..7b9fb816be 100644 --- a/packages/svelte/scripts/check-treeshakeability.js +++ b/packages/svelte/scripts/check-treeshakeability.js @@ -5,6 +5,9 @@ import virtual from '@rollup/plugin-virtual'; import { nodeResolve } from '@rollup/plugin-node-resolve'; import { compile } from 'svelte/compiler'; +/** + * @param {string} entry + */ async function bundle_code(entry) { const bundle = await rollup({ input: '__entry__', diff --git a/packages/svelte/scripts/process-messages/index.js b/packages/svelte/scripts/process-messages/index.js index b8f9a8f4b5..032e1fd28a 100644 --- a/packages/svelte/scripts/process-messages/index.js +++ b/packages/svelte/scripts/process-messages/index.js @@ -54,11 +54,23 @@ for (const category of fs.readdirSync('messages')) { } } +/** + * @param {string} name + * @param {string} dest + */ function transform(name, dest) { const source = fs .readFileSync(new URL(`./templates/${name}.js`, import.meta.url), 'utf-8') .replace(/\r\n/g, '\n'); + /** + * @type {Array<{ + * type: string; + * value: string; + * start: number; + * end: number + * }>} + */ const comments = []; let ast = acorn.parse(source, { @@ -135,6 +147,7 @@ function transform(name, dest) { for (const code in category) { const { messages } = category[code]; + /** @type {string[]} */ const vars = []; const group = messages.map((text, i) => { @@ -225,7 +238,7 @@ function transform(name, dest) { Block(node, context) { if (!node.value.includes('PARAMETER')) return; - const value = node.value + const value = /** @type {string} */ (node.value) .split('\n') .map((line) => { if (line === ' * MESSAGE') { diff --git a/packages/svelte/tsconfig.json b/packages/svelte/tsconfig.json index 8c27517244..062a5b1ece 100644 --- a/packages/svelte/tsconfig.json +++ b/packages/svelte/tsconfig.json @@ -31,10 +31,12 @@ } }, "include": [ - "./src", + "./*.js", + "./scripts/", + "./src/", "./tests/*/test.ts", "./tests/runtime-browser/test-ssr.ts", "./tests/*/samples/*/_config.js" ], - "exclude": ["./src/compiler/optimizer"] + "exclude": ["./scripts/process-messages/templates/", "./src/compiler/optimizer/"] }