36 lines
No EOL
1.1 KiB
Text
36 lines
No EOL
1.1 KiB
Text
tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts(1,28): error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'.
|
|
Type 'string' is not assignable to type 'symbol'.
|
|
|
|
|
|
==== tests/cases/conformance/es6/spread/iteratorSpreadInCall6.ts (1 errors) ====
|
|
foo(...new SymbolIterator, ...new StringIterator);
|
|
~~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type 'number | symbol'.
|
|
!!! error TS2345: Type 'string' is not assignable to type 'symbol'.
|
|
|
|
function foo(...s: (symbol | number)[]) { }
|
|
class SymbolIterator {
|
|
next() {
|
|
return {
|
|
value: Symbol(),
|
|
done: false
|
|
};
|
|
}
|
|
|
|
[Symbol.iterator]() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
class StringIterator {
|
|
next() {
|
|
return {
|
|
value: "",
|
|
done: false
|
|
};
|
|
}
|
|
|
|
[Symbol.iterator]() {
|
|
return this;
|
|
}
|
|
} |