Conflicts: src/compiler/checker.ts src/compiler/diagnosticInformationMap.generated.ts src/compiler/parser.ts tests/baselines/reference/FunctionDeclaration5_es6.errors.txt tests/baselines/reference/VariableDeclaration2_es6.errors.txt tests/baselines/reference/VariableDeclaration4_es6.errors.txt tests/baselines/reference/anonymousModules.errors.txt tests/baselines/reference/callSignaturesWithParameterInitializers2.errors.txt tests/baselines/reference/conflictMarkerTrivia1.errors.txt tests/baselines/reference/dottedModuleName.errors.txt tests/baselines/reference/innerModExport1.errors.txt tests/baselines/reference/innerModExport2.errors.txt tests/baselines/reference/parserAccessors10.errors.txt tests/baselines/reference/parserComputedPropertyName5.errors.txt tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction1.errors.txt tests/baselines/reference/parserErrantEqualsGreaterThanAfterFunction2.errors.txt tests/baselines/reference/parserModifierOnStatementInBlock2.errors.txt tests/baselines/reference/parserSkippedTokens16.errors.txt tests/baselines/reference/privateIndexer2.errors.txt
46 lines
No EOL
2.2 KiB
Text
46 lines
No EOL
2.2 KiB
Text
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.
|
|
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) ====
|
|
// 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.
|
|
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.
|
|
foo(x = 1) { }
|
|
}
|
|
|
|
var c: C;
|
|
c.foo();
|
|
c.foo(1);
|
|
|
|
var b = {
|
|
foo(x = 1), // error
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier 'foo'.
|
|
~~~~~
|
|
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
~
|
|
!!! error TS1005: '{' expected.
|
|
foo(x = 1) { }, // error
|
|
~~~
|
|
!!! error TS2300: Duplicate identifier 'foo'.
|
|
}
|
|
|
|
b.foo();
|
|
b.foo(1); |