GObject.String

GObject.String represents the gchararray type in the GObject type system. You can pass this class object to methods taking a GObject.Type.

Despite the name, a gchararray is not a generic array of gchar values. It is instead a nul-terminated UTF-8 string, which must be valid. In gjs, it is represented as a JS string (in UTF-16, like all JS strings).

GObject.String is actually an alias to the JS standard String constructor, and whenever you want to represent the gchararray type you can pass String instead.

Creating a new object with new GObject.String returns an empty String object.

Calling GObject.String(arg) will coerce the argument to a string.