mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 20:14:01 -06:00
Replace uses of 'Symbol.isRegExp' with 'Symbol.toPrimitive'.
This commit is contained in:
parent
f75c9a6624
commit
33028d5199
10
src/lib/es6.d.ts
vendored
10
src/lib/es6.d.ts
vendored
@ -52,19 +52,19 @@ interface SymbolConstructor {
|
||||
|
||||
/**
|
||||
* A method that returns the default iterator for an object.Called by the semantics of the
|
||||
* for-of statement.
|
||||
* for-of statement.
|
||||
*/
|
||||
iterator: symbol;
|
||||
|
||||
/**
|
||||
* A method that converts an object to a corresponding primitive value.Called by the ToPrimitive
|
||||
* abstract operation.
|
||||
* abstract operation.
|
||||
*/
|
||||
toPrimitive: symbol;
|
||||
|
||||
/**
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built- in method Object.prototype.toString.
|
||||
* A String value that is used in the creation of the default string description of an object.
|
||||
* Called by the built-in method Object.prototype.toString.
|
||||
*/
|
||||
toStringTag: symbol;
|
||||
|
||||
@ -106,7 +106,7 @@ interface ObjectConstructor {
|
||||
getOwnPropertySymbols(o: any): symbol[];
|
||||
|
||||
/**
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* Returns true if the values are the same value, false otherwise.
|
||||
* @param value1 The first value.
|
||||
* @param value2 The second value.
|
||||
*/
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//@target: ES6
|
||||
//@declaration: true
|
||||
class C {
|
||||
[Symbol.isRegExp]: number;
|
||||
[Symbol.toPrimitive]: number;
|
||||
}
|
||||
@ -3,6 +3,6 @@
|
||||
class C {
|
||||
static [Symbol.iterator] = 0;
|
||||
static [Symbol.toPrimitive]() { }
|
||||
static get [Symbol.isRegExp]() { return ""; }
|
||||
static set [Symbol.isRegExp](x) { }
|
||||
static get [Symbol.toPrimitive]() { return ""; }
|
||||
static set [Symbol.toPrimitive](x) { }
|
||||
}
|
||||
@ -8,7 +8,7 @@ module M {
|
||||
[Symbol.isConcatSpreadable](): I {
|
||||
return undefined
|
||||
}
|
||||
get [Symbol.isRegExp]() { return undefined; }
|
||||
set [Symbol.isRegExp](x: I) { }
|
||||
get [Symbol.toPrimitive]() { return undefined; }
|
||||
set [Symbol.toPrimitive](x: I) { }
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
//@target: ES6
|
||||
//@declaration: true
|
||||
class C {
|
||||
get [Symbol.isRegExp]() { return ""; }
|
||||
get [Symbol.toPrimitive]() { return ""; }
|
||||
set [Symbol.toStringTag](x) { }
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
//@target: ES6
|
||||
//@declaration: true
|
||||
class C {
|
||||
get [Symbol.isRegExp]() { return ""; }
|
||||
get [Symbol.toPrimitive]() { return ""; }
|
||||
get [Symbol.toStringTag]() { return ""; }
|
||||
}
|
||||
@ -1,5 +1,5 @@
|
||||
//@target: ES6
|
||||
//@declaration: true
|
||||
class C {
|
||||
[Symbol.isRegExp] = "";
|
||||
[Symbol.toPrimitive] = "";
|
||||
}
|
||||
@ -1,7 +1,7 @@
|
||||
//@target: ES6
|
||||
//@declaration: true
|
||||
class C {
|
||||
[Symbol.isRegExp](x: number);
|
||||
[Symbol.isRegExp](x: string);
|
||||
[Symbol.isRegExp](x: any) { }
|
||||
[Symbol.toPrimitive](x: number);
|
||||
[Symbol.toPrimitive](x: string);
|
||||
[Symbol.toPrimitive](x: any) { }
|
||||
}
|
||||
@ -1,6 +1,6 @@
|
||||
//@target: ES6
|
||||
//@declaration: true
|
||||
class C {
|
||||
get [Symbol.isRegExp]() { return ""; }
|
||||
set [Symbol.isRegExp](x) { }
|
||||
get [Symbol.toPrimitive]() { return ""; }
|
||||
set [Symbol.toPrimitive](x) { }
|
||||
}
|
||||
@ -8,6 +8,6 @@ declare function foo<T, U>(p: I<T, U>): { t: T; u: U };
|
||||
|
||||
foo({
|
||||
[Symbol.isConcatSpreadable]: "",
|
||||
[Symbol.isRegExp]: 0,
|
||||
[Symbol.toPrimitive]: 0,
|
||||
[Symbol.unscopables]: true
|
||||
});
|
||||
@ -1,7 +1,7 @@
|
||||
//@target: ES6
|
||||
var x = {
|
||||
[Symbol.iterator]: 0,
|
||||
[Symbol.isRegExp]() { },
|
||||
[Symbol.toPrimitive]() { },
|
||||
get [Symbol.toStringTag]() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
class C {
|
||||
[Symbol.iterator] = 0;
|
||||
[Symbol.unscopables]: number;
|
||||
[Symbol.isRegExp]() { }
|
||||
[Symbol.toPrimitive]() { }
|
||||
get [Symbol.toStringTag]() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
//@target: ES6
|
||||
interface I {
|
||||
[Symbol.unscopables]: number;
|
||||
[Symbol.isRegExp]();
|
||||
[Symbol.toPrimitive]();
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
//@target: ES6
|
||||
declare class C {
|
||||
[Symbol.isRegExp]: string;
|
||||
[Symbol.toPrimitive]: string;
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
//@target: ES6
|
||||
class C {
|
||||
[Symbol.isRegExp]: string;
|
||||
[Symbol.toPrimitive]: string;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user