Skip to content

Commit

Permalink
proposed solution for _SERVICE not found error
Browse files Browse the repository at this point in the history
  • Loading branch information
bdemann committed Jun 20, 2024
1 parent a8070d9 commit 33b9b05
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 59 deletions.
33 changes: 8 additions & 25 deletions examples/simple_erc20/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion examples/simple_erc20/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"devDependencies": {
"@dfinity/agent": "0.11.1",
"ts-node": "10.7.0",
"typescript": "4.6.3"
"typescript": "^5.2.2"
}
}
5 changes: 2 additions & 3 deletions examples/simple_erc20/test/tests.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { ActorSubclass } from '@dfinity/agent';
import { Test } from 'azle/test';
import { Service } from 'service';

import { _SERVICE } from './dfx_generated/simple_erc20/simple_erc20.did';

export function getTests(simpleErc20Canister: ActorSubclass<_SERVICE>): Test[] {
export function getTests(simpleErc20Canister: ActorSubclass<Service>): Test[] {
return [
{
name: 'empty name',
Expand Down
5 changes: 5 additions & 0 deletions examples/simple_erc20/test/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { _SERVICE } from './dfx_generated/simple_erc20/simple_erc20.did';

declare module 'service' {
export type Service = _SERVICE;
}
5 changes: 4 additions & 1 deletion examples/simple_erc20/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
"target": "ES2020",
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS"
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"paths": {
"service": ["./test/types.d.ts"]
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@
"@dfinity/agent": "0.11.1",
"simple_erc20_end_to_end_test_canister_syntax": "file:../../../../../examples/simple_erc20",
"ts-node": "10.7.0",
"typescript": "4.6.3"
"typescript": "^5.2.2"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
"moduleResolution": "node",
"allowJs": true,
"outDir": "HACK_BECAUSE_OF_ALLOW_JS",
"experimentalDecorators": true
"experimentalDecorators": true,
"paths": {
"service": ["../../../../types/service.d.ts"]
}
}
}
3 changes: 3 additions & 0 deletions tests/types/service.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
declare module 'service' {
export type Service = any;
}

0 comments on commit 33b9b05

Please sign in to comment.