Skip to content

Fix type misaligments in newer TypeScript versions #563

@hupf

Description

@hupf

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

Apparently the type definitions provided by this plugin don't work with newer TypeScript versions (I'm using 4.8). The result is a mismatch of the types with the TypeScript internal types, causing a Subsequent property declarations must have the same type error.

Here is the diff that solved my problem by align the types to TypeScript's ones:

diff --git a/node_modules/cordova-plugin-file/types/index.d.ts b/node_modules/cordova-plugin-file/types/index.d.ts
index 469d862..c8b1b86 100644
--- a/node_modules/cordova-plugin-file/types/index.d.ts
+++ b/node_modules/cordova-plugin-file/types/index.d.ts
@@ -44,9 +44,9 @@ interface Window {
 /** This interface represents a file system. */
 interface FileSystem {
     /* The name of the file system, unique across the list of exposed file systems. */
-    name: string;
+    readonly name: string;
     /** The root directory of the file system. */
-    root: DirectoryEntry;
+    readonly root: FileSystemDirectoryEntry;
 }
 
 /**

This issue body was partially generated by patch-package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions