diff --git a/README.md b/README.md index fd34c4ae33..a822c69c47 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,9 @@ Your package should have this structure: | tsconfig.json | This allows you to run `tsc` within the package. | | tslint.json | Enables linting. | -Generate these by running `npm run new-package -- new-package-name`. +Generate these by running `npm run new-package -- --name my-package-name --template module`. +(Other templates are `module-class`, `module-function`, `module-plugin`, `global`, `global-plugin`, and `global-modifying-module`. +This just wraps [dts-gen](https://github.com/Microsoft/dts-gen), so it supports all options from that.) You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option. diff --git a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts index b14af506b6..15f0f2b661 100644 --- a/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts +++ b/angular-ui-bootstrap/angular-ui-bootstrap-tests.ts @@ -155,6 +155,7 @@ testApp.config(( placement: 'bottom', animation: false, popupDelay: 1000, + popupCloseDelay: 1000, appendToBody: true, trigger: 'mouseenter hover', useContentExp: true, diff --git a/angular-ui-bootstrap/index.d.ts b/angular-ui-bootstrap/index.d.ts index b5b4e1a5e6..bc80d96b5a 100644 --- a/angular-ui-bootstrap/index.d.ts +++ b/angular-ui-bootstrap/index.d.ts @@ -161,7 +161,7 @@ declare module 'angular' { /** * Defines the initial date, when no model value is specified. - * + * * @default null */ initDate?: any; @@ -834,12 +834,19 @@ declare module 'angular' { animation?: boolean; /** - * For how long should the user have to have the mouse over the element before the tooltip shows (in milliseconds)? + * Popup delay in milliseconds until it opens. * * @default 0 */ popupDelay?: number; + /** + * For how long should the tooltip remain open after the close trigger event? + * + * @default 0 + */ + popupCloseDelay?: number; + /** * Should the tooltip be appended to `$body` instead of the parent element? * diff --git a/auth0-js/auth0-js-tests.ts b/auth0-js/auth0-js-tests.ts index 68d4e1797b..7c910d1765 100644 --- a/auth0-js/auth0-js-tests.ts +++ b/auth0-js/auth0-js-tests.ts @@ -1,4 +1,4 @@ -/// +import 'auth0-js'; let webAuth = new auth0.WebAuth({ domain: 'mine.auth0.com', diff --git a/auth0-js/index.d.ts b/auth0-js/index.d.ts index 0a0e004303..11cf16a3ed 100644 --- a/auth0-js/index.d.ts +++ b/auth0-js/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Auth0.js v8.1.3 +// Type definitions for Auth0.js 8.1 // Project: https://github.com/auth0/auth0.js // Definitions by: Adrian Chia // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -409,7 +409,7 @@ declare namespace auth0 { interface Auth0Error { error: any; - errorDescription: string + errorDescription: string; } interface Auth0DecodedHash { @@ -442,7 +442,7 @@ declare namespace auth0 { connection: string; send: string; phoneNumber?: string; - email?: string, + email?: string; authParams?: any; } diff --git a/auth0-js/tsconfig.json b/auth0-js/tsconfig.json index a2e16e19e0..62bab1e208 100644 --- a/auth0-js/tsconfig.json +++ b/auth0-js/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "auth0-js-tests.ts" ] -} \ No newline at end of file +} diff --git a/auth0-js/v7/auth0-js-tests.ts b/auth0-js/v7/auth0-js-tests.ts index d5ca0250d4..a68b17cb69 100644 --- a/auth0-js/v7/auth0-js-tests.ts +++ b/auth0-js/v7/auth0-js-tests.ts @@ -1,4 +1,5 @@ -/// +import 'auth0-js'; + var auth0 = new Auth0({ domain: 'mine.auth0.com', clientID: 'dsa7d77dsa7d7', diff --git a/auth0-js/v7/index.d.ts b/auth0-js/v7/index.d.ts index ee834d5c61..a93e979f2b 100644 --- a/auth0-js/v7/index.d.ts +++ b/auth0-js/v7/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Auth0.js v7.x +// Type definitions for Auth0.js 7.0 // Project: https://github.com/auth0/auth0.js // Definitions by: Robert McLaws // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -13,20 +13,20 @@ interface Window { interface Auth0Static { new(options: Auth0ClientOptions): Auth0Static; - changePassword(options: any, callback?: Function): void; + changePassword(options: any, callback?: (error?: Auth0Error, valid?: any) => void): void; decodeJwt(jwt: string): any; login(options: any, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; loginWithPopup(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; loginWithResourceOwner(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: any) => any): void; loginWithUsernamePassword(options: Auth0LoginOptions, callback: (error?: Auth0Error, profile?: Auth0UserProfile, id_token?: string, access_token?: string, state?: string) => any): void; logout(query: string): void; - getConnections(callback?: Function): void; + getConnections(callback?: (error?: Auth0Error, valid?: any) => void): void; refreshToken(refreshToken: string, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; getDelegationToken(options: any, callback: (error?: Auth0Error, delegationResult?: Auth0DelegationToken) => any): void; - getProfile(id_token: string, callback?: Function): Auth0UserProfile; - getSSOData(withActiveDirectories: any, callback?: Function): void; + getProfile(id_token: string, callback?: (error?: Auth0Error, valid?: any) => void): Auth0UserProfile; + getSSOData(withActiveDirectories: any, callback?: (error?: Auth0Error, valid?: any) => void): void; parseHash(hash: string): Auth0DecodedHash; - signup(options: Auth0SignupOptions, callback: Function): void; + signup(options: Auth0SignupOptions, callback: (error?: Auth0Error, valid?: any) => void): void; validateUser(options: any, callback: (error?: Auth0Error, valid?: any) => any): void; } @@ -132,5 +132,5 @@ interface Auth0DelegationToken { declare const Auth0: Auth0Static; declare module "auth0-js" { - export = Auth0 + export = Auth0; } diff --git a/auth0-js/v7/tsconfig.json b/auth0-js/v7/tsconfig.json index 7413e97f44..bdabf7ef7f 100644 --- a/auth0-js/v7/tsconfig.json +++ b/auth0-js/v7/tsconfig.json @@ -12,12 +12,11 @@ "typeRoots": [ "../../" ], - "paths": { - "auth0-js": [ - "auth0-js/v7" - ] - }, "types": [], + "paths": { + "auth0-js": ["auth0-js/v7"], + "auth0-js/*": ["auth0-js/v7/*"] + }, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/auth0-lock/auth0-lock-tests.ts b/auth0-lock/auth0-lock-tests.ts index 4b72edcfa1..8045386586 100644 --- a/auth0-lock/auth0-lock-tests.ts +++ b/auth0-lock/auth0-lock-tests.ts @@ -1,5 +1,5 @@ -/// -/// +import 'auth0-js/v7'; +import Auth0Lock from 'auth0-lock'; const CLIENT_ID = "YOUR_AUTH0_APP_CLIENTID"; const DOMAIN = "YOUR_DOMAIN_AT.auth0.com"; diff --git a/auth0-lock/package.json b/auth0-lock/package.json new file mode 100644 index 0000000000..2d730992af --- /dev/null +++ b/auth0-lock/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@types/auth0-js": "latest" + } +} diff --git a/auth0-lock/tsconfig.json b/auth0-lock/tsconfig.json index 367445041e..09c9f8233c 100644 --- a/auth0-lock/tsconfig.json +++ b/auth0-lock/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "auth0-lock-tests.ts" ] -} \ No newline at end of file +} diff --git a/auth0.widget/auth0.widget-tests.ts b/auth0.widget/auth0.widget-tests.ts index 6277d4cc3a..f2ddda2146 100644 --- a/auth0.widget/auth0.widget-tests.ts +++ b/auth0.widget/auth0.widget-tests.ts @@ -1,5 +1,4 @@ -/// - +import 'auth0-js/v7'; var widget: Auth0WidgetStatic = new Auth0Widget({ domain: 'mine.auth0.com', diff --git a/auth0.widget/index.d.ts b/auth0.widget/index.d.ts index cdefd9e0fd..36d99c9009 100644 --- a/auth0.widget/index.d.ts +++ b/auth0.widget/index.d.ts @@ -5,7 +5,6 @@ /// - interface Auth0WidgetStatic { new(params: Auth0Constructor): Auth0WidgetStatic; diff --git a/auth0.widget/package.json b/auth0.widget/package.json new file mode 100644 index 0000000000..2d730992af --- /dev/null +++ b/auth0.widget/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "@types/auth0-js": "latest" + } +} diff --git a/auth0.widget/tsconfig.json b/auth0.widget/tsconfig.json index 7bba7e763f..8ceb7b3d73 100644 --- a/auth0.widget/tsconfig.json +++ b/auth0.widget/tsconfig.json @@ -19,4 +19,4 @@ "index.d.ts", "auth0.widget-tests.ts" ] -} \ No newline at end of file +} diff --git a/basic-auth/index.d.ts b/basic-auth/index.d.ts index 3dc19b3046..51ada3b0c7 100644 --- a/basic-auth/index.d.ts +++ b/basic-auth/index.d.ts @@ -3,9 +3,11 @@ // Definitions by: Clément Bourgeois // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -import * as Express from 'express'; +/// -declare function auth(req: Express.Request): auth.BasicAuthResult; +import * as http from 'http'; + +declare function auth(req: http.IncomingMessage): auth.BasicAuthResult; declare namespace auth { interface BasicAuthResult { diff --git a/bezier-js/bezier-js-tests.ts b/bezier-js/bezier-js-tests.ts index 5776ffd307..f5fba4d947 100644 --- a/bezier-js/bezier-js-tests.ts +++ b/bezier-js/bezier-js-tests.ts @@ -10,7 +10,7 @@ function test() { var utils = bezier.getUtils(); var line: BezierJs.Line = { p1: { x: 0, y: 0 }, p2: { x: 1, y: 1 } }; var abc: BezierJs.ABC = { A: null, B: null, C: null }; - var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1 }; + var arc: BezierJs.Arc = { e: 0, s: 0, x: 0, y: 0, r: 1, interval:{ start: 0, end: 1 } }; var bbox: BezierJs.BBox = bezier.bbox(); var closest: BezierJs.Closest = { mdist: 1, mpos: 0 }; var inflection: BezierJs.Inflection = { values: null, x: [0], y: [0], z: [0] }; @@ -95,4 +95,4 @@ function test() { utils.round(.999, .001); utils.shapeintersections(shape, bbox, shape, bbox); -} \ No newline at end of file +} diff --git a/bezier-js/index.d.ts b/bezier-js/index.d.ts index ff07e67f16..7706a46472 100644 --- a/bezier-js/index.d.ts +++ b/bezier-js/index.d.ts @@ -51,6 +51,7 @@ declare namespace BezierJs { e: number; r: number; s: number; + interval: { start: number; end: number; }; } interface Shape { startcap: BezierCap; diff --git a/cordova_app_version_plugin/README.md b/cordova_app_version_plugin/README.md new file mode 100644 index 0000000000..a12ccb5267 --- /dev/null +++ b/cordova_app_version_plugin/README.md @@ -0,0 +1,8 @@ +# Installation +> `npm install --save-dev @types/cordova_app_version_plugin` + +# Summary +This package contains type definitions for cordova_app_version_plugin (https://www.npmjs.com/package/cordova_app_version_plugin) + +# Details +Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/cordova_app_version_plugin diff --git a/cordova_app_version_plugin/cordova_app_version_plugin-tests.ts b/cordova_app_version_plugin/cordova_app_version_plugin-tests.ts new file mode 100644 index 0000000000..5e4eb16e66 --- /dev/null +++ b/cordova_app_version_plugin/cordova_app_version_plugin-tests.ts @@ -0,0 +1,3 @@ +/// + +var appVersion = window.cordova.plugins.version.getAppVersion(); // e.g. "1.5.0" diff --git a/cordova_app_version_plugin/index.d.ts b/cordova_app_version_plugin/index.d.ts new file mode 100644 index 0000000000..b8a70216a6 --- /dev/null +++ b/cordova_app_version_plugin/index.d.ts @@ -0,0 +1,26 @@ +// Type definitions for cordova_app_version_plugin v0.2.6 +// Project: https://www.npmjs.com/package/cordova_app_version_plugin +// Definitions by: Larry Bahr +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// +// Licensed under the MIT license. + +interface CordovaPlugins { + /** + * cordova_app_version_plugin interface + */ + version: CordovaAppVersionPlugin.CordovaAppVersionPlugin; +} + +/** + * Keep the type global namespace clean by using a module + */ +declare module CordovaAppVersionPlugin { + interface CordovaAppVersionPlugin { + /** + * App version from config.xml's version (e.g. ) + * @example window.cordova.plugins.version.getAppVersion() // e.g: "1.5.0" + */ + getAppVersion(): string; + } +} \ No newline at end of file diff --git a/cordova_app_version_plugin/tsconfig.json b/cordova_app_version_plugin/tsconfig.json new file mode 100644 index 0000000000..62f656037c --- /dev/null +++ b/cordova_app_version_plugin/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cordova_app_version_plugin-tests.ts" + ] +} \ No newline at end of file diff --git a/cucumber/cucumber-tests.ts b/cucumber/cucumber-tests.ts index dd92ee7c19..87089671ae 100644 --- a/cucumber/cucumber-tests.ts +++ b/cucumber/cucumber-tests.ts @@ -9,6 +9,12 @@ function StepSample() { var step = this; var hook = this; + hook.setWorldConstructor(function() { + this.visit = function(url: string, callback: Callback) { + callback(null, 'pending'); + } + }) + hook.Before(function(scenario: HookScenario, callback: Callback){ scenario.isFailed() && callback.pending(); }); diff --git a/cucumber/index.d.ts b/cucumber/index.d.ts index 154e6707cc..8c56e3aae4 100644 --- a/cucumber/index.d.ts +++ b/cucumber/index.d.ts @@ -69,6 +69,7 @@ declare namespace cucumber { After(code: HookCode): void; Around(code: AroundCode):void; setDefaultTimeout(time:number): void; + setWorldConstructor(world: () => void): void; registerHandler(handlerOption:string, code:(event:any, callback:CallbackStepDefinition) =>void): void; registerListener(listener: EventListener): void; } diff --git a/hapi-decorators/hapi-decorators-tests.ts b/hapi-decorators/hapi-decorators-tests.ts index 2a05f67e4d..49a112152a 100644 --- a/hapi-decorators/hapi-decorators-tests.ts +++ b/hapi-decorators/hapi-decorators-tests.ts @@ -39,3 +39,18 @@ class TestController implements Controller { const server = new hapi.Server(); server.route(new TestController().routes()); + +@controller('/test') +class SimpleTestController implements Controller { + + foo: string; + + constructor(foo: string) { + this.foo = foo; + } + + baseUrl: string; + routes: () => hapi.IRouteConfiguration[]; +} + +server.route(new SimpleTestController('bar').routes()); diff --git a/hapi-decorators/index.d.ts b/hapi-decorators/index.d.ts index c58a1a6052..fc32ae8ad5 100644 --- a/hapi-decorators/index.d.ts +++ b/hapi-decorators/index.d.ts @@ -5,7 +5,7 @@ import * as hapi from 'hapi'; interface ControllerStatic { - new (): Controller; + new (...args: any[]): Controller; } export interface Controller { baseUrl: string; diff --git a/jasmine/package.json b/jasmine/package.json new file mode 100644 index 0000000000..7e47d54c61 --- /dev/null +++ b/jasmine/package.json @@ -0,0 +1,5 @@ +{ + "dependencies": { + "typescript": ">=2.1.4" + } +} \ No newline at end of file diff --git a/jsdom/index.d.ts b/jsdom/index.d.ts index a7d8e1d58b..0f272a7c35 100644 --- a/jsdom/index.d.ts +++ b/jsdom/index.d.ts @@ -89,7 +89,7 @@ export interface DocumentWithParentWindow extends Document { * equivalent to what a browser will give if you open up an empty .html file. * @param options see the explanation of the config object above. */ -export declare function jsdom(markup: string, config?: Config): DocumentWithParentWindow; +export declare function jsdom(markup?: string, config?: Config): DocumentWithParentWindow; /** * Before creating any documents, you can modify the defaults for all future documents: diff --git a/koa-hbs/index.d.ts b/koa-hbs/index.d.ts index 8adfeaf20f..51c609e296 100644 --- a/koa-hbs/index.d.ts +++ b/koa-hbs/index.d.ts @@ -1,22 +1,21 @@ -// Type definitions for koa-favicon v2.x +// Type definitions for koa-hbs v1.x // Project: https://github.com/gilt/koa-hbs -// Definitions by: Jacob Malone +// Definitions by: Jacob Malone , Mudkip // Definitions: https://github.com/jcbmln/DefinitelyTyped /* =================== USAGE =================== - import * as Hbs from "koa-hbs"; import * as Koa from "koa"; +....import hbs = require("koa-hbs"); - var hbs = new Hbs(); var app = new Koa(); app.use(hbs.middleware({ viewPath: __dirname + '/views' })); - app.use(function *() { - yield this.render('main', { + app.use(async (ctx, next) => { + await ctx.render('main', { title: 'koa-hbs' }); }); @@ -25,31 +24,33 @@ /// -declare module "koa-hbs" { +import * as Koa from "koa"; - import * as Koa from "koa"; - - namespace Hbs { - export interface Middleware { - viewPath: Array | string, - handlebars?: Function, - templateOptions?: {}, - extname?: string, - partialsPath?: Array | string, - defaultLayout?: string, - layoutsPath?: string, - contentHelperName?: string, - blockHelperName?: string, - disableCache?: boolean - } +declare namespace Hbs { + export interface Middleware { + viewPath: Array | string, + handlebars?: Function, + templateOptions?: {}, + extname?: string, + partialsPath?: Array | string, + defaultLayout?: string, + layoutsPath?: string, + contentHelperName?: string, + blockHelperName?: string, + disableCache?: boolean } - - class Hbs { - constructor(); - - middleware(opts: Hbs.Middleware): any; - } - - namespace Hbs {} - export = Hbs; } + +declare class Hbs { + constructor(); + middleware(opts: Hbs.Middleware): any; +} + +declare const hbs: Hbs; +export = hbs; + +declare module "koa" { + export interface Context extends Request, Response { + render(tpl: string, locals?: {[key: string]: any}): Promise; + } +} \ No newline at end of file diff --git a/koa-hbs/koa-hbs-tests.ts b/koa-hbs/koa-hbs-tests.ts index 647eee7f22..3c86a51cad 100644 --- a/koa-hbs/koa-hbs-tests.ts +++ b/koa-hbs/koa-hbs-tests.ts @@ -1,16 +1,15 @@ -import * as Hbs from 'koa-hbs'; import * as Koa from 'koa'; +import hbs = require("koa-hbs"); import * as Path from 'path'; const app = new Koa(); -const hbs = new Hbs(); app.use(hbs.middleware({ viewPath: Path.join(__dirname, './views') })); -app.use(function *(next: any) { - yield this.render('index', { +app.use(async (ctx, next) => { + await ctx.render('index', { title: 'Hello World!' }); }); diff --git a/material-ui/index.d.ts b/material-ui/index.d.ts index a2661455f8..c399116482 100644 --- a/material-ui/index.d.ts +++ b/material-ui/index.d.ts @@ -130,6 +130,7 @@ declare namespace __MaterialUI { accent2Color?: string; accent3Color?: string; textColor?: string; + secondaryTextColor?: string; alternateTextColor?: string; canvasColor?: string; borderColor?: string; diff --git a/materialize-css/index.d.ts b/materialize-css/index.d.ts index ea844d959f..8b4c610e13 100644 --- a/materialize-css/index.d.ts +++ b/materialize-css/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for materialize-css v0.97.5 +// Type definitions for materialize-css v0.98.0 // Project: http://materializecss.com/ -// Definitions by: Erik Lieben , Leon Yu +// Definitions by: Erik Lieben , Leon Yu , Sukhdeep Singh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -15,7 +15,7 @@ declare namespace Materialize { /** * A setting that changes the collapsible behavior to expandable instead of the default accordion style */ - accordion: boolean; + accordion?: boolean; /** * Callback for Collapsible section close. @@ -34,7 +34,23 @@ declare namespace Materialize { /** * The delay before the tooltip shows (in milliseconds) */ - delay:number; + delay: number; + /** + * Tooltip text. Can use custom HTML if you set the html option + */ + tooltip?: string; + /** + * Set the direction of the tooltip. 'top', 'right', 'bottom', 'left'. + * + * (Default: 'bottom') + */ + position?: string; + /** + * Allow custom html inside the tooltip. + * + * (Default: false) + */ + html?: boolean; } /** @@ -46,43 +62,49 @@ declare namespace Materialize { * The duration of the transition enter in milliseconds. * Default: 300 */ - inDuration?:number; + inDuration?: number; /** * The duration of the transition out in milliseconds. * Default: 225 */ - outDuration?:number; + outDuration?: number; + - // TODO: constrain_width /** * If true, constrainWidth to the size of the dropdown activator. * Default: true */ - constrain_width?:boolean; + constrainWidth?: boolean; /** * If true, the dropdown will open on hover. * Default: false */ - hover?:boolean; + hover?: boolean; /** * This defines the spacing from the aligned edge. * Default: 0 */ - gutter?:number; + gutter?: number; /** * If true, the dropdown will show below the activator. * Default: false */ - belowOrigin?:boolean; + belowOrigin?: boolean; /** * Defines the edge the menu is aligned to. * Default: 'left' */ - alignment?:string; + alignment?: string; + /** + * If true, stops the event propagating from the dropdown origin click handler. + * + * Default: false + */ + stopPropagation?: boolean } /** @@ -120,10 +142,10 @@ declare namespace Materialize { */ interface CarouselOptions { /** - * Transition time. + * Transition duration in milliseconds * Default: 200 */ - time_constant?: number; + duration?: number; /** * Perspective zoom. If 0, all items are the same size. @@ -147,13 +169,25 @@ declare namespace Materialize { * Set the width of the carousel. * Default: false */ - full_width?: boolean; + fullWidth?: boolean; + /** + * Set to true to show indicators. + * + * Default: false + */ + indicators?: boolean; + /** + * Don't wrap around and cycle through items. + * + * Default: false + */ + noWrap?: boolean; } /** - * The lean modal options + * The modal options */ - interface LeanModalOptions { + interface ModalOptions { /** * Modal can be dismissed by clicking outside of the modal. @@ -171,13 +205,23 @@ declare namespace Materialize { * Transition in duration. * Default: 300 */ - in_duration?: number; + inDuration?: number; /** * Transition out duration. * Default: 200 */ - out_duration?: number; + outDuration?: number; + /** + * Starting top style attribute + * Default: `4%` + */ + startingTop?: string; + /** + * Ending top style attribute + * Default : `10%` + */ + endingTop?: string; /** * Callback for Modal open. @@ -201,19 +245,19 @@ declare namespace Materialize { * The distance in pixels from the top of the page where the element becomes fixed. * Default: 0 */ - top?:number; + top?: number; /** * The distance in pixels from the top of the page where the elements stops being fixed. * Default: Infinity */ - bottom?:number; + bottom?: number; /** * The offset from the top the element will be fixed at. * Default: 0 */ - offset?:number; + offset?: number; } /** @@ -273,44 +317,97 @@ declare namespace Materialize { * It will only be called once. * Example: 'console.log("hello, world!")'; */ - callback?: string; + callback?: Function; } + interface TabOptions { /** + * Execute a callback function when the tab is changed. + * + * The callback provides a parameter which refers to the current tab being shown. + */ + onShow?: Function; + + /** + * Set to true to enable swipeable tabs. This also uses the responsiveThreshold option. + * + * Default: false + */ + swipeable?: boolean; + + /** + * The maximum width of the screen, in pixels, where the swipeable functionality initializes. + * + * Default: Infinity + */ + responsiveThreshold?: number; + } + + interface ChipDataObject { + tag: string, + image?: string, + id?: number + } + + interface ChipOptions { + /** + * Set the chip data + */ + data?: Materialize.ChipDataObject[]; + /** + * Set first placeholder when there are no tags + */ + placeholder?: string; + /** + * Set second placeholder when adding additional tags. + */ + secondaryPlaceholder?: string; + /** + * Set autocomplete data. + */ + autocompleteData?: any; + /** + * Set autocomplete limit. + */ + autocompleteLimit?: number; + } + + + /** * The Materialize object */ interface Materialize { /** - * Displays a toast message on screen - * - * @name message The message to display on screen - * @name displayLength The duration in milliseconds to display the message on screen - * @name className The className to use to format the message to display - * @name completeCallback Callback function to call when the messages completes/hides. - */ - toast(message:string|JQuery, displayLength:number, className?:string, completeCallback?:Function): void; + * Displays a toast message on screen + * + * @name message The message to display on screen + * @name displayLength The duration in milliseconds to display the message on screen + * @name className The className to use to format the message to display + * @name completeCallback Callback function to call when the messages completes/hides. + */ + toast(message: string | JQuery, displayLength: number, className?: string, completeCallback?: Function): void; /** * Fires an event when the page is scrolled to a certain area * * @name options optional parameter with scroll fire options */ - scrollFire(options?:ScrollFireOptions): void; + scrollFire(options?: ScrollFireOptions): void; /** * A staggered reveal effect for any UL Tag with list items * * @name selector the selector for the list to show in staggered fasion */ - showStaggeredList(selector:string): void; + showStaggeredList(selector: string): void; /** * Fade in images. It also animates grayscale and brightness to give it a unique effect. * * @name selector the selector for the image to fade in */ - fadeInImage(selector:string): void; + fadeInImage(selector: string): void; /** * Update all text field to reinitialize all the Materialize labels on the page if dynamically adding inputs @@ -319,7 +416,7 @@ declare namespace Materialize { } } -declare var Materialize : Materialize.Materialize; +declare var Materialize: Materialize.Materialize; interface JQuery { @@ -365,7 +462,7 @@ interface JQuery { * * @name options the tooltip options or the string "remove" to remove the tooltip function */ - tooltip(options?: Materialize.TooltipOptions|string): JQuery; + tooltip(options?: Materialize.TooltipOptions | string): JQuery; /** * Add a dropdown list to any button. @@ -414,28 +511,32 @@ interface JQuery { * * @name method the methods to pause, start, move to next and move to previous slide. */ - carousel(method: string, count: [number]): JQuery; + carousel(method: string, count?: number): JQuery; /** - * Modal for dialog boxes, confirmation messages, or other content that can be called up. + * Modal for dialog boxes, confirmation messages, or other content that can be called up. + * + * For Initialization. + */ + modal(): JQuery; + + /** + * Modal for dialog boxes, confirmation messages, or other content that can be called up. + * + * For opening and closing modals programatically. + * + * @name string action action to do (`open` or `close) + */ + modal(action: string): void; + + /** + * Modal for dialog boxes, confirmation messages, or other content that can be called up. + * + * To customize the behaviour of a modal * * @name options the lean modal options */ - leanModal(options?: Materialize.LeanModalOptions): JQuery; - - /** - * Open a modal programatically - * - * @name options the lean modal options - */ - openModal(options?: Materialize.LeanModalOptions): void; - - /** - * Close a modal programatically - * - * @name options the lean modal options - */ - closeModal(options?: Materialize.LeanModalOptions): void; + modal(options: Materialize.ModalOptions): void; /** * Parallax is an effect where the background content or image in this case, is moved at a different speed than the foreground content while scrolling. @@ -461,12 +562,33 @@ interface JQuery { * * @params methodOrOptions the slide navigation options or a string with "show" to reveal or "hide" to hide the menu */ - sideNav(methodOrOptions?: Materialize.SideNavOptions|string): void; + sideNav(methodOrOptions?: Materialize.SideNavOptions | string): void; /** * Programmatically trigger the tab change event * * @name method, the method to call (always "select_tab") and a param containing the id of the tab to open */ - tabs(method?:string, tab?:string): JQuery; + tabs(method?: string, tab?: string): JQuery; + + /** + * Tab Initialization with options + * + * @name TabOptions options jQuery plugin options + */ + tabs(options?: Materialize.TabOptions): JQuery; + + /** + * Chip Initialization + * + * @name ChipOptions options Material chip options + */ + material_chip(options?: Materialize.ChipOptions): JQuery; + + /** + * To access chip data + * + * @name string method name of the method to invoke + */ + material_chip(method: string): Materialize.ChipDataObject[] | Materialize.ChipDataObject; } diff --git a/materialize-css/materialize-css-tests.ts b/materialize-css/materialize-css-tests.ts index 15189e1b8f..9c7d7d1ea2 100644 --- a/materialize-css/materialize-css-tests.ts +++ b/materialize-css/materialize-css-tests.ts @@ -22,7 +22,7 @@ $('input#input_text, textarea#textarea1').characterCounter(); // Navbar $(".dropdown-button").dropdown(); -$(".dropdown-button").dropdown({hover: false}); +$(".dropdown-button").dropdown({ hover: false }); $(".button-collapse").sideNav(); @@ -30,22 +30,22 @@ $(".button-collapse").sideNav(); // Collapsible var collapseHtml = '
    ' + - '
  • ' + - '
    filter_dramaFirst
    ' + - '

    Lorem ipsum dolor sit amet.

    ' + - '
  • ' + - '
  • ' + - '
    placeSecond
    ' + - '

    Lorem ipsum dolor sit amet.

    ' + - '
  • ' + - '
  • ' + - '
    whatshotThird
    ' + - '

    Lorem ipsum dolor sit amet.

    ' + - '
  • ' + + '
  • ' + + '
    filter_dramaFirst
    ' + + '

    Lorem ipsum dolor sit amet.

    ' + + '
  • ' + + '
  • ' + + '
    placeSecond
    ' + + '

    Lorem ipsum dolor sit amet.

    ' + + '
  • ' + + '
  • ' + + '
    whatshotThird
    ' + + '

    Lorem ipsum dolor sit amet.

    ' + + '
  • ' + '
'; -$(collapseHtml).collapsible({ accordion : false, onClose : function() { alert('Closed'); } }); -$(collapseHtml).collapsible({ accordion : true, onOpen : function() { alert('Opened'); } }); +$(collapseHtml).collapsible({ accordion: false, onClose: function () { alert('Closed'); } }); +$(collapseHtml).collapsible({ accordion: true, onOpen: function () { alert('Opened'); } }); // Dialogs - Toasts Materialize.toast('I am a toast!', 4000); @@ -57,19 +57,21 @@ Materialize.toast($toastContent, 5000); // Dialogs - Tooltip var tooltipHtml = 'Hover me!'; $(tooltipHtml).tooltip(); -$(tooltipHtml).tooltip({delay: 100}); +$(tooltipHtml).tooltip({ delay: 100 }); $(tooltipHtml).tooltip('remove'); // DropDown var dropDownHtml = 'Drop Me!'; $(dropDownHtml).dropdown({ - inDuration: 300, - outDuration: 225, - constrain_width: false, - hover: true, - gutter: 0, - belowOrigin: false, - alignment: 'left' + inDuration: 300, + outDuration: 225, + constrainWidth: false, // Does not change width of dropdown to that of the activator + hover: true, // Activate on hover + gutter: 0, // Spacing from edge + belowOrigin: false, // Displays dropdown below the button + alignment: 'left', // Displays dropdown with edge aligned to the left of button + stopPropagation: false // Stops event propagation + }); $(dropDownHtml).dropdown({}); @@ -79,136 +81,138 @@ $(materialboxHtml).materialbox(); // Media - slider var sliderHtml = '
' + - '
    ' + - '
  • ' + - ' ' + - '
    ' + - '

    This is our big Tagline!

    ' + - '
    Here\'s our small slogan.
    ' + - '
    ' + - '
  • ' + - '
  • ' + - ' ' + - '
    ' + - '

    Left Aligned Caption

    ' + - '
    Here\'s our small slogan.
    ' + - '
    ' + - '
  • ' + - '
  • ' + - ' ' + - '
    ' + - '

    Right Aligned Caption

    ' + - '
    Here\'s our small slogan.
    ' + - '
    ' + - '
  • ' + - '
  • ' + - ' ' + - '
    ' + - '

    This is our big Tagline!

    ' + - '
    Here\'s our small slogan.
    ' + - '
    ' + - '
  • ' + - '
' + + '
    ' + + '
  • ' + + ' ' + + '
    ' + + '

    This is our big Tagline!

    ' + + '
    Here\'s our small slogan.
    ' + + '
    ' + + '
  • ' + + '
  • ' + + ' ' + + '
    ' + + '

    Left Aligned Caption

    ' + + '
    Here\'s our small slogan.
    ' + + '
    ' + + '
  • ' + + '
  • ' + + ' ' + + '
    ' + + '

    Right Aligned Caption

    ' + + '
    Here\'s our small slogan.
    ' + + '
    ' + + '
  • ' + + '
  • ' + + ' ' + + '
    ' + + '

    This is our big Tagline!

    ' + + '
    Here\'s our small slogan.
    ' + + '
    ' + + '
  • ' + + '
' + '
'; - $(sliderHtml).slider(); - $(sliderHtml).slider({}); - $(sliderHtml).slider({ indicators: true }); - $(sliderHtml).slider({ indicators: true, height: 5 }); - $(sliderHtml).slider({ indicators: true, height: 5, transition: 4 }); - $(sliderHtml).slider({ indicators: true, height: 5, transition: 4, interval: 5 }); +$(sliderHtml).slider(); +$(sliderHtml).slider({}); +$(sliderHtml).slider({ indicators: true }); +$(sliderHtml).slider({ indicators: true, height: 5 }); +$(sliderHtml).slider({ indicators: true, height: 5, transition: 4 }); +$(sliderHtml).slider({ indicators: true, height: 5, transition: 4, interval: 5 }); // Carousel $('.carousel').carousel(); $('.carousel').carousel({}); -$('.carousel').carousel({ time_constant: 200, dist: -100, shift: 500, padding: 6000, full_width: true }); +$('.carousel').carousel({ duration: 200, dist: -100, shift: 500, padding: 6000, fullWidth: true, indicators: false, noWrap: false }); // Next slide $('.carousel').carousel('next'); -$('.carousel').carousel('next', [3]); // Move next n times. +$('.carousel').carousel('next', 3); // Move next n times. // Previous slide $('.carousel').carousel('prev'); -$('.carousel').carousel('prev', [4]); // Move prev n times. +$('.carousel').carousel('prev', 4); // Move prev n times. // Modals var modalhtml = ''; -$(modalhtml).openModal(); -$(modalhtml).closeModal(); +$(modalhtml).modal('open'); +$(modalhtml).modal('close'); var modalTriggerHtml = ''; -$(modalTriggerHtml).leanModal(); -$(modalTriggerHtml).leanModal({}); -$(modalTriggerHtml).leanModal({ dismissible: true }); -$(modalTriggerHtml).leanModal({ dismissible: true, opacity: 1 }); -$(modalTriggerHtml).leanModal({ dismissible: true, opacity: 1, in_duration: 100 }); -$(modalTriggerHtml).leanModal({ dismissible: true, opacity: 1, in_duration: 100, out_duration: 100 }); -$(modalTriggerHtml).leanModal({ dismissible: true, opacity: 1, in_duration: 100, out_duration: 100, ready: () => console.log('ready') }); -$(modalTriggerHtml).leanModal({ dismissible: true, opacity: 1, in_duration: 100, out_duration: 100, ready: () => console.log('ready'), complete: () => console.log('complete')}); +$(modalTriggerHtml).modal(); +$(modalTriggerHtml).modal({}); +$(modalTriggerHtml).modal({ dismissible: true }); +$(modalTriggerHtml).modal({ dismissible: true, opacity: 1 }); +$(modalTriggerHtml).modal({ dismissible: true, opacity: 1, inDuration: 100 }); +$(modalTriggerHtml).modal({ dismissible: true, opacity: 1, inDuration: 100, outDuration: 100 }); +$(modalTriggerHtml).modal({ dismissible: true, opacity: 1, inDuration: 100, outDuration: 100, startingTop: "4%" }); +$(modalTriggerHtml).modal({ dismissible: true, opacity: 1, inDuration: 100, outDuration: 100, startingTop: "4%", endingTop: "10%" }); +$(modalTriggerHtml).modal({ dismissible: true, opacity: 1, inDuration: 100, outDuration: 100, startingTop: "4%", endingTop: "10%", ready: () => console.log('ready') }); +$(modalTriggerHtml).modal({ dismissible: true, opacity: 1, inDuration: 100, outDuration: 100, startingTop: "4%", endingTop: "10%", ready: () => console.log('ready'), complete: () => console.log('complete') }); // Parallax var parallaxHtml = '
' + - '
' + - '
'; - $(parallaxHtml).parallax(); + '
' + + ''; +$(parallaxHtml).parallax(); - // PushPin - $('
').pushpin(); - $('
').pushpin({ top: 1 }); - $('
').pushpin({ top: 1, bottom: 1 }); - $('
').pushpin({ top: 1, bottom: 1, offset: 2 }); +// PushPin +$('
').pushpin(); +$('
').pushpin({ top: 1 }); +$('
').pushpin({ top: 1, bottom: 1 }); +$('
').pushpin({ top: 1, bottom: 1, offset: 2 }); // ScrollFire var options = [ - {selector: '.class', offset: 200, callback: 'console.log(".class")' }, - {selector: '.other-class', offset: 200, callback: 'console.log(".other-class")' }, + { selector: '.class', offset: 200, callback: 'console.log(".class")' }, + { selector: '.other-class', offset: 200, callback: 'console.log(".other-class")' }, ]; Materialize.scrollFire(options); // ScrollSpy var scrollSpyHtml = '
' + - '
' + - '
' + - '

Content

' + - '
' + - '
' + - '

Content

' + - '
' + - '
' + - '

Content

' + - '
' + - '
' + - '
' + - '' + - '
' + + '
' + + '
' + + '

Content

' + + '
' + + '
' + + '

Content

' + + '
' + + '
' + + '

Content

' + + '
' + + '
' + + '
' + + '' + + '
' + '
'; $(scrollSpyHtml, ".scrollspy").scrollSpy(); // Side-Nav var sideNavHtml = ''; + ''; $(sideNavHtml).sideNav(); $(sideNavHtml).sideNav({}); $(sideNavHtml).sideNav({ menuWidth: 100 }); @@ -220,24 +224,55 @@ $(sideNavHtml).sideNav("hide"); // Tabs var tabsHtml = '
' + - '
' + - '' + - '
' + - '
Test 1
' + - '
Test 2
' + - '
Test 3
' + - '
Test 4
' + + '
' + + '' + + '
' + + '
Test 1
' + + '
Test 2
' + + '
Test 3
' + + '
Test 4
' + '
'; - $(tabsHtml).tabs(); - $(tabsHtml).tabs('select_tab', 'test1'); +$(tabsHtml).tabs(); +$(tabsHtml).tabs('select_tab', 'test1'); +$(tabsHtml).tabs({ onShow: (currentTab: any) => { console.log(currentTab) }, swipeable: false, responsiveThreshold: 5000 }); // Transitions Materialize.showStaggeredList('#staggered-test'); -Materialize.updateTextFields(); \ No newline at end of file +Materialize.updateTextFields(); + +let chipsHTML = '
' + + '
' + + '
' + + '
'; + +$(chipsHTML).material_chip(); +$(chipsHTML).material_chip({ + data: [{ + tag: 'Apple', + }, { + tag: 'Microsoft', + }, { + tag: 'Google', + }], +}); + +$('.chips-placeholder').material_chip({ + placeholder: 'Enter a tag', + secondaryPlaceholder: '+Tag', +}); +$('.chips-autocomplete').material_chip({ + autocompleteData: { + 'Apple': null, + 'Microsoft': null, + 'Google': null + } +}); + +let chipData: Materialize.ChipDataObject | Materialize.ChipDataObject[] = $('.chips-initial').material_chip('data'); \ No newline at end of file diff --git a/nock/index.d.ts b/nock/index.d.ts index 447c591803..180100a33f 100644 --- a/nock/index.d.ts +++ b/nock/index.d.ts @@ -34,7 +34,8 @@ declare namespace nock { type HttpHeaders = { [key: string]: string | { (req: any, res: any, body: string): any; }; }; type InterceptFunction = ( uri: string | RegExp | { (uri: string): boolean; }, - requestBody?: string | RegExp | { (body: any): boolean; } | any + requestBody?: string | RegExp | { (body: any): boolean; } | any, + interceptorOptions?: Options ) => Interceptor; export type ReplyCallback = (err: any, result: ReplyCallbackResult) => void; type ReplyCallbackResult = string | [number, string | any] | [number, string | any, HttpHeaders] | any; @@ -48,6 +49,7 @@ declare namespace nock { patch: InterceptFunction; merge: InterceptFunction; delete: InterceptFunction; + options: InterceptFunction; intercept: ( uri: string | RegExp | { (uri: string): boolean; }, diff --git a/nock/nock-tests.ts b/nock/nock-tests.ts index 0d1b11159f..8c2d48e736 100644 --- a/nock/nock-tests.ts +++ b/nock/nock-tests.ts @@ -21,29 +21,39 @@ inst = scope.head(str); inst = scope.get(str); inst = scope.get(str, data); +inst = scope.get(str, data, options); + +inst = scope.options(str); +inst = scope.options(str, data); +inst = scope.options(str, data, options); inst = scope.patch(str); inst = scope.patch(str, str); inst = scope.patch(str, obj); +inst = scope.patch(str, obj, options); inst = scope.patch(str, regex); inst = scope.post(str); inst = scope.post(str, data); +inst = scope.post(str, data, options); inst = scope.post(str, obj); inst = scope.post(str, regex); inst = scope.put(str); inst = scope.put(str, data); +inst = scope.put(str, data, options); inst = scope.put(str, obj); inst = scope.put(str, regex); inst = scope.delete(str); inst = scope.delete(str, data); +inst = scope.delete(str, data, options); inst = scope.delete(str, obj); inst = scope.delete(str, regex); inst = scope.merge(str); inst = scope.merge(str, data); +inst = scope.merge(str, data, options); inst = scope.merge(str, obj); inst = scope.merge(str, regex); diff --git a/package.json b/package.json index a9b9625069..1dad46394d 100644 --- a/package.json +++ b/package.json @@ -16,12 +16,13 @@ }, "scripts": { "compile-scripts": "tsc -p scripts", - "new-package": "node scripts/new-package.js", + "new-package": "dts-gen --dt", "not-needed": "node scripts/not-needed.js", "lint": "node scripts/lint.js", "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed --nProcesses 1" }, "devDependencies": { - "types-publisher": "Microsoft/types-publisher#production" + "types-publisher": "Microsoft/types-publisher#production", + "dts-gen": "latest" } } diff --git a/pako/index.d.ts b/pako/index.d.ts index 2838272dbf..7f9b31f2b9 100644 --- a/pako/index.d.ts +++ b/pako/index.d.ts @@ -1,61 +1,84 @@ -// Type definitions for pako 0.2.8 +// Type definitions for pako 1.0.4 // Project: https://github.com/nodeca/pako -// Definitions by: Denis Cappellin +// Definitions by: Denis Cappellin , Caleb Eggensperger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = Pako; export as namespace pako; declare namespace Pako { + export interface DeflateOptions { + level?: number; + windowBits?: number; + memLevel?: number; + strategy?: number; + dictionary?: any; + raw?: boolean; + to?: 'string'; + } + + export interface InflateOptions { + windowBits?: number; + raw?: boolean; + to?: 'string'; + } + + export type Data = Uint8Array | Array | string; + /** * Compress data with deflate algorithm and options. */ - export function deflate( data: Uint8Array | Array | string, options?: any ): string; + export function deflate( data: Data, options: DeflateOptions & {to: 'string'} ): string; + export function deflate( data: Data, options?: DeflateOptions ): Uint8Array; + /** * The same as deflate, but creates raw data, without wrapper (header and adler32 crc). */ - export function deflateRaw( data: Uint8Array | Array | string, options?: any ): string; + export function deflateRaw( data: Data, options: DeflateOptions & {to: 'string'} ): string; + export function deflateRaw( data: Data, options?: DeflateOptions ): Uint8Array; + /** * The same as deflate, but create gzip wrapper instead of deflate one. */ - export function gzip( data: Uint8Array | Array | string, options?: any ): string; + export function gzip( data: Data, options: DeflateOptions & {to: 'string'} ): string; + export function gzip( data: Data, options?: DeflateOptions ): Uint8Array; + /** * Decompress data with inflate/ungzip and options. Autodetect format via wrapper header * by default. That's why we don't provide separate ungzip method. */ - export function inflate( data: Uint8Array | Array | string, options?: any ): Uint8Array; - export function inflate( data: Uint8Array | Array | string, options?: any ): Array; - export function inflate( data: Uint8Array | Array | string, options?: any ): String; + export function inflate( data: Data, options: InflateOptions & {to: 'string'} ): string; + export function inflate( data: Data, options?: InflateOptions ): Uint8Array; + /** * The same as inflate, but creates raw data, without wrapper (header and adler32 crc). */ - export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Uint8Array; - export function inflateRaw( data: Uint8Array | Array | string, options?: any ): Array; - export function inflateRaw( data: Uint8Array | Array | string, options?: any ): string; + export function inflateRaw( data: Data, options: InflateOptions & {to: 'string'} ): string; + export function inflateRaw( data: Data, options?: InflateOptions ): Uint8Array; + /** * Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. */ - export function ungzip( data: Uint8Array | Array | string, options?: any ): Uint8Array; - export function ungzip( data: Uint8Array | Array | string, options?: any ): Array; - export function ungzip( data: Uint8Array | Array | string, options?: any ): string; + export function ungzip( data: Data, options: InflateOptions & {to: 'string'} ): string; + export function ungzip( data: Data, options?: InflateOptions ): Uint8Array; export class Deflate { - constructor( options?: any ); + constructor( options?: DeflateOptions ); err: number; msg: string; result: Uint8Array | Array; - onData( chunk: Uint8Array | Array | string ): void; + onData( chunk: Data ): void; onEnd( status: number ): void; - push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; + push( data: Data | ArrayBuffer, mode?: number | boolean ): boolean; } export class Inflate { - constructor( options?: any ); + constructor( options?: InflateOptions ); err: number; msg: string; - result: Uint8Array | Array | string; - onData( chunk: Uint8Array | Array | string ): void; + result: Data; + onData( chunk: Data ): void; onEnd( status: number ): void; - push( data: Uint8Array | Array | ArrayBuffer | string, mode?: number | boolean ): boolean; + push( data: Data | ArrayBuffer, mode?: number | boolean ): boolean; } } diff --git a/pako/pako-tests.ts b/pako/pako-tests.ts index e928fba9dc..5e5a6c3eef 100644 --- a/pako/pako-tests.ts +++ b/pako/pako-tests.ts @@ -5,13 +5,20 @@ import pako = require("pako"); var chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9]) var chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]); -var deflate = new pako.Deflate({ level: 3}); +var deflate = new pako.Deflate({ level: 3 }); deflate.push(chunk1, false); deflate.push(chunk2, true); // true -> last chunk -if (deflate.err) { - throw new Error( deflate.err.toString() ); +if (deflate.err) { + throw new Error( deflate.err.toString() ); } -console.log(deflate.result); \ No newline at end of file +console.log(deflate.result); + +let str: string = pako.deflate('1234', {to: 'string'}); +let arr: Uint8Array = pako.deflate('1234'); + +let str2: string = pako.inflate('1234', {to: 'string'}); +let arr2: Uint8Array = pako.inflate('1234'); + diff --git a/passport-facebook/index.d.ts b/passport-facebook/index.d.ts index 7b6cedeac5..4e84b4996b 100644 --- a/passport-facebook/index.d.ts +++ b/passport-facebook/index.d.ts @@ -31,6 +31,7 @@ interface IStrategyOption { scopeSeparator?: string; enableProof?: boolean; profileFields?: string[]; + passReqToCallback?: boolean; } declare class Strategy implements passport.Strategy { diff --git a/react-custom-scrollbars/index.d.ts b/react-custom-scrollbars/index.d.ts new file mode 100644 index 0000000000..cf9410f81d --- /dev/null +++ b/react-custom-scrollbars/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for react-css-transition-replace 2.0.1 +// Project: https://github.com/malte-wessel/react-custom-scrollbars +// Definitions by: David-LeBlanc-git +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import * as React from "react"; + +declare module "react-custom-scrollbars" { + export interface positionValues { + top: number; + left: number; + clientWidth: number; + clientHeight: number; + scrollWidth: number; + scrollHeight: number; + scrollLeft: number; + scrollTop: number; + } + + export interface ScrollbarProps extends React.HTMLProps { + onScroll?: React.UIEventHandler; + onScrollFrame?: (values: positionValues) => void; + onScrollStart?: () => void; + onScrollStop?: () => void; + onUpdate?: (values: positionValues) => void; + + renderView?: React.StatelessComponent; + renderTrackHorizontal?: React.StatelessComponent; + renderTrackVertical?: React.StatelessComponent; + renderThumbHorizontal?: React.StatelessComponent; + renderThumbVertical?: React.StatelessComponent; + + autoHide?: boolean; + autoHideTimeout?: number; + autoHideDuration?: number; + + thumbSize?: number; + thumbMinSize?: number; + universal?: boolean; + } + + export default class Scrollbars extends React.Component { + scrollTop(top: number): void; + scrollLeft(left: number): void; + scrollToTop(): void; + scrollToBottom(): void; + scrollToLeft(): void; + scrollToRight(): void; + getScrollLeft(): number; + getScrollTop(): number; + getScrollWidth(): number; + getScrollHeight(): number; + getWidth(): number; + getHeight(): number; + getValues(): positionValues; + } +} \ No newline at end of file diff --git a/react-custom-scrollbars/react-custom-scrollbars-tests.tsx b/react-custom-scrollbars/react-custom-scrollbars-tests.tsx new file mode 100644 index 0000000000..240061eada --- /dev/null +++ b/react-custom-scrollbars/react-custom-scrollbars-tests.tsx @@ -0,0 +1,10 @@ +import * as React from "react" +import { render } from 'react-dom'; +import Scrollbars from "react-custom-scrollbars" + +render( + +
Test
+
, + document.getElementById("main") +) diff --git a/react-custom-scrollbars/tsconfig.json b/react-custom-scrollbars/tsconfig.json new file mode 100644 index 0000000000..0b25f24bde --- /dev/null +++ b/react-custom-scrollbars/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-custom-scrollbars-tests.tsx" + ] +} \ No newline at end of file diff --git a/react-notification-system/index.d.ts b/react-notification-system/index.d.ts index fcf5f41120..bf76875f3a 100644 --- a/react-notification-system/index.d.ts +++ b/react-notification-system/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React Notification System v0.2.10 +// Type definitions for React Notification System v0.2.11 // Project: https://www.npmjs.com/package/react-notification-system // Definitions by: Giedrius Grabauskas , Deividas Bakanas , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,6 +12,7 @@ declare namespace NotificationSystem { addNotification(notification: Notification): Notification; removeNotification(notification: Notification): void; removeNotification(uid: number | string): void; + clearNotifications(): void; } export type CallBackFunction = (notification: Notification) => void; diff --git a/react-sticky/index.d.ts b/react-sticky/index.d.ts index b3070b046a..2126d582ef 100644 --- a/react-sticky/index.d.ts +++ b/react-sticky/index.d.ts @@ -11,14 +11,14 @@ declare module "react-sticky" { export var StickyContainer: React.ComponentClass>; export interface StickyProps { - isActive: boolean; - className: string; - style: any; - stickyClassName: string; - stickyStyle: any; - topOffset: number; - bottomOffset: number; - onStickyStateChange: (isSticky: boolean) => void; + isActive?: boolean; + className?: string; + style?: any; + stickyClassName?: string; + stickyStyle?: any; + topOffset?: number; + bottomOffset?: number; + onStickyStateChange?: (isSticky: boolean) => void; } export var Sticky: React.ComponentClass; diff --git a/react-sticky/react-sticky-tests.tsx b/react-sticky/react-sticky-tests.tsx index 7ab99bf0c7..6eb9d0e0d0 100644 --- a/react-sticky/react-sticky-tests.tsx +++ b/react-sticky/react-sticky-tests.tsx @@ -1,9 +1,16 @@ import {Sticky, StickyContainer} from "react-sticky"; import * as React from "react"; -const StickyComponent: JSX.Element = +const StickyAllOptions: JSX.Element = undefined}> +
; +const StickyNoOptions: JSX.Element = + + +
+ + ; diff --git a/scripts/new-package.js b/scripts/new-package.js deleted file mode 100644 index 360fdff85f..0000000000 --- a/scripts/new-package.js +++ /dev/null @@ -1,121 +0,0 @@ -/// -"use strict"; -var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { - return new (P || (P = Promise))(function (resolve, reject) { - function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } - function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } - function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } - step((generator = generator.apply(thisArg, _arguments || [])).next()); - }); -}; -const http_1 = require("http"); -const fs_1 = require("fs"); -const path = require("path"); -const newPackageName = process.argv[2]; -if (!newPackageName) { - throw new Error("Usage: node scripts/new-package.js new-package-name"); -} -run().catch(e => { - console.error(e); - process.exit(1); -}); -function run() { - return __awaiter(this, void 0, void 0, function* () { - const files = [ - ["index.d.ts", yield getIndex()], - [`${newPackageName}-tests.ts`, ""], - ["tsconfig.json", `${JSON.stringify(getTSConfig(), undefined, 4)}\n`], - ["tslint.json", '{ "extends": "../tslint.json" }\n'], - ]; - try { - yield pify1(fs_1.mkdir, newPackageName); - yield Promise.all(files.map(([name, text]) => write(name, text))); - } - catch (e) { - if (e.code === "EEXIST") { - console.warn(`Module “${newPackageName}” already exists!`); - } - else { - console.error(`Error creating module files: ${e}\nCleaning Up.`); - yield Promise.all(files.map(([name]) => rm(name))); - yield pify1(fs_1.rmdir, newPackageName); - } - process.exit(1); - } - }); -} -function getIndex() { - return __awaiter(this, void 0, void 0, function* () { - let version = "x.x"; - let project = "https://github.com/baz/foo (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.)"; - try { - const reg = JSON.parse(yield loadString(`http://registry.npmjs.org/${newPackageName}`)); - const { latest } = reg["dist-tags"]; - const { homepage } = reg.versions[latest]; - version = latest.split(".").slice(0, 2).join("."); - if (homepage !== undefined) - project = homepage; - } - catch (e) { - console.warn(`Warning: could not retrieve version/homepage information: ${e.message}`); - } - return `// Type definitions for ${newPackageName} ${version} -// Project: ${project} -// Definitions by: My Self -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -Fill the header in! -`; - }); -} -function getTSConfig() { - return { - "compilerOptions": { - "module": "commonjs", - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - `${newPackageName}-tests.ts` - ] - }; -} -function write(name, content) { - return new Promise((resolve, reject) => { - fs_1.writeFile(path.join(newPackageName, name), content, err => err ? reject(err) : resolve()); - }); -} -function rm(name) { - return pify1(fs_1.unlink, path.join(newPackageName, name)).catch((e) => { - if (e.code === "ENOENT") - return; - throw e; - }); -} -function pify1(fn, arg) { - return new Promise((resolve, reject) => { - fn(arg, err => err ? reject(err) : resolve()); - }); -} -function loadString(url) { - return new Promise((resolve, reject) => { - http_1.get(url, (res) => { - if (res.statusCode !== 200) { - return reject(new Error(`HTTP Error ${res.statusCode}: ${http_1.STATUS_CODES[res.statusCode || 500]} for ${url}`)); - } - let rawData = ""; - res.on("data", chunk => rawData += chunk); - res.on("end", () => resolve(rawData)); - }).on("error", e => reject(e)); - }); -} diff --git a/scripts/new-package.ts b/scripts/new-package.ts deleted file mode 100644 index 6e9384c896..0000000000 --- a/scripts/new-package.ts +++ /dev/null @@ -1,131 +0,0 @@ -/// - -import { get, STATUS_CODES } from "http" -import { mkdir, writeFile, unlink, rmdir } from "fs" -import * as path from "path" - -interface Package { - name: string - description: string - version: string - homepage?: string -} - -interface Registry { - name: string - description: string - "dist-tags": { latest: string } - versions: { [version: string]: Package } -} - -const newPackageName = process.argv[2] -if (!newPackageName) { - throw new Error("Usage: node scripts/new-package.js new-package-name") -} - -run().catch(e => { - console.error(e) - process.exit(1) -}) - -async function run() { - const files: [string, string][] = [ - ["index.d.ts", await getIndex()], - [`${newPackageName}-tests.ts`, ""], - ["tsconfig.json", `${JSON.stringify(getTSConfig(), undefined, 4)}\n`], - ["tslint.json", '{ "extends": "../tslint.json" }\n'], - ] - - try { - await pify1(mkdir, newPackageName) - await Promise.all(files.map(([name, text]) => write(name, text))) - } catch (e) { - if (e.code === "EEXIST") { - console.warn(`Module “${newPackageName}” already exists!`) - } else { - console.error(`Error creating module files: ${e}\nCleaning Up.`) - await Promise.all(files.map(([name]) => rm(name))) - await pify1(rmdir, newPackageName) - } - process.exit(1) - } -} - -async function getIndex() { - let version = "x.x" - let project = "https://github.com/baz/foo (Does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.)" - try { - const reg: Registry = JSON.parse(await loadString(`http://registry.npmjs.org/${newPackageName}`)) - - const { latest } = reg["dist-tags"] - const { homepage } = reg.versions[latest] - - version = latest.split(".").slice(0, 2).join(".") - if (homepage !== undefined) project = homepage - } catch (e) { - console.warn(`Warning: could not retrieve version/homepage information: ${e.message}`) - } - - return `// Type definitions for ${newPackageName} ${version} -// Project: ${project} -// Definitions by: My Self -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -Fill the header in! -` -} - -function getTSConfig() { - return { - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - `${newPackageName}-tests.ts` - ] - } -} - -function write(name: string, content: string) { - return new Promise((resolve, reject) => { - writeFile(path.join(newPackageName, name), content, err => err ? reject(err): resolve()) - }) -} - -function rm(name: string) { - return pify1(unlink, path.join(newPackageName, name)).catch((e: NodeJS.ErrnoException) => { - if (e.code === "ENOENT") return - throw e - }) -} - -function pify1 void) => void, A>(fn: F, arg: A) { - return new Promise((resolve, reject) => { - fn(arg, err => err ? reject(err): resolve()) - }) -} - -function loadString(url: string): Promise { - return new Promise((resolve, reject) => { - get(url, (res) => { - if (res.statusCode !== 200) { - return reject(new Error(`HTTP Error ${res.statusCode}: ${STATUS_CODES[res.statusCode || 500]} for ${url}`)) - } - let rawData = "" - res.on("data", chunk => rawData += chunk) - res.on("end", () => resolve(rawData)) - }).on("error", e => reject(e)) - }) -} diff --git a/sequelize/index.d.ts b/sequelize/index.d.ts index 6ff2c3e6df..85283ff468 100644 --- a/sequelize/index.d.ts +++ b/sequelize/index.d.ts @@ -3319,38 +3319,25 @@ declare namespace sequelize { /** * Options for Model.findOrInitialize method */ - interface FindOrInitializeOptions extends LoggingOptions { - - /** - * A hash of search attributes. - */ - where: string | WhereOptions; + interface FindOrInitializeOptions extends FindOptions { /** * Default values to use if building a new instance */ defaults?: TAttributes; - /** - * Transaction to run query under - */ - transaction?: Transaction; } /** - * Options for Model.findOrInitialize method + * Options for Model.findOrInitialize method */ - interface FindCreateFindOptions { + interface FindCreateFindOptions extends FindOptions { /** - * A hash of search attributes. - */ - where: string | WhereOptions; - - /** - * Default values to use if building a new instance + * Default values to use if building a new instance */ defaults?: TAttributes; + } /** diff --git a/sequelize/sequelize-tests.ts b/sequelize/sequelize-tests.ts index 973f98076c..9a54ea6d64 100644 --- a/sequelize/sequelize-tests.ts +++ b/sequelize/sequelize-tests.ts @@ -977,6 +977,7 @@ let findOrRetVal: Promise<[AnyInstance, boolean]>; findOrRetVal = User.findOrInitialize( { where : { username : 'foo' } } ); findOrRetVal = User.findOrInitialize( { where : { username : 'foo' }, transaction : t } ); findOrRetVal = User.findOrInitialize( { where : { username : 'foo' }, defaults : { foo : 'asd' }, transaction : t } ); +findOrRetVal = User.findOrInitialize( { where : { username : 'foo' }, defaults : { foo : 'asd' }, paranoid : false } ); findOrRetVal = User.findOrCreate( { where : { a : 'b' }, defaults : { json : { a : { b : 'c' }, d : [1, 2, 3] } } } ); findOrRetVal = User.findOrCreate( { where : { a : 'b' }, defaults : { json : 'a', data : 'b' } } ); @@ -989,7 +990,6 @@ findOrRetVal = User.findOrCreate( { where : { objectId : 'asdasdasd' }, defaults findOrRetVal = User.findOrCreate( { where : { id : undefined }, defaults : { name : Math.random().toString() } } ); findOrRetVal = User.findOrCreate( { where : { email : 'unique.email.@d.com', companyId : Math.floor( Math.random() * 5 ) } } ); findOrRetVal = User.findOrCreate( { where : { objectId : 1 }, defaults : { bool : false } } ); -findOrRetVal = User.findOrCreate( { where : 'c', defaults : {} } ); User.upsert( { id : 42, username : 'doe', foo : s.fn( 'upper', 'mixedCase2' ) } ); diff --git a/vectorious/index.d.ts b/vectorious/index.d.ts index 63b53d20bf..c68e87236c 100644 --- a/vectorious/index.d.ts +++ b/vectorious/index.d.ts @@ -269,6 +269,8 @@ export class Vector { export class Matrix { T: Matrix; + + shape: number[]; /** * @method constructor @@ -586,4 +588,4 @@ export class Matrix { public toArray (): number[][]; } -export class BLAS {} \ No newline at end of file +export class BLAS {}