Skip to content

Instantly share code, notes, and snippets.

@manticorp
Created October 21, 2024 19:45
Show Gist options
  • Save manticorp/3658b8cb4c515ff38d87911307f4b77c to your computer and use it in GitHub Desktop.
Save manticorp/3658b8cb4c515ff38d87911307f4b77c to your computer and use it in GitHub Desktop.
Minimal typescript file to generate TypeDoc overload issue
interface Test {
/**
* Provide a string and I will give you a boolean
*
* @example
* concrete.myFunc('str'); // false
*/
myFunc (a: string) : boolean;
/**
* Pass me a number and I will give you a number
*
* @example
* concrete.myFunc(5); // 1
*/
myFunc (a: number) : number;
/**
* Pass me a string and I will give you a number
*
* @example
* concrete.myFunc('str'); // 1
*/
anotherFunc (a: string) : number;
/**
* Pass me a number and I will give you a boolean
*
* @example
* concrete.myFunc(5); // false
*/
anotherFunc (a: number) : boolean;
}
abstract class AbstractTest implements Test {
abstract myFunc (a: string) : boolean;
abstract myFunc (a: number) : number;
anotherFunc (a: string) : number;
anotherFunc (a: number) : boolean;
anotherFunc (a: string | number): number | boolean {
if (typeof a === 'string') {
return 1;
}
return false;
}
}
class ConcreteTest extends AbstractTest {
myFunc (a: string) : boolean;
myFunc (a: number) : number;
myFunc (a: string | number): number | boolean {
if (typeof a === 'string') {
return false;
}
return 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment