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

[@reduxjs/toolkit: 1.6.2 → 1.7.0] TS2344: Type 'Definitions[EndpointName]' does not satisfy the constraint 'QueryDefinition<any, any, any, any, string>'. #1833

Closed
ryota-murakami opened this issue Dec 15, 2021 · 7 comments · Fixed by #1834

Comments

@ryota-murakami
Copy link
Contributor

I ran the tsc command immediately after updating reduxjs/toolkit from 1.6.2 to 1.7.0, and encountered this error.

There is no way I can read this and understand it, can anyone tell me the cause or give me a clue?

Error: node_modules/@reduxjs/toolkit/dist/query/core/module.d.ts(100,183): error TS2344: Type 'Definitions[EndpointName]' does not satisfy the constraint 'MutationDefinition<any, any, any, any, string>'.
  Type 'Definitions[MutationKeys<Definitions>]' is not assignable to type 'MutationDefinition<any, any, any, any, string>'.
    Type 'Definitions[Definitions[keyof Definitions] extends MutationDefinition<any, any, any, any, string> ? keyof Definitions : never]' is not assignable to type 'MutationDefinition<any, any, any, any, string>'.
      Type 'Definitions[keyof Definitions]' is not assignable to type 'MutationDefinition<any, any, any, any, string>'.
        Type 'Definitions[string] | Definitions[number] | Definitions[symbol]' is not assignable to type 'MutationDefinition<any, any, any, any, string>'.
          Type 'Definitions[string]' is not assignable to type 'MutationDefinition<any, any, any, any, string>'.
            Type 'EndpointDefinition<any, any, any, any, string>' is not assignable to type 'MutationDefinition<any, any, any, any, string>'.
              Type 'EndpointDefinitionWithQueryFn<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & QueryExtraOptions<any, any, any, any, string>' is not assignable to type 'MutationDefinition<any, any, any, any, string>'.
                Type 'EndpointDefinitionWithQueryFn<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & QueryExtraOptions<any, any, any, any, string>' is not assignable to type 'EndpointDefinitionWithQueryFn<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                  Type 'EndpointDefinitionWithQueryFn<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & QueryExtraOptions<any, any, any, any, string>' is not assignable to type 'MutationExtraOptions<any, any, any, any, string>'.
                    Types of property 'type' are incompatible.
                      Type 'DefinitionType.query' is not assignable to type 'DefinitionType.mutation'.
                        Type 'Definitions[string]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                          Type 'Definitions[keyof Definitions]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                            Type 'Definitions[Definitions[keyof Definitions] extends MutationDefinition<any, any, any, any, string> ? keyof Definitions : never]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                              Type 'Definitions[MutationKeys<Definitions>]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                Type 'Definitions[EndpointName]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                  Type 'Definitions[MutationKeys<Definitions>]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                    Type 'Definitions[Definitions[keyof Definitions] extends MutationDefinition<any, any, any, any, string> ? keyof Definitions : never]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                      Type 'Definitions[keyof Definitions]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                        Type 'Definitions[string] | Definitions[number] | Definitions[symbol]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                          Type 'Definitions[string]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                            Type 'EndpointDefinition<any, any, any, any, string>' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                              Type 'EndpointDefinitionWithQueryFn<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & QueryExtraOptions<any, any, any, any, string>' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & MutationExtraOptions<any, any, any, any, string>'.
                                                Type 'EndpointDefinitionWithQueryFn<any, any, any> & { [resultType]?: any; [baseQuery]?: any; } & { extraOptions?: unknown; } & QueryExtraOptions<any, any, any, any, string>' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                  Type 'Definitions[string]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                    Type 'Definitions[keyof Definitions]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                      Type 'Definitions[Definitions[keyof Definitions] extends MutationDefinition<any, any, any, any, string> ? keyof Definitions : never]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                        Type 'Definitions[MutationKeys<Definitions>]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                          Type 'Definitions[EndpointName]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                            Type 'Definitions[MutationKeys<Definitions>]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                              Type 'Definitions[Definitions[keyof Definitions] extends MutationDefinition<any, any, any, any, string> ? keyof Definitions : never]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.
                                                                Type 'Definitions[keyof Definitions]' is not assignable to type 'EndpointDefinitionWithQuery<any, any, any>'.

envirionment

TypeScirpt v4.5.4
node: 16.9
github actions container

Reproduction

https://github.com/laststance/react-re-render-rules/runs/4494596354?check_suite_focus=true

@markerikson
Copy link
Collaborator

Hoooo-ly smoke, that's ugly :)

Also looks like the same error as #1829, I think?

@phryneas
Copy link
Member

Seems like this is a problem within our sources that TS 4.2 which we use for building doesn't detect - and then somehow it also doesn't trigger in the type tests

@ryota-murakami
Copy link
Contributor Author

@markerikson

Hoooo-ly smoke, that's ugly :)

Isn't this a promising candidate for MEME? like

smell-bad

@markerikson
Copy link
Collaborator

Should be fixed in https://github.com/reduxjs/redux-toolkit/releases/tag/v1.7.1 .

@ryota-murakami
Copy link
Contributor Author

@markerikson @phryneas I confirmed this is fixed, thank you for faster fixing! 😄

@markerikson
Copy link
Collaborator

heh, thank @phryneas for actually fixing it - I just merged and released :)

@ryota-murakami
Copy link
Contributor Author

@markerikson haha, also I'm getting thousand number count of contributions from Github that showing my top page.
https://github.com/ryota-murakami

But approximately 90% are just merging npm automated dependency update PR from Depfu.

Honestly increasing number and top page become more green glass is bring me satisfaction, but that's can never say 'contributions'. 😅

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 a pull request may close this issue.

3 participants