mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
22 lines
671 B
TypeScript
22 lines
671 B
TypeScript
//// [tests/cases/compiler/genericFunctionsWithOptionalParameters2.ts] ////
|
|
|
|
//// [genericFunctionsWithOptionalParameters2.ts]
|
|
interface Utils {
|
|
fold<T, S>(c: Array<T>, folder?: (s: S, t: T) => T, init?: S): T;
|
|
}
|
|
|
|
declare var utils: Utils;
|
|
|
|
utils.fold(); // error
|
|
utils.fold(null); // no error
|
|
utils.fold(null, null); // no error
|
|
utils.fold(null, null, null); // error: Unable to invoke type with no call signatures
|
|
|
|
|
|
//// [genericFunctionsWithOptionalParameters2.js]
|
|
"use strict";
|
|
utils.fold(); // error
|
|
utils.fold(null); // no error
|
|
utils.fold(null, null); // no error
|
|
utils.fold(null, null, null); // error: Unable to invoke type with no call signatures
|