troyedwardsjr

Members
  • Content Count

    6
  • Joined

  • Last visited

About troyedwardsjr

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Updated my TypeScript boilerplate with a more complete example: https://github.com/troyedwardsjr/phaser3-typescript-webpack
  2. troyedwardsjr

    Phaser 3 JSDoc Generated Typescript Definitions

    I believe so. One way I know of is copying the typescript definition file to the root of your phaser folder in node_modules, and changing the phaser package.json file to have the field "types" : "./phaser.d.ts" in it. Then either restart the TypeScript server in VS Code by pressing CTRL + SHIFT + P and searching "Restart TS Server" or just restarting VS Code. So as long as you're using NPM and RequireJS or ES6 Import, you should be able to use it with vanilla Javascript or ES6. https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html https://code.visualstudio.com/docs/languages/javascript
  3. troyedwardsjr

    Phaser 3 JSDoc Generated Typescript Definitions

    I haven't tested everything yet but using my modified version of Antriel's official (WIP) Phaser 3 typescript definitions build, I was able to get scene properties (plugins) to work using a hacky generator by stepping through Phaser code with the browser debugger, converting any useful runtime data to JSON, writing it to disk, then converting it with a simple script, and injecting it into Antriel's build. End result: Everything appears to be compiling in the typescript compiler so far, with code hinting, autocompletion/intellisense, ect. in VS Code (and I imagine similar editors). Note: This is a temporary, hacky, potentially unstable solution for those who want to start building their Phaser 3 typescript projects right now while we wait on offical typescript support to be completed by Antriel and the Phaser team. Modified build here: https://github.com/troyedwardsjr/phaser3-tsd/blob/master/build/official/phaser.d.ts Also created a boilerplate starter project, with definitions included: https://github.com/troyedwardsjr/phaser3-typescript-webpack
  4. troyedwardsjr

    [WIP] Phaser 3 TypeScript Definitions

    Are member variables working for you? They don't appear to be working for me in your build: Have you found a solution to this yet because I haven't found a solution other than to manually add JSDocs (which would require changes to the source / PR requests), or possibly hacky importing and evaluating of modules from the source and writing a custom parser afterwards from any useful data in the middle of my tsd compilation/transpilation process. Which would be a problem since Scenes appear to have properties or as phaser calls it "plugins" dynamically added to them at runtime and Phaser registers all the plugins when phaser.js is require'd (giving the plugins the necessary mappings to match up with InjectionMap and then becoming Scene property names) which includes calls to global browser objects like "window", which will crash nodejs. Both of these solutions are not ideal and very tedious. Currently, the JSDocs in the source do not appear to be very "TypeScript friendly" for automatic generation. Ideally, I was hoping for TypeScript support on release as stated in the Phaser World dev log over two weeks ago so that I could start my projects.
  5. troyedwardsjr

    Phaser 3 JSDoc Generated Typescript Definitions

    Making good progress on writing my Phaser 3 typescript definition generator/transpiler. First full build: https://github.com/troyedwardsjr/phaser3-tsd/blob/master/build/phaser.d.ts
  6. I've started writing a generator for Phaser 3 typescript definitions using Richard's JSDoc annotations. If anyone is interested in helping: https://github.com/troyedwardsjr/phaser3-tsd