6

I am using jquery & jquery validate. I am also using typescript with the appropriate type files to go with it but when I do this line of code I get an error

  $('#form').validate().settings.ignore = [];

Error TS2322 (TS) Type 'undefined[]' is not assignable to type 'string'.

This peice of code seem to be valid and does work. Maybe it has changed to something else but I have not found anything else that would work.

chobo2
  • 83,322
  • 195
  • 530
  • 832
  • can you try this - https://stackoverflow.com/questions/8466643/jquery-validate-enable-validation-for-hidden-fields#:~:text=validate().,the%20form%20element%20via%20the%20%24. – D-user Aug 18 '20 at 16:57

1 Answers1

11

You can disable typescript in line by using ts-expect-error comments:

  // @ts-expect-error
  $('#form').validate().settings.ignore = [];

You can read more about this here.

Rafał Figura
  • 5,428
  • 1
  • 15
  • 20