dotansimha / dotansimha/graphql-code-generator

Add return type to function to avoid eslint warning explicit-module-boundary-types

Open
#5,348 0 comments 13 reactions 0 assignees View on GitHub
core help wanted kind/enhancement plugins
Dominant language
TypeScript
Stars
11.3k
Forks
1.4k
Avg merge
1d 1h
Merged PRs (30d)
23

Description

I'm using strict typescript and I want all functions to explicitly define their return types.
However, when generating the types using code generator, the function have no return type.

Of course I can disabled eslint for the file (/* eslint-disable @typescript-eslint/explicit-module-boundary-types */), but this is messy

Example ;
```
export function useFindRefBudgetEntityQuery(
baseOptions?: Apollo.QueryHookOptions<
FindRefBudgetEntityQuery,
FindRefBudgetEntityQueryVariables
>
) {
return Apollo.useQuery<
FindRefBudgetEntityQuery,
FindRefBudgetEntityQueryVariables
>(FindRefBudgetEntityDocument, baseOptions);
}
```

the returnType is compiled but not set to this function
```
export type FindRefBudgetEntityQueryResult = Apollo.QueryResult<
FindRefBudgetEntityQuery,
FindRefBudgetEntityQueryVariables
>;
```

adding it works fine

```
export function useFindRefBudgetEntityQuery(
baseOptions?: Apollo.QueryHookOptions<
FindRefBudgetEntityQuery,
FindRefBudgetEntityQueryVariables
>
):Apollo.QueryResult<
FindRefBudgetEntityQuery,
FindRefBudgetEntityQueryVariables
> {
return Apollo.useQuery<
FindRefBudgetEntityQuery,
FindRefBudgetEntityQueryVariables
>(FindRefBudgetEntityDocument, baseOptions);
}

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.