In order to easily use the json file for documentation rendering, could it be possible to "deserialize" and get a ProjectReflection object ?
Neat idea! Currently not possible, and this would probably require a fair bit of work since serialization is spread out over so many different classes right now. If you want a ProjectReflection for now it's probably best to use the api to generate one.
const td = require('typedoc');
const app = new td.Application({
// options
});
const inputFiles = app.expandInputFiles('src');
const projectReflection = app.convert(inputFiles);
From what I (believe to) recall this is practically impossible at the moment because:
A better way might be to stop accessing reflection instances in the theme and instead rely on a reduced dataset (like from toObject()).
I recently spent quite a bit of time in the serialization code and agree with mootari. There isn't any nice way to resolve this. If you need a ProjectReflection when rendering a theme, the best way to do that is to use the code I provided above.
So... this seems to be a recurring theme with TypeDoc for me. I think something is impossible, then 6 months or a year later I come back and realize - this isn't that difficult. There are a few things that need to happen first (and some of these are being done for library mode), but this is definitely doable, and I really like the idea.
Application:Deserializer module.ts
interface Deserailizer {
addReflectionDeserailizer(kind: ReflectionKind, Extract<SomeReflection, { kind }>)
addTypeDeserailizer(kind: TypeKind, Extract<SomeType, { kind }>)
deserializeReflection(json: object): SomeReflection
deserializeType(json: object): SomeType
}
The deserializer should work in much the same way as the serializer used in library mode (not pushed to GH yet, still have another 200 or so type errors to fix...)
Most helpful comment
Neat idea! Currently not possible, and this would probably require a fair bit of work since serialization is spread out over so many different classes right now. If you want a
ProjectReflectionfor now it's probably best to use the api to generate one.