ngx-store icon indicating copy to clipboard operation
ngx-store copied to clipboard

Angular 13 and Typscript 4.4

Open Stexxen opened this issue 3 years ago • 1 comments

Simlilar to https://github.com/zoomsphere/ngx-store/issues/97 but this occurs after upgrading to Angular 13 which uses typescript 4.4

Error: node_modules/ngx-store/lib/utility/storage/storage-event.d.ts:1:22 - error TS2420: Class 'NgxStorageEvent<T>' incorrectly implements interface 'Omit<StorageEvent, "oldValue" | "newValue">'.
  Property 'initStorageEvent' is missing in type 'NgxStorageEvent<T>' but required in type 'Omit<StorageEvent, "oldValue" | "newValue">'.

StorageEvent is now defined as

interface StorageEvent extends Event {
    /**
     * Returns the key of the storage item being changed.
     */
    readonly key: string | null;
    /**
     * Returns the new value of the key of the storage item whose value is being changed.
     */
    readonly newValue: string | null;
    /**
     * Returns the old value of the key of the storage item whose value is being changed.
     */
    readonly oldValue: string | null;
    /**
     * Returns the Storage object that was affected.
     */
    readonly storageArea: Storage | null;
    /**
     * Returns the URL of the document whose storage item changed.
     */
    readonly url: string;
    initStorageEvent(type: string, bubbles?: boolean, cancelable?: boolean, key?: string | null, oldValue?: string | null, newValue?: string | null, url?: string | URL, storageArea?: Storage | null): void;
}

adding the prototype for initStorageEvent to storage-event.d.ts allows it to compile but should it be added to Omit instead?

Stexxen avatar Nov 30 '21 12:11 Stexxen

As a workaround, add "skipLibCheck": true to compilerOptions in tsconfig.json

stanciupaul avatar Aug 11 '22 08:08 stanciupaul