Skip to content

Commit 9f287a3

Browse files
authored
(fix) defensively call ts function
It got added only recently (TS 4.0) and might break people using older TS versions in context of `svelte-check` #685
1 parent a0de300 commit 9f287a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/svelte2tsx/src/svelte2tsx/processInstanceScriptContent.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,9 @@ export function processInstanceScriptContent(
448448
}
449449
}
450450

451-
if (ts.isTypeAssertionExpression(node)) {
451+
// Defensively call function (checking for undefined) because it got added only recently (TS 4.0)
452+
// and therefore might break people using older TS versions
453+
if (ts.isTypeAssertionExpression?.(node)) {
452454
handleTypeAssertion(str, node, astOffset);
453455
}
454456

0 commit comments

Comments
 (0)