Skip to content

Commit b3de447

Browse files
committed
Make ts beginner friendly
1 parent 53080f4 commit b3de447

File tree

5 files changed

+15
-9
lines changed

5 files changed

+15
-9
lines changed

Diff for: src/scripts/game.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import PreloadScene from './scenes/preloadScene'
55
const DEFAULT_WIDTH = 1280
66
const DEFAULT_HEIGHT = 720
77

8-
const config: Phaser.Types.Core.GameConfig = {
8+
const config = {
99
type: Phaser.AUTO,
1010
backgroundColor: '#ffffff',
1111
scale: {

Diff for: src/scripts/objects/fpsText.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default class FpsText extends Phaser.GameObjects.Text {
2-
constructor(scene: Phaser.Scene) {
2+
constructor(scene) {
33
super(scene, 10, 10, '', { color: 'black', fontSize: '28px' })
44
scene.add.existing(this)
55
this.setOrigin(0)

Diff for: src/scripts/objects/phaserLogo.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
export default class PhaserLogo extends Phaser.Physics.Arcade.Sprite {
2-
constructor(scene: Phaser.Scene, x: number, y: number) {
2+
constructor(scene, x, y) {
33
super(scene, x, y, 'phaser-logo')
44
scene.add.existing(this)
55
scene.physics.add.existing(this)

Diff for: src/scripts/scenes/mainScene.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import PhaserLogo from '../objects/phaserLogo'
22
import FpsText from '../objects/fpsText'
33

44
export default class MainScene extends Phaser.Scene {
5-
fpsText: Phaser.GameObjects.Text
5+
fpsText
66

77
constructor() {
88
super({ key: 'MainScene' })

Diff for: tsconfig.json

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
{
22
"compilerOptions": {
3-
"target": "es5",
4-
"module": "commonjs",
3+
"target": "ES2015",
4+
"module": "ES2015",
5+
56
"strict": true,
6-
"noImplicitAny": false,
77
"esModuleInterop": true,
8+
"skipLibCheck": true,
9+
"forceConsistentCasingInFileNames": true,
10+
11+
"allowJs": true,
812
"allowUnreachableCode": false,
13+
"noImplicitAny": false,
914
"sourceMap": true,
1015
"strictPropertyInitialization": false,
11-
"allowJs": true,
12-
"lib": ["dom", "es5", "esnext"]
16+
17+
"moduleResolution": "node",
18+
"lib": ["dom", "esnext"]
1319
}
1420
}

0 commit comments

Comments
 (0)