diff --git a/angular-material/angular-material.d.ts b/angular-material/angular-material.d.ts index 4ce3fe103..25ac6b830 100644 --- a/angular-material/angular-material.d.ts +++ b/angular-material/angular-material.d.ts @@ -63,7 +63,10 @@ declare module angular.material { interface IDialogOptions { templateUrl?: string; template?: string; + autoWrap?: boolean; // default: true targetEvent?: MouseEvent; + openFrom?: any; + closeTo?: any; scope?: angular.IScope; // default: new child scope preserveScope?: boolean; // default: false disableParentScroll?: boolean; // default: true @@ -77,8 +80,10 @@ declare module angular.material { resolve?: {[index: string]: angular.IPromise} controllerAs?: string; parent?: string|Element|JQuery; // default: root node - fullscreen?: boolean; + onShowing?: Function; onComplete?: Function; + onRemoving?: Function; + fullscreen?: boolean; } interface IDialogService { @@ -224,7 +229,7 @@ declare module angular.material { setDefaultTheme(theme: string): void; alwaysWatchTheme(alwaysWatch: boolean): void; } - + interface IDateLocaleProvider { months: string[]; shortMonths: string[]; @@ -239,4 +244,8 @@ declare module angular.material { msgCalendar: string; msgOpenCalendar: string; } + + interface IMenuService { + hide(response?: any, options?: any): angular.IPromise; + } } diff --git a/auth0-angular/auth0-angular-tests.ts b/auth0-angular/auth0-angular-tests.ts new file mode 100644 index 000000000..1abd9fdc3 --- /dev/null +++ b/auth0-angular/auth0-angular-tests.ts @@ -0,0 +1,24 @@ +/// + +var authProvider: auth0.angular.IAuth0ServiceProvider; + +// Initialize Auth0 +authProvider.init({ + clientID: 'myClientID', + domain: 'mydomain.auth0.com' +}); + +// Listen for authenticated event +authProvider.on('authenticated', ($location: any) => { +}); + + +var authService: auth0.angular.IAuth0Service; + +// Sign in to Auth0 +authService.signin({}, (profile: string, idToken: string, acccessToken: string, state: string, refreshToken: string) => { +}, (err) => { +}); + +// Sign out of Auth0 +authService.signout(); \ No newline at end of file diff --git a/auth0-angular/auth0-angular.d.ts b/auth0-angular/auth0-angular.d.ts new file mode 100644 index 000000000..5228d706b --- /dev/null +++ b/auth0-angular/auth0-angular.d.ts @@ -0,0 +1,167 @@ +// Type definitions for auth0-angular +// Project: https://github.com/auth0/auth0-angular +// Definitions by: Matt Emory +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module auth0.angular { + + interface IAuth0ClientOptions { + /** + * Login url if you're using ngRoute + */ + loginUrl?: string; + + /** + * Login state if you're using ui-router + */ + loginState?: string; + + /** + * Client identifier of your Auth0 application + */ + clientID: string; + + /** + * Domain of your Auth0 account + */ + domain: string; + + /** + * Use single signon + */ + sso?: boolean; + } + + interface ITokenOptions { + + targetClientId?: string; + api?: string; + } + + interface IAuth0Options { + /** + * Connection name + */ + connection?: string; + + /** + * Username + */ + username?: string; + + /** + * Email address + */ + email?: string; + } + + interface ISuccessCallback { + (profile?: string, idToken?: string, accessToken?: string, state?: string, refreshToken?: string): void; + } + + interface IErrorCallback { + (error: any): void; + } + + interface IAuth0Service { + /** + * Hooks to internal Angular events so that a user will be redirected to the login page if trying to visit a restricted resource + */ + hookEvents(): void; + + /** + * Performs a token delegation request exchanging th ecurrent token for another one. + * @param options Token options + */ + getToken(options?: ITokenOptions): ng.IPromise; + + /** + * Refreshes the Id token + * @param refreshToken Refresh token to use when renewing + */ + refreshIdToken(refreshToken: string): ng.IPromise; + + /** + * Renews the Id Token with the same scopes as the original token + * @param id_token Id Token + */ + renewIdToken(id_token: string): ng.IPromise; + + /** + * Logs in a user, returning tokens and profile information + * @param options Options to bypass displaying the Lock UI + * @param successCallback Callback on successful login + * @param errorCallback Callback on failed login + */ + signin(options?: IAuth0Options, successCallback?: ISuccessCallback, errorCallback?: IErrorCallback): void; + + /** + * Displays Lock in signup mode, and logs the user in immediately after a successful signup. + * @param options Options to bypass displaying the Lock UI + * @param successCallback Callback on successful signup + * @param errorCallback Callback on failed signup + */ + signup(options?: IAuth0Options, successCallback?: ISuccessCallback, errorCallback?: IErrorCallback): void; + + /** + * Performs the "forgot your password" flow. + * @param options Options to bypass displaying the Lock UI + * @param successCallback Callback on successful reset + * @param errorCallback Callback on failed reset + */ + reset(options?: IAuth0Options, successCallback?: ISuccessCallback, errorCallback?: IErrorCallback): void; + + /** + * Validates the user + * @param options Options to bypass displaying the Lock UI + * @param successCallback Callback on successful validation + * @param errorCallback Callback on failed validation + */ + validateUser(options: IAuth0Options, successCallback?: ISuccessCallback, errorCallback?: IErrorCallback): void; + + /** + * Logs the user out locally by deleting their token from local storage. + */ + signout(): void; + + /** + * Reauthenticates the user by using a stored profile and token without going through the login flow. + * @param profile Profile of the user + * @param idToken Id token + * @param accessToken Access token + * @param state State + * @param refreshToken Flag to indicate refreshing the token + */ + authenticate(profile?: any, idToken?: string, accessToken?: string, state?: any, refreshToken?: boolean): ng.IPromise; + + /** + * Gets the user's profile + * @param idToken Id token + */ + getProfile(idToken?: string): ng.IPromise; + + // Properties + + accessToken: string; + idToken: string; + profile: any; + isAuthenticated: boolean; + config: any; + } + + interface IAuth0ServiceProvider { + /** + * Configures the auth service + * @param options Client options passed into Auth0 + */ + init(options: IAuth0ClientOptions): void; + + /** + * @param event Name of the event to handle. + * @param handler Event handler + */ + on(event: string, handler: (...args: any[]) => any): void; + } +} \ No newline at end of file diff --git a/browser-sync/browser-sync-tests.ts b/browser-sync/browser-sync-tests.ts index 210a8cf1b..822c941d9 100644 --- a/browser-sync/browser-sync-tests.ts +++ b/browser-sync/browser-sync-tests.ts @@ -78,6 +78,8 @@ evt.on("init", function () { browserSync(config); +var has = browserSync.has("My server"); + var bs = browserSync.create(); bs.init({ @@ -85,7 +87,7 @@ bs.init({ }); bs.reload(); - + function browserSyncInit(): browserSync.BrowserSyncInstance { var browser = browserSync.create(); browser.init(); @@ -95,3 +97,26 @@ function browserSyncInit(): browserSync.BrowserSyncInstance { } var browser = browserSyncInit(); browser.exit(); + +// Stream method. + +// -- No options. +browser.stream(); + +// -- "once" option. +browser.stream({once: true}); + +// -- "match" option (string). +browser.stream({match: "**/*.js"}); + +// -- "match" option (RegExp). +browser.stream({match: /\.js$/}); + +// -- "match" option (function). +browser.stream({match: (testString) => true}); + +// -- "match" option (array). +browser.stream({match: ["**/*.js", /\.js$/, (testString) => true]}); + +// -- Both options. +browser.stream({once: true, match: ["**/*.js", /\.js$/, (testString) => true]}); diff --git a/browser-sync/browser-sync.d.ts b/browser-sync/browser-sync.d.ts index 9d4cbcce3..6640090bc 100644 --- a/browser-sync/browser-sync.d.ts +++ b/browser-sync/browser-sync.d.ts @@ -5,25 +5,27 @@ /// /// +/// declare module "browser-sync" { import chokidar = require("chokidar"); import fs = require("fs"); import http = require("http"); + import mm = require("micromatch"); namespace browserSync { interface Options { /** - * Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls + * Browsersync includes a user-interface that is accessed via a separate port. The UI allows to controls * all devices, push sync updates and much more. - * + * * port - Default: 3001 * weinre.port - Default: 8080 * Note: requires at least version 2.0.0 */ ui?: UIOptions; /** - * Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS + * Browsersync can watch your files as you work. Changes you make will either be injected into the page (CSS * & images) or will cause all browsers to do a full-page refresh. See anymatch for more information on glob * patterns. * Default: false @@ -55,14 +57,14 @@ declare module "browser-sync" { */ port?: number; /** - * Add additional directories from which static files should be served. + * Add additional directories from which static files should be served. * Should only be used in proxy or snippet mode. * Default: [] * Note: requires at least version 2.8.0 */ serveStatic?: string[]; /** - * Enable https for localhost development. + * Enable https for localhost development. * Note - this is not needed for proxy option as it will be inferred from your target url. * Note: requires at least version 1.3.0 */ @@ -102,7 +104,7 @@ declare module "browser-sync" { */ logSnippet?: boolean; /** - * You can control how the snippet is injected onto each page via a custom regex + function. + * You can control how the snippet is injected onto each page via a custom regex + function. * You can also provide patterns for certain urls that should be ignored from the snippet injection. * Note: requires at least version 2.0.0 */ @@ -119,13 +121,13 @@ declare module "browser-sync" { */ tunnel?: string | boolean; /** - * Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're + * Some features of Browsersync (such as xip & tunnel) require an internet connection, but if you're * working offline, you can reduce start-up time by setting this option to false */ online?: boolean; /** * Default: true - * Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set. + * Decide which URL to open automatically when Browsersync starts. Defaults to "local" if none set. * Can be true, local, external, ui, ui-external, tunnel or false */ open?: string | boolean; @@ -135,7 +137,7 @@ declare module "browser-sync" { */ browser?: string | string[]; /** - * Requires an internet connection - useful for services such as Typekit as it allows you to configure + * Requires an internet connection - useful for services such as Typekit as it allows you to configure * domains such as *.xip.io in your kit settings * Default: false */ @@ -154,14 +156,14 @@ declare module "browser-sync" { * scrollProportionally: false // Sync viewports to TOP position * Default: true */ - scrollProportionally?: boolean + scrollProportionally?: boolean; /** * How often to send scroll events * Default: 0 */ scrollThrottle?: number; /** - * Decide which technique should be used to restore scroll position following a reload. + * Decide which technique should be used to restore scroll position following a reload. * Can be window.name or cookie * Default: 'window.name' */ @@ -175,13 +177,13 @@ declare module "browser-sync" { /** * Default: [] * Note: requires at least version 2.9.0 - * Sync the scroll position of any element on the page - where any scrolled element will cause - * all others to match scroll position. This is helpful when a breakpoint alters which element + * Sync the scroll position of any element on the page - where any scrolled element will cause + * all others to match scroll position. This is helpful when a breakpoint alters which element * is actually scrolling */ scrollElementMapping?: string[]; /** - * Time, in milliseconds, to wait before instructing the browser to reload/inject following a file + * Time, in milliseconds, to wait before instructing the browser to reload/inject following a file * change event * Default: 0 */ @@ -227,7 +229,7 @@ declare module "browser-sync" { */ timestamps?: boolean; /** - * Alter the script path for complete control over where the Browsersync Javascript is served + * Alter the script path for complete control over where the Browsersync Javascript is served * from. Whatever you return from this function will be used as the script path. * Note: requires at least version 1.5.0 */ @@ -250,7 +252,7 @@ declare module "browser-sync" { [path: string]: T; } - interface UIOptions { + interface UIOptions { /** set the default port */ port?: number; /** set the default weinre port */ @@ -266,9 +268,9 @@ declare module "browser-sync" { directory?: boolean; /** set index filename */ index?: string; - /** - * key-value object hash, where the key is the url to match, - * and the value is the folder to serve (relative to your working directory) + /** + * key-value object hash, where the key is the url to match, + * and the value is the folder to serve (relative to your working directory) */ routes?: Hash; /** configure custom middleware */ @@ -312,9 +314,14 @@ declare module "browser-sync" { fn: (match: string) => string; } + interface StreamOptions { + once?: boolean; + match?: mm.Pattern | mm.Pattern[]; + } + interface BrowserSyncStatic extends BrowserSyncInstance { /** - * Start the Browsersync service. This will launch a server, proxy or start the snippet mode + * Start the Browsersync service. This will launch a server, proxy or start the snippet mode * depending on your use-case. */ (config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance; @@ -328,36 +335,41 @@ declare module "browser-sync" { * @param name the identifier used for retrieval */ get(name: string): BrowserSyncInstance; + /** + * Check if an instance has been created. + * @param name the name of the instance + */ + has(name: string): boolean; } interface BrowserSyncInstance { /** the name of this instance of browser-sync */ name: string; /** - * Start the Browsersync service. This will launch a server, proxy or start the snippet mode + * Start the Browsersync service. This will launch a server, proxy or start the snippet mode * depending on your use-case. */ init(config?: Options, callback?: (err: Error, bs: Object) => any): BrowserSyncInstance; /** * Reload the browser - * The reload method will inform all browsers about changed files and will either cause the browser + * The reload method will inform all browsers about changed files and will either cause the browser * to refresh, or inject the files where possible. */ reload(): void; /** * Reload a single file - * The reload method will inform all browsers about changed files and will either cause the browser + * The reload method will inform all browsers about changed files and will either cause the browser * to refresh, or inject the files where possible. */ reload(file: string): void; /** * Reload multiple files - * The reload method will inform all browsers about changed files and will either cause the browser + * The reload method will inform all browsers about changed files and will either cause the browser * to refresh, or inject the files where possible. */ reload(files: string[]): void; /** - * The reload method will inform all browsers about changed files and will either cause the browser + * The reload method will inform all browsers about changed files and will either cause the browser * to refresh, or inject the files where possible. */ reload(options: { stream: boolean }): NodeJS.ReadWriteStream; @@ -365,7 +377,7 @@ declare module "browser-sync" { * The stream method returns a transform stream and can act once or on many files. * @param opts Configuration for the stream method */ - stream(opts?: { once: boolean }): NodeJS.ReadWriteStream; + stream(opts?: StreamOptions): NodeJS.ReadWriteStream; /** * Helper method for browser notifications * @param message Can be a simple message such as 'Connected' or HTML @@ -390,7 +402,7 @@ declare module "browser-sync" { */ resume(): void; /** - * The internal Event Emitter used by the running Browsersync instance (if there is one). You can use + * The internal Event Emitter used by the running Browsersync instance (if there is one). You can use * this to emit your own events, such as changed files, logging etc. */ emitter: NodeJS.EventEmitter; diff --git a/callsite/callsite-tests.ts b/callsite/callsite-tests.ts new file mode 100644 index 000000000..fcabcd8b5 --- /dev/null +++ b/callsite/callsite-tests.ts @@ -0,0 +1,21 @@ + +/// + +import callsite = require("callsite"); + +var stack = callsite(); +var p = stack[0]; + +console.log(p.getThis()); +console.log(p.getTypeName()); +console.log(p.getFunctionName()); +console.log(p.getMethodName()); +console.log(p.getFileName()); +console.log(p.getLineNumber()); +console.log(p.getColumnNumber()); +console.log(p.getFunction()); +console.log(p.getEvalOrigin()); +console.log(p.isNative()); +console.log(p.isToplevel()); +console.log(p.isEval()); +console.log(p.isConstructor()); diff --git a/callsite/callsite.d.ts b/callsite/callsite.d.ts new file mode 100644 index 000000000..be73af4de --- /dev/null +++ b/callsite/callsite.d.ts @@ -0,0 +1,30 @@ +// Type definitions for callsite 1.0.0 +// Project: https://github.com/tj/callsite +// Definitions by: newclear +// Definitions: https://github.com/newclear/DefinitelyTyped + +declare module "callsite" { + + module Callsite{ + + interface CallSite { + getThis(): any; + getTypeName(): string; + getFunctionName(): string; + getMethodName(): string; + getFileName(): string; + getLineNumber(): number; + getColumnNumber(): number; + getFunction(): Function; + getEvalOrigin(): string; + isNative(): boolean; + isToplevel(): boolean; + isEval(): boolean; + isConstructor(): boolean; + } + } + + function Callsite(): Callsite.CallSite[]; + + export = Callsite; +} diff --git a/datatables-buttons/datatables-buttons-tests.ts b/datatables-buttons/datatables-buttons-tests.ts new file mode 100644 index 000000000..dbe176eea --- /dev/null +++ b/datatables-buttons/datatables-buttons-tests.ts @@ -0,0 +1,33 @@ +/// +/// +/// + +$(document).ready(function () { + + var config: DataTables.Settings = + { + // Buttons extension options + buttons: [ + { + extend: 'excel', + text: 'Excel', + className: 'class', + exportOptions: { + columns: ':visible' + } + }, + { + action: function (e, dt, node, config) { }, + available: function (dt, config) { return true; }, + destroy: function (dt, node, config) { }, + enabled: true, + init: function (dt, node, config) { }, + key: 'a', + name: 'name', + namespace: 'namespace', + titleAttr: 'title', + } + ], + } + +}); \ No newline at end of file diff --git a/datatables-buttons/datatables-buttons.d.ts b/datatables-buttons/datatables-buttons.d.ts new file mode 100644 index 000000000..fd047f0a8 --- /dev/null +++ b/datatables-buttons/datatables-buttons.d.ts @@ -0,0 +1,113 @@ +// Type definitions for JQuery DataTables Buttons extension 1.1.0 +// Project: http://datatables.net/extensions/buttons/ +// Definitions by: Sam Germano +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module DataTables { + export interface Settings { + /** + * Buttons extension options + */ + buttons?: boolean | string[] | ButtonSettings[]; + } + + //#region "button-settings" + + /** + * Buttons extension options + */ + export interface ButtonSettings { + /** + * Action to take when the button is activated + */ + action?: FunctionButtonAction; + + /** + * Ensure that any requirements have been satisfied before initialising a button + */ + available?: FunctionButtonAvailable; + + /** + * Set the class name for the button + */ + className?: string; + + /** + * Function that is called when the button is destroyed + */ + destroy?: FunctionButtonInit; + + /** + * Set a button's initial enabled state + */ + enabled?: boolean; + + /** + * Define which button type the button should be based on + */ + extend?: string; + + /** + * Initialisation function that can be used to add events specific to this button + */ + init?: FunctionButtonInit; + + /** + * Define an activation key for a button + */ + key?: string | ButtonKey; + + /** + * Set a name for each selection + */ + name?: string; + + /** + * Unique namespace for every button + */ + namespace?: string; + + /** + * The text to show in the button + */ + text?: string | ButtonText; + + /** + * Button 'title' attribute text + */ + titleAttr?: string; + + exportOptions?: ButtonExportOptions; + autoPrint?: boolean; + } + + export interface FunctionButtonAvailable { + (dt: DataTables.DataTable, config: any): boolean + } + export interface ButtonExportOptions { + columns?: string; + } + + export interface ButtonKey { + key?: string; + shiftKey?: boolean; + altKey?: boolean; + ctrlKey?: boolean; + metaKey?: boolean; + } + + export interface ButtonText { + (dt: DataTables.DataTable, node: JQuery, config: any): string + } + export interface FunctionButtonInit { + (dt: DataTables.DataTable, node: JQuery, config: any): void + } + // api object? + export interface FunctionButtonAction { + (e: any, dt: DataTables.DataTable, node: JQuery, config: any): void + } + //#endregion "button-settings +} \ No newline at end of file diff --git a/github-electron/github-electron-main-tests.ts b/github-electron/github-electron-main-tests.ts index e88926d58..5d3060e4b 100644 --- a/github-electron/github-electron-main-tests.ts +++ b/github-electron/github-electron-main-tests.ts @@ -166,6 +166,10 @@ var dockMenu = Menu.buildFromTemplate([ }, ]); app.dock.setMenu(dockMenu); +app.dock.setBadge('foo'); +var id = app.dock.bounce('informational'); +app.dock.cancelBounce(id); +app.dock.setIcon('/path/to/icon.png'); app.setUserTasks([ { diff --git a/github-electron/github-electron.d.ts b/github-electron/github-electron.d.ts index 4351b5aa1..d5ca18690 100644 --- a/github-electron/github-electron.d.ts +++ b/github-electron/github-electron.d.ts @@ -1048,7 +1048,7 @@ declare module Electron { * Note: This API is only available on Windows. */ setUserTasks(tasks: Task[]): void; - dock: BrowserWindow; + dock: Dock; commandLine: CommandLine; /** * This method makes your application a Single Instance Application instead of allowing @@ -1075,6 +1075,64 @@ declare module Electron { appendArgument(value: any): void; } + interface Dock { + /** + * When critical is passed, the dock icon will bounce until either the + * application becomes active or the request is canceled. + * + * When informational is passed, the dock icon will bounce for one second. + * The request, though, remains active until either the application becomes + * active or the request is canceled. + * + * Note: This API is only available on Mac. + * @param type Can be critical or informational, the default is informational. + * @returns An ID representing the request + */ + bounce(type?: string): number; + /** + * Cancel the bounce of id. + * + * Note: This API is only available on Mac. + */ + cancelBounce(id: number): void; + /** + * Sets the string to be displayed in the dock’s badging area. + * + * Note: This API is only available on Mac. + */ + setBadge(text: string): void; + /** + * Returns the badge string of the dock. + * + * Note: This API is only available on Mac. + */ + getBadge(): string; + /** + * Hides the dock icon. + * + * Note: This API is only available on Mac. + */ + hide(): void; + /** + * Shows the dock icon. + * + * Note: This API is only available on Mac. + */ + show(): void; + /** + * Sets the application dock menu. + * + * Note: This API is only available on Mac. + */ + setMenu(menu: Menu): void; + /** + * Sets the image associated with this dock icon. + * + * Note: This API is only available on Mac. + */ + setIcon(icon: NativeImage | string): void; + } + interface Task { /** * Path of the program to execute, usually you should specify process.execPath @@ -1106,57 +1164,7 @@ declare module Electron { */ iconIndex?: number; commandLine?: CommandLine; - dock?: { - /** - * When critical is passed, the dock icon will bounce until either the - * application becomes active or the request is canceled. - * - * When informational is passed, the dock icon will bounce for one second. - * The request, though, remains active until either the application becomes - * active or the request is canceled. - * - * Note: This API is only available on Mac. - * @param type Can be critical or informational, the default is informational. - * @returns An ID representing the request - */ - bounce(type?: string): any; - /** - * Cancel the bounce of id. - * - * Note: This API is only available on Mac. - */ - cancelBounce(id: number): void; - /** - * Sets the string to be displayed in the dock’s badging area. - * - * Note: This API is only available on Mac. - */ - setBadge(text: string): void; - /** - * Returns the badge string of the dock. - * - * Note: This API is only available on Mac. - */ - getBadge(): string; - /** - * Hides the dock icon. - * - * Note: This API is only available on Mac. - */ - hide(): void; - /** - * Shows the dock icon. - * - * Note: This API is only available on Mac. - */ - show(): void; - /** - * Sets the application dock menu. - * - * Note: This API is only available on Mac. - */ - setMenu(menu: Menu): void; - }; + dock?: Dock; } class AutoUpdater implements NodeJS.EventEmitter { @@ -1225,7 +1233,7 @@ declare module Electron { filters?: { name: string; extensions: string[]; - }[] + }[]; } /** diff --git a/js-schema/js-schema-tests.ts b/js-schema/js-schema-tests.ts new file mode 100644 index 000000000..4a9a33e58 --- /dev/null +++ b/js-schema/js-schema-tests.ts @@ -0,0 +1,19 @@ +/// + +import {default as schema} from 'js-schema'; + +var Duck = schema({ // A duck + swim : Function, // - can swim + quack : Function, // - can quack + age : Number.min(0).max(5), // - is 0 to 5 years old + color : ['yellow', 'brown'] // - has either yellow or brown color +}); + +// Some animals +var myDuck = { swim : function() {}, quack : function() {}, age : 2, color : 'yellow' }, + myCat = { walk : function() {}, purr : function() {}, age : 3, color : 'black' }, + animals = [ myDuck, myCat, {}, /*...*/ ]; + +// Simple checks +console.log( Duck(myDuck) ); // true +console.log( Duck(myCat) ); // false diff --git a/js-schema/js-schema.d.ts b/js-schema/js-schema.d.ts new file mode 100644 index 000000000..10c1460f0 --- /dev/null +++ b/js-schema/js-schema.d.ts @@ -0,0 +1,50 @@ +// Type definitions for js-schema +// Project: https://github.com/molnarg/js-schema +// Definitions by: Marcin Porebski +// Definitions: https://github.com/borisyankov/DefinitelyTyped + + +declare module 'js-schema' +{ + export interface Schema + { + (obj: any): boolean; // test obj against the schema + } + + export default function schema(definition: any): Schema +} + +interface NumberConstructor +{ + min(n: number): NumberConstructor; + max(n: number): NumberConstructor; + below(n: number): NumberConstructor; + above(n: number): NumberConstructor; + step(n: number): NumberConstructor; +} + +interface StringConstructor +{ + of(charset: string): StringConstructor; + of(length: number, charset: string): StringConstructor; + of(minLength: number, maxLength: number, charset: string): StringConstructor; +} + +interface ArrayConstructor +{ + like(arr: Array): ArrayConstructor; + of(pattern: any): ArrayConstructor; + of(length: number, pattern: any): ArrayConstructor; + of(minLength: number, maxLength: number, pattern: any): ArrayConstructor; +} + +interface ObjectConstructor +{ + like(obj: any): ObjectConstructor; + reference(obj: any): ObjectConstructor; +} + +interface FunctionConstructor +{ + reference(func: Function): FunctionConstructor; +} diff --git a/js-yaml/js-yaml-tests.ts b/js-yaml/js-yaml-tests.ts index 91596b756..cd5f63c49 100644 --- a/js-yaml/js-yaml-tests.ts +++ b/js-yaml/js-yaml-tests.ts @@ -3,12 +3,31 @@ import yaml = require('js-yaml'); import LoadOptions = yaml.LoadOptions; import DumpOptions = yaml.DumpOptions; +import TypeConstructorOptions = yaml.TypeConstructorOptions; +import SchemaDefinition = yaml.SchemaDefinition; var bool: boolean; var num: number; var str: string; var obj: Object; var value: any; +var array: any[]; +var fn: Function; +var schemaDefinition: SchemaDefinition = { + implicit: array, + explicit: array, + include: array +}; +var typeConstructorOptions: TypeConstructorOptions = { + kind: str, + resolve: fn, + construct: fn, + instanceOf: obj, + predicate: str, + represent: fn, + defaultStyle: str, + styleAliases: obj +}; var loadOpts: LoadOptions; var dumpOpts: DumpOptions; @@ -20,6 +39,8 @@ yaml.JSON_SCHEMA; yaml.CORE_SCHEMA; yaml.DEFAULT_SAFE_SCHEMA; yaml.DEFAULT_FULL_SCHEMA; +yaml.MINIMAL_SCHEMA; +yaml.SAFE_SCHEMA; // -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- @@ -82,3 +103,7 @@ value = yaml.safeDump(str, dumpOpts); value = yaml.dump(str); value = yaml.dump(str, dumpOpts); + +value = new yaml.YAMLException(); +value = new yaml.Type(str, typeConstructorOptions); +value = yaml.Schema.create([schemaDefinition]); diff --git a/js-yaml/js-yaml.d.ts b/js-yaml/js-yaml.d.ts index 0de5a8f6b..85d9579cf 100644 --- a/js-yaml/js-yaml.d.ts +++ b/js-yaml/js-yaml.d.ts @@ -1,17 +1,26 @@ -// Type definitions for js-yaml 3.0.2 +// Type definitions for js-yaml 3.5.2 // Project: https://github.com/nodeca/js-yaml -// Definitions by: Bart van der Schoor -// Definitions: https://github.com/borisyankov/DefinitelyTyped +// Definitions by: Bart van der Schoor , Sebastian Clausen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module jsyaml { export function safeLoad(str: string, opts?: LoadOptions): any; export function load(str: string, opts?: LoadOptions): any; + export class Type implements TypeConstructorOptions { + constructor(tag: string, opts?: TypeConstructorOptions); + tag: string; + } + export class Schema { + constructor(definition: SchemaDefinition); + public static create(args: any[]): Schema; + } + export function safeLoadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): any; export function loadAll(str: string, iterator: (doc: any) => void, opts?: LoadOptions): any; export function safeDump(obj: any, opts?: DumpOptions): string; - export function dump(obj: any, opts?: DumpOptions): string + export function dump(obj: any, opts?: DumpOptions): string; export interface LoadOptions { // string to be used as a file path in error/warning messages. @@ -29,12 +38,29 @@ declare module jsyaml { skipInvalid?: boolean; // specifies level of nesting, when to switch from block to flow style for collections. -1 means block style everwhere flowLevel?: number; - // Each tag may have own set of styles. - "tag" => "style" map. + // Each tag may have own set of styles. - "tag" => "style" map. styles?: Object; // specifies a schema to use. schema?: any; } + export interface TypeConstructorOptions { + kind?: string; + resolve?: Function; + construct?: Function; + instanceOf?: Object; + predicate?: string; + represent?: Function; + defaultStyle?: string; + styleAliases?: Object; + } + + export interface SchemaDefinition { + implicit?: any[]; + explicit?: any[]; + include?: any[]; + } + // only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346 export var FAILSAFE_SCHEMA: any; // only strings, arrays and plain objects: http://www.yaml.org/spec/1.2/spec.html#id2802346 @@ -45,6 +71,13 @@ declare module jsyaml { export var DEFAULT_SAFE_SCHEMA: any; // all supported YAML types. export var DEFAULT_FULL_SCHEMA: any; + export var MINIMAL_SCHEMA: any; + export var SAFE_SCHEMA: any; + + export class YAMLException extends Error { + constructor(reason?: any, mark?: any); + toString(compact?: boolean): string; + } } declare module 'js-yaml' { diff --git a/leaflet/leaflet.d.ts b/leaflet/leaflet.d.ts index 94e6ab51c..ef02c29d2 100755 --- a/leaflet/leaflet.d.ts +++ b/leaflet/leaflet.d.ts @@ -41,7 +41,7 @@ declare module L { export function bounds(points: Point[]): Bounds; - export interface BoundsStatic extends ClassStatic { + export interface BoundsStatic { /** * Creates a Bounds object from two coordinates (usually top-left and bottom-right * corners). @@ -513,7 +513,7 @@ declare module L { /** * Creates a control with the given options. */ - function (options?: ControlOptions): Control; + (options?: ControlOptions): Control; } export namespace control { @@ -805,13 +805,6 @@ declare namespace L { } declare namespace L { - - /** - * Creates a Draggable object for moving the given element when you start dragging - * the dragHandle element (equals the element itself by default). - */ - function draggable(element: HTMLElement, dragHandle?: HTMLElement): Draggable; - export interface DraggableStatic extends ClassStatic { /** * Creates a Draggable object for moving the given element when you start dragging @@ -1453,7 +1446,7 @@ declare namespace L { */ function latLng(coords: LatLngExpression): LatLng; - export interface LatLngStatic extends ClassStatic { + export interface LatLngStatic { /** * Creates an object representing a geographical point with the given latitude * and longitude. @@ -1539,7 +1532,7 @@ declare namespace L { */ function latLngBounds(latlngs: LatLngBoundsExpression): LatLngBounds; - export interface LatLngBoundsStatic extends ClassStatic { + export interface LatLngBoundsStatic { /** * Creates a LatLngBounds object by defining south-west and north-east corners * of the rectangle. @@ -2442,7 +2435,7 @@ declare namespace L { options: Map.MapOptions; /** - * Iterates over the layers of the map, optionally specifying context + * Iterates over the layers of the map, optionally specifying context * of the iterator function. */ eachLayer(fn: (layer: ILayer) => void, context?: any): Map; @@ -3058,7 +3051,7 @@ declare namespace L { */ function multiPolygon(latlngs: LatLng[][], options?: PolylineOptions): MultiPolygon; - export interface MultiPolylgonStatic extends ClassStatic { + export interface MultiPolygonStatic extends ClassStatic { /** * Instantiates a multi-polyline object given an array of latlngs arrays (one * for each individual polygon) and optionally an options object (the same @@ -3066,7 +3059,7 @@ declare namespace L { */ new(latlngs: LatLng[][], options?: PolylineOptions): MultiPolygon; } - export var MultiPolylgon: MultiPolylgonStatic; + export var MultiPolygon: MultiPolygonStatic; export interface MultiPolygon extends FeatureGroup { /** @@ -3401,7 +3394,7 @@ declare namespace L { */ function point(x: number, y: number, round?: boolean): Point; - export interface PointStatic extends ClassStatic { + export interface PointStatic { /** * Creates a Point object with the given x and y coordinates. If optional round * is set to true, rounds the x and y values. @@ -4182,7 +4175,7 @@ declare namespace L { * When this option is set, the TileLayer only loads tiles that are in the given geographical bounds. */ bounds?: LatLngBounds; - + /** * Custom keys may be specified in TileLayerOptions so they can be used in a provided URL template. */ @@ -4191,7 +4184,7 @@ declare namespace L { } declare namespace L { - export interface TransformationStatic extends ClassStatic { + export interface TransformationStatic { /** * Creates a transformation object with the given coefficients. */ diff --git a/lodash/lodash-tests.ts b/lodash/lodash-tests.ts index 66f0bf2ca..49974a788 100644 --- a/lodash/lodash-tests.ts +++ b/lodash/lodash-tests.ts @@ -257,6 +257,193 @@ module TestDifference { } } +// _.differenceBy +module TestDifferenceBy { + let array: TResult[]; + let list: _.List; + let iteratee: (value: TResult) => any; + + { + let result: TResult[]; + + result = _.differenceBy(array, array); + result = _.differenceBy(array, list, array); + result = _.differenceBy(array, array, list, array); + result = _.differenceBy(array, list, array, list, array); + result = _.differenceBy(array, array, list, array, list, array); + result = _.differenceBy(array, list, array, list, array, list, array); + + result = _.differenceBy(array, array, iteratee); + result = _.differenceBy(array, list, array, iteratee); + result = _.differenceBy(array, array, list, array, iteratee); + result = _.differenceBy(array, list, array, list, array, iteratee); + result = _.differenceBy(array, array, list, array, list, array, iteratee); + result = _.differenceBy(array, list, array, list, array, list, array, iteratee); + + result = _.differenceBy(array, array, 'a'); + result = _.differenceBy(array, list, array, 'a'); + result = _.differenceBy(array, array, list, array, 'a'); + result = _.differenceBy(array, list, array, list, array, 'a'); + result = _.differenceBy(array, array, list, array, list, array, 'a'); + result = _.differenceBy(array, list, array, list, array, list, array, 'a'); + + result = _.differenceBy(array, array, {a: 1}); + result = _.differenceBy(array, list, array, {a: 1}); + result = _.differenceBy(array, array, list, array, {a: 1}); + result = _.differenceBy(array, list, array, list, array, {a: 1}); + result = _.differenceBy(array, array, list, array, list, array, {a: 1}); + result = _.differenceBy(array, list, array, list, array, list, array, {a: 1}); + + result = _.differenceBy(list, list); + result = _.differenceBy(list, array, list); + result = _.differenceBy(list, list, array, list); + result = _.differenceBy(list, array, list, array, list); + result = _.differenceBy(list, list, array, list, array, list); + result = _.differenceBy(list, array, list, array, list, array, list); + + result = _.differenceBy(list, list, iteratee); + result = _.differenceBy(list, array, list, iteratee); + result = _.differenceBy(list, list, array, list, iteratee); + result = _.differenceBy(list, array, list, array, list, iteratee); + result = _.differenceBy(list, list, array, list, array, list, iteratee); + result = _.differenceBy(list, array, list, array, list, array, list, iteratee); + + result = _.differenceBy(list, list, 'a'); + result = _.differenceBy(list, array, list, 'a'); + result = _.differenceBy(list, list, array, list, 'a'); + result = _.differenceBy(list, array, list, array, list, 'a'); + result = _.differenceBy(list, list, array, list, array, list, 'a'); + result = _.differenceBy(list, array, list, array, list, array, list, 'a'); + + result = _.differenceBy(list, list, {a: 1}); + result = _.differenceBy(list, array, list, {a: 1}); + result = _.differenceBy(list, list, array, list, {a: 1}); + result = _.differenceBy(list, array, list, array, list, {a: 1}); + result = _.differenceBy(list, list, array, list, array, list, {a: 1}); + result = _.differenceBy(list, array, list, array, list, array, list, {a: 1}); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _(array).differenceBy(array); + result = _(array).differenceBy(list, array); + result = _(array).differenceBy(array, list, array); + result = _(array).differenceBy(list, array, list, array); + result = _(array).differenceBy(array, list, array, list, array); + result = _(array).differenceBy(list, array, list, array, list, array); + + result = _(array).differenceBy(array, iteratee); + result = _(array).differenceBy(list, array, iteratee); + result = _(array).differenceBy(array, list, array, iteratee); + result = _(array).differenceBy(list, array, list, array, iteratee); + result = _(array).differenceBy(array, list, array, list, array, iteratee); + result = _(array).differenceBy(list, array, list, array, list, array, iteratee); + + result = _(array).differenceBy(array, 'a'); + result = _(array).differenceBy(list, array, 'a'); + result = _(array).differenceBy(array, list, array, 'a'); + result = _(array).differenceBy(list, array, list, array, 'a'); + result = _(array).differenceBy(array, list, array, list, array, 'a'); + result = _(array).differenceBy(list, array, list, array, list, array, 'a'); + + result = _(array).differenceBy(array, {a: 1}); + result = _(array).differenceBy(list, array, {a: 1}); + result = _(array).differenceBy(array, list, array, {a: 1}); + result = _(array).differenceBy(list, array, list, array, {a: 1}); + result = _(array).differenceBy(array, list, array, list, array, {a: 1}); + result = _(array).differenceBy(list, array, list, array, list, array, {a: 1}); + + result = _(list).differenceBy(list); + result = _(list).differenceBy(array, list); + result = _(list).differenceBy(list, array, list); + result = _(list).differenceBy(array, list, array, list); + result = _(list).differenceBy(list, array, list, array, list); + result = _(list).differenceBy(array, list, array, list, array, list); + + result = _(list).differenceBy(list, iteratee); + result = _(list).differenceBy(array, list, iteratee); + result = _(list).differenceBy(list, array, list, iteratee); + result = _(list).differenceBy(array, list, array, list, iteratee); + result = _(list).differenceBy(list, array, list, array, list, iteratee); + result = _(list).differenceBy(array, list, array, list, array, list, iteratee); + + result = _(list).differenceBy(list, 'a'); + result = _(list).differenceBy(array, list, 'a'); + result = _(list).differenceBy(list, array, list, 'a'); + result = _(list).differenceBy(array, list, array, list, 'a'); + result = _(list).differenceBy(list, array, list, array, list, 'a'); + result = _(list).differenceBy(array, list, array, list, array, list, 'a'); + + result = _(list).differenceBy(list, {a: 1}); + result = _(list).differenceBy(array, list, {a: 1}); + result = _(list).differenceBy(list, array, list, {a: 1}); + result = _(list).differenceBy(array, list, array, list, {a: 1}); + result = _(list).differenceBy(list, array, list, array, list, {a: 1}); + result = _(list).differenceBy(array, list, array, list, array, list, {a: 1}); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _(array).chain().differenceBy(array); + result = _(array).chain().differenceBy(list, array); + result = _(array).chain().differenceBy(array, list, array); + result = _(array).chain().differenceBy(list, array, list, array); + result = _(array).chain().differenceBy(array, list, array, list, array); + result = _(array).chain().differenceBy(list, array, list, array, list, array); + + result = _(array).chain().differenceBy(array, iteratee); + result = _(array).chain().differenceBy(list, array, iteratee); + result = _(array).chain().differenceBy(array, list, array, iteratee); + result = _(array).chain().differenceBy(list, array, list, array, iteratee); + result = _(array).chain().differenceBy(array, list, array, list, array, iteratee); + result = _(array).chain().differenceBy(list, array, list, array, list, array, iteratee); + + result = _(array).chain().differenceBy(array, 'a'); + result = _(array).chain().differenceBy(list, array, 'a'); + result = _(array).chain().differenceBy(array, list, array, 'a'); + result = _(array).chain().differenceBy(list, array, list, array, 'a'); + result = _(array).chain().differenceBy(array, list, array, list, array, 'a'); + result = _(array).chain().differenceBy(list, array, list, array, list, array, 'a'); + + result = _(array).chain().differenceBy(array, {a: 1}); + result = _(array).chain().differenceBy(list, array, {a: 1}); + result = _(array).chain().differenceBy(array, list, array, {a: 1}); + result = _(array).chain().differenceBy(list, array, list, array, {a: 1}); + result = _(array).chain().differenceBy(array, list, array, list, array, {a: 1}); + result = _(array).chain().differenceBy(list, array, list, array, list, array, {a: 1}); + + result = _(list).chain().differenceBy(list); + result = _(list).chain().differenceBy(array, list); + result = _(list).chain().differenceBy(list, array, list); + result = _(list).chain().differenceBy(array, list, array, list); + result = _(list).chain().differenceBy(list, array, list, array, list); + result = _(list).chain().differenceBy(array, list, array, list, array, list); + + result = _(list).chain().differenceBy(list, iteratee); + result = _(list).chain().differenceBy(array, list, iteratee); + result = _(list).chain().differenceBy(list, array, list, iteratee); + result = _(list).chain().differenceBy(array, list, array, list, iteratee); + result = _(list).chain().differenceBy(list, array, list, array, list, iteratee); + result = _(list).chain().differenceBy(array, list, array, list, array, list, iteratee); + + result = _(list).chain().differenceBy(list, 'a'); + result = _(list).chain().differenceBy(array, list, 'a'); + result = _(list).chain().differenceBy(list, array, list, 'a'); + result = _(list).chain().differenceBy(array, list, array, list, 'a'); + result = _(list).chain().differenceBy(list, array, list, array, list, 'a'); + result = _(list).chain().differenceBy(array, list, array, list, array, list, 'a'); + + result = _(list).chain().differenceBy(list, {a: 1}); + result = _(list).chain().differenceBy(array, list, {a: 1}); + result = _(list).chain().differenceBy(list, array, list, {a: 1}); + result = _(list).chain().differenceBy(array, list, array, list, {a: 1}); + result = _(list).chain().differenceBy(list, array, list, array, list, {a: 1}); + result = _(list).chain().differenceBy(array, list, array, list, array, list, {a: 1}); + } +} + // _.drop { let array: TResult[]; @@ -3979,8 +4166,53 @@ module TestKeyBy { } } -result = _.invokeMap([[5, 1, 7], [3, 2, 1]], 'sort'); -result = _.invokeMap([123, 456], String.prototype.split, ''); +//_.invokeMap +module TestInvokeMap { + let numArray = [4, 2, 1, 3] + let numDict: _.Dictionary = { + a: 1, + b: 2, + c: 3, + d: 4 + } + + let result: string[]; + result = _.invokeMap(numArray, 'toString'); + result = _.invokeMap(numArray, 'toString', 2); + result = _.invokeMap(numArray, 'toString'); + result = _.invokeMap(numArray, 'toString', 2); + result = _(numArray).invokeMap('toString').value(); + result = _(numArray).invokeMap('toString', 2).value(); + result = _(numArray).chain().invokeMap('toString').value(); + result = _(numArray).chain().invokeMap('toString', 2).value(); + + result = _.invokeMap(numArray, Number.prototype.toString); + result = _.invokeMap(numArray, Number.prototype.toString, 2); + result = _.invokeMap(numArray, Number.prototype.toString); + result = _.invokeMap(numArray, Number.prototype.toString, 2); + result = _(numArray).invokeMap(Number.prototype.toString).value(); + result = _(numArray).invokeMap(Number.prototype.toString, 2).value(); + result = _(numArray).chain().invokeMap(Number.prototype.toString).value(); + result = _(numArray).chain().invokeMap(Number.prototype.toString, 2).value(); + + result = _.invokeMap(numDict, 'toString'); + result = _.invokeMap(numDict, 'toString', 2); + result = _.invokeMap(numDict, 'toString'); + result = _.invokeMap(numDict, 'toString', 2); + result = _(numDict).invokeMap('toString').value(); + result = _(numDict).invokeMap('toString', 2).value(); + result = _(numDict).chain().invokeMap('toString').value(); + result = _(numDict).chain().invokeMap('toString', 2).value(); + + result = _.invokeMap(numDict, Number.prototype.toString); + result = _.invokeMap(numDict, Number.prototype.toString, 2); + result = _.invokeMap(numDict, Number.prototype.toString); + result = _.invokeMap(numDict, Number.prototype.toString, 2); + result = _(numDict).invokeMap(Number.prototype.toString).value(); + result = _(numDict).invokeMap(Number.prototype.toString, 2).value(); + result = _(numDict).chain().invokeMap(Number.prototype.toString).value(); + result = _(numDict).chain().invokeMap(Number.prototype.toString, 2).value(); +} // _.map module TestMap { @@ -8970,7 +9202,7 @@ module TestValuesIn { **********/ // _.camelCase -module TestCamelCase { +namespace TestCamelCase { { let result: string; @@ -8986,7 +9218,7 @@ module TestCamelCase { } // _.capitalize -module TestCapitalize { +namespace TestCapitalize { { let result: string; @@ -9002,7 +9234,7 @@ module TestCapitalize { } // _.deburr -module TestDeburr { +namespace TestDeburr { { let result: string; @@ -9018,7 +9250,7 @@ module TestDeburr { } // _.endsWith -module TestEndsWith { +namespace TestEndsWith { { let result: boolean; @@ -9038,7 +9270,7 @@ module TestEndsWith { } // _.escape -module TestEscape { +namespace TestEscape { { let result: string; @@ -9054,7 +9286,7 @@ module TestEscape { } // _.escapeRegExp -module TestEscapeRegExp { +namespace TestEscapeRegExp { { let result: string; @@ -9070,7 +9302,7 @@ module TestEscapeRegExp { } // _.kebabCase -module TestKebabCase { +namespace TestKebabCase { { let result: string; @@ -9086,7 +9318,7 @@ module TestKebabCase { } // _.lowerCase -module TestLowerCase { +namespace TestLowerCase { { let result: string; @@ -9102,7 +9334,7 @@ module TestLowerCase { } // _.lowerFirst -module TestLowerFirst { +namespace TestLowerFirst { { let result: string; @@ -9118,11 +9350,11 @@ module TestLowerFirst { } // _.pad -module TestPad { +namespace TestPad { { let result: string; - result = _.pad('abd'); + result = _.pad('abc'); result = _.pad('abc', 8); result = _.pad('abc', 8, '_-'); @@ -9140,31 +9372,8 @@ module TestPad { } } -// _.padStart -module TestPadStart { - { - let result: string; - - result = _.padStart('abc'); - result = _.padStart('abc', 6); - result = _.padStart('abc', 6, '_-'); - - result = _('abc').padStart(); - result = _('abc').padStart(6); - result = _('abc').padStart(6, '_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('abc').chain().padStart(); - result = _('abc').chain().padStart(6); - result = _('abc').chain().padStart(6, '_-'); - } -} - // _.padEnd -module TestPadEnd { +namespace TestPadEnd { { let result: string; @@ -9186,9 +9395,31 @@ module TestPadEnd { } } +// _.padStart +namespace TestPadStart { + { + let result: string; + + result = _.padStart('abc'); + result = _.padStart('abc', 6); + result = _.padStart('abc', 6, '_-'); + + result = _('abc').padStart(); + result = _('abc').padStart(6); + result = _('abc').padStart(6, '_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('abc').chain().padStart(); + result = _('abc').chain().padStart(6); + result = _('abc').chain().padStart(6, '_-'); + } +} // _.parseInt -module TestParseInt { +namespace TestParseInt { { let result: number; @@ -9208,7 +9439,7 @@ module TestParseInt { } // _.repeat -module TestRepeat { +namespace TestRepeat { { let result: string; result = _.repeat('*'); @@ -9226,8 +9457,63 @@ module TestRepeat { } } +// _.replace +namespace TestReplace { + let replacer = (match: string, offset: number, string: string) => 'Barney'; + + { + let result: string; + + result = _.replace('Hi Fred', 'Fred', 'Barney'); + result = _.replace('Hi Fred', 'Fred', replacer); + + result = _.replace('Hi Fred', /fred/i, 'Barney'); + result = _.replace('Hi Fred', /fred/i, replacer); + + result = _.replace('Fred'); + result = _.replace('Fred', 'Barney'); + result = _.replace('Fred', replacer); + + result = _.replace(/fred/i); + result = _.replace(/fred/i, 'Barney'); + result = _.replace(/fred/i, replacer); + + result = _('Hi Fred').replace('Fred', 'Barney'); + result = _('Hi Fred').replace('Fred', replacer); + + result = _('Hi Fred').replace(/fred/i, 'Barney'); + result = _('Hi Fred').replace(/fred/i, replacer); + + result = _('Fred').replace(); + result = _('Fred').replace('Barney'); + result = _('Fred').replace(replacer); + + result = _(/fred/i).replace(); + result = _(/fred/i).replace('Barney'); + result = _(/fred/i).replace(replacer); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('Hi Fred').chain().replace('Fred', 'Barney'); + result = _('Hi Fred').chain().replace('Fred', replacer); + + result = _('Hi Fred').chain().replace(/fred/i, 'Barney'); + result = _('Hi Fred').chain().replace(/fred/i, replacer); + + result = _('Fred').chain().replace(); + result = _('Fred').chain().replace('Barney'); + result = _('Fred').chain().replace(replacer); + + result = _(/fred/i).chain().replace(); + result = _(/fred/i).chain().replace('Barney'); + result = _(/fred/i).chain().replace(replacer); + } +} + // _.snakeCase -module TestSnakeCase { +namespace TestSnakeCase { { let result: string; @@ -9242,8 +9528,35 @@ module TestSnakeCase { } } +// _.split +namespace TestSplit { + { + let result: string[]; + + result = _.split('a-b-c'); + result = _.split('a-b-c', '-'); + result = _.split('a-b-c', '-', 2); + } + + { + let result: _.LoDashImplicitArrayWrapper; + + result = _('a-b-c').split(); + result = _('a-b-c').split('-'); + result = _('a-b-c').split('-', 2); + } + + { + let result: _.LoDashExplicitArrayWrapper; + + result = _('a-b-c').chain().split(); + result = _('a-b-c').chain().split('-'); + result = _('a-b-c').chain().split('-', 2); + } +} + // _.startCase -module TestStartCase { +namespace TestStartCase { { let result: string; @@ -9259,7 +9572,7 @@ module TestStartCase { } // _.startsWith -module TestStartsWith { +namespace TestStartsWith { { let result: boolean; @@ -9279,7 +9592,7 @@ module TestStartsWith { } // _.template -module TestTemplate { +namespace TestTemplate { interface TemplateExecutor { (obj?: Object): string; source: string; @@ -9313,7 +9626,7 @@ module TestTemplate { } // _.toLower -module TestToLower { +namespace TestToLower { { let result: string; @@ -9329,7 +9642,7 @@ module TestToLower { } // _.toUpper -module TestToUpper { +namespace TestToUpper { { let result: string; @@ -9345,7 +9658,7 @@ module TestToUpper { } // _.trim -module TestTrim { +namespace TestTrim { { let result: string; @@ -9365,29 +9678,8 @@ module TestTrim { } } -// _.trimStart -module TestTrimStart { - { - let result: string; - - result = _.trimStart(); - result = _.trimStart(' abc '); - result = _.trimStart('-_-abc-_-', '_-'); - - result = _('-_-abc-_-').trimStart(); - result = _('-_-abc-_-').trimStart('_-'); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('-_-abc-_-').chain().trimStart(); - result = _('-_-abc-_-').chain().trimStart('_-'); - } -} - // _.trimEnd -module TestTrimEnd { +namespace TestTrimEnd { { let result: string; @@ -9407,19 +9699,38 @@ module TestTrimEnd { } } +// _.trimStart +namespace TestTrimStart { + { + let result: string; + + result = _.trimStart(); + result = _.trimStart(' abc '); + result = _.trimStart('-_-abc-_-', '_-'); + + result = _('-_-abc-_-').trimStart(); + result = _('-_-abc-_-').trimStart('_-'); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('-_-abc-_-').chain().trimStart(); + result = _('-_-abc-_-').chain().trimStart('_-'); + } +} + // _.truncate -module Testtruncate { +namespace TestTruncate { { let result: string; result = _.truncate('hi-diddly-ho there, neighborino'); - result = _.truncate('hi-diddly-ho there, neighborino', 24); result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': ' ' }); result = _.truncate('hi-diddly-ho there, neighborino', { 'length': 24, 'separator': /,? +/ }); result = _.truncate('hi-diddly-ho there, neighborino', { 'omission': ' […]' }); result = _('hi-diddly-ho there, neighborino').truncate(); - result = _('hi-diddly-ho there, neighborino').truncate(24); result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': ' ' }); result = _('hi-diddly-ho there, neighborino').truncate({ 'length': 24, 'separator': /,? +/ }); result = _('hi-diddly-ho there, neighborino').truncate({ 'omission': ' […]' }); @@ -9429,15 +9740,31 @@ module Testtruncate { let result: _.LoDashExplicitWrapper; result = _('hi-diddly-ho there, neighborino').chain().truncate(); - result = _('hi-diddly-ho there, neighborino').chain().truncate(24); result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': ' ' }); result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'length': 24, 'separator': /,? +/ }); result = _('hi-diddly-ho there, neighborino').chain().truncate({ 'omission': ' […]' }); } } +// _.unescape +namespace TestUnescape { + { + let result: string; + + result = _.unescape('fred, barney, & pebbles'); + result = _('fred, barney, & pebbles').unescape(); + } + + { + let result: _.LoDashExplicitWrapper; + + result = _('fred, barney, & pebbles').chain().unescape(); + } +} + + // _.upperCase -module TestUpperCase { +namespace TestUpperCase { { let result: string; @@ -9453,7 +9780,7 @@ module TestUpperCase { } // _.upperFirst -module TestUpperFirst { +namespace TestUpperFirst { { let result: string; @@ -9468,24 +9795,8 @@ module TestUpperFirst { } } -// _.unescape -module TestUnescape { - { - let result: string; - - result = _.unescape('fred, barney, & pebbles'); - result = _('fred, barney, & pebbles').unescape(); - } - - { - let result: _.LoDashExplicitWrapper; - - result = _('fred, barney, & pebbles').chain().unescape(); - } -} - // _.words -module TestWords { +namespace TestWords { { let result: string[]; diff --git a/lodash/lodash.d.ts b/lodash/lodash.d.ts index aaa8dc7e3..c3af67d28 100644 --- a/lodash/lodash.d.ts +++ b/lodash/lodash.d.ts @@ -548,28 +548,568 @@ declare module _ { difference(...values: (TValue[]|List)[]): LoDashExplicitArrayWrapper; } - //_.differenceBy DUMMY + //_.differenceBy interface LoDashStatic { /** - * Creates an array of unique `array` values not included in the other - * provided arrays using [`SameValueZero`](http://ecma-international.org/ecma-262/6.0/#sec-samevaluezero) - * for equality comparisons. + * This method is like _.difference except that it accepts iteratee which is invoked for each element of array + * and values to generate the criterion by which uniqueness is computed. The iteratee is invoked with one + * argument: (value). * - * @static - * @memberOf _ - * @category Array - * @param {Array} array The array to inspect. - * @param {...Array} [values] The values to exclude. - * @returns {Array} Returns the new array of filtered values. - * @example - * - * _.difference([3, 2, 1], [4, 2]); - * // => [3, 1] + * @param array The array to inspect. + * @param values The values to exclude. + * @param iteratee The iteratee invoked per element. + * @returns Returns the new array of filtered values. */ - differenceBy( - array: any[]|List, + differenceBy( + array: T[]|List, + values?: T[]|List, + iteratee?: ((value: T) => any)|string + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values?: T[]|List, + iteratee?: W + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + iteratee?: ((value: T) => any)|string + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + iteratee?: W + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: ((value: T) => any)|string + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: W + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: W + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: ((value: T) => any)|string + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: ((value: T) => any)|string + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: W + ): T[]; + + /** + * @see _.differenceBy + */ + differenceBy( + array: T[]|List, ...values: any[] - ): any[]; + ): T[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + ...values: any[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: W + ): LoDashImplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + ...values: any[] + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + ...values: any[] + ): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: ((value: T) => any)|string + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + values1?: T[]|List, + values2?: T[]|List, + values3?: T[]|List, + values4?: T[]|List, + values5?: T[]|List, + iteratee?: W + ): LoDashExplicitArrayWrapper; + + /** + * @see _.differenceBy + */ + differenceBy( + ...values: any[] + ): LoDashExplicitArrayWrapper; } //_.differenceWith DUMMY @@ -6831,50 +7371,130 @@ declare module _ { * @param methodName The name of the method to invoke. * @param args Arguments to invoke the method with. **/ - invokeMap( - collection: Array, + invokeMap( + collection: TValue[], methodName: string, - ...args: any[]): any; + ...args: any[]): TResult[]; /** * @see _.invokeMap **/ - invokeMap( - collection: List, + invokeMap( + collection: Dictionary, methodName: string, - ...args: any[]): any; + ...args: any[]): TResult[]; /** * @see _.invokeMap **/ - invokeMap( - collection: Dictionary, + invokeMap( + collection: {}[], methodName: string, - ...args: any[]): any; + ...args: any[]): TResult[]; /** * @see _.invokeMap **/ - invokeMap( - collection: Array, - method: Function, - ...args: any[]): any; + invokeMap( + collection: Dictionary<{}>, + methodName: string, + ...args: any[]): TResult[]; /** * @see _.invokeMap **/ - invokeMap( - collection: List, - method: Function, - ...args: any[]): any; + invokeMap( + collection: TValue[], + method: (...args: any[]) => TResult, + ...args: any[]): TResult[]; /** * @see _.invokeMap **/ - invokeMap( - collection: Dictionary, - method: Function, - ...args: any[]): any; + invokeMap( + collection: Dictionary, + method: (...args: any[]) => TResult, + ...args: any[]): TResult[]; + + /** + * @see _.invokeMap + **/ + invokeMap( + collection: {}[], + method: (...args: any[]) => TResult, + ...args: any[]): TResult[]; + + /** + * @see _.invokeMap + **/ + invokeMap( + collection: Dictionary<{}>, + method: (...args: any[]) => TResult, + ...args: any[]): TResult[]; + } + + interface LoDashImplicitArrayWrapper { + /** + * @see _.invokeMap + **/ + invokeMap( + methodName: string, + ...args: any[]): LoDashImplicitArrayWrapper; + + /** + * @see _.invokeMap + **/ + invokeMap( + method: (...args: any[]) => TResult, + ...args: any[]): LoDashImplicitArrayWrapper; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.invokeMap + **/ + invokeMap( + methodName: string, + ...args: any[]): LoDashImplicitArrayWrapper; + + /** + * @see _.invokeMap + **/ + invokeMap( + method: (...args: any[]) => TResult, + ...args: any[]): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitArrayWrapper { + /** + * @see _.invokeMap + **/ + invokeMap( + methodName: string, + ...args: any[]): LoDashExplicitArrayWrapper; + + /** + * @see _.invokeMap + **/ + invokeMap( + method: (...args: any[]) => TResult, + ...args: any[]): LoDashExplicitArrayWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.invokeMap + **/ + invokeMap( + methodName: string, + ...args: any[]): LoDashExplicitArrayWrapper; + + /** + * @see _.invokeMap + **/ + invokeMap( + method: (...args: any[]) => TResult, + ...args: any[]): LoDashExplicitArrayWrapper; } //_.map @@ -14907,6 +15527,12 @@ declare module _ { //_.capitalize interface LoDashStatic { + /** + * Converts the first character of string to upper case and the remaining to lower case. + * + * @param string The string to capitalize. + * @return Returns the capitalized string. + */ capitalize(string?: string): string; } @@ -14990,16 +15616,16 @@ declare module _ { // _.escape interface LoDashStatic { /** - * Converts the characters "&", "<", ">", '"', "'", and "`", in string to their corresponding HTML entities. + * Converts the characters "&", "<", ">", '"', "'", and "`" in string to their corresponding HTML entities. * * Note: No other characters are escaped. To escape additional characters use a third-party library like he. * - * Though the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML + * hough the ">" character is escaped for symmetry, characters like ">" and "/" don’t need escaping in HTML * and have no special meaning unless they're part of a tag or unquoted attribute value. See Mathias Bynens’s * article (under "semi-related fun fact") for more details. * - * Backticks are escaped because in Internet Explorer < 9, they can break out of attribute values or HTML - * comments. See #59, #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. + * Backticks are escaped because in IE < 9, they can break out of attribute values or HTML comments. See #59, + * #102, #108, and #133 of the HTML5 Security Cheatsheet for more details. * * When working with HTML you should always quote attribute values to reduce XSS vectors. * @@ -15026,8 +15652,8 @@ declare module _ { // _.escapeRegExp interface LoDashStatic { /** - * Escapes the RegExp special characters "\", "/", "^", "$", ".", "|", "?", "*", "+", "(", ")", "[", "]", - * "{" and "}" in string. + * Escapes the RegExp special characters "^", "$", "\", ".", "*", "+", "?", "(", ")", "[", "]", + * "{", "}", and "|" in string. * * @param string The string to escape. * @return Returns the escaped string. @@ -15079,21 +15705,8 @@ declare module _ { /** * Converts `string`, as space separated words, to lower case. * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.lowerCase('--Foo-Bar'); - * // => 'foo bar' - * - * _.lowerCase('fooBar'); - * // => 'foo bar' - * - * _.lowerCase('__FOO_BAR__'); - * // => 'foo bar' + * @param string The string to convert. + * @return Returns the lower cased string. */ lowerCase(string?: string): string; } @@ -15117,18 +15730,8 @@ declare module _ { /** * Converts the first character of `string` to lower case. * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.lowerFirst('Fred'); - * // => 'fred' - * - * _.lowerFirst('FRED'); - * // => 'fRED' + * @param string The string to convert. + * @return Returns the converted string. */ lowerFirst(string?: string): string; } @@ -15185,44 +15788,6 @@ declare module _ { ): LoDashExplicitWrapper; } - //_.padStart - interface LoDashStatic { - /** - * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed - * length. - * - * @param string The string to pad. - * @param length The padding length. - * @param chars The string used as padding. - * @return Returns the padded string. - */ - padStart( - string?: string, - length?: number, - chars?: string - ): string; - } - - interface LoDashImplicitWrapper { - /** - * @see _.padStart - */ - padStart( - length?: number, - chars?: string - ): string; - } - - interface LoDashExplicitWrapper { - /** - * @see _.padStart - */ - padStart( - length?: number, - chars?: string - ): LoDashExplicitWrapper; - } - //_.padEnd interface LoDashStatic { /** @@ -15261,6 +15826,44 @@ declare module _ { ): LoDashExplicitWrapper; } + //_.padStart + interface LoDashStatic { + /** + * Pads string on the left side if it’s shorter than length. Padding characters are truncated if they exceed + * length. + * + * @param string The string to pad. + * @param length The padding length. + * @param chars The string used as padding. + * @return Returns the padded string. + */ + padStart( + string?: string, + length?: number, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.padStart + */ + padStart( + length?: number, + chars?: string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.padStart + */ + padStart( + length?: number, + chars?: string + ): LoDashExplicitWrapper; + } + //_.parseInt interface LoDashStatic { /** @@ -15322,6 +15925,101 @@ declare module _ { repeat(n?: number): LoDashExplicitWrapper; } + //_.replace + interface LoDashStatic { + /** + * Replaces matches for pattern in string with replacement. + * + * Note: This method is based on String#replace. + * + * @param string + * @param pattern + * @param replacement + * @return Returns the modified string. + */ + replace( + string: string, + pattern: RegExp|string, + replacement: Function|string + ): string; + + /** + * @see _.replace + */ + replace( + pattern?: RegExp|string, + replacement?: Function|string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.replace + */ + replace( + pattern?: RegExp|string, + replacement?: Function|string + ): string; + + /** + * @see _.replace + */ + replace( + replacement?: Function|string + ): string; + } + + interface LoDashImplicitObjectWrapper { + /** + * @see _.replace + */ + replace( + pattern?: RegExp|string, + replacement?: Function|string + ): string; + + /** + * @see _.replace + */ + replace( + replacement?: Function|string + ): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.replace + */ + replace( + pattern?: RegExp|string, + replacement?: Function|string + ): LoDashExplicitWrapper; + + /** + * @see _.replace + */ + replace( + replacement?: Function|string + ): LoDashExplicitWrapper; + } + + interface LoDashExplicitObjectWrapper { + /** + * @see _.replace + */ + replace( + pattern?: RegExp|string, + replacement?: Function|string + ): LoDashExplicitWrapper; + + /** + * @see _.replace + */ + replace( + replacement?: Function|string + ): LoDashExplicitWrapper; + } + //_.snakeCase interface LoDashStatic { /** @@ -15347,6 +16045,45 @@ declare module _ { snakeCase(): LoDashExplicitWrapper; } + //_.split + interface LoDashStatic { + /** + * Splits string by separator. + * + * Note: This method is based on String#split. + * + * @param string + * @param separator + * @param limit + * @return Returns the new array of string segments. + */ + split( + string: string, + separator?: RegExp|string, + limit?: number + ): string[]; + } + + interface LoDashImplicitWrapper { + /** + * @see _.split + */ + split( + separator?: RegExp|string, + limit?: number + ): LoDashImplicitArrayWrapper; + } + + interface LoDashExplicitWrapper { + /** + * @see _.split + */ + split( + separator?: RegExp|string, + limit?: number + ): LoDashExplicitArrayWrapper; + } + //_.startCase interface LoDashStatic { /** @@ -15474,21 +16211,8 @@ declare module _ { /** * Converts `string`, as a whole, to lower case. * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the lower cased string. - * @example - * - * _.toLower('--Foo-Bar'); - * // => '--foo-bar' - * - * _.toLower('fooBar'); - * // => 'foobar' - * - * _.toLower('__FOO_BAR__'); - * // => '__foo_bar__' + * @param string The string to convert. + * @return Returns the lower cased string. */ toLower(string?: string): string; } @@ -15512,21 +16236,8 @@ declare module _ { /** * Converts `string`, as a whole, to upper case. * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the upper cased string. - * @example - * - * _.toUpper('--foo-bar'); - * // => '--FOO-BAR' - * - * _.toUpper('fooBar'); - * // => 'FOOBAR' - * - * _.toUpper('__foo_bar__'); - * // => '__FOO_BAR__' + * @param string The string to convert. + * @return Returns the upper cased string. */ toUpper(string?: string): string; } @@ -15574,35 +16285,6 @@ declare module _ { trim(chars?: string): LoDashExplicitWrapper; } - //_.trimStart - interface LoDashStatic { - /** - * Removes leading whitespace or specified characters from string. - * - * @param string The string to trim. - * @param chars The characters to trim. - * @return Returns the trimmed string. - */ - trimStart( - string?: string, - chars?: string - ): string; - } - - interface LoDashImplicitWrapper { - /** - * @see _.trimStart - */ - trimStart(chars?: string): string; - } - - interface LoDashExplicitWrapper { - /** - * @see _.trimStart - */ - trimStart(chars?: string): LoDashExplicitWrapper; - } - //_.trimEnd interface LoDashStatic { /** @@ -15632,6 +16314,35 @@ declare module _ { trimEnd(chars?: string): LoDashExplicitWrapper; } + //_.trimStart + interface LoDashStatic { + /** + * Removes leading whitespace or specified characters from string. + * + * @param string The string to trim. + * @param chars The characters to trim. + * @return Returns the trimmed string. + */ + trimStart( + string?: string, + chars?: string + ): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.trimStart + */ + trimStart(chars?: string): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.trimStart + */ + trimStart(chars?: string): LoDashExplicitWrapper; + } + //_.truncate interface TruncateOptions { /** The maximum string length. */ @@ -15653,7 +16364,7 @@ declare module _ { */ truncate( string?: string, - options?: TruncateOptions|number + options?: TruncateOptions ): string; } @@ -15661,14 +16372,43 @@ declare module _ { /** * @see _.truncate */ - truncate(options?: TruncateOptions|number): string; + truncate(options?: TruncateOptions): string; } interface LoDashExplicitWrapper { /** * @see _.truncate */ - truncate(options?: TruncateOptions|number): LoDashExplicitWrapper; + truncate(options?: TruncateOptions): LoDashExplicitWrapper; + } + + //_.unescape + interface LoDashStatic { + /** + * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` + * in string to their corresponding characters. + * + * Note: No other HTML entities are unescaped. To unescape additional HTML entities use a third-party library + * like he. + * + * @param string The string to unescape. + * @return Returns the unescaped string. + */ + unescape(string?: string): string; + } + + interface LoDashImplicitWrapper { + /** + * @see _.unescape + */ + unescape(): string; + } + + interface LoDashExplicitWrapper { + /** + * @see _.unescape + */ + unescape(): LoDashExplicitWrapper; } //_.upperCase @@ -15676,21 +16416,8 @@ declare module _ { /** * Converts `string`, as space separated words, to upper case. * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the upper cased string. - * @example - * - * _.upperCase('--foo-bar'); - * // => 'FOO BAR' - * - * _.upperCase('fooBar'); - * // => 'FOO BAR' - * - * _.upperCase('__foo_bar__'); - * // => 'FOO BAR' + * @param string The string to convert. + * @return Returns the upper cased string. */ upperCase(string?: string): string; } @@ -15714,18 +16441,8 @@ declare module _ { /** * Converts the first character of `string` to upper case. * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to convert. - * @returns {string} Returns the converted string. - * @example - * - * _.upperFirst('fred'); - * // => 'Fred' - * - * _.upperFirst('FRED'); - * // => 'FRED' + * @param string The string to convert. + * @return Returns the converted string. */ upperFirst(string?: string): string; } @@ -15744,51 +16461,14 @@ declare module _ { upperFirst(): LoDashExplicitWrapper; } - //_.unescape - interface LoDashStatic { - /** - * The inverse of _.escape; this method converts the HTML entities &, <, >, ", ', and ` - * in string to their corresponding characters. - * - * @param string The string to unescape. - * @return Returns the unescaped string. - */ - unescape(string?: string): string; - } - - interface LoDashImplicitWrapper { - /** - * @see _.unescape - */ - unescape(): string; - } - - interface LoDashExplicitWrapper { - /** - * @see _.unescape - */ - unescape(): LoDashExplicitWrapper; - } - //_.words interface LoDashStatic { /** * Splits `string` into an array of its words. * - * @static - * @memberOf _ - * @category String - * @param {string} [string=''] The string to inspect. - * @param {RegExp|string} [pattern] The pattern to match words. - * @param- {Object} [guard] Enables use as an iteratee for functions like `_.map`. - * @returns {Array} Returns the words of `string`. - * @example - * - * _.words('fred, barney, & pebbles'); - * // => ['fred', 'barney', 'pebbles'] - * - * _.words('fred, barney, & pebbles', /[^, ]+/g); - * // => ['fred', 'barney', '&', 'pebbles'] + * @param string The string to inspect. + * @param pattern The pattern to match words. + * @return Returns the words of `string`. */ words( string?: string, diff --git a/meteor-publish-composite/meteor-publish-composite-tests.ts b/meteor-publish-composite/meteor-publish-composite-tests.ts new file mode 100644 index 000000000..ad84c0f3a --- /dev/null +++ b/meteor-publish-composite/meteor-publish-composite-tests.ts @@ -0,0 +1,60 @@ +/// +/// + +import User = Meteor.User; +interface IPost { _id : string, authorId : string }; +interface IComment { authorId : string }; +var Posts : Mongo.Collection = new Mongo.Collection('Posts'); +var Comments : Mongo.Collection = new Mongo.Collection('Comments'); + +// Server +Meteor.publishComposite('topTenPosts', { + find: function() : Mongo.Cursor { + // Find top ten highest scoring posts + return Posts.find({}, { sort: { score: -1 }, limit: 10 }); + }, + children: [ + { + find: function(post) { + // Find post author. Even though we only want to return + // one record here, we use "find" instead of "findOne" + // since this function should return a cursor. + return Meteor.users.find( + { _id: post.authorId }, + { limit: 1, fields: { profile: 1 } }); + } + }, + { + find: function(post) { + // Find top two comments on post + return Comments.find( + { postId: post._id }, + { sort: { score: -1 }, limit: 2 }); + }, + children: [ + { + find: function(comment, post) { + // Find user that authored comment. + return Meteor.users.find( + { _id: comment.authorId }, + { limit: 1, fields: { profile: 1 } }); + } + } + ] + } + ] +}); + +// Server +Meteor.publishComposite('postsByUser', function(userId, limit) { + return { + find: function() { + // Find posts made by user. Note arguments for callback function + // being used in query. + return Posts.find({ authorId: userId }, { limit: limit }); + }, + children: [ + // This section will be similar to that of the previous example. + ] + } +}); diff --git a/meteor-publish-composite/meteor-publish-composite.d.ts b/meteor-publish-composite/meteor-publish-composite.d.ts new file mode 100644 index 000000000..ddab6ef47 --- /dev/null +++ b/meteor-publish-composite/meteor-publish-composite.d.ts @@ -0,0 +1,65 @@ +// Type definitions for meteor-publish-composite +// Project: https://github.com/englue/meteor-publish-composite +// Definitions by: Robert Van Gorkom +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare interface PublishCompositeConfigN { + children? : PublishCompositeConfigN[]; + find( + ...args : any[] + ) : Mongo.Cursor; +} + +declare interface PublishCompositeConfig4 { + children? : PublishCompositeConfigN[]; + find( + arg4 : InLevel4, + arg3 : InLevel3, + arg2 : InLevel2, + arg1 : InLevel1 + ) : Mongo.Cursor; +} + +declare interface PublishCompositeConfig3 { + children? : PublishCompositeConfig4[]; + find( + arg3 : InLevel3, + arg2 : InLevel2, + arg1 : InLevel1 + ) : Mongo.Cursor; +} + +declare interface PublishCompositeConfig2 { + children? : PublishCompositeConfig3[]; + find( + arg2 : InLevel2, + arg1 : InLevel1 + ) : Mongo.Cursor; +} + +declare interface PublishCompositeConfig1 { + children? : PublishCompositeConfig2[]; + find( + arg1 : InLevel1 + ) : Mongo.Cursor; +} + +declare interface PublishCompositeConfig { + children? : PublishCompositeConfig1[]; + find() : Mongo.Cursor; +} + +declare module Meteor { + function publishComposite( + name : string, + config : PublishCompositeConfig|PublishCompositeConfig[] + ) : void; + + function publishComposite( + name : string, + configFunc : (...args : any[]) => + PublishCompositeConfig|PublishCompositeConfig[] + ) : void; +} diff --git a/mongodb/mongodb.d.ts b/mongodb/mongodb.d.ts index b96c43522..695f14c6a 100644 --- a/mongodb/mongodb.d.ts +++ b/mongodb/mongodb.d.ts @@ -11,6 +11,7 @@ declare module "mongodb" { import {EventEmitter} from 'events'; + // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/MongoClient.html export class MongoClient { constructor(); @@ -150,7 +151,7 @@ declare module "mongodb" { socketOptions?: SocketOptions; } - // Class documentation : http://mongodb.github.io/node-mongodb-native/api-generated/db.html + // Class documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Db.html export class Db extends EventEmitter { constructor(databaseName: string, serverConfig: Server | ReplSet | Mongos, options?: DbCreateOptions); @@ -322,7 +323,7 @@ declare module "mongodb" { } // http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html - export class Admin { + export interface Admin { // http://mongodb.github.io/node-mongodb-native/2.1/api/Admin.html#addUser addUser(username: string, password: string, callback: MongoCallback): void; addUser(username: string, password: string, options?: AddUserOptions): Promise; @@ -552,7 +553,7 @@ declare module "mongodb" { } // Documentation : http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html - export class Collection { + export interface Collection { // Get the collection name. collectionName: string; // Get the full collection namespace. @@ -642,7 +643,7 @@ declare module "mongodb" { //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeOrderedBulkOp initializeOrderedBulkOp(options: CollectionOptions): OrderedBulkOperation; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#initializeUnorderedBulkOp - initializeOrderedBulkOp(options: CollectionOptions): OrderedBulkOperation; + initializeUnorderedBulkOp(options: CollectionOptions): OrderedBulkOperation; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#insertMany insertMany(docs: Object[], callback: MongoCallback): void insertMany(docs: Object[], options?: CollectionInsertManyOptions): Promise; @@ -871,7 +872,7 @@ declare module "mongodb" { } //http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html - export class OrderedBulkOperation { + export interface OrderedBulkOperation { length: number; //http://mongodb.github.io/node-mongodb-native/2.1/api/OrderedBulkOperation.html#execute execute(callback: MongoCallback): void; @@ -884,7 +885,14 @@ declare module "mongodb" { } //http://mongodb.github.io/node-mongodb-native/2.1/api/BulkWriteResult.html - export class BulkWriteResult { + export interface BulkWriteResult { + ok: boolean; + nInserted: number; + nUpdated: number; + nUpserted: number; + nModified: number; + nRemoved: number; + getInsertedIds(): Array; getLastOp(): Object; getRawResponse(): Object; @@ -916,7 +924,7 @@ declare module "mongodb" { } //http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsOrdered.html - export class FindOperatorsOrdered { + export interface FindOperatorsOrdered { delete(): OrderedBulkOperation; deleteOne(): OrderedBulkOperation; replaceOne(doc: Object): OrderedBulkOperation; @@ -926,7 +934,7 @@ declare module "mongodb" { } //http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html - export class UnorderedBulkOperation { + export interface UnorderedBulkOperation { //http://mongodb.github.io/node-mongodb-native/2.1/api/UnorderedBulkOperation.html#execute execute(callback: MongoCallback): void; execute(options: FSyncOptions): Promise; @@ -938,7 +946,7 @@ declare module "mongodb" { } //http://mongodb.github.io/node-mongodb-native/2.1/api/FindOperatorsUnordered.html - export class FindOperatorsUnordered { + export interface FindOperatorsUnordered { length: number; remove(): UnorderedBulkOperation; removeOne(): UnorderedBulkOperation; @@ -1044,7 +1052,7 @@ declare module "mongodb" { export type CursorResult = any | void | boolean; //http://mongodb.github.io/node-mongodb-native/2.1/api/Cursor.html - export class Cursor extends EventEmitter implements Readable { + export interface Cursor extends Readable, NodeJS.EventEmitter { sortValue: string; timeout: boolean; @@ -1161,7 +1169,7 @@ declare module "mongodb" { export type AggregationCursorResult = any | void; //http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html - export class AggregationCursor extends EventEmitter implements Readable { + export interface AggregationCursor extends Readable, NodeJS.EventEmitter { // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#batchSize batchSize(value: number): AggregationCursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/AggregationCursor.html#clone @@ -1225,7 +1233,7 @@ declare module "mongodb" { } //http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html - export class CommandCursor extends EventEmitter implements Readable { + export interface CommandCursor extends Readable, NodeJS.EventEmitter { // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#batchSize batchSize(value: number): CommandCursor; // http://mongodb.github.io/node-mongodb-native/2.1/api/CommandCursor.html#clone diff --git a/node-sass-middleware/node-sass-middleware-tests.ts b/node-sass-middleware/node-sass-middleware-tests.ts new file mode 100644 index 000000000..088aa5ce5 --- /dev/null +++ b/node-sass-middleware/node-sass-middleware-tests.ts @@ -0,0 +1,15 @@ +/// + +import * as express from "express"; +import * as sassMiddleware from "node-sass-middleware"; +import * as path from "path"; +var app = express(); +app.use(sassMiddleware({ + /* Options */ + src: __dirname, + dest: path.join(__dirname, 'public'), + debug: true, + outputStyle: 'compressed', + prefix: '/prefix' // Where prefix is at +})); +app.use(express.static(path.join(__dirname, 'public'))); \ No newline at end of file diff --git a/node-sass-middleware/node-sass-middleware.d.ts b/node-sass-middleware/node-sass-middleware.d.ts new file mode 100644 index 000000000..36af6b6c2 --- /dev/null +++ b/node-sass-middleware/node-sass-middleware.d.ts @@ -0,0 +1,69 @@ +// Type definitions for node-sass-middleware +// Project: https://github.com/sass/node-sass-middleware +// Definitions by: Pascal Garber +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// +/// + +declare module "node-sass-middleware" { + + import * as sass from "node-sass"; + import * as express from "express"; + + interface Options extends sass.Options { + /** + * + */ + src: string; + /** + * + */ + dest?: string; + /** + * + */ + root?: string; + /** + * + */ + prefix?: string; + /** + * + */ + force?: boolean; + /** + * + */ + debug?: boolean; + /** + * + */ + indentedSyntax?: boolean; + /** + * + */ + response?: boolean; + /** + * + */ + error?: () => void; + } + + /** + * + * + */ + + function nodeSassMiddleware(options: Options): express.RequestHandler; + + /** + * + */ + namespace nodeSassMiddleware { } + + /** + * + */ + export = nodeSassMiddleware; +} \ No newline at end of file diff --git a/npm-shrinkwrap.json b/npm-shrinkwrap.json index 6dc63bfb0..77fb737ab 100644 --- a/npm-shrinkwrap.json +++ b/npm-shrinkwrap.json @@ -13,9 +13,9 @@ "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-0.3.0.tgz" }, "bluebird": { - "version": "2.10.2", - "from": "bluebird@>=2.10.1 <3.0.0", - "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.10.2.tgz" + "version": "3.1.5", + "from": "bluebird@>=3.1.2 <4.0.0", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.1.5.tgz" }, "brace-expansion": { "version": "1.1.2", @@ -33,19 +33,25 @@ "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz" }, "definition-header": { - "version": "0.1.0", - "from": "definition-header@>=0.1.0 <0.2.0", - "resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.1.0.tgz" + "version": "0.3.0", + "from": "definition-header@>=0.3.0 <0.4.0", + "resolved": "https://registry.npmjs.org/definition-header/-/definition-header-0.3.0.tgz" }, "definition-tester": { - "version": "0.3.0", - "from": "definition-tester@0.3.0", - "resolved": "https://registry.npmjs.org/definition-tester/-/definition-tester-0.3.0.tgz" + "version": "0.4.0", + "from": "definition-tester@0.4.0" }, "findup-sync": { "version": "0.3.0", "from": "findup-sync@>=0.3.0 <0.4.0", - "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz" + "resolved": "https://registry.npmjs.org/findup-sync/-/findup-sync-0.3.0.tgz", + "dependencies": { + "glob": { + "version": "5.0.15", + "from": "glob@>=5.0.0 <5.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz" + } + } }, "git-wrapper": { "version": "0.1.1", @@ -53,14 +59,14 @@ "resolved": "https://registry.npmjs.org/git-wrapper/-/git-wrapper-0.1.1.tgz" }, "glob": { - "version": "5.0.15", - "from": "glob@>=5.0.14 <6.0.0", - "resolved": "https://registry.npmjs.org/glob/-/glob-5.0.15.tgz" + "version": "6.0.4", + "from": "glob@>=6.0.4 <7.0.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-6.0.4.tgz" }, "hoek": { - "version": "2.16.3", - "from": "hoek@>=2.2.0 <3.0.0", - "resolved": "https://registry.npmjs.org/hoek/-/hoek-2.16.3.tgz" + "version": "3.0.4", + "from": "hoek@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/hoek/-/hoek-3.0.4.tgz" }, "inflight": { "version": "1.0.4", @@ -78,18 +84,18 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-0.0.1.tgz" }, "isemail": { - "version": "1.2.0", - "from": "isemail@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/isemail/-/isemail-1.2.0.tgz" + "version": "2.1.0", + "from": "isemail@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/isemail/-/isemail-2.1.0.tgz" }, "joi": { - "version": "4.9.0", - "from": "joi@>=4.0.0 <5.0.0", - "resolved": "https://registry.npmjs.org/joi/-/joi-4.9.0.tgz" + "version": "7.2.2", + "from": "joi@>=7.2.2 <8.0.0", + "resolved": "https://registry.npmjs.org/joi/-/joi-7.2.2.tgz" }, "joi-assert": { "version": "0.0.3", - "from": "joi-assert@0.0.3", + "from": "joi-assert@>=0.0.3 <0.0.4", "resolved": "https://registry.npmjs.org/joi-assert/-/joi-assert-0.0.3.tgz" }, "jsonparse": { @@ -130,9 +136,9 @@ "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz" }, "moment": { - "version": "2.10.6", + "version": "2.11.1", "from": "moment@>=2.0.0 <3.0.0", - "resolved": "https://registry.npmjs.org/moment/-/moment-2.10.6.tgz" + "resolved": "https://registry.npmjs.org/moment/-/moment-2.11.1.tgz" }, "once": { "version": "1.3.3", @@ -145,9 +151,9 @@ "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz" }, "parsimmon": { - "version": "0.5.1", - "from": "parsimmon@>=0.5.0 <0.6.0", - "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.5.1.tgz" + "version": "0.7.0", + "from": "parsimmon@>=0.7.0 <0.8.0", + "resolved": "https://registry.npmjs.org/parsimmon/-/parsimmon-0.7.0.tgz" }, "path-is-absolute": { "version": "1.0.0", @@ -180,9 +186,9 @@ "resolved": "https://registry.npmjs.org/through2/-/through2-0.5.1.tgz" }, "topo": { - "version": "1.1.0", - "from": "topo@>=1.0.0 <2.0.0", - "resolved": "https://registry.npmjs.org/topo/-/topo-1.1.0.tgz" + "version": "2.0.0", + "from": "topo@>=2.0.0 <3.0.0", + "resolved": "https://registry.npmjs.org/topo/-/topo-2.0.0.tgz" }, "type-detect": { "version": "0.1.2", @@ -190,9 +196,9 @@ "resolved": "https://registry.npmjs.org/type-detect/-/type-detect-0.1.2.tgz" }, "typescript": { - "version": "1.7.3", - "from": "typescript@1.7.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.7.3.tgz" + "version": "1.7.5", + "from": "typescript@1.7.5", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-1.7.5.tgz" }, "wordwrap": { "version": "0.0.3", @@ -205,9 +211,9 @@ "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.1.tgz" }, "xregexp": { - "version": "2.0.0", - "from": "xregexp@>=2.0.0 <2.1.0", - "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-2.0.0.tgz" + "version": "3.0.0", + "from": "xregexp@>=3.0.0 <4.0.0", + "resolved": "https://registry.npmjs.org/xregexp/-/xregexp-3.0.0.tgz" }, "xtend": { "version": "3.0.0", diff --git a/package.json b/package.json index 52cc5b719..fc13280e2 100644 --- a/package.json +++ b/package.json @@ -35,7 +35,7 @@ "dependencies": { }, "devDependencies": { - "definition-tester": "0.3.0", - "typescript": "1.7.3" + "definition-tester": "0.4.0", + "typescript": "1.7.5" } } diff --git a/pi-spi/pi-spi-tests.ts b/pi-spi/pi-spi-tests.ts new file mode 100644 index 000000000..9ec08f1ba --- /dev/null +++ b/pi-spi/pi-spi-tests.ts @@ -0,0 +1,29 @@ +/// + +import * as piSPI from 'pi-spi'; + +var spi:piSPI.SPI = piSPI.initialize("test"); +var b:Buffer = new Buffer("Hello, World!"); +var cb = function(error:Error, data:Buffer):void { }; + +spi.bitOrder(piSPI.order.LSB_FIRST); +spi.bitOrder(piSPI.order.MSB_FIRST); +console.log(spi.bitOrder()); + + +spi.dataMode(piSPI.mode.CPHA); +spi.dataMode(piSPI.mode.CPOL); +console.log(spi.dataMode()); + + +spi.clockSpeed(4e6); +console.log(spi.clockSpeed()); + + +spi.write(b, cb); +spi.read(13, cb); + +spi.transfer(b, cb); +spi.transfer(b, 13, cb); + +spi.close(); diff --git a/pi-spi/pi-spi.d.ts b/pi-spi/pi-spi.d.ts new file mode 100644 index 000000000..c535bd0bb --- /dev/null +++ b/pi-spi/pi-spi.d.ts @@ -0,0 +1,46 @@ +// Type definitions for pi-spi +// Project: https://github.com/natevw/pi-spi +// Definitions by: Marcel Ernst +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace __PI_SPI { + + enum mode { + CPHA = 0x01, + CPOL = 0x02 + } + + enum order { + MSB_FIRST = 0, + LSB_FIRST = 1 + } + + function initialize(device:string):__PI_SPI.SPI; + + class SPI { + clockSpeed():number; + clockSpeed(speed:number):void; + + dataMode():number; + dataMode(mode:mode):void; + + bitOrder():number; + bitOrder(order:order):void; + + + write(writebuf:Buffer, cb:(error:Error,data:Buffer) => void):void; + read(readcount:number, cb:(error:Error,data:Buffer) => void):void; + + transfer(writebuf:Buffer, cb:(error:Error,data:Buffer) => void ):void; + transfer(writebuf:Buffer, readcount:number, cb:(error:Error,data:Buffer) => void ):void; + + close():void; + } +} + + +declare module "pi-spi" { + export = __PI_SPI; +} \ No newline at end of file diff --git a/ratelimiter/ratelimiter-tests.ts b/ratelimiter/ratelimiter-tests.ts index 14d42422e..7c2f03eec 100644 --- a/ratelimiter/ratelimiter-tests.ts +++ b/ratelimiter/ratelimiter-tests.ts @@ -1,8 +1,8 @@ /// /// -import redis = require('redis'); -import Limiter = require('ratelimiter'); +import * as redis from 'redis'; +import * as Limiter from 'ratelimiter'; let id: string; let db: redis.RedisClient; diff --git a/ratelimiter/ratelimiter.d.ts b/ratelimiter/ratelimiter.d.ts index 6e9883dd5..4ea3a43fa 100644 --- a/ratelimiter/ratelimiter.d.ts +++ b/ratelimiter/ratelimiter.d.ts @@ -55,5 +55,7 @@ declare module "ratelimiter" { get(fn: (err: any, info: LimiterInfo) => void): void; } + namespace Limiter {} + export = Limiter; } diff --git a/react-router/react-router.d.ts b/react-router/react-router.d.ts index aba062716..abed5eb65 100644 --- a/react-router/react-router.d.ts +++ b/react-router/react-router.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-router v1.0.0 +// Type definitions for react-router v2.0.0-rc5 // Project: https://github.com/rackt/react-router // Definitions by: Sergey Buturlakin , Yuichi Murata , Václav Ostrožlík // Definitions: https://github.com/borisyankov/DefinitelyTyped @@ -110,17 +110,22 @@ declare namespace ReactRouter { const IndexLink: Link - interface RoutingContextProps extends React.Props { - history: H.History + interface RouterContextProps extends React.Props { + history?: H.History + router: Router createElement: (component: RouteComponent, props: Object) => any location: H.Location routes: RouteConfig params: Params components?: RouteComponent[] } - interface RoutingContext extends React.ComponentClass {} - interface RoutingContextElement extends React.ReactElement {} - const RoutingContext: RoutingContext + interface RouterContext extends React.ComponentClass {} + interface RouterContextElement extends React.ReactElement { + history?: H.History + location: H.Location + router?: Router + } + const RouterContext: RouterContext /* components (configuration) */ @@ -335,9 +340,9 @@ declare module "react-router/lib/RouteUtils" { } -declare module "react-router/lib/RoutingContext" { +declare module "react-router/lib/RouterContext" { - export default ReactRouter.RoutingContext + export default ReactRouter.RouterContext } @@ -418,7 +423,7 @@ declare module "react-router" { import { formatPattern } from "react-router/lib/PatternUtils" - import RoutingContext from "react-router/lib/RoutingContext" + import RouterContext from "react-router/lib/RouterContext" import PropTypes from "react-router/lib/PropTypes" @@ -459,7 +464,7 @@ declare module "react-router" { useRoutes, createRoutes, formatPattern, - RoutingContext, + RouterContext, PropTypes, match } diff --git a/react/react.d.ts b/react/react.d.ts index aba285158..e9b88dde2 100644 --- a/react/react.d.ts +++ b/react/react.d.ts @@ -515,6 +515,8 @@ declare namespace __React { */ backgroundBlendMode?: any; + backgroundColor?: any; + backgroundComposite?: any; /** diff --git a/redis/redis.d.ts b/redis/redis.d.ts index 723cb2701..ad38f95cb 100644 --- a/redis/redis.d.ts +++ b/redis/redis.d.ts @@ -359,6 +359,9 @@ declare module "redis" { eval(...args:any[]): boolean; evalsha(args:any[], callback?:ResCallbackT): boolean; evalsha(...args:any[]): boolean; + script(args:any[], callback?:ResCallbackT): boolean; + script(...args: any[]): boolean; + script(key: string, callback?: ResCallbackT): boolean; quit(args:any[], callback?:ResCallbackT): boolean; quit(...args:any[]): boolean; } diff --git a/ss-utils/ss-utils-tests.ts b/ss-utils/ss-utils-tests.ts new file mode 100644 index 000000000..52ac7151b --- /dev/null +++ b/ss-utils/ss-utils-tests.ts @@ -0,0 +1,81 @@ +/// +/// + +declare var EventSource : sse.IEventSourceStatic; + +declare module sse { + interface IEventSourceStatic extends EventTarget { + new (url: string, eventSourceInitDict?: IEventSourceInit):IEventSourceStatic; + url: string; + } + + interface IEventSourceInit { + withCredentials?: boolean; + } +} + +function test_ssutils() { + $.ss.eventReceivers = { "document": document }; + + var source = new EventSource("/event-stream?channels=home,work"); + $(source).handleServerEvents({ + handlers: { + onConnect: function(connect:ssutils.SSEConnect) {}, + onHeartbeat: function(msg:ssutils.SSEHeartbeat, e:MessageEvent){}, + onJoin: function(msg:ssutils.SSEJoin) {}, + onLeave: function(msg:ssutils.SSELeave) {} + }, + receivers: { + tv: { + watch: function(){} + } + } + }); + + $(document).bindHandlers({ + announce: function (msg:string) {} + }) + .on('customEvent', function (e, msg, msgEvent) { }); + + $.ss.handlers["changeChannel"]("home"); +} + +function test_jQuery_functions(){ + $("document").setFieldError("name","message"); + var map = $("form").serializeMap(); + $("form").applyErrors({errorCode:"",message:"",stackTrace:"",errors:[]}); + $("form").clearErrors(); + $("form").bindForm({ + overrideMessages: true, + messages: {"NotFound": "Not Found"}, + errorFilter: function(errorMsg, errorCode, type){} + }); + $("form").applyValues({ + "Key": "Value" + }); + $("form").bindHandlers({ + "test": function() {} + }); +} + +function test_ssutils_Static(){ + $.ss.handlers["key"] = () => 0; + $.ss.onSubmitDisable = "class"; + $.ss.validation.messages["Code"] = "Message"; + $.ss.clearAdjacentError(); + var date:Date = $.ss.todate("2001-01-01"); + var dateFmt:String = $.ss.todfmt("2001-01-01"); + dateFmt = $.ss.dfmt(new Date(2001,1,1)); + dateFmt = $.ss.dfmthm(new Date(2001,1,1)); + dateFmt = $.ss.tfmt12(new Date(2001,1,1)); + var parts:string[] = $.ss.splitOnFirst("A,B,C"); + parts = $.ss.splitOnLast("A,B,C"); + var selectedText = $.ss.getSelection(); + var qs:{ [index: string]: string } = $.ss.queryString("http://google.com?a=b&c=d"); + var relativePath = $.ss.createUrl("/path/to/{File}", {File:"file.js"}); + var readableText = $.ss.humanize("TheVariableName"); + + $.ss.listenOn = "click onmousedown"; + $.ss.eventReceivers = { "document": document }; + $.ss.handlers["changeChannel"]("home"); +} \ No newline at end of file diff --git a/ss-utils/ss-utils.d.ts b/ss-utils/ss-utils.d.ts new file mode 100644 index 000000000..3d6ddfbf4 --- /dev/null +++ b/ss-utils/ss-utils.d.ts @@ -0,0 +1,122 @@ +// Type definitions for ServiceStack Utils v0.0.1 +// Project: https://servicestack.net/ +// Definitions by: Demis Bellot +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare namespace ssutils { + + interface Static { + handlers: { [index: string]: Function }; + onSubmitDisable: string; + validation: Validation; + clearAdjacentError: () => void; + todate: (s: string) => Date; + todfmt: (s: string) => string; + dfmt: (d: Date) => string; + dfmthm: (d: Date) => string; + tfmt12: (d: Date) => string; + splitOnFirst: (s: string) => string[]; + splitOnLast: (s: string) => string[]; + getSelection: () => string; + queryString: (url: string) => { [index: string]: string }; + createUrl: (route: string, args?: any) => string; + humanize: (s: string) => string; + + listenOn: string; + eventReceivers: any; + reconnectServerEvents: (opt: ReconnectServerEventsOptions) => any; + } + + interface Validation { + overrideMessages: boolean; + messages: { [index: string]: string }; + errorFilter: (errorMsg: string, errorCode: string, type: string) => void; + } + + interface ValidationOptional { + overrideMessages?: boolean; + messages?: { [index: string]: string }; + errorFilter?: (errorMsg: string, errorCode: string, type: string) => void; + } + + interface ApplyErrorsOptions extends ValidationOptional { + } + + interface BindFormOptions { + validation?: ValidationOptional; + validate?: (form: HTMLFormElement) => boolean; + onSubmitDisable?: string; + complete?: (...args: any[]) => void; + error?: (...args: any[]) => void; + } + + interface HandleServerEventsOptions { + handlers?: { [index: string]: Function }; + validate?: (op?: string, target?: string, msg?: string, json?: string) => boolean; + heartbeatUrl?: string; + heartbeatIntervalMs?: number; + unRegisterUrl?: string; + receivers?: { [index: string]: any }; + success?: (selector: string, msg: string, e: any) => void; + } + + interface ResponseStatus { + errorCode: string; + message: string; + stackTrace: string; + errors: ResponseError[]; + } + interface ResponseError { + errorCode: string; + fieldName: string; + message: string; + } + + interface SSECommand { + userId: string; + displayName: string; + channels: string; + profileUrl: string; + } + + interface SSEHeartbeat extends SSECommand { } + interface SSEJoin extends SSECommand { } + interface SSELeave extends SSECommand { } + + interface SSEConnect extends SSECommand { + id: string; + unRegisterUrl: string; + heartbeatUrl: string; + heartbeatIntervalMs: number; + idleTimeoutMs: number; + } + + interface ReconnectServerEventsOptions { + url?: string; + onerror?: (...args: any[]) => void; + onmessage?: (...args: any[]) => void; + errorArgs: any[]; + } +} + +interface JQuery { + setFieldError: (name: string, msg: string) => void; + serializeMap: () => { [index: string]: any }; + applyErrors: (status: ssutils.ResponseStatus, opt?: ssutils.ApplyErrorsOptions) => JQuery; + clearErrors: () => JQuery; + bindForm: (opt?: ssutils.ApplyErrorsOptions) => JQuery; + applyValues: (values: { [index: string]: string }) => JQuery; + bindHandlers: (handlers: { [index: string]: Function }) => JQuery; + setActiveLinks: () => JQuery; + handleServerEvents: (opt?: ssutils.HandleServerEventsOptions) => void; +} + +interface JQueryStatic { + ss: ssutils.Static; +} + +declare module "ss-utils" { + export = ssutils; +} \ No newline at end of file diff --git a/threejs/three.d.ts b/threejs/three.d.ts index 8c637d4bf..65759e909 100644 --- a/threejs/three.d.ts +++ b/threejs/three.d.ts @@ -1410,9 +1410,9 @@ declare module THREE { */ scale: Vector3; - modelViewMatrix: { value: Matrix4 }; + modelViewMatrix: Matrix4; - normalMatrix: { value: Matrix3 }; + normalMatrix: Matrix3; /** * When this is set, then the rotationMatrix gets calculated every frame. diff --git a/traverse/traverse-tests.ts b/traverse/traverse-tests.ts new file mode 100644 index 000000000..bc5bfa87c --- /dev/null +++ b/traverse/traverse-tests.ts @@ -0,0 +1,40 @@ +/// + +import traverse = require('traverse'); + +function testForEach(){ + var obj = [ 5, 6, -3, [ 7, 8, -2, 1 ], { f : 10, g : -13 } ]; + + traverse(obj).forEach(function (x) { + if (x < 0) this.update(x + 128); + }); + + console.dir(obj); +} + +function testReduce(){ + var obj = { + a : [1,2,3], + b : 4, + c : [5,6], + d : { e : [7,8], f : 9 }, + }; + + var leaves = traverse(obj).reduce(function (acc, x) { + if (this.isLeaf) acc.push(x); + return acc; + }, []); + + console.dir(leaves); +} + +function testMap(){ + var c: any[] = [3, 4]; + var obj = { a : 1, b : 2, c : c }; + obj.c.push(obj); + + var scrubbed = traverse(obj).map(function (x) { + if (this.circular) this.remove() + }); + console.dir(scrubbed); +} diff --git a/traverse/traverse.d.ts b/traverse/traverse.d.ts new file mode 100644 index 000000000..c45c3db03 --- /dev/null +++ b/traverse/traverse.d.ts @@ -0,0 +1,22 @@ +// Type definitions for traverse 0.6.6 +// Project: https://github.com/substack/js-traverse +// Definitions by: newclear +// Definitions: https://github.com/newclear/DefinitelyTyped + +declare module "traverse" { + interface Traverse { + get(paths: string[]): any; + has(paths: string[]): boolean; + set(paths: string[], value: any): any; + map(cb: (v: any) => void): any; + forEach(cb: (v: any) => void): any; + reduce(cb: (acc: any, v: any) => void, init?: any): any; + paths(): string[]; + nodes(): any[]; + clone(): any; + } + + function traverse(obj: any): Traverse; + + export = traverse; +} diff --git a/vinyl-source-stream/vinyl-source-stream.d.ts b/vinyl-source-stream/vinyl-source-stream.d.ts index cf5f8082a..0a6d663c6 100644 --- a/vinyl-source-stream/vinyl-source-stream.d.ts +++ b/vinyl-source-stream/vinyl-source-stream.d.ts @@ -7,5 +7,6 @@ declare module "vinyl-source-stream" { function vinylSourceStream(filename: string): NodeJS.ReadWriteStream; + namespace vinylSourceStream {} export = vinylSourceStream; -} \ No newline at end of file +} diff --git a/webrtc/MediaStream.d.ts b/webrtc/MediaStream.d.ts index 37b605592..a7bebb857 100644 --- a/webrtc/MediaStream.d.ts +++ b/webrtc/MediaStream.d.ts @@ -174,6 +174,9 @@ interface NavigatorGetUserMedia { errorCallback: (error: MediaStreamError) => void): void; } +// to use with adapter.js, see: https://github.com/webrtc/adapter +declare var getUserMedia: NavigatorGetUserMedia; + interface Navigator { getUserMedia: NavigatorGetUserMedia; diff --git a/webrtc/RTCPeerConnection-tests.ts b/webrtc/RTCPeerConnection-tests.ts index f25ad81df..b85c61806 100644 --- a/webrtc/RTCPeerConnection-tests.ts +++ b/webrtc/RTCPeerConnection-tests.ts @@ -1,8 +1,8 @@ -/// +/// /// var config: RTCConfiguration = - { iceServers: [{ url: "stun.l.google.com:19302" }] }; + { iceServers: [{ urls: "stun.l.google.com:19302" }] }; var constraints: RTCMediaConstraints = { mandatory: { offerToReceiveAudio: true, offerToReceiveVideo: true } }; diff --git a/webrtc/RTCPeerConnection.d.ts b/webrtc/RTCPeerConnection.d.ts index 0e186fd27..661b9685b 100644 --- a/webrtc/RTCPeerConnection.d.ts +++ b/webrtc/RTCPeerConnection.d.ts @@ -29,7 +29,7 @@ declare var RTCConfiguration: { }; interface RTCIceServer { - url: string; + urls: string; credential?: string; } declare var RTCIceServer: { diff --git a/winreg/winreg.d.ts b/winreg/winreg.d.ts index 459a6e780..0b23f6981 100644 --- a/winreg/winreg.d.ts +++ b/winreg/winreg.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Winreg v0.0.15 +// Type definitions for Winreg v0.0.16 // Project: https://github.com/fresc81/node-winreg/ // Definitions by: RX14 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -122,6 +122,12 @@ interface Winreg { */ path: string; + /** + * Architecture this key belongs to. + * @readonly + */ + arch: string; + /** * A new Winreg instance of the parent key. * @readonly @@ -198,7 +204,12 @@ declare namespace Winreg { /** * Optional key, default is the root key. */ - key?: String; + key?: string; + + /** + * Optional architecture of the registry. + */ + arch?: string; } /** @@ -240,6 +251,12 @@ declare namespace Winreg { * @readonly */ value: string; + + /** + * Architecture this value belongs to. + * @readonly + */ + arch: string; } }