[bug report] dfx auto-gen `<canister>`.d.ts wrong naming

Version: dfx 0.7.0-beta.8

When dfx build a canister, let’s say it’s aliased as my_app, dfx output a set of files under the .dfx/local/canisters/my_app/ directory, the tree looks like:

my_app
├── my_app.did
├── my_app.wasm
├── my_app.did.js
├── my_app.d.ts  # <- this one got the wrong name!
└── my_app.js

my_app.d.ts should really be named my_app.did.d.ts since it contains types for the my_app.did.js, not my_app.js. It’s crucial because typescript engine need the correct name to do mapping, else I got false alarm in my IDE.

I would open an issue if dfx had its own repo but it does not. cc @kpeacock

1 Like

One more thing. Take for example this auto-gen greeting.d.ts file.

export interface Greeting {
  hello: () => Promise<string>;
}

export default Greeting;

The default export here is just a interface, not a value. But the real greeting.did.js default exports a value. The correct typing should be:

var Greeting: Greeting; // declare variable (it's ok to take same name)
export default Greeting; // export the variable, not interface

Not my neck of the woods, but I’ve filed an issue on the internal repo. Thanks for diagnosing and reporting the bug!

1 Like