foundry-vtt-types
foundry-vtt-types copied to clipboard
Typescript 4.7 - document.mjs.d.ts - Return type annotation circularly references itself
Foundry VTT Version
v9
Description
Hi,
Running typescript on fvtt types returns the following error:
node_modules/@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/abstract/document.mjs.d.ts:150:6 - error TS2577: Return type annotation circularly references itself.
150 ): TemporaryDocument<this> | Promise<TemporaryDocument<this> | undefined>;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in node_modules/@league-of-foundry-developers/foundry-vtt-types/src/foundry/common/abstract/document.mjs.d.ts:150
That's happening with version 4.7.4 of typescript - but it works well on version 4.6.2
Reproduction Steps
Use typescript 4.7.4
Expected Behavior
should work
Additional Context
Thanks
It doesn't seem to be an error in the types themselves, as there is no compile error when running a type check across the types themselves.
Due to the way the types are used, by injecting your own configuration into them, it's possible to introduce errors from the user side that show up as errors in the library. In order to figure out what the error actually is and to check if it's an error with your usage of the types, or an error in the types after all, we need to take a closer look at the project that the error happens in. Could you give a link to a branch of your project that exhibits the problem? I would also guess that the compile error contains a bit more information about the circular reference issue, or more error messages. Could you please provide the full error message(s)?
@ghost91-
You can clone this project https://bitbucket.org/rpgframework-cloud/shadowrun6-eden/src/master/ and in package.json replace typescript version to be 4.7.4 and run npm install then npm run build. Hope that will help
@gsouf Sorry, but since we are so busy with trying to get the types to work properly for v10, I don't have the capacity to properly look into this in more detail right now.
As a workaround, can you make it work by specifying "skipLibCheck": true in your tsconfig.json file?
@ghost91- thanks for your message. I keep using older version of typescript for now not a big deal
We appeared to have slayed the circularity dragon. I am closing this ticket!