I'd like to define a typed array, specifying a type for the first element, another type for the second and so on...
In fact, I'm trying to get rid of the following casts:
const cases = [
[ 'http://gmail.com', false ],
[ '/some_page', true ],
[ 'some_page', false ]
]
describe("'isInternalLink' utility", () => {
test.each(cases)(
"given %p as argument, returns %p", (link, result) => {
expect(
isInternalLink(<string>link)
).toEqual(
<boolean> result
)
}
)
})
As you can see, each element in cases is an array which has a string as first element and a boolean as second...
Just to be clear, I don't want an array of string | boolean type, I want an array whose first element is a string and whose second element is a boolean.
Any idea how to improve this???
casses = [..... ] as constas constdoesn't work right in this case (at least in my vscode). I wonder if the typing fortest.eachneeds some work? @TitianCernicova-Dragomir