Closed aSemy closed 2 years ago
If I manually edit classes.d.ts
and comment out the JSDoc above on_init()
, then doesn't complain! Very weird!
// /**
// * Register a function to be run on mod initialization. This is only called when a new save game is created or when a save file is loaded that previously didn't contain the mod. During it, the mod gets the chance to set up initial values that it will use for its lifetime. It has full access to {@link LuaGameScript} and the {@link https://lua-api.factorio.com/latest/Global.html global} table and can change anything about them that it deems appropriate. No other events will be raised for the mod until it has finished this step.
// *
// * {@link https://lua-api.factorio.com/latest/LuaBootstrap.html#LuaBootstrap.on_init View documentation}
// *
// * ASd
// *
// * @param f The handler for this event. Passing `nil` will unregister it.
// * @remarks For more context, refer to the {@link https://lua-api.factorio.com/latest/Data-Lifecycle.html Data Lifecycle} page.
// * @example Initialize a `players` table in `global` for later use.
// *
// * ```
// * script.on_init(function()
// * global.players = {}
// * end)
// * ```
// */
on_init(f: (() => void) | undefined): void
No more error for on_init()
:
...
Emit finished!
node_modules/typed-factorio/generated/classes.d.ts:267:3 - error TS2304: Cannot find name 'https'.
267 on_configuration_changed(f: ((param1: ConfigurationChangedData) => void) | undefined): void
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Process finished with exit code 2
It's something to do with the {@link https...}
inside the @remarks
block.
I can't find anyone else who's had this issue.
If I wrap the link in backticks then compilation works, and the link seems to render correctly UPDATE but it's not valid, and I can't click on it.
* @remarks For more context, refer to the {@link `https://lua-api.factorio.com/latest/Data-Lifecycle.html` Data Lifecycle} page.
It looks like this might be a TSTL issue https://github.com/TypeScriptToLua/TypeScriptToLua/issues/1058
This seems to be a Typescript issue. I couldn't find a nice workaround for this in typed-factorio; we'll have to wait for Typescript's response.
For now, a workaround is to add skipLibCheck: true
to your tsconfig > compilerOptions.
Great, that works, thanks! That's much better than the hack I implemented.
I was doing some investigation in https://github.com/microsoft/TypeScript/issues/49109 and I think I found a workaround: change {@link ...}
to {@linkplain ...}
when it refers to https links.
Thanks for the tip! v1.3.1 now uses @linkplain instead of @link for web links. Hopefully this works around this issue.
Sorry, false alarm - I get exactly the same error with @linkplain
:(
Oh well; no harm done; web links usually want to be plain links anyways.
For now, in v1.3.2, I've moved the notes comment into the main body of the doc comment, avoiding @remarks entirely.
Closing this issue for now. If Typescript fixes their bug in the future, we may move back to using @remarks.
Hi, I'm getting a new error after updating to v1.1.0.
If I downgrade to v1.0.0 it works correctly, no errors.
TSTL seems to run okay, but something fails on the last step.
package.json
tsconfig.json
npm-cache log