Skip to content

Commit ab12363

Browse files
Ship TypeScript declarations with foundry-local-sdk (#666)
`package.json` advertised `"types": "dist/index.d.ts"`, but the build never emitted declarations — consumers importing `foundry-local-sdk` from TypeScript got no IntelliSense or type checking. ### Changes - **`sdk/js/tsconfig.build.json`** — enable `declaration: true` and `sourceMap: true`. Scoped to the build tsconfig so tests/examples are unaffected. `declarationMap` is intentionally omitted to keep `src/` out of the tarball. - **`sdk/js/README.md`** — add a short "TypeScript support" section so the bundled typings are discoverable. No changes needed in `package.json` or `script/pack.cjs`: `dist/` is already in `files`, so the 16 emitted `.d.ts` files (`index`, `catalog`, `foundryLocalManager`, `configuration`, `imodel`, `types`, `openai/*`, `detail/*`) flow into the tarball automatically. The `foundry-local-sdk-winml` variant continues to inherit types transitively via its `foundry-local-sdk` dependency. ```jsonc // sdk/js/tsconfig.build.json "compilerOptions": { "rootDir": "./src", "outDir": "./dist", "declaration": true, "sourceMap": true } ``` `@internal`-tagged exports (`Model`, `ModelVariant`, `CoreInterop`, `Configuration`) are left in the emitted declarations to keep the public surface unchanged from what the `.js` already exposes; `stripInternal` can be layered on as a follow-up if tightening the advertised API is desired. Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: baijumeswani <12852605+baijumeswani@users.noreply.github.com>
1 parent 088f844 commit ab12363

2 files changed

Lines changed: 9 additions & 1 deletion

File tree

sdk/js/README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ The Foundry Local JS SDK provides a JavaScript/TypeScript interface for running
2121
npm install foundry-local-sdk
2222
```
2323

24+
## TypeScript support
25+
26+
The package is authored in TypeScript and ships with bundled type declarations (`.d.ts` files) alongside the compiled JavaScript. No `@types/foundry-local-sdk` package or manual ambient declarations are needed.
27+
28+
Importing from `foundry-local-sdk` in a TypeScript project gives you full type information and IntelliSense for every public API, including `FoundryLocalManager`, `Catalog`, `ChatClient`, `AudioClient`, `EmbeddingClient`, `ResponsesClient`, `LiveAudioTranscriptionSession`, and all of their associated option and response types.
29+
2430
## WinML: Automatic Hardware Acceleration (Windows)
2531

2632
On Windows, install the WinML package to enable automatic execution provider management. The SDK will automatically discover, download, and register hardware-specific execution providers (e.g., Qualcomm QNN for NPU acceleration) via the Windows App Runtime — no manual driver or EP setup required.

sdk/js/tsconfig.build.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
"extends": "./tsconfig.json",
33
"compilerOptions": {
44
"rootDir": "./src",
5-
"outDir": "./dist"
5+
"outDir": "./dist",
6+
"declaration": true,
7+
"sourceMap": true
68
},
79
"include": ["src/**/*"],
810
"exclude": ["node_modules", "test", "examples"]

0 commit comments

Comments
 (0)