Skip to content

Commit

Permalink
Export TS types for users to use in their own code (#26)
Browse files Browse the repository at this point in the history
  • Loading branch information
orta committed Apr 23, 2022
1 parent 2b6b6ee commit 8f4913c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ npm i react-chessboard
- Position Control
- Premoves
- Responsive Board Width
- Typescript Support
- TypeScript Support

### Planned

Expand Down
2 changes: 1 addition & 1 deletion package/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ npm i react-chessboard
- Position Control
- Premoves
- Responsive Board Width
- Typescript Support
- TypeScript Support

### Planned

Expand Down
14 changes: 7 additions & 7 deletions package/dist/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ReactElement, CSSProperties, RefObject } from 'react';
import { BackendFactory } from 'dnd-core';

type Square =
export type Square =
| 'a8'
| 'b8'
| 'c8'
Expand Down Expand Up @@ -67,31 +67,31 @@ type Square =
| 'g1'
| 'h1';

type Pieces = 'wP' | 'wB' | 'wN' | 'wR' | 'wQ' | 'wK' | 'bP' | 'bB' | 'bN' | 'bR' | 'bQ' | 'bK';
export type Pieces = 'wP' | 'wB' | 'wN' | 'wR' | 'wQ' | 'wK' | 'bP' | 'bB' | 'bN' | 'bR' | 'bQ' | 'bK';

interface CustomPieceFnArgs {
export interface CustomPieceFnArgs {
isDragging: boolean;
squareWidth: number;
droppedPiece: Pieces;
targetSquare: Square;
sourceSquare: Square;
}

type CustomPieceFn = (args: CustomPieceFnArgs) => ReactElement;
export type CustomPieceFn = (args: CustomPieceFnArgs) => ReactElement;

type CustomPieces = {
export type CustomPieces = {
[key in Pieces]?: CustomPieceFn;
};

type CustomSquareStyles = {
export type CustomSquareStyles = {
[key in Square]?: CSSProperties;
};

type CurrentPosition = {
[key in Square]: Pieces;
};

interface ChessBoardProps {
export interface ChessBoardProps {
/**
* Time in milliseconds for piece to slide to target square. Only used when the position is programmatically changed. If a new position is set before the animation is complete, the board will cancel the current animation and snap to the new position.
*/
Expand Down

1 comment on commit 8f4913c

@vercel
Copy link

@vercel vercel bot commented on 8f4913c Apr 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.