Skip to content

Commit fe50e58

Browse files
authored
chore: fix types of binding.blocker (#17177)
1 parent b94289d commit fe50e58

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

packages/svelte/src/compiler/phases/2-analyze/index.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1184,7 +1184,15 @@ function calculate_blockers(instance, scopes, analysis) {
11841184
trace_references(body, reads_writes, reads_writes);
11851185

11861186
const max = [...reads_writes].reduce((max, binding) => {
1187-
return binding.blocker ? Math.max(binding.blocker.property.value, max) : max;
1187+
if (binding.blocker) {
1188+
let property = /** @type {ESTree.SimpleLiteral & { value: number }} */ (
1189+
binding.blocker.property
1190+
);
1191+
1192+
return Math.max(property.value, max);
1193+
}
1194+
1195+
return max;
11881196
}, -1);
11891197

11901198
if (max === -1) continue;

packages/svelte/src/compiler/phases/scope.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ export class Binding {
141141
* otherwise the initial value will not have been assigned.
142142
* It is a member expression of the form `$$blockers[n]`.
143143
* TODO the blocker is set during transform which feels a bit grubby
144-
* @type {MemberExpression & { object: Identifier, property: SimpleLiteral & { value: number } } | null}
144+
* @type {MemberExpression | null}
145145
*/
146146
blocker = null;
147147

0 commit comments

Comments
 (0)