Open LgArcida opened 6 years ago
Usually what you only need is the types definitions. Having that in place, you can compile your application and import the module. Maybe you will need to take care of some issues about how current chessboard is written (which kind of syntax: ES5 or ES6 etc.) in order to configure properly typescript compiler.
I have been working a lot with typescript lately, so I would love to take care at this. Give me some time to try out things and I will report back. For sure if you came up with a type definition earlier it will be perfect.
As documentation:
At end, we should have available types definitions as an npm package @types/chessboardjs
which is built from a PR made againts: https://github.com/DefinitelyTyped/DefinitelyTyped
Cheers
Hi David, I also am using TypeScript and want to use this chessboard.js class in my code.
Have you had a chance to create the type definition file yet?
Hi David,
Have you had create the typescript file for this chessboard.js?
@snowman745 @profmicrop ,
Sorry guys, I did not had the time for this. My apologies. I will find the time today to look at it and start progress.
As a hint I did find this thread: https://stackoverflow.com/questions/43482076/typescript-declaration-file-for-chessboardjs-implicit-import. Which can provides some ideas.
Thanks, We are looking forward.. 👍
@snowman745 @profmicrop could you give a try to the files referenced in previous pull request?
Currently I'm using chessboard.js in an Ionic 4 / Angular 8 site/app. Simply reference it in angular.json:
"styles": [
...,
{
"input": "node_modules/chessboardjs/www/releases/0.3.0/css/chessboard-0.3.0.css"
}
],
"scripts": [
"node_modules/jquery/dist/jquery.min.js",
"node_modules/chessboardjs/www/releases/0.3.0/js/chessboard-0.3.0.js"
],
and declare ChessBoard in the code:
declare var ChessBoard: any;
Currently I'm using chessboard.js in an Ionic 4 / Angular 8 site/app. Simply reference it in angular.json:
"styles": [ ..., { "input": "node_modules/chessboardjs/www/releases/0.3.0/css/chessboard-0.3.0.css" } ], "scripts": [ "node_modules/jquery/dist/jquery.min.js", "node_modules/chessboardjs/www/releases/0.3.0/js/chessboard-0.3.0.js" ],
and declare ChessBoard in the code:
declare var ChessBoard: any;
But you are not getting code completion with your IDE, this way? I use pycharm pro and I don't get code completion if there are no typings for ts.
Thanks
@martinlombana You are correct, I don't have code completion, but I can use the component.
What about:
https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/chessboardjs
Did someone take a look at these? Are they up to date?
Can I use this for an Anguar 4 site? If so how?
I am not getting any error but the board is not visible at all.