question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TS errors on VS Code: Cannot find namespace 'Phaser'.ts(2503)

See original GitHub issue

I’ve just bought the book and tried going through chapter 3, but ran into issues with types not being found almost immediately in phaser-engine.class.ts. I’ve also tried checking out the chapter/3 branch directly and still encounter the same issue.

There are also some type conflicts in the index.d.ts file under globals/phaser.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
logicmasoncommented, Mar 28, 2019

This is also the checkout state of chapter 3 when running npm run start:dev

It’s in the @types dir of a dependency, though, so it may not be a major problem. Here’s the full output:

node_modules/@types/core-js/index.d.ts:829:20 - error TS2304: Cannot find name 'PromiseConstructor'.

829     const Promise: PromiseConstructor;
                       ~~~~~~~~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:1486:36 - error TS2339: Property 'for' does not exist on type 'SymbolConstructor'.

1486     const _for: typeof core.Symbol.for;
                                        ~~~

node_modules/@types/core-js/index.d.ts:1490:43 - error TS2339: Property 'hasInstance' does not exist on type 'SymbolConstructor'.

1490     const hasInstance: typeof core.Symbol.hasInstance;
                                               ~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:1494:50 - error TS2339: Property 'isConcatSpreadable' does not exist on type 'SymbolConstructor'.

1494     const isConcatSpreadable: typeof core.Symbol.isConcatSpreadable;
                                                      ~~~~~~~~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:1502:38 - error TS2339: Property 'keyFor' does not exist on type 'SymbolConstructor'.

1502     const keyFor: typeof core.Symbol.keyFor;
                                          ~~~~~~

node_modules/@types/core-js/index.d.ts:1506:37 - error TS2339: Property 'match' does not exist on type 'SymbolConstructor'.

1506     const match: typeof core.Symbol.match;
                                         ~~~~~

node_modules/@types/core-js/index.d.ts:1510:39 - error TS2339: Property 'replace' does not exist on type 'SymbolConstructor'.

1510     const replace: typeof core.Symbol.replace;
                                           ~~~~~~~

node_modules/@types/core-js/index.d.ts:1514:38 - error TS2339: Property 'search' does not exist on type 'SymbolConstructor'.

1514     const search: typeof core.Symbol.search;
                                          ~~~~~~

node_modules/@types/core-js/index.d.ts:1518:39 - error TS2339: Property 'species' does not exist on type 'SymbolConstructor'.

1518     const species: typeof core.Symbol.species;
                                           ~~~~~~~

node_modules/@types/core-js/index.d.ts:1522:37 - error TS2339: Property 'split' does not exist on type 'SymbolConstructor'.

1522     const split: typeof core.Symbol.split;
                                         ~~~~~

node_modules/@types/core-js/index.d.ts:1526:43 - error TS2339: Property 'toPrimitive' does not exist on type 'SymbolConstructor'.

1526     const toPrimitive: typeof core.Symbol.toPrimitive;
                                               ~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:1530:43 - error TS2339: Property 'toStringTag' does not exist on type 'SymbolConstructor'.

1530     const toStringTag: typeof core.Symbol.toStringTag;
                                               ~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:1534:43 - error TS2339: Property 'unscopables' does not exist on type 'SymbolConstructor'.

1534     const unscopables: typeof core.Symbol.unscopables;
                                               ~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:2305:36 - error TS2339: Property 'for' does not exist on type 'SymbolConstructor'.

2305     const _for: typeof core.Symbol.for;
                                        ~~~

node_modules/@types/core-js/index.d.ts:2309:43 - error TS2339: Property 'hasInstance' does not exist on type 'SymbolConstructor'.

2309     const hasInstance: typeof core.Symbol.hasInstance;
                                               ~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:2313:50 - error TS2339: Property 'isConcatSpreadable' does not exist on type 'SymbolConstructor'.

2313     const isConcatSpreadable: typeof core.Symbol.isConcatSpreadable;
                                                      ~~~~~~~~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:2321:38 - error TS2339: Property 'keyFor' does not exist on type 'SymbolConstructor'.

2321     const keyFor: typeof core.Symbol.keyFor;
                                          ~~~~~~

node_modules/@types/core-js/index.d.ts:2325:37 - error TS2339: Property 'match' does not exist on type 'SymbolConstructor'.

2325     const match: typeof core.Symbol.match;
                                         ~~~~~

node_modules/@types/core-js/index.d.ts:2329:39 - error TS2339: Property 'replace' does not exist on type 'SymbolConstructor'.

2329     const replace: typeof core.Symbol.replace;
                                           ~~~~~~~

node_modules/@types/core-js/index.d.ts:2333:38 - error TS2339: Property 'search' does not exist on type 'SymbolConstructor'.

2333     const search: typeof core.Symbol.search;
                                          ~~~~~~

node_modules/@types/core-js/index.d.ts:2337:39 - error TS2339: Property 'species' does not exist on type 'SymbolConstructor'.

2337     const species: typeof core.Symbol.species;
                                           ~~~~~~~

node_modules/@types/core-js/index.d.ts:2341:37 - error TS2339: Property 'split' does not exist on type 'SymbolConstructor'.

2341     const split: typeof core.Symbol.split;
                                         ~~~~~

node_modules/@types/core-js/index.d.ts:2345:43 - error TS2339: Property 'toPrimitive' does not exist on type 'SymbolConstructor'.

2345     const toPrimitive: typeof core.Symbol.toPrimitive;
                                               ~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:2349:43 - error TS2339: Property 'toStringTag' does not exist on type 'SymbolConstructor'.

2349     const toStringTag: typeof core.Symbol.toStringTag;
                                               ~~~~~~~~~~~

node_modules/@types/core-js/index.d.ts:2353:43 - error TS2339: Property 'unscopables' does not exist on type 'SymbolConstructor'.

2353     const unscopables: typeof core.Symbol.unscopables;
                                               ~~~~~~~~~~~

node_modules/@types/socket.io-client/index.d.ts:6:13 - error TS2403: Subsequent variable declarations must have the same type.  Variable 'io' must be of type 'any', but here has type 'SocketIOClientStatic'.

6 declare var io: SocketIOClientStatic;
1reaction
logicmasoncommented, Mar 28, 2019

That fixed everything. Thank you and I look forward to the rest of your book!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Phaser Definitions for typescript not being read by VSCode
It looks like the example code in the TypeScript tutorial is out of date for Phaser 3. See the current example JavaScript code....
Read more >
typescript Code Example - Code Grepper
error TS4111: Property 'name' comes from an index signature, so it must be accessed with ['name']. ... Property 'value' does not exist on...
Read more >
Microsoft/TypeScript - Gitter
Mh TS Playground does not complain but VS Code ... error: TypeScript error: app/level-module/module.ts(24,18): Error TS2503: Cannot find namespace 'Rx'.
Read more >
VS Code setup with Phaser and TypeScript
When I put some code in a *.ts file, TSLint in VS Code will always say "cannot find name 'Phaser'". I can use...
Read more >
cannot find module 'rxjs/observable' or its corresponding type ...
If you upgrade your Typescript version something greater than 4.2.x , you shouldn't face the issue in a real life project. However, the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found