You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
classMyClass{func(){return42;}}constinstance=newMyClass();constinstance2=newMyClass();console.log("instance.func()",instance.func());console.log("instance2.func()",instance2.func());console.log("Object.getPrototypeOf(instance).func()",Object.getPrototypeOf(instance).func());instance.func=()=>123;console.log("instance.func()",instance.func());console.log("instance2.func()",instance2.func());console.log("Object.getPrototypeOf(instance).func()",Object.getPrototypeOf(instance).func());// Invalid error ts2790// The operand of a 'delete' operator must be optional.deleteinstance.func;
π Actual behavior
Error ts2790: The operand of a 'delete' operator must be optional.
It is wrong, because property func is defined in the instance prototype, not the instance itself and we set to the instance manually. Therefore we should be able to remove it to rollback to the prototype behavior
π Expected behavior
No compiler error and the property is used again from the prototype as before
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
Uh oh!
There was an error while loading. Please reload this page.
π Search Terms
TS2790
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play?#code/MYGwhgzhAECyCeBhcVoG8BQ1oDMCuAdsABQCU6W20ATgKYAue1B0ALAEwDclAvhnxmAB7AhHrQAlqPpgitaAF5oBWgHc4SFBDLdh0ydNnBa7RcrUbkkbaV0iIQkLQB0IIQHNiAIilijL-CIyLwAaAz85Z0CSUltBe0cXN08fQzl2KMIY0PCZdMyg2LtRRNcPbwB5ACMAK1pgemd3BgAFaiF6DvgAB1oKnGJfPONSAuyw6rqGptb2zvoevoGh-1HosjiMFcjoszJFAD5oAEZ2AGZihycylO3jMeCwu4CsjcvS5O9njPXSHO+HkV4iVrp8vJN6o1mvQ2h0ur1+oM0iNATkIdNobD5otEc81q8gRgAPRE6AASQIADcwCAJAATaC0ajtajQegQdgAdgAnAAGYmkgAqAAt5EJetRZAyhDhoGBoAByOm0Jz0WgK6DiplgTqsgC2eDE0CqYu69AkIhpzgwytV8meY04QA
π» Code
π Actual behavior
Error ts2790: The operand of a 'delete' operator must be optional.
It is wrong, because property
func
is defined in the instance prototype, not the instance itself and we set to the instance manually. Therefore we should be able to remove it to rollback to the prototype behaviorπ Expected behavior
No compiler error and the property is used again from the prototype as before
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: