mirror of
https://github.com/wassname/DefinitelyTyped.git
synced 2026-09-09 11:13:57 +08:00
Make the methods generic instead of the interface
Making the interface generic limits it to only one data type. By making the get and set methods generic, you can use multiple data types on the same service
This commit is contained in:
+3
-3
@@ -75,7 +75,7 @@ declare module angular.local.storage {
|
||||
|
||||
}
|
||||
|
||||
interface ILocalStorageService<T> {
|
||||
interface ILocalStorageService {
|
||||
/**
|
||||
* Checks if the browser support the current storage type(e.g: localStorage, sessionStorage).
|
||||
* Returns: Boolean
|
||||
@@ -92,14 +92,14 @@ declare module angular.local.storage {
|
||||
* @param key
|
||||
* @param value
|
||||
*/
|
||||
set(key: string, value: T): boolean;
|
||||
set<T>(key: string, value: T): boolean;
|
||||
/**
|
||||
* Directly get a value from local storage.
|
||||
* If local storage is not supported, use cookies instead.
|
||||
* Returns: value from local storage
|
||||
* @param key
|
||||
*/
|
||||
get(key: string): T;
|
||||
get<T>(key: string): T;
|
||||
/**
|
||||
* Return array of keys for local storage, ignore keys that not owned.
|
||||
* Returns: value from local storage
|
||||
|
||||
Reference in New Issue
Block a user