2

Is it possible to say that everything other than 'keyA' is of type string, while 'keyA' is type string[]?

For example:

row: {
  [name: string]: string | string[];
  keyA: string[];
  everythingButKeyA: string[]
}

How do I specify the everythingButKeyA portion?

David Ten
  • 113
  • 1
  • 10
  • 1
    No, there is no current support for what you're doing; see [microsoft/TypeScript#17867](https://github.com/microsoft/TypeScript/issues/17867) for the suggestion to add something like this. Also see the [answer to the question this duplicates](https://stackoverflow.com/a/61434547/2887218) for more information and possible approached/workarounds. Translating the code there to this question produces [this](https://tsplay.dev/mZ83Jw), which you might find useful. – jcalz May 05 '21 at 18:12

0 Answers0