diff --git a/angular-ui/angular-ui-router-tests.ts b/angular-ui/angular-ui-router-tests.ts index 3d7ce3b5c..38f8b5ca0 100644 --- a/angular-ui/angular-ui-router-tests.ts +++ b/angular-ui/angular-ui-router-tests.ts @@ -2,6 +2,10 @@ var myApp = angular.module('testModule'); +interface MyAppScope extends ng.IScope { + items: string[]; + things: string[]; +} myApp.config(( $stateProvider: ng.ui.IStateProvider, @@ -19,7 +23,7 @@ myApp.config(( .state('state1.list', { url: "/list", templateUrl: "partials/state1.list.html", - controller: function($scope) { + controller: function ($scope: MyAppScope) { $scope.items = ["A", "List", "Of", "Items"]; } }) @@ -30,7 +34,7 @@ myApp.config(( .state('state2.list', { url: "/list", templateUrl: "partials/state2.list.html", - controller: function($scope) { + controller: function ($scope: MyAppScope) { $scope.things = ["A", "Set", "Of", "Things"]; } }).state('index', { diff --git a/angularjs/angular-resource-tests.ts b/angularjs/angular-resource-tests.ts index b223b8171..2870b21ad 100644 --- a/angularjs/angular-resource-tests.ts +++ b/angularjs/angular-resource-tests.ts @@ -83,5 +83,5 @@ var resourceService: ng.resource.IResourceService; resourceClass = resourceServiceFactoryFunction(resourceService); -resourceServiceFactoryFunction = function (resourceService) { return resourceClass }; +resourceServiceFactoryFunction = function (resourceService: ng.resource.IResourceService) { return resourceClass; }; mod = mod.factory('factory name', resourceServiceFactoryFunction); diff --git a/azure-mobile-services-client/AzureMobileServicesClient-tests.ts b/azure-mobile-services-client/AzureMobileServicesClient-tests.ts index 4d1765b25..7a3b9b956 100644 --- a/azure-mobile-services-client/AzureMobileServicesClient-tests.ts +++ b/azure-mobile-services-client/AzureMobileServicesClient-tests.ts @@ -59,7 +59,7 @@ query.read().done(printOut); //Execute query remotly and return data filtered //testing more complicated Query in composition with previous using function Predicate and Projection var minlength = 15; //parameter value for filter Predicate -query.where(function (len: number) { return this.text != null && this.text.length > len }, minlength) +query.where(function (len?: number) { return this.text != null && this.text.length > len }, minlength) .orderByDescending('id').skip(2).take(3) //some other ordering and paging filters .select(function () { return { abc: this.text + '|' + this.id }; }) //Projection .read().done(printOut); //return 3 object {abd: 'ttttttttttttttt|ID'} diff --git a/commander/commander-tests.ts b/commander/commander-tests.ts index eff20f28d..495426edd 100644 --- a/commander/commander-tests.ts +++ b/commander/commander-tests.ts @@ -18,7 +18,7 @@ program program .command('setup [env]') .description('run setup commands for all envs') - .action(function (env) { + .action(function (env?) { env = env || 'all'; console.log('setup for %s env(s)', env); }); @@ -27,7 +27,7 @@ program // $ deploy production program .command('*') - .action(function (env) { + .action(function (env?) { console.log('deploying "%s"', env); }); diff --git a/couchbase/couchbase-tests.ts b/couchbase/couchbase-tests.ts index f4d1b1061..4305300ee 100644 --- a/couchbase/couchbase-tests.ts +++ b/couchbase/couchbase-tests.ts @@ -4,10 +4,14 @@ import couchbase = require('couchbase'); var db = new couchbase.Connection({ bucket: "default" }, function (err) { if (err) throw err; - db.set('testdoc', { name: 'Frank' }, function (err, result) { - if (err) throw err; + // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix + (db).set('testdoc', { name: 'Frank' }, function (err, result) { + if (err) throw err; - db.get('testdoc', function (err, result) { + var s: string = err.message; + + // TS 0.9.5 bug https://typescript.codeplex.com/workitem/2035, todo: remove cast after fix + (db).get('testdoc', function (err, result) { if (err) throw err; console.log(result.value); diff --git a/crossfilter/crossfilter-tests.ts b/crossfilter/crossfilter-tests.ts index 222096566..745ed3aa4 100644 --- a/crossfilter/crossfilter-tests.ts +++ b/crossfilter/crossfilter-tests.ts @@ -44,28 +44,30 @@ paymentsByTotal.filterFunction(d => 0 <= d && d < 10 || 20 <= d && d < 30); paymentsByTotal.filterAll(); // selects all payments var topPayments = paymentsByTotal.top(4); // the top four payments, by total -topPayments[0]; // the biggest payment +{var p: Payment = topPayments[0];} // the biggest payment topPayments[1]; // the second-biggest payment var allPayments = paymentsByTotal.top(Infinity); var bottomPayments = paymentsByTotal.bottom(4); // the bottom four payments, by total -bottomPayments[0]; // the smallest payment +{var p: Payment = bottomPayments[0];} // the smallest payment bottomPayments[1]; // the second-smallest payment var paymentGroupsByTotal = paymentsByTotal.group(total => Math.floor(total / 100)); paymentGroupsByTotal.size(); -paymentGroupsByTotal.reduce((p, v) => p + 1, (p, v) => p - 1, () => 0); +// bug of TS 0.9.5 https://typescript.codeplex.com/discussions/471751 +//paymentGroupsByTotal.reduce((p, v) => p + 1, (p, v) => p - 1, () => 0); +paymentGroupsByTotal.reduce((p, v) => p + 1, (p, v) => p - 1, () => 0); paymentGroupsByTotal.reduceCount(); var paymentsByType = payments.dimension(d => d.type), paymentVolumeByType = paymentsByType.group().reduceSum(d => d.total), topTypes = paymentVolumeByType.top(1); -topTypes[0].key; // the top payment type (e.g., "tab") -topTypes[0].value; // the payment volume for that type (e.g., 900) +{var s: string = topTypes[0].key;} // the top payment type (e.g., "tab") +{var n: number = topTypes[0].value;} // the payment volume for that type (e.g., 900) interface Group { count: number; @@ -101,7 +103,7 @@ topTotals[0].value; // reduced value for that type (e.g., {count:8, total:920}) paymentGroupsByTotal.orderNatural(); -var paymentCountByType = paymentsByType.group(); +var paymentCountByType = paymentsByType.group().reduceCount(); topTypes = paymentCountByType.top(1); topTypes[0].key; // the top payment type (e.g., "tab") topTypes[0].value; // the count of payments of that type (e.g., 8) diff --git a/crossfilter/crossfilter.d.ts b/crossfilter/crossfilter.d.ts index e01cf1fcb..c98d20867 100644 --- a/crossfilter/crossfilter.d.ts +++ b/crossfilter/crossfilter.d.ts @@ -102,8 +102,8 @@ declare module CrossFilter { top(k: number): T[]; bottom(k: number): T[]; dispose(): void; - group(): Group; - group(groupValue: (data: T) => TGroup): Group; + group(): Group; + group(groupValue: (data: TDimension) => TGroup): Group; groupAll(): GroupAll; } } diff --git a/cryptojs/test/aes-tests.ts b/cryptojs/test/aes-tests.ts index eaef25447..d4f0d9537 100644 --- a/cryptojs/test/aes-tests.ts +++ b/cryptojs/test/aes-tests.ts @@ -63,9 +63,9 @@ YUI.add('algo-aes-test', function (Y) { // Replace random method with one that returns a predictable value C.lib.WordArray.random = function (nBytes) { - var words = []; + var words: number[] = []; for (var i = 0; i < nBytes; i += 4) { - words.push([0x11223344]); + words.push(0x11223344); } return C.lib.WordArray.create(words, nBytes); diff --git a/cryptojs/test/des-tests.ts b/cryptojs/test/des-tests.ts index 5e18608e0..d889abab1 100644 --- a/cryptojs/test/des-tests.ts +++ b/cryptojs/test/des-tests.ts @@ -87,9 +87,9 @@ YUI.add('algo-des-test', function (Y) { // Replace random method with one that returns a predictable value C.lib.WordArray.random = function (nBytes) { - var words = []; + var words: number[] = []; for (var i = 0; i < nBytes; i += 4) { - words.push([0x11223344]); + words.push(0x11223344); } return C.lib.WordArray.create(words, nBytes); diff --git a/cryptojs/test/pad-iso10126-tests.ts b/cryptojs/test/pad-iso10126-tests.ts index de46f7d81..2961c9a32 100644 --- a/cryptojs/test/pad-iso10126-tests.ts +++ b/cryptojs/test/pad-iso10126-tests.ts @@ -15,9 +15,9 @@ YUI.add('pad-iso10126-test', function (Y) { // Replace random method with one that returns a predictable value C.lib.WordArray.random = function (nBytes) { - var words = []; + var words: number[] = []; for (var i = 0; i < nBytes; i += 4) { - words.push([0x11223344]); + words.push(0x11223344); } return C.lib.WordArray.create(words, nBytes); diff --git a/cryptojs/test/rabbit-legacy-tests.ts b/cryptojs/test/rabbit-legacy-tests.ts index 658d62b25..30f368717 100644 --- a/cryptojs/test/rabbit-legacy-tests.ts +++ b/cryptojs/test/rabbit-legacy-tests.ts @@ -63,9 +63,9 @@ YUI.add('algo-rabbit-legacy-test', function (Y) { // Replace random method with one that returns a predictable value C.lib.WordArray.random = function (nBytes) { - var words = []; + var words: number[] = []; for (var i = 0; i < nBytes; i += 4) { - words.push([0x11223344]); + words.push(0x11223344); } return C.lib.WordArray.create(words, nBytes); diff --git a/cryptojs/test/rabbit-tests.ts b/cryptojs/test/rabbit-tests.ts index e8e0d3e3c..a5690face 100644 --- a/cryptojs/test/rabbit-tests.ts +++ b/cryptojs/test/rabbit-tests.ts @@ -67,9 +67,9 @@ YUI.add('algo-rabbit-test', function (Y) { // Replace random method with one that returns a predictable value C.lib.WordArray.random = function (nBytes) { - var words = []; + var words: number[] = []; for (var i = 0; i < nBytes; i += 4) { - words.push([0x11223344]); + words.push(0x11223344); } return C.lib.WordArray.create(words, nBytes); diff --git a/cryptojs/test/rc4-tests.ts b/cryptojs/test/rc4-tests.ts index 5a4e5aa6f..a827c0921 100644 --- a/cryptojs/test/rc4-tests.ts +++ b/cryptojs/test/rc4-tests.ts @@ -51,9 +51,9 @@ YUI.add('algo-rc4-test', function (Y) { // Replace random method with one that returns a predictable value C.lib.WordArray.random = function (nBytes) { - var words = []; + var words: number[] = []; for (var i = 0; i < nBytes; i += 4) { - words.push([0x11223344]); + words.push(0x11223344); } return C.lib.WordArray.create(words, nBytes); diff --git a/cryptojs/test/tripledes-tests.ts b/cryptojs/test/tripledes-tests.ts index 2227d3710..cbc123ea3 100644 --- a/cryptojs/test/tripledes-tests.ts +++ b/cryptojs/test/tripledes-tests.ts @@ -71,9 +71,9 @@ YUI.add('algo-tripledes-test', function (Y) { // Replace random method with one that returns a predictable value C.lib.WordArray.random = function (nBytes) { - var words = []; + var words: number[] = []; for (var i = 0; i < nBytes; i += 4) { - words.push([0x11223344]); + words.push(0x11223344); } return C.lib.WordArray.create(words, nBytes); diff --git a/dhtmlxgantt/dhtmlxgantt-tests.ts b/dhtmlxgantt/dhtmlxgantt-tests.ts index 0b491ce2b..1bfc7a089 100644 --- a/dhtmlxgantt/dhtmlxgantt-tests.ts +++ b/dhtmlxgantt/dhtmlxgantt-tests.ts @@ -28,6 +28,6 @@ gantt.init("scheduler_here", start); gantt.load("/data/events"); //events -gantt.attachEvent("onBeforeLightbox", function (id: string) { +gantt.attachEvent("onBeforeLightbox", function (id?: string) { gantt.showTask(id); }); \ No newline at end of file diff --git a/dhtmlxscheduler/dhtmlxscheduler-tests.ts b/dhtmlxscheduler/dhtmlxscheduler-tests.ts index d526a1eaf..2f1f2d9ce 100644 --- a/dhtmlxscheduler/dhtmlxscheduler-tests.ts +++ b/dhtmlxscheduler/dhtmlxscheduler-tests.ts @@ -28,6 +28,6 @@ scheduler.init("scheduler_here", start); scheduler.load("/data/events"); //events -scheduler.attachEvent("onEmptyClick", function (ev: Event) { +scheduler.attachEvent("onEmptyClick", function (ev?: Event) { var date: Date = scheduler.getActionData(ev).date; }); \ No newline at end of file diff --git a/expect.js/expect.js.d.ts b/expect.js/expect.js.d.ts index 82f85b19d..e19f769b6 100644 --- a/expect.js/expect.js.d.ts +++ b/expect.js/expect.js.d.ts @@ -17,14 +17,14 @@ declare module Expect { * * @param fn callback to match error string against */ - throwError(fn?: Function): void; + throwError(fn?: (exception: any) => void): void; /** * Assert that the function throws. * * @param fn callback to match error string against */ - throwException(fn?: Function): void; + throwException(fn?: (exception: any) => void): void; /** * Assert that the function throws. diff --git a/fabricjs/fabricjs-tests.ts b/fabricjs/fabricjs-tests.ts index b230e2249..df0d217e8 100644 --- a/fabricjs/fabricjs-tests.ts +++ b/fabricjs/fabricjs-tests.ts @@ -8,10 +8,10 @@ function sample1() { canvas.on({ 'object:moving': function (e) { - e.target.opacity = 0.5; + (e.target).opacity = 0.5; }, 'object:modified': function (e) { - e.target.opacity = 1; + (e.target).opacity = 1; } }); diff --git a/gamepad/gamepad-tests.ts b/gamepad/gamepad-tests.ts index 7491d7970..e6ca9d272 100644 --- a/gamepad/gamepad-tests.ts +++ b/gamepad/gamepad-tests.ts @@ -18,7 +18,7 @@ window.requestAnimationFrame(runAnimation); }; -()=>{ +(()=>{ window.addEventListener('GamepadConnected', (e: GamepadEvent)=>{ console.log('Gamepad ' + e.gamepad.index + ' connected!'); }, false); @@ -69,4 +69,4 @@ runAnimation(); } -}(); \ No newline at end of file +})(); \ No newline at end of file diff --git a/gldatepicker/gldatepicker.d.ts b/gldatepicker/gldatepicker.d.ts index 34781491f..3ed84c219 100644 --- a/gldatepicker/gldatepicker.d.ts +++ b/gldatepicker/gldatepicker.d.ts @@ -64,6 +64,6 @@ interface GlDatePicker { } interface JQuery { - glDatePicker(options?: GlDatePickerOptions): JQuery; - glDatePicker(ret: boolean): GlDatePicker; + glDatePicker(ret: boolean): GlDatePicker; + glDatePicker(options?: GlDatePickerOptions): JQuery; } \ No newline at end of file diff --git a/greasemonkey/greasemonkey-tests.ts b/greasemonkey/greasemonkey-tests.ts index 914c8f4e3..a0185c4a4 100644 --- a/greasemonkey/greasemonkey-tests.ts +++ b/greasemonkey/greasemonkey-tests.ts @@ -96,9 +96,9 @@ GM_xmlhttpRequest({ "Accept": "text/xml" // If not specified, browser defaults will be used. }, onload: function(response) { - var responseXML = response.responseXML; + var responseXML = (response).responseXML; // Inject responseXML into existing Object (only appropriate for XML content). - if (!response.responseXML) { + if (!responseXML) { responseXML = new DOMParser() .parseFromString(response.responseText, "text/xml"); } @@ -205,7 +205,7 @@ var finalUrl: string = syncResult.finalUrl; var readyState: number = syncResult.readyState; var responseHeaders: string = syncResult.responseHeaders; var responseText: string = syncResult.responseText; -var status: number = syncResult.status; +(function() { var status: number = syncResult.status; })(); // conflict with state defined in lib.d.ts var statusText: string = syncResult.statusText; //// Asynchronous diff --git a/handlebars/handlebars-tests.ts b/handlebars/handlebars-tests.ts index 1846f943d..937f93191 100644 --- a/handlebars/handlebars-tests.ts +++ b/handlebars/handlebars-tests.ts @@ -10,7 +10,7 @@ var context = { body: 'Me too!' }] }; -Handlebars.registerHelper('fullName', (person) => { +Handlebars.registerHelper('fullName', (person: typeof context.author) => { return person.firstName + ' ' + person.lastName; }); @@ -28,17 +28,18 @@ var data = { 'name': 'Alan', 'hometown': 'Somewhere, TX', 'kids': [{'name': 'Jimmy', 'age': '12'}, {'name': 'Sally', 'age': '4'}]}; var result = template(data); -Handlebars.registerHelper('link_to', (context) => { +Handlebars.registerHelper('link_to', (context: typeof post) => { return '' + context.body + ''; }); -var context2 = { posts: [{url: '/hello-world', body: 'Hello World!'}] }; +var post = { url: '/hello-world', body: 'Hello World!' }; +var context2 = { posts: [post] }; var source2 = '
    {{#posts}}
  • {{{link_to this}}}
  • {{/posts}}
'; var template2 = Handlebars.compile(source2); template2(context2); -Handlebars.registerHelper('link_to', (title, context) => { +Handlebars.registerHelper('link_to', (title: string, context: typeof post) => { return '' + title + '!'; }); @@ -48,7 +49,7 @@ var template3 = Handlebars.compile(source3); template3(context3); var source4 = '
    {{#people}}
  • {{#link}}{{name}}{{/link}}
  • {{/people}}
'; -Handlebars.registerHelper('link', function(context) { +Handlebars.registerHelper('link', function(context: any) { return '' + context.fn(this) + ''; }); var template4 = Handlebars.compile(source4); @@ -67,13 +68,13 @@ var data3 = { 'people': [ ]}; template5(data3); -Handlebars.registerHelper('list', (items, fn) => { +Handlebars.registerHelper('list', (items: any, fn: (item: any) => string) => { var out = '
    '; for(var i=0, l=items.length; i' + fn(items[i]) + ''; } return out + '
'; }); -Handlebars.registerHelper('fullName', (person) => { +Handlebars.registerHelper('fullName', (person: typeof context.author) => { return person.firstName + ' ' + person.lastName; }); diff --git a/i18next/i18next-tests.ts b/i18next/i18next-tests.ts index 7a07ed829..2b4ce5a45 100644 --- a/i18next/i18next-tests.ts +++ b/i18next/i18next-tests.ts @@ -24,7 +24,6 @@ describe('i18next', function () { dynamicLoad: false, useLocalStorage: false, sendMissing: false, - resStore: false, getAsync: true, returnObjectTrees: false, debug: true, diff --git a/jake/jake-tests.ts b/jake/jake-tests.ts index 74e5cc92f..3459083dc 100644 --- a/jake/jake-tests.ts +++ b/jake/jake-tests.ts @@ -9,7 +9,7 @@ task('default', function (params) { }); desc('This task has prerequisites.'); -task('hasPrereqs', ['foo', 'bar', 'baz'], function (params) { +task('hasPrereqs', ['foo', 'bar', 'baz'], function () { console.log('Ran some prereqs first.'); }); diff --git a/jqrangeslider/jqrangeslider.d.ts b/jqrangeslider/jqrangeslider.d.ts index 7dcb3060f..ef688e5d9 100644 --- a/jqrangeslider/jqrangeslider.d.ts +++ b/jqrangeslider/jqrangeslider.d.ts @@ -57,18 +57,18 @@ interface JQDateRangeSliderOptions extends JQRangeSliderOptions { } interface JQuery { - rangeSlider(options?: JQNumericRangeSliderOptions): JQuery; rangeSlider(method: string): any; rangeSlider(method: string, value: number): JQuery; rangeSlider(method: string, min: number, max: number): JQuery; + rangeSlider(options?: JQNumericRangeSliderOptions): JQuery; - editRangeSlider(options?: JQNumericRangeSliderOptions): JQuery; editRangeSlider(method: string): any; editRangeSlider(method: string, value: number): JQuery; - editRangeSlider(method: string, min: number, max: number): JQuery; + editRangeSlider(method: string, min: number, max: number): JQuery + editRangeSlider(options?: JQNumericRangeSliderOptions): JQuery; - dateRangeSlider(options?: JQRangeSliderOptions): JQuery; dateRangeSlider(method: string): any; dateRangeSlider(method: string, value: Date): JQuery; - dateRangeSlider(method: string, min: Date, max: Date): JQuery; + dateRangeSlider(method: string, min: Date, max: Date): JQuery + dateRangeSlider(options?: JQRangeSliderOptions): JQuery; } diff --git a/jquery.bbq/jquery.bbq-tests.ts b/jquery.bbq/jquery.bbq-tests.ts index c9a337d71..6bf301f3c 100644 --- a/jquery.bbq/jquery.bbq-tests.ts +++ b/jquery.bbq/jquery.bbq-tests.ts @@ -587,7 +587,7 @@ QUnit.module( 'jQuery.fn' ); $.elemUrlAttr({ span: 'arbitrary_attr' }); var test_elems = 'a form link span'.split(' '); -function init_url_attr( container, url ) { +function init_url_attr( _, url ) { var container = $('
').hide().appendTo('body'); $.each( test_elems, function(i,v){ $('<' + v + '/>') diff --git a/jquery.gridster/gridster.d.ts b/jquery.gridster/gridster.d.ts index 6019ebb06..968c0f333 100644 --- a/jquery.gridster/gridster.d.ts +++ b/jquery.gridster/gridster.d.ts @@ -138,7 +138,7 @@ interface GridsterOptions { /** * Return the data you want for each widget in the serialization. **/ - serialize_params?: ($w: JQuery, wgd: GridsterCoords) => T; + serialize_params?: ($w: JQuery, wgd: GridsterCoords) => any; /** * An object with all options for Collision class you want to overwrite. @see GridsterCollision or docs for more info. diff --git a/jquery.tinycarousel/jquery.tinycarousel.d.ts b/jquery.tinycarousel/jquery.tinycarousel.d.ts index 83a030107..2f4f4563a 100644 --- a/jquery.tinycarousel/jquery.tinycarousel.d.ts +++ b/jquery.tinycarousel/jquery.tinycarousel.d.ts @@ -50,7 +50,7 @@ declare module JQueryTinyCarousel { /** * Function that executes after every move (default: null) */ - callback? : Function; + callback? : (element: HTMLElement, index: number) => void; } } interface JQuery { diff --git a/jquery.validation/jquery.validation-tests.ts b/jquery.validation/jquery.validation-tests.ts index 0096db974..cfb10489b 100644 --- a/jquery.validation/jquery.validation-tests.ts +++ b/jquery.validation/jquery.validation-tests.ts @@ -142,12 +142,12 @@ function test_validate() { $(".selector").validate({ highlight: function (element: HTMLInputElement, errorClass, validClass) { $(element).addClass(errorClass).removeClass(validClass); - $(element.form).find("label[for=" + element.id + "]") + $((element).form).find("label[for=" + element.id + "]") .addClass(errorClass); }, unhighlight: function (element: HTMLInputElement, errorClass, validClass) { $(element).removeClass(errorClass).addClass(validClass); - $(element.form).find("label[for=" + element.id + "]") + $((element).form).find("label[for=" + element.id + "]") .removeClass(errorClass); } }); diff --git a/jquery/jquery-tests.ts b/jquery/jquery-tests.ts index 8ea41f2c1..728d9d06f 100644 --- a/jquery/jquery-tests.ts +++ b/jquery/jquery-tests.ts @@ -2372,6 +2372,7 @@ function test_EventIsCallable() { var ev = jQuery.Event('click'); } +$.when($.ajax("/my/page.json")).then(a => a.asdf); // is type JQueryPromise $.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise $.when("asdf", "jkl;").done((x,y) => x.length + y.length, (x,y) => x.length + y.length); diff --git a/jquery/jquery.d.ts b/jquery/jquery.d.ts index e68d50e36..e8a050194 100644 --- a/jquery/jquery.d.ts +++ b/jquery/jquery.d.ts @@ -863,7 +863,8 @@ interface JQuery { toggle(showOrHide: boolean): JQuery; // Events - bind(eventType: string, eventData?: any, handler?: (eventObject: JQueryEventObject) => any): JQuery; + bind(eventType: string, eventData: any, handler: (eventObject: JQueryEventObject) => any): JQuery; + bind(eventType: string, handler: (eventObject: JQueryEventObject) => any): JQuery; bind(eventType: string, eventData: any, preventBubble: boolean): JQuery; bind(eventType: string, preventBubble: boolean): JQuery; bind(...events: any[]): JQuery; diff --git a/moment/moment-tests.ts b/moment/moment-tests.ts index 9dd64d407..5150f7ebc 100644 --- a/moment/moment-tests.ts +++ b/moment/moment-tests.ts @@ -258,7 +258,7 @@ moment.lang('en', { }); moment.lang('en', { - months : function (momentToFormat, format) { + months : function (momentToFormat: Moment, format: string) { // momentToFormat is the moment currently being formatted // format is the formatting string if (/^MMMM/.test(format)) { // if the format starts with 'MMMM' @@ -277,7 +277,7 @@ moment.lang('en', { }); moment.lang('en', { - monthsShort : function (momentToFormat, format) { + monthsShort : function (momentToFormat: Moment, format: string) { if (/^MMMM/.test(format)) { return this.nominative[momentToFormat.month()]; } else { @@ -293,7 +293,7 @@ moment.lang('en', { }); moment.lang('en', { - weekdays : function (momentToFormat, format) { + weekdays : function (momentToFormat: Moment) { return this.weekdays[momentToFormat.day()]; } }); @@ -303,7 +303,7 @@ moment.lang('en', { }); moment.lang('en', { - weekdaysShort : function (momentToFormat, format) { + weekdaysShort : function (momentToFormat: Moment) { return this.weekdaysShort[momentToFormat.day()]; } }); @@ -313,7 +313,7 @@ moment.lang('en', { }); moment.lang('en', { - weekdaysMin : function (momentToFormat, format) { + weekdaysMin : function (momentToFormat: Moment) { return this.weekdaysMin[momentToFormat.day()]; } }); diff --git a/node-ffi/node-ffi-tests.ts b/node-ffi/node-ffi-tests.ts index c646af703..407036d39 100644 --- a/node-ffi/node-ffi-tests.ts +++ b/node-ffi/node-ffi-tests.ts @@ -26,7 +26,7 @@ import TArray = require('ref-array'); { var func = ffi.ForeignFunction(new Buffer(10), 'int', [ 'int' ]); func(-5); - func.async(-5, function(err, res) {}); + func.async(-5, function(err: any, res: any) {}); } { var printfPointer = ffi.DynamicLibrary().get('printf'); diff --git a/node-git/node-git.d.ts b/node-git/node-git.d.ts index dadfc8ba8..f10d217cb 100644 --- a/node-git/node-git.d.ts +++ b/node-git/node-git.d.ts @@ -17,7 +17,7 @@ declare module "git" { git(functionName:any, options:any, ...args:any[]):void; // last element is callback - call_git(prefix:string, command:any, postfix:string, options:any, args:any, callback:Function):void; + call_git(prefix:string, command:any, postfix:string, options:any, args:any, callback: (error: any, result: string) => void):void; rev_list(callback:Function):void; @@ -46,9 +46,9 @@ declare module "git" { // not implemented! clone(options:any, originalPath:any, targetPath:any, callback:Function):void; - diff(commit1:any, commit2:any, callback:Function):void; + diff(commit1:any, commit2:any, callback: (error: any, patch: string) => void):void; - diff(commit1:any, commit2:any, options:any, callback:Function):void; + diff(commit1: any, commit2: any, options: any, callback: (error: any, patch: string) => void):void; fs_exist(path:any, callback:Function):void; @@ -488,11 +488,11 @@ declare module "git" { fork_bare(path:any, options:any, callback:Function):void; // buggy? - diff(a:string, callback:Function):void; + diff(a: string, callback: (error: any, patch: string) => void):void; - diff(a:string, b:string, callback:Function):void; + diff(a: string, b: string, callback: (error: any, patch: string) => void):void; - diff(a:string, b:string, paths:any, callback:Function):void; + diff(a: string, b: string, paths: any, callback: (error: any, patch: string) => void):void; commit_diff(commit:string, callback:Function):void; diff --git a/pdf/pdf-tests.ts b/pdf/pdf-tests.ts index d40ffd578..90542b503 100644 --- a/pdf/pdf-tests.ts +++ b/pdf/pdf-tests.ts @@ -1,7 +1,5 @@ /// -var pdf: PDFPageProxy; - // // Fetch the PDF document from the URL using promises // diff --git a/pdf/pdf.d.ts b/pdf/pdf.d.ts index bddfca74f..6641000bc 100644 --- a/pdf/pdf.d.ts +++ b/pdf/pdf.d.ts @@ -27,7 +27,7 @@ interface PDFPromise { isRejected(): boolean; resolve(value: T): void; reject(reason: string): void; - then(onResolve: (promise: T) => void, onReject?: (reason: string) => void): PDFPromise; + then(onResolve: (promise: T) => void, onReject?: (reason: string) => void): PDFPromise; } interface PDFTreeNode { diff --git a/phonegap/phonegap-tests.ts b/phonegap/phonegap-tests.ts index 78b45609b..1eaff6040 100644 --- a/phonegap/phonegap-tests.ts +++ b/phonegap/phonegap-tests.ts @@ -318,7 +318,7 @@ function test_file() { var reader = new FileReader(); reader.onloadend = function (evt) { console.log("Read as data URL"); - console.log(evt.target.result); + console.log((evt.target).result); }; reader.readAsDataURL(file); } @@ -326,7 +326,7 @@ function test_file() { var reader = new FileReader(); reader.onloadend = function (evt) { console.log("Read as text"); - console.log(evt.target.result); + console.log((evt.target).result); }; reader.readAsText(file); } diff --git a/phonegap/phonegap.d.ts b/phonegap/phonegap.d.ts index 6e873163b..f23b473a9 100644 --- a/phonegap/phonegap.d.ts +++ b/phonegap/phonegap.d.ts @@ -3,10 +3,6 @@ // Definitions by: Boris Yankov // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface EventTarget { - result: any; -} - interface GeolocationError { code: number; message: string; @@ -54,7 +50,7 @@ interface CameraOptions { mediaType?: number; correctOrientation?: boolean; saveToPhotoAlbum?: boolean; - popoverOptions?: number; + popoverOptions?: CameraPopoverOptions; } interface CameraPictureSourceTypeObject { diff --git a/phonejs/dx.phonejs-tests.ts.tscparams b/phonejs/dx.phonejs-tests.ts.tscparams new file mode 100644 index 000000000..3cc762b55 --- /dev/null +++ b/phonejs/dx.phonejs-tests.ts.tscparams @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/pixi/pixi-tests.ts b/pixi/pixi-tests.ts index 93ff79593..de452f72e 100644 --- a/pixi/pixi-tests.ts +++ b/pixi/pixi-tests.ts @@ -1,6 +1,8 @@ /// /// +function PixiTests() +{ var stage = new PIXI.Stage(0xFFFFFF, true); @@ -1188,3 +1190,5 @@ function update22() requestAnimFrame(update); } + +} \ No newline at end of file diff --git a/requirejs/require-tests.ts b/requirejs/require-tests.ts index c66567e7b..a8cfdc87e 100644 --- a/requirejs/require-tests.ts +++ b/requirejs/require-tests.ts @@ -31,7 +31,7 @@ require.config({ // load AMD module main.ts (compiled to main.js) // and include shims $, _, Backbone -require(['main'], (main, $, _, Backbone) => { +require(['main'], (main: any, $: any, _: any, Backbone: any) => { var app = main.AppMain(); app.run(); @@ -39,5 +39,5 @@ require(['main'], (main, $, _, Backbone) => { }); var recOne = require.config({ baseUrl: 'js' }); -recOne(['core'], function (core) {/*some code*/}); +recOne(['core'], function (core: any) {/*some code*/}); diff --git a/rethinkdb/rethinkdb-tests.ts b/rethinkdb/rethinkdb-tests.ts index 4e6d78449..e94e5271c 100644 --- a/rethinkdb/rethinkdb-tests.ts +++ b/rethinkdb/rethinkdb-tests.ts @@ -10,7 +10,7 @@ r.connect({host:"localhost", port: 28015}, function(err, conn) { users.insert({name: "bob"}).run(conn, function() {}) - users.filter(function(doc) { + users.filter(function(doc?) { return doc("henry").eq("bob") }) .between("james", "beth") diff --git a/routie/routie-tests.ts b/routie/routie-tests.ts index aaf075675..323142c7e 100644 --- a/routie/routie-tests.ts +++ b/routie/routie-tests.ts @@ -25,7 +25,7 @@ routie("users/bob"); // window.location.hash will be #users/bob // Routie also supports regex style routes, so you can do advanced routing like this: -routie("users/:name", function (name) { +routie("users/:name", function (name: string) { // name == "bob"; }); @@ -33,7 +33,7 @@ routie("users/bob"); // Optional params: -routie("users/?:name", function (name) { +routie("users/?:name", function (name: string) { //name == undefined //then //name == bob diff --git a/royalslider/royalslider-tests.ts b/royalslider/royalslider-tests.ts index 03294c464..8ec25e91a 100644 --- a/royalslider/royalslider-tests.ts +++ b/royalslider/royalslider-tests.ts @@ -8,7 +8,7 @@ $(".royalSlider").royalSlider({ keyboardNavEnabled: true }); -jQuery(document).ready(function ($) { +jQuery(document).ready(function () { $(".royalSlider").royalSlider({ // general options go gere autoScaleSlider: true, @@ -20,7 +20,7 @@ jQuery(document).ready(function ($) { }); }); -jQuery(document).ready(function ($) { +jQuery(document).ready(function () { $(".royalSlider").royalSlider({ // general options go gere autoScaleSlider: true, @@ -32,7 +32,7 @@ jQuery(document).ready(function ($) { }); }); -jQuery(document).ready(function ($) { +jQuery(document).ready(function () { $(".royalSlider").royalSlider({ // general options go gere autoScaleSlider: true, @@ -45,7 +45,7 @@ jQuery(document).ready(function ($) { }); -jQuery(document).ready(function ($) { +jQuery(document).ready(function () { $(".royalSlider").royalSlider({ // general options go gere autoScaleSlider: true, @@ -57,7 +57,7 @@ jQuery(document).ready(function ($) { }); }); -jQuery(document).ready(function ($) { +jQuery(document).ready(function () { $(".royalSlider").royalSlider({ // general options go gere autoScaleSlider: true, @@ -69,7 +69,7 @@ jQuery(document).ready(function ($) { }); }); -jQuery(document).ready(function ($) { +jQuery(document).ready(function () { $(".royalSlider").royalSlider({ // general options go gere autoScaleSlider: true, @@ -81,7 +81,7 @@ jQuery(document).ready(function ($) { }); }); -jQuery(document).ready(function ($) { +jQuery(document).ready(function () { $(".royalSlider").royalSlider({ // general options go gere keyboardNavEnabled: true, @@ -171,7 +171,7 @@ slider.ev.on('rsAfterSlideChange', function (event) { slider.ev.on('rsBeforeAnimStart', function (event) { // before animation between slides start }); -slider.ev.on('rsBeforeMove', function (event, type, userAction) { +slider.ev.on('rsBeforeMove', function (event: JQueryEventObject, type?: string, userAction?: boolean) { // before any transition start (including after drag release) // "type" - can be "next", "prev", or ID of slide to move // userAction (Boolean) - defines if action is triggered by user (e.g. will be false if movement is triggered by autoPlay) @@ -188,7 +188,7 @@ slider.ev.on('rsDragRelease', function () { slider.ev.on('rsBeforeDestroy', function () { // triggers before slider in destroyed }); -slider.ev.on('rsOnCreateVideoElement', function (e, url) { +slider.ev.on('rsOnCreateVideoElement', function (e: JQueryEventObject, url?: string) { // triggers before video element is created, after click on play button. // Read more in Tips&Tricks section }); @@ -214,7 +214,7 @@ slider.slides[2].holder.on('rsAfterContentSet', function () { // fires when third slide content is loaded and added to DOM }); // or globally -slider.ev.on('rsAfterContentSet', function (e, slideObject) { +slider.ev.on('rsAfterContentSet', function (e: JQueryEventObject, slideObject?: RoyalSlider.RoyalSlider) { // fires when every time when slide content is loaded and added to DOM }); @@ -224,7 +224,7 @@ slider.ev.on('rsAfterContentSet', function (e, slideObject) { slider.ev.on('rsAfterInit', function () { // after slider is initialized, }); -slider.ev.on('rsBeforeParseNode', function (e, content, obj) { +slider.ev.on('rsBeforeParseNode', function (e: JQueryEventObject, content?: any, obj?: any) { // before slide node is parsed // content - HTML object of slide that is parsed // obj - RoyalSlider data object (stores image URLs) diff --git a/rx.js/rx.async.d.ts b/rx.js/rx.async.d.ts index 5ee13b89a..2e511444a 100644 --- a/rx.js/rx.async.d.ts +++ b/rx.js/rx.async.d.ts @@ -84,7 +84,11 @@ declare module Rx { fromEvent(element: Node, eventName: string, selector?: (arguments: any[]) => T): Observable; fromEventPattern(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable; - fromPromise(promise: { then(onFulfill: (value: T) => any, onReject?: (reason: any) => any): any; }): Observable; + fromPromise(promise: Promise): Observable; fromPromise(promise: any): Observable; } + + interface Promise { + then(onFulfill: (value: T) => any, onReject?: (reason: any) => any): any; + } } diff --git a/sammyjs/sammyjs.d.ts b/sammyjs/sammyjs.d.ts index 1c9ca4877..b4fd40880 100644 --- a/sammyjs/sammyjs.d.ts +++ b/sammyjs/sammyjs.d.ts @@ -6,26 +6,20 @@ /// -interface SammyFunc { - (): Sammy.Application; - (selector: string): Sammy.Application; - (handler: Function): Sammy.Application; - (selector: string, handler: Function): Sammy.Application; -} - declare function Sammy(): Sammy.Application; declare function Sammy(selector: string): Sammy.Application; declare function Sammy(handler: Function): Sammy.Application; declare function Sammy(selector: string, handler: Function): Sammy.Application; -interface JQueryStatic { - sammy: SammyFunc; - log: Function; -} - declare module Sammy { + interface SammyFunc { + (): Sammy.Application; + (selector: string): Sammy.Application; + (handler: Function): Sammy.Application; + (selector: string, handler: Function): Sammy.Application; + } - export function Cache(app, options); + export function Cache(app, options); export function DataCacheProxy(initial, $element); export var DataLocationProxy:DataLocationProxy; export function DefaultLocationProxy(app, run_interval_every); @@ -279,5 +273,10 @@ declare module Sammy { SessionStorage(name, element); isAvailable(type); Template(app, method_alias); - } + } +} + +interface JQueryStatic { + sammy: Sammy.SammyFunc; + log: Function; } \ No newline at end of file diff --git a/select2/select2-tests.ts b/select2/select2-tests.ts index 665618daf..d3a21b188 100644 --- a/select2/select2-tests.ts +++ b/select2/select2-tests.ts @@ -144,15 +144,16 @@ $("#e11_2").select2({ data: [{ id: 0, text: 'story' }, { id: 1, text: 'bug' }, { id: 2, text: 'task' }] }); function log(e) { - var e = $("
  • " + e + "
  • "); - $("#events_11").append(e); - e.animate({ opacity: 1 }, 10000, 'linear', function () { e.animate({ opacity: 0 }, 2000, 'linear', function () { e.remove(); }); }); + var item = $("
  • " + e + "
  • "); + $("#events_11").append(item); + item.animate({ opacity: 1 }, 10000, 'linear', function () { item.animate({ opacity: 0 }, 2000, 'linear', function () { item.remove(); }); }); } $("#e11") - .on("change", function (e) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) + // TS 0.9.5: correct overload not resolved https://typescript.codeplex.com/discussions/472172 + .on("change", function (e: Select2JQueryEventObject) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) .on("open", function () { log("open"); }); $("#e11_2") - .on("change", function (e) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) + .on("change", function (e: Select2JQueryEventObject) { log(JSON.stringify({ val: e.val, added: e.added, removed: e.removed })); }) .on("open", function () { log("open"); }); $("#e12").select2({ tags: ["red", "green", "blue"] }); $("#e20").select2({ diff --git a/sencha_touch/SenchaTouch-Tests.ts.tscparams b/sencha_touch/SenchaTouch-Tests.ts.tscparams new file mode 100644 index 000000000..3cc762b55 --- /dev/null +++ b/sencha_touch/SenchaTouch-Tests.ts.tscparams @@ -0,0 +1 @@ +"" \ No newline at end of file diff --git a/siesta/siesta.d.ts b/siesta/siesta.d.ts index 449bf262c..aaf6692bf 100644 --- a/siesta/siesta.d.ts +++ b/siesta/siesta.d.ts @@ -770,7 +770,7 @@ declare module Siesta { elementFromPoint(x: number, y: number, shallow?: boolean): HTMLElement; - firesAtLeastNTimes(observable: any, event: string, n: number, desc: string); + firesAtLeastNTimes(observable: any, event: string, n: number, desc: string): void; firesOk(options: any): void; diff --git a/slickgrid/SlickGrid-tests.ts b/slickgrid/SlickGrid-tests.ts index a5fa63e03..1b41d1a0b 100644 --- a/slickgrid/SlickGrid-tests.ts +++ b/slickgrid/SlickGrid-tests.ts @@ -1,8 +1,6 @@ /// /// -declare var $: any; - interface MyData extends Slick.SlickData { title: string; duration: string; diff --git a/slickgrid/SlickGrid.d.ts b/slickgrid/SlickGrid.d.ts index becc6f617..9579997ad 100644 --- a/slickgrid/SlickGrid.d.ts +++ b/slickgrid/SlickGrid.d.ts @@ -1320,7 +1320,7 @@ declare module Slick { } // todo: merge with existing column definition - export interface Column { + export interface Column { sortCol?: string; sortAsc?: boolean; } diff --git a/swipeview/swipeview-tests.ts b/swipeview/swipeview-tests.ts index 52a5681ce..02564e11b 100644 --- a/swipeview/swipeview-tests.ts +++ b/swipeview/swipeview-tests.ts @@ -47,9 +47,9 @@ var i; for (i = 0; i < 3; i++) { - upcoming = gallery.masterPages[i].dataset.upcomingPageIndex; + upcoming = (gallery.masterPages[i].dataset).upcomingPageIndex; - if (upcoming != gallery.masterPages[i].dataset.pageIndex) { + if (upcoming != (gallery.masterPages[i].dataset).pageIndex) { el = gallery.masterPages[i].querySelector('img'); el.className = 'loading'; el.src = slides[upcoming].img; @@ -104,9 +104,9 @@ var carousel: SwipeView, i; for (i = 0; i < 3; i++) { - upcoming = carousel.masterPages[i].dataset.upcomingPageIndex; + upcoming = (carousel.masterPages[i].dataset).upcomingPageIndex; - if (upcoming != carousel.masterPages[i].dataset.pageIndex) { + if (upcoming != (carousel.masterPages[i].dataset).pageIndex) { el = carousel.masterPages[i].querySelector('span'); el.innerHTML = slides[upcoming]; } @@ -216,8 +216,8 @@ function demo3() { ereader.slider.removeChild(container); ereader.updatePageCount(pages.length); - ereader.masterPages[0].dataset.pageIndex = pages.length - 1; - ereader.masterPages[0].dataset.upcomingPageIndex = ereader.masterPages[0].dataset.pageIndex; + (ereader.masterPages[0].dataset).pageIndex = pages.length - 1; + (ereader.masterPages[0].dataset).upcomingPageIndex = (ereader.masterPages[0].dataset).pageIndex; // Load initial data for (i = 0; i < 3; i++) { @@ -240,9 +240,9 @@ function demo3() { i; for (i = 0; i < 3; i++) { - upcoming = ereader.masterPages[i].dataset.upcomingPageIndex; + upcoming = (ereader.masterPages[i].dataset).upcomingPageIndex; - if (upcoming != ereader.masterPages[i].dataset.pageIndex) { + if (upcoming != (ereader.masterPages[i].dataset).pageIndex) { el = ereader.masterPages[i].querySelector('div'); el.innerHTML = pages[upcoming]; } diff --git a/swipeview/swipeview.d.ts b/swipeview/swipeview.d.ts index 7ce476b83..8e079fa7d 100644 --- a/swipeview/swipeview.d.ts +++ b/swipeview/swipeview.d.ts @@ -16,13 +16,9 @@ interface SwipeViewOptions { loop?: boolean; } -interface PageHTMLElement extends HTMLElement { - dataset: any; -} - declare class SwipeView { - masterPages: PageHTMLElement[]; + masterPages: HTMLElement[]; currentMasterPage: number; wrapper: HTMLElement; slider: HTMLElement; diff --git a/titanium/titanium-tests.ts b/titanium/titanium-tests.ts index 3899824c7..a4057b80c 100644 --- a/titanium/titanium-tests.ts +++ b/titanium/titanium-tests.ts @@ -111,7 +111,7 @@ function test_map() { mapview.regionFit = true; mapview.userLocation = true; mapview.annotations = [mountainView]; - mapview.addEventListener('click', function(evt) { + mapview.addEventListener('click', function(evt?) { if (evt.clicksource === 'leftButton' || evt.clicksource === 'leftPane') { alert(evt.title + ' left button clicked'); } diff --git a/viewporter/viewporter-tests.ts b/viewporter/viewporter-tests.ts index 35c8c2ae4..9ce0be298 100644 --- a/viewporter/viewporter-tests.ts +++ b/viewporter/viewporter-tests.ts @@ -119,7 +119,7 @@ function test_swipey() { }).trigger(viewporter.ACTIVE ? 'viewportchange' : 'resize'); $('canvas').bind(iOS ? 'touchstart' : 'mousedown', function (e) { e.preventDefault(); - var touches = iOS ? e.originalEvent.changedTouches : [e.originalEvent]; + var touches = iOS ? (e.originalEvent).changedTouches : [e.originalEvent]; var identifier; for (var i = 0; i < touches.length; i++) { identifier = touches[i].identifier || 'mouse'; @@ -133,7 +133,7 @@ function test_swipey() { }); $('canvas').bind(iOS ? 'touchmove' : 'mousemove', function (e) { - var touches = iOS ? e.originalEvent.changedTouches : [e.originalEvent]; + var touches = iOS ? (e.originalEvent).changedTouches : [e.originalEvent]; var identifier; for (var i = 0; i < touches.length; i++) { identifier = touches[i].identifier || 'mouse'; @@ -144,7 +144,7 @@ function test_swipey() { }); $('canvas').bind(iOS ? 'touchend' : 'mouseup', function (e) { - var touches = iOS ? e.originalEvent.changedTouches : [e.originalEvent]; + var touches = iOS ? (e.originalEvent).changedTouches : [e.originalEvent]; var identifier; for (var i = 0; i < touches.length; i++) { identifier = touches[i].identifier || 'mouse';