Skip to content

Commit dbb6efe

Browse files
committed
TypeScript fixes
1 parent db2b524 commit dbb6efe

File tree

30 files changed

+74
-179
lines changed

30 files changed

+74
-179
lines changed

examples/react/apollo-client-defer/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const InlinedSlowDataField = (props: { data: DocumentType<typeof alphabetQuery>
2727
try {
2828
// @ts-expect-error - this field should be either undefined or a string
2929
const _ = props.data.inlinedSlowField.toLowerCase();
30-
} catch (e) {}
30+
} catch (e: any) {}
3131

3232
if (!props.data.inlinedSlowField) {
3333
return null;

packages/graphql-codegen-cli/src/cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export async function runCli(cmd: string): Promise<number> {
2424
return 1;
2525
}
2626
return 0;
27-
} catch (error) {
27+
} catch (error: any) {
2828
await lifecycleHooks(context.getConfig().hooks).onError(error.toString());
2929
return 1;
3030
}

packages/graphql-codegen-cli/src/codegen.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export async function executeCodegen(
108108
context.profiler.run(async () => {
109109
try {
110110
await Promise.resolve().then(() => task());
111-
} catch (error) {
111+
} catch (error: any) {
112112
if (source && !(error instanceof GraphQLError)) {
113113
error.source = source;
114114
}
@@ -328,7 +328,7 @@ export async function executeCodegen(
328328
return {
329329
documents,
330330
};
331-
} catch (error) {
331+
} catch (error: any) {
332332
if (
333333
error instanceof NoTypeDefinitionsFound &&
334334
config.ignoreNoDocuments

packages/graphql-codegen-cli/src/config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ function customLoader(ext: 'json' | 'yaml' | 'js' | 'ts' | 'mts' | 'cts'): Codeg
6969
try {
7070
const result = yaml.parse(content, { prettyErrors: true, merge: true });
7171
return result;
72-
} catch (error) {
72+
} catch (error: any) {
7373
error.message = `YAML Error in ${filepath}:\n${error.message}`;
7474
throw error;
7575
}

packages/graphql-codegen-cli/src/documentTransforms.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export async function getDocumentTransformByName(
5858
for (const moduleName of possibleModules) {
5959
try {
6060
return await loader(moduleName);
61-
} catch (err) {
61+
} catch (err: any) {
6262
if (err.code !== 'MODULE_NOT_FOUND' && err.code !== 'ERR_MODULE_NOT_FOUND') {
6363
throw new Error(
6464
`

packages/graphql-codegen-cli/src/generate-and-save.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ function isConfiguredOutput(output: any): output is Types.ConfiguredOutput {
212212
async function hashFile(filePath: string): Promise<string | null> {
213213
try {
214214
return hash(await readFile(filePath));
215-
} catch (err) {
215+
} catch (err: any) {
216216
if (err && err.code === 'ENOENT') {
217217
// return null if file does not exist
218218
return null;

packages/graphql-codegen-cli/src/init/questions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ export async function getAnswers(possibleTargets: Record<Tags, boolean>): Promis
8484
config,
8585
script,
8686
};
87-
} catch (error) {
87+
} catch (error: any) {
8888
if (error instanceof Error && error.name === 'ExitPromptError') {
8989
// This error because user exited using CMD+C, just exit gracefully or else user would see an ugly error message
9090
// https://github.com/SBoudrias/Inquirer.js/blob/ee16061a1e3f99a6cc714a3d473f7cd12b06a3f1/packages/prompts/README.md#handling-ctrlc-gracefully

packages/graphql-codegen-cli/src/load.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function loadSchema(
4949
...config.config,
5050
});
5151
return schema;
52-
} catch (e) {
52+
} catch (e: any) {
5353
throw new Error(
5454
[
5555
`Failed to load schema from ${Object.keys(schemaPointers).join(',')}:`,
@@ -99,7 +99,7 @@ export async function loadDocuments(
9999
...config.config,
100100
});
101101
return loadedFromToolkit;
102-
} catch (error) {
102+
} catch (error: any) {
103103
// NoTypeDefinitionsFound from `@graphql-tools/load` already has a message with pointer, so we can just rethrow the error
104104
if (error instanceof NoTypeDefinitionsFound) {
105105
throw error;

packages/graphql-codegen-cli/src/plugins.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function getPluginByName(
2121
for (const moduleName of possibleModules) {
2222
try {
2323
return await pluginLoader(moduleName);
24-
} catch (err) {
24+
} catch (err: any) {
2525
if (err.code !== 'MODULE_NOT_FOUND' && err.code !== 'ERR_MODULE_NOT_FOUND') {
2626
throw new Error(
2727
`

packages/graphql-codegen-cli/src/presets.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export async function getPresetByName(
2727
}
2828

2929
return loaded as Types.OutputPreset;
30-
} catch (err) {
30+
} catch (err: any) {
3131
if (
3232
/** CJS Error code */
3333
err.code !== 'MODULE_NOT_FOUND' &&

0 commit comments

Comments
 (0)