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

Cannot find definition file for './matter' #9

Open
WastedFreeTime opened this issue Nov 21, 2022 · 1 comment
Open

Cannot find definition file for './matter' #9

WastedFreeTime opened this issue Nov 21, 2022 · 1 comment

Comments

@WastedFreeTime
Copy link

Hello,
i tried using the phaser-matter-collision-plugin with Typescript and Angular but got the following error:

Error: node_modules/phaser-matter-collision-plugin/dist/collision-types.d.ts:1:23 - error TS2688: Cannot find type definition file for './matter'.

1 /// <reference types="./matter" />

My current project versions are:

"typescript": "~4.7.2"
"phaser": "^3.55.2",
"phaser-matter-collision-plugin": "^1.0.0",

Thats how i imported the plugin:

import PhaserMatterCollisionPlugin from 'phaser-matter-collision-plugin';

Three files throw this error:
valid-collision-object.d.ts, utils.d.ts and collision-types.d.ts

Is there something that i am missing? I looked at the Phaser module itself and there its .matter reference is just working fine.

Can someone help me?
Thanks for any help and ideas!

@guydav
Copy link

guydav commented Jun 14, 2024

@WastedFreeTime This is probably irrelevant to you by now, but in case anyone else runs into this, a way I found to resolve this is to add phaser's type definitions to the typeRoots in your tsconfig.json:

{
  "compilerOptions": {
    ...
    "typeRoots": [
      "./node_modules/@types",
      "./node_modules/phaser/types"
    ]
  }
}

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

2 participants