Currently, I am delving into learning typescript and have taken up the challenge of crafting a declaration file for the chess.js library. However, it seems that I am struggling to grasp the concept of creating one. Whenever I attempt to import the library using the import statement
import { Chess } from chess.js
An error pops up stating that Module chess.js does not have any exported members.
So far, this is what I have in the index.d.ts file:
declare namespace ChessJSTypes {
type ChessType = 'p' | 'n' | 'b' | 'r' | 'q' | 'k';
type ChessColor = 'b' | 'w';
}
// Followed by various interfaces and classes related to chess functionality
// and concluding with module declaration