feat: Add TypeScript declarations for the programmatic API - #1340
Open
ThomasHartDev wants to merge 1 commit into
Open
feat: Add TypeScript declarations for the programmatic API#1340ThomasHartDev wants to merge 1 commit into
ThomasHartDev wants to merge 1 commit into
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1238
Adds TypeScript declarations for the programmatic
@vercel/nccAPI and pointspackage.jsontypesat 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.jscopiessrc/index.d.tsintodist/ncc/index.d.tsso the published package ships the types next tomain.Verified with
pnpm test-types(strict check over a small consumer fixture),pnpm build(confirmsdist/ncc/index.d.tsis emitted), andpnpm exec jest test/unit.test.js test/watcher.test.js --runInBand(29 passed). Fullpnpm testhits two environment-only flakes on this host (socket.io needs free:3000; theTYPESCRIPT_LOOKUP_PATH=/tmp/nowhereCLI case finds typescript under/tmp/node_modules); both fail the same way without this change.