Artifacts type missing from generated typings
See original GitHub issueI ran typechain --target=truffle-v5 --glob "build/contracts/*.json"
and it generated all my typings:
ts-gen: Running TypeChain
ts-gen: build/contracts/*.json matched 2 files.
ts-gen: Processing build\contracts\Migrations.json
ts-gen: Writing file: types\truffle-contracts\Migrations.d.ts
ts-gen: Processing build\contracts\XXX.json
ts-gen: Writing file: types\truffle-contracts\XXX.d.ts
ts-gen: Writing file: types\truffle-contracts\index.d.ts
ts-gen: Writing file: types\truffle-contracts\types.d.ts
ts-gen: � All done! Generated files: 4
However in the generated types.d.ts
it has this:
declare const artifacts: Truffle.Artifacts;
But there’s a red squiggle under Artifacts
as it doesn’t seem to exist in the generated Truffle
namespaces (it has many other definitions, like Accounts
, TransactionDetails
, TransactionLog
).
Is this a bug, or is there something else I need to do? I thought maybe I need truffle-typings
, however the readme says that’s deprecated and everything is generated here.
Thanks!
Issue Analytics
- State:
- Created 3 years ago
- Comments:14 (4 by maintainers)
Top Results From Across the Web
Cannot find name 'artifacts', 'contract' after upgrading ... - GitHub
Based on the error messages it looks like tsc didn't pick up generated typings. Can u show us your tsconfig.json file? Do you...
Read more >java - Maven - missing artifact - Stack Overflow
I am using Spring Tool Suite Eclipse extension and have maven2 downloaded. What could cause that? Thanks. EDIT: after typing "mvn clean install ......
Read more >Azure DevOps: Available artifact versions not showing up ...
The release works fine after typing in the required version (so the feed exists), just the dropdown is not showing available versions.
Read more >Type Emission - Relay
Relay guide to type emission. ... These types are included in the artifacts that relay-compiler generates to describe ... Flow; TypeScript.
Read more >Using TypeScript | Ethereum development environment for ...
It generates typing files ( *. d. ts ) based on ABI's, and it requires little to no configuration.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Yeah, I was using that as a reference - but started from an empty project to make sure I understood everything I was adding. I’d been bitten by weird behaviour with no
tsconfig.json
in the past, so not sure why it hadn’t occurred to me earlier!FWIW, on Windows, I found that using single quotes around the glob here didn’t work:
https://github.com/ethereum-ts/TypeChain/blob/849a90f81b0753def86c989e139138ea38f4721f/examples/truffle-v5/package.json#L8
If I ran the same command directly from a shell it was fine, but when running with
npm run generate-types
it would always say the glob matched nothing. Swapping the quotes to\"
solved the issue. I’m not sure I understand that either, but if you can repro, it may be worth updating there for those using it as a reference on Windows 😃Thanks!
BTW:
These are coming from the
types.d.ts
file written by the target-truffle-v5 package:https://github.com/ethereum-ts/TypeChain/blob/f63bbe3504bb82eec2d683850998d8547b05f825/packages/target-truffle-v5/static/types.d.ts#L4-L11
https://github.com/ethereum-ts/TypeChain/blob/f63bbe3504bb82eec2d683850998d8547b05f825/packages/target-truffle-v5/src/index.ts#L49-L60
This results in
expect
being achai
interface automatically in all test files.