Merge pull request #1462 from Igorbek/switch-0.9.5

Fixed some definitions/tests for switch to 0.9.5
This commit is contained in:
Basarat Ali Syed
2013-12-23 13:58:36 -08:00
55 changed files with 153 additions and 143 deletions
+6 -2
View File
@@ -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', {
+1 -1
View File
@@ -83,5 +83,5 @@ var resourceService: ng.resource.IResourceService;
resourceClass = resourceServiceFactoryFunction<IMyResourceClass>(resourceService);
resourceServiceFactoryFunction = function (resourceService) { return resourceClass };
resourceServiceFactoryFunction = function (resourceService: ng.resource.IResourceService) { return <any>resourceClass; };
mod = mod.factory('factory name', resourceServiceFactoryFunction);
@@ -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'}
+2 -2
View File
@@ -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);
});
+7 -3
View File
@@ -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
(<couchbase.Connection>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
(<couchbase.Connection>db).get('testdoc', function (err, result) {
if (err) throw err;
console.log(result.value);
+8 -6
View File
@@ -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<number>((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)
+2 -2
View File
@@ -102,8 +102,8 @@ declare module CrossFilter {
top(k: number): T[];
bottom(k: number): T[];
dispose(): void;
group(): Group<T, TDimension, number>;
group<TGroup>(groupValue: (data: T) => TGroup): Group<T, TDimension, TGroup>;
group(): Group<T, TDimension, TDimension>;
group<TGroup>(groupValue: (data: TDimension) => TGroup): Group<T, TDimension, TGroup>;
groupAll(): GroupAll<T>;
}
}
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);
+2 -2
View File
@@ -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);
+1 -1
View File
@@ -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);
});
+1 -1
View File
@@ -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;
});
+2 -2
View File
@@ -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.
+2 -2
View File
@@ -8,10 +8,10 @@ function sample1() {
canvas.on({
'object:moving': function (e) {
e.target.opacity = 0.5;
(<any>e.target).opacity = 0.5;
},
'object:modified': function (e) {
e.target.opacity = 1;
(<any>e.target).opacity = 1;
}
});
+2 -2
View File
@@ -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();
}
}();
})();
+2 -2
View File
@@ -64,6 +64,6 @@ interface GlDatePicker {
}
interface JQuery {
glDatePicker(options?: GlDatePickerOptions): JQuery;
glDatePicker(ret: boolean): GlDatePicker;
glDatePicker(ret: boolean): GlDatePicker;
glDatePicker(options?: GlDatePickerOptions): JQuery;
}
+3 -3
View File
@@ -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 = (<any>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
+8 -7
View File
@@ -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 '<a href="' + context.url + '">' + context.body + '</a>';
});
var context2 = { posts: [{url: '/hello-world', body: 'Hello World!'}] };
var post = { url: '/hello-world', body: 'Hello World!' };
var context2 = { posts: [post] };
var source2 = '<ul>{{#posts}}<li>{{{link_to this}}}</li>{{/posts}}</ul>';
var template2 = Handlebars.compile(source2);
template2(context2);
Handlebars.registerHelper('link_to', (title, context) => {
Handlebars.registerHelper('link_to', (title: string, context: typeof post) => {
return '<a href="/posts' + context.url + '">' + title + '!</a>';
});
@@ -48,7 +49,7 @@ var template3 = Handlebars.compile(source3);
template3(context3);
var source4 = '<ul>{{#people}}<li>{{#link}}{{name}}{{/link}}</li>{{/people}}</ul>';
Handlebars.registerHelper('link', function(context) {
Handlebars.registerHelper('link', function(context: any) {
return '<a href="/people/' + this.id + '">' + context.fn(this) + '</a>';
});
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 = '<ul>';
for(var i=0, l=items.length; i<l; i++) {
out = out + '<li>' + fn(items[i]) + '</li>';
}
return out + '</ul>';
});
Handlebars.registerHelper('fullName', (person) => {
Handlebars.registerHelper('fullName', (person: typeof context.author) => {
return person.firstName + ' ' + person.lastName;
});
-1
View File
@@ -24,7 +24,6 @@ describe('i18next', function () {
dynamicLoad: false,
useLocalStorage: false,
sendMissing: false,
resStore: false,
getAsync: true,
returnObjectTrees: false,
debug: true,
+1 -1
View File
@@ -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.');
});
+5 -5
View File
@@ -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;
}
+1 -1
View File
@@ -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 = $('<div/>').hide().appendTo('body');
$.each( test_elems, function(i,v){
$('<' + v + '/>')
+1 -1
View File
@@ -138,7 +138,7 @@ interface GridsterOptions {
/**
* Return the data you want for each widget in the serialization.
**/
serialize_params?: <T>($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.
+1 -1
View File
@@ -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 {
+2 -2
View File
@@ -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 + "]")
$((<HTMLInputElement>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 + "]")
$((<HTMLInputElement>element).form).find("label[for=" + element.id + "]")
.removeClass(errorClass);
}
});
+1
View File
@@ -2372,6 +2372,7 @@ function test_EventIsCallable() {
var ev = jQuery.Event('click');
}
$.when<any>($.ajax("/my/page.json")).then(a => a.asdf); // is type JQueryPromise<any>
$.when($.ajax("/my/page.json")).then((a?,b?,c?) => a.asdf); // is type JQueryPromise<any>
$.when("asdf", "jkl;").done((x,y) => x.length + y.length, (x,y) => x.length + y.length);
+2 -1
View File
@@ -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;
+5 -5
View File
@@ -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()];
}
});
+1 -1
View File
@@ -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');
+6 -6
View File
@@ -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;
-2
View File
@@ -1,7 +1,5 @@
/// <reference path="pdf.d.ts" />
var pdf: PDFPageProxy;
//
// Fetch the PDF document from the URL using promises
//
+1 -1
View File
@@ -27,7 +27,7 @@ interface PDFPromise<T> {
isRejected(): boolean;
resolve(value: T): void;
reject(reason: string): void;
then<T>(onResolve: (promise: T) => void, onReject?: (reason: string) => void): PDFPromise<T>;
then(onResolve: (promise: T) => void, onReject?: (reason: string) => void): PDFPromise<T>;
}
interface PDFTreeNode {
+2 -2
View File
@@ -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((<any>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((<any>evt.target).result);
};
reader.readAsText(file);
}
+1 -5
View File
@@ -3,10 +3,6 @@
// Definitions by: Boris Yankov <https://github.com/borisyankov/>
// 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 {
+1
View File
@@ -0,0 +1 @@
""
+4
View File
@@ -1,6 +1,8 @@
///<reference path="pixi.d.ts"/>
///<reference path="webgl.d.ts"/>
function PixiTests()
{
var stage = new PIXI.Stage(0xFFFFFF, true);
@@ -1188,3 +1190,5 @@ function update22()
requestAnimFrame(update);
}
}
+2 -2
View File
@@ -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*/});
+1 -1
View File
@@ -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")
+2 -2
View File
@@ -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
+11 -11
View File
@@ -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)
+5 -1
View File
@@ -84,7 +84,11 @@ declare module Rx {
fromEvent<T>(element: Node, eventName: string, selector?: (arguments: any[]) => T): Observable<T>;
fromEventPattern<T>(addHandler: (handler: Function) => void, removeHandler: (handler: Function) => void, selector?: (arguments: any[])=>T): Observable<T>;
fromPromise<T>(promise: { then(onFulfill: (value: T) => any, onReject?: (reason: any) => any): any; }): Observable<T>;
fromPromise<T>(promise: Promise<T>): Observable<T>;
fromPromise<T>(promise: any): Observable<T>;
}
interface Promise<T> {
then(onFulfill: (value: T) => any, onReject?: (reason: any) => any): any;
}
}
+13 -14
View File
@@ -6,26 +6,20 @@
/// <reference path="../jquery/jquery.d.ts"/>
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;
}
+6 -5
View File
@@ -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 = $("<li>" + e + "</li>");
$("#events_11").append(e);
e.animate({ opacity: 1 }, 10000, 'linear', function () { e.animate({ opacity: 0 }, 2000, 'linear', function () { e.remove(); }); });
var item = $("<li>" + e + "</li>");
$("#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({
@@ -0,0 +1 @@
""
+1 -1
View File
@@ -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;
-2
View File
@@ -1,8 +1,6 @@
/// <reference path="../jquery/jquery.d.ts" />
/// <reference path="SlickGrid.d.ts" />
declare var $: any;
interface MyData extends Slick.SlickData {
title: string;
duration: string;
+1 -1
View File
@@ -1320,7 +1320,7 @@ declare module Slick {
}
// todo: merge with existing column definition
export interface Column {
export interface Column<T extends SlickData> {
sortCol?: string;
sortAsc?: boolean;
}
+8 -8
View File
@@ -47,9 +47,9 @@ var
i;
for (i = 0; i < 3; i++) {
upcoming = gallery.masterPages[i].dataset.upcomingPageIndex;
upcoming = (<any>gallery.masterPages[i].dataset).upcomingPageIndex;
if (upcoming != gallery.masterPages[i].dataset.pageIndex) {
if (upcoming != (<any>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 = (<any>carousel.masterPages[i].dataset).upcomingPageIndex;
if (upcoming != carousel.masterPages[i].dataset.pageIndex) {
if (upcoming != (<any>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;
(<any>ereader.masterPages[0].dataset).pageIndex = pages.length - 1;
(<any>ereader.masterPages[0].dataset).upcomingPageIndex = (<any>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 = (<any>ereader.masterPages[i].dataset).upcomingPageIndex;
if (upcoming != ereader.masterPages[i].dataset.pageIndex) {
if (upcoming != (<any>ereader.masterPages[i].dataset).pageIndex) {
el = ereader.masterPages[i].querySelector('div');
el.innerHTML = pages[upcoming];
}
+1 -5
View File
@@ -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;
+1 -1
View File
@@ -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');
}
+3 -3
View File
@@ -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 ? (<any>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 ? (<any>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 ? (<any>e.originalEvent).changedTouches : [e.originalEvent];
var identifier;
for (var i = 0; i < touches.length; i++) {
identifier = touches[i].identifier || 'mouse';