vinejs / vine

VineJS is a form data validation library for Node.js
https://vinejs.dev
MIT License
1.17k stars 26 forks source link

error typescript 2589 #91

Closed sergefabre closed 2 weeks ago

sergefabre commented 2 months ago

Package version

@vinejs/vine@3.0.0 | MIT | deps: 8 | versions: 19

Describe the bug

Hello,

I encounter an error after updating from version 2.1.0 to version 3.0.0 on a snippet which was fine in 2.1.0. The typescript error 2589 is raised by the IDE, the build also fails now.

I tried commenting some lines to identify the problematic code. The error only seems to be generated by a "vine.string()" validation but not at all times either.With "vine.number()", there is no error. Changing some symbols to snake_case also seems to mute the problem ?!

Context :

Snippet :

the commented lines are the ones that generate the errors

export const MySchema = vine.object({  
   identifier: vine.number().positive().max(2147483647),  
   // numImmatriculationEF: vine.string(),  
   stf: vine.string().fixedLength(3),  
   // libelleStatut: enumStatutMR,  
   sync_statut: vine.enum(['F170', 'F079']).optional(), 
   id: vine.number().positive().max(2147483647).optional(),
})

Reproduction repo

No response

thetutlage commented 2 months ago

Hello @sergefabre

A reproduction error will be needed to debug this issue 👍