Skip to content

Object ​

Object helpers and Proxy.

Always available

No import needed. These names are in scope in every file.

Object class ​

ts
class Object

Object namespace. Static utilities for object reflection, property inspection, and shallow copying.

Object.keys ​

ts
static keys(obj: any): Array<string>

Return an array of all own enumerable property names of obj. Works on plain objects, class instances, and struct values.

Object.values ​

ts
static values(obj: any): Array<any>

Return an array of all own enumerable property values of obj. Works on plain objects, class instances, and struct values.

Object.entries ​

ts
static entries(obj: any): Array<[string, any]>

Return an array of [key, value] pairs for all own enumerable properties of obj. Works on plain objects, class instances, and struct values.

Object.fromEntries ​

ts
static fromEntries(entries: Array<any>): any

Recreate an object from an array of key-value pairs.

Object.assign ​

ts
static assign(target: any, ...sources: Array<any>): any

Copy all own properties from one or more source objects into target. Returns target.

Object.freeze ​

ts
static freeze(obj: any): any

Freeze obj, preventing all property additions, deletions, and modifications. Returns obj.

Object.seal ​

ts
static seal(obj: any): any

Seal obj, preventing adding or removing properties, but allowing modifications to existing property values. Returns obj.

Object.isFrozen ​

ts
static isFrozen(obj: any): boolean

Return true if obj is frozen, or if obj is a primitive.

Object.isSealed ​

ts
static isSealed(obj: any): boolean

Return true if obj is sealed or frozen, or if obj is a primitive.

Object.hasOwn ​

ts
static hasOwn(obj: any, prop: string): boolean

Return true if obj has prop as an own property.

Proxy class ​

ts
class Proxy

Base class for objects that answer undeclared names with code. Extend it and override the hooks you need. A hook runs only when the name is not declared on the class (declared fields, getters and methods resolve normally and never reach a hook). On a value typed as a Proxy subclass, an undeclared member is accepted and typed any.

Proxy.getProperty ​

ts
getProperty(name: string): any

Runs for obj.name / obj[name] when name is undeclared.

Proxy.setProperty ​

ts
setProperty(name: string, value: any): void

Runs for obj.name = value when name is undeclared.

Proxy.callProperty ​

ts
callProperty(name: string, ...args: Array<any>): any

Runs for obj.name(...args) when name is undeclared.

Proxy.hasProperty ​

ts
hasProperty(name: string): boolean

Runs for name in obj when name is undeclared.

Proxy.deleteProperty ​

ts
deleteProperty(name: string): boolean

Runs for delete obj[name] when name is undeclared.

Other members of Proxy ​

ts
constructor()

Generated from lang/types/builtin_object.d.tks in the ThicketScript repository.