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

Contracts produce error when effect result doesn't extends contract result #510

Open
SQReder opened this issue Sep 3, 2024 · 0 comments
Labels
scope:core type:bug Something isn't working
Milestone

Comments

@SQReder
Copy link
Contributor

SQReder commented Sep 3, 2024

createQuery resolves to Query<any, unknown, unknown, null> if effect result doesn't match with contract output

import { createQuery, Contract } from '@farfetched/core';
import { Effect } from 'effector';

// Declared somewhere else
declare interface DateObjectDto {
    date: string
}

declare const dtoFx: Effect<void, DateObjectDto, Error>
declare const coolResponseContract: Contract<unknown, { date: Date; }>

export const coolNumbersQuery = createQuery({
    initialData: { numbers: [] },
    effect: dtoFx,
    contract: coolResponseContract, // No overload matches this call.
})

Reproduce https://tsplay.dev/NBKnDm

@SQReder SQReder changed the title Contracts produce error when use zod coerce Contracts produce error when effect result doesn't extends contract result Sep 3, 2024
@igorkamyshev igorkamyshev added type:bug Something isn't working scope:core labels Sep 3, 2024
@igorkamyshev igorkamyshev added this to the v1.0 milestone Sep 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope:core type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants