Skip to content

[promise-function-async] Should not report for returned union types containing non-promise #1005

Closed
@sindresorhus

Description

@sindresorhus
{
	'@typescript-eslint/promise-function-async': [
		'error',
		{
			allowAny: true
		}
	]
}
type Return = NodeJS.ReadableStream | Promise;

const promiseOrStream = (options: Options): Return => options.stream ? asStream(options) : asPromise(options);

Expected Result

I expected it to not report as adding an async keyword there will not work.

Actual Result

It reports.

Additional Info

It should only report when the return value is a Promise.

Versions

package version
@typescript-eslint/eslint-plugin 2.3.1
@typescript-eslint/parser 2.3.1
TypeScript 3.6.3
ESLint 6.4.0
node 12.10.0
npm 6.11.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinggood first issueGood for newcomershas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions