The @inline
, @inlineType
and @preventInline
tags can be used to control how
TypeDoc converts references to type aliases and interfaces.
Tag Kind: Modifier
The @inline
tag may be placed on type aliases and interfaces. When a type is
annotated with @inline
and the type is referenced, TypeDoc will attempt to inline
the referenced type within the other type. TypeDoc is unable to inline some types,
notably type references with type parameters in some cases, and may make incorrect
guesses about the shape of types which aren't object literals, unions, intersections,
or literals. Please report a bug if @inline
incorrectly converts a type.
Use of this tag can significantly increase the size of your generated documentation if it is applied to commonly used types as it will result in inlining the comments for those types everywhere they are referenced.
/**
* @inline
*/
export type HelloProps = {
/** Name property docs */
name: string;
};
/**
* Hello component - HelloProps will be inlined here as
* if you had written `Hello(props: { name: string })`
*/
export function Hello(props: HelloProps) {
return <span>Hello {props.name}!</span>;
}
Tag Kind: Block
The @inlineType
block tag can be used to selectively inline a type reference
without inlining it everywhere. It should specify the type name without type
arguments.
export type HelloProps = {
name: string;
};
/**
* Hello component - HelloProps will be inlined here as
* if you had written `Hello(props: { name: string })`
* @inlineType HelloProps
*/
export function Hello(props: HelloProps) {
return <span>Hello {props.name}!</span>;
}
Tag Kind: Block
The @preventInline
block tag can be used to instruct TypeDoc to not inline a
tag which has been inlined with @inline
or @preventInline
. Note that TypeDoc
will be unable to produce a type reference instead of an inlined type if
TypeScript does not produce a named reference to begin with. If you remove
@inline
and the type is still inlined in your type, @preventInline
cannot
prevent the expansion.
/**
* @inline
*/
export type HelloProps = {
/** Name property docs */
name: string;
};
/**
* Hello component - HelloProps will NOT be inlined here
* @preventInline HelloProps
*/
export function Hello2(props: HelloProps) {
return <span>Hello {props.name}!</span>;
}
@expand
tags