This works
interface Functions {
size<T>(a: T[]): number
size<T>(o: Record<string, T>): number
}
But this doesn’t, run it. How to make it work? The overloaded method is not known at the time the interface Functions
declared and should be added later, incrementally.
interface Functions {}
interface ArrayFunctions {
size<T>(a: T[]): number
}
interface ObjectFunctions {
size<T>(o: Record<string, T>): number
}
interface Functions extends ArrayFunctions, ObjectFunctions {}
Error:
Interface 'Functions' cannot simultaneously extend types 'ArrayFunctions' and 'ObjectFunctions'.
Named property 'size' of types 'ArrayFunctions' and 'ObjectFunctions' are not identical.ts(2320)