From 9090b264a34b6551806c09862d285dd2a3a5248c Mon Sep 17 00:00:00 2001 From: ascebiswajit <100769299+ascebiswajit@users.noreply.github.com> Date: Thu, 15 Oct 2026 15:53:26 +0530 Subject: [PATCH 1/2] fix(sio-client): export acknowledgement decorator for declaration emit --- .github/workflows/ci-socket.io-client.yml | 5 +++++ .../typescript-check-public-exports/mapped-socket.mts | 9 +++++++++ examples/typescript-check-public-exports/tsconfig.json | 3 ++- packages/socket.io-client/lib/index.ts | 2 ++ packages/socket.io-client/package.json | 2 +- 5 files changed, 19 insertions(+), 2 deletions(-) create mode 100644 examples/typescript-check-public-exports/mapped-socket.mts diff --git a/.github/workflows/ci-socket.io-client.yml b/.github/workflows/ci-socket.io-client.yml index 50fab02d0..7f59697c9 100644 --- a/.github/workflows/ci-socket.io-client.yml +++ b/.github/workflows/ci-socket.io-client.yml @@ -13,6 +13,7 @@ on: - 'packages/socket.io-client/**' - 'packages/socket.io-component-emitter/**' - 'packages/socket.io-parser/**' + - 'examples/typescript-check-public-exports/**' - '.github/workflows/ci-socket.io-client.yml' pull_request: paths: @@ -24,6 +25,7 @@ on: - 'packages/socket.io-client/**' - 'packages/socket.io-component-emitter/**' - 'packages/socket.io-parser/**' + - 'examples/typescript-check-public-exports/**' - '.github/workflows/ci-socket.io-client.yml' permissions: @@ -57,6 +59,9 @@ jobs: - name: Compile package run: npm run compile --workspace=socket.io-client + - name: Check public type declarations + run: npm run test:types --workspace=socket.io-client + - name: Compile dev dependencies run: | npm run compile \ diff --git a/examples/typescript-check-public-exports/mapped-socket.mts b/examples/typescript-check-public-exports/mapped-socket.mts new file mode 100644 index 000000000..6b15bfcc9 --- /dev/null +++ b/examples/typescript-check-public-exports/mapped-socket.mts @@ -0,0 +1,9 @@ +import { io } from "socket.io-client"; + +// Reactive stores expose the public properties of a Socket through mapped types. +// Declaration emit must be able to name the types used by those properties. +function publicProperties(value: T): { [K in keyof T]: T[K] } { + return value; +} + +export const socket = publicProperties(io({ autoConnect: false })); diff --git a/examples/typescript-check-public-exports/tsconfig.json b/examples/typescript-check-public-exports/tsconfig.json index ff4537d37..5c45b0748 100644 --- a/examples/typescript-check-public-exports/tsconfig.json +++ b/examples/typescript-check-public-exports/tsconfig.json @@ -19,7 +19,8 @@ "sourceMap": true, "declaration": true, "declarationMap": true, - "noEmit": true, + "emitDeclarationOnly": true, + "outDir": "./dist", // Stricter Typechecking Options "noUncheckedIndexedAccess": true, diff --git a/packages/socket.io-client/lib/index.ts b/packages/socket.io-client/lib/index.ts index 9ffd54225..7e0489845 100644 --- a/packages/socket.io-client/lib/index.ts +++ b/packages/socket.io-client/lib/index.ts @@ -1,6 +1,7 @@ import { url } from "./url.js"; import { Manager, ManagerOptions, ManagerReservedEvents } from "./manager.js"; import { + DecorateAcknowledgements, DisconnectDescription, ExtendedError, Socket, @@ -97,6 +98,7 @@ export { protocol } from "socket.io-parser"; */ export { + DecorateAcknowledgements, DisconnectDescription, ExtendedError, Manager, diff --git a/packages/socket.io-client/package.json b/packages/socket.io-client/package.json index 972c7bfea..a9560923f 100644 --- a/packages/socket.io-client/package.json +++ b/packages/socket.io-client/package.json @@ -55,7 +55,7 @@ "test": "npm run format:check && npm run compile && if test \"$BROWSERS\" = \"1\" ; then npm run test:browser; else npm run test:node; fi", "test:node": "mocha --import=tsx --require test/support/hooks.ts --exit test/index.ts", "test:browser": "ts-node test/browser-runner.ts", - "test:types": "exit 0", + "test:types": "tsc -p ../../examples/typescript-check-public-exports", "build": "rollup -c support/rollup.config.umd.js && rollup -c support/rollup.config.esm.js && rollup -c support/rollup.config.umd.msgpack.js", "bundle-size": "node support/bundle-size.js", "format:check": "prettier --check \"*.js\" \"lib/**/*.ts\" \"test/**/*.ts\" \"support/**/*.js\"", From 271d4fe996679d7063911073ed8c1bf855763b48 Mon Sep 17 00:00:00 2001 From: ascebiswajit <100769299+ascebiswajit@users.noreply.github.com> Date: Thu, 15 Oct 2026 16:13:32 +0530 Subject: [PATCH 2/2] ci(sio-client): skip Sauce Labs tests when credentials are unavailable --- .github/workflows/ci-socket.io-client.yml | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-socket.io-client.yml b/.github/workflows/ci-socket.io-client.yml index 7f59697c9..2ce2de8dc 100644 --- a/.github/workflows/ci-socket.io-client.yml +++ b/.github/workflows/ci-socket.io-client.yml @@ -72,8 +72,23 @@ jobs: - name: Run tests run: npm test --workspace=socket.io-client - - name: Run browser tests + - name: Check browser test credentials if: github.event_name == 'push' + id: browser-tests + env: + SAUCE_USERNAME: ${{ secrets.SAUCE_USERNAME }} + SAUCE_ACCESS_KEY: ${{ secrets.SAUCE_ACCESS_KEY }} + run: | + if [ -n "$SAUCE_USERNAME" ] && [ -n "$SAUCE_ACCESS_KEY" ]; then + echo "enabled=true" >> "$GITHUB_OUTPUT" + else + echo "enabled=false" >> "$GITHUB_OUTPUT" + echo "::notice::Skipping Sauce Labs browser tests: credentials are not configured." + echo "Browser tests skipped because Sauce Labs credentials are not configured. Browser coverage has not been verified." >> "$GITHUB_STEP_SUMMARY" + fi + + - name: Run browser tests + if: github.event_name == 'push' && steps.browser-tests.outputs.enabled == 'true' run: npm test --workspace=socket.io-client env: BROWSERS: 1