Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[Bug]: Delete property from Optional-Chaining  #35084

Copy link
Copy link

Description

@OlegLustenko
Issue body actions

TypeScript Version: 3.8.0-dev.20191112, 3.7.2

Search Terms:

Code

interface z {
    name?: string;
}
var z: z = {
    name: 'qwe'
}
delete z?.name;
console.log(z);

Expected behavior: property is deleted from the object
Actual behavior: property still exists in the object
Playground Link: http://www.typescriptlang.org/play/?ts=3.8.0-dev.20191112#

Related Issues: I haven't found any related bugs

compiles to:

...
delete ((_a = z) === null || _a === void 0 ? void 0 : _a.name);

I think it should compile to something like this:

((_a = z) === null || _a === void 0 ? void 0 : delete _a.name);
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptA bug in TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

Morty Proxy This is a proxified and sanitized view of the page, visit original site.