Kind: Interface
Source: src/helper/ssg/ssg.ts
Part of: Helper
ToSSGResult represents the outcome of a static site generation operation. It reports whether generation succeeded, lists generated file paths, and carries an Error when the operation fails.
Properties
| Property | Type |
|---|---|
success | boolean |
files | string[] |
error | Error |
Diagram
mermaidgraph LR SSG[Static site generation] --> Result[ToSSGResult] Result --> Success[success: boolean] Result --> Files[files: string[]] Result --> Error[error: Error]
Usage
tsimport type { ToSSGResult } from "./src/helper/ssg/ssg";
function reportGeneration(result: ToSSGResult): void {
if (result.success) {
console.log("Generated files:", result.files);
return;
}
console.error("Static site generation failed:", result.error);
}
const result: ToSSGResult = {
success: true,
files: ["dist/index.html", "dist/about/index.html"],
error: new Error(),
};
reportGeneration(result);
AI Coding Instructions
- Return
success,files, anderrortogether when creating aToSSGResult. - Check
successbefore treating entries infilesas generated output. - Pass the original failure through the
errorfield so callers can log or handle it. - Keep
fileslimited to paths produced by the static site generation operation.
Was this page helpful?