| 132 | * @publicApi 22.0 |
| 133 | */ |
| 134 | export interface WritableResource<T> extends Resource<T> { |
| 135 | readonly value: WritableSignal<T>; |
| 136 | hasValue( |
| 137 | this: T extends undefined ? this : never, |
| 138 | ): this is WritableResource<Exclude<T, undefined>>; |
| 139 | |
| 140 | hasValue(): boolean; |
| 141 | |
| 142 | /** |
| 143 | * Convenience wrapper for `value.set`. |
| 144 | */ |
| 145 | set(value: T): void; |
| 146 | |
| 147 | /** |
| 148 | * Convenience wrapper for `value.update`. |
| 149 | */ |
| 150 | update(updater: (value: T) => T): void; |
| 151 | asReadonly(): Resource<T>; |
| 152 | |
| 153 | /** |
| 154 | * Instructs the resource to re-load any asynchronous dependency it may have. |
| 155 | * |
| 156 | * Note that the resource will not enter its reloading state until the actual backend request is |
| 157 | * made. |
| 158 | * |
| 159 | * @returns true if a reload was initiated, false if a reload was unnecessary or unsupported |
| 160 | */ |
| 161 | reload(): boolean; |
| 162 | } |
| 163 | |
| 164 | /** |
| 165 | * A `WritableResource` created through the `resource` function. |
no outgoing calls
no test coverage detected