chanced / filedrop-svelte

File dropzone for Svelte.
MIT License
110 stars 12 forks source link

Export types #13

Closed www-chique closed 2 years ago

www-chique commented 2 years ago

Many thanks for this great module!

However, I came across some type issues. If I use declare type FileDropEvent = import("filedrop-svelte/lib/event").FileDropEvent; it doesn't work because "filedrop-svelte/lib/event" doesn't exist as it's not exported.

chanced commented 2 years ago

Hmm, it should be exported. I'll look into this later today.

Notes for myself:

https://github.com/chanced/filedrop-svelte/blob/c79817c21265e4cb09cd2a7564f5c47ef3723e0f/src/lib/index.ts#L6

https://github.com/chanced/filedrop-svelte/blob/c79817c21265e4cb09cd2a7564f5c47ef3723e0f/src/lib/event.ts#L5-L10

chanced commented 2 years ago

Ah, the import location of the types changed at some point, somehow.

Use this instead:

declare type FileDropEvent = import('filedrop-svelte/event').FileDropEvent;
declare type FileDropSelectEvent = import('filedrop-svelte/event').FileDropSelectEvent;
declare type FileDropDragEvent = import('filedrop-svelte/event').FileDropDragEvent;

note to self: update the README

www-chique commented 2 years ago

It works now. Many thanks.