kamilkisiela / apollo-angular

A fully-featured, production ready caching GraphQL client for Angular and every GraphQL server 🎁
https://apollo-angular.com
MIT License
1.5k stars 311 forks source link

Dynamic import statement used in mutation.d.ts #1779

Closed dlq84 closed 1 month ago

dlq84 commented 2 years ago

Describe the bug

Hi, there is a strange type regression since after version 2.6.0 in mutation.d.ts, it generates types that uses the dynamic import statement, while on version 2.6.0 the type was statically imported. See line 6, the return type of mutation()

export declare class Mutation<T = {}, V = EmptyObject> {
    protected apollo: Apollo;
    readonly document: DocumentNode | TypedDocumentNode<T, V>;
    client: string;
    constructor(apollo: Apollo);
    mutate(variables?: V, options?: MutationOptionsAlone<T, V>): import("rxjs").Observable<import("./types").MutationResult<T>>;
    static ɵfac: i0.ɵɵFactoryDeclaration<Mutation<any, any>, never>;
    static ɵprov: i0.ɵɵInjectableDeclaration<Mutation<any, any>>;
}

To Reproduce

  1. checkout 6728bbb7a527d230d45e08878834bf538cdf93db
  2. yarn install
  3. yarn workspaces run build
  4. see file packages/apollo-angular/build/mutation.d.ts

Expected behavior

mutation() is expected to have the return type of Observable<MutationResult<T>>

Environment:

- @angular/cli@^13.2.2
- @angular/core@^13.2.2
- @apollo/client@3.5.9
- apollo-angular@commit:6728bbb7a527d230d45e08878834bf538cdf93db
- graphql@16.3.0
- typescript@4.4.4

query.d.ts behaves correctly.

PowerKiKi commented 1 month ago

Has been solved in the meantime