-
Couldn't load subscription status.
- Fork 13.1k
Closed
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
Don't write overloads that differ by type in only one argument position:
/* WRONG */
interface Moment {
utcOffset(): number;
utcOffset(b: number): Moment;
utcOffset(b: string): Moment;
}
Do use union types whenver possible:/* OK */
interface Moment {
utcOffset(): number;
utcOffset(b: number|string): Moment;
}
TypeScript Version: master
Code
https://github.com/Microsoft/TypeScript/blob/master/src/lib/es5.d.ts#L330-L340
Expected behavior:
match(regexp: string | RegExp): RegExpMatchArray | null;Actual behavior:
/**
* Matches a string with a regular expression, and returns an array containing the results of that search.
* @param regexp A variable name or string literal containing the regular expression pattern and flags.
*/
match(regexp: string): RegExpMatchArray | null;
/**
* Matches a string with a regular expression, and returns an array containing the results of that search.
* @param regexp A regular expression object that contains the regular expression pattern and applicable flags.
*/
match(regexp: RegExp): RegExpMatchArray | null;Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created