UNPKG

@irwinproject/storybook-addon-tsdoc

Version:
93 lines (92 loc) 3.82 kB
import { JSDoc, Node, Type } from "ts-morph"; import SK from "./SyntaxKindDelegator.types"; import { Nodely } from "./types"; /** * Because there isnt a standard way to mark something private. * @param node * @returns */ export declare const isPrivate: (node: Nodely) => boolean; /** * Get a nodes name if one is available * @param node * @returns */ export declare const getName: <T extends Node>(node: Nodely<T>) => string; /** * Gets a / delimited list of names from source to current node * @param node * @returns */ export declare const getFullName: (node: Node, delim?: string) => string; /** * Gets the signature of a declaration. * @param node * @param delim * @returns */ export declare const getSignatureName: (node: Node, delim?: string) => string; export declare const isKeyword: (node: Nodely) => node is import("ts-morph").Expression<import("ts-morph").ts.Expression> | Node<import("ts-morph").ts.Token<SK.NeverKeyword>> | Node<import("ts-morph").ts.Token<SK.InferKeyword>>; /** * Get the JSDocs if available. * to avoid potential duplicate documentation explicit corner cases should be used. * * - variableDeclarations. (the declarations JSDoc should be derived from the statement) * @param node * @returns */ export declare const getJsDocs: (node: Nodely) => JSDoc[]; /** * Instead it seems better to just support JSDoc separately from the built in typing. As I integrate properties into the signature process I can omit them from here. */ export declare const OMITTED_TAGS: Set<string>; /** * This method is to simplify some of the tag parsing into one place. however with some tags being designed to affect the actual typing in the linter and editor I need to experiment with how these tags effect typescript in different environments. * * To be clear this will only parse tags that just need to be displayed but do not effect the typing of the object. * @param doc */ export declare const parseTags: (doc: JSDoc) => string; export declare const parseDoc: (doc: JSDoc) => string; export declare const getComments: (node: Nodely) => string; /** * Converts the ancestors into a family name. * @param node * @returns */ export declare const getFamilyName: (node: Node, delim?: string) => string; export declare const isAsync: (node: Node) => any; export declare const getTypeNode: (node?: Node) => import("ts-morph").Expression<import("ts-morph").ts.Expression> | import("ts-morph").TypeNode<import("ts-morph").ts.TypeNode> | undefined; /** * In some cases the named node is the parent node of the evaluated node this just climbs the node tree until it finds a name * @param node */ export declare const getNearestName: (node?: Node) => string; export declare const getFName: (node: Node) => string; /** * Gets the source of the node and returns a storybook formatted link to the documentation of said node if the node exists within the scope provided by the entry point. * @param node */ export declare const getDocPath: (node: Node) => string | undefined; /** * With there being 4 to 5 different method like declarations it seems like a good way to reduce redundant code. * @param node * @returns */ export declare const isMethodLike: (node?: Node) => boolean; /** * Checks to see if the Node is primitive * * update: using Kind value is simpler response as I am not confirming a specific type. * @param node * @returns */ export declare const isPrimitive: (node?: Node) => boolean; export declare const getExample: (node: Node) => string; export declare const renderCode: (code: string) => string; export declare const isStatic: (node: Node) => boolean; /** * attempt to get a Node from the type declaration * @param type */ export declare const declarationOfType: (type: Type, onlyAnonymous?: boolean) => Node<import("ts-morph").ts.Node> | undefined;