-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[Bug]: Regression: TS2589: Type instantiation is excessively deep and possibly infinite #6679
Comments
you can provide an old version as well. |
The bug was introduced in 7.16.2 for me, I can only install up until 7.15.3 in CSB |
You can provide the same code with an old version in a codesanbox. I need the code so i can reproduce. |
Sorry but I don't succeed in getting a reproducible scenario with a small codebase. |
then I am afraid it would be very difficult for me to investigate if I don't have a codesanbox to reproduce the problem, i will keep this issue open for couple of days if others have a similar issue. |
We´re migrating from 6.15.8 to latest 7.16.1 or today 7.16.2 but having hard issues on that. It´s big industry code base with tree of nested domain interfaces and causes problems even on start. It hang on typecheck, killing IDE- functionality also. This is error message after some actions:
We already changed to workaround the now missing support of recursive properties (#4055). |
Does the issue occur at 7.16.1? |
For me it only pops up in 7.16.1, I temporarily fixed it with: microsoft/TypeScript#34933 (comment) Edit: I mean 7.16.2, no issues with this on 7.16.1 |
you mean 7.16.2 right? I am bit confused on which version having the issue. |
Apologies, yes :) Added edit to my comment |
In 7.16.1 it hangs a long time and than shows the expected compile failure (Work in Progress). After a lot more time it crashes based on the heap overflow :
With 7.16.2 it´s more weird, because it hangs long time than starts server (even with known compile errors) and later the heap overflows. |
That's the thing without a reproducible |
I'm part of the team of @sebastian-kricke. |
I will fix this 🙏 |
any update on reproducible codesadnbox (example)? |
Unfortunately not, I'm trying to implement the same data structure and amount as in our project but it's not doing anything wrong yet. |
which version of TS that you guys are using? |
We just updated as we were starting with the RHF update. We are now using 4.4.3. |
Same here, 4.4.3 |
Until now, we were not able to finish a sandbox reproducing the issue. It´s a bit hard to figure out how complex it needs to be. Possibly it´s caused by not only "large" amount of data structures, but also on large amounts of forms with fields that run type checks. Today we have no capacity to increase the sandbox more. We´ll keep it in mind this week and have to balance or tasks. |
thanks for the update @sebastian-kricke will keep this issue open for a while, in case someone can reproduce this issue, so we can look into it for a fix. |
I'm having the same issue on v7. It occurs when using the |
can you provide a codesandbox @bailinca ? |
I believe I'm also seeing this issue in some manifestation after upgrading to // typeof normalizeFieldError: (error: FieldError) => string[];
const controlReturn = useController({ control, name });
<ListOfFieldErrors
errors={normalizeFieldError(controlReturn.fieldState.error)}
/> Passing
Attempting to assert
I can try to create a repro of this in codesandbox if it would be helpful. |
@jviall if you can provide a CSB would be great. |
thanks very much @getTobiasNielsen for the investigation, i will have a look at today. |
It's happening in my codebase with react-hook-form 7.17 and even 7.18.0-next.0. I tried hard to reproduce it in CodeSandBox but I couldn't. The reason might be that CodeSandBox loads only some default VSCode version of TypeScript. I tried overriding the TS SDK version in settings and it didn't let me. My sample component looks a bit like the following if you want to try it in new CRA app in VSCode: import { useForm, Controller } from "react-hook-form";
type FormFields = {
p1?: boolean;
p2?: string | null;
p3?: boolean;
p4?: number[] | null;
p5?: string | null;
};
export default function App() {
const methods = useForm({
defaultValues: ({} as any) as FormFields,
context: {}
});
const { control } = methods;
let defaultValue: boolean | undefined = false;
return (
<form>
<Controller
control={control}
name="p1"
defaultValue={defaultValue}
render={({ field }) => <input value={field.value?.toString()} />}
/>
<input type="submit" />
</form>
);
} I tried eliminating the BTW, my project is using emotion for JSX. I wonder if this is a factor, but even if, it's only happening with a specific case of a |
I've also seen it in earlier versions. At this stage it seems that a potential workaround might be using the |
@Meligy does it happen at 7.17.2? |
Yes |
maybe this comment helps: #6753 (comment) |
Thanks. I did see it yeah, and am confirming the findings there. Interestingly it seems across a wide range of versions for both react-hook-form and TS :( |
HI, What I am trying to say is maybe there are some memory leaks that are coming from the library. Down you have a screenshot from my code editor with the error: |
on my branch where I installed react hook form, with tsc --extendedDiagnostics I am seeing double the amount of type instantiations than the integration branch, and the compilation time also doubled from 8 secs to 16 seconds and also have massive lag for vscode intellisense, I hope V8 won't have these issues. |
What could be done in V7? We're trying to migrate from formik, but Webstorm goes into 100% cpu and mem perpetually. It's unusable. |
Using either It seems like |
@KazimirPodolski try with v8, TS performance is getting address and v8 breaking change is minimal as well. |
@bluebill1049 It worked just fine, thanks. |
I'm facing the same issue, my project stopped to compile for some reason. Is there any migration guide or documentation for the V8? What's the ETA for a stable release? Can it be used in production safely ? |
There're a couple of TS perf issues in the current v8 version. No ETA for now |
Seems that the issue: react-hook-form/react-hook-form#6679 is appearing at times. Lets see if this helps.
Seems that the issue: react-hook-form/react-hook-form#6679 is appearing at times. Lets see if this helps.
Version Number
7.16.2
Codesandbox/Expo snack
Codesandbox still doesn't allow me to install the latest version
Steps to reproduce
Expected behaviour
TypeScript compilation should succeed without any warnings.
I believe #6658 is the cause of introducing this error, this is a regression of #4441
What browsers are you seeing the problem on?
No response
Relevant log output
No response
Code of Conduct
The text was updated successfully, but these errors were encountered: