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

It is not supporting ts #67

Open
himanshi2910 opened this issue Aug 1, 2024 · 7 comments
Open

It is not supporting ts #67

himanshi2910 opened this issue Aug 1, 2024 · 7 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@himanshi2910
Copy link

Could not find a declaration file for module 'currency-converter-lt'. '/node_modules/currency-converter-lt/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/currency-converter-lt if it exists or add a new declaration (.d.ts) file containing declare module 'currency-converter-lt';ts(7016)

After installing npm i --save-dev @types/currency-converter-lt, getting this error:
npm i --save-dev @types/currency-converter-lt
Password:
npm error code E404
npm error 404 Not Found - GET https://registry.npmjs.org/@types%2fcurrency-converter-lt - Not found
npm error 404
npm error 404 '@types/currency-converter-lt@*' is not in this registry.
npm error 404
npm error 404 Note that you can also install from a
npm error 404 tarball, folder, http url, or git url.

@paul-shuvo paul-shuvo added enhancement New feature or request help wanted Extra attention is needed labels Aug 1, 2024
@The-White-Fang
Copy link

Assuming you are using src directory

  1. Create a path src/@types/currency-converter-lt/index.d.ts.
  2. Paste the contents from this gist
  3. Update tsconfig.json to include types from src/@types.
    "typeRoots": ["src/@types", "node_modules/@types"],

@olarotseyi
Copy link
Contributor

Did you try to install it normally using npm i currency-converter-lt?

@The-White-Fang
Copy link

@olarotseyi I don't think that would solve the issue. Typescript requires type definitions to be present in the modules being used. And since the currency-converter-lt does not have any, it throws an error. This can be fixed by providing the types using .d.ts files. I can create a @types/currency-converter-lt package if someone needs it, I also have provided a gist in case you want to add it to the package itself.

@olarotseyi
Copy link
Contributor

@The-White-Fang Yes, you are right. Cloning this repository and creating a separate package for typescript might be the best option so that it doesn't interrupt people already using the package in javascript projects. I'm sure people using typescript like @himanshi2910 will appreciate the effort.

@olarotseyi
Copy link
Contributor

@The-White-Fang If you clone this repo to create a separate package, you can update the ReadMe in the new package to state that the new package was created from this repo so that the new repo can start off with some level of trust.

@The-White-Fang
Copy link

Hey @olarotseyi, I noticed that this repo hasn't been updated for quite some time. I am willing to work on it as the current project requires this to work, but it will be pointless if the fixes aren't merged. Do you have the merge rights? If yes, I will create some PRs within the next week. If not, publishing a new package will be more reasonable.

@olarotseyi
Copy link
Contributor

If your PR won’t affect users currently using the package with JavaScript, then you can create the PRs to support Typescript and @paul-shuvo will merge it if no conflict otherwise, I think it’s best to clone the repo and make it adaptable to typescript. I wonder if @himanshi2910 was able to try the suggestion made by @The-White-Fang on Aug 24, 2024 regarding this issue. It would be nice to know if @himanshi2910 tried the suggestion and if it solved the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants