2014-07-13 01:04:16 +02:00
|
|
|
//// [funcdecl.ts]
|
|
|
|
function simpleFunc() {
|
|
|
|
return "this is my simple func";
|
|
|
|
}
|
|
|
|
var simpleFuncVar = simpleFunc;
|
|
|
|
|
|
|
|
function anotherFuncNoReturn() {
|
|
|
|
}
|
|
|
|
var anotherFuncNoReturnVar = anotherFuncNoReturn;
|
|
|
|
|
|
|
|
function withReturn() : string{
|
|
|
|
return "Hello";
|
|
|
|
}
|
|
|
|
var withReturnVar = withReturn;
|
|
|
|
|
|
|
|
function withParams(a : string) : string{
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
var withparamsVar = withParams;
|
|
|
|
|
|
|
|
function withMultiParams(a : number, b, c: Object) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
var withMultiParamsVar = withMultiParams;
|
|
|
|
|
|
|
|
function withOptionalParams(a?: string) {
|
|
|
|
}
|
|
|
|
var withOptionalParamsVar = withOptionalParams;
|
|
|
|
|
|
|
|
function withInitializedParams(a: string, b0, b = 30, c = "string value") {
|
|
|
|
}
|
|
|
|
var withInitializedParamsVar = withInitializedParams;
|
|
|
|
|
|
|
|
function withOptionalInitializedParams(a: string, c: string = "hello string") {
|
|
|
|
}
|
|
|
|
var withOptionalInitializedParamsVar = withOptionalInitializedParams;
|
|
|
|
|
|
|
|
function withRestParams(a: string, ... myRestParameter : number[]) {
|
|
|
|
return myRestParameter;
|
|
|
|
}
|
|
|
|
var withRestParamsVar = withRestParams;
|
|
|
|
|
|
|
|
function overload1(n: number) : string;
|
|
|
|
function overload1(s: string) : string;
|
|
|
|
function overload1(ns: any) {
|
|
|
|
return ns.toString();
|
|
|
|
}
|
|
|
|
var withOverloadSignature = overload1;
|
|
|
|
|
|
|
|
function f(n: () => void) { }
|
|
|
|
|
|
|
|
module m2 {
|
|
|
|
export function foo(n: () => void ) {
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
m2.foo(() => {
|
|
|
|
|
|
|
|
var b = 30;
|
|
|
|
return b;
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
declare function fooAmbient(n: number): string;
|
|
|
|
|
|
|
|
declare function overloadAmbient(n: number): string;
|
|
|
|
declare function overloadAmbient(s: string): string;
|
|
|
|
|
|
|
|
var f2 = () => {
|
|
|
|
return "string";
|
|
|
|
}
|
|
|
|
|
|
|
|
//// [funcdecl.js]
|
|
|
|
function simpleFunc() {
|
|
|
|
return "this is my simple func";
|
|
|
|
}
|
|
|
|
var simpleFuncVar = simpleFunc;
|
|
|
|
function anotherFuncNoReturn() {
|
|
|
|
}
|
|
|
|
var anotherFuncNoReturnVar = anotherFuncNoReturn;
|
|
|
|
function withReturn() {
|
|
|
|
return "Hello";
|
|
|
|
}
|
|
|
|
var withReturnVar = withReturn;
|
|
|
|
function withParams(a) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
var withparamsVar = withParams;
|
|
|
|
function withMultiParams(a, b, c) {
|
|
|
|
return a;
|
|
|
|
}
|
|
|
|
var withMultiParamsVar = withMultiParams;
|
|
|
|
function withOptionalParams(a) {
|
|
|
|
}
|
|
|
|
var withOptionalParamsVar = withOptionalParams;
|
|
|
|
function withInitializedParams(a, b0, b, c) {
|
|
|
|
if (b === void 0) { b = 30; }
|
|
|
|
if (c === void 0) { c = "string value"; }
|
|
|
|
}
|
|
|
|
var withInitializedParamsVar = withInitializedParams;
|
|
|
|
function withOptionalInitializedParams(a, c) {
|
|
|
|
if (c === void 0) { c = "hello string"; }
|
|
|
|
}
|
|
|
|
var withOptionalInitializedParamsVar = withOptionalInitializedParams;
|
|
|
|
function withRestParams(a) {
|
|
|
|
var myRestParameter = [];
|
|
|
|
for (var _i = 1; _i < arguments.length; _i++) {
|
|
|
|
myRestParameter[_i - 1] = arguments[_i];
|
|
|
|
}
|
|
|
|
return myRestParameter;
|
|
|
|
}
|
|
|
|
var withRestParamsVar = withRestParams;
|
|
|
|
function overload1(ns) {
|
|
|
|
return ns.toString();
|
|
|
|
}
|
|
|
|
var withOverloadSignature = overload1;
|
2015-02-07 03:45:09 +01:00
|
|
|
function f(n) { }
|
2014-07-13 01:04:16 +02:00
|
|
|
var m2;
|
|
|
|
(function (m2) {
|
|
|
|
function foo(n) {
|
|
|
|
}
|
|
|
|
m2.foo = foo;
|
|
|
|
})(m2 || (m2 = {}));
|
|
|
|
m2.foo(function () {
|
|
|
|
var b = 30;
|
|
|
|
return b;
|
|
|
|
});
|
|
|
|
var f2 = function () {
|
|
|
|
return "string";
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//// [funcdecl.d.ts]
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function simpleFunc(): string;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var simpleFuncVar: typeof simpleFunc;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function anotherFuncNoReturn(): void;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var anotherFuncNoReturnVar: typeof anotherFuncNoReturn;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function withReturn(): string;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withReturnVar: typeof withReturn;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function withParams(a: string): string;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withparamsVar: typeof withParams;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function withMultiParams(a: number, b: any, c: Object): number;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withMultiParamsVar: typeof withMultiParams;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function withOptionalParams(a?: string): void;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withOptionalParamsVar: typeof withOptionalParams;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function withInitializedParams(a: string, b0: any, b?: number, c?: string): void;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withInitializedParamsVar: typeof withInitializedParams;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function withOptionalInitializedParams(a: string, c?: string): void;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withOptionalInitializedParamsVar: typeof withOptionalInitializedParams;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function withRestParams(a: string, ...myRestParameter: number[]): number[];
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withRestParamsVar: typeof withRestParams;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function overload1(n: number): string;
|
|
|
|
declare function overload1(s: string): string;
|
2014-08-09 01:15:09 +02:00
|
|
|
declare var withOverloadSignature: typeof overload1;
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function f(n: () => void): void;
|
2014-07-11 23:44:31 +02:00
|
|
|
declare module m2 {
|
2014-07-12 01:36:06 +02:00
|
|
|
function foo(n: () => void): void;
|
2014-07-11 23:44:31 +02:00
|
|
|
}
|
2014-07-12 01:36:06 +02:00
|
|
|
declare function fooAmbient(n: number): string;
|
|
|
|
declare function overloadAmbient(n: number): string;
|
|
|
|
declare function overloadAmbient(s: string): string;
|
|
|
|
declare var f2: () => string;
|