In typescript I have the following methods in a class:
authorize(resource: any, requirement: Requirement) : boolean {
return false;
}
authorize(resource: any, policy: Policy) : boolean {
return false;
}
But I get the following error:
Duplicate function implementation.
Why is it duplicated if the arguments have different types, e.g., policy and requirement?
How to solve this?
authorize(resource: any, requirement: Requirement | Policy) : boolean