idlFactory not in d.ts

i recently tried a different setup for canister imports. when i allow checkJs : true in my tsconfig.json, ts complains with the following error

Module '"./whitelist.did.js"' has no exported member 'idlFactory'.ts(2305)

can we add the idlFactory export to the .d.ts files?
@kpeacock

1 Like

Funny I had the same error while doing some refactoring in nns-js today too :wink:. I end up adding the following code in a .d.ts file that has the same name as the factory js file

import type { IDL } from "@dfinity/candid";
export const idlFactory: IDL.InterfaceFactory;

So maybe we don’t even need to add the all the idleFactory but only above definition.

1 Like

as long as dfx does it when generating the files and i don’t have to do it manually and the typing is correct i’m more than fine :smiley:

1 Like

It should be as simple as adding it to the compile method’s header in this file and updating the test cases: candid/typescript.rs at master · dfinity/candid · GitHub

I’ll get to this in a few days, but feel free to tag me for review if you get to it before me!

3 Likes

any news on this being integrated to dfx? :slight_smile: