I am trying to import the npm package: tiktok-livestream-chat-connector into a react typescript webapp. To import this package, I used:
import { WebcastPushConnection } from 'tiktok-livestream-chat-connector'
When I do this, I get this error:
'WebcastPushConnection' is declared but its value is never read.ts(6133) Could not find a declaration file for module 'tiktok-livestream-chat-connector'. 'C:/project-path/node_modules/tiktok-livestream-chat-connector/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/tiktok-livestream-chat-connector` if it exists or add a new declaration (.d.ts) file containing `declare module 'tiktok-livestream-chat-connector';`ts(7016)
Using npm i --save-dev @types/tiktok-livestream-chat-connector
gives me npm ERR! code E404
not found, and I don't know where to place a d.ts
file.
CodePudding user response:
Possible solution: place the following in index.d.ts, and it will compile:
declare module "inputmask-core" {
declare class InputMask {}
export default InputMask;
}
I still don't understand the special handling that node_modules/@types gets, though.
CodePudding user response:
With
import { WebcastPushConnection } from 'tiktok-livestream-chat-connector'
I have an another error in console :
Uncaught TypeError: Class extends value undefined is not a constructor or null at Object../node_modules/tiktok-livestream-chat-connector/dist/lib/webcastWebsocket.js