Skip to content

Commit

Permalink
type fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Apr 5, 2024
1 parent f601230 commit ca80f52
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/compiler/file_uploader/expand_paths.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ async function expandDirectory(
},
Promise.resolve([])
);
} catch (error) {
throw new Error(`Error reading directory: ${error}`);
} catch (error: any) {
throw new Error(`Error reading directory: ${error.message}`);
}
}
4 changes: 2 additions & 2 deletions src/lib/candid/serde/decode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ import { DecodeVisitor } from './visitors/decode_visitor';
* @param candidType either a built-in IDL data type, or an Azle-defined super-type
* @returns the Azle representation of the data
*/
export function decode(
export function decode<T>(
candidType: CandidType | CandidType[],
data: ArrayBuffer
): any | any[] {
): T | T[] {
if (Array.isArray(candidType)) {
return decodeMultiple(candidType, data);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/candid/serde/encode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import { EncodeVisitor } from './visitors/encode_visitor';
* @param candidType either a built-in IDL data type, or an Azle-defined super-type
* @returns candid bytes
*/
export function encode(
export function encode<T>(
candidType: CandidType | CandidType[],
data: any | any[]
data: T | T[]
): Uint8Array {
if (Array.isArray(candidType)) {
if (Array.isArray(data)) {
Expand Down
2 changes: 1 addition & 1 deletion src/lib/canister_methods/execute_method.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function executeMethod(
returnCandidType: CandidType,
manual: boolean
) {
const decodedArgs = decode(paramCandidTypes, args[0]);
const decodedArgs = decode<any>(paramCandidTypes, args[0]);

const result = getResult(decodedArgs, callback);

Expand Down

0 comments on commit ca80f52

Please sign in to comment.