Skip to content

Commit e45bbfb

Browse files
authored
docs: unify d.ts example filename to apollo.d.ts (#13261)
I noticed that the TypeScript docs is inconsistent about the name for the declaration file used for module augmentation. Some examples refer to it as `apollo-client.d.ts`, while others call it `apollo.d.ts`, and this can happen even within the same page and section. I'm concerned that this inconsistency can confuse readers and make them question if the two names have different meanings. So, I've standardized all the `.d.ts` examples to `apollo.d.ts`, which is the name used in [the Apollo Client 4.2 blog post](https://www.apollographql.com/blog/whats-new-in-apollo-client-4-2). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated TypeScript declaration file examples throughout the documentation guides to maintain consistent filename references in code samples for better clarity across data fragments, type definitions, and migration sections. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 5e8b651 commit e45bbfb

3 files changed

Lines changed: 15 additions & 15 deletions

File tree

docs/source/data/fragments.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ To use GraphQL Codegen's masking format with your operation types, you need to t
14021402
14031403
Create a TypeScript file that will be used to modify the `TypeOverrides` interface. Extend `TypeOverrides` with the `GraphQLCodegenDataMasking.TypeOverrides` interface.
14041404
1405-
```ts title="apollo-client.d.ts"
1405+
```ts title="apollo.d.ts"
14061406
// This import is necessary to ensure all Apollo Client imports
14071407
// are still available to the rest of the application.
14081408
import "@apollo/client";
@@ -1415,7 +1415,7 @@ declare module "@apollo/client" {
14151415
14161416
<Note>
14171417
1418-
This example uses `apollo-client.d.ts` as the file name to make it easily identifiable. You can give this file any name.
1418+
This example uses `apollo.d.ts` as the file name to make it easily identifiable. You can give this file any name.
14191419
14201420
</Note>
14211421
@@ -1751,7 +1751,7 @@ Apollo Client uses [declaration merging](https://www.typescriptlang.org/docs/han
17511751
17521752
Let's add type overrides for our custom type implementations. Create a TypeScript file and define a `TypeOverrides` interface for the `@apollo/client` module.
17531753
1754-
```ts title=apollo-client.d.ts
1754+
```ts title="apollo.d.ts"
17551755
// This import is necessary to ensure all Apollo Client imports
17561756
// are still available to the rest of the application.
17571757
import "@apollo/client";
@@ -1765,7 +1765,7 @@ declare module "@apollo/client" {
17651765
17661766
Now we'll import our HKT types and add them as keys in the `TypeOverrides` interface.
17671767
1768-
```ts {4,8-9} title=apollo-client.d.ts
1768+
```ts {4,8-9} title="apollo.d.ts"
17691769
// This import is necessary to ensure all Apollo Client imports
17701770
// are still available to the rest of the application.
17711771
import "@apollo/client";

docs/source/data/typescript.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ You can define your own context types for better type safety in Apollo Client us
518518

519519
To define types for your custom context properties, create a TypeScript file and define the `DefaultContext` interface.
520520

521-
```ts title="apollo-client.d.ts"
521+
```ts title="apollo.d.ts"
522522
// This import is necessary to ensure all Apollo Client imports
523523
// are still available to the rest of the application.
524524
import "@apollo/client";
@@ -560,7 +560,7 @@ Some links provided by Apollo Client have built-in context option types. You can
560560

561561
The following example adds `HttpLink`'s context types to `DefaultContext`:
562562

563-
```ts title="apollo-client.d.ts"
563+
```ts title="apollo.d.ts"
564564
import "@apollo/client";
565565
import { HttpLink } from "@apollo/client";
566566

@@ -587,7 +587,7 @@ const { data } = useQuery(MY_QUERY, {
587587

588588
If you are using more than one link that has context options, you can extend from each link's context options:
589589

590-
```ts title="apollo-client.d.ts"
590+
```ts title="apollo.d.ts"
591591
import "@apollo/client";
592592
import type { BaseHttpLink } from "@apollo/client/link/http";
593593
import type { ClientAwarenessLink } from "@apollo/client/link/client-awareness";
@@ -900,7 +900,7 @@ Once your HKT type is created, you tell Apollo Client about it by using [declara
900900

901901
Create a TypeScript file that defines the `TypeOverrides` interface for the `@apollo/client` module.
902902

903-
```ts title=apollo-client.d.ts
903+
```ts title="apollo.d.ts"
904904
// This import is necessary to ensure all Apollo Client imports
905905
// are still available to the rest of the application.
906906
import "@apollo/client";
@@ -1001,7 +1001,7 @@ With our HKT types in place, we now need to tell Apollo Client about them. We'll
10011001

10021002
Create a TypeScript file and define a `TypeOverrides` interface for the `@apollo/client` module.
10031003

1004-
```ts title="apollo-client.d.ts"
1004+
```ts title="apollo.d.ts"
10051005
// This import is necessary to ensure all Apollo Client imports
10061006
// are still available to the rest of the application.
10071007
import "@apollo/client";

docs/source/migrating/apollo-client-4-migration.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,9 @@ const client = new ApolloClient({
887887
888888
To provide accurate TypeScript types, you will also need to tell Apollo Client to use the types associated with the `Defer20220824Handler` in order to provide accurate types for incremental chunks, used with the `ApolloLink.Result` type. This ensures that you properly handle incremental results in your custom links that might access the result directly.
889889
890-
Create a new `.d.ts` file in your project (e.g. `apollo-client.d.ts`) and add the following content:
890+
Create a new `.d.ts` file in your project (e.g. `apollo.d.ts`) and add the following content:
891891
892-
```ts title="apollo-client.d.ts
892+
```ts title="apollo.d.ts"
893893
import { Defer20220824Handler } from "@apollo/client/incremental";// [!code highlight]
894894

895895
declare module "@apollo/client" {
@@ -911,7 +911,7 @@ In Apollo Client 4, the data masking types are now configurable to allow for mor
911911
912912
To configure the data masking types to be the same as they were in Apollo Client 3, create a `.d.ts` file in your project with the following content:
913913
914-
```ts title="apollo-client.d.ts
914+
```ts title="apollo.d.ts"
915915
import { GraphQLCodegenDataMasking } from "@apollo/client/masking";// [!code highlight]
916916

917917
declare module "@apollo/client" {
@@ -924,7 +924,7 @@ declare module "@apollo/client" {
924924
925925
You can combine multiple `TypeOverrides` of different kinds. For example, you can combine the data masking types with the `Defer20220824Handler` type overrides from the previous section.
926926
927-
```ts title="apollo-client.d.ts disableCopy=true
927+
```ts title="apollo.d.ts" disableCopy=true
928928
import { Defer20220824Handler } from "@apollo/client/incremental";
929929
import { GraphQLCodegenDataMasking } from "@apollo/client/masking";// [!code ++]
930930

@@ -1692,7 +1692,7 @@ Apollo Client 4 removes the `TContext` generic argument in favor of using [decla
16921692
16931693
To define types for your custom context properties, create a TypeScript file and define the `DefaultContext` interface.
16941694
1695-
```ts title="apollo-client.d.ts"
1695+
```ts title="apollo.d.ts"
16961696
// This import is necessary to ensure all Apollo Client imports
16971697
// are still available to the rest of the application.
16981698
import "@apollo/client";
@@ -2055,7 +2055,7 @@ The `context` type can be extended by using declaration merging to allow you to
20552055

20562056
For example, to make your context type-safe for usage with `HttpLink`, place this snippet in a `.d.ts` file in your project:
20572057

2058-
```ts title="apollo-client.d.ts"
2058+
```ts title="apollo.d.ts"
20592059
import { HttpLink } from "@apollo/client";
20602060
20612061
declare module "@apollo/client" {

0 commit comments

Comments
 (0)