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

Can't build root tsconfig (for e.g. IDE) without running pnpm build first #372

Open
sublimator opened this issue Feb 9, 2023 · 2 comments

Comments

@sublimator
Copy link
Member

yarn run v1.22.19
interledgerjs/node_modules/.bin/tsc -p tsconfig.json --noEmit
packages/connection-tag-utils/test/index.spec.ts:1:22 - error TS2307: Cannot find module '..' or its corresponding type declarations.

1 import * as Tag from '..'
                       ~~~~

packages/pay/src/controllers/asset-details.ts:1:56 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

1 import { ConnectionAssetDetailsFrame, FrameType } from 'ilp-protocol-stream/dist/src/packet'
                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/src/controllers/establishment.ts:7:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

7 } from 'ilp-protocol-stream/dist/src/packet'
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/src/controllers/failure.ts:7:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

7 } from 'ilp-protocol-stream/dist/src/packet'
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/src/request.ts:15:58 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

15 import { Frame, FrameType, Packet as StreamPacket } from 'ilp-protocol-stream/dist/src/packet'
                                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/src/request.ts:156:11 - error TS2532: Object is possibly 'undefined'.

156           responseFrames.map((f) => FrameType[f.type]).join()
              ~~~~~~~~~~~~~~

packages/pay/src/senders/asset-probe.ts:4:43 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

4 import { ConnectionNewAddressFrame } from 'ilp-protocol-stream/dist/src/packet'
                                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/src/senders/connection-closer.ts:2:49 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

2 import { ConnectionCloseFrame, ErrorCode } from 'ilp-protocol-stream/dist/src/packet'
                                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/src/senders/payment.ts:8:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

8 } from 'ilp-protocol-stream/dist/src/packet'
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/test/helpers/plugin.ts:17:24 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/util/plugin-interface' or its corresponding type declarations.

17 import { Plugin } from 'ilp-protocol-stream/dist/src/util/plugin-interface'
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/test/integration.spec.ts:15:24 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/util/plugin-interface' or its corresponding type declarations.

15 import { Plugin } from 'ilp-protocol-stream/dist/src/util/plugin-interface'
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/test/payment.spec.ts:21:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

21 } from 'ilp-protocol-stream/dist/src/packet'
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/test/reply.spec.ts:18:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

18 } from 'ilp-protocol-stream/dist/src/packet'
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/pay/test/setup.spec.ts:12:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

12 } from 'ilp-protocol-stream/dist/src/packet'
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/src/index.ts:22:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

22 } from 'ilp-protocol-stream/dist/src/packet'
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/src/index.ts:23:27 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/util/long' or its corresponding type declarations.

23 import { LongValue } from 'ilp-protocol-stream/dist/src/util/long'
                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/src/index.ts:24:31 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/util/receipt' or its corresponding type declarations.

24 import { createReceipt } from 'ilp-protocol-stream/dist/src/util/receipt'
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/src/index.ts:340:8 - error TS7006: Parameter 'frame' implicitly has an 'any' type.

340       (frame): frame is ConnectionCloseFrame => frame.type === FrameType.ConnectionClose
           ~~~~~

packages/stream-receiver/src/index.ts:355:8 - error TS7006: Parameter 'frame' implicitly has an 'any' type.

355       (frame) => frame.type === FrameType.ConnectionNewAddress
           ~~~~~

packages/stream-receiver/src/utils.ts:1:31 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

1 import { Frame, Packet } from 'ilp-protocol-stream/dist/src/packet'
                                ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/src/utils.ts:4:42 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/util/long' or its corresponding type declarations.

4 import { longFromValue, LongValue } from 'ilp-protocol-stream/dist/src/util/long'
                                           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/src/utils.ts:6:29 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/crypto' or its corresponding type declarations.

6 import { randomBytes } from 'ilp-protocol-stream/dist/src/crypto'
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/test/index.spec.ts:4:29 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/crypto' or its corresponding type declarations.

4 import { randomBytes } from 'ilp-protocol-stream/dist/src/crypto'
                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/test/index.spec.ts:24:8 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/packet' or its corresponding type declarations.

24 } from 'ilp-protocol-stream/dist/src/packet'
          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/test/index.spec.ts:26:31 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/util/receipt' or its corresponding type declarations.

26 import { verifyReceipt } from 'ilp-protocol-stream/dist/src/util/receipt'
                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/test/index.spec.ts:28:24 - error TS2307: Cannot find module 'ilp-protocol-stream/dist/src/util/plugin-interface' or its corresponding type declarations.

28 import { Plugin } from 'ilp-protocol-stream/dist/src/util/plugin-interface'
                          ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

packages/stream-receiver/test/index.spec.ts:291:37 - error TS7006: Parameter 'f' implicitly has an 'any' type.

291     expect(replyPacket.frames.some((f) => f.type === FrameType.ConnectionClose))
                                        ~

packages/stream-receiver/test/index.spec.ts:327:10 - error TS7006: Parameter 'f' implicitly has an 'any' type.

327         (f) =>
             ~

packages/stream-receiver/test/index.spec.ts:425:8 - error TS7006: Parameter 'f' implicitly has an 'any' type.

425       (f) => f.type === FrameType.StreamReceipt
           ~

packages/stream-receiver/test/index.spec.ts:527:37 - error TS7006: Parameter 'f' implicitly has an 'any' type.

527     expect(replyPacket.frames.some((f) => f.type === FrameType.ConnectionClose))
                                        ~
@sublimator
Copy link
Member Author

This can be solved using a combination of:

  1. The new (for some definition of new) exports field in package.json
  2. scripting the generation of subpackages ( folders inside the root of a subpackage, with a package.json pointing to the compiled source)
  3. tsconfig paths
  4. generating jest module name mappers
  5. generating webpack/vite etc aliases
  6. some restructuring of the exports interface of the package to allow easier access to the types actually used

Solution 1 is ideal, as it would would obviate the need for 2/4/5

@sublimator sublimator changed the title Can't build root tsconfig (for e.g. IDE) without running yarn build first Can't build root tsconfig (for e.g. IDE) without running pnpm build first Apr 25, 2023
@sublimator
Copy link
Member Author

Have seen some evidence that TypeScript only really supports setting "main" to a TS file (It's what Dassie uses, and also yarn itself' monorepo) and that exports is not honored in the same way. One can override main in publishConfig ?

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

1 participant