Skip to content

yield* call sometimes infers type as Generator  #43

@rssfrncsrenishaw

Description

@rssfrncsrenishaw
const { d1, d2  } = yield* all({
    d1: call(fetchD1, options),
    d2: call(fetchD2, options),
  });

I've had sitatuions where the above example fetchD1 and fetchD2 are both other sagas that I am calling with call but fetchD1 infers the correct type ({ from: string; to: string; featureName: string | undefined; name: string; data: MeasurementCharacteristicPresentation[]; }) and fetchD2 infers,

Generator<SelectEffect | AllEffect<SagaGenerator<{
    from: string;
    to: string;
    featureName: string | undefined;
    name: string;
    data: MeasurementCharacteristicPresentation[];
}, CallEffect<...>>>

The difference between the two sagas return,

fetchD1

return yield* call(
    (from, to, take, machineId) =>
      client.fetchD1Data.unique({
        query: {
          from,
          to,
          take,
          machineId
        }
      }).promise,
    from,
    to,
    constants.maxTake,
    machineId
  );

fetchD2

return yield* all(
    items.map(({  name }) =>
      call(fetchD2Data, { from, to,  name })
    )
  );

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions