Skip to content

Typescript errors in History.ts #6

@hasnul

Description

@hasnul

When I tried to compile the repo, I got the following error messages:

> tsc

src/History.ts:441:9 - error TS18048: 'from' is possibly 'undefined'.

441     if (from.type !== KING || from.color !== chess.turn()) {
            ~~~~

src/History.ts:441:31 - error TS18048: 'from' is possibly 'undefined'.

441     if (from.type !== KING || from.color !== chess.turn()) {
                                  ~~~~

src/History.ts:446:12 - error TS18048: 'to' is possibly 'undefined'.

446     return to.type === KING && to.color !== chess.turn();
               ~~

src/History.ts:446:32 - error TS18048: 'to' is possibly 'undefined'.

446     return to.type === KING && to.color !== chess.turn();
                                   ~~

src/History.ts:484:21 - error TS2740: Type '{ color: Color; from: Square; to: Square; piece: "k"; flags: string; san: string; lan: string; before: string; after: string; }' is missing the following properties from type 'Move': isCapture, isPromotion, isEnPassant, isKingsideCastle, and 2 more.

484                     return {
                        ~~~~~~

Found 5 errors in the same file, starting at: src/History.ts:441

> tsc --version
Version 5.7.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions