From 08bf8b8ad1beb7529685ecd67ebc95fdd4352ffa Mon Sep 17 00:00:00 2001 From: Colin McDonnell Date: Mon, 2 Oct 2023 15:18:29 -0700 Subject: [PATCH] Add Bun.TOML to types (#6161) --- packages/bun-types/bun.d.ts | 13 +++++++++++++ packages/bun-types/tests/bun.test-d.ts | 3 +++ 2 files changed, 16 insertions(+) diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index 9b2d314e83..d8d8fd2040 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -70,6 +70,19 @@ declare module "bun" { options?: { PATH?: string; cwd?: string }, ): string | null; + interface TOML { + /** + * Parse a TOML string into a JavaScript object. + * + * @param {string} command The name of the executable or script + * @param {string} options.PATH Overrides the PATH environment variable + * @param {string} options.cwd Limits the search to a particular directory in which to searc + * + */ + parse(input: string): object; + } + export const TOML: TOML; + export type Serve = | ServeOptions | TLSServeOptions diff --git a/packages/bun-types/tests/bun.test-d.ts b/packages/bun-types/tests/bun.test-d.ts index 03301c13db..cd5a40ecaf 100644 --- a/packages/bun-types/tests/bun.test-d.ts +++ b/packages/bun-types/tests/bun.test-d.ts @@ -41,3 +41,6 @@ import * as tsd from "tsd"; env: { ...process.env, dummy: "" }, }); } +{ + Bun.TOML.parse("asdf = asdf"); +}