2014-07-13 01:04:16 +02:00
|
|
|
//// [stringLiteralTypesInImplementationSignatures2.ts]
|
|
|
|
// String literal types are only valid in overload signatures
|
|
|
|
|
|
|
|
function foo(x: any);
|
|
|
|
function foo(x: 'hi') { }
|
|
|
|
|
|
|
|
class C {
|
|
|
|
foo(x: string);
|
|
|
|
foo(x: 'hi') { }
|
|
|
|
}
|
|
|
|
|
|
|
|
interface I {
|
|
|
|
(x: 'a');
|
|
|
|
(x: 'hi');
|
|
|
|
foo(x: 'a', y: 'a');
|
|
|
|
foo(x: 'hi', y: 'hi');
|
|
|
|
}
|
|
|
|
|
|
|
|
var a: {
|
|
|
|
(x: 'hi');
|
|
|
|
(x: 'a');
|
|
|
|
foo(x: 'hi');
|
|
|
|
foo(x: 'a');
|
|
|
|
}
|
|
|
|
|
|
|
|
var b = {
|
|
|
|
foo(x: 'hi') { },
|
|
|
|
foo(x: 'a') { },
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//// [stringLiteralTypesInImplementationSignatures2.js]
|
2014-08-19 19:43:13 +02:00
|
|
|
// String literal types are only valid in overload signatures
|
2014-07-13 01:04:16 +02:00
|
|
|
function foo(x) {
|
|
|
|
}
|
|
|
|
var C = (function () {
|
|
|
|
function C() {
|
|
|
|
}
|
|
|
|
C.prototype.foo = function (x) {
|
|
|
|
};
|
|
|
|
return C;
|
|
|
|
})();
|
|
|
|
var a;
|
|
|
|
var b = {
|
2014-07-23 20:48:29 +02:00
|
|
|
foo: function (x) {
|
2014-07-13 01:04:16 +02:00
|
|
|
},
|
2014-07-23 20:48:29 +02:00
|
|
|
foo: function (x) {
|
2014-07-28 20:34:30 +02:00
|
|
|
}
|
2014-07-13 01:04:16 +02:00
|
|
|
};
|