I have the following function that takes a String and return a String such as
mockingcase('foobar')
// => fOoBaR
The project has a Typescript declaration file. I don't know much about Typescript (read nothing other than the last hour spent reading the doc.)
The function mockingcase has now the ability to return a String from an Array of string
mockingcase(['foo','bar'])
// => 'fOoBaR'
How do I change the typescript declaration file so it can take a String or an Array?
original:
function mockingcase(input: string, options?: { random?: boolean }): string;
my idea:
function mockingcase(input: string|array, options?: { random?: boolean }): string;
Am I completely wrong?
function mockingcase(input: string|string[], options?: { random?: boolean }): string