initial project setup

This commit is contained in:
2025-03-11 08:16:29 -04:00
commit 001a4ee4fc
48 changed files with 12260 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
// Copyright (c) Microsoft Corporation
// Licensed under the MIT license.
import { Type, getDoc } from "@typespec/compiler";
import { JsContext } from "../ctx.js";
import { indent } from "../util/iter.js";
/**
* Emit the documentation for a type in JSDoc format.
*
* This assumes that the documentation may include Markdown formatting.
*
* @param ctx - The emitter context.
* @param type - The type to emit documentation for.
*/
export function* emitDocumentation(ctx: JsContext, type: Type): Iterable<string> {
const doc = getDoc(ctx.program, type);
if (doc === undefined) return;
yield `/**`;
yield* indent(doc.trim().split(/\r?\n/g), " * ");
yield ` */`;
}