Webpack used typeScript, to install js-cookie and introduced it in .ts but said that the module could not be found

install: npm i js-cookie-- save
Import: import Cookies from "js-cookie";
restart: npm run dev

error in. / src/utils/cookie.ts
[tsl] error

  TS7016: Could not find a declaration file for module "js-cookie". "C:\\\\jiGouHouTai\node_modules\js-cookie\src\js.cookie.js" implicitly has an "any" type.

error in. / src/utils/Cookie.ts

[tsl] reported an error

  TS7016: Could not find a declaration file for module "js-cookie". "C:\\\\jiGouHouTai\node_modules\js-cookie\src\js.cookie.js" implicitly has an "any" type.

the package may have been misplaced

npm install-- save @ types/js-cookie

Discussion on

github


// tsconfig.json
{
  "compilerOptions": {
    //...
    "noImplicitAny": false,
   }
}

also answer
.ts file to introduce js library
(1) you can use [require] for example to introduce moment:const moment = require ('moment') in the file;
(2) directly install its ts library such as npm I @ types/moment

.
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37f86-2c0df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37f86-2c0df.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?