Skip to content

Commit 4f1f4cc

Browse files
committed
$props will never be null
1 parent ffec768 commit 4f1f4cc

File tree

1 file changed

+6
-0
lines changed
  • packages/svelte/src/compiler/phases

1 file changed

+6
-0
lines changed

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const UNKNOWN = Symbol('unknown');
2121
/** Includes `BigInt` */
2222
export const NUMBER = Symbol('number');
2323
export const STRING = Symbol('string');
24+
const NOT_NULL = Symbol('not null');
2425
/** @typedef {NUMBER | STRING | UNKNOWN | undefined | boolean} TYPE */
2526
/** @type {Record<string, [type: TYPE | TYPE[], fn?: Function]>} */
2627
const globals = {
@@ -298,6 +299,11 @@ class Evaluation {
298299
binding.scope.evaluate(/** @type {Expression} */ (binding.initial), this.values);
299300
break;
300301
}
302+
303+
if (binding.kind === 'rest_prop' && !binding.updated) {
304+
this.values.add(NOT_NULL);
305+
break;
306+
}
301307
} else if (expression.name === 'undefined') {
302308
this.values.add(undefined);
303309
break;

0 commit comments

Comments
 (0)