Use generics to specify type of return value

I have this method on an Angular service:

 getFromSyncStorage(key: string): Promise {
    return new Promise(function (resolve, reject) {, function (v: Object) {
        if (chrome.runtime.lastError) {
          return reject(chrome.runtime.lastError);
        resolve(v && v[key]);

note that LastErrorType is

export type LastErrorType = typeof chrome.runtime.lastError;

here is the problem, sometimes I pass a key, and I know the “return” type will be an array, for example:

getAllRunHistory() {
    return this.cds.getFromSyncStorage('my-special-key');

but if I do this:

getAllRunHistory() : Promise>{
    return this.cds.getFromSyncStorage('my-special-key');

tsc will complain and say that the return type is not assignable to Promise>.

how can I use generics, so that this general-purpose getFromSyncStorage method can be typed properly?

Use typeof

I installed this NPM package:

Right now I have this in my code:

declare var chrome;

chrome.runtime.onConnect.addListener(function (port) {
  console.log('extension is connected to port:', port);
  port.onMessage.addListener(function (msg) {
    console.log('message from port:', msg);

when I get rid of the declare statement, my IDE (Webstorm) doesn’t give me any suggestions for which type to use.

Does anyone know how to properly reference/incorporate the chrome typings in a project?