fix: add types for svelte/reactivity (#10817)

* fix: add types for svelte/reactivity - closes #10816

* simplify

---------

Co-authored-by: Rich Harris <rich.harris@vercel.com>
pull/10814/head
Rich Harris 9 months ago committed by GitHub
parent 474fc7ebe0
commit d921fb97bd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -0,0 +1,5 @@
---
'svelte': patch
---
fix: add types for svelte/reactivity

@ -29,6 +29,7 @@ await createBundle({
[`${pkg.name}/easing`]: `${dir}/src/easing/index.js`,
[`${pkg.name}/legacy`]: `${dir}/src/legacy/legacy-client.js`,
[`${pkg.name}/motion`]: `${dir}/src/motion/public.d.ts`,
[`${pkg.name}/reactivity`]: `${dir}/src/reactivity/index.js`,
[`${pkg.name}/server`]: `${dir}/src/server/index.js`,
[`${pkg.name}/store`]: `${dir}/src/store/public.d.ts`,
[`${pkg.name}/transition`]: `${dir}/src/transition/public.d.ts`,

@ -55,14 +55,15 @@ const write = [
'setYear'
];
var inited = false;
export class ReactiveDate extends Date {
#raw_time = source(super.getTime());
static #inited = false;
// We init as part of the first instance so that we can treeshake this class
#init() {
if (!ReactiveDate.#inited) {
ReactiveDate.#inited = true;
if (!inited) {
inited = true;
const proto = ReactiveDate.prototype;
const date_proto = Date.prototype;

@ -1806,6 +1806,48 @@ declare module 'svelte/motion' {
export function tweened<T>(value?: T | undefined, defaults?: TweenedOptions<T> | undefined): Tweened<T>;
}
declare module 'svelte/reactivity' {
export class Date extends Date {
constructor(...values: any[]);
#private;
}
export class Set<T> extends Set<any> {
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;
}
export class Map<K, V> extends Map<any, any> {
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;
}
}
declare module 'svelte/server' {
export function render(component: (...args: any[]) => void, options: {
props: Record<string, any>;

Loading…
Cancel
Save