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

Type linking issue fixed with typescript #142

Merged
merged 1 commit into from
May 27, 2024
Merged

Conversation

hrishioa
Copy link
Contributor

package.json has an issue where Typescript wasn't able to pick up types.

To reproduce, you can try importing nkn-sdk as per the example into a fresh create-next-app project (and running npm build). This was the error:

next build
  ▲ Next.js 14.2.3

   Creating an optimized production build ...
 ✓ Compiled successfully
   Linting and checking validity of types  ...Failed to compile.

./src/core/p2p/nkn-test.ts:1:45
Type error: Could not find a declaration file for module 'nkn-sdk'. '<project>/node_modules/nkn-sdk/lib/index.js' implicitly has an 'any' type.
  There are types at <project>/node_modules/nkn-sdk/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'nkn-sdk' library may need to update its package.json or typings.

> 1 | import { Client, MultiClient, Wallet } from "nkn-sdk";

error: script "build" exited with code 1

Small change to package.json fixes it!

@yilunzhang yilunzhang merged commit 7ca1094 into nknorg:master May 27, 2024
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

Successfully merging this pull request may close these issues.

2 participants