Skip to content

Commit

Permalink
fix(interaction-output): adjust storing behavior and return type of `…
Browse files Browse the repository at this point in the history
…value` method (#1211)

* fix(interaction-output): allow stored value to be `null`

* fix(interaction-output): restrict value method to DataSchemaValues
  • Loading branch information
JKRhb authored Jan 11, 2024
1 parent 5dc47c4 commit e8e0cd2
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/interaction-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,11 @@ export class InteractionOutput implements WoT.InteractionOutput {
return data;
}

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

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

0 comments on commit e8e0cd2

Please sign in to comment.