In my code, there is a module named utils.tsx
defined as follows:
interface IUtils {
toUri: (route: string) => string
}
export default abstract class Utils implements IUtils {
public toUri = (route: string) => {
return route
}
}
Now, in another file where I want to utilize this utils module:
import Utils from '../helpers/utils'
class Router {
private getBuilder = (search: string) => {
const path = Utils.toUri(search)
}
}
However, using Utils.toUri
gives me a TS error:
[ts] Property 'toUri' does not exist on type 'typeof Utils'.
I aim to call the external abstract class function without extending or inheriting from the Router
class since there will be multiple external modules in the main file. Can someone assist me in finding a solution and understanding this issue?
PS: I also attempted with public abstract toUri()
. It's possible that I have confused the usage of static and abstract due to routines from other programming languages...