I need help with a module declaration for a 3rd-party JS library that has subclasses which Typescript detects as incompatible overrides of methods from a parent class. One example is:
Base class:
class Entity {
...
/**
* Test whether a given User has permission to perform some action on this Entity
* @param {User} user The User requesting creation
* @param {string} action The attempted action
* @return {boolean} Does the User have permission?
*/
can(user, action) {
...
}
}
Subclass:
class User extends Entity {
...
/**
* Test whether the User is able to perform a certain permission action. Game Master users are always allowed to
* perform every action, regardless of permissions.
*
* @param {string} permission The action to test
* @return {boolean} Does the user have the ability to perform this action?
*/
can(permission) {
...
}
}
How can I handle overridden methods like this without getting error messages from tsc? Do I need to somehow misrepresent the relationship between Entity
and User
?