# Phaser By Example Book with Typescript

**URL:** <https://phaser.discourse.group/t/phaser-by-example-book-with-typescript/14392>\
**Category:** Phaser 3\
**Created:** [June 4, 2024, 1:35pm UTC](https://phaser.discourse.group/t/phaser-by-example-book-with-typescript/14392 "2024-06-04T13:35:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ionshard](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/ionshard/32/8318_2.png) [@Ionshard](https://phaser.discourse.group/u/Ionshard)\
**Post date:** [June 4, 2024, 1:35pm UTC](https://phaser.discourse.group/t/phaser-by-example-book-with-typescript/14392/1 "2024-06-04T13:35:08Z")

</div>

Just sharing here in case anyone else finds it useful. I was interested in using Typescript since I use it everyday as a professional web developer, however I often times found it quite frustrating to work with the Phaser types, and I wasn’t finding very much helpful information online as many of the examples out there are written in JS and often times do things that are not ideal in a Typescript manner.

So I have done my best to start converting the Phaser By Example Book’s source code into Typescript. I absolutely refuse to use the dreaded `any`, since to me that’s the equivalent of just not using Typescript which doesn’t help out developers who want Typescript. I also do my best to avoid using type assertions (the `as` keyword) … however unfortunately there are many things I just could not solve without them, since Phaser’s built in types don’t use generics there are many issues around collections, groups and layers.

So I am sharing my initial attempt here in case anyone else would find it useful. I have converted the Runner and Starshake examples so far.

> **[GitHub - Ionshard/phaser-by-example-ts: The source code to the games that go...](https://github.com/Ionshard/phaser-by-example-ts)**
>
> The source code to the games that go with the Phaser by Example book (converted to Typescript) - Ionshard/phaser-by-example-ts
