This was we don't get noisy baselines just because a different phase of the compiler reported the diagnostic. This helps with Yui's refactoring work to move grammar checks into the type checker.
106 lines
No EOL
5.8 KiB
Text
106 lines
No EOL
5.8 KiB
Text
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(3,14): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(4,22): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(5,22): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(15,9): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(23,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(24,20): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(34,6): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(35,9): error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(44,9): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS1015: Parameter cannot have question mark and initializer.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(45,32): error TS2322: Type 'string' is not assignable to type 'number'.
|
|
tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts(46,9): error TS1015: Parameter cannot have question mark and initializer.
|
|
|
|
|
|
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/callSignatureWithOptionalParameterAndInitializer.ts (16 errors) ====
|
|
// Optional parameters cannot also have initializer expressions, these are all errors
|
|
|
|
function foo(x?: number = 1) { }
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
var f = function foo(x?: number = 1) { }
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
var f2 = (x: number, y? = 1) => { }
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
|
|
foo(1);
|
|
foo();
|
|
f(1);
|
|
f();
|
|
f2(1);
|
|
f2(1, 2);
|
|
|
|
class C {
|
|
foo(x?: number = 1) { }
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
}
|
|
|
|
var c: C;
|
|
c.foo();
|
|
c.foo(1);
|
|
|
|
interface I {
|
|
(x? = 1);
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
~~~~~~
|
|
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
foo(x: number, y?: number = 1);
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
}
|
|
|
|
var i: I;
|
|
i();
|
|
i(1);
|
|
i.foo(1);
|
|
i.foo(1, 2);
|
|
|
|
var a: {
|
|
(x?: number = 1);
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
~~~~~~~~~~~~~~
|
|
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
foo(x? = 1);
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
~~~~~~
|
|
!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation.
|
|
}
|
|
|
|
a();
|
|
a(1);
|
|
a.foo();
|
|
a.foo(1);
|
|
|
|
var b = {
|
|
foo(x?: number = 1) { },
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
a: function foo(x: number, y?: number = '') { },
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
~~~~~~~~~~~~~~~
|
|
!!! error TS2322: Type 'string' is not assignable to type 'number'.
|
|
b: (x?: any = '') => { }
|
|
~
|
|
!!! error TS1015: Parameter cannot have question mark and initializer.
|
|
}
|
|
|
|
b.foo();
|
|
b.foo(1);
|
|
b.a(1);
|
|
b.a(1, 2);
|
|
b.b();
|
|
b.b(1);
|
|
|