Psychedelic / cap-js

CAP-js is a client for CAP's HTTP API - An Open Internet Service to store transaction history for NFTs/Tokens on the Internet Computer - https://cap.ooo/
GNU General Public License v3.0
6 stars 1 forks source link

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

Open ildefons opened 2 years ago

ildefons commented 2 years ago

` Type> node1@1.0.0 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 commented 2 years ago

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 commented 1 year ago

@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",