Skip to content

Commit

Permalink
fix BoardApi type
Browse files Browse the repository at this point in the history
  • Loading branch information
Luca Hendrik Helms committed Feb 19, 2023
1 parent e9f8014 commit 732ec72
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 35 deletions.
4 changes: 2 additions & 2 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<script setup lang="ts">
import { ref } from 'vue';
import { TheChessboard, type ChessboardAPI, type BoardConfig } from '@/index';
import { TheChessboard, type BoardApi, type BoardConfig } from '@/index';
import '@/assets/board.css';
const boardAPI = ref<ChessboardAPI>();
const boardAPI = ref<BoardApi>();
const boardConfig: BoardConfig = {
coordinates: true,
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import '@/assets/board.css';

export { default as TheChessboard } from './components/TheChessboard.vue';
export { default as ChessboardAPI } from './classes/BoardApi';
export { default as BoardApi } from './classes/BoardApi';
export * from './typings/BoardAPI';
export * from './typings/Chessboard';
export * from './typings/BoardConfig';
4 changes: 2 additions & 2 deletions src/tests/helper/Functions.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { moveableSquaresWhite } from './Constants';
import type { BoardAPI } from '@/typings/BoardAPI';
import type { BoardApi } from '@/classes/BoardApi';

export function randomMoveFirstMove(boardApi: BoardAPI) {
export function randomMoveFirstMove(boardApi: BoardApi) {
const randomSquare =
moveableSquaresWhite[
Math.floor(Math.random() * moveableSquaresWhite.length)
Expand Down
31 changes: 1 addition & 30 deletions src/typings/BoardAPI.ts
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
import type { Chess, Move } from 'chess.js';
import type { Api } from 'chessground/api';
import type { Color, Key } from 'chessground/types';
import type { BoardState } from './Chessboard';

export interface BoardAPI {
game: Chess;
board: Api;
boardState: BoardState;

resetBoard: () => void;
undoLastMove: () => void;
getMaterialCount: () => {
materialWhite: number;
materialBlack: number;
materialDiff: number;
};
toggleOrientation: () => void;
hideMoves: () => void;
drawMoves: () => void;
toggleMoves: () => void;
getOpeningName: () => Promise<string | null>;
move: (move: string) => boolean;
getTurnColor: () => Color;
getPossibleMoves: () => Map<Key, Key[]> | undefined;
getCurrentTurnNumber: () => number;
getLastMove: () => Move | undefined;
getHistory: () => Move[] | string[];
getFen: () => string;
}
import type { Key } from 'chessground/types';

export interface LichessOpening {
white: number;
Expand Down

0 comments on commit 732ec72

Please sign in to comment.