-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Consider adding TypeScript declarations for uppy Svelte package #3123
Comments
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Nope |
This would be very nice to have, is there currently a temp work around for this? |
This is how I can use it for now, this should do as a workaround: <script lang="ts">
import Dashboard from "@uppy/dashboard";
import Uppy from '@uppy/core';
// Idk if that css import is needed
import '@uppy/core/dist/style.css';
import '@uppy/dashboard/dist/style.css';
import { onMount } from "svelte";
onMount(()=>{
const uppy = new Uppy({id: "lalal", allowMultipleUploads:false,restrictions:{maxNumberOfFiles:1,maxFileSize:10000000,allowedFileTypes:[".pdf",".docx",".pptx",".html"]}});
uppy.use(Dashboard,{inline:true, target:"#dashboard"})
});
</script>
<main>
<div id="dashboard"></div>
</main> EDIT: You do need to import the css files. |
what a horrible workaround, the same issue of types happens with react |
Note that we're done with the complete transition of the codebase to TS. It will be released soon under 4.0.0 |
Or use it today in the beta: https://www.npmjs.com/package/@uppy/svelte/v/4.0.0-beta.1 |
I tried that but am getting TypeError: Cannot read properties of undefined (reading 'id')
at Uppy.removePlugin (file:///Users/user/project/node_modules/@uppy/core/lib/Uppy.js:1031:42)
at uninstallPlugin (/Users/user/project/node_modules/@uppy/svelte/src/components/DragDrop.svelte:24:18)
at /Users/user/project/node_modules/@uppy/svelte/src/components/DragDrop.svelte:29:19
at run (/Users/user/project/node_modules/svelte/src/runtime/internal/utils.js:41:9)
at Array.forEach (<anonymous>)
at Module.run_all (/Users/user/project/node_modules/svelte/src/runtime/internal/utils.js:53:6)
at Object.render (/Users/user/project/node_modules/svelte/src/runtime/internal/ssr.js:165:4)
at Module.render_response (/Users/user/project/node_modules/@sveltejs/kit/src/runtime/server/page/render.js:171:29)
at async Module.render_page (/Users/user/project/node_modules/@sveltejs/kit/src/runtime/server/page/index.js:286:10)
at async resolve (/Users/user/project/node_modules/@sveltejs/kit/src/runtime/server/respond.js:446:18) with <script lang="ts">
import { DragDrop } from '@uppy/svelte';
import Uppy from '@uppy/core';
import '@uppy/core/dist/style.css';
import '@uppy/drag-drop/dist/style.css';
const uppy = new Uppy();
</script>
<DragDrop {uppy} /> |
@cellulosa fixed in #5186 |
We're using "@uppy/svelte": "^4.0.2" and are encountering the following TypeScript error:
As a workaround, we have to include the following directive in our code:
It would be great if official type definitions for @uppy/svelte could be provided so that we can avoid the need for this exception. |
Issue reported here: #5475. Closing this as we did actually add types to the package and it's published. But in the meantime a different build error slipped in. |
It would be great to have that so
svelte-check
will not complain anymore and for more useful information that the TypeScript compiler can work with!Currently I get:
Also I get errors when instantiating uppy, e.g.
let uppy = new Uppy()
yields the error[ts 2350] [E] only a void function can be called with the 'new' keyword
.The text was updated successfully, but these errors were encountered: