Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

hasVirtualProps.md

36 lines781 Bytes

1---
2id: hasVirtualProps
3title: hasVirtualProps
4---
5​
6```ts
7function hasVirtualProps(value): value is VirtualRowProps<string | number>;
8```
9​
10Defined in: [packages/db/src/virtual-props.ts:194](https://github.com/TanStack/db/blob/main/packages/db/src/virtual-props.ts#L194)
11​
12Checks if a value has virtual properties attached. Legacy rows with the
13original four properties still match; only rows published by this version
14are guaranteed to carry `$hasPendingWrites`.
15​
16## Parameters
17​
18### value
19​
20`unknown`
21​
22The value to check
23​
24## Returns
25​
26value is VirtualRowProps\<string \| number\>
27​
28true if the value has virtual properties
29​
30## Example
31​
32```typescript
33if (hasVirtualProps(row) && row.$hasPendingWrites !== undefined) {
34 console.log('Pending local writes:', row.$hasPendingWrites)
36```