Skip to content

Commit

Permalink
fix: add missing typescript export for init args (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanosdev authored Jan 11, 2024
1 parent a6cc9e6 commit d0b4ccd
Show file tree
Hide file tree
Showing 14 changed files with 16 additions and 1 deletion.
4 changes: 3 additions & 1 deletion rust/candid_parser/src/bindings/typescript.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,9 @@ import type { IDL } from '@dfinity/candid';
None => RcDoc::nil(),
Some(actor) => pp_actor(env, actor)
.append(RcDoc::line())
.append("export declare const idlFactory: IDL.InterfaceFactory;"),
.append("export declare const idlFactory: IDL.InterfaceFactory;")
.append(RcDoc::line())
.append("export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];"),
};
let doc = RcDoc::text(header)
.append(RcDoc::line())
Expand Down
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/actor.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,4 @@ export interface _SERVICE {
'o' : ActorMethod<[o], o>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/class.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,4 @@ export interface _SERVICE {
'set' : ActorMethod<[List], List>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/cyclic.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export type Y = Z;
export type Z = A;
export interface _SERVICE { 'f' : ActorMethod<[A, B, C, X, Y, Z], undefined> }
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/empty.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,4 @@ export interface _SERVICE {
'h' : ActorMethod<[[T, never]], { 'a' : T } | { 'b' : {} }>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/escape.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ export interface t {
}
export interface _SERVICE { '\n\'\"\'\'\"\"\r\t' : ActorMethod<[t], undefined> }
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/example.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,4 @@ export interface _SERVICE {
'x' : ActorMethod<[a, b], [[] | [a], [] | [b]]>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/fieldnat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@ export interface _SERVICE {
'foo' : ActorMethod<[{ _2_ : bigint }], { _2_ : bigint, '_2' : bigint }>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/keyword.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ export interface _SERVICE {
>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/management.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,3 +172,4 @@ export interface _SERVICE {
>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/recursion.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@ export type tree = {
{ 'leaf' : bigint };
export interface _SERVICE extends s {}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/recursive_class.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ import type { IDL } from '@dfinity/candid';
export interface s { 'next' : ActorMethod<[], Principal> }
export interface _SERVICE extends s {}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/service.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export interface _SERVICE {
>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];
1 change: 1 addition & 0 deletions rust/candid_parser/tests/assets/ok/unicode.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export interface _SERVICE {
'👀' : ActorMethod<[bigint], bigint>,
}
export declare const idlFactory: IDL.InterfaceFactory;
export declare const init: ({ IDL }: { IDL: IDL }) => IDL.Type[];

0 comments on commit d0b4ccd

Please sign in to comment.