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

Investigate TSC compilation errors when using as package #66

Open
cgewecke opened this issue Jun 23, 2021 · 5 comments
Open

Investigate TSC compilation errors when using as package #66

cgewecke opened this issue Jun 23, 2021 · 5 comments

Comments

@cgewecke
Copy link
Contributor

No description provided.

@rootulp
Copy link
Contributor

rootulp commented Aug 18, 2021

I'm encountering TSC errors when adding set.js as a dependency to index-ui however the error appears a bit misleading:

Failed to compile.

/Users/rootulp/git/index-ui/src/contexts/Airdrop/AirdropProvider.tsx
TypeScript error in /Users/rootulp/git/index-ui/src/contexts/Airdrop/AirdropProvider.tsx(2,26):
Could not find a declaration file for module 'web3-core'. '/Users/rootulp/git/index-ui/node_modules/web3-core/src/index.js' implicitly has an 'any' type.
  Try `npm install @types/web3-core` if it exists or add a new declaration (.d.ts) file containing `declare module 'web3-core';`  TS7016

    1 | import React, { useState, useEffect } from 'react'
  > 2 | import { provider } from 'web3-core'
      |                          ^
    3 | import { useCallback } from 'react'
    4 | import BigNumber from 'bignumber.js'
    5 |

I have a suspicion this is because the versions of web3 being pulled in by both projects are incompatible.

@rootulp
Copy link
Contributor

rootulp commented Aug 27, 2021

Disregard, the above error seems unique to index-ui and may be resolved by IndexCoop/index-ui#364

@rootulp
Copy link
Contributor

rootulp commented Dec 18, 2021

FWIW I no longer observe this error. This issue may be safe to close unless @cgewecke you have observed other compilation errors recently

@AmagiDDmxh
Copy link

AmagiDDmxh commented May 5, 2022

Failed to compile.

./node_modules/set.js/src/api/DebtIssuanceAPI.ts:22:30
Type error: Could not find a declaration file for module '@setprotocol/set-protocol-v2/dist/utils/constants'. '/Users/amagi/dev/jj-web3-fe/node_modules/@setprotocol/set-protocol-v2/dist/utils/constants.js' implicitly has an 'any' type.
  If the '@setprotocol/set-protocol-v2' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '@setprotocol/set-protocol-v2/dist/utils/constants';`

  20 | import { Provider } from '@ethersproject/providers';
  21 | import { Address } from '@setprotocol/set-protocol-v2/utils/types';
> 22 | import { ADDRESS_ZERO } from '@setprotocol/set-protocol-v2/dist/utils/constants';
     |                              ^
  23 | import { TransactionOverrides } from '@setprotocol/set-protocol-v2/dist/typechain';
  24 | import { BigNumber } from 'ethers/lib/ethers';
  25 | 
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Experience this on the newer version during compilation on tsbuild.

@AmagiDDmxh
Copy link

Failed to compile.

./node_modules/set.js/src/api/DebtIssuanceAPI.ts:22:30
Type error: Could not find a declaration file for module '@setprotocol/set-protocol-v2/dist/utils/constants'. '/Users/amagi/dev/jj-web3-fe/node_modules/@setprotocol/set-protocol-v2/dist/utils/constants.js' implicitly has an 'any' type.
  If the '@setprotocol/set-protocol-v2' package actually exposes this module, try adding a new declaration (.d.ts) file containing `declare module '@setprotocol/set-protocol-v2/dist/utils/constants';`

  20 | import { Provider } from '@ethersproject/providers';
  21 | import { Address } from '@setprotocol/set-protocol-v2/utils/types';
> 22 | import { ADDRESS_ZERO } from '@setprotocol/set-protocol-v2/dist/utils/constants';
     |                              ^
  23 | import { TransactionOverrides } from '@setprotocol/set-protocol-v2/dist/typechain';
  24 | import { BigNumber } from 'ethers/lib/ethers';
  25 | 
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Experience this on the newer version during compilation on tsbuild.

problem solved, it happened because I've used the wrong import like

import { Position as IPosition, SetDetails } from 'set.js/src/types'

but it should import from

import { Position as IPosition, SetDetails } from 'set.js/dist/types/src/types'

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

3 participants