You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to use fileRenameFunction with a promise on angular and i was getting this error:
Type '(file: { basename: string; extension: string; name: string; }) => Promise' is not assignable to type '((options: { basename: string; extension: string; name: string; }) => string) | Promise'.
Type '(file: { basename: string; extension: string; name: string; }) => Promise' is not assignable to type '(options: { basename: string; extension: string; name: string; }) => string'.
Type 'Promise' is not assignable to type 'string'.ts(2322)
ui-upload-order.component.ts(52, 33): Did you mean to call this expression?
so i changed the type of the function to:
// @ts-ignore
import { FilePondOptions } from "filepond";
declare module "filepond" {
export interface FilePondOptions {
/** Enable or disable file renaming */
allowFileRename?: boolean;
/** A function that receives an objecting containing file information like basename, extension and name. It should return either a string value or a Promise that resolves with a string value. */
fileRenameFunction?:
| undefined
| null
| ((options: {
basename: string;
extension: string;
name: string;
}) => string | Promise<string>);
}
}
instead of:
// @ts-ignore
import { FilePondOptions } from "filepond";
declare module "filepond" {
export interface FilePondOptions {
/** Enable or disable file renaming */
allowFileRename?: boolean;
/** A function that receives an objecting containing file information like basename, extension and name. It should return either a string value or a Promise that resolves with a string value. */
fileRenameFunction?:
| undefined
| null
| ((options: {
basename: string;
extension: string;
name: string;
}) => string)
| Promise<string>;
}
}
and worked!
is it mean to be that way?
The text was updated successfully, but these errors were encountered:
I was trying to use fileRenameFunction with a promise on angular and i was getting this error:
Type '(file: { basename: string; extension: string; name: string; }) => Promise' is not assignable to type '((options: { basename: string; extension: string; name: string; }) => string) | Promise'.
Type '(file: { basename: string; extension: string; name: string; }) => Promise' is not assignable to type '(options: { basename: string; extension: string; name: string; }) => string'.
Type 'Promise' is not assignable to type 'string'.ts(2322)
ui-upload-order.component.ts(52, 33): Did you mean to call this expression?
so i changed the type of the function to:
instead of:
and worked!
is it mean to be that way?
The text was updated successfully, but these errors were encountered: