+// Definitions: https://github.com/borisyankov/DefinitelyTyped
+
+///
+
+declare class __ReactDom {
+ public render(
+ element: __React.DOMElement
,
+ container: Element,
+ callback?: () => any): __React.DOMComponent
;
+ public render
(
+ element: __React.ClassicElement
,
+ container: Element,
+ callback?: () => any): __React.ClassicComponent
;
+ public render
(
+ element: __React.ReactElement
,
+ container: Element,
+ callback?: () => any): __React.Component
;
+
+ public findDOMNode(
+ componentOrElement: __React.Component | Element): TElement;
+ public findDOMNode(
+ componentOrElement: __React.Component | Element): Element;
+
+ public unmountComponentAtNode(container: Element): boolean;
+}
+
+declare class __ReactDomServer {
+ public renderToString(element: __React.ReactElement): string;
+ public renderToStaticMarkup(element: __React.ReactElement): string;
+}
+declare module "react-dom" {
+ export = __ReactDom
+}
+
+declare module "react-dom/server" {
+ export = __ReactDomServer
+}
\ No newline at end of file
diff --git a/switchery/switchery-tests.ts b/switchery/switchery-tests.ts
index 2a06795027..35bd77920f 100644
--- a/switchery/switchery-tests.ts
+++ b/switchery/switchery-tests.ts
@@ -3,69 +3,86 @@
//
// Examples from https://github.com/abpetkov/switchery
//
+import {default as Switchery} from "switchery";
function multipleSwitches() {
- var elems = Array.prototype.slice.call( document.querySelectorAll( '.js-switch' ) );
+ var elems = Array.prototype.slice.call(document.querySelectorAll('.js-switch'));
- elems.forEach( (html: Element) => {
- var switchery = new Switchery( html );
- } );
+ elems.forEach((html: Element) => {
+ var switchery = new Switchery(html);
+ });
}
function disabledSwitch() {
- var elem = document.querySelector( '.js-switch' )
+ var elem = document.querySelector('.js-switch')
//inactive switch
- var switchery = new Switchery( elem, {disabled: true} );
+ var switchery = new Switchery(elem, { disabled: true });
//Customize the default opacity of the disabled switch, using the disabledOpacity option.
- switchery = new Switchery( elem, {disabled: true, disabledOpacity: 0.75} );
+ switchery = new Switchery(elem, { disabled: true, disabledOpacity: 0.75 });
}
function coloredSwitch() {
- var elem = document.querySelector( '.js-switch' )
+ var elem = document.querySelector('.js-switch')
//You can change the primary color of the switch to fit your design perfectly:
- var switchery = new Switchery( elem, {color: '#41b7f1'} );
+ var switchery = new Switchery(elem, { color: '#41b7f1' });
//Or the secondary color, which will change the switch background color and border color:
- switchery = new Switchery( elem, {secondaryColor: '#bbf0f0'} );
+ switchery = new Switchery(elem, { secondaryColor: '#bbf0f0' });
//Since version 0.6.3, you're even allowed to change the jack color from JS, as follows:
- switchery = new Switchery( elem, {jackColor: '#fffc00'} );
+ switchery = new Switchery(elem, { jackColor: '#fffc00', jackSecondaryColor: '#41b7f1' });
}
function switchSizes() {
- var elem = document.querySelector( '.js-switch' )
+ var elem = document.querySelector('.js-switch')
- var switchery = new Switchery( elem, {size: 'small'} );
- switchery = new Switchery( elem, {size: 'large'} );
+ var switchery = new Switchery(elem, { size: 'small' });
+ switchery = new Switchery(elem, { size: 'large' });
}
function checkingState() {
- var elem = document.querySelector( '.js-switch' )
+ var elem = document.querySelector('.js-switch')
//On click:
- var clickCheckbox = document.querySelector( '.js-check-click' )
- var clickButton = document.querySelector( '.js-check-click-button' );
+ var clickCheckbox = document.querySelector('.js-check-click')
+ var clickButton = document.querySelector('.js-check-click-button');
- clickButton.addEventListener( 'click', () => {
- alert( clickCheckbox.checked );
- } );
+ clickButton.addEventListener('click', () => {
+ alert(clickCheckbox.checked);
+ });
//On change:
- var changeCheckbox = document.querySelector( '.js-check-change' );
+ var changeCheckbox = document.querySelector('.js-check-change');
- changeCheckbox.onchange = function () {
- alert( changeCheckbox.checked );
+ changeCheckbox.onchange = function() {
+ alert(changeCheckbox.checked);
};
+}
+
+function detached() {
+ var elem = document.querySelector('.js-switch')
+ var switchery = new Switchery(elem, { size: 'small' });
+
+ switchery.destroy();
+}
+
+function toggleState() {
+ var elem = document.querySelector('.js-switch')
+ var switchery = new Switchery(elem, { size: 'small' });
+ var isDisabled = switchery.isDisabled();
+
+ switchery.enable();
+ switchery.disable();
}
\ No newline at end of file
diff --git a/switchery/switchery.d.ts b/switchery/switchery.d.ts
index 4d953aff88..79934c776c 100644
--- a/switchery/switchery.d.ts
+++ b/switchery/switchery.d.ts
@@ -1,64 +1,93 @@
-// Type definitions for switchery 0.7.0
+// Type definitions for switchery 0.8.1
// Project: https://github.com/abpetkov/switchery
-// Definitions by: Bruno Grieder
+// Definitions by: Bruno Grieder , Clayton Lautier
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module Switchery {
- export interface Options {
+ interface SwitcheryStatic {
+ new (node: Node, options?: Options): Switchery;
+ }
+
+ interface Options {
/**
* color of the switch element (HEX or RGB value)
* @default '#64bd63'
*/
- color? : string;
+ color?: string;
/**
* secondary color for background color and border, when the switch is off
* @default '#dfdfdf'
*/
- secondaryColor? : string;
+ secondaryColor?: string;
/**
* color of the jack/handle element
* @default '#fff'
*/
- jackColor? : string;
+ jackColor?: string;
+ /**
+ * color of unchecked jack/handle element
+ * @default 'null'
+ */
+ jackSecondaryColor?: string;
/**
* class name for the switch element (by default styled in switchery.css)
* @default 'switchery'
*/
- className? : string;
+ className?: string;
/**
* enable or disable click events and changing the state of the switch (boolean value)
* @default false
*/
- disabled? : boolean;
+ disabled?: boolean;
/**
* opacity of the switch when it's disabled (0 to 1)
* @default 0.5
*/
- disabledOpacity? : number;
+ disabledOpacity?: number;
/**
* length of time that the transition will take, ex. '0.4s', '1s', '2.2s' (Note: transition speed of the handle is twice shorter)
- * @default '0.4s'
+ * @default '0.1s'
*/
- speed? : string;
+ speed?: string;
/**
* size of the switch element (small or large)
* @default 'default'
*/
- size? : string;
+ size?: string;
}
-
-
}
-declare class Switchery {
+interface Switchery {
- constructor(node: Node, options?: Switchery.Options);
+ /**
+ * Unbinding all event handlers attached to the switch element to prepare the object for garbage collection.
+ * @returns {void}
+ */
+ destroy(): void;
+ /**
+ * Enable disabled switch by re-adding event handlers and changing the opacity to 1.
+ * @returns {void}
+ */
+ enable(): void;
+
+ /**
+ * Disable switch by unbinding attached events and changing opacity to disabledOpacity value
+ * @returns {void}
+ */
+ disable(): void;
+
+ /**
+ * Check if switch is currently disabled by checking the readonly and disabled attributes on the checkbox and the disabled option set via JS.
+ * If any of those are present, the returned value is true.
+ * @returns {boolean} whether it's disabled or not.
+ */
+ isDisabled(): boolean;
}
declare module "switchery" {
-
- export = Switchery
+ var switchery: Switchery.SwitcheryStatic;
+ export default switchery;
}
\ No newline at end of file
diff --git a/urijs/URIjs-tests.ts b/urijs/URIjs-tests.ts
index 3501a6efc2..0f529fe4a0 100644
--- a/urijs/URIjs-tests.ts
+++ b/urijs/URIjs-tests.ts
@@ -37,4 +37,9 @@ var uri: uri.URI = $('a').uri();
URI('http://example.org/foo/hello.html').segment('bar');
URI('http://example.org/foo/hello.html').segment(0, 'bar');
-URI('http://example.org/foo/hello.html').segment(['foo', 'bar', 'foobar.html']);
\ No newline at end of file
+URI('http://example.org/foo/hello.html').segment(['foo', 'bar', 'foobar.html']);
+
+var withDuplicates = URI("?bar=1&bar=1")
+ .duplicateQueryParameters(true)
+ .normalizeQuery()
+ .toString();
\ No newline at end of file
diff --git a/urijs/URIjs.d.ts b/urijs/URIjs.d.ts
index a41e06cbfa..3bd4ba366f 100644
--- a/urijs/URIjs.d.ts
+++ b/urijs/URIjs.d.ts
@@ -27,6 +27,8 @@ declare module uri {
domain(): string;
domain(domain: boolean): string;
domain(domain: string): URI;
+
+ duplicateQueryParameters(val: boolean): URI;
equals(): boolean;
equals(url: string): boolean;
diff --git a/yargs/yargs-tests.ts b/yargs/yargs-tests.ts
index 10b75382b5..f20254990a 100644
--- a/yargs/yargs-tests.ts
+++ b/yargs/yargs-tests.ts
@@ -134,6 +134,49 @@ function Argv$options() {
;
}
+function command() {
+ var argv = yargs
+ .usage('npm ')
+ .command('install', 'tis a mighty fine package to install')
+ .command('publish', 'shiver me timbers, should you be sharing all that', yargs => {
+ argv = yargs.option('f', {
+ alias: 'force',
+ description: 'yar, it usually be a bad idea'
+ })
+ .help('help')
+ .argv;
+ })
+ .help('help')
+ .argv;
+}
+
+function completion_sync() {
+ var argv = yargs
+ .completion('completion', (current, argv) => {
+ // 'current' is the current command being completed.
+ // 'argv' is the parsed arguments so far.
+ // simply return an array of completions.
+ return [
+ 'foo',
+ 'bar'
+ ];
+ })
+ .argv;
+}
+
+function completion_async() {
+ var argv = yargs
+ .completion('completion', (current, argv, done) => {
+ setTimeout(function() {
+ done([
+ 'apple',
+ 'banana'
+ ]);
+ }, 500);
+ })
+ .argv;
+}
+
function Argv$help() {
var yargs1 = yargs
.usage("$0 -operand1 number -operand2 number -operation [add|subtract]");
diff --git a/yargs/yargs.d.ts b/yargs/yargs.d.ts
index 0e42090fcd..03b7c05dcd 100644
--- a/yargs/yargs.d.ts
+++ b/yargs/yargs.d.ts
@@ -54,6 +54,12 @@ declare module "yargs" {
usage(options?: { [key: string]: Options }): Argv;
command(command: string, description: string): Argv;
+ command(command: string, description: string, fn: (args: Argv) => void): Argv;
+
+ completion(cmd: string, fn?: SyncCompletionFunction): Argv;
+ completion(cmd: string, description?: string, fn?: SyncCompletionFunction): Argv;
+ completion(cmd: string, fn?: AsyncCompletionFunction): Argv;
+ completion(cmd: string, description?: string, fn?: AsyncCompletionFunction): Argv;
example(command: string, description: string): Argv;
@@ -110,6 +116,9 @@ declare module "yargs" {
desc?: any;
requiresArg?: any;
}
+
+ type SyncCompletionFunction = (current: string, argv: any) => string[];
+ type AsyncCompletionFunction = (current: string, argv: any, done: (completion: string[]) => void) => void;
}
var yargs: yargs.Argv;