Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error TS2307: Cannot find module './declarations/cap/root' #27

Open
ildefons opened this issue Nov 3, 2022 · 2 comments
Open

error TS2307: Cannot find module './declarations/cap/root' #27

ildefons opened this issue Nov 3, 2022 · 2 comments

Comments

@ildefons
Copy link

ildefons commented Nov 3, 2022

`
Type> [email protected] start

tsc && node dist/app.js

node_modules/@psychedelic/cap-js/dist/index.d.ts:4:29 - error TS2307: Cannot find module './declarations/cap/router' or its corresponding type declarations.

4 import _ROUTER_SERVICE from "./declarations/cap/router";
~~~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@psychedelic/cap-js/dist/index.d.ts:5:27 - error TS2307: Cannot find module './declarations/cap/root' or its corresponding type declarations.

5 import _ROOT_SERVICE from "./declarations/cap/root";
~~~~~~~~~~~~~~~~~~~~~~~~~

node_modules/@psychedelic/cap-js/dist/index.d.ts:6:181 - error TS2307: Cannot find module './declarations/cap' or its corresponding type declarations.

6 import { GetUserRootBucketsResponse, GetTokenContractRootBucketResponse, GetTransactionResponse, GetTransactionsResponseBorrowed, GetIndexCanistersResponse, IndefiniteEvent } from "./declarations/cap";
~~~~~~~~~~~~~~~~~~~~

node_modules/@psychedelic/cap-js/dist/index.d.ts:7:395 - error TS2307: Cannot find module './declarations/cap' or its corresponding type declarations.

7 export { Root, Event, GetBucketResponse, GetNextCanistersResponse, GetTransactionResponse, GetTransactionsArg, GetTransactionsResponseBorrowed, GetUserTransactionsArg, IndefiniteEvent, DetailValue, WithIdArg, WithWitnessArg, Witness, Router, GetIndexCanistersResponse, GetTokenContractRootBucketArg, GetTokenContractRootBucketResponse, GetUserRootBucketsArg, GetUserRootBucketsResponse, } from "./declarations/cap";
~~~~~~~~~~~~~~~~~~~~

node_modules/@psychedelic/cap-js/dist/utils.d.ts:2:23 - error TS2307: Cannot find module './declarations/cap/root' or its corresponding type declarations.

2 import { Event } from "./declarations/cap/root";
~~~~~~~~~~~~~~~~~~~~~~~~~

Found 5 errors in 2 files.

Errors Files
4 node_modules/@psychedelic/cap-js/dist/index.d.ts:4
1 node_modules/@psychedelic/cap-js/dist/utils.d.ts:2script declarations not found when using cap-js within a typescript project:
`

@ildefons
Copy link
Author

ildefons commented Nov 3, 2022

I installed cap-js in my typescript project as indicated yarn add ..., but it fails to find the typescript declaration for root and roterand

@heldrida
Copy link
Member

@ildefons the declarations directory is only available at the source, the library has a public interface where the exports are defined. In other words, take into account the public interface of the package where the exports are defined.

You have the package.json "main" defined here https://github.com/Psychedelic/cap-js/blob/main/package.json#L8

  "main": "dist/index.js",

You can see what's exported in the library entry-point https://github.com/Psychedelic/cap-js/blob/main/src/index.ts

For types you can also find:

  "types": "dist/index.d.ts",

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants