Sorry that this isn’t more minimal, as it still uses two external libraries (TanStack Form and zod), but I have trimmed it down from the original as much as possible.
defaultValues: {[name]: initialValue} as Record<TFieldName,z.infer<TSchema>[TFieldName]>
Steps to reproduce
https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQFCiSxwDeArqlgGLQgC+cRJcgAEYyAHapRuANYB6SnhgBaAtzIBuOuGjwmALz4DSZPRAAmGmnTEwsUAnixwACsTCoAPDThwAKgGVcAAssEGQ4LAAPWzEzdD0AOgAtcwB5ACMAKyx8D0SUswxkAHd-IOQwLAA+ABpvPw5gLAAbMwA5ZBAnKJi4uABRaKhFD2ksAE8IAjhE4DECOw8A4NDkWrhJKDmAc1qaKuZ6ueAYYGRmgDVzliwALhmEuYWoJcCQsKqAbV9GlvbOrAAXU0PjEAPuPyarQ6XRBGxWYQhb1Wmh4ViiDEILDE+GAEDEmCwYGIXh8y3e4R6WFi8WSaSyORgeTphRKZQq1TqZN+0IBEWi1L6gxgw1yY0m01m80W5NW602Oz2VQAFEwwV0anBjqdzldmjcePdXBB3K8EchNZC-jDqgBKQ4+XD4yT8bhwAC8cDYnG4qvqPjMWAcLGaMD1N1Q9yYn3VQPu2rOl2uWB4XLgPFtmnqlBgLCgBI8qigIASPLMcFj7rVAJ4VSYBCh5fdBw8ZmAADc6w2-glYzwPLI253+7IiyWy1VUVYnRJ4KhzR6HhAGfg-T5VBB7okFWJtsrbTQM1YCNjcfi-FhJPvDtmsLn83Blf64B5sMSIPCKVX5xS+JWAEQbv+WpiCcibhlg7r-ukyBQMBshVPUB48EAA
Sorry that this isn’t more minimal, as it still uses two external libraries (TanStack Form and zod), but I have trimmed it down from the original as much as possible.
As discussed with Jake on Bluesky, this could very well be an issue with TanStack Form’s typings, but I’d still expect tsgo and ts 5.9 to behave identically.
Behavior with
typescript@5.9no error
Behavior with
tsgoError in line 22:
As a workaround, we can cast
defaultValues: