You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "peitschie (via GitHub)" <gi...@apache.org> on 2023/07/28 02:17:45 UTC

[GitHub] [cordova-plugin-file] peitschie commented on pull request #588: Rename FileSystem interface to FileSystemCordova

peitschie commented on PR #588:
URL: https://github.com/apache/cordova-plugin-file/pull/588#issuecomment-1654877663

   Unfortunately, a rename is not enough here. With this change in place, my test set (https://github.com/peitschie/cordova-plugin-file-type-tests) still sees this problem when your change here is applied.
   
   ```
   index.ts:15:37 - error TS2345: Argument of type '(value: FileSystem | PromiseLike<FileSystem>) => void' is not assignable to parameter of type '(fileSystem: FileSystemCordova) => void'.
     Types of parameters 'value' and 'fileSystem' are incompatible.
       Type 'FileSystemCordova' is not assignable to type 'FileSystem | PromiseLike<FileSystem>'.
         Type 'FileSystemCordova' is not assignable to type 'FileSystem'.
           The types of 'root.createReader().readEntries' are incompatible between these types.
             Type '(successCallback: (entries: Entry[]) => void, errorCallback?: ((error: FileError) => void) | undefined) => void' is not assignable to type '(successCallback: FileSystemEntriesCallback, errorCallback?: ErrorCallback | undefined) => void'.
               Types of parameters 'successCallback' and 'successCallback' are incompatible.
                 Types of parameters 'entries' and 'entries' are incompatible.
                   Type 'Entry[]' is not assignable to type 'FileSystemEntry[]'.
                     Type 'Entry' is not assignable to type 'FileSystemEntry'.
                       Types of property 'getParent' are incompatible.
                         Type '(successCallback: (entry: Entry) => void, errorCallback?: ((error: FileError) => void) | undefined) => void' is not assignable to type '(successCallback?: FileSystemEntryCallback | undefined, errorCallback?: ErrorCallback | undefined) => void'.
                           Types of parameters 'successCallback' and 'successCallback' are incompatible.
                             Type 'FileSystemEntryCallback | undefined' is not assignable to type '(entry: Entry) => void'.
                               Type 'undefined' is not assignable to type '(entry: Entry) => void'.
   ```
   
   Typescript's conflict arises because `Window.requestFileSystem` is defined by libdom as well as this plugin. Typescript doesn't use the interface names to match types, but rather pays attention to the interfaces being compatible with each other.
   
   The only solution is either https://github.com/apache/cordova-plugin-file/pull/536 (which lies about cordova's own types to maintain compatibility) or this plugin should move off the `requestFileSystem` method to a new method that does not conflict with libdom.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org