How to avoid the error Expected 1 argument but got 0 on Typescript How to avoid the error Expected 1 argument but got 0 on Typescript typescript typescript

How to avoid the error Expected 1 argument but got 0 on Typescript


Simply add the question mark to the argument that requires your function, example:

function movements(remove?) {    // ...}


You need to specify the input for calling movements().

You can set default to the variable using this:

function movements(remove = null) {

so that the function won't break even if you don't give it the input.

You can default it to anything you like though.