question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

delete doesn't count as turning a property to undefined

See original GitHub issue
function plus1(x) {
    return x + 1;
}
let y: { z: number } = {
    z: 5
};
delete y.z; // if you switch this line to y.z = undefined it will produce an error
let result = plus1(y.z);

This should return an error because type undefined is not compatible with type number

Also lovely work so far!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Mathspycommented, Jun 5, 2020

Sweet! Thank you for the amazing work! ❤️

1reaction
JSMonkcommented, Apr 25, 2020

Unfortunately, there is no kind of list. So, if you will report it in issues, it will be great.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Is it possible to delete a property from an object by setting it to ...
You've set the property value to be undefined but the property still exists. Use delete o.x to remove the property entirely. – evolutionxbox....
Read more >
delete operator - JavaScript - MDN Web Docs - Mozilla
The delete operator removes a property from an object. If the property's value is an object and there are no more references to...
Read more >
delete obj.property vs obj.property = undefined - this vs that
Calling obj.property = undefined sets the value of property to undefined . The property is still there and appears if we iterate the...
Read more >
Data Structures: Objects and Arrays - Eloquent JavaScript
Reading a property that doesn't exist will give you the value undefined . It is possible to assign a value to a property...
Read more >
JSON methods, toJSON - The Modern JavaScript Tutorial
Properties that store undefined .
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found