add type safety
This commit is contained in:
18
types.d.ts
vendored
18
types.d.ts
vendored
@ -12,9 +12,19 @@ interface GCIResult {
|
||||
url: string;
|
||||
}
|
||||
|
||||
interface APIResult {
|
||||
error?: boolean;
|
||||
payload: string;
|
||||
interface APIError {
|
||||
error: true;
|
||||
errorMessage: string;
|
||||
}
|
||||
|
||||
export { GCIAPIResult, APIResult };
|
||||
interface APISuccess<T> {
|
||||
error: false;
|
||||
payload: T;
|
||||
}
|
||||
|
||||
interface APIQueryParams {
|
||||
query: string;
|
||||
lucky?: string;
|
||||
}
|
||||
|
||||
type APIResult<T> = APIError | APISuccess<T>;
|
||||
|
||||
Reference in New Issue
Block a user