fix: use type arguments when extending Map/Set (#10820)

* use type arguments when extending Map/Set

* changeset
pull/11260/head
Rich Harris 1 year ago committed by GitHub
parent fd5f5bb85d
commit dcfa503617
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: add type arguments to Map and Set

@ -7,6 +7,7 @@ import { map } from './utils.js';
/**
* @template K
* @template V
* @extends {Map<K, V>}
*/
export class ReactiveMap extends Map {
/** @type {Map<K, import('#client').Source<V>>} */

@ -10,6 +10,7 @@ var inited = false;
/**
* @template T
* @extends {Set<T>}
*/
export class ReactiveSet extends Set {
/** @type {Map<T, import('#client').Source<boolean>>} */

@ -1985,38 +1985,18 @@ declare module 'svelte/reactivity' {
constructor(...values: any[]);
#private;
}
class ReactiveSet<T> extends Set<any> {
class ReactiveSet<T> extends Set<T> {
constructor(value?: Iterable<T> | null | undefined);
has(value: T): boolean;
add(value: T): this;
delete(value: T): boolean;
keys(): IterableIterator<T>;
values(): IterableIterator<T>;
entries(): IterableIterator<[T, T]>;
[Symbol.iterator](): IterableIterator<T>;
#private;
}
class ReactiveMap<K, V> extends Map<any, any> {
class ReactiveMap<K, V> extends Map<K, V> {
constructor(value?: Iterable<readonly [K, V]> | null | undefined);
has(key: K): boolean;
forEach(callbackfn: (value: V, key: K, map: Map<K, V>) => void, this_arg?: any): void;
get(key: K): V | undefined;
set(key: K, value: V): this;
delete(key: K): boolean;
keys(): IterableIterator<K>;
values(): IterableIterator<V>;
entries(): IterableIterator<[K, V]>;
[Symbol.iterator](): IterableIterator<[K, V]>;
#private;
}
class ReactiveURL extends URL {

Loading…
Cancel
Save