MessageContent

A message's content: an ordered array of UIMessage parts.

Definition

TypeScript
type MessageContent = Array<{ [x: string]: unknown; type: string }>;

Fields

FieldTypeNotes
lengthnumberrequired — Gets or sets the length of the array. This is a number one higher than the highest index in the array.
toString() => stringrequired — Returns a string representation of an array.
toLocaleString{ (): string; (locales: string | string[], options?: Intl.NumberFormatOptions & Intl.DateTimeFormatOptions): string; }required — Returns a string representation of an array. The elements are converted to string using their toLocaleString methods.
pop() => { [x: string]: unknown; type: string; } | undefinedrequired — Removes the last element from an array and returns it.
If the array is empty, undefined is returned and the array is not modified.
push(...items: Array<{ [x: string]: unknown; type: string; }>) => numberrequired — Appends new elements to the end of an array, and returns the new length of the array.
concat{ (...items: Array<ConcatArray<{ [x: string]: unknown; type: string; }>>): Array<{ [x: string]: unknown; type: string; }>; (...items: Array<{ [x: string]: unknown; type: string; } | ConcatArray<{ [x: string]: unknown; type: string; }>>): Array<{ [x: string]: unknown; type: string; }>; }required — Combines two or more arrays.
This method returns a new array without modifying any existing arrays.
join(separator?: string) => stringrequired — Adds all the elements of an array into a string, separated by the specified separator string.
reverse() => Array<{ [x: string]: unknown; type: string; }>required — Reverses the elements in an array in place.
This method mutates the array and returns a reference to the same array.
shift() => { [x: string]: unknown; type: string; } | undefinedrequired — Removes the first element from an array and returns it.
If the array is empty, undefined is returned and the array is not modified.
slice(start?: number, end?: number) => Array<{ [x: string]: unknown; type: string; }>required — Returns a copy of a section of an array.

