You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:692
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
src/TicTacToeGame.ts(30,36): error TS2322: Type 'typeof LobbyPhase' is not assignable to type 'PhaseClass<AnyPhase>'.
Types of parameters 'parent' and 'parent' are incompatible.
Type 'AnyPhase | null' is not assignable to type 'null'.
Type 'AnyPhase' is not assignable to type 'null'.
src/TicTacToeGame.ts(30,48): error TS2322: Type 'typeof GameInProgressPhase' is not assignable to type 'PhaseClass<AnyPhase>'.
Types of parameters 'parent' and 'parent' are incompatible.
Type 'AnyPhase | null' is not assignable to type 'null'.
Type 'AnyPhase' is not assignable to type 'null'.
src/TicTacToeGame.ts(30,69): error TS2322: Type 'typeof GameEndedPhase' is not assignable to type 'PhaseClass<AnyPhase>'.
Types of parameters 'parent' and 'parent' are incompatible.
Type 'AnyPhase | null' is not assignable to type 'null'.
Type 'AnyPhase' is not assignable to type 'null'.
at createTSError (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:692:12)
at reportTSError (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:696:19)
at getOutput (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:883:36)
at Object.compile (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:1185:30)
at Module.m._compile (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:1309:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Object.require.extensions.<computed> [as .ts] (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:1313:12)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19) {
diagnosticText: "src/TicTacToeGame.ts(30,36): error TS2322: Type 'typeof LobbyPhase' is not assignable to type 'PhaseClass<AnyPhase>'.\r\n" +
" Types of parameters 'parent' and 'parent' are incompatible.\r\n" +
" Type 'AnyPhase | null' is not assignable to type 'null'.\r\n" +
" Type 'AnyPhase' is not assignable to type 'null'.\r\n" +
"src/TicTacToeGame.ts(30,48): error TS2322: Type 'typeof GameInProgressPhase' is not assignable to type 'PhaseClass<AnyPhase>'.\r\n" +
" Types of parameters 'parent' and 'parent' are incompatible.\r\n" +
" Type 'AnyPhase | null' is not assignable to type 'null'.\r\n" +
" Type 'AnyPhase' is not assignable to type 'null'.\r\n" +
"src/TicTacToeGame.ts(30,69): error TS2322: Type 'typeof GameEndedPhase' is not assignable to type 'PhaseClass<AnyPhase>'.\r\n" +
" Types of parameters 'parent' and 'parent' are incompatible.\r\n" +
" Type 'AnyPhase | null' is not assignable to type 'null'.\r\n" +
" Type 'AnyPhase' is not assignable to type 'null'.\r\n",
diagnosticCodes: [ 2322, 2322, 2322 ]
}
and this line:
this.setChild(LobbyPhase)
which produces a similar error:
M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:692
return new TSError(diagnosticText, diagnosticCodes);
^
TSError: ⨯ Unable to compile TypeScript:
src/TicTacToeGame.ts(26,19): error TS2345: Argument of type 'typeof LobbyPhase' is not assignable to parameter of type 'PhaseClass<null>'.
Types of parameters 'parent' and 'parent' are incompatible.
Type 'AnyPhase | null' is not assignable to type 'null'.
Type 'AnyPhase' is not assignable to type 'null'.
at createTSError (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:692:12)
at reportTSError (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:696:19)
at getOutput (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:883:36)
at Object.compile (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:1185:30)
at Module.m._compile (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:1309:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
at Object.require.extensions.<computed> [as .ts] (M:\GitHub\TicTacToe-Ravens\node_modules\ts-node\src\index.ts:1313:12)
at Module.load (internal/modules/cjs/loader.js:950:32)
at Function.Module._load (internal/modules/cjs/loader.js:790:12)
at Module.require (internal/modules/cjs/loader.js:974:19) {
diagnosticText: "src/TicTacToeGame.ts(26,19): error TS2345: Argument of type 'typeof LobbyPhase' is not assignable to parameter of type 'PhaseClass<null>'.\r\n" +
" Types of parameters 'parent' and 'parent' are incompatible.\r\n" +
" Type 'AnyPhase | null' is not assignable to type 'null'.\r\n" +
" Type 'AnyPhase' is not assignable to type 'null'.\r\n",
diagnosticCodes: [ 2345 ]
}
Am I missing something here? It seems like the problem is that the Phase classes that we implemented in the tutorial do not inherit from or implement AnyPhase or PhaseClass.
Is this a problem with how the tutorial code was written or a fundamental problem with the core code?
The text was updated successfully, but these errors were encountered:
I've tried to make Ravens Typescript-friendly, but I had a lot of trouble doing so due to the complexity of the generic types that I use. I've put Typescript support aside for the moment, as I'd rather work on something else than working on that.
I might add, in the future, some basic support. But being able to specify the state of a Phase, for example, and have this.state have proper typing seems to be harder than it looks.
I'm in the process of trying to port the tutorial code (which I got working as js/jsx) to use Typescript (ts/tsx).
NOTE: I have little-to-no typescript knowledge.
It seems like there's some problem with the
Phase
class and how it relates toPhaseClass
andAnyPhase
.I'm having two issues outlined below:
error:
and this line:
which produces a similar error:
Am I missing something here? It seems like the problem is that the Phase classes that we implemented in the tutorial do not inherit from or implement
AnyPhase
orPhaseClass
.Is this a problem with how the tutorial code was written or a fundamental problem with the
core
code?The text was updated successfully, but these errors were encountered: