Skip to content

Commit

Permalink
fix: update return type for fetchData (#247)
Browse files Browse the repository at this point in the history
  • Loading branch information
magalimorin18 authored Oct 27, 2022
1 parent dd1e0b7 commit 7ffcd64
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import {
DecodeDataInput,
DecodeDataOutput,
EncodeDataInput,
FetchDataOutput,
} from './types/decodeData';
import { GetDataDynamicKey, GetDataInput } from './types/GetData';
import { decodeData } from './lib/decodeData';
Expand Down Expand Up @@ -208,13 +209,13 @@ export class ERC725 {

async fetchData(
keyOrKeys?: Array<string | GetDataDynamicKey>,
): Promise<DecodeDataOutput[]>;
): Promise<FetchDataOutput[]>;
async fetchData(
keyOrKeys?: string | GetDataDynamicKey,
): Promise<DecodeDataOutput>;
): Promise<FetchDataOutput>;
async fetchData(
keyOrKeys?: GetDataInput,
): Promise<DecodeDataOutput | DecodeDataOutput[]> {
): Promise<FetchDataOutput | FetchDataOutput[]> {
let keyNames: Array<string | GetDataDynamicKey>;

if (Array.isArray(keyOrKeys)) {
Expand Down
10 changes: 10 additions & 0 deletions src/types/decodeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,16 @@ export interface DecodeDataOutput {
key: string;
}

export interface FetchDataOutput {
value:
| string
| string[]
| { LSP3Profile: Record<string, any> }
| Record<string, any>;
name: string;
key: string;
}

export interface GetDataExternalSourcesOutput extends DecodeDataOutput {
value: any;
}

0 comments on commit 7ffcd64

Please sign in to comment.