pqina / filepond-plugin-file-rename

🏷 File rename plugin for FilePond
MIT License
6 stars 3 forks source link

typescript definition file is malformed #11

Closed derekparsons718 closed 4 years ago

derekparsons718 commented 4 years ago

The file at location types/index.d.ts is throwing typescript errors:

node_modules/filepond-plugin-file-rename/types/index.d.ts:14:11 - error TS1005: ';' expected.
14         ) => string | Promise<string>;
             ~~
node_modules/filepond-plugin-file-rename/types/index.d.ts:14:14 - error TS1131: Property or signature expected.
14         ) => string | Promise<string>;
                ~~~~~~
node_modules/filepond-plugin-file-rename/types/index.d.ts:14:38 - error TS1005: '(' expected.
14         ) => string | Promise<string>;
                                        ~
node_modules/filepond-plugin-file-rename/types/index.d.ts:17:1 - error TS1128: Declaration or statement expected.
17 }%
   ~
node_modules/filepond-plugin-file-rename/types/index.d.ts:17:2 - error TS1109: Expression expected.
17 }%
    ~
node_modules/filepond-plugin-file-rename/types/index.d.ts:17:3 - error TS1109: Expression expected.
17 }%

I am using Typescript 3.9.7

I recommend rewriting the file thusly to remove errors:

declare module "filepond-plugin-file-rename" {
   const FilepondPluginFileRename: FilepondPluginFilepondPluginFileRenameProps;
   export interface FilepondPluginFilepondPluginFileRenameProps {
      /** 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>;
   }
   export default FilepondPluginFileRename;
}

Note the important changes:

These changes are intended to fix syntax errors; they shouldn't add or remove any functionality as far as I know.

rikschennink commented 4 years ago

Can you submit a PR?

boskiv commented 4 years ago

I made it https://github.com/pqina/filepond-plugin-file-rename/pull/12

rikschennink commented 4 years ago

Merged 👍