Skip to content

Commit 6403a25

Browse files
committed
fix type so optional chaining is unnecessary
1 parent f8bb4a3 commit 6403a25

File tree

1 file changed

+5
-5
lines changed
  • packages/svelte/src/compiler/migrate

1 file changed

+5
-5
lines changed

packages/svelte/src/compiler/migrate/index.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -948,13 +948,13 @@ const instance_script = {
948948
const [, expression_ids] = extract_all_identifiers_from_expression(
949949
node.body.expression.right
950950
);
951-
const bindings = ids.map((id) => state.scope.get(id.name));
952-
const reassigned_bindings = bindings.filter((b) => b?.reassigned);
951+
const bindings = ids.map((id) => /** @type {Binding} */ (state.scope.get(id.name)));
952+
const reassigned_bindings = bindings.filter((b) => b.reassigned);
953953

954-
if (!bindings.some((b) => b?.kind === 'state')) {
954+
if (!bindings.some((b) => b.kind === 'state')) {
955955
if (
956956
node.body.expression.right.type !== 'Literal' &&
957-
!bindings.some((b) => b?.kind === 'store_sub') &&
957+
!bindings.some((b) => b.kind === 'store_sub') &&
958958
node.body.expression.left.type !== 'MemberExpression'
959959
) {
960960
let { start, end } = /** @type {{ start: number, end: number }} */ (
@@ -1001,7 +1001,7 @@ const instance_script = {
10011001
);
10021002
}
10031003
}
1004-
if (expression_ids.length === 0 && !bindings.some((b) => b?.kind === 'store_sub')) {
1004+
if (expression_ids.length === 0 && !bindings.some((b) => b.kind === 'store_sub')) {
10051005
state.str.remove(/** @type {number} */ (node.start), /** @type {number} */ (node.end));
10061006
return;
10071007
}

0 commit comments

Comments
 (0)