chore: mesurer la forme du tableau au lieu de la supposer, et retirer les any
La branche tableau se decide sur `typeof cible.length === "number"`, ce qui est une question posee a un proxy : mesure contre le vrai `@ng-org/alien-deepsignals`, `deepSignal(new Set(...)).length` vaut `undefined` et ses `Object.keys` sont vides, tandis que `deepSignal([...]).length` est un nombre. La forme ensemble n-entre donc jamais dans cette branche, et c-est aussi celle qui ne porte aucune cle nommant un objet. Les trois `as any` des tests ajoutes et le `Iterable<any>` du harness sont types.
This commit is contained in:
@@ -213,6 +213,12 @@ export function makeReadFilteredView<S extends object>(set: S, caps: CapRegistry
|
||||
* `DeepSignal<ReadOnlyArray>` instead of a `DeepSignalSet`, and an array is addressed by
|
||||
* INDEX and counts itself with `length`. Decided from the target once, so the view never
|
||||
* grows a member the collection it wraps does not have.
|
||||
*
|
||||
* MEASURED against the real `@ng-org/alien-deepsignals` rather than assumed, because the
|
||||
* collection is itself a proxy and what it answers for a key it does not carry is its
|
||||
* business: `deepSignal(new Set(...)).length` is `undefined` and its `Object.keys` is
|
||||
* empty, while `deepSignal([...]).length` is a number. So the set form never enters this
|
||||
* branch, and the set form is also the one with no key naming an item to project.
|
||||
*/
|
||||
const arrayLike = typeof (set as { length?: unknown }).length === "number";
|
||||
/** The index a key names, or `null` when it names no position in this collection. */
|
||||
|
||||
Reference in New Issue
Block a user