Actor type doesn't have prepareData, prepareBaseData, prepareDerivedData, etc...
william-gooch opened this issue · comments
William Gooch commented
Foundry VTT Version
v9
Description
In trying to make a system using this library, when trying to extend the Actor class I can't override the prepareData method (et al) because they don't exist on the base Actor class.
Importantly, this does not occur on the Item class, a similar example to the below with an Item subclass compiles just fine.
Reproduction Steps
Create a new project with this tsconfig.json
:
{
"compilerOptions": {
"module": "commonjs",
"moduleResolution": "node",
"target": "ES2018",
"lib": ["DOM", "ES6", "ES2017", "ES2018"],
"types": ["@league-of-foundry-developers/foundry-vtt-types", "node"],
"allowUmdGlobalAccess": true,
"skipLibCheck": true
},
"files": ["test.ts"]
}
Then add to a file test.ts
:
class TestActor extends Actor {
override prepareData() {
super.prepareData();
}
}
Expected Behavior
Should compile with no issues.
Additional Context
Error given is:
test.ts:2:12 - error TS4113: This member cannot have an 'override' modifier because it is not declared in the base class 'Actor'.
2 override prepareData() {
~~~~~~~~~~~
test.ts:3:11 - error TS2339: Property 'prepareData' does not exist on type 'Actor'.
3 super.prepareData();
~~~~~~~~~~~
Kai Moschcau commented
Hi, please have a look at the Usage section of the README. The types need at least strictNullChecks
, ideally strict
set to true in your tsconfig to work properly.