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
Adding restriction to function parameters is difficult.
// reflect-delete-property.d.tsdeclarenamespaceReflect{/** * Removes a property from an object, equivalent to `delete target[propertyKey]`, * except it won't throw if `target[propertyKey]` is non-configurable. * @param target Object from which to remove the own property. * @param propertyKey The property name. */functiondeleteProperty<Textendsobject>(target: T,propertyKey: keyofT): boolean;}// other-file.tsconsta={b:123};Reflect.deleteProperty(a,'c');// no compiling error 🙁
Reflect.deleteProperty
is equivalent todelete
operator.Reflect.deleteProperty
is modern, but not type safe enough.The text was updated successfully, but these errors were encountered: