From 1d7a6e1f41f4790ee5165c9b23835601cb189e25 Mon Sep 17 00:00:00 2001 From: Pkthunder Date: Wed, 31 Jan 2018 15:32:52 -0500 Subject: [PATCH 1/6] Update index.d.ts (#23301) see paper.js docs: http://paperjs.org/reference/project/#addlayer-layer http://paperjs.org/reference/project/#insertlayer-index-item --- types/paper/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/paper/index.d.ts b/types/paper/index.d.ts index 5bd4315bfd..3f57526a19 100644 --- a/types/paper/index.d.ts +++ b/types/paper/index.d.ts @@ -3237,6 +3237,16 @@ declare module paper { * Deselects all selected items in the project. */ deselectAll(): void; + + /** + * Adds the specified layer at the end of the this project’s layers list. + */ + addLayer(layer: Layer): Layer; + + /** + * Inserts the specified layer at the specified index in this project’s layers list. + */ + insertLayer(index: number, layer: Layer): Layer; /** * Perform a hit-test on the items contained within the project at the location of the specified point. From 99614fa92018ee6023c6dbc6b8ceebff19be5626 Mon Sep 17 00:00:00 2001 From: Gustavo Henke Date: Thu, 1 Feb 2018 07:33:34 +1100 Subject: [PATCH 2/6] @storybook/addon-knobs: add button() knob (#23302) --- types/storybook__addon-knobs/index.d.ts | 2 ++ types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx | 3 +++ 2 files changed, 5 insertions(+) diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index c2f8c954ec..f725abb47c 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -46,6 +46,8 @@ export function date(name: string, value?: Date): Date; export function array(name: string, value: T[], separator?: string): T[]; +export function button(name: string, handler: () => any): void; + export interface WrapStoryProps { context?: object; storyFn?: RenderFunction; diff --git a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx index 9e1c1dbd6b..18d8d0a29e 100644 --- a/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx +++ b/types/storybook__addon-knobs/storybook__addon-knobs-tests.tsx @@ -11,6 +11,7 @@ import { select, date, array, + button, knob, } from '@storybook/addon-knobs'; @@ -58,6 +59,8 @@ stories.add('with all knobs', () => { const genericKnob: X = knob('Some generic knob', { value: 'a', type: 'text' }); + button('Some button', () => console.log('Button knob clicked')); + const style = { ...customStyle, fontWeight: bold ? 800 as 800 : 400 as 400, // tslint:disable-line no-unnecessary-type-assertion From 0db2724abb05212b385634fd3d4fdbe0ba4b0cd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anderson=20Fria=C3=A7a?= Date: Wed, 31 Jan 2018 17:35:04 -0300 Subject: [PATCH 3/6] Adding missing type on jquery-mask-plugin (#23304) --- types/jquery-mask-plugin/index.d.ts | 5 ++++- types/jquery-mask-plugin/jquery-mask-plugin-tests.ts | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/types/jquery-mask-plugin/index.d.ts b/types/jquery-mask-plugin/index.d.ts index a142d0a97e..342045a204 100644 --- a/types/jquery-mask-plugin/index.d.ts +++ b/types/jquery-mask-plugin/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for jQuery Mask Plugin 1.14 // Project: https://igorescobar.github.io/jQuery-Mask-Plugin/ -// Definitions by: Anže Videnič , Igor Escobar +// Definitions by: Anže Videnič +// Igor Escobar +// Anderson Friaça // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -25,6 +27,7 @@ declare namespace jQueryMask { selectOnFocus?: boolean; reverse?: boolean; clearIfNotMatch?: boolean; + placeholder?: string; onComplete?(value: string, e: Event, $element: JQuery, options: Options): void; onKeyPress?(value: string, e: Event, $element: JQuery, options: Options): void; onChange?(value: string, e: Event, $element: JQuery, options: Options): void; diff --git a/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts b/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts index 310cec421b..90ac9f7a00 100644 --- a/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts +++ b/types/jquery-mask-plugin/jquery-mask-plugin-tests.ts @@ -27,6 +27,9 @@ $(document).ready(() => { placeholder: "__/__/____" } }); + $('.placeholder2').mask("00/00/0000", { + placeholder: "__/__/____" + }); $('.fallback').mask("00r00r0000", { translation: { r: { From 962a9ec91974abd33080fd04f89ce860039cc2fe Mon Sep 17 00:00:00 2001 From: Oliver Joseph Ash Date: Wed, 31 Jan 2018 20:35:27 +0000 Subject: [PATCH 4/6] Lodash: `zip`: add undefined to return values (#23305) * Lodash: `zip`: add undefined to return values * Lodash: `zip`: correct generic typo * Lodash: `zip`: add undefined to return values for other overloads * Lodash: `zip`: use `` for tests --- types/lodash/array/zip.d.ts | 32 ++++++++++---------- types/lodash/lodash-tests.ts | 57 +++++++++++++++++++++--------------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/types/lodash/array/zip.d.ts b/types/lodash/array/zip.d.ts index cc8fa0be88..e6051f64a7 100644 --- a/types/lodash/array/zip.d.ts +++ b/types/lodash/array/zip.d.ts @@ -8,27 +8,27 @@ declare module "../index" { * @param arrays The arrays to process. * @return Returns the new array of grouped elements. */ - zip(arrays1: List, arrays2: List): Array<[T1, T2]>; + zip(arrays1: List, arrays2: List): Array<[T1 | undefined, T2 | undefined]>; /** * @see _.zip */ - zip(arrays1: List, arrays2: List, arrays3: List): Array<[T1, T2, T3]>; + zip(arrays1: List, arrays2: List, arrays3: List): Array<[T1 | undefined, T2 | undefined, T3 | undefined]>; /** * @see _.zip */ - zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List): Array<[T1, T2, T3, T4]>; + zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined]>; /** * @see _.zip */ - zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List, arrays5: List): Array<[T1, T2, T3, T4, T5]>; + zip(arrays1: List, arrays2: List, arrays3: List, arrays4: List, arrays5: List): Array<[T1 | undefined, T2 | undefined, T3 | undefined, T4 | undefined, T5 | undefined]>; /** * @see _.zip */ - zip(...arrays: Array | null | undefined>): T[][]; + zip(...arrays: Array | null | undefined>): (T | undefined)[][]; } interface LoDashImplicitWrapper { @@ -38,7 +38,7 @@ declare module "../index" { zip( this: LoDashImplicitWrapper>, arrays2: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -47,7 +47,7 @@ declare module "../index" { this: LoDashImplicitWrapper>, arrays2: List, arrays3: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -57,7 +57,7 @@ declare module "../index" { arrays2: List, arrays3: List, arrays4: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -68,7 +68,7 @@ declare module "../index" { arrays3: List, arrays4: List, arrays5: List, - ): LoDashImplicitWrapper>; + ): LoDashImplicitWrapper>; /** * @see _.zip @@ -76,7 +76,7 @@ declare module "../index" { zip( this: LoDashImplicitWrapper | null | undefined>, ...arrays: Array | null | undefined> - ): LoDashImplicitWrapper; + ): LoDashImplicitWrapper>>; } interface LoDashExplicitWrapper { @@ -86,7 +86,7 @@ declare module "../index" { zip( this: LoDashExplicitWrapper>, arrays2: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -95,7 +95,7 @@ declare module "../index" { this: LoDashExplicitWrapper>, arrays2: List, arrays3: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -105,7 +105,7 @@ declare module "../index" { arrays2: List, arrays3: List, arrays4: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -116,7 +116,7 @@ declare module "../index" { arrays3: List, arrays4: List, arrays5: List, - ): LoDashExplicitWrapper>; + ): LoDashExplicitWrapper>; /** * @see _.zip @@ -124,6 +124,6 @@ declare module "../index" { zip( this: LoDashExplicitWrapper | null | undefined>, ...arrays: Array | null | undefined> - ): LoDashExplicitWrapper; + ): LoDashExplicitWrapper>>; } -} \ No newline at end of file +} diff --git a/types/lodash/lodash-tests.ts b/types/lodash/lodash-tests.ts index 9baaa64815..e0c02f2b2d 100644 --- a/types/lodash/lodash-tests.ts +++ b/types/lodash/lodash-tests.ts @@ -3197,43 +3197,52 @@ namespace TestXor { let list: _.List | null | undefined = [] as any; { - let result: TResult[][]; + // $ExpectType (TResult | undefined)[][] + _.zip(array); + // $ExpectType (TResult | undefined)[][] + _.zip(array, list); + // $ExpectType (TResult | undefined)[][] + _.zip(array, list, array); - result = _.zip(array); - result = _.zip(array, list); - result = _.zip(array, list, array); + // $ExpectType (TResult | undefined)[][] + _.zip(list); + // $ExpectType (TResult | undefined)[][] + _.zip(list, array); + // $ExpectType (TResult | undefined)[][] + _.zip(list, array, list); - result = _.zip(list); - result = _.zip(list, array); - result = _.zip(list, array, list); - - result = _.zip(list, array, list, array, list, array); + // $ExpectType (TResult | undefined)[][] + _.zip(list, array, list, array, list, array); } { - let result: _.LoDashImplicitArrayWrapper; + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(array).zip(list); + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(array).zip(list, array); - result = _(array).zip(list); - result = _(array).zip(list, array); - - result = _(list).zip(array); - result = _(list).zip(array, list); + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(list).zip(array); + // $ExpectType LoDashImplicitWrapper<(TResult | undefined)[][]> + _(list).zip(array, list); } { - let result: _.LoDashExplicitArrayWrapper; + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(array).chain().zip(list); + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(array).chain().zip(list, array); - result = _(array).chain().zip(list); - result = _(array).chain().zip(list, array); - - result = _(list).chain().zip(array); - result = _(list).chain().zip(array, list); + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(list).chain().zip(array); + // $ExpectType LoDashExplicitWrapper<(TResult | undefined)[][]> + _(list).chain().zip(array, list); } { - _.zip([1, 2], [3, 4]); // $ExpectType [number, number][] - _.zip([1, 2], ["a", "b"]); // $ExpectType [number, string][] - _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number, string, boolean][] + _.zip([1, 2], [3, 4]); // $ExpectType [number | undefined, number | undefined][] + _.zip([1, 2], ["a", "b"]); // $ExpectType [number | undefined, string | undefined][] + _.zip([1, 2], ["a", "b"], [true, false]); // $ExpectType [number | undefined, string | undefined, boolean | undefined][] } } From 0b755d302fd60e6e686a71091af468222a190364 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anderson=20Fria=C3=A7a?= Date: Wed, 31 Jan 2018 17:38:12 -0300 Subject: [PATCH 5/6] Types for bootstrap-growl-ifightcrime (#23308) * Types for bootstrap-growl-ifightcrime * necessary adjustments * Adding types for values --- .../bootstrap-growl-ifightcrime-tests.ts | 25 ++++++ types/bootstrap-growl-ifightcrime/index.d.ts | 78 +++++++++++++++++++ .../bootstrap-growl-ifightcrime/tsconfig.json | 24 ++++++ types/bootstrap-growl-ifightcrime/tslint.json | 1 + 4 files changed, 128 insertions(+) create mode 100644 types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts create mode 100644 types/bootstrap-growl-ifightcrime/index.d.ts create mode 100644 types/bootstrap-growl-ifightcrime/tsconfig.json create mode 100644 types/bootstrap-growl-ifightcrime/tslint.json diff --git a/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts b/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts new file mode 100644 index 0000000000..78f92fcf71 --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts @@ -0,0 +1,25 @@ +// basic usage +$(document).ready(() => { + $.bootstrapGrowl('Message to show in alert'); +}); + +// with options example +let offsetOptions: BootstrapGrowlIfightcrime.OffsetOption = { + from: 'top', + amount: 20 +}; + +let options: BootstrapGrowlIfightcrime.Options = { + ele: 'body', + type: 'info', + offset: offsetOptions, + align: 'right', + width: 250, + delay: 4000, + allow_dismiss: true, + stackup_spacing: 10 +}; + +$(document).ready(() => { + $.bootstrapGrowl('Alert with options', options); +}); diff --git a/types/bootstrap-growl-ifightcrime/index.d.ts b/types/bootstrap-growl-ifightcrime/index.d.ts new file mode 100644 index 0000000000..45755682ea --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/index.d.ts @@ -0,0 +1,78 @@ +// Type definitions for Bootstrap Growl Ifightcrime 1.1 +// Project: https://github.com/ifightcrime/bootstrap-growl +// Definitions by: Anderson Friaça +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// + +declare namespace BootstrapGrowlIfightcrime { + type OffsetPositionType = 'top' | 'bottom'; + + type AlertType = 'info' | 'danger' | 'success' | 'warning' | string | null; + + type AlignType = 'left' | 'center' | 'right'; + + interface OffsetOption { + /** + * Position: top or bottom + */ + from?: OffsetPositionType; + + /** + * Offset amount + */ + amount?: number; + } + + interface Options { + /** + * Which element to append to + */ + ele?: string; + + /** + * Values of (null, 'info', 'danger', 'success', 'warning') or another value + */ + type?: AlertType; + + /** + * Offset Options + */ + offset?: OffsetOption; + + /** + * 'left', 'right', or 'center' + */ + align?: AlignType; + + /** + * Integer + */ + width?: number; + + /** + * Time while the message will be displayed. It's not equivalent to the *demo* timeOut! + */ + delay?: number; + + /** + * If true then will display a cross to close the popup. + */ + allow_dismiss?: boolean; + + /** + * Spacing between consecutively stacked growls. + */ + stackup_spacing?: number; + } +} +interface JQueryStatic { + /** + * Show standard Bootstrap alerts into hovering "Growl-like" notifications + * @param message to show. + * @param options should be an options object. + * @returns The element. + */ + bootstrapGrowl: (message: string, options?: BootstrapGrowlIfightcrime.Options) => JQuery; +} diff --git a/types/bootstrap-growl-ifightcrime/tsconfig.json b/types/bootstrap-growl-ifightcrime/tsconfig.json new file mode 100644 index 0000000000..dbeadea241 --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bootstrap-growl-ifightcrime-tests.ts" + ] +} \ No newline at end of file diff --git a/types/bootstrap-growl-ifightcrime/tslint.json b/types/bootstrap-growl-ifightcrime/tslint.json new file mode 100644 index 0000000000..4e88071852 --- /dev/null +++ b/types/bootstrap-growl-ifightcrime/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} From 00aad235f1d0582b28af599062cc9d6f0a3031a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zsolt=20Kov=C3=A1cs?= Date: Wed, 31 Jan 2018 21:40:26 +0100 Subject: [PATCH 6/6] Add types for jquery-awesome-cursor (#23311) --- types/jquery-awesome-cursor/index.d.ts | 34 ++++++++++ .../jquery-awesome-cursor-tests.ts | 64 +++++++++++++++++++ types/jquery-awesome-cursor/tsconfig.json | 23 +++++++ types/jquery-awesome-cursor/tslint.json | 1 + 4 files changed, 122 insertions(+) create mode 100644 types/jquery-awesome-cursor/index.d.ts create mode 100644 types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts create mode 100644 types/jquery-awesome-cursor/tsconfig.json create mode 100644 types/jquery-awesome-cursor/tslint.json diff --git a/types/jquery-awesome-cursor/index.d.ts b/types/jquery-awesome-cursor/index.d.ts new file mode 100644 index 0000000000..1137b16b75 --- /dev/null +++ b/types/jquery-awesome-cursor/index.d.ts @@ -0,0 +1,34 @@ +// Type definitions for jquery-awesome-cursor 0.3 +// Project: https://jwarby.github.io/jquery-awesome-cursor +// Definitions by: Zsolt Kovács +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +declare namespace JQueryAwesomeCursor { + type flip = "horizontal" | "vertical" | "both"; + type cssHandler = (name: string) => void; + + interface Options { + color?: string; + size?: number; + hotspot?: number[] | string; + flip?: flip; + rotate?: number; + outline?: string; + font?: Font; + } + + interface Font { + family: string; + cssClass: string | cssHandler; + } +} + +interface JQueryStatic { + awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery; +} + +interface JQuery { + awesomeCursor(icon: string, options?: JQueryAwesomeCursor.Options): JQuery; +} diff --git a/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts b/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts new file mode 100644 index 0000000000..cd47f56ff9 --- /dev/null +++ b/types/jquery-awesome-cursor/jquery-awesome-cursor-tests.ts @@ -0,0 +1,64 @@ +// Default +jQuery.awesomeCursor('pencil'); + +// Color +jQuery.awesomeCursor('pencil', { + color: '#ff0000' +}); + +// Size +jQuery.awesomeCursor('pencil', { + size: 32 +}); + +// Hotspot +jQuery.awesomeCursor('pencil', { + hotspot: [0, 17] +}); +jQuery.awesomeCursor('pencil', { + hotspot: 'bottom left' +}); + +// Flip +jQuery.awesomeCursor('pencil', { + flip: 'horizontal' +}); +jQuery.awesomeCursor('pencil', { + flip: 'vertical' +}); +jQuery.awesomeCursor('pencil', { + flip: 'both' +}); + +// Rotate +jQuery.awesomeCursor('pencil', { + rotate: 45 +}); + +// Outline +jQuery.awesomeCursor('pencil', { + outline: 'red' +}); + +// Different font +jQuery.awesomeCursor('brush', { + font: { + family: 'typicons', + cssClass: 'typcn typcn-%s' + } +}); +jQuery.awesomeCursor('brush', { + font: { + family: 'typicons', + cssClass: (name) => { + return 'typcn typcn-' + name; + } + } +}); + +// Mixed +jQuery.awesomeCursor('long-arrow-left', { + color: 'red', + hotspot: 'top left', + rotate: 45, +}); diff --git a/types/jquery-awesome-cursor/tsconfig.json b/types/jquery-awesome-cursor/tsconfig.json new file mode 100644 index 0000000000..cb81088d83 --- /dev/null +++ b/types/jquery-awesome-cursor/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jquery-awesome-cursor-tests.ts" + ] +} \ No newline at end of file diff --git a/types/jquery-awesome-cursor/tslint.json b/types/jquery-awesome-cursor/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jquery-awesome-cursor/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }