Hi we are following along with the typegen docs on polkadotjs documentation.

and the generated code cannot find most the types. an example line:

Called: AugmentedEvent<ApiType, [caller: PalletContractsOrigin, contract: AccountId32]...

The PalletContractsOrigin is not found the types did get generated are in types/lookup if i manually add an import

import {PalletContractsOrigin} from "@polkadot/types/lookup";

then that one is found. But there are many type errors.

Found 78 errors in 5 files.

Errors  Files
     6  src/interfaces/augment-api-consts.ts:119
    18  src/interfaces/augment-api-events.ts:166
    33  src/interfaces/augment-api-query.ts:23
    20  src/interfaces/augment-api-tx.ts:191
     1  src/interfaces/index.ts:4

here is my tsconfig section:

    "paths": {
      "my-lib-name/*": ["src/*"],
      "@polkadot/api/augment": ["src/interfaces/augment-api.ts"],
      "@polkadot/types/augment": ["src/interfaces/augment-types.ts"]

i also get this error when running the generate

ERROR: No lookup definitions found: Unknown file extension ".ts" for src/interfaces/lookup.ts

1 Answer 1


I am no longer using tsc for generation of types .. I am using esno or tsx because of ESM.

npx esno node_modules/.bin/polkadot-types-from-defs --package @mangata-finance/types/interfaces --input ./src/interfaces --endpoint ./metadata.json

npx esno node_modules/.bin/polkadot-types-from-chain --package @mangata-finance/types/interfaces --endpoint ./metadata.json --output ./src/interfaces

If you can show the repo I can look.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.