error TS2688: Cannot find type definition file for 'bga-ts-template'.

Game development with Board Game Arena Studio
Post Reply
User avatar
oscarlevin
Posts: 3
Joined: 06 October 2023, 17:04

error TS2688: Cannot find type definition file for 'bga-ts-template'.

Post by oscarlevin »

Today I tried to restart some development work by going through the new TS Templates tutorial (https://github.com/NevinAF/bga-ts-templ ... s/index.md).

When I got to item 3 of step 2, running the init script, I encountered the following:

Code: Select all

...
Running build commands:
        Game States: 'gamestates.jsonc' => 'states.inc.php', '.action.php', [gamestates.d.ts]
        Game Statistics: stats.jsonc => stats.json
        Game Options: gameoptions.jsonc => gameoptions.json
        Game Preferences: gamepreferences.jsonc => gamepreferences.json
        Game Infos: gameinfos.jsonc => gameinfos.inc.php
        Typescript compiler: client/define.ts => knightsknaves.js
error TS2688: Cannot find type definition file for 'bga-ts-template'.
  The file is in the program because:
    Entry point of type library 'bga-ts-template' specified in compilerOptions

  source/client/tsconfig.json:30:14
    30   "types": [ "bga-ts-template" ], // Includes all non-module types which are on HTML script tags.
                    ~~~~~~~~~~~~~~~~~
    File is entry point of type library specified here.


Found 1 error.

Command failed: npx tsc -p source/client --outFile knightsknaves.js
Command failed: npx bga-build
Not sure if it is related, but a few other things were suspicious: I tried running the game following the directions in step 1 part 5, and the table didn't load (it was stuck on "Opening the game box.."). Also, there was no <gamename>.game.php file and the <gamename>.js file looked very different from what it used to (which might be expected, but could explain why the game wouldn't run?)

Any suggestions?
User avatar
Nevin
Posts: 2
Joined: 18 March 2024, 21:49

Re: error TS2688: Cannot find type definition file for 'bga-ts-template'.

Post by Nevin »

Hey! I'm sorry you are having issues. This was caused by a change made in V2.0.3 which has now been resolved. Run "npm run init" again to automatically update the npm package and fix the build issue.
https://github.com/NevinAF/bga-ts-template/issues/19

The BGA-TS-Template is managed independently by myself and is not an official project. I recently converted all all source code into very detailed types (V2.0.0), which introduced some instability that I am working on resolving with one of the BGA Admin, Thoun. There are a few outdated components (mostly auto generated stuff anyways) which are also in the works as enhancements.

If you have any concerns about building/outdated components, you can also just get the typescript types by downloading "https://github.com/NevinAF/bga-ts-templ ... types.d.ts". Then, within the tsconfig.json, use the following compilerOptions: "target": "es5", "module": "AMD","moduleResolution": "node10", "lib": [ "dom", "esnext" ]
User avatar
oscarlevin
Posts: 3
Joined: 06 October 2023, 17:04

Re: error TS2688: Cannot find type definition file for 'bga-ts-template'.

Post by oscarlevin »

Thanks so much! I finally found some time to try this again and can confirm it is working. I really appreciate your help and work on this project.
Post Reply

Return to “Developers”