-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
npm installs wrong version #61
Comments
After using patch package this is the patch file I got, if that helps diff --git a/node_modules/svelte-french-toast/dist/components/ToastBar.svelte.d.ts b/node_modules/svelte-french-toast/dist/components/ToastBar.svelte.d.ts
index c4734e0..54b0f7b 100644
--- a/node_modules/svelte-french-toast/dist/components/ToastBar.svelte.d.ts
+++ b/node_modules/svelte-french-toast/dist/components/ToastBar.svelte.d.ts
@@ -17,7 +17,7 @@ declare const __propDef: {
default: {
ToastIcon: typeof ToastIcon;
ToastMessage: typeof ToastMessage;
- toast: Toast;
+ toast: Toast<Record<string, any>>;
};
};
};
diff --git a/node_modules/svelte-french-toast/dist/components/ToastMessage.svelte b/node_modules/svelte-french-toast/dist/components/ToastMessage.svelte
index 79217d7..cb54284 100644
--- a/node_modules/svelte-french-toast/dist/components/ToastMessage.svelte
+++ b/node_modules/svelte-french-toast/dist/components/ToastMessage.svelte
@@ -5,7 +5,7 @@
{#if typeof toast.message === 'string'}
{toast.message}
{:else}
- <svelte:component this={toast.message} {toast} />
+ <svelte:component this={toast.message} {toast} {...toast.props} />
{/if}
</div>
diff --git a/node_modules/svelte-french-toast/dist/core/toast.d.ts b/node_modules/svelte-french-toast/dist/core/toast.d.ts
index 6f96c6b..7c6c3dd 100644
--- a/node_modules/svelte-french-toast/dist/core/toast.d.ts
+++ b/node_modules/svelte-french-toast/dist/core/toast.d.ts
@@ -1,17 +1,18 @@
-import { type Renderable, type DefaultToastOptions, type ToastOptions, type ValueOrFunction } from './types';
-type ToastHandler = (message: Renderable, options?: ToastOptions) => string;
+import { type Toast, type Renderable, type DefaultToastOptions, type ToastOptions, type ValueOrFunction } from './types';
+type Message<T extends Record<string, any> = Record<string, any>> = Renderable<T>;
+type ToastHandler = <T extends Record<string, any> = Record<string, any>>(message: Message<T>, options?: ToastOptions<T>) => string;
declare const toast: {
- (message: Renderable, opts?: ToastOptions): string;
+ <T extends Record<string, any> = Record<string, any>>(message: Message<T>, opts?: Partial<Pick<Toast<T>, "id" | "icon" | "duration" | "ariaProps" | "className" | "style" | "position" | "iconTheme" | "props">> | undefined): string;
error: ToastHandler;
success: ToastHandler;
loading: ToastHandler;
custom: ToastHandler;
dismiss(toastId?: string): void;
remove(toastId?: string): void;
- promise<T>(promise: Promise<T>, msgs: {
+ promise<T_1>(promise: Promise<T_1>, msgs: {
loading: Renderable;
- success: ValueOrFunction<Renderable, T>;
+ success: ValueOrFunction<Renderable, T_1>;
error: ValueOrFunction<Renderable, any>;
- }, opts?: DefaultToastOptions): Promise<T>;
+ }, opts?: DefaultToastOptions): Promise<T_1>;
};
export default toast;
diff --git a/node_modules/svelte-french-toast/dist/core/toast.js b/node_modules/svelte-french-toast/dist/core/toast.js
index 53f4139..9effa0d 100644
--- a/node_modules/svelte-french-toast/dist/core/toast.js
+++ b/node_modules/svelte-french-toast/dist/core/toast.js
@@ -11,7 +11,11 @@ const createToast = (message, type = 'blank', opts) => ({
},
message,
pauseDuration: 0,
- ...opts,
+ icon: opts?.icon,
+ duration: opts?.duration,
+ iconTheme: opts?.iconTheme,
+ position: opts?.position,
+ props: opts?.props,
id: opts?.id || genId()
});
const createHandler = (type) => (message, options) => {
diff --git a/node_modules/svelte-french-toast/dist/core/types.d.ts b/node_modules/svelte-french-toast/dist/core/types.d.ts
index 14d2859..3146478 100644
--- a/node_modules/svelte-french-toast/dist/core/types.d.ts
+++ b/node_modules/svelte-french-toast/dist/core/types.d.ts
@@ -8,7 +8,7 @@ export type ToastType = 'success' | 'error' | 'loading' | 'blank' | 'custom';
* - Use `top-start` instead of `top-left`.
* - Use `top-end` instead of `top-right`. */
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end';
-export type Renderable = typeof SvelteComponent<any> | string | null;
+export type Renderable<T extends Record<string, any> = Record<string, any>> = typeof SvelteComponent<T> | string | null;
export interface IconTheme {
primary: string;
secondary: string;
@@ -16,14 +16,15 @@ export interface IconTheme {
export type ValueFunction<TValue, TArg> = (arg: TArg) => TValue;
export type ValueOrFunction<TValue, TArg> = TValue | ValueFunction<TValue, TArg>;
export declare const resolveValue: <TValue, TArg>(valOrFunction: ValueOrFunction<TValue, TArg>, arg: TArg) => TValue;
-export interface Toast {
+export interface Toast<T extends Record<string, any> = Record<string, any>> {
type: ToastType;
id: string;
- message: Renderable;
+ message: Renderable<T>;
icon?: Renderable;
duration?: number;
pauseDuration: number;
position?: ToastPosition;
+ props?: Omit<T, 'toast'>;
ariaProps: {
role: 'status' | 'alert';
'aria-live': 'assertive' | 'off' | 'polite';
@@ -35,10 +36,10 @@ export interface Toast {
visible: boolean;
height?: number;
}
-export type DOMToast = Toast & {
+export type DOMToast<T extends Record<string, any> = Record<string, any>> = Toast<T> & {
offset: number;
};
-export type ToastOptions = Partial<Pick<Toast, 'id' | 'icon' | 'duration' | 'ariaProps' | 'className' | 'style' | 'position' | 'iconTheme'>>;
+export type ToastOptions<T extends Record<string, any> = Record<string, any>> = Partial<Pick<Toast<T>, 'id' | 'icon' | 'duration' | 'ariaProps' | 'className' | 'style' | 'position' | 'iconTheme' | 'props'>>;
export type DefaultToastOptions = ToastOptions & {
[key in ToastType]?: ToastOptions;
};
diff --git a/node_modules/svelte-french-toast/dist/core/use-toaster.d.ts b/node_modules/svelte-french-toast/dist/core/use-toaster.d.ts
index 0460c99..15c6f62 100644
--- a/node_modules/svelte-french-toast/dist/core/use-toaster.d.ts
+++ b/node_modules/svelte-french-toast/dist/core/use-toaster.d.ts
@@ -6,7 +6,7 @@ declare function calculateOffset(toast: Toast, $toasts: Toast[], opts?: {
defaultPosition?: ToastPosition;
}): number;
export default function useToaster(toastOptions?: ToastOptions): {
- toasts: import("svelte/store").Writable<Toast[]>;
+ toasts: import("svelte/store").Writable<Toast<Record<string, any>>[]>;
handlers: {
startPause(): void;
endPause(): void;
|
Closed
Till the new package is published, I've published |
I also make a small change (LeoDog896@b68c867) to fix style and className propagation. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey.
I have been trying to create a
Rich Content
toast and had troubles passing down props, like so:I got type errors saying that
props
does not exist inPartial<Pick<Toast, "id" | "icon" | "duration"...
and in my project,RichComponent
did show up inside the toast butsomeProp
resolved asundefined
.I dived into the package
dist
folder and couldn't quite figure out what's wrong, so I cloned the entire repo and have built the package usingnpm run package
. I then copied the newly createddist
folder into my project, essentially overriding the one installed fromnpm
, and...... everything seems to work,
except I am still getting type errors, but I can deal with those.There are certainly some differences between the version I have built myself and the one coming from npm, unless I have done something incredibly stupid (which is likely)
The text was updated successfully, but these errors were encountered: