I am working on a function that accepts a single argument, named options
. Even though I typically prefer using named arguments instead of the options
style, it is currently a requirement. The TypeScript documentation provides a specific type for the items within the options
object.
const doThing = async ({
query = null
}: {
query?: string;
}) => {
var options = Array.from(arguments)[0]
};
When attempting to use this function, an error occurs:
Cannot find name 'arguments'.ts(2304)
This issue confuses me since arguments
should be present in all JavaScript functions.
Is there a way to utilize the arguments
object in a TypeScript function?
Purpose of My Task:
To utilize a solitary
options
argumentTo enforce typings and set default values for the data inside
To access the
options
argument by its given name