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 type definition file for 'phaser' #20

Closed
tljesse opened this issue Jun 8, 2020 · 4 comments
Closed

Cannot find type definition file for 'phaser' #20

tljesse opened this issue Jun 8, 2020 · 4 comments

Comments

@tljesse
Copy link

tljesse commented Jun 8, 2020

Environment
Angular 9.1.0
Ionic 5.1.0
Typescript 3.7.5

Error Message

[ng] ERROR in node_modules/@ion-phaser/core/dist/types/components/models/index.d.ts:1:23 - error TS2688: Cannot find type definition file for 'phaser'.
[ng] 1 /// <reference types="Phaser" />

I'm getting this error when trying to run ionic serve and I haven't found a solution. I have the file phaser.d.ts in the src folder and have tried to add that directly to tsconfig.json files list without success.

When I remove the line /// <reference types="Phaser" /> from the index.d.ts file in @ion-phaser then it will run but this can't be the solution. Any help is greatly appreciated!

@jdnichollsc
Copy link
Member

@tljesse
Copy link
Author

tljesse commented Jun 9, 2020

This is my tsconfig.json

{
  "compileOnSave": false,
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "baseUrl": "./",
    "outDir": "./dist/out-tsc",
    "sourceMap": true,
    "declaration": false,
    "module": "esnext",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "importHelpers": true,
    "target": "es5",
    "typeRoots": [
      "node_modules/@types"
    ],
    "lib": [
      "es2018",
      "dom", 
      "scripthost"
    ],
    "paths": {
      "@app/*": [
        "src/app/*"
      ],
      "@assets/*": [
        "src/assets/*"
      ],
      "@env/*": [
        "src/environments/*"
      ]
    }
  },
  "files": ["src/phaser.d.ts"],
  "angularCompilerOptions": {
    "fullTemplateTypeCheck": true,
    "strictInjectionParameters": true
  }
}

We have the phaser.d.ts file in the src folder. Before we had been using phaser on it's own without ion-phaser and had some issues getting it running and ended up having to remove phaser.d.ts from the phaser folder in node_modules. I'm trying to convert everything over now so the project also won't run if I leave phaser.d.ts in node_modules since I haven't converted everything.

This probably sounds like a weird configuration, maybe I need to get rid of the old phaser games as I rebuild and put that back into node_modules? But shouldn't adding that to files from any destination still work?

@jdnichollsc
Copy link
Member

@tljesse can you attach a repo to be able to reproduce this issue?

@jdnichollsc
Copy link
Member

Please let me know if the issue persist with the last version, thanks!

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