Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeScript declarations are incorrect #54

Open
kendfrey opened this issue May 21, 2021 · 4 comments
Open

TypeScript declarations are incorrect #54

kendfrey opened this issue May 21, 2021 · 4 comments

Comments

@kendfrey
Copy link

There are multiple issues with the TypeScript declarations.

  1. TypeScript does not recognize any of the properties of Board and Coordinate.
import { Board } from "godash";
const board = new Board(19);
console.log(board.dimensions); // Property 'dimensions' does not exist on type 'Board'.
  1. Importing the module does not import the types. The types only work when separately imported from godash/types/board and given different names.
import { Board } from "godash";
const board: Board = new Board(19); // 'Board' refers to a value, but is being used as a type here. Did you mean 'typeof Board'?

cc @abc1236762

@duckpunch
Copy link
Owner

I've never used TypeScript, but I'm open to fixing this eventually when I have a bit more time to figure out the ecosystem.

Alternatively, feel free to submit an PR.

@yjlin0224
Copy link
Contributor

@kendfrey I wrote TypeScript declarations about 1 year ago and I tested at that time it didn't have any problem. Maybe it have aome changes that make declarations failed, I will check it if I have time. Or you can help to fix it, thanks very much.

@duckpunch
Copy link
Owner

It'd be nice if this also included some automation to catch these kinds of issues.

@duckpunch duckpunch removed the v2 label Aug 14, 2022
@maciejken
Copy link
Contributor

maciejken commented Dec 13, 2024

hi everyone, I was trying to use the godash lib inside an angular 19 web app and see there's a problem with the Move class/type definition, but I managed to fix it by adding a line inside godash const declaration in types/index.d.ts file:

declare const godash: {
    BLACK: typeof BLACK;
    WHITE: typeof WHITE;
    EMPTY: typeof EMPTY;
    Board: typeof Board;
    Coordinate: typeof Coordinate;
    Move: typeof Move;
...

the Move type needs to be also added to the imports from './board' :)

maciejken added a commit to maciejken/godash that referenced this issue Dec 13, 2024
duckpunch pushed a commit that referenced this issue Dec 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants