Skip to content

feat: Add TypeScript declarations for the programmatic API - #1340

Open
ThomasHartDev wants to merge 1 commit into
vercel:mainfrom
ThomasHartDev:fix/issue-1238-typescript-declarations
Open

feat: Add TypeScript declarations for the programmatic API#1340
ThomasHartDev wants to merge 1 commit into
vercel:mainfrom
ThomasHartDev:fix/issue-1238-typescript-declarations

Conversation

@ThomasHartDev

Copy link
Copy Markdown

Fixes #1238

Adds TypeScript declarations for the programmatic @vercel/ncc API and points package.json types at them. The declarations cover the documented build options, watch-mode overloads (handler / rebuild / close), and the real return shape (code, map, assets, symlinks, stats). scripts/build.js copies src/index.d.ts into dist/ncc/index.d.ts so the published package ships the types next to main.

Verified with pnpm test-types (strict check over a small consumer fixture), pnpm build (confirms dist/ncc/index.d.ts is emitted), and pnpm exec jest test/unit.test.js test/watcher.test.js --runInBand (29 passed). Full pnpm test hits two environment-only flakes on this host (socket.io needs free :3000; the TYPESCRIPT_LOOKUP_PATH=/tmp/nowhere CLI case finds typescript under /tmp/node_modules); both fail the same way without this change.

Ship index.d.ts with the package so require('@vercel/ncc') is usable from
TypeScript without ambient stubs. Types cover the documented options,
watch mode overloads, and the build result shape (code, map, assets,
symlinks, stats).

Closes vercel#1238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TypeScript Declarations

1 participant