Skip to content

Commit

Permalink
remove references to "dom" ts lib (#11449)
Browse files Browse the repository at this point in the history
* remove references to "dom" ts lib

* changeset

* api extractor
  • Loading branch information
phryneas authored Jan 8, 2024
1 parent a4b4ef5 commit f40cda4
Show file tree
Hide file tree
Showing 10 changed files with 17 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .api-reports/api-report-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ const enum CacheWriteBehavior {
type CanReadFunction = (value: StoreValue) => boolean;

// @public (undocumented)
export const checkFetcher: (fetcher: WindowOrWorkerGlobalScope["fetch"] | undefined) => void;
export const checkFetcher: (fetcher: typeof fetch | undefined) => void;

// @public (undocumented)
export type ClientParseError = InvariantError & {
Expand Down Expand Up @@ -897,7 +897,7 @@ export class HttpLink extends ApolloLink {
// @public (undocumented)
export interface HttpOptions {
credentials?: string;
fetch?: WindowOrWorkerGlobalScope["fetch"];
fetch?: typeof fetch;
fetchOptions?: any;
headers?: Record<string, string>;
includeExtensions?: boolean;
Expand Down
2 changes: 1 addition & 1 deletion .api-reports/api-report-link_batch-http.md
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ interface GraphQLRequest<TVariables = Record<string, any>> {
// @public (undocumented)
interface HttpOptions {
credentials?: string;
fetch?: WindowOrWorkerGlobalScope["fetch"];
fetch?: typeof fetch;
fetchOptions?: any;
headers?: Record<string, string>;
includeExtensions?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions .api-reports/api-report-link_http.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ interface Body_2 {
}

// @public (undocumented)
export const checkFetcher: (fetcher: WindowOrWorkerGlobalScope["fetch"] | undefined) => void;
export const checkFetcher: (fetcher: typeof fetch | undefined) => void;

// @public (undocumented)
export type ClientParseError = InvariantError & {
Expand Down Expand Up @@ -186,7 +186,7 @@ export class HttpLink extends ApolloLink {
// @public (undocumented)
export interface HttpOptions {
credentials?: string;
fetch?: WindowOrWorkerGlobalScope["fetch"];
fetch?: typeof fetch;
fetchOptions?: any;
headers?: Record<string, string>;
includeExtensions?: boolean;
Expand Down
4 changes: 2 additions & 2 deletions .api-reports/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ const enum CacheWriteBehavior {
type CanReadFunction = (value: StoreValue) => boolean;

// @public (undocumented)
export const checkFetcher: (fetcher: WindowOrWorkerGlobalScope["fetch"] | undefined) => void;
export const checkFetcher: (fetcher: typeof fetch | undefined) => void;

// @public (undocumented)
export type ClientParseError = InvariantError & {
Expand Down Expand Up @@ -1075,7 +1075,7 @@ export class HttpLink extends ApolloLink {
// @public (undocumented)
export interface HttpOptions {
credentials?: string;
fetch?: WindowOrWorkerGlobalScope["fetch"];
fetch?: typeof fetch;
fetchOptions?: any;
headers?: Record<string, string>;
includeExtensions?: boolean;
Expand Down
5 changes: 5 additions & 0 deletions .changeset/many-bottles-count.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@apollo/client": patch
---

Removes refences to the typescript "dom" lib.
5 changes: 1 addition & 4 deletions src/link/http/__tests__/HttpLink.ts
Original file line number Diff line number Diff line change
Expand Up @@ -887,10 +887,7 @@ describe("HttpLink", () => {

itAsync("allows uri to be a function", (resolve, reject) => {
const variables = { params: "stub" };
const customFetch: WindowOrWorkerGlobalScope["fetch"] = (
uri,
options
) => {
const customFetch: typeof fetch = (uri, options) => {
const { operationName } = convertBatchedBody(options!.body);
try {
expect(operationName).toBe("SampleQuery");
Expand Down
4 changes: 1 addition & 3 deletions src/link/http/checkFetcher.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { newInvariantError } from "../../utilities/globals/index.js";

export const checkFetcher = (
fetcher: WindowOrWorkerGlobalScope["fetch"] | undefined
) => {
export const checkFetcher = (fetcher: typeof fetch | undefined) => {
if (!fetcher && typeof fetch === "undefined") {
throw newInvariantError(`
"fetch" has not been found globally and no fetcher has been \
Expand Down
2 changes: 1 addition & 1 deletion src/link/http/selectHttpOptionsAndBody.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export interface HttpOptions {
/**
* A `fetch`-compatible API to use when making requests.
*/
fetch?: WindowOrWorkerGlobalScope["fetch"];
fetch?: typeof fetch;

/**
* An object representing values to be sent as headers on the request.
Expand Down
2 changes: 1 addition & 1 deletion src/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{
"compilerOptions": {
"noEmit": true,
"lib": ["es2015", "esnext.asynciterable", "dom"],
"lib": ["es2015", "esnext.asynciterable"],
"types": ["jest", "node", "./testing/matchers/index.d.ts"]
},
"extends": "../tsconfig.json",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"esModuleInterop": true,
"experimentalDecorators": true,
"outDir": "./dist",
"lib": ["es2015", "esnext.asynciterable", "dom"],
"lib": ["es2015", "esnext.asynciterable"],
"jsx": "react",
"strict": true
},
Expand Down

0 comments on commit f40cda4

Please sign in to comment.