@workday/canvas-kit-docs
Version:
Documentation components of Canvas Kit components
33 lines • 1.91 kB
TypeScript
import ts from 'typescript';
import { ComponentValue } from './customTypes';
import { DocParser } from '../docParser';
import { ObjectProperty, Value } from '../docTypes';
export declare const componentParser: import("../docParser").ParserPlugin<ComponentValue>;
/**
* Evaluate the return type looking for a `React.ReactElement` type based on the `props`.
*/
export declare function isComponent(returnType: ts.Type): boolean;
/**
* Get the props of an interface. It is expected the type of the `Prop` interface has already been
* created and passed down. Where props are defined is very specific to how a React component is
* created.
*
* @param parser
* @param signature The function like component containing the component's implementation
* @param type The type of the props. We use a type because there are many ways the prop interface
* @param defaultProps Optional record of found default props could be created
*/
export declare function getComponentProps(parser: DocParser<ComponentValue>, type: ts.Type, defaultProps?: Record<string, Value>): ObjectProperty[];
/**
* A component might have a `defaultProps` literal. The `node` passed should be this node. If this
* node is an `ObjectLiteralExpression`, we'll try to parse to extract default props
*/
export declare function getDefaultsFromDefaultProps(parser: DocParser, node?: ts.Node): Record<string, Value>;
/**
* A parameter might represent a `ObjectBindingPattern` which can be used to set defaults. This will
* return all defaults found within the `ObjectBindingPattern` and return them as a map of the
* property name to the `Value`. These defaults can be used to piece together a default. Also
* `getDefaultFromTags` can be used to get defaults from JSDoc tags.
*/
export declare function getDefaultsFromObjectBindingPattern(parser: DocParser, node: ts.Node): Record<string, Value>;
//# sourceMappingURL=componentParser.d.ts.map