Is it necessary to use Typescript interfaces for every input parameter? If not, when should they be used and when should they not be used?
For instance, is it appropriate to have the following setup?
interface IOne {
myFirstVal: string
}
interface ITwo {
mySecondVal: number
}
function one (input: IOne) {
const { myFirstVal } = input
...
}
function two (input: ITwo) {
const { mySecondVal } = input
...
}
If the above scenario doesn't make sense, should I just pass primitive values like this:
function one (myFirstVal: string) { ... }
What criteria should be used to determine when to use primitives instead of defined objects as shown in the initial example?