Search code examples
typescriptantd

Type 'string[]' is not assignable to type 'string' in Antd Select value?


I have 2 selects, both with mode="multiple" and both being passed an array of strings as value={query.x}. But one is throwing a typescript error and the other isn't. And if I comment out the one not working, the page renders and everything is fine, so something fishy is going on.

enter image description here enter image description here

Why is it giving me that Type 'string[]' is not assignable to type 'string' error, only in one case?


Solution

  • It was because my onChange handler still had value: string on it, instead of value: Array<string>!