Skip to content

Commit d55d2c6

Browse files
committed
typecast
1 parent 52c5a71 commit d55d2c6

File tree

1 file changed

+23
-25
lines changed
  • packages/svelte/scripts/process-messages

1 file changed

+23
-25
lines changed

packages/svelte/scripts/process-messages/index.js

Lines changed: 23 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -238,33 +238,31 @@ function transform(name, dest) {
238238
Block(node, context) {
239239
if (!node.value.includes('PARAMETER')) return;
240240

241-
const value = node.value
241+
const value = /** @type {string} */ (node.value)
242242
.split('\n')
243-
.map(
244-
/** @param {string} line */ (line) => {
245-
if (line === ' * MESSAGE') {
246-
return messages[messages.length - 1]
247-
.split('\n')
248-
.map((line) => ` * ${line}`)
249-
.join('\n');
250-
}
251-
252-
if (line.includes('PARAMETER')) {
253-
return vars
254-
.map((name, i) => {
255-
const optional = i >= group[0].vars.length;
256-
257-
return optional
258-
? ` * @param {string | undefined | null} [${name}]`
259-
: ` * @param {string} ${name}`;
260-
})
261-
.join('\n');
262-
}
263-
264-
return line;
243+
.map((line) => {
244+
if (line === ' * MESSAGE') {
245+
return messages[messages.length - 1]
246+
.split('\n')
247+
.map((line) => ` * ${line}`)
248+
.join('\n');
265249
}
266-
)
267-
.filter(/** @param {string} x */ (x) => x !== '')
250+
251+
if (line.includes('PARAMETER')) {
252+
return vars
253+
.map((name, i) => {
254+
const optional = i >= group[0].vars.length;
255+
256+
return optional
257+
? ` * @param {string | undefined | null} [${name}]`
258+
: ` * @param {string} ${name}`;
259+
})
260+
.join('\n');
261+
}
262+
263+
return line;
264+
})
265+
.filter((x) => x !== '')
268266
.join('\n');
269267

270268
if (value !== node.value) {

0 commit comments

Comments
 (0)