Skip to content

Quick fix shouldn't be available for converting getters to async await #43939

@Tyriar

Description

@Tyriar

Bug Report

getters cannot be async, this quick fix results in a compile error:

Screen Shot 2021-05-04 at 12 07 54 AM

Screen Shot 2021-05-04 at 12 11 27 AM

🔎 Search Terms

async, get, property

🕗 Version & Regression Information

v4.3.0-dev.20120426

⏯ Playground Link

Doesn't seem to happen here, needs TS extension in vscode

💻 Code

This was the code:

	get linuxDistro(): Promise<LinuxDistro> {
		if (!isLinux) {
			return Promise.resolve(LinuxDistro.Unknown);
		}
		const file = '/etc/os-release';
		return SymlinkSupport.existsFile(file).then(async exists => {
			if (!exists) {
				return LinuxDistro.Unknown;
			}
			const buffer = await fsPromises.readFile(file);
			const contents = buffer.toString();
			if (/NAME="?Fedora"?/.test(contents)) {
				return LinuxDistro.Fedora;
			} else if (/NAME="?Ubuntu"?/.test(contents)) {
				return LinuxDistro.Ubuntu;
			} else {
				return LinuxDistro.Unknown;
			}
		});
	}

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFixedA PR has been merged for this issueGood First IssueWell scoped, documented and has the green lightHelp WantedYou can do this

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions