diff --git a/package-lock.json b/package-lock.json index fb801cb..f1fbab7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -28,8 +28,8 @@ "ts-mocha": "^10.0.0", "ts-node": "^10.9.2", "tsx": "^4.7.0", - "typescript": "^5.0.4", - "web-streams-polyfill": "^3.3.2" + "typescript": "^5.5.2", + "web-streams-polyfill": "^4.0.0" }, "engines": { "node": ">= 18.0.0" @@ -6048,9 +6048,9 @@ } }, "node_modules/typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", + "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", "dev": true, "bin": { "tsc": "bin/tsc", @@ -6224,9 +6224,9 @@ } }, "node_modules/web-streams-polyfill": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", - "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0.tgz", + "integrity": "sha512-0zJXHRAYEjM2tUfZ2DiSOHAa2aw1tisnnhU3ufD57R8iefL+DcdJyRBRyJpG+NUimDgbTI/lH+gAE1PAvV3Cgw==", "dev": true, "engines": { "node": ">= 8" @@ -10889,9 +10889,9 @@ } }, "typescript": { - "version": "5.3.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz", - "integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==", + "version": "5.5.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.5.2.tgz", + "integrity": "sha512-NcRtPEOsPFFWjobJEtfihkLCZCXZt/os3zf8nTxjVH3RvTSxjrCamJpbExGvYOF+tFHc3pA65qpdwPbzjohhew==", "dev": true }, "ua-parser-js": { @@ -11004,9 +11004,9 @@ } }, "web-streams-polyfill": { - "version": "3.3.2", - "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-3.3.2.tgz", - "integrity": "sha512-3pRGuxRF5gpuZc0W+EpwQRmCD7gRqcDOMt688KmdlDAgAyaB1XlN0zq2njfDNm44XVdIouE7pZ6GzbdyH47uIQ==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/web-streams-polyfill/-/web-streams-polyfill-4.0.0.tgz", + "integrity": "sha512-0zJXHRAYEjM2tUfZ2DiSOHAa2aw1tisnnhU3ufD57R8iefL+DcdJyRBRyJpG+NUimDgbTI/lH+gAE1PAvV3Cgw==", "dev": true }, "webpack": { diff --git a/package.json b/package.json index 2ebcf0c..123940f 100644 --- a/package.json +++ b/package.json @@ -46,8 +46,8 @@ "ts-mocha": "^10.0.0", "ts-node": "^10.9.2", "tsx": "^4.7.0", - "typescript": "^5.0.4", - "web-streams-polyfill": "^3.3.2" + "typescript": "^5.5.2", + "web-streams-polyfill": "^4.0.0" }, "peerDependencies": { "typescript": ">=4.2" diff --git a/test/node.test.ts b/test/node.test.ts index a624736..abb19ea 100644 --- a/test/node.test.ts +++ b/test/node.test.ts @@ -37,16 +37,16 @@ describe('Node integration tests', () => { it('polyfilled web stream cannot be converted into node native stream', async () => { const { ReadableStream: PolyfilledReadableStream } = await import ('web-streams-polyfill'); - // this test is just to keep track that this behaviour is expected + // this test is just to keep track that this behaviour is expected: it does not cause a TS error, but a runtime one const input = 'chunk'; - const stream = new PolyfilledReadableStream({ + const stream: NodeWebReadableStream = new PolyfilledReadableStream({ start(controller) { controller.enqueue(input); controller.close(); } }); const streamedData = toStream(stream); - // @ts-expect-error `fromWeb` does not accept the polyfilled stream + // `fromWeb` does not accept the polyfilled stream expect(() => NodeNativeReadableStream.fromWeb(streamedData)).to.throw(/must be an instance of ReadableStream/); }); }); diff --git a/test/typescript.test.ts b/test/typescript.test.ts index af19767..0103aa2 100644 --- a/test/typescript.test.ts +++ b/test/typescript.test.ts @@ -33,10 +33,10 @@ const newEmptyWebStream = (): WebStream => new WebReadableStr const expectedWebStreamButActualNodeStream: WebStream = toStream(nodeWebStream); assert(expectedWebStreamButActualNodeStream instanceof NodeWebReadableStream); const newStringStream: Stream = toStream('chunk'); - assert(newStringStream instanceof WebReadableStream); // ReadableStream is polyfilled + assert(newStringStream instanceof NodeWebReadableStream); // @ts-expect-error detect type parameter mismatch const anotherStringStream: Stream = toStream('chunk'); - assert(anotherStringStream instanceof WebReadableStream); // ReadableStream is polyfilled + assert(anotherStringStream instanceof NodeWebReadableStream); assert(isArrayStream(new ArrayStream())) ; // ensure Array is actually extended in e.g. es5