TypeScript/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt
2014-09-11 16:11:08 -07:00

49 lines
2 KiB
Plaintext

==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/stringLiteralTypesInImplementationSignatures.ts (11 errors) ====
// String literal types are only valid in overload signatures
function foo(x: 'hi') { }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
var f = function foo(x: 'hi') { }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
var f2 = (x: 'hi', y: 'hi') => { }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
class C {
foo(x: 'hi') { }
~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
}
interface I {
(x: 'hi');
~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
foo(x: 'hi', y: 'hi');
~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
}
var a: {
(x: 'hi');
~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
foo(x: 'hi');
~~~~~~~~~~~~~
!!! error TS2382: Specialized overload signature is not assignable to any non-specialized signature.
}
var b = {
foo(x: 'hi') { },
~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
a: function foo(x: 'hi', y: 'hi') { },
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
b: (x: 'hi') => { }
~~~~~~~~~~~~~~~~
!!! error TS2381: A signature with an implementation cannot use a string literal type.
}