Closed whazor closed 1 year ago
Hi. Could you explain what exactly you are trying to do?
I was trying to add types to the configuration file, but for this library the types are not published.
Ok. How are you trying to do this? I'm asking because I haven't seen a TypeDoc plugin that publishes its typings.
My goal is to add typings to the configuration.
I think I was trying something like:
/** @type {import('typedoc').TypeDocOptions & import('typedoc-plugin-replace-text').TypeDocOptionMap} */
module.exports = {
out: "output",
entryPointStrategy: "expand",
entryPoints: ["input/module1.ts", "input/module2.ts"],
tsconfig: "tsconfig.json",
readme: "MAIN.md",
plugin: ["typedoc-plugin-replace-text"],
replaceText: {
inCodeCommentText: true,
inCodeCommentTags: true,
inIncludedFiles: true,
replacements: [
{
pattern: "(GH-(\\d+))",
replace: "[$1](https://github.com/your-name/the-repo/issues/$2)"
},
{
pattern: "King Kong",
flags: "gi",
replace: (match) => {
return match + " is the greatest!";
},
},
],
},
};
Oh I see. That looks like a good idea. However I don't think that will work, because the type that you are importing is actually just a declaration merger used by the plugin to integrate with TypeDoc.
However I should be able to export the type of the plugin's options object in a different manner so that you can use it in you configuration. I'm going to take a closer look and let you know soon.
Finally I got around doing this. It is released with version 3.1.0.
It will work the way you were using it in your example with one small difference:
/** @type { import('typedoc').TypeDocOptionMap & import('typedoc-plugin-replace-text').Config } */
You need to use import('typedoc').TypeDocOptionMap
instead of import('typedoc').TypeDocOptions
because TypeDoc is using conditional types in TypeDocOptions
which aren't resolved correctly when intersected with other types.
Please check it out and give me feedback. Thank you.
Hi, could you please export the typescript typings (or source) into
dist/
? This would help me with typing the configuration.Currently, there are only JS files:![image](https://github.com/krisztianb/typedoc-plugin-replace-text/assets/184182/cddc248b-e292-40ca-bdcb-555c15a35320)
Thanks!