Forráskód Böngészése

Loosen `metaFields.render` types again to fix React/preact typings conflict

Renée Kooi 5 éve
szülő
commit
3b54808cc7

+ 3 - 3
examples/dev/Dashboard.js

@@ -69,13 +69,13 @@ module.exports = () => {
 
   switch (UPLOADER) {
     case 'tus':
-      uppyDashboard.use(Tus, { endpoint: TUS_ENDPOINT })
+      uppyDashboard.use(Tus, { endpoint: TUS_ENDPOINT, limit: 6 })
       break
     case 's3':
-      uppyDashboard.use(AwsS3, { companionUrl: COMPANION_URL })
+      uppyDashboard.use(AwsS3, { companionUrl: COMPANION_URL, limit: 6 })
       break
     case 'xhr':
-      uppyDashboard.use(XHRUpload, { endpoint: XHR_ENDPOINT, bundle: true })
+      uppyDashboard.use(XHRUpload, { endpoint: XHR_ENDPOINT, limit: 6, bundle: true })
       break
     case 'transloadit':
       uppyDashboard.use(Transloadit, {

+ 8 - 2
packages/@uppy/dashboard/types/index.d.ts

@@ -1,13 +1,19 @@
 import Uppy = require('@uppy/core')
 import StatusBar = require('@uppy/status-bar')
 import DashboardLocale = require('./generatedLocale')
-import Preact = require('preact')
+
+type FieldRenderOptions = {
+  value: string,
+  onChange: (newVal: string) => void
+}
+
+type PreactRender = (node: any, params: object | null, ...children: any[]) => any
 
 interface MetaField {
   id: string
   name: string
   placeholder?: string
-  render?(field: {value: string, onChange(newVal: string): void}, h: typeof Preact.h): Preact.VNode
+  render?: (field: FieldRenderOptions, h: PreactRender) => any
 }
 
 declare module Dashboard {

+ 2 - 0
packages/@uppy/dashboard/types/index.test-d.ts

@@ -34,6 +34,7 @@ import Dashboard = require('../')
           expectType<(val: string) => void>(onChange)
           // `h` should be the Preact `h`
           expectError(h([], 'error'))
+          /* Currently `h` typings are limited because of a JSX type conflict between React and Preact.
           return h('input', {
             type: 'checkbox',
             checked: value === 'yes',
@@ -42,6 +43,7 @@ import Dashboard = require('../')
               onChange((event.target as HTMLInputElement).checked ? 'yes' : 'no')
             }
           })
+          */
         }
       }
     ]