For both start and end, a negative index can be used to indicate an offset from the end of the array. For example, -2 refers to the second to last element of the array. | | sort | (compareFn?: ((a: { [x: string]: unknown; type: string; }, b: { [x: string]: unknown; type: string; }) => number) \| undefined) => Array<{ [x: string]: unknown; type: string; }> | required — Sorts an array in place. This method mutates the array and returns a reference to the same array. | | splice | { (start: number, deleteCount?: number): Array<{ [x: string]: unknown; type: string; }>; (start: number, deleteCount: number, ...items: Array<{ [x: string]: unknown; type: string; }>): Array<{ [x: string]: unknown; type: string; }>; } | required — Removes elements from an array and, if necessary, inserts new elements in their place, returning the deleted elements. | | unshift | (...items: Array<{ [x: string]: unknown; type: string; }>) => number | required — Inserts new elements at the start of an array, and returns the new length of the array. | | indexOf | (searchElement: { [x: string]: unknown; type: string; }, fromIndex?: number) => number | required — Returns the index of the first occurrence of a value in an array, or -1 if it is not present. | | lastIndexOf | (searchElement: { [x: string]: unknown; type: string; }, fromIndex?: number) => number | required — Returns the index of the last occurrence of a specified value in an array, or -1 if it is not present. | | every | { <S extends { [x: string]: unknown; type: string; }>(predicate: (value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => value is S, thisArg?: any): this is S[]; (predicate: (value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => unknown, thisArg?: any): boolean; } | required — Determines whether all the members of an array satisfy the specified test. | | some | (predicate: (value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => unknown, thisArg?: any) => boolean | required — Determines whether the specified callback function returns true for any element of an array. | | forEach | (callbackfn: (value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => void, thisArg?: any) => void | required — Performs the specified action for each element in an array. | | map | <U>(callbackfn: (value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => U, thisArg?: any) => Array<U> | required — Calls a defined callback function on each element of an array, and returns an array that contains the results. | | filter | { <S extends { [x: string]: unknown; type: string; }>(predicate: (value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => value is S, thisArg?: any): Array<S>; (predicate: (value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => unknown, thisArg?: any): Array<{ [x: string]: unknown; type: string; }>; } | required — Returns the elements of an array that meet the condition specified in a callback function. | | reduce | { (callbackfn: (previousValue: { [x: string]: unknown; type: string; }, currentValue: { [x: string]: unknown; type: string; }, currentIndex: number, array: Array<{ [x: string]: unknown; type: string; }>) => { [x: string]: unknown; type: string; }): { [x: string]: unknown; type: string; }; (callbackfn: (previousValue: { [x: string]: unknown; type: string; }, currentValue: { [x: string]: unknown; type: string; }, currentIndex: number, array: Array<{ [x: string]: unknown; type: string; }>) => { [x: string]: unknown; type: string; }, initialValue: { [x: string]: unknown; type: string; }): { [x: string]: unknown; type: string; }; <U>(callbackfn: (previousValue: U, currentValue: { [x: string]: unknown; type: string; }, currentIndex: number, array: Array<{ [x: string]: unknown; type: string; }>) => U, initialValue: U): U; } | required — Calls the specified callback function for all the elements in an array. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. | | reduceRight | { (callbackfn: (previousValue: { [x: string]: unknown; type: string; }, currentValue: { [x: string]: unknown; type: string; }, currentIndex: number, array: Array<{ [x: string]: unknown; type: string; }>) => { [x: string]: unknown; type: string; }): { [x: string]: unknown; type: string; }; (callbackfn: (previousValue: { [x: string]: unknown; type: string; }, currentValue: { [x: string]: unknown; type: string; }, currentIndex: number, array: Array<{ [x: string]: unknown; type: string; }>) => { [x: string]: unknown; type: string; }, initialValue: { [x: string]: unknown; type: string; }): { [x: string]: unknown; type: string; }; <U>(callbackfn: (previousValue: U, currentValue: { [x: string]: unknown; type: string; }, currentIndex: number, array: Array<{ [x: string]: unknown; type: string; }>) => U, initialValue: U): U; } | required — Calls the specified callback function for all the elements in an array, in descending order. The return value of the callback function is the accumulated result, and is provided as an argument in the next call to the callback function. | | find | { <S extends { [x: string]: unknown; type: string; }>(predicate: (value: { [x: string]: unknown; type: string; }, index: number, obj: Array<{ [x: string]: unknown; type: string; }>) => value is S, thisArg?: any): S \| undefined; (predicate: (value: { [x: string]: unknown; type: string; }, index: number, obj: Array<{ [x: string]: unknown; type: string; }>) => unknown, thisArg?: any): { [x: string]: unknown; type: string; } \| undefined; } | required — Returns the value of the first element in the array where predicate is true, and undefined otherwise. | | findIndex | (predicate: (value: { [x: string]: unknown; type: string; }, index: number, obj: Array<{ [x: string]: unknown; type: string; }>) => unknown, thisArg?: any) => number | required — Returns the index of the first element in the array where predicate is true, and -1 otherwise. | | fill | (value: { [x: string]: unknown; type: string; }, start?: number, end?: number) => Array<{ [x: string]: unknown; type: string; }> | required — Changes all array elements from start to end index to a static value and returns the modified array | | copyWithin | (target: number, start: number, end?: number) => Array<{ [x: string]: unknown; type: string; }> | required — Returns the this object after copying a section of the array identified by start and end to the same array starting at position target | | entries | () => ArrayIterator<[number, { [x: string]: unknown; type: string; }]> | required — Returns an iterable of key, value pairs for every entry in the array | | keys | () => ArrayIterator<number> | required — Returns an iterable of keys in the array | | values | () => ArrayIterator<{ [x: string]: unknown; type: string; }> | required — Returns an iterable of values in the array | | includes | (searchElement: { [x: string]: unknown; type: string; }, fromIndex?: number) => boolean | required — Determines whether an array includes a certain element, returning true or false as appropriate. | | flatMap | <U, This = undefined>(callback: (this: This, value: { [x: string]: unknown; type: string; }, index: number, array: Array<{ [x: string]: unknown; type: string; }>) => U \| ReadonlyArray<U>, thisArg?: This \| undefined) => Array<U> | required — Calls a defined callback function on each element of an array. Then, flattens the result into a new array. This is identical to a map followed by flat with depth 1. | | flat | <A, D extends number = 1>(this: A, depth?: D \| undefined) => Array<FlatArray<A, D>> | required — Returns a new array with all sub-array elements concatenated into it recursively up to the specified depth. | | at | (index: number) => { [x: string]: unknown; type: string; } \| undefined | required — Returns the item located at the specified index. | | __@iterator@390 | () => ArrayIterator<{ [x: string]: unknown; type: string; }> | required — Iterator | | __@unscopables@392 | { [x: number]: boolean \| undefined; length?: boolean \| undefined; toString?: boolean \| undefined; toLocaleString?: boolean \| undefined; pop?: boolean \| undefined; push?: boolean \| undefined; concat?: boolean \| undefined; join?: boolean \| undefined; reverse?: boolean \| undefined; shift?: boolean \| undefined; slice?: boolean \| undefined; sort?: boolean \| undefined; splice?: boolean \| undefined; unshift?: boolean \| undefined; indexOf?: boolean \| undefined; lastIndexOf?: boolean \| undefined; every?: boolean \| undefined; some?: boolean \| undefined; forEach?: boolean \| undefined; map?: boolean \| undefined; filter?: boolean \| undefined; reduce?: boolean \| undefined; reduceRight?: boolean \| undefined; find?: boolean \| undefined; findIndex?: boolean \| undefined; fill?: boolean \| undefined; copyWithin?: boolean \| undefined; entries?: boolean \| undefined; keys?: boolean \| undefined; values?: boolean \| undefined; includes?: boolean \| undefined; flatMap?: boolean \| undefined; flat?: boolean \| undefined; at?: boolean \| undefined; [Symbol.iterator]?: boolean \| undefined; readonly [Symbol.unscopables]?: boolean \| undefined; } | required — Is an object whose properties have the value 'true' when they will be absent when used in a 'with' statement. |