Localstorage getitem and setitem JavaScript to TypeScript conversion
<p>Can someone please help me in converting the below code from JavaScript to TypeScript?</p>

<pre><code>(function () {
    'use strict';

    angular.module('testUi').service('localStorage', localStorage);

    localStorage.$inject = ['$window']

    function localStorage ($window) {
        var storage;
        if ($window.localStorage) {
            storage = $window.localStorage;
        } else {
            storage = {
                items:[],
                getItem: function(key) {
                    return this.items[key];
                },  
                setItem: function(key,value) {
                    this.items[key] = value;
                }
            };
        }

        //exports
        this.get = function (key) {
            return storage.getItem(key);
        };

        this.set = function(key,value) {
            storage.setItem(key,value);
        };
    }
}());
</code></pre>