TypeScript/tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt

46 lines
2.2 KiB
Plaintext
Raw Normal View History

tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(4,14): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(11,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
2014-10-01 02:15:18 +02:00
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,5): error TS2300: Duplicate identifier 'foo'.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(20,15): error TS1005: '{' expected.
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts(21,5): error TS2300: Duplicate identifier 'foo'.
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignaturesWithParameterInitializers2.ts (6 errors) ====
2014-07-13 01:04:16 +02:00
// Optional parameters allow initializers only in implementation signatures
// All the below declarations are errors
function foo(x = 2);
~~~~~
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
2014-07-13 01:04:16 +02:00
function foo(x = 1) { }
foo(1);
foo();
class C {
foo(x = 2);
~~~~~
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
2014-07-13 01:04:16 +02:00
foo(x = 1) { }
}
var c: C;
c.foo();
c.foo(1);
var b = {
2014-10-01 20:27:20 +02:00
foo(x = 1), // error
2014-07-13 01:04:16 +02:00
~~~
2014-10-01 02:15:18 +02:00
!!! error TS2300: Duplicate identifier 'foo'.
~~~~~
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
~
!!! error TS1005: '{' expected.
2014-10-01 20:27:20 +02:00
foo(x = 1) { }, // error
~~~
!!! error TS2300: Duplicate identifier 'foo'.
2014-07-13 01:04:16 +02:00
}
b.foo();
b.foo(1);