I have a typescript project using node.js. There is a module i want to use npm package country-code-lookup.
The problem is it does not have a supporting types declaration for it. However, i'd still like to use it.
Is it possible i could still use this package without the typings.
import * as CountryCodeLookup from "country-code-lookup";
const countryCodes = CountryCodeLookup.countries;
console.log(countryCodes);
I get the following error when typescript attempts to compile.
TS7016: Could not find a declaration file for module 'country-code-lookup'. '/Users/kay/portal/node_modules/country-code-lookup/index.js' implicitly has an 'any' type. Try
npm install @types/country-code-lookup
if it exists or add a new declaration (.d.ts) file containingdeclare module 'country-code-lookup';
declare module 'country-code-lookup';
". So just add a declaration file in your project with that in it. – Andrew Li