Skip to content
This repository has been archived by the owner on Mar 25, 2021. It is now read-only.

Rule await-promise: Should accept Intersection type ? #2986

Closed
yokomotod opened this issue Jul 3, 2017 · 1 comment
Closed

Rule await-promise: Should accept Intersection type ? #2986

yokomotod opened this issue Jul 3, 2017 · 1 comment

Comments

@yokomotod
Copy link
Contributor

Bug Report

  • TSLint version: 5.4.3
  • TypeScript version: 2.4.1
  • Running TSLint via: CLI

TypeScript code being linted

(with yarn add webdriverio @types/webdriverio )

import * as webdriverio from 'webdriverio';

async function init(): Promise<void> {
    const browser = webdriverio.remote({
        desiredCapabilities: {
            browserName: 'chrome'
        }
    });

    await browser.init(); // HERE, return type is `Client<RawResult<null>> & RawResult<null>` according to its .d.ts
}

with tslint.json configuration:

{
    "rules": {
        "await-promise": [true, "Client"]
    }
}

tsconfig.json configuration:

{
  "compilerOptions": {
    "target": "es2015",
    "module": "commonjs"
  }
}

Actual behavior

ERROR: sample.ts[10, 5]: 'await' of non-Promise.

Expected behavior

No error should be reported.

Now await-promise rule only considers union type, but intersection type should be accept as well ?

@yokomotod
Copy link
Contributor Author

I'm not sure how this is major case though 😅

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants