You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I compile the project using yarn compile, I get the following error
Generating typings for: 17 artifacts in dir: src/types/typechain for target: ethers-v5
An unexpected error occurred:
SyntaxError: 'from' expected. (4:24)
2 | /* tslint:disable */
3 | /* eslint-disable */
> 4 | import type * as from './..';
| ^
5 | export type { };
6 | export * as accountAbstraction from './@account-abstraction';
7 | export * as openzeppelin from './@openzeppelin';
at D (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/parser-typescript.js:1:17100)
at LT (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/parser-typescript.js:257:10765)
at Object.RT [as parse] (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/parser-typescript.js:257:11074)
at Object.parse (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/index.js:7515:23)
at coreFormat (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/index.js:8829:18)
at formatWithCursor2 (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/index.js:9021:18)
at /Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/index.js:38176:12
at Object.format (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/prettier/index.js:38190:12)
at prettierOutputTransformer (/Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/typechain/src/codegen/outputTransformers/prettier.ts:8:19)
at /Users/nicholasaddison/Documents/workspaces/abstract-accounts/node_modules/typechain/src/typechain/io.ts:22:33 {
loc: { start: { line: 4, column: 24 } },
codeFrame: '\x1B[0m \x1B[90m 2 |\x1B[39m \x1B[90m/* tslint:disable */\x1B[39m\x1B[0m\n' +
'\x1B[0m \x1B[90m 3 |\x1B[39m \x1B[90m/* eslint-disable */\x1B[39m\x1B[0m\n' +
"\x1B[0m\x1B[31m\x1B[1m>\x1B[22m\x1B[39m\x1B[90m 4 |\x1B[39m \x1B[36mimport\x1B[39m type \x1B[33m*\x1B[39m \x1B[36mas\x1B[39m \x1B[36mfrom\x1B[39m \x1B[32m'./..'\x1B[39m\x1B[33m;\x1B[39m\x1B[0m\n" +
'\x1B[0m \x1B[90m |\x1B[39m \x1B[31m\x1B[1m^\x1B[22m\x1B[39m\x1B[0m\n' +
'\x1B[0m \x1B[90m 5 |\x1B[39m \x1B[36mexport\x1B[39m type { }\x1B[33m;\x1B[39m\x1B[0m\n' +
"\x1B[0m \x1B[90m 6 |\x1B[39m \x1B[36mexport\x1B[39m \x1B[33m*\x1B[39m \x1B[36mas\x1B[39m accountAbstraction \x1B[36mfrom\x1B[39m \x1B[32m'./@account-abstraction'\x1B[39m\x1B[33m;\x1B[39m\x1B[0m\n" +
"\x1B[0m \x1B[90m 7 |\x1B[39m \x1B[36mexport\x1B[39m \x1B[33m*\x1B[39m \x1B[36mas\x1B[39m openzeppelin \x1B[36mfrom\x1B[39m \x1B[32m'./@openzeppelin'\x1B[39m\x1B[33m;\x1B[39m\x1B[0m"
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Interestingly, types are created in the src/types and src/types/types folders. If I just use the Hardhat typechain plug-in defaults, types are created in typechain-types and the project root.
I've kept the installed packages to a minimum to try and isolate the problem
This seems to be caused by Typechain normalizing files/directories names by simply removing special symbols; in this case, it's importing from "./..", which after normalized, becomes "".
We got a similar issue, but with version-named folders:
importtype*as047from'./0.4.7';
047 is the naive normalization of the path, but isn't a valid identifier, and prettier is rightfully complaining.
Whatever function is generating those alias import names, should make sure they're both unique and valid.
I'm trying to use the ERC-4337 contracts in the @account-abstraction/contracts package.
I've created a simple Hardhat project that attempts to compile and generate types for the @account-abstraction contracts. To replicate, please use the
typechain
branch as that is barebones.https://github.com/naddison36/abstract-accounts/tree/typechain
When I compile the project using
yarn compile
, I get the following errorInterestingly, types are created in the
src/types
andsrc/types/types
folders. If I just use the Hardhat typechain plug-in defaults, types are created intypechain-types
and the project root.I've kept the installed packages to a minimum to try and isolate the problem
The typechain config in Hardhat is
The text was updated successfully, but these errors were encountered: