Skip to content

isSealed

The isSealed function checks if an object is sealed, meaning new properties cannot be added and existing ones cannot be removed.

Syntax

typescript
isSealed(obj): boolean

Parameters

NameTypeDescription
objobjectObject to be checked.

Return

TypeDescription
booleanReturns true if the object is sealed, otherwise false.

Examples

typescript
const obj = Object.seal({ a: 1 });
isSealed(obj); // true
isSealed({ b: 2 }); // false

Notes

  • Internally uses Object.isSealed.
  • Sealed objects cannot have properties added or removed, but existing property values can still be changed.

References

Released under the MIT License.