[SOLVED] Adding additional type in DefinitelyTyped library

Issue

This Content is from Stack Overflow. Question asked by NewCoderOnTheBlock

I have Forked DefinitelyTyped and made changes to the types of a library. . I would like to test them from my fork instead of the upstream”. Updated my package.json my “devDependencies” with the appropriate target "@types/google-spreadsheet": "github:NewCoderOnTheBlock/DefinitelyTyped#delete-move-rows", then I proceed to use the command “npm install” Finally when I start to run my program i am encountering this following error:

Could not find a declaration file for module 'google-spreadsheet'. 'c:/Users/USER/OneDrive/Documents/Projet/Discord/node_modules/google-spreadsheet/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/google-spreadsheet` if it exists or add a new declaration (.d.ts) file containing `declare module 'google-spreadsheet';`ts(701

Any help would be appreciated.



Solution

It seems like this isn’t working because the DefinitelyTyped repository has a build step, and you’re not running the bot that generates the package declarations.

You should be able to copy types/google-spreadsheet/index.d.ts into your project and then wrap it in declare module "google-spreadsheet" { ... } to test your types locally.


This Question was asked in StackOverflow by NewCoderOnTheBlock and Answered by Nick McCurdy It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?