dev: typescript 5

Massimo Melina committed Apr 20, 2025 at 17:38 UTC cd7a339ff450724c85cdc53fdbd23f5229806dbf
7 files changed +8 -8
admin/src/dialog.ts
+1 -1
@@ -215,7 +215,7 @@ export function waitDialog() {
215 return newDialog({ Content: () => h(CircularProgress, { size: '20vw'}), noFrame: true, closable: false }).close
216 }
217
218 -export function toast(msg: string | ReactElement, type: AlertType | ReactElement='info', options?: Partial<DialogOptions>) {
218 +export function toast(msg: string | ReactElement, type: AlertType | ReactElement<unknown>='info', options?: Partial<DialogOptions>) {
219 const ms = 3000
220 const dialog = newDialog({
221 ...options,
admin/src/mui.ts
+1 -1
@@ -129,7 +129,7 @@ export const IconBtn = forwardRef((props: IconBtnProps, ref: ForwardedRef<HTMLBu
129 h(Btn, { ref, ...props }))
130
131 export interface BtnProps extends Omit<ButtonProps & IconButtonProps,'disabled'|'title'|'onClick'> {
132 - icon?: SvgIconComponent | ReactElement
132 + icon?: SvgIconComponent | ReactElement<unknown>
133 title?: ReactNode
134 disabled?: boolean | string
135 progress?: boolean | number
frontend/src/components.ts
+1 -1
@@ -126,7 +126,7 @@ export function iconBtn(icon: string, onClick: MouseEventHandler, { title, ...pr
126 }
127
128 export interface BtnProps extends ComponentPropsWithoutRef<"button"> {
129 - icon?: string | ReactElement,
129 + icon?: string | ReactElement<unknown>,
130 label: string,
131 tooltip?: string,
132 toggled?: boolean,
frontend/src/uploadQueue.ts
+2 -2
@@ -320,7 +320,7 @@ async function calcHash(file: File, limit=Infinity) {
320 const res = await reader.read()
321 if (res.done) break
322 const chunk = res.value.slice(0, left)
323 - hash.update(chunk)
323 + hash.update(chunk.buffer)
324 left -= chunk.length
325 updateUI()
326 await wait(1) // cooperative: without this, the browser may freeze
@@ -348,7 +348,7 @@ async function calcHash(file: File, limit=Infinity) {
348 //if (BigInt !== Number && BigInt) return (await (await import('xxhash-wasm')).default()).create64() // at 32bit, a 9% difference is not worth having 2 libs, but 64bit is terrible without wasm
349 const ret = (await import('xxhashjs')).h32()
350 const original = ret.update
351 - ret.update = (x: Uint8Array) => original.call(ret, x.buffer) // xxhashjs only works with ArrayBuffer, not UInt8Array
351 + ret.update = (x: Buffer) => original.call(ret, x) // xxhashjs only works with ArrayBuffer, not UInt8Array
352 return ret
353 }
354 }
mui-grid-form/index.ts
+1 -1
@@ -54,7 +54,7 @@ export interface FieldProps<T> {
54 type Dict<T=any> = Record<string,T>
55
56 export interface FormProps<Values> extends Partial<BoxProps> {
57 - fields: (FieldDescriptor | ReactElement | null | undefined | false)[]
57 + fields: (FieldDescriptor | ReactElement<unknown> | null | undefined | false)[]
58 defaults?: (f:FieldDescriptor) => Partial<FieldDescriptor>
59 values: Values
60 set: (v: any, fieldK: keyof Values) => void
package.json
+1 -1
@@ -124,6 +124,6 @@
124 "nodemon": "^3.1.9",
125 "tough-cookie": "^4.0.0",
126 "tsx": "^4.19.3",
127 - "typescript": "4.9.5"
127 + "typescript": "^5.8.3"
128 }
129 }
tsconfig-web.json
+1 -1
@@ -1,6 +1,6 @@
1 {
2 "compilerOptions": {
3 - "target": "es2017",
3 + "target": "es2018",
4 "lib": [
5 "dom",
6 "dom.iterable",