TypeScript/tests/baselines/reference/stringLiteralTypesInImplementationSignatures.errors.txt
2014-07-12 17:30:19 -07:00

49 lines
1.8 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') { }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! A signature with an implementation cannot use a string literal type.
var f = function foo(x: 'hi') { }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! A signature with an implementation cannot use a string literal type.
var f2 = (x: 'hi', y: 'hi') => { }
~~~~~~~~~~~~~~~~~~~~~~~~~
!!! A signature with an implementation cannot use a string literal type.
class C {
foo(x: 'hi') { }
~~~~~~~~~~~~~~~~
!!! A signature with an implementation cannot use a string literal type.
}
interface I {
(x: 'hi');
~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: 'hi', y: 'hi');
~~~~~~~~~~~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
}
var a: {
(x: 'hi');
~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
foo(x: 'hi');
~~~~~~~~~~~~~
!!! Specialized overload signature is not assignable to any non-specialized signature.
}
var b = {
foo(x: 'hi') { },
~~~~~~~~~~~~~~~~
!!! A signature with an implementation cannot use a string literal type.
a: function foo(x: 'hi', y: 'hi') { },
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! A signature with an implementation cannot use a string literal type.
b: (x: 'hi') => { }
~~~~~~~~~~~~~~~~
!!! A signature with an implementation cannot use a string literal type.
}