Improve operator overload typings (#480)

This commit is contained in:
Max Graey
2019-02-21 01:23:46 +02:00
committed by Daniel Wirtz
parent 951b6f9f45
commit 2c365ada5b
2 changed files with 40 additions and 34 deletions

View File

@ -931,7 +931,10 @@ declare function global(
): TypedPropertyDescriptor<any> | void;
/** Annotates a method as a binary operator overload for the specified `token`. */
declare function operator(token: string): (
declare function operator(token:
"[]" | "[]=" | "{}" | "{}=" | "==" | "!=" | ">" | "<" | "<=" | ">=" |
">>" | ">>>" | "<<" | "&" | "|" | "^" | "+" | "-" | "*" | "**" | "/" | "%"
): (
target: any,
propertyKey: string,
descriptor: TypedPropertyDescriptor<any>
@ -939,19 +942,22 @@ declare function operator(token: string): (
declare namespace operator {
/** Annotates a method as a binary operator overload for the specified `token`. */
export function binary(token: string): (
export function binary(token:
"[]" | "[]=" | "{}" | "{}=" | "==" | "!=" | ">" | "<" | "<=" | ">=" |
">>" | ">>>" | "<<" | "&" | "|" | "^" | "+" | "-" | "*" | "**" | "/" | "%"
): (
target: any,
propertyKey: string,
descriptor: TypedPropertyDescriptor<any>
) => TypedPropertyDescriptor<any> | void;
/** Annotates a method as an unary prefix operator overload for the specified `token`. */
export function prefix(token: string): (
export function prefix(token: "!" | "~" | "+" | "-" | "++" | "--"): (
target: any,
propertyKey: string,
descriptor: TypedPropertyDescriptor<any>
) => TypedPropertyDescriptor<any> | void;
/** Annotates a method as an unary postfix operator overload for the specified `token`. */
export function postfix(token: string): (
export function postfix(token: "++" | "--"): (
target: any,
propertyKey: string,
descriptor: TypedPropertyDescriptor<any>