diff --git a/types/crypto/crypto.d.ts b/types/crypto/crypto.d.ts index a806137d52..ab9785a4dc 100644 --- a/types/crypto/crypto.d.ts +++ b/types/crypto/crypto.d.ts @@ -47,7 +47,13 @@ declare module 'stripe' { * defaults to the `crypto.subtle` object in the global scope. */ export const createSubtleCryptoProvider: ( - subtleCrypto?: WindowOrWorkerGlobalScope['crypto']['subtle'] + /** + * The SubtleCrypto type cannot be specified without pulling in DOM types. + * This corresponds to WindowOrWorkerGlobalScope['crypto']['subtle'] for + * applications which pull in DOM types. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + subtleCrypto?: any ) => CryptoProvider; } } diff --git a/types/net/net.d.ts b/types/net/net.d.ts index 4492c4c03d..57fc880124 100644 --- a/types/net/net.d.ts +++ b/types/net/net.d.ts @@ -1,5 +1,4 @@ /// -/// import {IncomingMessage} from 'http'; declare module 'stripe' { @@ -76,11 +75,24 @@ declare module 'stripe' { * passed, will default to the default `fetch` function in the global scope. */ export const createFetchHttpClient: ( - fetchFn?: WindowOrWorkerGlobalScope['fetch'] + /** When specified, interface should match the Web Fetch API function. */ + fetchFn?: Function ) => HttpClient< HttpClientResponse< - ReturnType, - ReadableStream + /** + * The response type cannot be specified without pulling in DOM types. + * This corresponds to ReturnType + * for applications which pull in DOM types. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + any, + /** + * The stream type cannot be specified without pulling in DOM types. + * This corresponds to ReadableStream for applications which + * pull in DOM types. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + any > >; } diff --git a/types/test/typescriptTest.ts b/types/test/typescriptTest.ts index 99dc1bc88f..aa8ed12092 100644 --- a/types/test/typescriptTest.ts +++ b/types/test/typescriptTest.ts @@ -228,7 +228,7 @@ async (): Promise => { // Test FetchHttpClient request processing. async (): Promise => { - const client = Stripe.createFetchHttpClient(window.fetch); + const client = Stripe.createFetchHttpClient(); const response = await client.makeRequest( 'api.stripe.com', @@ -244,7 +244,7 @@ async (): Promise => { 80000 ); - const stream: ReadableStream = response.toStream(() => { + const stream = response.toStream(() => { return; });