Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ESLint no-invalid-void-type error in services.gen.ts #1103

Open
lukaskoeller opened this issue Sep 30, 2024 · 2 comments
Open

ESLint no-invalid-void-type error in services.gen.ts #1103

lukaskoeller opened this issue Sep 30, 2024 · 2 comments
Labels
bug 🔥 Something isn't working prioritized 🚚 This issue has been prioritized and will be worked on soon
Milestone

Comments

@lukaskoeller
Copy link

Description

Actual

In the services.gen.ts there are void is only valid as a return type or generic type argument.eslint[@typescript-eslint/no-invalid-void-type](https://typescript-eslint.io/rules/no-invalid-void-type) errors appearing.

Expected

The eslint page suggests to use undefined instead.

That would mean that these appearances would change as follows:

export const postAuthResetPassword = <ThrowOnError extends boolean = false>(
  options: Options<PostAuthResetPasswordData, ThrowOnError>,
) => {
-  return (options.client ?? client).post<void, unknown, ThrowOnError>({
+  return (options.client ?? client).post<undefined, unknown, ThrowOnError>({
    ...options,
    url: "/auth/reset_password",
  });
};

Reproducible example or configuration

https://stackblitz.com/edit/hey-api-client-fetch-example-nppfy7?file=src%2Fclient%2Fservices.gen.ts

Then run npm run lint. Quite some issues will appear, but some will be like:

/home/projects/hey-api-client-fetch-example/src/client/services.gen.ts
…
153:57  error  void is only valid as a return type or generic type argument

OpenAPI specification (optional)

Any OpenAPI endpoint that does return nothing basically.

System information (optional)

Only thing important to mention here, is a more strict eslint config:

extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/strict-type-checked',
    'plugin:@typescript-eslint/stylistic-type-checked',
  ],
parserOptions: {
    ecmaVersion: "latest",
    sourceType: "module",
    project: ["./tsconfig.json", "./tsconfig.node.json"],
    tsconfigRootDir: __dirname,
  },

These were added/edited to the base stackblitz example. It is the recommended production setup by the vite react-ts template (see README)

@lukaskoeller lukaskoeller added the bug 🔥 Something isn't working label Sep 30, 2024
Copy link

stackblitz bot commented Sep 30, 2024

@mrlubos mrlubos added the prioritized 🚚 This issue has been prioritized and will be worked on soon label Sep 30, 2024
@mrlubos mrlubos added this to the Parser milestone Oct 20, 2024
@mrlubos
Copy link
Member

mrlubos commented Oct 20, 2024

This will be addressed as part of the parser release. Thank you for reporting!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🔥 Something isn't working prioritized 🚚 This issue has been prioritized and will be worked on soon
Projects
None yet
Development

No branches or pull requests

2 participants