osmosis-labs / osmojs

OsmosJS makes it easy to compose and broadcast Osmosis and Cosmos messages
https://cosmology.zone/products/osmojs
Apache License 2.0
63 stars 32 forks source link

export 'Long'.'UZERO' (imported as 'Long') was not found in #19

Closed cothi closed 1 year ago

cothi commented 1 year ago

hello my tsconfig.json

{
  "compilerOptions": {
    "target": "es5",
    "lib": [
      "dom",
      "dom.iterable",
      "esnext"
    ],
    "allowJs": true,
    "skipLibCheck": true,

// add esModuleInterop
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noFallthroughCasesInSwitch": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noEmit": true,
    "jsx": "react-jsx"
  },
  "include": [
    "src"
  ]

my react App.tsx code


import logo from './logo.svg';
import './App.css';
// this problem code
import { osmosis } from 'osmojs';

// start App
function App() {
  const { createRPCQueryClient } = osmosis.ClientFactory;
  return (
    <div className="App">
      <header className="App-header">
        <img src={logo} className="App-logo" alt="logo" />
        <p>
          Edit <code>src/App.tsx</code> and save to reload.
        </p>
        <a
          className="App-link"
          href="https://reactjs.org"
          target="_blank"
          rel="noopener noreferrer"
        >
          Learn React
        </a>
      </header>
    </div>
  );
}
export default App;

i refer https://github.com/osmosis-labs/osmojs/issues/18, then fix my tsconfig.json but, i see this error

Screen Shot 2022-10-14 at 4 01 33 PM

how can i fix error ?

pyramation commented 1 year ago

hi @cothi thanks for providing this information.

The Long library is seemingly having issues.

Because when we do import Long from 'long' we got an error. Now that we have import * as Long from 'long' we still have an error... One thought is maybe we need to install long types. I will look into this.

Another question — would you be willing to add me to your repo so I can take a deeper look and investigate in your environment? This could help us solve the issue with more visibility, let me know

pyramation commented 1 year ago

working on a PR to fix the TS stuff: https://github.com/osmosis-labs/osmojs/pull/20

pyramation commented 1 year ago

try osmojs@0.33.0 and let me know, I switched it back to import Long from 'long' and other TS fixes/cleanup.

cothi commented 1 year ago

thanks, solved :)

pyramation commented 1 year ago

amazing! So happy to hear @cothi :)