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

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions