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

Make it possible to inherit from ZodiosHookClass #331

Merged
merged 1 commit into from
Apr 29, 2023
Merged

Conversation

vanpav
Copy link
Contributor

@vanpav vanpav commented Apr 29, 2023

I'm trying to extend ZodiosClass with some dependent features like prefetching queries for SSR. But I got an obvious error

Class 'ZodiusHooksPrefetch<Api>' incorrectly extends base class 'ZodiosHooksClass<Api>'.
  Types have separate declarations of a private property 'apiName'

This small change of modifiers keeps required to be private properties private, makes the typescript compiler happy, and lets it extend hooks API without errors.

class ZodiusHooksPrefetch<Api extends ZodiosEndpointDefinitions> extends ZodiosHooksClass<Api> {
  constructor(
    protected readonly apiName: string,
    protected readonly zodios: ZodiosInstance<Api>,
    protected readonly options: { shouldAbortOnUnmount?: boolean } = {}
  ) {
    super(apiName, zodios, options);
  }
}

@ecyrbe ecyrbe merged commit 6d87b5b into ecyrbe:main Apr 29, 2023
@ecyrbe
Copy link
Owner

ecyrbe commented Apr 29, 2023

Thanks

@ecyrbe
Copy link
Owner

ecyrbe commented Apr 29, 2023

available on 10.4.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants