Skip to content

Commit e8e0cd2

Browse files
authored
fix(interaction-output): adjust storing behavior and return type of value method (#1211)
* fix(interaction-output): allow stored value to be `null` * fix(interaction-output): restrict value method to DataSchemaValues
1 parent 5dc47c4 commit e8e0cd2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

packages/core/src/interaction-output.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,11 @@ export class InteractionOutput implements WoT.InteractionOutput {
7777
return data;
7878
}
7979

80-
async value<T>(): Promise<T> {
80+
async value<T extends WoT.DataSchemaValue>(): Promise<T> {
8181
// the value has been already read?
82-
if (this.parsedValue != null) return this.parsedValue as T;
82+
if (this.parsedValue !== undefined) {
83+
return this.parsedValue as T;
84+
}
8385

8486
if (this.dataUsed) {
8587
throw new Error("Can't read the stream once it has been already used");

0 commit comments

Comments
 (0)