Comments (3)
For this you'd have to write a custom plugin to overwrite the type with a stringified version, here's an example of how to do that for parameters.
$ npx typedoc src/gh2472.ts --plugin ./path/to/plugin.mjs
// @ts-check
import td from "typedoc";
/** @param {td.Application} app */
export function load(app) {
/** @type {Map<td.ParameterReflection, td.SomeType>} */
const replacements = new Map();
app.converter.on(td.Converter.EVENT_CREATE_PARAMETER, replaceTypesWithStrings);
app.converter.on(td.Converter.EVENT_RESOLVE_BEGIN, () => {
for (const [param, type] of replacements) {
param.type = type;
}
replacements.clear();
});
/**
* @param {td.Context} context
* @param {td.ParameterReflection} reflection
* @param {td.TypeScript.Node?} node
*/
function replaceTypesWithStrings(context, reflection, node) {
const symbol = context.project.getSymbolFromReflection(reflection);
if (!symbol) return;
const type = context.checker.typeToString(context.checker.getTypeOfSymbol(symbol));
replacements.set(reflection, new td.UnknownType(type));
}
}
from typedoc.
Great one! Look like it need to do custom callback to each places.
Could I ask more? I want this results apply to all places such as 'return', not just parameter. Could you another guide me? Or have any more detail document for this?
// for example. I want to get results as K[] and T[]
public myFunction(params: K[]): T[] {
...
return
}
from typedoc.
You'll have to add listeners for the other CREATE
events on the converter, and replace the type field on those too: https://typedoc.org/api/classes/Converter.html#EVENT_CREATE_DECLARATION is the big one, but there's also one for parameters and signatures
from typedoc.
Related Issues (20)
- TypeDoc crashes during link resolver HOT 7
- Exporting a function named `html` provokes a 404 (`index.html.html`) HOT 5
- Q: How to document CallExpression/CallSignature with TypeDoc? HOT 5
- Module DeclarationReflections are missing readme property in --json output with --entryPointStrategy=packages
- How do I "place a child in a group"? HOT 1
- feat: sort unions HOT 2
- issues about #2479 HOT 6
- Is there a JavaScript API? HOT 13
- Use icon-font instead of svg in html outputs HOT 1
- How can I output the documentation as react components? HOT 1
- Maximum call stack size exceeded for complex type HOT 3
- `@interface` type references do not always link correctly. HOT 1
- Duplicate comment in interfaces and types HOT 3
- How to exclude a folder to not be parsed? HOT 1
- How to include one dependency while using --excludeExternals? HOT 2
- [BUG] Index is empty initially HOT 3
- [BUG] Weird behavior with h2 headers when no h1 is present
- How to include changelog.md in typedoc output? HOT 9
- Typescript 5.4 support HOT 2
- Segoe UI font issue on Mac shows random letter/numbers in many places HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from typedoc.