36 lines
No EOL
1.3 KiB
Text
36 lines
No EOL
1.3 KiB
Text
tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts(1,1): error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
|
Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'.
|
|
|
|
|
|
==== tests/cases/conformance/es6/spread/iteratorSpreadInCall7.ts (1 errors) ====
|
|
foo(...new SymbolIterator, ...new StringIterator);
|
|
~~~
|
|
!!! error TS2453: The type argument for type parameter 'T' cannot be inferred from the usage. Consider specifying the type arguments explicitly.
|
|
!!! error TS2453: Type argument candidate 'symbol' is not a valid type argument because it is not a supertype of candidate 'string'.
|
|
|
|
function foo<T>(...s: T[]) { return s[0]; }
|
|
class SymbolIterator {
|
|
next() {
|
|
return {
|
|
value: Symbol(),
|
|
done: false
|
|
};
|
|
}
|
|
|
|
[Symbol.iterator]() {
|
|
return this;
|
|
}
|
|
}
|
|
|
|
class StringIterator {
|
|
next() {
|
|
return {
|
|
value: "",
|
|
done: false
|
|
};
|
|
}
|
|
|
|
[Symbol.iterator]() {
|
|
return this;
|
|
}
|
|
} |