-
Notifications
You must be signed in to change notification settings - Fork 844
Closed
Description
Steps to reproduce
Repo link: https://github.com/connorshea/tsgo-repro/blob/main/repro.tsx
I had Claude create a reproduction case out of the actual codebase I ran into this with, and confirmed myself that it recreates the exact same issue, and is as minimal as I can make it.
Steps:
git clone https://github.com/connorshea/tsgo-reprocd tsgo-repronpm installnpx tsc, see there's no typecheck failurenpx tsgo, see there's a typecheck failure
I should also note that the regression was only in the last few days, it works fine in tsgo on 7.0.0-dev.20260217.1:
- Passes: tsc 5.9.3, tsc 6.0.0-beta, tsgo <= 7.0.0-dev.20260217.1
- Fails: tsgo >= 7.0.0-dev.20260218.1
The problematic code is a tsx file:
import { Formik } from 'formik';
import { type SWRMutationResponse } from 'swr/mutation';
interface FormData {
name: string;
email: string;
}
type TriggerType = SWRMutationResponse<
{ result: string },
Error,
string,
FormData
>['trigger'];
const trigger = null as unknown as TriggerType;
const initialValues: FormData = {
name: '',
email: '',
};
// ERROR in tsgo >= 7.0.0-dev.20260218.1:
// Type 'TriggerWithArgs<...>' is not assignable to type
// '(values: FormData, formikHelpers: FormikHelpers<FormData>) => void | Promise<any>'.
// Types of parameters 'options' and 'formikHelpers' are incompatible.
// Type 'FormikHelpers<FormData>' has no properties in common with
// type 'SWRMutationConfiguration<...>'.
const element = (
<Formik initialValues={initialValues} onSubmit={trigger}>
{({ dirty }) => {
return <div />;
}}
</Formik>
);Behavior with typescript@6.0
No error when typechecking.
Behavior with tsgo
% npx tsgo
repro.tsx:49:41 - error TS2322: Type 'TriggerWithArgs<{ result: string; }, Error, string, FormData>' is not assignable to type '(values: FormData, formikHelpers: FormikHelpers<FormData>) => void | Promise<any>'.
Types of parameters 'options' and 'formikHelpers' are incompatible.
Type 'FormikHelpers<FormData>' has no properties in common with type 'SWRMutationConfiguration<{ result: string; }, Error, string, FormData, any>'.
49 <Formik initialValues={initialValues} onSubmit={trigger}>
~~~~~~~~
node_modules/formik/dist/types.d.ts:164:5 - The expected type comes from property 'onSubmit' which is declared here on type 'IntrinsicAttributes & FormikConfig<FormData>'
164 onSubmit: (values: Values, formikHelpers: FormikHelpers<Values>) => void | Promise<any>;
~~~~~~~~
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels