From 263a397723a0598e1ad633d544e1563400879324 Mon Sep 17 00:00:00 2001 From: LewieJ08 Date: Tue, 7 Jul 2026 17:04:18 +0100 Subject: [PATCH] Add examples type-checking to CI examples/ was never type-checked anywhere - not by npm run build (only src/ and tests/ are in tsconfig.json's include) and not by CI. This is exactly how the user.login typo in basic-usage.ts (fixed in ae1c0dc) went undetected through the #56 docs/examples audit. Added tsconfig.examples.json, which type-checks examples/ against the real SDK source via a path mapping for the @lujax/github-sdk import (the package isn't installed from npm during local dev, so bare imports need to resolve to src/index.ts instead). Wired a new typecheck:examples script into ci.yml, between build and test. Verified it actually catches the class of bug it's meant to: temporarily reintroduced user.login and confirmed tsc fails with "Property 'login' does not exist on type 'User'", then reverted. Co-Authored-By: Claude Sonnet 5 --- .github/workflows/ci.yml | 1 + package.json | 3 ++- tsconfig.examples.json | 10 ++++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 tsconfig.examples.json diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c384ae6..caa64cc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,5 +22,6 @@ jobs: - run: npm ci - run: npm run build + - run: npm run typecheck:examples - run: npm test - run: npm run format:check diff --git a/package.json b/package.json index fe4e7d2..9ccac26 100644 --- a/package.json +++ b/package.json @@ -32,7 +32,8 @@ "format:check": "prettier . --check", "test": "jest", "test:watch": "jest --watch", - "test:coverage": "jest --coverage" + "test:coverage": "jest --coverage", + "typecheck:examples": "tsc -p tsconfig.examples.json" }, "keywords": [ "github", diff --git a/tsconfig.examples.json b/tsconfig.examples.json new file mode 100644 index 0000000..e64469e --- /dev/null +++ b/tsconfig.examples.json @@ -0,0 +1,10 @@ +{ + "extends": "./tsconfig.json", + "compilerOptions": { + "paths": { + "@lujax/github-sdk": ["./src/index.ts"] + } + }, + "include": ["examples/**/*"], + "exclude": ["node_modules", "dist"] +}