core-types
Version:
Generic type declarations for e.g. TypeScript, GraphQL and JSON Schema
23 lines (22 loc) • 1.21 kB
TypeScript
import type { CoreTypeAnnotations, NodeType } from './types.js';
export declare function mergeAnnotations(nodes: Array<CoreTypeAnnotations>): CoreTypeAnnotations;
export declare function extractAnnotations(node: CoreTypeAnnotations): CoreTypeAnnotations;
export interface StringifyAnnotationsOptions {
/**
* Include the comment part of the annotation
*/
includeComment?: boolean;
/**
* Format whitespace so that the comment can be either wrapped within
* a \/* and *\/ boundary or prefixed with //
*/
formatWhitespace?: boolean;
}
export declare function wrapWhitespace(text: string): string;
export declare function stringifyAnnotations(node: CoreTypeAnnotations, { includeComment, formatWhitespace, }?: StringifyAnnotationsOptions): string;
export declare function stripAnnotations<T extends NodeType>(node: T, recursive?: boolean): T;
export declare function arrayOrSingle<T>(arr: Array<T>): T | Array<T>;
export declare function formatExamples(examples: Array<string>): string;
export declare function formatDefault(_default: string): string;
export declare function formatSee(see: Array<string>): string;
export declare function stringify(value: any): string;