I have a function that takes a single argument, which I will call options. I prefer not using the options style (I rather like named arguments) but this is a requirement for now. A type for the items inside the options object is supplied per the TypeScript docs
const doThing = async ({
query = null
}: {
query?: string;
}) => {
var options = Array.from(arguments)[0]
};
This fails with:
Cannot find name 'arguments'.ts(2304)
I don't understand this, as arguments should exist in all JS functions.
How can I use arguments in a Typescript function?`
What I am trying to do:
have a single
optionsargumentenforce typing and have default values on the data inside
be able to access that
optionsargument by a name.
(...arguments) => { var options = Array.from(arguments)[0] }optionsargument, which is a requirement of the question.