From c6343d34d85acebc46c81e6187cf86c3623b958e Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Thu, 19 Oct 2017 22:06:32 +0300 Subject: [PATCH 1/6] Added definitions for clusterize.js --- types/clusterize.js/clusterize.js-tests.ts | 19 +++++++++++ types/clusterize.js/index.d.ts | 39 ++++++++++++++++++++++ types/clusterize.js/tsconfig.json | 23 +++++++++++++ types/clusterize.js/tslint.json | 1 + 4 files changed, 82 insertions(+) create mode 100644 types/clusterize.js/clusterize.js-tests.ts create mode 100644 types/clusterize.js/index.d.ts create mode 100644 types/clusterize.js/tsconfig.json create mode 100644 types/clusterize.js/tslint.json diff --git a/types/clusterize.js/clusterize.js-tests.ts b/types/clusterize.js/clusterize.js-tests.ts new file mode 100644 index 0000000000..e7e8359185 --- /dev/null +++ b/types/clusterize.js/clusterize.js-tests.ts @@ -0,0 +1,19 @@ +import Clusterize = require('clusterize.js'); + +const clusterize = new Clusterize({ contentId: '', scrollId: '' }); + +clusterize.append(['
  • ']); + +clusterize.prepend(['
  • ']); + +clusterize.getRowsAmount(); + +clusterize.update(['
  • ']); + +clusterize.getScrollProgress(); + +clusterize.refresh(); + +clusterize.clear(); + +clusterize.destroy(); diff --git a/types/clusterize.js/index.d.ts b/types/clusterize.js/index.d.ts new file mode 100644 index 0000000000..31b4f072ca --- /dev/null +++ b/types/clusterize.js/index.d.ts @@ -0,0 +1,39 @@ +// Type definitions for clusterize.js 0.17 +// Project: https://github.com/NeXTs/Clusterize.js +// Definitions by: My Self +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class Clusterize { + constructor(options: ClusterizeOptions); + + destroy(clean?: boolean): void; + refresh(force?: boolean): void; + clear(): void; + getRowsAmount(): number; + getScrollProgress(): number; + update(data?: string[]): void; + append(rows: string[]): void; + prepend(rows: string[]): void; +} + +interface ClusterizeOptions { + scrollId: string; + contentId: string; + rows?: string[]; + tag?: string; + rows_in_block?: number; + blocks_in_cluster?: number; + show_no_data_row?: boolean; + no_data_text?: string; + no_data_class?: string; + keep_parity?: boolean; + callbacks?: ClusterizeCallbacks; +} + +interface ClusterizeCallbacks { + clusterWillChange?(cb: () => any): any; + clusterChanged?(cb: () => any): any; + scrollingProgress?(cb: (progress: number) => any): any; +} + +export = Clusterize; diff --git a/types/clusterize.js/tsconfig.json b/types/clusterize.js/tsconfig.json new file mode 100644 index 0000000000..319aca3588 --- /dev/null +++ b/types/clusterize.js/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": false, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "clusterize.js-tests.ts" + ] +} diff --git a/types/clusterize.js/tslint.json b/types/clusterize.js/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/clusterize.js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From d1daeda3b26820c140a33a68c62335cdd4456dc1 Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Thu, 19 Oct 2017 22:28:55 +0300 Subject: [PATCH 2/6] Fixed definitions author. --- types/clusterize.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/clusterize.js/index.d.ts b/types/clusterize.js/index.d.ts index 31b4f072ca..beda96d79d 100644 --- a/types/clusterize.js/index.d.ts +++ b/types/clusterize.js/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for clusterize.js 0.17 // Project: https://github.com/NeXTs/Clusterize.js -// Definitions by: My Self +// Definitions by: Pr1st0n // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class Clusterize { From 64b1289e185646ffffb2e23f3292dbbe19ebb09e Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Fri, 20 Oct 2017 11:23:51 +0300 Subject: [PATCH 3/6] Review fixes. --- types/clusterize.js/clusterize.js-tests.ts | 3 +- types/clusterize.js/index.d.ts | 38 ++++++++++++---------- types/clusterize.js/tsconfig.json | 2 +- 3 files changed, 23 insertions(+), 20 deletions(-) diff --git a/types/clusterize.js/clusterize.js-tests.ts b/types/clusterize.js/clusterize.js-tests.ts index e7e8359185..acbfbc36f8 100644 --- a/types/clusterize.js/clusterize.js-tests.ts +++ b/types/clusterize.js/clusterize.js-tests.ts @@ -1,6 +1,7 @@ import Clusterize = require('clusterize.js'); -const clusterize = new Clusterize({ contentId: '', scrollId: '' }); +const options: Clusterize.Options = { contentId: '', scrollId: '' }; +const clusterize = new Clusterize(options); clusterize.append(['
  • ']); diff --git a/types/clusterize.js/index.d.ts b/types/clusterize.js/index.d.ts index beda96d79d..2d0e169c38 100644 --- a/types/clusterize.js/index.d.ts +++ b/types/clusterize.js/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class Clusterize { - constructor(options: ClusterizeOptions); + constructor(options: Clusterize.Options); destroy(clean?: boolean): void; refresh(force?: boolean): void; @@ -16,24 +16,26 @@ declare class Clusterize { prepend(rows: string[]): void; } -interface ClusterizeOptions { - scrollId: string; - contentId: string; - rows?: string[]; - tag?: string; - rows_in_block?: number; - blocks_in_cluster?: number; - show_no_data_row?: boolean; - no_data_text?: string; - no_data_class?: string; - keep_parity?: boolean; - callbacks?: ClusterizeCallbacks; -} +declare namespace Clusterize { + interface Options { + scrollId: string; + contentId: string; + rows?: string[]; + tag?: string; + rows_in_block?: number; + blocks_in_cluster?: number; + show_no_data_row?: boolean; + no_data_text?: string; + no_data_class?: string; + keep_parity?: boolean; + callbacks?: Callbacks; + } -interface ClusterizeCallbacks { - clusterWillChange?(cb: () => any): any; - clusterChanged?(cb: () => any): any; - scrollingProgress?(cb: (progress: number) => any): any; + interface Callbacks { + clusterWillChange?(cb: () => any): void; + clusterChanged?(cb: () => any): void; + scrollingProgress?(cb: (progress: number) => any): void; + } } export = Clusterize; diff --git a/types/clusterize.js/tsconfig.json b/types/clusterize.js/tsconfig.json index 319aca3588..10ca5c2a1a 100644 --- a/types/clusterize.js/tsconfig.json +++ b/types/clusterize.js/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": false, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 67a8a0fd9151c27321ef932ebae6622f4b6452b0 Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Fri, 20 Oct 2017 17:21:20 +0300 Subject: [PATCH 4/6] Review fix. --- types/clusterize.js/index.d.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/types/clusterize.js/index.d.ts b/types/clusterize.js/index.d.ts index 2d0e169c38..7c549761d6 100644 --- a/types/clusterize.js/index.d.ts +++ b/types/clusterize.js/index.d.ts @@ -32,9 +32,9 @@ declare namespace Clusterize { } interface Callbacks { - clusterWillChange?(cb: () => any): void; - clusterChanged?(cb: () => any): void; - scrollingProgress?(cb: (progress: number) => any): void; + clusterWillChange?(cb: () => void): void; + clusterChanged?(cb: () => void): void; + scrollingProgress?(cb: (progress: number) => void): void; } } From ed43ece3e55c8b435298c99fc57971fd6bbc842d Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Wed, 25 Oct 2017 17:46:59 +0300 Subject: [PATCH 5/6] Added execCommand and isReadOnly CodeMirror.Editor functions. --- types/codemirror/index.d.ts | 6 ++++++ types/codemirror/test/index.ts | 3 +++ 2 files changed, 9 insertions(+) diff --git a/types/codemirror/index.d.ts b/types/codemirror/index.d.ts index 4bf1844114..cfcbd9d5b3 100644 --- a/types/codemirror/index.d.ts +++ b/types/codemirror/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/marijnh/CodeMirror // Definitions by: mihailik // nrbernard +// Pr1st0n // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = CodeMirror; @@ -336,6 +337,11 @@ declare namespace CodeMirror { "subtract" Reduce the indentation of the line. */ indentLine(line: number, dir?: string): void; + /** Tells you whether the editor's content can be edited by the user. */ + isReadOnly(): boolean; + + /** Runs the command with the given name on the editor. */ + execCommand(name: string): void; /** Give the editor focus. */ focus(): void; diff --git a/types/codemirror/test/index.ts b/types/codemirror/test/index.ts index e283abe974..39c601f159 100644 --- a/types/codemirror/test/index.ts +++ b/types/codemirror/test/index.ts @@ -68,3 +68,6 @@ myCodeMirror.on( ); CodeMirror.registerHelper("lint", "javascript", {}); + +myCodeMirror.isReadOnly(); +myCodeMirror.execCommand('selectAll'); From 9551c81ecbc723ab0874de187c7f82516ea181d0 Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Mon, 30 Oct 2017 15:02:31 +0300 Subject: [PATCH 6/6] Added types for lil-uuid --- types/lil-uuid/index.d.ts | 19 +++++++++++++++++++ types/lil-uuid/lil-uuid-tests.ts | 4 ++++ types/lil-uuid/tsconfig.json | 23 +++++++++++++++++++++++ types/lil-uuid/tslint.json | 1 + 4 files changed, 47 insertions(+) create mode 100644 types/lil-uuid/index.d.ts create mode 100644 types/lil-uuid/lil-uuid-tests.ts create mode 100644 types/lil-uuid/tsconfig.json create mode 100644 types/lil-uuid/tslint.json diff --git a/types/lil-uuid/index.d.ts b/types/lil-uuid/index.d.ts new file mode 100644 index 0000000000..fb0a783142 --- /dev/null +++ b/types/lil-uuid/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for lil-uuid 0.1 +// Project: https://github.com/lil-js/uuid +// Definitions by: Pr1st0n +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Generate a random UUID + * + * @returns UUID string. + */ +export function uuid(): string; + +/** + * Check if a given string has a valid UUID format. It supports multiple version (3, 4 and 5). + * + * @param uuid UUID string. + * @returns True if string is valid UUID, false otherwise. + */ +export function isUUID(uuid: string): boolean; diff --git a/types/lil-uuid/lil-uuid-tests.ts b/types/lil-uuid/lil-uuid-tests.ts new file mode 100644 index 0000000000..8b39216e67 --- /dev/null +++ b/types/lil-uuid/lil-uuid-tests.ts @@ -0,0 +1,4 @@ +import * as lil from 'lil-uuid'; + +lil.uuid(); +lil.isUUID('f47ac10b-58cc-4372-a567-0e02b2c3d479'); diff --git a/types/lil-uuid/tsconfig.json b/types/lil-uuid/tsconfig.json new file mode 100644 index 0000000000..889bd07cca --- /dev/null +++ b/types/lil-uuid/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", + "lil-uuid-tests.ts" + ] +} diff --git a/types/lil-uuid/tslint.json b/types/lil-uuid/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/lil-uuid/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }