svelte-typecheck 0.1.5 → 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +0,0 @@
1
- import{version2,package_default}from"./shared-zgnhwdjy.js";export{package_default as default,version2 as version};
@@ -1,2 +0,0 @@
1
- var version2="0.1.5",package_default={version:version2};
2
- export{version2,package_default};
package/shims/shims.d.ts DELETED
@@ -1,426 +0,0 @@
1
- /* eslint-disable typescript/no-explicit-any, typescript/consistent-type-imports, typescript/consistent-type-definitions --
2
- these stand in for Svelte's runtime, which accepts anything here; an
3
- ambient file can't import, so types come from `import("svelte")`; and
4
- the shapes keep svelte2tsx's, to diff against it. */
5
- // Ambient declarations for the helpers `emit.ts` calls in generated code.
6
- // None of them runs; each exists so the checker infers what Svelte does at
7
- // runtime. Adapted from svelte2tsx's svelte-shims-v4.d.ts (MIT,
8
- // https://github.com/sveltejs/language-tools), keeping only what `emit.ts`
9
- // uses and keeping its names, so generated code can be diffed against
10
- // svelte2tsx's when parity drifts.
11
-
12
- type SvelteAllProps = { [index: string]: any };
13
- type SvelteStore<T> = {
14
- subscribe: (run: (value: T) => any, invalidate?: any) => any;
15
- };
16
- /** Spells out a mapped type, for readable error messages. */
17
- type Expand<T> = T extends infer O ? { [K in keyof O]: O[K] } : never;
18
- type SvelteWithOptionalProps<Props, Keys extends keyof Props> = Omit<
19
- Props,
20
- Keys
21
- > &
22
- Partial<Pick<Props, Keys>>;
23
- type SveltePropsAnyFallback<Props> = {
24
- [K in keyof Props]: Props[K] extends never
25
- ? never
26
- : Props[K] extends undefined
27
- ? any
28
- : Props[K];
29
- };
30
- type SvelteSlotsAnyFallback<Slots> = {
31
- [K in keyof Slots]: {
32
- [S in keyof Slots[K]]: Slots[K][S] extends undefined ? any : Slots[K][S];
33
- };
34
- };
35
- type SvelteRender<Props, Events, Slots, Exports, Bindings> = {
36
- props: Props;
37
- events: Events;
38
- slots: Slots;
39
- exports?: Exports;
40
- bindings?: Bindings;
41
- };
42
-
43
- // --- Values: `any` stand-ins and the script's special variables.
44
-
45
- declare function __sveltets_2_any(...dummy: any[]): any;
46
- declare function __sveltets_2_empty(...dummy: any[]): {};
47
- /** `$$props`. */
48
- declare function __sveltets_2_allPropsType(): SvelteAllProps;
49
- /** `$$restProps`. */
50
- declare function __sveltets_2_restPropsType(): SvelteAllProps;
51
- /** `$: x = expr` declares `x` with `expr`'s type. */
52
- declare function __sveltets_2_invalidate<T>(getValue: () => T): T;
53
- /** `$store`: the store's value. */
54
- declare function __sveltets_2_store_get<T = any>(store: SvelteStore<T>): T;
55
- declare function __sveltets_2_store_get<
56
- Store extends SvelteStore<any> | undefined | null,
57
- >(store: Store): Store extends SvelteStore<infer T> ? T : Store;
58
-
59
- // --- Markup.
60
-
61
- /** An `{#each}` item, as a slot prop that is one is typed. */
62
- declare function __sveltets_2_unwrapArr<T>(arr: ArrayLike<T>): T;
63
-
64
- /** `{#each}` accepts an array or iterable, and in Svelte 5 `null`. */
65
- declare function __sveltets_2_ensureArray<
66
- T extends ArrayLike<unknown> | Iterable<unknown>,
67
- >(
68
- array:
69
- | T
70
- | (typeof import("svelte") extends { mount: any }
71
- ? undefined | null
72
- : never),
73
- ): T extends ArrayLike<infer U>
74
- ? U[]
75
- : T extends Iterable<infer U>
76
- ? Iterable<U>
77
- : any[];
78
-
79
- type __sveltets_2_SvelteActionReturnType = {
80
- update?: (args: any) => void;
81
- destroy?: () => void;
82
- $$_attributes?: Record<string, any>;
83
- } | void;
84
- /** `use:action`: what the action adds to the element's attributes. */
85
- declare function __sveltets_2_ensureAction<
86
- T extends __sveltets_2_SvelteActionReturnType,
87
- >(actionCall: T): T extends { $$_attributes?: any } ? T["$$_attributes"] : {};
88
- /** Joins what several actions add to an element's attributes. */
89
- declare function __sveltets_2_union<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
90
- t1: T1,
91
- t2?: T2,
92
- t3?: T3,
93
- t4?: T4,
94
- t5?: T5,
95
- t6?: T6,
96
- t7?: T7,
97
- t8?: T8,
98
- t9?: T9,
99
- t10?: T10,
100
- ): T1 & T2 & T3 & T4 & T5 & T6 & T7 & T8 & T9 & T10;
101
-
102
- type __sveltets_2_SvelteTransitionConfig = {
103
- delay?: number;
104
- duration?: number;
105
- easing?: (t: number) => number;
106
- css?: (t: number, u: number) => string;
107
- tick?: (t: number, u: number) => void;
108
- };
109
- type __sveltets_2_SvelteTransitionReturnType =
110
- | __sveltets_2_SvelteTransitionConfig
111
- | (() => __sveltets_2_SvelteTransitionConfig);
112
- /** `transition:`, `in:` and `out:`. */
113
- declare function __sveltets_2_ensureTransition(
114
- transitionCall: __sveltets_2_SvelteTransitionReturnType,
115
- ): {};
116
-
117
- // --- `$$Props`, `$$Events`, `$$Slots`.
118
-
119
- /** Checks that `$$Props` agrees with the `export let`s. */
120
- declare function __sveltets_2_ensureRightProps<Props>(props: Props): {};
121
- type KeysMatching<Obj, V> = {
122
- [K in keyof Obj]-?: Obj[K] extends V ? K : never;
123
- }[keyof Obj];
124
- /** `$$Events` as `createEventDispatcher`'s type argument: each event's detail. */
125
- declare type __sveltets_2_CustomEvents<T> = {
126
- [K in KeysMatching<T, CustomEvent>]: T[K] extends CustomEvent
127
- ? T[K]["detail"]
128
- : T[K];
129
- };
130
- /** A `<slot>` whose props `$$Slots` declares. */
131
- declare function __sveltets_2_createCreateSlot<
132
- Slots = Record<string, Record<string, any>>,
133
- >(): <SlotName extends keyof Slots>(
134
- slotName: SlotName,
135
- attrs: Slots[SlotName],
136
- ) => Record<string, any>;
137
-
138
- // --- `animate:`.
139
-
140
- declare var __sveltets_2_AnimationMove: { from: DOMRect; to: DOMRect };
141
- type __sveltets_2_SvelteAnimationReturnType = {
142
- delay?: number;
143
- duration?: number;
144
- easing?: (t: number) => number;
145
- css?: (t: number, u: number) => string;
146
- tick?: (t: number, u: number) => void;
147
- };
148
- declare function __sveltets_2_ensureAnimation(
149
- animationCall: __sveltets_2_SvelteAnimationReturnType,
150
- ): {};
151
-
152
- // --- Events.
153
-
154
- /** `createEventDispatcher<Typings>()`'s events, as `CustomEvent`s. */
155
- declare function __sveltets_2_toEventTypings<Typings>(): {
156
- [Key in keyof Typings]: CustomEvent<Typings[Key]>;
157
- };
158
- /** A DOM event an element forwards with a bare `on:event`. */
159
- declare function __sveltets_2_mapElementEvent<
160
- K extends keyof HTMLElementEventMap,
161
- >(event: K): HTMLElementEventMap[K];
162
-
163
- // --- Components.
164
-
165
- declare type ATypedSvelteComponent = {
166
- $$prop_def: any;
167
- $$events_def: any;
168
- $$slot_def: any;
169
- $on(event: string, handler: any): () => void;
170
- };
171
- declare type ConstructorOfATypedSvelteComponent = new (args: {
172
- target: any;
173
- props?: any;
174
- }) => ATypedSvelteComponent;
175
- /**
176
- * A component to `new` with its props: a class component (sveld's `.d.ts`,
177
- * Svelte 3 and 4) as it is, a Svelte 5 function component as a class.
178
- */
179
- declare function __sveltets_2_ensureComponent<
180
- T extends
181
- | ConstructorOfATypedSvelteComponent
182
- | (typeof import("svelte") extends { mount: any }
183
- ? // @ts-ignore svelte.Component doesn't exist in Svelte 4
184
- import("svelte").Component<any, any, any>
185
- : never)
186
- | null
187
- | undefined,
188
- >(
189
- type: T,
190
- ): NonNullable<
191
- T extends ConstructorOfATypedSvelteComponent
192
- ? T
193
- : typeof import("svelte") extends { mount: any }
194
- ? // @ts-ignore svelte.Component doesn't exist in Svelte 4
195
- T extends import("svelte").Component<
196
- infer Props extends Record<string, any>,
197
- infer Exports extends Record<string, any>,
198
- infer Bindings extends string
199
- >
200
- ? new (
201
- options: import("svelte").ComponentConstructorOptions<Props>,
202
- ) => import("svelte").SvelteComponent<
203
- Props,
204
- Props["$$events"],
205
- Props["$$slots"]
206
- > &
207
- Exports & { $$bindings: Bindings }
208
- : never
209
- : never
210
- >;
211
-
212
- // --- What a generated component exports: `$$render()`'s props, events and
213
- // slots, wrapped in turn.
214
-
215
- /**
216
- * Props listed in `optionalProps` (those with a default) are optional. With
217
- * none, `emit.ts` leaves the list out: an empty one would make them all so.
218
- */
219
- declare function __sveltets_2_partial<
220
- Props = {},
221
- Events = {},
222
- Slots = {},
223
- Exports = {},
224
- Bindings = string,
225
- >(
226
- render: SvelteRender<Props, Events, Slots, Exports, Bindings>,
227
- ): {
228
- props: Expand<SveltePropsAnyFallback<Props>>;
229
- events: Events;
230
- slots: Expand<SvelteSlotsAnyFallback<Slots>>;
231
- exports?: Exports;
232
- bindings?: Bindings;
233
- };
234
- declare function __sveltets_2_partial<
235
- Props = {},
236
- Events = {},
237
- Slots = {},
238
- Exports = {},
239
- Bindings = string,
240
- OptionalProps extends keyof Props = any,
241
- >(
242
- optionalProps: OptionalProps[],
243
- render: SvelteRender<Props, Events, Slots, Exports, Bindings>,
244
- ): {
245
- props: Expand<
246
- SvelteWithOptionalProps<SveltePropsAnyFallback<Props>, OptionalProps>
247
- >;
248
- events: Events;
249
- slots: Expand<SvelteSlotsAnyFallback<Slots>>;
250
- exports?: Exports;
251
- bindings?: Bindings;
252
- };
253
- /** `__sveltets_2_partial` for a component that reads `$$props` or `$$restProps`. */
254
- declare function __sveltets_2_partial_with_any<
255
- Props = {},
256
- Events = {},
257
- Slots = {},
258
- Exports = {},
259
- Bindings = string,
260
- >(
261
- render: SvelteRender<Props, Events, Slots, Exports, Bindings>,
262
- ): {
263
- props: Expand<SveltePropsAnyFallback<Props> & SvelteAllProps>;
264
- events: Events;
265
- slots: Expand<SvelteSlotsAnyFallback<Slots>>;
266
- exports?: Exports;
267
- bindings?: Bindings;
268
- };
269
- declare function __sveltets_2_partial_with_any<
270
- Props = {},
271
- Events = {},
272
- Slots = {},
273
- Exports = {},
274
- Bindings = string,
275
- OptionalProps extends keyof Props = any,
276
- >(
277
- optionalProps: OptionalProps[],
278
- render: SvelteRender<Props, Events, Slots, Exports, Bindings>,
279
- ): {
280
- props: Expand<
281
- SvelteWithOptionalProps<SveltePropsAnyFallback<Props>, OptionalProps> &
282
- SvelteAllProps
283
- >;
284
- events: Events;
285
- slots: Expand<SvelteSlotsAnyFallback<Slots>>;
286
- exports?: Exports;
287
- bindings?: Bindings;
288
- };
289
- /** A TypeScript component that reads `$$props` or `$$restProps`: any prop. */
290
- declare function __sveltets_2_with_any<
291
- Props = {},
292
- Events = {},
293
- Slots = {},
294
- Exports = {},
295
- Bindings = string,
296
- >(
297
- render: SvelteRender<Props, Events, Slots, Exports, Bindings>,
298
- ): {
299
- props: Expand<Props & SvelteAllProps>;
300
- events: Events;
301
- slots: Slots;
302
- exports?: Exports;
303
- bindings?: Bindings;
304
- };
305
- /** Any event name, with a `CustomEvent`. */
306
- declare function __sveltets_2_with_any_event<
307
- Props = {},
308
- Events = {},
309
- Slots = {},
310
- Exports = {},
311
- Bindings = string,
312
- >(
313
- render: SvelteRender<Props, Events, Slots, Exports, Bindings>,
314
- ): {
315
- props: Props;
316
- events: Events & { [evt: string]: CustomEvent<any> };
317
- slots: Slots;
318
- exports?: Exports;
319
- bindings?: Bindings;
320
- };
321
-
322
- /** A component both `new`-able (Svelte 4) and callable (Svelte 5). */
323
- interface __sveltets_2_IsomorphicComponent<
324
- Props extends Record<string, any> = any,
325
- Events extends Record<string, any> = any,
326
- Slots extends Record<string, any> = any,
327
- Exports = {},
328
- Bindings = string,
329
- > {
330
- new (
331
- options: import("svelte").ComponentConstructorOptions<Props>,
332
- ): import("svelte").SvelteComponent<Props, Events, Slots> & {
333
- $$bindings?: Bindings;
334
- } & Exports;
335
- (
336
- internal: unknown,
337
- props: Props extends Record<string, never>
338
- ? { $$events?: Events; $$slots?: Slots }
339
- : Props & { $$events?: Events; $$slots?: Slots },
340
- ): Exports & { $set?: any; $on?: any };
341
- z_$$bindings?: Bindings;
342
- }
343
- declare function __sveltets_2_isomorphic_component<
344
- Props extends Record<string, any>,
345
- Events extends Record<string, any>,
346
- Slots extends Record<string, any>,
347
- Exports extends Record<string, any>,
348
- Bindings extends string,
349
- >(
350
- klass: SvelteRender<Props, Events, Slots, Exports, Bindings>,
351
- ): __sveltets_2_IsomorphicComponent<Props, Events, Slots, Exports, Bindings>;
352
-
353
- /** A component with a default `<slot>` also takes a `children` prop. */
354
- type __sveltets_2_PropsWithChildren<Props, Slots> = Props &
355
- (Slots extends { default: any }
356
- ? Props extends Record<string, never>
357
- ? any
358
- : { children?: any }
359
- : {});
360
- declare function __sveltets_2_isomorphic_component_slots<
361
- Props extends Record<string, any>,
362
- Events extends Record<string, any>,
363
- Slots extends Record<string, any>,
364
- Exports extends Record<string, any>,
365
- Bindings extends string,
366
- >(
367
- klass: SvelteRender<Props, Events, Slots, Exports, Bindings>,
368
- ): __sveltets_2_IsomorphicComponent<
369
- __sveltets_2_PropsWithChildren<Props, Slots>,
370
- Events,
371
- Slots,
372
- Exports,
373
- Bindings
374
- >;
375
-
376
- /**
377
- * A component as Svelte 3 types one: a `SvelteComponentTyped` class, which
378
- * its `render()` typings infer props from. Svelte 3 has no function components.
379
- */
380
- declare function __sveltets_2_svelte3_component<
381
- Props extends Record<string, any>,
382
- Events extends Record<string, any>,
383
- Slots extends Record<string, any>,
384
- Exports extends Record<string, any>,
385
- Bindings extends string,
386
- >(
387
- klass: SvelteRender<Props, Events, Slots, Exports, Bindings>,
388
- ): new (
389
- options: import("svelte").ComponentConstructorOptions<Props>,
390
- ) => import("svelte").SvelteComponentTyped<Props, Events, Slots> & Exports;
391
-
392
- // Svelte 5's runes components, snippets and function bindings.
393
-
394
- /** A runes component: a function, typed by its `$props()`. */
395
- declare function __sveltets_2_fn_component<
396
- Props extends Record<string, any>,
397
- Exports extends Record<string, any>,
398
- Bindings extends string,
399
- >(klass: {
400
- props: Props;
401
- exports?: Exports;
402
- bindings?: Bindings;
403
- // @ts-ignore Svelte 5 only
404
- }): import("svelte").Component<Props, Exports, Bindings>;
405
- /** The props a runes component lets a parent `bind:`. */
406
- declare function __sveltets_$$bindings<Bindings extends string[]>(
407
- ...bindings: Bindings
408
- ): Bindings[number];
409
- /** `{@render x()}`, which takes only a snippet's result. */
410
- declare function __sveltets_2_ensureSnippet(
411
- // @ts-ignore Svelte 5 only
412
- val: ReturnType<import("svelte").Snippet> | undefined | null,
413
- ): any;
414
- /** `bind:x={get, set}`: `set` takes what `get` returns. */
415
- declare function __sveltets_2_get_set_binding<T>(
416
- get: (() => T) | null | undefined,
417
- set: (t: T) => void,
418
- ): T;
419
- /**
420
- * A `<svelte:element>` tag, as `string` when it may be any element (a
421
- * component's generic tag): typed as every element's tag, its attributes
422
- * are a union TypeScript can't represent. A smaller union keeps its tags.
423
- */
424
- declare function __sveltets_2_elementTag<T extends string>(
425
- tag: T | undefined | null,
426
- ): keyof HTMLElementTagNameMap extends T ? string : T;