Summary
webfont() resolves to a Result object whose config is a ResultConfig, but neither type is re-exported from the package entry (src/index.ts). TypeScript consumers currently cannot do:
import webfont, { type Result, type ResultConfig } from "webfont";
and have to fall back to ReturnType/Awaited inference to annotate the output.
Current state on master
src/types/Result.ts and src/types/ResultConfig.ts define and export the types internally.
src/index.ts only exports webfont (named + default), the SVG diagnostics helpers, and SvgToolsOptions types — not Result / ResultConfig.
result.config.filePath is already modeled as result-only metadata on master (landed in f557233, "fix: model filePath as result-only metadata"), but it is not documented in the README.
Proposed change
- Re-export the public result types from the entry point:
export type { Result } from "./types/Result";
export type { ResultConfig } from "./types/ResultConfig";
- Document the result shape in
README.md:
- A new Result section describing
result.config (effective options + output metadata).
result.config.filePath — absolute path of the discovered/loaded config file; output-only (ignored if set as input).
- A short TypeScript usage example using the exported types.
Reference implementation
An unmerged local branch feat/export-result-types already implements this (no PR was ever opened):
460bb4c — feat: export Result and ResultConfig types from package entry (the src/index.ts re-exports).
- README additions: a Result section, a TypeScript example, and
result.config.filePath docs.
- Also carries expanded cosmiconfig coverage (
src/standalone/cosmiconfig.test.ts) that can be split out if desired.
The filePath modeling portion of that branch is already on master; the remaining, genuinely new work is the public type export + README documentation.
Acceptance criteria
Summary
webfont()resolves to aResultobject whoseconfigis aResultConfig, but neither type is re-exported from the package entry (src/index.ts). TypeScript consumers currently cannot do:and have to fall back to
ReturnType/Awaitedinference to annotate the output.Current state on
mastersrc/types/Result.tsandsrc/types/ResultConfig.tsdefine andexportthe types internally.src/index.tsonly exportswebfont(named + default), the SVG diagnostics helpers, andSvgToolsOptionstypes — notResult/ResultConfig.result.config.filePathis already modeled as result-only metadata onmaster(landed inf557233, "fix: model filePath as result-only metadata"), but it is not documented in the README.Proposed change
README.md:result.config(effective options + output metadata).result.config.filePath— absolute path of the discovered/loaded config file; output-only (ignored if set as input).Reference implementation
An unmerged local branch
feat/export-result-typesalready implements this (no PR was ever opened):460bb4c—feat: export Result and ResultConfig types from package entry(thesrc/index.tsre-exports).result.config.filePathdocs.src/standalone/cosmiconfig.test.ts) that can be split out if desired.The
filePathmodeling portion of that branch is already onmaster; the remaining, genuinely new work is the public type export + README documentation.Acceptance criteria
import type { Result, ResultConfig } from "webfont"type-checks for consumers (verify viaattw/ pack-smoke innpm run test:package).result.configandresult.config.filePathwith a TypeScript example.