From 13ac5e0a67fff1abfd0e124305b8ac4aaa5e5bc6 Mon Sep 17 00:00:00 2001 From: Antoine du Hamel Date: Tue, 26 Mar 2024 20:18:47 +0100 Subject: [PATCH] add minimal types for Svelte components --- packages/@uppy/svelte/package.json | 3 +- .../@uppy/svelte/src/{index.js => index.ts} | 2 + packages/@uppy/svelte/tsconfig.json | 44 ++++--------------- packages/@uppy/svelte/typings/index.d.ts | 5 +++ 4 files changed, 17 insertions(+), 37 deletions(-) rename packages/@uppy/svelte/src/{index.js => index.ts} (75%) create mode 100644 packages/@uppy/svelte/typings/index.d.ts diff --git a/packages/@uppy/svelte/package.json b/packages/@uppy/svelte/package.json index 076ab7d032..b0b7366c39 100644 --- a/packages/@uppy/svelte/package.json +++ b/packages/@uppy/svelte/package.json @@ -51,6 +51,7 @@ ], "files": [ "src", - "lib" + "lib", + "typings" ] } diff --git a/packages/@uppy/svelte/src/index.js b/packages/@uppy/svelte/src/index.ts similarity index 75% rename from packages/@uppy/svelte/src/index.js rename to packages/@uppy/svelte/src/index.ts index 9987023a26..866ce3517e 100644 --- a/packages/@uppy/svelte/src/index.js +++ b/packages/@uppy/svelte/src/index.ts @@ -1,3 +1,5 @@ +// eslint-disable-next-line @typescript-eslint/triple-slash-reference +/// export { default as Dashboard } from './components/Dashboard.svelte' export { default as DashboardModal } from './components/DashboardModal.svelte' export { default as DragDrop } from './components/DragDrop.svelte' diff --git a/packages/@uppy/svelte/tsconfig.json b/packages/@uppy/svelte/tsconfig.json index 7721dbeea3..47ac2958aa 100644 --- a/packages/@uppy/svelte/tsconfig.json +++ b/packages/@uppy/svelte/tsconfig.json @@ -1,41 +1,13 @@ { - "extends": "@tsconfig/svelte/tsconfig.json", + "extends": [ + "../../../tsconfig.shared.json", + "@tsconfig/svelte/tsconfig.json", + ], "compilerOptions": { - "allowImportingTsExtensions": true, - "jsx": "react-jsx", - "jsxImportSource": "preact", - "emitDeclarationOnly": false, - "noEmit": true, - "paths": { - "@uppy/core": ["../core/src/index.js"], - "@uppy/core/lib/*": ["../core/src/*"], - "@uppy/dashboard": ["../dashboard/src/index.js"], - "@uppy/dashboard/lib/*": ["../dashboard/src/*"], - "@uppy/drag-drop": ["../drag-drop/src/index.js"], - "@uppy/drag-drop/lib/*": ["../drag-drop/src/*"], - "@uppy/progress-bar": ["../progress-bar/src/index.js"], - "@uppy/progress-bar/lib/*": ["../progress-bar/src/*"], - "@uppy/status-bar": ["../status-bar/src/index.js"], - "@uppy/status-bar/lib/*": ["../status-bar/src/*"], - }, + "emitDeclarationOnly": true, + "rootDir": "./src", + "outDir": "./lib", }, - "include": ["./package.json", "./src/**/*.*"], + "include": ["./src/**/*.*", "src/**/*.svelte"], "exclude": ["node_modules/*"], - "references": [ - { - "path": "../core/tsconfig.build.json", - }, - { - "path": "../dashboard/tsconfig.build.json", - }, - { - "path": "../drag-drop/tsconfig.build.json", - }, - { - "path": "../progress-bar/tsconfig.build.json", - }, - { - "path": "../status-bar/tsconfig.build.json", - }, - ], } diff --git a/packages/@uppy/svelte/typings/index.d.ts b/packages/@uppy/svelte/typings/index.d.ts new file mode 100644 index 0000000000..0cce06400e --- /dev/null +++ b/packages/@uppy/svelte/typings/index.d.ts @@ -0,0 +1,5 @@ +declare module '*.svelte' { + import { SvelteComponent } from 'svelte' + + export default class extends SvelteComponent {} +}