Something went wrong. Try again.
fork of hey-api/openapi-ts because I need some additional things
Something went wrong. Try again.
914 B · 32 lines
TypeScript
123456789101112131415161718192021222324252627282930313233import type { AnalysisContext, Node } from '@hey-api/codegen-core';
import type { py } from '../../ts-python';import type { DocFn, DocLines } from '../layout/doc';import { DocPyDsl } from '../layout/doc';import type { BaseCtor, MixinCtor } from './types';
export interface DocMethods extends Node { $docs(): string | undefined; doc(lines?: DocLines, fn?: DocFn): this;}
export function DocMixin<T extends py.Node, TBase extends BaseCtor<T>>(Base: TBase) { abstract class Doc extends Base { private _doc?: DocPyDsl;
override analyze(ctx: AnalysisContext): void { super.analyze(ctx); }
protected doc(lines?: DocLines, fn?: DocFn): this { this._doc = new DocPyDsl(lines, fn); return this; }
protected $docs(): string | undefined { return this._doc ? this._doc.resolve() : undefined; } }
return Doc as unknown as MixinCtor<TBase, DocMethods>;}