From c6343d34d85acebc46c81e6187cf86c3623b958e Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Thu, 19 Oct 2017 22:06:32 +0300 Subject: [PATCH 01/54] 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 02/54] 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 03/54] 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 04/54] 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 59daf53c63d8485f3207e88bd5dcbf3b2ed9531b Mon Sep 17 00:00:00 2001 From: Alec Hill Date: Tue, 24 Oct 2017 13:41:09 +0000 Subject: [PATCH 05/54] Updated react-responsive types to v3.0 - also addresses issue https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20656 --- types/react-responsive/index.d.ts | 143 ++++++++++-------- .../react-responsive-tests.tsx | 101 ++++++++++++- types/react-responsive/tsconfig.json | 7 +- types/react-responsive/tslint.json | 3 + types/react-responsive/v1/index.d.ts | 65 ++++++++ .../v1/react-responsive-tests.tsx | 42 +++++ types/react-responsive/v1/tsconfig.json | 33 ++++ 7 files changed, 328 insertions(+), 66 deletions(-) create mode 100644 types/react-responsive/tslint.json create mode 100644 types/react-responsive/v1/index.d.ts create mode 100644 types/react-responsive/v1/react-responsive-tests.tsx create mode 100644 types/react-responsive/v1/tsconfig.json diff --git a/types/react-responsive/index.d.ts b/types/react-responsive/index.d.ts index 2b9a37839f..dde02d8dae 100644 --- a/types/react-responsive/index.d.ts +++ b/types/react-responsive/index.d.ts @@ -1,65 +1,90 @@ -// Type definitions for react-responsive 1.1.3 +// Type definitions for react-responsive 3.0 // Project: https://github.com/contra/react-responsive // Definitions by: Alexey Svetliakov +// Alec Hill +// Javier Gonzalez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.4 -declare module "react-responsive" { - import * as React from "react"; - - namespace MediaQuery { - export interface MediaQueryProps { - query?: string; - // matchers - orientation?: "portrait" | "landscape"; - scan?: "progressive" | "interlace"; - aspectRatio?: string; - deviceAspectRatio?: string; - height?: number | string; - deviceHeight?: number | string; - width?: number | string; - deviceWidth?: number | string; - color?: boolean; - colorIndex?: boolean; - monochrome?: boolean; - resolution?: number | string; - // types - minAspectRatio?: string; - maxAspectRatio?: string; - minDeviceAspectRatio?: string; - maxDeviceAspectRatio?: string; - minHeight?: number | string; - maxHeight?: number | string; - minDeviceHeight?: number | string; - maxDeviceHeight?: number | string; - minDeviceWidth?: number | string; - maxDeviceWidth?: number | string; - minWidth?: number | string; - maxWidth?: number | string; - minColor?: number; - maxColor?: number; - minColorIndex?: number; - maxColorIndex?: number; - minMonochrome?: number; - maxMonochrome?: number; - minResolution?: number | string; - maxResolution?: number | string; - // types - all?: boolean; - grid?: boolean; - aural?: boolean; - braille?: boolean; - handheld?: boolean; - print?: boolean; - projection?: boolean; - screen?: boolean; - tty?: boolean; - tv?: boolean; - embossed?: boolean; - } - } - - class MediaQuery extends React.Component { } - export = MediaQuery; +import * as React from "react"; +export interface MediaQueryTypes { + all?: boolean; + grid?: boolean; + aural?: boolean; + braille?: boolean; + handheld?: boolean; + print?: boolean; + projection?: boolean; + screen?: boolean; + tty?: boolean; + tv?: boolean; + embossed?: boolean; } + +export type MediaQueryType = keyof MediaQueryTypes; + +export interface MediaQueryMatchers { + aspectRatio?: string; + deviceAspectRatio?: string; + height?: number | string; + deviceHeight?: number | string; + width?: number | string; + deviceWidth?: number | string; + color?: boolean; + colorIndex?: boolean; + monochrome?: boolean; + resolution?: number | string; + orientation?: 'portrait' | 'landscape'; + scan?: 'progressive' | 'interlace'; + type?: MediaQueryType; +} + +export interface MediaQueryFeatures extends MediaQueryMatchers { + minAspectRatio?: string; + maxAspectRatio?: string; + + minDeviceAspectRatio?: string; + maxDeviceAspectRatio?: string; + + minHeight?: number | string; + maxHeight?: number | string; + + minDeviceHeight?: number | string; + maxDeviceHeight?: number | string; + + minWidth?: number | string; + maxWidth?: number | string; + + minDeviceWidth?: number | string; + maxDeviceWidth?: number | string; + + minColor?: number; + maxColor?: number; + + minColorIndex?: number; + maxColorIndex?: number; + + minMonochrome?: number; + maxMonochrome?: number; + + minResolution?: number | string; + maxResolution?: number | string; +} + +export interface MediaQueryAllQueryable extends MediaQueryFeatures, MediaQueryTypes {} + +export interface MediaQueryProps extends MediaQueryAllQueryable { + component?: string | React.SFC | React.ClassType | React.ComponentClass; + query?: string; + style?: React.CSSProperties; + className?: string; + children?: React.ReactNode | ((matches: boolean) => React.ReactNode); + values?: Partial; + onBeforeChange?: (matches: boolean) => void; + onChange?: (matches: boolean) => void; +} + +declare class MediaQuery extends React.Component { } +export function toQuery(matchers: Partial): string; +export default MediaQuery; diff --git a/types/react-responsive/react-responsive-tests.tsx b/types/react-responsive/react-responsive-tests.tsx index 28f8f39c30..3445a8d1cf 100644 --- a/types/react-responsive/react-responsive-tests.tsx +++ b/types/react-responsive/react-responsive-tests.tsx @@ -1,7 +1,9 @@ import * as React from "react"; -import * as MediaQuery from "react-responsive"; +import MediaQuery, { + toQuery +} from "react-responsive"; -class Test extends React.Component { +class QueryTests extends React.Component { render() { return (
    @@ -37,6 +39,99 @@ class Test extends React.Component {
    - ) + ); } } + +const ChildrenPropTest: React.SFC = ({ children }) => ; + +class PropsTests extends React.Component { + render() { + return ( +
    + +
  • Item 1
  • +
  • Item 2
  • +
    + +
  • Item 1
  • +
  • Item 2
  • +
    + +
  • Item 1
  • +
  • Item 2
  • +
    + +
    Wrapped
    +
    Content
    +
    + + uppercase me! + + + Values supplied for SSR + +
    + ); + } +} + +class FunctionChildrenTest extends React.Component { + render() { + return ( + + {(matches: boolean) => { + if (matches) { + return
    Media query matches!
    ; + } else { + return
    Media query does not match!
    ; + } + }} +
    + ); + } +} + +class CallbackTest extends React.Component { + onBeforeChange = (matches: boolean): void => { + if (matches) { + // do something + } + } + + onChange = (matches: boolean): void => { + if (matches) { + // do something else + } + } + + render() { + return ( + + Media query matches! + + ); + } +} + +const queryStrTest: string = toQuery({ + type: 'print', + screen: true, + minHeight: 666 +}); diff --git a/types/react-responsive/tsconfig.json b/types/react-responsive/tsconfig.json index 61a49072b7..294f0c8cde 100644 --- a/types/react-responsive/tsconfig.json +++ b/types/react-responsive/tsconfig.json @@ -2,12 +2,11 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6", - "dom" + "es6" ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -22,4 +21,4 @@ "index.d.ts", "react-responsive-tests.tsx" ] -} \ No newline at end of file +} diff --git a/types/react-responsive/tslint.json b/types/react-responsive/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/react-responsive/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/react-responsive/v1/index.d.ts b/types/react-responsive/v1/index.d.ts new file mode 100644 index 0000000000..2b9a37839f --- /dev/null +++ b/types/react-responsive/v1/index.d.ts @@ -0,0 +1,65 @@ +// Type definitions for react-responsive 1.1.3 +// Project: https://github.com/contra/react-responsive +// Definitions by: Alexey Svetliakov +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare module "react-responsive" { + import * as React from "react"; + + namespace MediaQuery { + export interface MediaQueryProps { + query?: string; + // matchers + orientation?: "portrait" | "landscape"; + scan?: "progressive" | "interlace"; + aspectRatio?: string; + deviceAspectRatio?: string; + height?: number | string; + deviceHeight?: number | string; + width?: number | string; + deviceWidth?: number | string; + color?: boolean; + colorIndex?: boolean; + monochrome?: boolean; + resolution?: number | string; + // types + minAspectRatio?: string; + maxAspectRatio?: string; + minDeviceAspectRatio?: string; + maxDeviceAspectRatio?: string; + minHeight?: number | string; + maxHeight?: number | string; + minDeviceHeight?: number | string; + maxDeviceHeight?: number | string; + minDeviceWidth?: number | string; + maxDeviceWidth?: number | string; + minWidth?: number | string; + maxWidth?: number | string; + minColor?: number; + maxColor?: number; + minColorIndex?: number; + maxColorIndex?: number; + minMonochrome?: number; + maxMonochrome?: number; + minResolution?: number | string; + maxResolution?: number | string; + // types + all?: boolean; + grid?: boolean; + aural?: boolean; + braille?: boolean; + handheld?: boolean; + print?: boolean; + projection?: boolean; + screen?: boolean; + tty?: boolean; + tv?: boolean; + embossed?: boolean; + } + } + + class MediaQuery extends React.Component { } + export = MediaQuery; + +} diff --git a/types/react-responsive/v1/react-responsive-tests.tsx b/types/react-responsive/v1/react-responsive-tests.tsx new file mode 100644 index 0000000000..28f8f39c30 --- /dev/null +++ b/types/react-responsive/v1/react-responsive-tests.tsx @@ -0,0 +1,42 @@ +import * as React from "react"; +import * as MediaQuery from "react-responsive"; + +class Test extends React.Component { + render() { + return ( +
    +
    Device Test!
    + +
    You are a desktop or laptop
    + +
    You also have a huge screen
    +
    + +
    You are sized like a tablet or mobile phone though
    +
    +
    + +
    You are a tablet or mobile phone
    +
    + +
    You are portrait
    +
    + +
    You are landscape
    +
    + +
    You are retina
    +
    + +
    You are a desktop or laptop
    + +
    You also have a huge screen
    +
    + +
    You are sized like a tablet or mobile phone though
    +
    +
    +
    + ) + } +} diff --git a/types/react-responsive/v1/tsconfig.json b/types/react-responsive/v1/tsconfig.json new file mode 100644 index 0000000000..774fd47a00 --- /dev/null +++ b/types/react-responsive/v1/tsconfig.json @@ -0,0 +1,33 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "react-responsive": [ + "react-responsive/v1" + ], + "react-responsive/*": [ + "react-responsive/v1/*" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-responsive-tests.tsx" + ] +} From ed43ece3e55c8b435298c99fc57971fd6bbc842d Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Wed, 25 Oct 2017 17:46:59 +0300 Subject: [PATCH 06/54] 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 11ac6579bcb8bfb74e4af61660b206c67dd1833c Mon Sep 17 00:00:00 2001 From: Marc-Andre Roy Date: Thu, 26 Oct 2017 16:44:04 -0400 Subject: [PATCH 07/54] Add typings for guid npm package. --- types/guid/guid-tests.ts | 5 +++++ types/guid/index.d.ts | 38 ++++++++++++++++++++++++++++++++++++++ types/guid/tsconfig.json | 22 ++++++++++++++++++++++ types/guid/tslint.json | 1 + 4 files changed, 66 insertions(+) create mode 100644 types/guid/guid-tests.ts create mode 100644 types/guid/index.d.ts create mode 100644 types/guid/tsconfig.json create mode 100644 types/guid/tslint.json diff --git a/types/guid/guid-tests.ts b/types/guid/guid-tests.ts new file mode 100644 index 0000000000..cb5008d2a2 --- /dev/null +++ b/types/guid/guid-tests.ts @@ -0,0 +1,5 @@ +import guid = require('guid'); + +const newRawGuid: string = guid.raw(); +const isAGuid: boolean = guid.isGuid(newRawGuid); +const newGuidObject: object = guid.create(); diff --git a/types/guid/index.d.ts b/types/guid/index.d.ts new file mode 100644 index 0000000000..210a1f9584 --- /dev/null +++ b/types/guid/index.d.ts @@ -0,0 +1,38 @@ +// Type definitions for guid 1.0 +// Project: https://github.com/dandean/guid +// Definitions by: Marc-Andre Roy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** Declaration file generated by dts-gen */ + +export = guid; + +declare function guid(guid: string | guid): any; + +declare namespace guid { + const EMPTY: string; + + const prototype: { + }; + + function create(): object; + + function isGuid(value: string): boolean; + + function raw(): string; + + namespace create { + const prototype: { + }; + } + + namespace isGuid { + const prototype: { + }; + } + + namespace raw { + const prototype: { + }; + } +} diff --git a/types/guid/tsconfig.json b/types/guid/tsconfig.json new file mode 100644 index 0000000000..5d335b8f70 --- /dev/null +++ b/types/guid/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "guid-tests.ts" + ] +} diff --git a/types/guid/tslint.json b/types/guid/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/guid/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 5a1c6ddc309df5bc64a11d1a9d0a9723b7da826b Mon Sep 17 00:00:00 2001 From: Marc-Andre Roy Date: Fri, 27 Oct 2017 09:21:06 -0400 Subject: [PATCH 08/54] Improve tests, types, and whatnot --- types/guid/guid-tests.ts | 19 ++++++++++++++++--- types/guid/index.d.ts | 5 ++--- types/guid/tsconfig.json | 1 + 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/types/guid/guid-tests.ts b/types/guid/guid-tests.ts index cb5008d2a2..52e0a738d1 100644 --- a/types/guid/guid-tests.ts +++ b/types/guid/guid-tests.ts @@ -1,5 +1,18 @@ import guid = require('guid'); -const newRawGuid: string = guid.raw(); -const isAGuid: boolean = guid.isGuid(newRawGuid); -const newGuidObject: object = guid.create(); +// $ExpectType object +guid.create(); + +// $ExpectType string +guid.raw(); + +const newRawGuid = guid.raw(); + +// $ExpectType boolean +guid.isGuid(newRawGuid); + +// $ExpectType string +guid.EMPTY; + +// $ExpectType object +guid(guid.create()); diff --git a/types/guid/index.d.ts b/types/guid/index.d.ts index 210a1f9584..9d1c6b2ea2 100644 --- a/types/guid/index.d.ts +++ b/types/guid/index.d.ts @@ -2,12 +2,11 @@ // Project: https://github.com/dandean/guid // Definitions by: Marc-Andre Roy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/** Declaration file generated by dts-gen */ +// TypeScript Version: 2.2 export = guid; -declare function guid(guid: string | guid): any; +declare function guid(guid: object): object; declare namespace guid { const EMPTY: string; diff --git a/types/guid/tsconfig.json b/types/guid/tsconfig.json index 5d335b8f70..17563577fd 100644 --- a/types/guid/tsconfig.json +++ b/types/guid/tsconfig.json @@ -7,6 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" From 9f478ae4cc1ec875a3fadca87882fd25babb0540 Mon Sep 17 00:00:00 2001 From: jessezhang91 Date: Fri, 27 Oct 2017 23:40:56 -0400 Subject: [PATCH 09/54] [mock-knex] add types for mock-knex --- types/mock-knex/index.d.ts | 79 ++++++++++++++++++++++++++++++ types/mock-knex/mock-knex-tests.ts | 29 +++++++++++ types/mock-knex/tsconfig.json | 23 +++++++++ types/mock-knex/tslint.json | 1 + 4 files changed, 132 insertions(+) create mode 100644 types/mock-knex/index.d.ts create mode 100644 types/mock-knex/mock-knex-tests.ts create mode 100644 types/mock-knex/tsconfig.json create mode 100644 types/mock-knex/tslint.json diff --git a/types/mock-knex/index.d.ts b/types/mock-knex/index.d.ts new file mode 100644 index 0000000000..5633000ab9 --- /dev/null +++ b/types/mock-knex/index.d.ts @@ -0,0 +1,79 @@ +// Type definitions for mock-knex 0.3 +// Project: https://github.com/colonyamerican/mock-knex +// Definitions by: Jesse Zhang +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +import * as Knex from "knex"; +import { EventEmitter } from "events"; + +/** + * Attaches mocked client to knex instance + * + * @param knex initialized knex client + */ +export function mock(knex: Knex): void; + +/** + * Detaches mocked client from knex instance + * + * @param knex initialized knex client + */ +export function unmock(knex: Knex): void; + +/** + * Returns query Tracker instance + */ +export function getTracker(): Tracker; + +/** + * The tracker enables you to catch and respond to queries that occur during testing, see Test for more examples. + */ +export interface Tracker extends EventEmitter { + /** + * Enables query tracking mock on mocked knex client + */ + install(): void; + + /** + * Disables query tracking mock on mocked knex client. Also resets 'step' counter. + */ + uninstall(): void; + + /** + * Add event listener for 'query' event. It gets esecuted for each query that should end up in database. + * Instead of this callback gets executed and its up to you to assert queries and mock database responses. + * + * @param callback A function that gets executed on 'query' event. + */ + on(event: 'query', callback: (query: QueryDetails, step: number) => void): this; +} + +/** + * The object containing query details that is being sent to knex database dialect on query execution. + * Object properties signature matches with knex toSQL() output with additional method returns(values). + */ +export interface QueryDetails extends Knex.Sql { + /** + * Function that needs to be called to mock database query result for knex. + * + * @param error The Error, string or instance of Error, which represents why the result was rejected + */ + reject(error: Error | string): void; + + /** + * Function that needs to be called to mock database query result for knex. + * + * @param values An array of mock data to be returned by database. For Bookshelf this is mostly array of objects. Knex could return any type of data. + */ + response(values: any[], options?: QueryDetailsResponseOption): void; +} + +export interface QueryDetailsResponseOption { + /** + * Is this a stream response, defaults to false + */ + stream: boolean; +} diff --git a/types/mock-knex/mock-knex-tests.ts b/types/mock-knex/mock-knex-tests.ts new file mode 100644 index 0000000000..ec4ef0024e --- /dev/null +++ b/types/mock-knex/mock-knex-tests.ts @@ -0,0 +1,29 @@ +import * as knex from "knex"; +import * as mockDb from "mock-knex"; + +const db = knex({ + client: 'sqlite' +}); + +mockDb.mock(db); + +const tracker = mockDb.getTracker(); +tracker.install(); +tracker.on('query', (query, step) => { + if (query.method === "first" || step === 1) { + query.response([{ + a: 1 + }, { + a: 2 + }, { + a: 3 + }], { + stream: false + }); + } else { + query.reject(new Error("bad query")); + } +}); +tracker.uninstall(); + +mockDb.unmock(db); diff --git a/types/mock-knex/tsconfig.json b/types/mock-knex/tsconfig.json new file mode 100644 index 0000000000..427ad9f843 --- /dev/null +++ b/types/mock-knex/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", + "mock-knex-tests.ts" + ] +} diff --git a/types/mock-knex/tslint.json b/types/mock-knex/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mock-knex/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From bc39d3d32046c106fcf866e1766045c7632939ff Mon Sep 17 00:00:00 2001 From: Winslow Dalpe Date: Sat, 28 Oct 2017 15:51:36 -0700 Subject: [PATCH 10/54] Adding typings for moment-holiday PR upstream to add typings in the library has been open for a while without feedback. Adding the typings here until that PR changes state. --- types/moment-holiday/index.d.ts | 71 +++++++++++ types/moment-holiday/moment-holiday-tests.ts | 126 +++++++++++++++++++ types/moment-holiday/package.json | 6 + types/moment-holiday/tsconfig.json | 23 ++++ types/moment-holiday/tslint.json | 1 + 5 files changed, 227 insertions(+) create mode 100644 types/moment-holiday/index.d.ts create mode 100644 types/moment-holiday/moment-holiday-tests.ts create mode 100644 types/moment-holiday/package.json create mode 100644 types/moment-holiday/tsconfig.json create mode 100644 types/moment-holiday/tslint.json diff --git a/types/moment-holiday/index.d.ts b/types/moment-holiday/index.d.ts new file mode 100644 index 0000000000..fffe81ed73 --- /dev/null +++ b/types/moment-holiday/index.d.ts @@ -0,0 +1,71 @@ +// Type definitions for moment-holiday 1.5 +// Project: https://github.com/kodie/moment-holiday +// Definitions by: Robert Winslow Dalpe +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as moment from 'moment'; + +declare module 'moment' { + interface Moment extends Object { + holiday( + holidays?: string[] | string, + adjust?: boolean): Moment | false | { [holidayName: string]: Moment }; + + holidays( + holidays?: string[] | string, + adjust?: boolean): Moment | false | { [holidayName: string]: Moment }; + + isHoliday( + holidays?: string[] | string | null, + adjust?: boolean): boolean | string | string[]; + + previousHoliday(count?: number, adjust?: boolean): Moment[] | Moment; + + previousHolidays(count?: number, adjust?: boolean): Moment[] | Moment; + + nextHoliday(count?: number, adjust?: boolean): Moment[] | Moment; + + nextHolidays(count?: number, adjust?: boolean): Moment[] | Moment; + + holidaysBetween(m: Moment, adjust?: boolean): Moment[] | false; + } + + interface HolidayDefinition { + date: string; + keywords?: string[]; + keywords_y?: string[]; + keywords_n?: string[]; + regions?: string[]; + regions_n?: string[]; + } + + interface HolidaysMapping { + [holidayName: string]: HolidayDefinition; + } + + interface Holidays { + active: HolidaysMapping; + active_last: HolidaysMapping; + } + + interface HolidayModifier { + set( + holidays: HolidaysMapping | string | string[], + specifics?: any): HolidayModifier; + + add( + holidays: HolidaysMapping | string, + specifics?: any): HolidayModifier; + + remove(holidays: string | string[]): HolidayModifier; + + undo(): HolidayModifier; + + load(locales: string | string[]): HolidayModifier; + + extendParser(parserFunc: (m: Moment, date: string) => Moment | Moment[] | false | void): HolidayModifier; + } + + let holidays: Holidays; + let modifyHolidays: HolidayModifier; +} diff --git a/types/moment-holiday/moment-holiday-tests.ts b/types/moment-holiday/moment-holiday-tests.ts new file mode 100644 index 0000000000..d6d0941f38 --- /dev/null +++ b/types/moment-holiday/moment-holiday-tests.ts @@ -0,0 +1,126 @@ +import * as moment from 'moment'; + +let holidayResult: moment.Moment | false | { [holidayName: string]: moment.Moment }; +holidayResult = moment().holiday([]); +holidayResult = moment().holiday([], false); +holidayResult = moment().holiday([], true); +holidayResult = moment().holiday('string'); +holidayResult = moment().holiday('string', false); +holidayResult = moment().holiday('string', true); +holidayResult = moment().holiday(['array', 'of', 'strings']); +holidayResult = moment().holiday(['array', 'of', 'strings'], false); +holidayResult = moment().holiday(['array', 'of', 'strings'], true); + +holidayResult = moment().holidays([]); +holidayResult = moment().holidays([], false); +holidayResult = moment().holidays([], true); +holidayResult = moment().holidays('string'); +holidayResult = moment().holidays('string', false); +holidayResult = moment().holidays('string', true); +holidayResult = moment().holidays(['array', 'of', 'strings']); +holidayResult = moment().holidays(['array', 'of', 'strings'], false); +holidayResult = moment().holidays(['array', 'of', 'strings'], true); + +let isHolidayResult: boolean | string | string[]; +isHolidayResult = moment().isHoliday(); +isHolidayResult = moment().isHoliday([]); +isHolidayResult = moment().isHoliday([], false); +isHolidayResult = moment().isHoliday([], true); +isHolidayResult = moment().isHoliday(['array', 'of', 'strings']); +isHolidayResult = moment().isHoliday(['array', 'of', 'strings'], false); +isHolidayResult = moment().isHoliday(['array', 'of', 'strings'], true); +isHolidayResult = moment().isHoliday('string'); +isHolidayResult = moment().isHoliday('string', false); +isHolidayResult = moment().isHoliday('string', true); +isHolidayResult = moment().isHoliday(null); +isHolidayResult = moment().isHoliday(null, false); +isHolidayResult = moment().isHoliday(null, true); + +let previousHolidayResult: moment.Moment[] | moment.Moment; +previousHolidayResult = moment().previousHoliday(); +previousHolidayResult = moment().previousHoliday(1); +previousHolidayResult = moment().previousHoliday(1, false); +previousHolidayResult = moment().previousHoliday(1, true); +previousHolidayResult = moment().previousHolidays(); +previousHolidayResult = moment().previousHolidays(1); +previousHolidayResult = moment().previousHolidays(1, false); +previousHolidayResult = moment().previousHolidays(1, true); + +let nextHolidayResult: moment.Moment[] | moment.Moment; +nextHolidayResult = moment().nextHoliday(); +nextHolidayResult = moment().nextHoliday(1); +nextHolidayResult = moment().nextHoliday(1, false); +nextHolidayResult = moment().nextHoliday(1, true); +nextHolidayResult = moment().nextHolidays(); +nextHolidayResult = moment().nextHolidays(1); +nextHolidayResult = moment().nextHolidays(1, false); +nextHolidayResult = moment().nextHolidays(1, true); + +let holidaysBetweenResult: moment.Moment[] | false; +holidaysBetweenResult = moment().holidaysBetween(moment()); +holidaysBetweenResult = moment().holidaysBetween(moment(), false); +holidaysBetweenResult = moment().holidaysBetween(moment(), true); + +let holidayDefinition: moment.HolidayDefinition = { + date: 'string' +}; +holidayDefinition = { + date: 'string', + keywords: ['array'], +}; +holidayDefinition = { + date: 'string', + keywords: ['array'], + keywords_n: ['array'], +}; +holidayDefinition = { + date: 'string', + keywords: ['array'], + keywords_n: ['array'], + keywords_y: ['array'], +}; +holidayDefinition = { + date: 'string', + keywords: ['array'], + keywords_n: ['array'], + keywords_y: ['array'], + regions: ['array'], +}; +holidayDefinition = { + date: 'string', + keywords: ['array'], + keywords_n: ['array'], + keywords_y: ['array'], + regions: ['array'], + regions_n: ['array'] +}; + +const holidays: moment.Holidays = moment.holidays; +let activeHolidays: moment.HolidaysMapping = moment.holidays.active; +activeHolidays = { + 'Some holiday name': holidayDefinition +}; + +let lastActiveHolidays: moment.HolidaysMapping = moment.holidays.active_last; +lastActiveHolidays = { + 'Some holiday name': holidayDefinition +}; + +let holidayModifier: moment.HolidayModifier = moment.modifyHolidays; +holidayModifier = holidayModifier.set('string'); +holidayModifier = holidayModifier.set(['array']); +holidayModifier = holidayModifier.set(activeHolidays); +holidayModifier = holidayModifier.set('string', {}); +holidayModifier = holidayModifier.set(['array'], {}); +holidayModifier = holidayModifier.set(activeHolidays, {}); +holidayModifier = holidayModifier.add(activeHolidays); +holidayModifier = holidayModifier.add('string'); +holidayModifier = holidayModifier.add(activeHolidays, {}); +holidayModifier = holidayModifier.add('string', {}); +holidayModifier = holidayModifier.remove('string'); +holidayModifier = holidayModifier.remove(['array']); +holidayModifier = holidayModifier.undo(); +holidayModifier = holidayModifier.load('string'); +holidayModifier = holidayModifier.load(['string']); +holidayModifier = holidayModifier.extendParser((m: moment.Moment, d: string): moment.Moment | moment.Moment[] | false | void => { +}); diff --git a/types/moment-holiday/package.json b/types/moment-holiday/package.json new file mode 100644 index 0000000000..4c7554a28e --- /dev/null +++ b/types/moment-holiday/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": ">=2.0.0" + } +} diff --git a/types/moment-holiday/tsconfig.json b/types/moment-holiday/tsconfig.json new file mode 100644 index 0000000000..d03f37e12c --- /dev/null +++ b/types/moment-holiday/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", + "moment-holiday-tests.ts" + ] +} diff --git a/types/moment-holiday/tslint.json b/types/moment-holiday/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/moment-holiday/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 9551c81ecbc723ab0874de187c7f82516ea181d0 Mon Sep 17 00:00:00 2001 From: pr1st0n Date: Mon, 30 Oct 2017 15:02:31 +0300 Subject: [PATCH 11/54] 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" } From cee36b14805f3bf5938347f9abb32c960910708e Mon Sep 17 00:00:00 2001 From: Marc-Andre Roy Date: Mon, 30 Oct 2017 10:36:15 -0400 Subject: [PATCH 12/54] Removed unnecessary namespace declarations. --- types/guid/index.d.ts | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/types/guid/index.d.ts b/types/guid/index.d.ts index 9d1c6b2ea2..6025e90bf1 100644 --- a/types/guid/index.d.ts +++ b/types/guid/index.d.ts @@ -19,19 +19,4 @@ declare namespace guid { function isGuid(value: string): boolean; function raw(): string; - - namespace create { - const prototype: { - }; - } - - namespace isGuid { - const prototype: { - }; - } - - namespace raw { - const prototype: { - }; - } } From a35e7da8b1edc8e5af93ba7b811582443dc8b27b Mon Sep 17 00:00:00 2001 From: fogsh Date: Tue, 31 Oct 2017 19:15:01 +0200 Subject: [PATCH 13/54] Add types for `iota.lib.js` --- types/iota-lib-js/index.d.ts | 515 +++++++++++++++++++++++++ types/iota-lib-js/iota-lib-js-tests.ts | 114 ++++++ types/iota-lib-js/tsconfig.json | 15 + types/iota-lib-js/tslint.json | 1 + 4 files changed, 645 insertions(+) create mode 100644 types/iota-lib-js/index.d.ts create mode 100644 types/iota-lib-js/iota-lib-js-tests.ts create mode 100644 types/iota-lib-js/tsconfig.json create mode 100644 types/iota-lib-js/tslint.json diff --git a/types/iota-lib-js/index.d.ts b/types/iota-lib-js/index.d.ts new file mode 100644 index 0000000000..28b7a61f5a --- /dev/null +++ b/types/iota-lib-js/index.d.ts @@ -0,0 +1,515 @@ +// Type definitions for iota.lib.js +// Project: https://github.com/iotaledger/iota.lib.js +// Definitions by: Fogsh +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare class IotaClass { + + constructor(settings: { + provider: string + sandbox?: boolean + token?: boolean + }) + + constructor(settings: { + host: string + port: number + sandbox?: boolean + token?: boolean + }) + + api: IotaApi + utils: IotaUtils + multisig: IotaMultisig + valid: IotaValid + + version: string + +} + +declare module "iota.lib.js" { + export = IotaClass +} + +/** +* Types +*/ + +type Security = 1 | 2 | 3 +type IOTAUnit = "i" | "Ki" | "Mi" | "Gi" | "Ti" | "Pi" + + +/** +* Objects +*/ + +interface TransactionObject { + hash: string + signatureMessageFragment: string + address: string + value: number + tag: string + timestamp: number + currentIndex: number + lastIndex: number + bundle: number + trunkTransaction: string + branchTransaction: string + attachmentTimestamp: number + attachmentTimestampLowerBound: number + attachmentTimestampUpperBound: number + nonce: string +} + +interface InputObject { + address: string + balance: number + keyIndex: number + security: Security +} + +interface TransferObject { + address: string + value: number + message: string + tag: string +} + +interface NodeInfo { + appName: string + appVersion: string + duration: number + jreAvailableProcessors: number + jreFreeMemory: number + jreVersion: string + jreMaxMemory: number + jreTotalMemory: number + latestMilestone: string + latestMilestoneIndex: number + latestSolidSubtangleMilestone: string + latestSolidSubtangleMilestoneIndex: number + neighbors: number + packetsQueueSize: number + time: number + tips: number + transactionsToRequest: number +} + +interface Neighbor { + address: string + numberOfAllTransactions: number + numberOfRandomTransactionRequests: number + numberOfInvalidTransactions: number + numberOfSentTransactions: number + numberOfNewTransactions: number + connectionType: "udp" | "tcp" +} + +/** +* +* iota.api +* +**/ + +interface IriApi { + + getNodeInfo( + callback: (error: Error, info: NodeInfo) => void + ): void + + getNeighbors( + callback: (error: Error, neighbors: Neighbor[]) => void + ): void + + addNeighbors( + uris: string[], + callback: (error: Error, addedNeighbors: number) => void + ): void + + removeNeighbors( + uris: string[], + callback: (error: Error, removedNeighbors: number[]) => void + ): void + + getTips( + callback: (error: Error, hashes: string[]) => void + ): void + + findTransactions( + searchValues: { + addresses?: string[] + bundles?: string[] + tags?: string[] + approvees?: string[] + }, + callback: (error: Error, hashes: string[]) => void + ): void + + getTrytes( + hashes: string[], + callback: (error: Error, trytes: string[]) => void + ): void + + getInclusionStates( + transactions: string[], + tips: string[], + callback: (error: Error, states: boolean[]) => void + ): void + + getBalances( + addresses: string[], + treshold: number, + callback: (error: Error, response: { + balances: number[] + milestone: string + milestoneIndex: number + duration: number + }) => void + ): void + + getTransactionsToApprove( + depth: number, + callback: (error: Error, response: { + trunkTransaction: string + branchTransaction: string + duration: number + }) => void + ): void + + attachToTangle( + trunkTransaction: string, + branchTransaction: string, + minWeightMagnitude: number, + trytes: string[], + callback: (error: Error, trytes: string[]) => void + ): void + + interruptAttachingToTangle( + callback: (error: Error, response: {}) => void + ): void + + broadcastTransactions( + trytes: string[], + callback: (error: Error, response: {}) => void + ): void + + storeTransactions( + trytes: string[], + callback: (error: Error, response: {}) => void + ): void + +} + +/** +* +* iota.api +* +**/ + +interface IotaApi extends IriApi { + + getTransactionsObjects( + hashes: string[], + callback?: (error: Error, transactions: TransactionObject[]) => void + ): void + + findTransactionObjects( + searchValues: { + addresses?: string[] + bundles?: string[] + tags?: string[] + approvees?: string[] + }, + callback?: (error: Error, transactions: TransactionObject[]) => void + ): void + + getLatestInclusion( + hashes: string[], + callback?: (error: Error, states: boolean[]) => void + ): void + + broadcastAndStore( + trytes: string[], + callback?: (error: Error, response: {}) => void + ): void + + getNewAddress( + seed: string, + options?: { + index?: number + checksum?: boolean + total?: number + security?: Security + returnAll?: boolean + }, + callback?: (error: Error, response: string | string[]) => void + ): void + + getInputs( + seed: string, + options?: { + start?: number + end?: number + security?: Security + threshold?: boolean + }, + callback?: (error: Error, response: { + inputs: InputObject[] + }) => void + ): void + + prepareTransfers( + seed: string, + transfers: TransferObject[], + options?: { + inputs?: string[], + address?: string, + security?: Security + }, + callback?: (error: Error, response: { + trytes: string[] + }) => void + ): void + + sendTrytes( + trytes: string[], + depth: number, + minWeightMagnitude: number, + callback?: (error: Error, response: { + inputs: TransactionObject[] + }) => void + ): void + + sendTransfer( + seed: string, + depth: number, + minWeightMagnitude: number, + transfers: TransferObject[], + options?: { + inputs: string[], + address: string + }, + callback?: (error: Error, response: { + inputs: TransactionObject[] + }) => void + ): void + + replayBundle( + transactionHash: string, + depth: number, + minWeightMagnitude: number, + callback?: (error: Error, response: {}) => void + ): void + + broadcastBundle( + transactionHash: string, + callback?: (error: Error, response: {}) => void + ): void + + getBundle( + transactionHash: string, + callback?: (error: Error, bundle: TransactionObject[]) => void + ): void + + getTransfers( + seed: string, + options?: { + start?: number + end?: number + security?: Security + inclusionStates?: boolean + }, + callback?: (error: Error, transfers: TransactionObject[][]) => void + ): void + + getAccountData( + seed: string, + options?: { + start: number + end: number + security?: Security + }, + callback?: (error: Error, response: { + latestAddress: string + addresses: string[] + transfers: string[] + inputs: InputObject[] + balance: number + }) => void + ): void + + isReattachable( + address: string | string[], + callback?: (error: Error, response: boolean | boolean[]) => void + ): void + +} + +/** +* +* iota.utils +* +**/ + +interface IotaUtils { + + convertUnits( + value: number, + fromUnit: IOTAUnit, + toUnit: IOTAUnit + ): number + + addChecksum( + inputValue: string, + checksumLength?: number, + isAddress?: boolean + ): string + + addChecksum( + inputValue: string[], + checksumLength?: number, + isAddress?: boolean + ): string[] + + noChecksum( + address: string + ): string + + isValidChecksum( + addressWithChecksum: string + ): boolean + + transactionObject( + trytes: string + ): TransactionObject + + transactionTrytes( + transaction: TransactionObject + ): string + + categorizeTransfers( + transfers: TransactionObject[], + addresses: string[] + ): { + sent: TransactionObject[] + received: TransactionObject[] + } + + toTrytes( + input: string + ): string + + fromTrytes( + trytes: string + ): string + + extractJson( + bundle: TransactionObject[] + ): string + + validateSignatures( + signedBundle: string[], + inputAddress: string + ): boolean + + isBundle( + bundle: TransactionObject[] + ): boolean + +} + +/** +* +* iota.multisig +* +**/ + +interface IotaMultisig { + + getKey( + seed: string, + index: number, + security: Security + ): string + + getDigest( + seed: string, + index: number, + security: Security + ): string + + address( + digestTrytes: string | string[] + ): MultisigAddress + + validateAddress( + multisigAddress: string, + digests: string[] + ): boolean + + initiateTransfer( + securitySum: number, + inputAddress: string, + remainderAddress: string, + transfers: TransferObject[], + callback?: (error: Error, bundle: TransactionObject[]) => void + ): void + + addSignature( + bundleToSign: TransactionObject[], + inputAddress: string, + key: string, + callback?: (error: Error, bundle: TransactionObject[]) => void + ): void + +} + +interface MultisigAddress { + + absorb( + digest: string | string[] + ): MultisigAddress + + finalize(): string + +} + +/** +* +* iota.valid +* +**/ + +interface IotaValid { + + isAddress(address: string): boolean + + isTrytes(trytes: string, length?: number): boolean + + isValue(value: any): boolean + + isNum(value: any): boolean + + isHash(hash: any): boolean + + isTransfersArray(transfers: any): boolean + + isArrayOfHashes(hashes: any): boolean + + isArrayOfTrytes(trytes: any): boolean + + isArrayOfAttachedTrytes(trytes: any): boolean + + isArrayOfTxObjects(transactions: any): boolean + + isInputs(inputs: any): boolean + + isString(string: any): boolean + + isArray(array: any): boolean + + isObject(object: any): boolean + + isUri(uri: any): boolean + +} \ No newline at end of file diff --git a/types/iota-lib-js/iota-lib-js-tests.ts b/types/iota-lib-js/iota-lib-js-tests.ts new file mode 100644 index 0000000000..59ca511293 --- /dev/null +++ b/types/iota-lib-js/iota-lib-js-tests.ts @@ -0,0 +1,114 @@ +import IOTA = require("iota.lib.js") + +const config = { + node: "https://localhost:14265", + address: "999999999999999999999999999999999999999999999999999999999999999999999999999999999", + transaction: "999999999999999999999999999999999999999999999999999999999999999999999999999999999" +} + +const iota = new IOTA({ + provider: config.node +}) + +// +// iota.api +// + +iota.api.getNodeInfo((error, info) => { + console.log(info) +}) + +iota.api.getNeighbors((error, info) => { + console.log(error, info) +}) + +iota.api.addNeighbors(["udp://127.0.0.2:14600"],(error, count) => { + console.log(count) +}) + +iota.api.removeNeighbors(["udp://127.0.0.2:14600"],(error, count) => { + console.log(count) +}) + +iota.api.findTransactions({ + addresses: [config.address] +}, (error, hashes) => { + console.log(error, hashes) +}) + +iota.api.getTrytes([config.address], (error, trytes) =>{ + console.log(trytes) +}) + +iota.api.getInclusionStates([config.address],[config.transaction], (error, states) => { + console.log(states) +}) + +iota.api.getBalances([config.address], 1, (error, states) => { + console.log(states) +}) + +iota.api.getTransactionsToApprove(1, (error, transactions) => { + console.log(transactions) +}) + +iota.api.getTransactionsObjects([config.transaction],(err, response) =>{ + console.log(response) +}) + +iota.api.findTransactionObjects({ + addresses: [config.address] +},(err, response) =>{ + console.log(response) +}) + +iota.api.getLatestInclusion([config.address], (err, response) => { + console.log(response) +}) + +// +// iota.utils +// + +console.log(iota.utils.convertUnits(1000,"i", "Mi")) + +const checksum = iota.utils.addChecksum(config.address) +console.log(iota.utils.noChecksum(checksum)) +console.log(iota.utils.isValidChecksum(checksum)) + +const transactionObj = iota.utils.transactionObject(new Array(2674).join("9")) +console.log(iota.utils.transactionTrytes(transactionObj)) + +const trytes = iota.utils.toTrytes("HELLO TANGLE") +console.log(iota.utils.fromTrytes(trytes)) + +// +// iota.valid +// + +console.log(iota.valid.isAddress(config.address)) + +console.log(iota.valid.isTrytes(trytes)) + +console.log(iota.valid.isValue(0)) + +console.log(iota.valid.isNum(0)) + +console.log(iota.valid.isHash(config.address)) + +const transferObj : TransferObject = { + address: config.address, + message: "", + value: 0, + tag: "" +} +console.log(iota.valid.isTransfersArray([transferObj])) + + + + + + + + + diff --git a/types/iota-lib-js/tsconfig.json b/types/iota-lib-js/tsconfig.json new file mode 100644 index 0000000000..972c615df3 --- /dev/null +++ b/types/iota-lib-js/tsconfig.json @@ -0,0 +1,15 @@ +{ + "compilerOptions": { + "module": "commonjs", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "iota-lib-js-tests.ts" + ] +} \ No newline at end of file diff --git a/types/iota-lib-js/tslint.json b/types/iota-lib-js/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/iota-lib-js/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From 6dbf11e176ae9d31ade4cad60a9cafed1f7d022a Mon Sep 17 00:00:00 2001 From: fogsh Date: Tue, 31 Oct 2017 19:21:21 +0200 Subject: [PATCH 14/54] Rename iota.lib.js to npm package name --- types/{iota-lib-js => iota.lib.js}/index.d.ts | 0 types/{iota-lib-js => iota.lib.js}/iota-lib-js-tests.ts | 0 types/{iota-lib-js => iota.lib.js}/tsconfig.json | 0 types/{iota-lib-js => iota.lib.js}/tslint.json | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename types/{iota-lib-js => iota.lib.js}/index.d.ts (100%) rename types/{iota-lib-js => iota.lib.js}/iota-lib-js-tests.ts (100%) rename types/{iota-lib-js => iota.lib.js}/tsconfig.json (100%) rename types/{iota-lib-js => iota.lib.js}/tslint.json (100%) diff --git a/types/iota-lib-js/index.d.ts b/types/iota.lib.js/index.d.ts similarity index 100% rename from types/iota-lib-js/index.d.ts rename to types/iota.lib.js/index.d.ts diff --git a/types/iota-lib-js/iota-lib-js-tests.ts b/types/iota.lib.js/iota-lib-js-tests.ts similarity index 100% rename from types/iota-lib-js/iota-lib-js-tests.ts rename to types/iota.lib.js/iota-lib-js-tests.ts diff --git a/types/iota-lib-js/tsconfig.json b/types/iota.lib.js/tsconfig.json similarity index 100% rename from types/iota-lib-js/tsconfig.json rename to types/iota.lib.js/tsconfig.json diff --git a/types/iota-lib-js/tslint.json b/types/iota.lib.js/tslint.json similarity index 100% rename from types/iota-lib-js/tslint.json rename to types/iota.lib.js/tslint.json From 7523ad872fd31d41f66a1b8e685a5516980ae08a Mon Sep 17 00:00:00 2001 From: fogsh Date: Tue, 31 Oct 2017 19:46:34 +0200 Subject: [PATCH 15/54] iota.lib.js lint fixes --- types/iota.lib.js/index.d.ts | 375 ++++++++++++------------- types/iota.lib.js/iota-lib-js-tests.ts | 94 +++---- types/iota.lib.js/tsconfig.json | 8 + 3 files changed, 218 insertions(+), 259 deletions(-) diff --git a/types/iota.lib.js/index.d.ts b/types/iota.lib.js/index.d.ts index 28b7a61f5a..758c6a0b3c 100644 --- a/types/iota.lib.js/index.d.ts +++ b/types/iota.lib.js/index.d.ts @@ -1,139 +1,129 @@ -// Type definitions for iota.lib.js +// Type definitions for iota.lib.js 0.4 // Project: https://github.com/iotaledger/iota.lib.js // Definitions by: Fogsh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class IotaClass { - constructor(settings: { - provider: string - sandbox?: boolean - token?: boolean - }) + provider: string; + sandbox?: boolean; + token?: boolean; + } | { + host: string; + port: number; + sandbox?: boolean; + token?: boolean; + }); - constructor(settings: { - host: string - port: number - sandbox?: boolean - token?: boolean - }) - - api: IotaApi - utils: IotaUtils - multisig: IotaMultisig - valid: IotaValid - - version: string + api: IotaApi; + utils: IotaUtils; + multisig: IotaMultisig; + valid: IotaValid; + version: string; } -declare module "iota.lib.js" { - export = IotaClass -} +export = IotaClass; -/** -* Types -*/ +// +// Types +// -type Security = 1 | 2 | 3 -type IOTAUnit = "i" | "Ki" | "Mi" | "Gi" | "Ti" | "Pi" +type Security = 1 | 2 | 3; +type IOTAUnit = "i" | "Ki" | "Mi" | "Gi" | "Ti" | "Pi"; - -/** -* Objects -*/ +// +// Objects +// interface TransactionObject { - hash: string - signatureMessageFragment: string - address: string - value: number - tag: string - timestamp: number - currentIndex: number - lastIndex: number - bundle: number - trunkTransaction: string - branchTransaction: string - attachmentTimestamp: number - attachmentTimestampLowerBound: number - attachmentTimestampUpperBound: number - nonce: string + hash: string; + signatureMessageFragment: string; + address: string; + value: number; + tag: string; + timestamp: number; + currentIndex: number; + lastIndex: number; + bundle: number; + trunkTransaction: string; + branchTransaction: string; + attachmentTimestamp: number; + attachmentTimestampLowerBound: number; + attachmentTimestampUpperBound: number; + nonce: string; } interface InputObject { - address: string - balance: number - keyIndex: number - security: Security + address: string; + balance: number; + keyIndex: number; + security: Security; } interface TransferObject { - address: string - value: number - message: string - tag: string + address: string; + value: number; + message: string; + tag: string; } interface NodeInfo { - appName: string - appVersion: string - duration: number - jreAvailableProcessors: number - jreFreeMemory: number - jreVersion: string - jreMaxMemory: number - jreTotalMemory: number - latestMilestone: string - latestMilestoneIndex: number - latestSolidSubtangleMilestone: string - latestSolidSubtangleMilestoneIndex: number - neighbors: number - packetsQueueSize: number - time: number - tips: number - transactionsToRequest: number + appName: string; + appVersion: string; + duration: number; + jreAvailableProcessors: number; + jreFreeMemory: number; + jreVersion: string; + jreMaxMemory: number; + jreTotalMemory: number; + latestMilestone: string; + latestMilestoneIndex: number; + latestSolidSubtangleMilestone: string; + latestSolidSubtangleMilestoneIndex: number; + neighbors: number; + packetsQueueSize: number; + time: number; + tips: number; + transactionsToRequest: number; } interface Neighbor { - address: string - numberOfAllTransactions: number - numberOfRandomTransactionRequests: number - numberOfInvalidTransactions: number - numberOfSentTransactions: number - numberOfNewTransactions: number - connectionType: "udp" | "tcp" + address: string; + numberOfAllTransactions: number; + numberOfRandomTransactionRequests: number; + numberOfInvalidTransactions: number; + numberOfSentTransactions: number; + numberOfNewTransactions: number; + connectionType: "udp" | "tcp"; } -/** -* -* iota.api -* -**/ +// +// iota.api +// interface IriApi { - getNodeInfo( callback: (error: Error, info: NodeInfo) => void - ): void + ): void; getNeighbors( callback: (error: Error, neighbors: Neighbor[]) => void - ): void + ): void; addNeighbors( uris: string[], callback: (error: Error, addedNeighbors: number) => void - ): void + ): void; removeNeighbors( uris: string[], callback: (error: Error, removedNeighbors: number[]) => void - ): void + ): void; getTips( callback: (error: Error, hashes: string[]) => void - ): void + ): void; findTransactions( searchValues: { @@ -143,38 +133,38 @@ interface IriApi { approvees?: string[] }, callback: (error: Error, hashes: string[]) => void - ): void + ): void; getTrytes( hashes: string[], callback: (error: Error, trytes: string[]) => void - ): void + ): void; getInclusionStates( transactions: string[], tips: string[], callback: (error: Error, states: boolean[]) => void - ): void + ): void; getBalances( addresses: string[], treshold: number, callback: (error: Error, response: { balances: number[] - milestone: string - milestoneIndex: number - duration: number + milestone: string; + milestoneIndex: number; + duration: number; }) => void - ): void + ): void; getTransactionsToApprove( depth: number, callback: (error: Error, response: { - trunkTransaction: string - branchTransaction: string - duration: number + trunkTransaction: string; + branchTransaction: string; + duration: number; }) => void - ): void + ): void; attachToTangle( trunkTransaction: string, @@ -182,36 +172,32 @@ interface IriApi { minWeightMagnitude: number, trytes: string[], callback: (error: Error, trytes: string[]) => void - ): void + ): void; interruptAttachingToTangle( callback: (error: Error, response: {}) => void - ): void + ): void; broadcastTransactions( trytes: string[], callback: (error: Error, response: {}) => void - ): void + ): void; storeTransactions( trytes: string[], callback: (error: Error, response: {}) => void - ): void - + ): void; } -/** -* -* iota.api -* -**/ +// +// iota.api +// interface IotaApi extends IriApi { - getTransactionsObjects( hashes: string[], callback?: (error: Error, transactions: TransactionObject[]) => void - ): void + ): void; findTransactionObjects( searchValues: { @@ -221,42 +207,42 @@ interface IotaApi extends IriApi { approvees?: string[] }, callback?: (error: Error, transactions: TransactionObject[]) => void - ): void + ): void; getLatestInclusion( hashes: string[], callback?: (error: Error, states: boolean[]) => void - ): void + ): void; broadcastAndStore( trytes: string[], callback?: (error: Error, response: {}) => void - ): void + ): void; getNewAddress( seed: string, options?: { - index?: number - checksum?: boolean - total?: number + index?: number; + checksum?: boolean; + total?: number; security?: Security - returnAll?: boolean + returnAll?: boolean; }, callback?: (error: Error, response: string | string[]) => void - ): void + ): void; getInputs( seed: string, options?: { - start?: number - end?: number + start?: number; + end?: number; security?: Security - threshold?: boolean + threshold?: boolean; }, callback?: (error: Error, response: { inputs: InputObject[] }) => void - ): void + ): void; prepareTransfers( seed: string, @@ -269,7 +255,7 @@ interface IotaApi extends IriApi { callback?: (error: Error, response: { trytes: string[] }) => void - ): void + ): void; sendTrytes( trytes: string[], @@ -278,7 +264,7 @@ interface IotaApi extends IriApi { callback?: (error: Error, response: { inputs: TransactionObject[] }) => void - ): void + ): void; sendTransfer( seed: string, @@ -287,105 +273,101 @@ interface IotaApi extends IriApi { transfers: TransferObject[], options?: { inputs: string[], - address: string + address: string; }, callback?: (error: Error, response: { inputs: TransactionObject[] }) => void - ): void + ): void; replayBundle( transactionHash: string, depth: number, minWeightMagnitude: number, callback?: (error: Error, response: {}) => void - ): void + ): void; broadcastBundle( transactionHash: string, callback?: (error: Error, response: {}) => void - ): void + ): void; getBundle( transactionHash: string, callback?: (error: Error, bundle: TransactionObject[]) => void - ): void + ): void; getTransfers( seed: string, options?: { - start?: number - end?: number + start?: number; + end?: number; security?: Security - inclusionStates?: boolean + inclusionStates?: boolean; }, callback?: (error: Error, transfers: TransactionObject[][]) => void - ): void + ): void; getAccountData( seed: string, options?: { - start: number - end: number + start: number; + end: number; security?: Security }, callback?: (error: Error, response: { - latestAddress: string + latestAddress: string; addresses: string[] transfers: string[] inputs: InputObject[] - balance: number + balance: number; }) => void - ): void + ): void; isReattachable( address: string | string[], callback?: (error: Error, response: boolean | boolean[]) => void - ): void - + ): void; } -/** -* -* iota.utils -* -**/ +// +// iota.utils +// interface IotaUtils { - convertUnits( value: number, fromUnit: IOTAUnit, toUnit: IOTAUnit - ): number + ): number; addChecksum( inputValue: string, checksumLength?: number, isAddress?: boolean - ): string + ): string; addChecksum( inputValue: string[], checksumLength?: number, isAddress?: boolean - ): string[] + ): string[]; noChecksum( address: string - ): string + ): string; isValidChecksum( addressWithChecksum: string - ): boolean + ): boolean; transactionObject( trytes: string - ): TransactionObject + ): TransactionObject; transactionTrytes( transaction: TransactionObject - ): string + ): string; categorizeTransfers( transfers: TransactionObject[], @@ -393,59 +375,55 @@ interface IotaUtils { ): { sent: TransactionObject[] received: TransactionObject[] - } + }; toTrytes( input: string - ): string + ): string; fromTrytes( trytes: string - ): string + ): string; extractJson( bundle: TransactionObject[] - ): string + ): string; validateSignatures( signedBundle: string[], inputAddress: string - ): boolean + ): boolean; isBundle( bundle: TransactionObject[] - ): boolean - + ): boolean; } -/** -* -* iota.multisig -* -**/ +// +// iota.multisig +// interface IotaMultisig { - getKey( seed: string, index: number, security: Security - ): string + ): string; getDigest( seed: string, index: number, security: Security - ): string + ): string; address( digestTrytes: string | string[] - ): MultisigAddress + ): MultisigAddress; validateAddress( multisigAddress: string, digests: string[] - ): boolean + ): boolean; initiateTransfer( securitySum: number, @@ -453,63 +431,56 @@ interface IotaMultisig { remainderAddress: string, transfers: TransferObject[], callback?: (error: Error, bundle: TransactionObject[]) => void - ): void + ): void; addSignature( bundleToSign: TransactionObject[], inputAddress: string, key: string, callback?: (error: Error, bundle: TransactionObject[]) => void - ): void - + ): void; } interface MultisigAddress { - absorb( digest: string | string[] - ): MultisigAddress - - finalize(): string + ): MultisigAddress; + finalize(): string; } -/** -* -* iota.valid -* -**/ +// +// iota.valid +// interface IotaValid { + isAddress(address: string): boolean; - isAddress(address: string): boolean + isTrytes(trytes: string, length?: number): boolean; - isTrytes(trytes: string, length?: number): boolean + isValue(value: any): boolean; - isValue(value: any): boolean + isNum(value: any): boolean; - isNum(value: any): boolean + isHash(hash: any): boolean; - isHash(hash: any): boolean + isTransfersArray(transfers: any): boolean; - isTransfersArray(transfers: any): boolean + isArrayOfHashes(hashes: any): boolean; - isArrayOfHashes(hashes: any): boolean + isArrayOfTrytes(trytes: any): boolean; - isArrayOfTrytes(trytes: any): boolean + isArrayOfAttachedTrytes(trytes: any): boolean; - isArrayOfAttachedTrytes(trytes: any): boolean + isArrayOfTxObjects(transactions: any): boolean; - isArrayOfTxObjects(transactions: any): boolean + isInputs(inputs: any): boolean; - isInputs(inputs: any): boolean + isString(string: any): boolean; - isString(string: any): boolean + isArray(array: any): boolean; - isArray(array: any): boolean + isObject(object: any): boolean; - isObject(object: any): boolean - - isUri(uri: any): boolean - -} \ No newline at end of file + isUri(uri: any): boolean; +} diff --git a/types/iota.lib.js/iota-lib-js-tests.ts b/types/iota.lib.js/iota-lib-js-tests.ts index 59ca511293..6b3c3a9b85 100644 --- a/types/iota.lib.js/iota-lib-js-tests.ts +++ b/types/iota.lib.js/iota-lib-js-tests.ts @@ -1,114 +1,94 @@ -import IOTA = require("iota.lib.js") +import IOTA = require("iota.lib.js"); const config = { node: "https://localhost:14265", address: "999999999999999999999999999999999999999999999999999999999999999999999999999999999", transaction: "999999999999999999999999999999999999999999999999999999999999999999999999999999999" -} +}; const iota = new IOTA({ provider: config.node -}) +}); // // iota.api // iota.api.getNodeInfo((error, info) => { - console.log(info) -}) +}); iota.api.getNeighbors((error, info) => { - console.log(error, info) -}) +}); -iota.api.addNeighbors(["udp://127.0.0.2:14600"],(error, count) => { - console.log(count) -}) +iota.api.addNeighbors(["udp://127.0.0.2:14600"], (error, count) => { +}); -iota.api.removeNeighbors(["udp://127.0.0.2:14600"],(error, count) => { - console.log(count) -}) +iota.api.removeNeighbors(["udp://127.0.0.2:14600"], (error, count) => { +}); iota.api.findTransactions({ addresses: [config.address] }, (error, hashes) => { - console.log(error, hashes) -}) +}); -iota.api.getTrytes([config.address], (error, trytes) =>{ - console.log(trytes) -}) +iota.api.getTrytes([config.address], (error, trytes) => { +}); -iota.api.getInclusionStates([config.address],[config.transaction], (error, states) => { - console.log(states) -}) +iota.api.getInclusionStates([config.address], [config.transaction], (error, states) => { +}); iota.api.getBalances([config.address], 1, (error, states) => { - console.log(states) -}) +}); iota.api.getTransactionsToApprove(1, (error, transactions) => { - console.log(transactions) -}) +}); -iota.api.getTransactionsObjects([config.transaction],(err, response) =>{ - console.log(response) -}) +iota.api.getTransactionsObjects([config.transaction], (err, response) => { +}); iota.api.findTransactionObjects({ addresses: [config.address] -},(err, response) =>{ - console.log(response) -}) +}, (err, response) => { +}); iota.api.getLatestInclusion([config.address], (err, response) => { - console.log(response) -}) +}); // // iota.utils // -console.log(iota.utils.convertUnits(1000,"i", "Mi")) +iota.utils.convertUnits(1000, "i", "Mi"); -const checksum = iota.utils.addChecksum(config.address) -console.log(iota.utils.noChecksum(checksum)) -console.log(iota.utils.isValidChecksum(checksum)) +const checksum = iota.utils.addChecksum(config.address); +iota.utils.noChecksum(checksum); +iota.utils.isValidChecksum(checksum); -const transactionObj = iota.utils.transactionObject(new Array(2674).join("9")) -console.log(iota.utils.transactionTrytes(transactionObj)) +const transactionObj = iota.utils.transactionObject(new Array(2674).join("9")); +iota.utils.transactionTrytes(transactionObj); -const trytes = iota.utils.toTrytes("HELLO TANGLE") -console.log(iota.utils.fromTrytes(trytes)) +const trytes = iota.utils.toTrytes("HELLO TANGLE"); +iota.utils.fromTrytes(trytes); // // iota.valid // -console.log(iota.valid.isAddress(config.address)) +iota.valid.isAddress(config.address); -console.log(iota.valid.isTrytes(trytes)) +iota.valid.isTrytes(trytes); -console.log(iota.valid.isValue(0)) +iota.valid.isValue(0); -console.log(iota.valid.isNum(0)) +iota.valid.isNum(0); -console.log(iota.valid.isHash(config.address)) +iota.valid.isHash(config.address); -const transferObj : TransferObject = { +const transferObj = { address: config.address, message: "", value: 0, tag: "" -} -console.log(iota.valid.isTransfersArray([transferObj])) - - - - - - - - +}; +iota.valid.isTransfersArray([transferObj]); diff --git a/types/iota.lib.js/tsconfig.json b/types/iota.lib.js/tsconfig.json index 972c615df3..3c8f269b4b 100644 --- a/types/iota.lib.js/tsconfig.json +++ b/types/iota.lib.js/tsconfig.json @@ -1,9 +1,17 @@ { "compilerOptions": { "module": "commonjs", + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true From 19b072026936d22d533ec3a1947a9d38041a5f8d Mon Sep 17 00:00:00 2001 From: fogsh Date: Tue, 31 Oct 2017 19:51:46 +0200 Subject: [PATCH 16/54] Rename iota.lib.js test file to match package name --- types/iota.lib.js/{iota-lib-js-tests.ts => iota.lib.js-tests.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename types/iota.lib.js/{iota-lib-js-tests.ts => iota.lib.js-tests.ts} (100%) diff --git a/types/iota.lib.js/iota-lib-js-tests.ts b/types/iota.lib.js/iota.lib.js-tests.ts similarity index 100% rename from types/iota.lib.js/iota-lib-js-tests.ts rename to types/iota.lib.js/iota.lib.js-tests.ts From 0da135b606b7caabb138ae412147f22ce990b17a Mon Sep 17 00:00:00 2001 From: fogsh Date: Tue, 31 Oct 2017 20:10:45 +0200 Subject: [PATCH 17/54] tsconfig filename typo fix --- types/iota.lib.js/tsconfig.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/iota.lib.js/tsconfig.json b/types/iota.lib.js/tsconfig.json index 3c8f269b4b..b206b83455 100644 --- a/types/iota.lib.js/tsconfig.json +++ b/types/iota.lib.js/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "iota-lib-js-tests.ts" + "iota.lib.js-tests.ts" ] } \ No newline at end of file From 1ddb7d489a318a66baf67798ad8c325dfecf0bba Mon Sep 17 00:00:00 2001 From: mtraynham Date: Wed, 1 Nov 2017 11:40:50 -0400 Subject: [PATCH 18/54] Add types for json-query --- types/json-query/index.d.ts | 58 +++++++++++++ types/json-query/json-query-tests.ts | 123 +++++++++++++++++++++++++++ types/json-query/tsconfig.json | 23 +++++ types/json-query/tslint.json | 1 + 4 files changed, 205 insertions(+) create mode 100644 types/json-query/index.d.ts create mode 100644 types/json-query/json-query-tests.ts create mode 100644 types/json-query/tsconfig.json create mode 100644 types/json-query/tslint.json diff --git a/types/json-query/index.d.ts b/types/json-query/index.d.ts new file mode 100644 index 0000000000..929ab738ae --- /dev/null +++ b/types/json-query/index.d.ts @@ -0,0 +1,58 @@ +// Type definitions for json-query 2.2 +// Project: http://github.com/mmckegg/json-query#readme +// Definitions by: Matt Traynham +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = JsonQuery; + +declare function JsonQuery( + selector: JsonQuery.Selector | JsonQuery.SelectorWithQueryParams, + options: JsonQuery.Options +): JsonQuery.Result; + +declare namespace JsonQuery { + type Selector = string; + + type QueryParam = any; + // No way to support [Selector, ...QueryParam[]]? + // 10 params should be more than enough, hopefully. + type SelectorWithQueryParams = + [Selector, QueryParam] + | [Selector, QueryParam] + | [Selector, QueryParam] + | [Selector, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam] + | [Selector, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam, QueryParam]; + + type Context = any; + + type Filter = (input: Context, ...args: any[]) => Context; + interface Locals { + [filterName: string]: Filter; + } + + interface Options { + data?: Context; + rootContext?: Context; + source?: Context; + context?: Context; + parent?: Context; + locals?: Locals; + globals?: boolean; + force?: boolean; + allowRegexp?: boolean; + } + + interface Result { + value: any; + key: string; + references: any[]; + parents: string[]; + } +} diff --git a/types/json-query/json-query-tests.ts b/types/json-query/json-query-tests.ts new file mode 100644 index 0000000000..5da1ca9e78 --- /dev/null +++ b/types/json-query/json-query-tests.ts @@ -0,0 +1,123 @@ +import jsonQuery = require('json-query'); + +// API +let data: jsonQuery.Context = { + people: [ + {name: 'Matt', country: 'NZ'}, + {name: 'Pete', country: 'AU'}, + {name: 'Mikey', country: 'NZ'} + ] +}; +jsonQuery('people[country=NZ].name', {data}); // => {value: 'Matt', parents: [...], key: 0} ... etc + +// Deep Queries +data = { + grouped_people: { + friends: [ + {name: 'Steve', country: 'NZ'}, + {name: 'Jane', country: 'US'}, + {name: 'Mike', country: 'AU'}, + {name: 'Mary', country: 'NZ'} + ], + enemies: [ + {name: 'Evil Steve', country: 'AU'}, + {name: 'Betty', country: 'NZ'} + ] + } +}; +const result: any = jsonQuery('grouped_people[**][*country=NZ]', {data}).value; + +// Inner Queries +data = { + page: { + id: 'page_1', + title: 'Test' + }, + comments_lookup: { + page_1: [ + {id: 'comment_1', parent_id: 'page_1', content: "I am a comment"} + ] + } +}; +jsonQuery('comments_lookup[{page.id}]', {data}); + +// Local functions (helpers) +const locals: jsonQuery.Locals = { + greetingName: (input: jsonQuery.Context) => { + if (input.known_as) { + return input.known_as; + } else { + return input.name; + } + }, + and: (inputA: jsonQuery.Context, inputB: boolean) => { + return inputA && inputB; + }, + text: (input: jsonQuery.Context, text: string) => { + return text; + }, + then: (input: jsonQuery.Context, thenValue: string, elseValue: string) => { + if (input) { + return thenValue; + } else { + return elseValue; + } + } +}; +data = { + is_fullscreen: true, + is_playing: false, + user: { + name: "Matthew McKegg", + known_as: "Matt" + } +}; +jsonQuery('user:greetingName', {data, locals}).value; // => "Matt" +jsonQuery(['is_fullscreen:and({is_playing}):then(?, ?)', "Playing big!", "Not so much"], {data, locals}).value; // => "Not so much" +jsonQuery(':text(This displays text cos we made it so)', {locals}).value; // => "This displays text cos we made it so" +jsonQuery('people:select(name, country)', { + data, + locals: { + select: (input: jsonQuery.Context, ...keys: string[]) => { + if (Array.isArray(input)) { + return input.map((item: any) => { + return Object.keys(item).reduce((result: {[p: string]: any}, key: string) => { + if (~keys.indexOf(key)) { + result[key] = item[key]; + } + return result; + }, {}); + }); + } + } + } +}); +jsonQuery('people[*:recentlyUpdated]', { + data, + locals: { + recentlyUpdated: (item: {updatedAt: number}) => { + return item.updatedAt < Date.now() - (30 * 24 * 60 * 60 * 1000); + } + } +}); + +// Context +data = { + styles: { + bold: 'font-weight:strong', + red: 'color: red' + }, + paragraphs: [ + {content: "I am a red paragraph", style: 'red'}, + {content: "I am a bold paragraph", style: 'bold'}, + ], +}; +let pageHtml = ''; +data.paragraphs.forEach((paragraph: {content: string, style: string}) => { + const style = jsonQuery('styles[{.style}]', {data, source: paragraph}).value; + const content = jsonQuery('.content', {data, source: paragraph}).value; // pretty pointless :) + pageHtml += `

    ${content}

    `; +}); + +// Query Params +jsonQuery(['people[country=?]', 'NZ'], {data}); diff --git a/types/json-query/tsconfig.json b/types/json-query/tsconfig.json new file mode 100644 index 0000000000..9a317f4d83 --- /dev/null +++ b/types/json-query/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", + "json-query-tests.ts" + ] +} \ No newline at end of file diff --git a/types/json-query/tslint.json b/types/json-query/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/json-query/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 41b5d8e7322059d81f075f3ae38a06aef66f3245 Mon Sep 17 00:00:00 2001 From: Mitsuru Ogawa Date: Fri, 3 Nov 2017 22:32:29 +0900 Subject: [PATCH 19/54] Add react-s-alert --- types/react-s-alert/index.d.ts | 55 +++++++++++++++++++++ types/react-s-alert/react-s-alert-tests.tsx | 46 +++++++++++++++++ types/react-s-alert/tsconfig.json | 25 ++++++++++ types/react-s-alert/tslint.json | 6 +++ 4 files changed, 132 insertions(+) create mode 100644 types/react-s-alert/index.d.ts create mode 100644 types/react-s-alert/react-s-alert-tests.tsx create mode 100644 types/react-s-alert/tsconfig.json create mode 100644 types/react-s-alert/tslint.json diff --git a/types/react-s-alert/index.d.ts b/types/react-s-alert/index.d.ts new file mode 100644 index 0000000000..54e3f5551b --- /dev/null +++ b/types/react-s-alert/index.d.ts @@ -0,0 +1,55 @@ +// Type definitions for react-s-alert 1.3 +// Project: https://github.com/juliancwirko/react-s-alert +// Definitions by: mitsuruog +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as React from "react"; + +declare class SAlert extends React.Component {} + +declare namespace SAlert { + interface SAlertConfigProps { + position?: string; + offset?: number; + stack?: boolean | SAlertStackProps; + effect?: string; + beep?: string | boolean | SAlertBeepProps; + timeout?: string | number; + html?: boolean; + onClose?: () => void; + onShow?: () => void; + customFields?: object; + contentTemplate?: Function; + } + + interface SAlertProps extends SAlertConfigProps { + message?: string; + } + + interface SAlertStackProps { + limit?: number; + spacing?: number; + } + + interface SAlertBeepProps { + info?: string; + error?: string; + warning?: string; + success?: string; + } + + function info(msg?: string, data?: SAlertConfigProps): number; + + function error(msg?: string, data?: SAlertConfigProps): number; + + function warning(msg?: string, data?: SAlertConfigProps): number; + + function success(msg?: string, data?: SAlertConfigProps): number; + + function close(id: number): void; + + function closeAll(): void; +} + +export default SAlert; diff --git a/types/react-s-alert/react-s-alert-tests.tsx b/types/react-s-alert/react-s-alert-tests.tsx new file mode 100644 index 0000000000..5c8af89a96 --- /dev/null +++ b/types/react-s-alert/react-s-alert-tests.tsx @@ -0,0 +1,46 @@ +import * as React from "react"; +import Alert from "react-s-alert"; + +const config = { + position: "top", + offset: 100, + stack: { + limit: 3, + spacing: 50, + }, + effect: "genie", + beep: { + info: "beep.mp3", + error: "beep.mp3", + warning: "beep.mp3", + success: "beep.mp3", + }, + timeout: 1000, + html: true, + onClose: () => {}, + onShow: () => {}, + customFields: {}, +}; + +class Test extends React.Component { + render() { + return ( +
    + + +
    + ); + } +} + +Alert.info("I am a info message.", config); +Alert.error("I am an error message.", config); +Alert.warning("I am a warning message.", config); +Alert.success("I am a success message", config); + +const index = Alert.info("Hello"); +Alert.close(index); + +Alert.closeAll(); diff --git a/types/react-s-alert/tsconfig.json b/types/react-s-alert/tsconfig.json new file mode 100644 index 0000000000..c029ed03aa --- /dev/null +++ b/types/react-s-alert/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-s-alert-tests.tsx" + ] +} diff --git a/types/react-s-alert/tslint.json b/types/react-s-alert/tslint.json new file mode 100644 index 0000000000..bcc9e3dd1b --- /dev/null +++ b/types/react-s-alert/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "ban-types": false + } + } From a11adde10f0a1643237fdbd70e74dad88860d22e Mon Sep 17 00:00:00 2001 From: Mitsuru Ogawa Date: Sat, 4 Nov 2017 22:09:29 +0900 Subject: [PATCH 20/54] Remove ban-types rule --- types/react-s-alert/index.d.ts | 2 +- types/react-s-alert/tslint.json | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/types/react-s-alert/index.d.ts b/types/react-s-alert/index.d.ts index 54e3f5551b..42a0557162 100644 --- a/types/react-s-alert/index.d.ts +++ b/types/react-s-alert/index.d.ts @@ -20,7 +20,7 @@ declare namespace SAlert { onClose?: () => void; onShow?: () => void; customFields?: object; - contentTemplate?: Function; + contentTemplate?: (...args: any[]) => any; } interface SAlertProps extends SAlertConfigProps { diff --git a/types/react-s-alert/tslint.json b/types/react-s-alert/tslint.json index bcc9e3dd1b..593f1d33c8 100644 --- a/types/react-s-alert/tslint.json +++ b/types/react-s-alert/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "ban-types": false - } + "extends": "dtslint/dt.json" } From 49764af96088728b7ab328bd3ec397e151978a19 Mon Sep 17 00:00:00 2001 From: Sander Pick Date: Sun, 5 Nov 2017 09:41:50 -0800 Subject: [PATCH 21/54] Add cleanDiacritics method --- types/underscore.string/index.d.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/types/underscore.string/index.d.ts b/types/underscore.string/index.d.ts index c173dfbfa5..2d067679d5 100644 --- a/types/underscore.string/index.d.ts +++ b/types/underscore.string/index.d.ts @@ -91,6 +91,13 @@ declare module 'underscore' { */ clean(str: string): string; + /** + * Replace diacritic characters with closest ASCII equivalents. + * cleanDiacritics('ääkkönen') => 'aakkonen' + * @param str + */ + cleanDiacritics(str: string): string; + /** * Count occurences of a sub string. * ('Hello world', 'l') => 3 From 7ec78b6dea2bb67c14ea558523c555ce38c3fcb0 Mon Sep 17 00:00:00 2001 From: Sander Pick Date: Sun, 5 Nov 2017 09:44:07 -0800 Subject: [PATCH 22/54] Add cleanDiacritics test --- types/underscore.string/underscore.string-tests.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/underscore.string/underscore.string-tests.ts b/types/underscore.string/underscore.string-tests.ts index 8eed630854..545f6362d6 100644 --- a/types/underscore.string/underscore.string-tests.ts +++ b/types/underscore.string/underscore.string-tests.ts @@ -13,6 +13,8 @@ _.chop('whitespace', 3); _.clean(' foo bar '); +_.cleanDiacritics('ääkkönen'); + _.chars('Hello'); _.swapCase('hELLO'); From b3f06feb4573461623dbf83b837442a96d0ae7b5 Mon Sep 17 00:00:00 2001 From: kl4kennylee81 Date: Sun, 5 Nov 2017 01:01:46 -0700 Subject: [PATCH 23/54] supercluster: added initial,map,reduce to Options --- types/supercluster/index.d.ts | 21 +++++++++++++++++++++ types/supercluster/supercluster-tests.ts | 21 ++++++++++++++++++--- 2 files changed, 39 insertions(+), 3 deletions(-) diff --git a/types/supercluster/index.d.ts b/types/supercluster/index.d.ts index 5fb9ccf792..7fd487ae09 100644 --- a/types/supercluster/index.d.ts +++ b/types/supercluster/index.d.ts @@ -33,6 +33,27 @@ export interface Options { * Whether timing info should be logged. */ log?: boolean; + /** + * a reduce function for calculating custom cluster properties + * + * @example + * function (accumulated, props) { accumulated.sum += props.sum; } + */ + reduce?: (accumulated: any, props: any) => void; + /** + * initial properties of a cluster (before running the reducer) + * + * @example + * function () { return {sum: 0}; } + */ + initial?: () => any; + /** + * properties to use for individual points when running the reducer + * + * @example + * function (props) { return {sum: props.my_value}; } + */ + map?: (props: any) => any; } export class Supercluster { diff --git a/types/supercluster/supercluster-tests.ts b/types/supercluster/supercluster-tests.ts index 2fe5eeff39..e3120206e9 100644 --- a/types/supercluster/supercluster-tests.ts +++ b/types/supercluster/supercluster-tests.ts @@ -2,21 +2,36 @@ import supercluster, { Point } from 'supercluster'; const point1: Point = { type: 'Feature', - properties: {}, + properties: {my_value: 2}, geometry: { type: 'Point', coordinates: [10, 20] } }; const point2: Point = { type: 'Feature', - properties: {}, + properties: {my_value: 3}, geometry: { type: 'Point', coordinates: [20, 30] } }; const points = [point1, point2]; +const initialFunction = () => { + return {sum: 0}; +}; + +const mapFunction = (props: any) => { + return {sum: props.my_value}; +}; + +const reduceFunction = (accumulated: any, props: any) => { + accumulated.sum += props.sum; +}; + const index = supercluster({ radius: 40, maxZoom: 16, extent: 256, - log: true + log: true, + initial: initialFunction, + map: mapFunction, + reduce: reduceFunction, }); index.load(points); const clusters = index.getClusters([-180, -85, 180, 85], 2); From 483c1ab97d7b0f99c5ff0bb2496e852aaee8f5f2 Mon Sep 17 00:00:00 2001 From: Angelo Ocana Date: Sun, 5 Nov 2017 21:35:52 -0500 Subject: [PATCH 24/54] Ramda: Make partial and partialRight binary fns Change Added to Ramda 0.18.0 Pull Request: https://github.com/ramda/ramda/pull/1433 Upgrade guide: https://github.com/ramda/ramda/issues/1436 --- types/ramda/index.d.ts | 20 +++++++++++--------- types/ramda/ramda-tests.ts | 8 ++++---- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 2f96611b86..59d2fcf26b 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -10,6 +10,7 @@ // Simon Højberg // Charles-Philippe Clermont // Samson Keung +// Angelo Ocana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -1196,19 +1197,20 @@ declare namespace R { pair(fst: F, snd: S): [F, S]; /** - * Accepts as its arguments a function and any number of values and returns a function that, - * when invoked, calls the original function with all of the values prepended to the - * original function's arguments list. In some libraries this function is named `applyLeft`. + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided initially followed by the arguments provided to `g`. */ - partial(fn: (...a: any[]) => any, ...args: any[]): (...a: any[]) => any; - partial(fn: (...a: any[]) => T, ...args: any[]): (...a: any[]) => T; + partial(fn: (...a: any[]) => any, args: any[]): (...a: any[]) => any; + partial(fn: (...a: any[]) => T, args: any[]): (...a: any[]) => T; /** - * Accepts as its arguments a function and any number of values and returns a function that, - * when invoked, calls the original function with all of the values appended to the original - * function's arguments list. + * Takes a function `f` and a list of arguments, and returns a function `g`. + * When applied, `g` returns the result of applying `f` to the arguments + * provided to `g` followed by the arguments provided initially. */ - partialRight(fn: (...a: any[]) => any, ...args: any[]): (...a: any[]) => any; + partialRight(fn: (...a: any[]) => any, args: any[]): (...a: any[]) => any; + partialRight(fn: (...a: any[]) => T, args: any[]): (...a: any[]) => T; /** * Takes a predicate and a list and returns the pair of lists of elements diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 3767109e8e..ddaf6d95b1 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -266,18 +266,18 @@ R.times(i, 5); return a * b; } - const double = R.partial(multiply, 2); + const double = R.partial(multiply, [2]); double(2); // => 4 function greet(salutation: string, title: string, firstName: string, lastName: string) { return `${salutation}, ${title} ${firstName} ${lastName}!`; } - const sayHello = R.partial(greet, "Hello"); - const sayHelloToMs = R.partial(sayHello, "Ms."); + const sayHello = R.partial(greet, ["Hello"]); + const sayHelloToMs = R.partial(sayHello, ["Ms."]); sayHelloToMs("Jane", "Jones"); // => 'Hello, Ms. Jane Jones!' - const greetMsJaneJones = R.partialRight(greet, "Ms.", "Jane", "Jones"); + const greetMsJaneJones = R.partialRight(greet, ["Ms.", "Jane", "Jones"]); greetMsJaneJones("Hello"); // => 'Hello, Ms. Jane Jones!' })(); From 947a197a89bf18bc954ccfd31a87176b916a8ed0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan-Niclas=20Str=C3=BCwer?= Date: Mon, 6 Nov 2017 11:42:17 +0100 Subject: [PATCH 25/54] the documentation correctly describes that a layout object should be returned by the method calls layout and makeLayout. It is essential that you are able to call layoutObject.run() after setting a new layout, because else the layout change will not be applied. --- types/cytoscape/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index 40a500a354..85b3a97e46 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -978,7 +978,7 @@ declare namespace cytoscape { * An analogue to run a layout on a subset of the graph exists as eles.layout(). * http://js.cytoscape.org/#cy.layout */ - layout(layout: LayoutOptions): void; + layout(layout: LayoutOptions): LayoutManipulation; /** * Get a new layout, which can be used to algorithmically * position the nodes in the graph. @@ -991,7 +991,7 @@ declare namespace cytoscape { * Note that you must call layout.run() in order for it to affect the graph. * An analogue to make a layout on a subset of the graph exists as eles.makeLayout(). */ - makeLayout(options: LayoutOptions): void; + makeLayout(options: LayoutOptions): LayoutManipulation; } /** From dd669cd78bc4c6dfd6d6fc22dc061e76abf571bf Mon Sep 17 00:00:00 2001 From: Angelo Ocana Date: Mon, 6 Nov 2017 10:29:25 -0500 Subject: [PATCH 26/54] Ramda: Remove return Any for partial/partialRight Remove return **Any** signature for **partial** and **partialRight** as asked by @samsonkeung https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21262/files/483c1ab97d7b0f99c5ff0bb2496e852aaee8f5f2#r148995006 https://github.com/DefinitelyTyped/DefinitelyTyped/pull/21262/files/483c1ab97d7b0f99c5ff0bb2496e852aaee8f5f2#r148995018 --- types/ramda/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 59d2fcf26b..5875b4ef50 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1201,7 +1201,6 @@ declare namespace R { * When applied, `g` returns the result of applying `f` to the arguments * provided initially followed by the arguments provided to `g`. */ - partial(fn: (...a: any[]) => any, args: any[]): (...a: any[]) => any; partial(fn: (...a: any[]) => T, args: any[]): (...a: any[]) => T; /** @@ -1209,7 +1208,6 @@ declare namespace R { * When applied, `g` returns the result of applying `f` to the arguments * provided to `g` followed by the arguments provided initially. */ - partialRight(fn: (...a: any[]) => any, args: any[]): (...a: any[]) => any; partialRight(fn: (...a: any[]) => T, args: any[]): (...a: any[]) => T; /** From 0531c2cb37c39a1fc10311ca54ebdbcfe04ca9e0 Mon Sep 17 00:00:00 2001 From: Steven Fan Date: Mon, 6 Nov 2017 11:00:49 -0500 Subject: [PATCH 27/54] Remove myself from angulartics contributors --- types/angulartics/index.d.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/types/angulartics/index.d.ts b/types/angulartics/index.d.ts index e1b36bc210..40ff202329 100644 --- a/types/angulartics/index.d.ts +++ b/types/angulartics/index.d.ts @@ -1,7 +1,6 @@ // Type definitions for Angulartics 1.4 // Project: http://luisfarzati.github.io/angulartics/ -// Definitions by: Steven Fan -// Bateast2 +// Definitions by: Bateast2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 From 267ab9581b6d33756bca4234f56f831e1f6101ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Einar=20Nor=C3=B0fj=C3=B6r=C3=B0?= Date: Mon, 6 Nov 2017 17:44:19 +0000 Subject: [PATCH 28/54] Improve noUiSlider definitions 1) range is an object from `string` to `number | number[]` [See the documentation](https://refreshless.com/nouislider/slider-options/) 2) the Instance exposes an updateOptions method [See the documentation](https://refreshless.com/nouislider/more/#section-update) 3) the instance exposes an options object [See the documentation](https://refreshless.com/nouislider/more/#section-update) > Options can be read from the slider using the slider.noUiSlider.options property --- types/nouislider/index.d.ts | 169 +++++++++++++++++++----------------- 1 file changed, 89 insertions(+), 80 deletions(-) diff --git a/types/nouislider/index.d.ts b/types/nouislider/index.d.ts index 4389b87d49..0e070e89c7 100644 --- a/types/nouislider/index.d.ts +++ b/types/nouislider/index.d.ts @@ -8,102 +8,102 @@ export = noUiSlider; export as namespace noUiSlider; declare namespace noUiSlider { - /** + /** * To create a slider, call noUiSlider.create() with an element and your options. */ - function create(target: HTMLElement, options: Options): void; + function create(target: HTMLElement, options: Options): void; - interface Options { - /** + interface Options { + /** * The start option sets the number of handles and their start positions, relative to range. */ - start: number | number[] | number[][]; - /** + start: number | number[] | number[][]; + /** * All values on the slider are part of a range. The range has a minimum and maximum value. * The minimum value cannot be equal to the maximum value. */ - range: Object; - /** + range: { [key: string]: number | number[] }; + /** * The connect setting can be used to control the (green) bar between the handles, or the edges of the slider. - * Pass an array with a boolean for every connecting element, including the edges of the slider. + * Pass an array with a boolean for every connecting element, including the edges of the slider. * The length of this array must match the handle count + 1. * Setting true sets the bars between the handles, but not between the handles and the sliders edges. */ - connect?: boolean | boolean[]; - /** + connect?: boolean | boolean[]; + /** * When using two handles, the minimum distance between the handles can be set using the margin option. * The margin value is relative to the value set in 'range'. * This option is only available on standard linear sliders. */ - margin?: number; - /** + margin?: number; + /** * The limit option is the opposite of the margin option, * limiting the maximum distance between two handles. * As with the margin option, the limit option can only be used on linear sliders. */ - limit?: number; - /** + limit?: number; + /** * Padding limits how close to the slider edges handles can be. */ - padding?: number; - /** + padding?: number; + /** * By default, the slider slides fluently. * In order to make the handles jump between intervals, you can use this option. * The step option is relative to the values provided to range. */ - step?: number; - /** + step?: number; + /** * The orientation setting can be used to set the slider to "vertical" or "horizontal". * Set dimensions! Vertical sliders don't assume a default height, so you'll need to set one. * You can use any unit you want, including % or px. */ - orientation?: "vertical" | "horizontal"; - /** + orientation?: 'vertical' | 'horizontal'; + /** * By default the sliders are top-to-bottom and left-to-right, * but you can change this using the direction option, * which decides where the upper side of the slider is. */ - direction?: "ltr" | "rtl"; - /** - * noUiSlider can provide a basic tooltip without using its events system. - * Set the tooltips option to true to enable. - * This option can also accept formatting options to format the tooltips content. + direction?: 'ltr' | 'rtl'; + /** + * noUiSlider can provide a basic tooltip without using its events system. + * Set the tooltips option to true to enable. + * This option can also accept formatting options to format the tooltips content. * In that case, pass an array with a formatter for each handle, true to use the default or false to display no tooltip. */ - tooltips?: boolean | Object | ((...args:any[]) => any); - /** + tooltips?: boolean | Object | ((...args: any[]) => any); + /** * Set the animate option to false to prevent the slider from animating to a new value with when calling .val(). */ - animate?: boolean; - /** + animate?: boolean; + /** * The animationDuration option can be used to set the animation speed assumed by the slider library. * In addition to this, you must manually set the CSS (-webkit-)transition property for the .noUi-state-tap .noUi-origin selector. */ - animationDuration?: number; - /** + animationDuration?: number; + /** * When a non-linear slider has been configured, the snap option can be set to true to force the slider to jump * between the specified values. */ - snap?: boolean; - /** + snap?: boolean; + /** * All values on the slider are part of a range. The range has a minimum and maximum value. */ - behaviour?: string; - /** + behaviour?: string; + /** * To format the slider output, noUiSlider offers a format option. * Simply specify to and from functions to encode and decode the values. * See manual formatting to the right for usage information. * By default, noUiSlider will format output with 2 decimals. */ - format?: Object | ((...args:any[]) => any); - /** + format?: Object | ((...args: any[]) => any); + /** * Allows you to generate points along the slider. */ - pips?: PipsOptions; - } + pips?: PipsOptions; + } - interface PipsOptions { - /** + interface PipsOptions { + /** * The 'range' mode uses the slider range to determine where the pips should be. A pip is generated for every percentage specified. * * The 'steps', like 'range', uses the slider range. In steps mode, a pip is generated for every step. @@ -118,83 +118,92 @@ declare namespace noUiSlider { * The 'values' mode is similar to positions, but it accepts values instead of percentages. The stepped option can be used for this mode. * */ - mode: "range" | "steps" | "positions" | "count" | "values"; - /** + mode: 'range' | 'steps' | 'positions' | 'count' | 'values'; + /** * Range Mode: percentage for range mode * Step Mode: step number for steps * Positions Mode: percentage-based positions on the slider * Count Mode: positions between pips */ - density?: number; - /** + density?: number; + /** * Step Mode: The filter option can be used to filter the generated pips. * The filter function must return 0 (no value), 1 (large value) or 2 (small value). */ - filter?: (...args: any[]) => PipFilterResult; - /** + filter?: (...args: any[]) => PipFilterResult; + /** * format for step mode * see noUiSlider format */ - format?: Object | ((...args:any[]) => any); - /** + format?: Object | ((...args: any[]) => any); + /** * * values for positions and values mode * number pips for count mode */ - values?: number | number[]; - /** + values?: number | number[]; + /** * stepped option for positions, values and count mode */ - stepped?: boolean; - } + stepped?: boolean; + } - const enum PipFilterResult { - NoValue, - LargeValue, - SmallValue, - } + const enum PipFilterResult { + NoValue, + LargeValue, + SmallValue, + } - interface Callback { - /** + interface Callback { + /** * Array for both one-handle and two-handle sliders. It contains the current slider values, * with formatting applied. */ - (values: any[], handle: number, unencodedValues: number[]): void; - } + (values: any[], handle: number, unencodedValues: number[]): void; + } - interface noUiSlider { - /** + interface noUiSlider { + /** * Bind event to the slider. */ - on(eventName: string, callback: Callback): void; - /** + on(eventName: string, callback: Callback): void; + /** * Unbind event to the slider. */ - off(eventName: string): void; - /** + off(eventName: string): void; + /** * Destroy's the slider. */ - destroy(): void; - /** + destroy(): void; + /** * To get the current slider value. For one-handle sliders, calling .get() will return the value. * For two-handle sliders, an array[value, value] will be returned. */ - get(): number | number[]; - /** + get(): number | number[]; + /** * noUiSlider will keep your values within the slider range, which saves you a bunch of validation. * If you have configured the slider to use one handle, you can change the current value by passing * a number to the .set() method. If you have two handles, pass an array. One-handled sliders * will also accept arrays. Within an array, you can set one position to null * if you want to leave a handle unchanged. */ - set(value: number | (number | null)[]): void; - /** + set(value: number | (number | null)[]): void; + /** * To return to the initial slider values, you can use the .reset() method. This will only reset the slider values. */ - reset(): void; - } + reset(): void; + /** + * Exposes the options used to create the noUiSlider instance + */ + options: Options; + /** + * method that can change the 'margin', 'limit', 'step', 'range', 'animate' and 'snap' options. + * All other options require changes to the slider's HTML or event bindings. + */ + updateOptions(newOptions: Options, fireSetEvent?: boolean): void; + } - interface Instance extends HTMLElement { - noUiSlider: noUiSlider; - } + interface Instance extends HTMLElement { + noUiSlider: noUiSlider; + } } From b3ce125aee24087b54da8d320e1f84d71cbaf617 Mon Sep 17 00:00:00 2001 From: Andy Hanson Date: Mon, 6 Nov 2017 10:27:18 -0800 Subject: [PATCH 29/54] semantic-ui: Increment typescript version to 2.3 to match dependencies --- types/semantic-ui/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/semantic-ui/index.d.ts b/types/semantic-ui/index.d.ts index e36ff8c748..00b2c7c273 100644 --- a/types/semantic-ui/index.d.ts +++ b/types/semantic-ui/index.d.ts @@ -2,7 +2,7 @@ // Project: http://semantic-ui.com/ // Definitions by: Leonard Thieu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 /// From 9413f9cb41da76379a3b86c9111985b507d27c50 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 6 Nov 2017 11:28:30 -0800 Subject: [PATCH 30/54] node types don't really require TypeScript@2.2 (#21283) --- types/node/index.d.ts | 1 - types/node/node-tests.ts | 39 ++++++++++++++++----------------------- types/node/tsconfig.json | 1 + 3 files changed, 17 insertions(+), 24 deletions(-) diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 2fa564ce3e..6d65f5999e 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -14,7 +14,6 @@ // Kelvin Jin // Alvis HT Tang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 /************************************************ * * diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index 6b0574e603..d33dee0c93 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1620,19 +1620,7 @@ namespace path_tests { // returns // ['foo', 'bar', 'baz'] - console.log(process.env.PATH); - // '/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin' - - process.env.PATH.split(path.delimiter); - // returns - // ['/usr/bin', '/bin', '/usr/sbin', '/sbin', '/usr/local/bin'] - - console.log(process.env.PATH); - // 'C:\Windows\system32;C:\Windows;C:\Program Files\nodejs\' - - process.env.PATH.split(path.delimiter); - // returns - // ['C:\Windows\system32', 'C:\Windows', 'C:\Program Files\nodejs\'] + process.env["PATH"]; // $ExpectType string path.parse('/home/user/dir/file.txt'); // returns @@ -3075,11 +3063,11 @@ client.listbreakpoints((err, body, packet) => { }); //////////////////////////////////////////////////// namespace async_hooks_tests { const hooks: async_hooks.HookCallbacks = { - init: (asyncId: number, type: string, triggerAsyncId: number, resource: object) => void {}, - before: (asyncId: number) => void {}, - after: (asyncId: number) => void {}, - destroy: (asyncId: number) => void {}, - promiseResolve: (asyncId: number) => void {} + init() {}, + before() {}, + after() {}, + destroy() {}, + promiseResolve() {}, }; const asyncHook = async_hooks.createHook(hooks); @@ -3346,7 +3334,8 @@ namespace http2_tests { settings, allowHTTP1: true }; - let secureServerOptions: http2.SecureServerOptions = { ...serverOptions }; + // tslint:disable-next-line prefer-object-spread (ts2.1 feature) + let secureServerOptions: http2.SecureServerOptions = Object.assign({}, serverOptions); secureServerOptions.ca = ''; let onRequestHandler = (request: http2.Http2ServerRequest, response: http2.Http2ServerResponse) => { // Http2ServerRequest @@ -3443,7 +3432,8 @@ namespace http2_tests { selectPadding: (frameLen: number, maxFrameLen: number) => 0, settings }; - let secureClientSessionOptions: http2.SecureClientSessionOptions = { ...clientSessionOptions }; + // tslint:disable-next-line prefer-object-spread (ts2.1 feature) + let secureClientSessionOptions: http2.SecureClientSessionOptions = Object.assign({}, clientSessionOptions); secureClientSessionOptions.ca = ''; let onConnectHandler = (session: http2.Http2Session, socket: net.Socket) => {}; @@ -3696,8 +3686,9 @@ namespace inspector_tests { session.disconnect(); // Unknown post method - session.post('A.b', { key: 'value' }, (err: Error, params: object) => {}); - session.post('A.b', (err: Error, params: object) => {}); + session.post('A.b', { key: 'value' }, (err, params) => {}); + // TODO: parameters are implicitly 'any' and need type annotation + session.post('A.b', (err: Error | null, params?: {}) => {}); session.post('A.b'); // Known post method const parameter: inspector.Runtime.EvaluateParameterType = { expression: '2 + 2' }; @@ -3710,7 +3701,9 @@ namespace inspector_tests { session.post('Runtime.evaluate'); // General event - session.on('inspectorNotification', (message: inspector.InspectorNotification) => {}); + session.on('inspectorNotification', message => { + message; // $ExpectType InspectorNotification<{}> + }); // Known events session.on('Debugger.paused', (message: inspector.InspectorNotification) => { const method: string = message.method; diff --git a/types/node/tsconfig.json b/types/node/tsconfig.json index e3ac3b2f91..9f4317b9f4 100644 --- a/types/node/tsconfig.json +++ b/types/node/tsconfig.json @@ -5,6 +5,7 @@ ], "compilerOptions": { "module": "commonjs", + "target": "es6", "lib": [ "es6" ], From 90532bc5a57019e944f4a7747fe1c7de33887e83 Mon Sep 17 00:00:00 2001 From: Andrew Goodale Date: Mon, 6 Nov 2017 15:57:47 -0500 Subject: [PATCH 31/54] Return type of `onStartShouldSetPanRespnder` should be boolean --- types/react-native/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 2b82a43ee1..1c0cb7d0e8 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -6966,7 +6966,7 @@ export interface PanResponderGestureState { */ export interface PanResponderCallbacks { onMoveShouldSetPanResponder?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean - onStartShouldSetPanResponder?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void + onStartShouldSetPanResponder?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => boolean onPanResponderGrant?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void onPanResponderMove?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void onPanResponderRelease?: (e: GestureResponderEvent, gestureState: PanResponderGestureState) => void From 1590bd57485c8ba68a4ee10ae30a82bedc05d9b5 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 6 Nov 2017 13:09:32 -0800 Subject: [PATCH 32/54] p-lazy: Fix test (#21280) --- types/p-lazy/p-lazy-tests.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/p-lazy/p-lazy-tests.ts b/types/p-lazy/p-lazy-tests.ts index d240ae826e..16ab9e466b 100644 --- a/types/p-lazy/p-lazy-tests.ts +++ b/types/p-lazy/p-lazy-tests.ts @@ -1,7 +1,7 @@ import PLazy = require('p-lazy'); const lazyPromise = new PLazy((resolve, reject) => { - if (typeof resolve === 'object') { + if (!true) { resolve('foo'); } else { reject(new Error()); From 9100ae16ba0de4deb2ccfa76b0113203b756920c Mon Sep 17 00:00:00 2001 From: Harry Nicholls Date: Mon, 6 Nov 2017 17:42:27 -0600 Subject: [PATCH 33/54] Added type definitions and tests for LatLonVectors --- types/geodesy/geodesy-tests.ts | 39 +++++++++++++++++++++++++++++++++- types/geodesy/index.d.ts | 25 ++++++++++++++++++++++ 2 files changed, 63 insertions(+), 1 deletion(-) diff --git a/types/geodesy/geodesy-tests.ts b/types/geodesy/geodesy-tests.ts index 984b8e80c2..6f6641520e 100644 --- a/types/geodesy/geodesy-tests.ts +++ b/types/geodesy/geodesy-tests.ts @@ -4,7 +4,9 @@ import { Dms, Vector3d, OsGridRef, - LatLonEllipsoidal as LatLon, LatLonSpherical } from 'geodesy'; + LatLonEllipsoidal as LatLon, LatLonSpherical, + LatLonVectors +} from 'geodesy'; /** * Mgrs @@ -165,3 +167,38 @@ LatLonSpherical.crossingParallels(point1, point2, 30); const polygon = [new LatLonSpherical(0, 0), new LatLonSpherical(1, 0), new LatLonSpherical(0, 1)]; LatLonSpherical.areaOf(polygon); // 6.18e9 m² LatLonSpherical.areaOf(polygon, 6371e3); // 6.18e9 m² + +/** + * LatLonVectors + */ +const point3 = new LatLonVectors(49.78846, -97.44306); +const point4 = new LatLonVectors(49.79822, -97.4592); +const point5 = new LatLonVectors(49.7981, -97.41371); +const point6 = new LatLonVectors(49.76851, -97.41371); +const point7 = new LatLonVectors(49.76873, -97.45954); +const point8 = new LatLonVectors(49.78846, -97.44306); +point3.toVector(); // Vector3d { x: -0.08363305717526297, y: -0.6401716454146233, z: 0.7636660108677438 } +point3.greatCircle(45); // Vector3d { x: -0.6311975610221534, y: 0.6270426835846277, z: 0.45651627782881243 } +point3.distanceTo(point4, 6371e3); // 1587.463492544562 m +point3.bearingTo(point4); // 313.1353494923952 deg +point3.midpointTo(point4); // LatLon { lat: 49.79334028019261, lon: -97.45112918683637 } +point3.intermediatePointTo(point4, 0.25); // LatLon { lat: 49.79090021013134, lon: -97.44709439015365 } +point3.intermediatePointOnChordTo(point4, 0.5); // LatLon { lat: 49.7933402801926, lon: -97.45112918683637 } +point3.destinationPoint(100, 0, 6371e3); // LatLon { lat: 49.78935932160593, lon: -97.44306000000003 } +point3.crossTrackDistanceTo(point4, point5, 6371e3); // 1080.7461902301488 m +point3.crossTrackDistanceTo(point4, 60, 6371e3); // 1519.091945034438 m +point3.alongTrackDistanceTo(point4, point5, 6371e3); // 1162.7673995854138 m +point3.alongTrackDistanceTo(point4, 60, 6371e3); // 460.86875216457025 m +point3.nearestPointOnSegment(point4, point5); // LatLon { lat: 49.79817930627353, lon: -97.44299978937423 } +point3.isBetween(point4, point5); // true + +const boundary = [point4, point5, point6, point7]; +point3.enclosedBy(boundary); // true +point3.equals(point4); // false +point3.equals(point8); // true +point3.toString('dms', 3); // 49°47′18.456″N, 097°26′35.016″W + +// Static functions +LatLonVectors.intersection(point4, point5, point3, 1); // LatLon { lat: 49.7981787830497, lon: -97.44279718554108 } +LatLonVectors.areaOf(boundary, 6371e3); // 10768180.94129682 m^2 +LatLonVectors.meanOf(boundary); // LatLon { lat: 49.783392242641824, lon: -97.43653998581752 } diff --git a/types/geodesy/index.d.ts b/types/geodesy/index.d.ts index d66de9fe3d..610b9cbee4 100644 --- a/types/geodesy/index.d.ts +++ b/types/geodesy/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/chrisveness/geodesy // Definitions by: Denis Carriere // Gilbert Handy +// Harry Nicholls // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export type format = 'd' | 'dm' | 'dms'; @@ -168,3 +169,27 @@ export class LatLonSpherical { static areaOf(polygon: LatLonSpherical[], radius?: number): number; toString(format?: string, dp?: number): string; } + +export class LatLonVectors { + lat: number; + lon: number; + constructor(lat: number, lon: number); + toVector(): Vector3d; + greatCircle(bearing: number): Vector3d; + distanceTo(point: LatLonVectors, radius?: number): number; + bearingTo(point: LatLonVectors): number; + midpointTo(point: LatLonVectors): number; + intermediatePointTo(point: LatLonVectors, fraction: number): LatLonVectors; + intermediatePointOnChordTo(point: LatLonVectors, fraction: number): LatLonVectors; + destinationPoint(distance: number, bearing: number, radius?: number): LatLonVectors; + static intersection(path1start: LatLonVectors, path1brngEnd: LatLonVectors | number, path2start: LatLonVectors, path2brngEnd: LatLonVectors | number): LatLonVectors; + crossTrackDistanceTo(pathStart: LatLonVectors, pathBrngEnd: LatLonVectors | number, radius?: number): number; + alongTrackDistanceTo(pathStart: LatLonVectors, pathBrngEnd: LatLonVectors | number, radius?: number): number; + nearestPointOnSegment(point1: LatLonVectors, point2: LatLonVectors): LatLonVectors; + isBetween(point1: LatLonVectors, point2: LatLonVectors): boolean; + enclosedBy(polygon: LatLonVectors[]): boolean; + static areaOf(polygon: LatLonVectors[], radius?: number): number; + static meanOf(points: LatLonVectors[]): LatLonVectors; + equals(point: LatLonVectors): boolean; + toString(format?: string, dp?: number): string; + } From 8ad9bea2ee59c631669ba7e15b6ff62447ca6e7e Mon Sep 17 00:00:00 2001 From: Harry Nicholls Date: Mon, 6 Nov 2017 17:54:20 -0600 Subject: [PATCH 34/54] Fixed common mistakes Changed an array parameter reference to ReadonlyArray --- types/geodesy/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/geodesy/index.d.ts b/types/geodesy/index.d.ts index 610b9cbee4..15a53796e0 100644 --- a/types/geodesy/index.d.ts +++ b/types/geodesy/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for geodesy 1.1 +// Type definitions for geodesy 1.2 // Project: https://github.com/chrisveness/geodesy // Definitions by: Denis Carriere // Gilbert Handy @@ -189,7 +189,7 @@ export class LatLonVectors { isBetween(point1: LatLonVectors, point2: LatLonVectors): boolean; enclosedBy(polygon: LatLonVectors[]): boolean; static areaOf(polygon: LatLonVectors[], radius?: number): number; - static meanOf(points: LatLonVectors[]): LatLonVectors; + static meanOf(points: ReadonlyArray): LatLonVectors; equals(point: LatLonVectors): boolean; toString(format?: string, dp?: number): string; } From b4d173f77e41baf23c7d3f32e391d1df1276f887 Mon Sep 17 00:00:00 2001 From: ZheyangSong Date: Wed, 1 Nov 2017 12:03:46 -0700 Subject: [PATCH 35/54] react-grid-layout Layout Interface Update + Adjust `Layout` to match the source code's defintion --- types/react-grid-layout/index.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/react-grid-layout/index.d.ts b/types/react-grid-layout/index.d.ts index bf3f5805d9..7c59c0bf39 100644 --- a/types/react-grid-layout/index.d.ts +++ b/types/react-grid-layout/index.d.ts @@ -64,6 +64,11 @@ declare namespace ReactGridLayout { */ maxH?: number; + /** + * set by DragEvents (onDragStart, onDrag, onDragStop) and ResizeEvents (onResizeStart, onResize, onResizeStop) + */ + moved?: boolean; + /** * If true, equal to `isDraggable: false` and `isResizable: false`. */ @@ -168,6 +173,11 @@ declare namespace ReactGridLayout { */ isResizable?: boolean; + /** + * Enable or disable grid rearrangement when dragging/resizing an element. + */ + isRearrangeable?: boolean; + /** * Uses CSS3 `translate()` instead of position top/left. * This makes about 6x faster paint performance. From ec90ab0cabb0f75db135119174fa76f7d18b1bc5 Mon Sep 17 00:00:00 2001 From: Tim Kang Date: Mon, 6 Nov 2017 17:17:17 -0800 Subject: [PATCH 36/54] material-ui: fix Chip missing `containerElement` prop --- types/material-ui/index.d.ts | 1 + types/material-ui/material-ui-tests.tsx | 2 ++ 2 files changed, 3 insertions(+) diff --git a/types/material-ui/index.d.ts b/types/material-ui/index.d.ts index 91bcef28d9..22b5d1711f 100644 --- a/types/material-ui/index.d.ts +++ b/types/material-ui/index.d.ts @@ -947,6 +947,7 @@ declare namespace __MaterialUI { export interface ChipProps { backgroundColor?: string; className?: string; + containerElement?: React.ReactNode | string; labelColor?: string; labelStyle?: React.CSSProperties; onRequestDelete?: React.TouchEventHandler; diff --git a/types/material-ui/material-ui-tests.tsx b/types/material-ui/material-ui-tests.tsx index 1034d47cad..987c6dd030 100644 --- a/types/material-ui/material-ui-tests.tsx +++ b/types/material-ui/material-ui-tests.tsx @@ -3030,6 +3030,8 @@ const ChipExampleSimple = () => ( Blue Label Color UI Avatar Styled + String Container + {}}>ReactNode Container ); From ab7d7db1d2318619a8ebd8b6f1928c455b889892 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 10:45:47 +0900 Subject: [PATCH 37/54] Activate unnecessarily ignored rules. --- types/nunjucks/tslint.json | 67 +------------------------------------- 1 file changed, 1 insertion(+), 66 deletions(-) diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index a41bf5d19a..f5f9eba608 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -1,79 +1,14 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, "ban-types": false, - "callable-types": false, - "comment-format": false, "dt-header": false, - "eofline": false, "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, "strict-export-declare-modifiers": false, "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } From 41fb40bb68b666424d4188867da9fe319c8d3fca Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 10:48:01 +0900 Subject: [PATCH 38/54] cleanup ignore lint errors: no-consecutive-blank-lines, trim-file --- types/nunjucks/index.d.ts | 1 - types/nunjucks/nunjucks-tests.ts | 2 -- types/nunjucks/tslint.json | 2 -- 3 files changed, 5 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index 002f8b93f8..6a75cecd27 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -3,7 +3,6 @@ // Definitions by: Ruben Slabbert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - declare namespace Nunjucks { function render(name: string, context?: Object): string; function render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; diff --git a/types/nunjucks/nunjucks-tests.ts b/types/nunjucks/nunjucks-tests.ts index 7407cc65ba..a1570fb301 100644 --- a/types/nunjucks/nunjucks-tests.ts +++ b/types/nunjucks/nunjucks-tests.ts @@ -1,7 +1,5 @@ - import nunjucks = require("nunjucks"); - nunjucks.configure({ autoescape: false }); let rendered = nunjucks.render("./noexists.html"); diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index f5f9eba608..2ff6c4ab8a 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -5,10 +5,8 @@ "dt-header": false, "export-just-namespace": false, "interface-name": false, - "no-consecutive-blank-lines": false, "prefer-const": false, "strict-export-declare-modifiers": false, - "trim-file": false, "unified-signatures": false } } From 8fc83723b33b0550ce61cbcb71e924f6e69cd60b Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 10:57:05 +0900 Subject: [PATCH 39/54] cleanup ignore lint error: unified-signatures --- types/nunjucks/index.d.ts | 9 ++------- types/nunjucks/tslint.json | 3 +-- 2 files changed, 3 insertions(+), 9 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index 6a75cecd27..cf5cd6f5b4 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -10,7 +10,6 @@ declare namespace Nunjucks { function renderString(src: string, context: Object): string; function renderString(src: string, context: Object, callback?: (err: any, res: string) => any): void; - function compile(src: string, env?: Environment): Template; function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template; function precompile(path: string, opts?: PrecompileOptions): string; @@ -33,8 +32,7 @@ declare namespace Nunjucks { } function configure(options: ConfigureOptions): Environment; - function configure(path: string, options?: ConfigureOptions): Environment; - function configure(path: string[], options?: ConfigureOptions): Environment; + function configure(path: string | string[], options?: ConfigureOptions): Environment; interface ConfigureOptions { autoescape?: boolean; @@ -63,10 +61,7 @@ declare namespace Nunjucks { autoescape: boolean; }; - constructor(); - constructor(loader: ILoader, opts?: ConfigureOptions); - constructor(loaders: ILoader[], opts?: ConfigureOptions); - + constructor(loader?: ILoader | ILoader[], opts?: ConfigureOptions); render(name: string, context?: Object): string; render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index 2ff6c4ab8a..a5b37cd1f8 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -6,7 +6,6 @@ "export-just-namespace": false, "interface-name": false, "prefer-const": false, - "strict-export-declare-modifiers": false, - "unified-signatures": false + "strict-export-declare-modifiers": false } } From e481e9ca2479c3cb853859814472eb74420603dc Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 10:59:06 +0900 Subject: [PATCH 40/54] cleanup ignore lint error: dt-header --- types/nunjucks/index.d.ts | 2 +- types/nunjucks/tslint.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index cf5cd6f5b4..a596aebecf 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for nunjucks +// Type definitions for nunjucks 3.0 // Project: http://mozilla.github.io/nunjucks/ // Definitions by: Ruben Slabbert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index a5b37cd1f8..c373dd4ad6 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "ban-types": false, - "dt-header": false, "export-just-namespace": false, "interface-name": false, "prefer-const": false, From f9293c661ffd0614265fe635807ca01808956854 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 11:03:06 +0900 Subject: [PATCH 41/54] cleanup ignore lint error: prefer-const --- types/nunjucks/nunjucks-tests.ts | 8 ++++---- types/nunjucks/tslint.json | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/types/nunjucks/nunjucks-tests.ts b/types/nunjucks/nunjucks-tests.ts index a1570fb301..2d5888ce62 100644 --- a/types/nunjucks/nunjucks-tests.ts +++ b/types/nunjucks/nunjucks-tests.ts @@ -4,19 +4,19 @@ nunjucks.configure({ autoescape: false }); let rendered = nunjucks.render("./noexists.html"); -let ctx = { items: ["Hello", "this", "is", "for", "testing"] }; -let src = "{% for item in items %}{{item}}{% endfor %}"; +const ctx = { items: ["Hello", "this", "is", "for", "testing"] }; +const src = "{% for item in items %}{{item}}{% endfor %}"; rendered = nunjucks.renderString(src, ctx); -let compiled = nunjucks.compile(src); +const compiled = nunjucks.compile(src); rendered = compiled.render(ctx); rendered = nunjucks.precompileString(src, { name: "TestyWesty" }); -let template = new nunjucks.Template(src); +const template = new nunjucks.Template(src); rendered = template.render(ctx); let env = nunjucks.configure({ autoescape: false }); diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index c373dd4ad6..27c36c8561 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -4,7 +4,6 @@ "ban-types": false, "export-just-namespace": false, "interface-name": false, - "prefer-const": false, "strict-export-declare-modifiers": false } } From fb2435c3d4f82ab22d1627224ff9b117d42976fe Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 11:04:08 +0900 Subject: [PATCH 42/54] cleanup ignore lint error: strict-export-declare-modifiers --- types/nunjucks/index.d.ts | 2 +- types/nunjucks/tslint.json | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index a596aebecf..a710480bfc 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -128,7 +128,7 @@ declare namespace Nunjucks { constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions); } - export class WebLoader implements ILoader { + class WebLoader implements ILoader { constructor(baseUrl: string, opts?: any); getSource(name: string): LoaderSource; } diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index 27c36c8561..546b9566c1 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -3,7 +3,6 @@ "rules": { "ban-types": false, "export-just-namespace": false, - "interface-name": false, - "strict-export-declare-modifiers": false + "interface-name": false } } From cdb226b3bacfe4fc542a00827db11434dce9fba1 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 11:13:47 +0900 Subject: [PATCH 43/54] cleanup ignore lint error: export-just-namespace --- types/nunjucks/index.d.ts | 258 ++++++++++++++++++------------------- types/nunjucks/tslint.json | 1 - 2 files changed, 127 insertions(+), 132 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index a710480bfc..7cb6e22ccb 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -3,140 +3,136 @@ // Definitions by: Ruben Slabbert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare namespace Nunjucks { - function render(name: string, context?: Object): string; - function render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; +export function render(name: string, context?: Object): string; +export function render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; - function renderString(src: string, context: Object): string; - function renderString(src: string, context: Object, callback?: (err: any, res: string) => any): void; +export function renderString(src: string, context: Object): string; +export function renderString(src: string, context: Object, callback?: (err: any, res: string) => any): void; - function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template; +export function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template; - function precompile(path: string, opts?: PrecompileOptions): string; - function precompileString(src: string, opts?: PrecompileOptions): string; +export function precompile(path: string, opts?: PrecompileOptions): string; +export function precompileString(src: string, opts?: PrecompileOptions): string; - interface PrecompileOptions { - name?: string; - asFunction?: boolean; - force?: boolean; - env?: Environment; - include?: string[]; - exclude?: string[]; - wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string; - } - - class Template { - constructor(src: string, env?: Environment, eagerCompile?: boolean); - render(context?: Object): string; - render(context?: Object, callback?: (err: any, res: string) => any): void; - } - - function configure(options: ConfigureOptions): Environment; - function configure(path: string | string[], options?: ConfigureOptions): Environment; - - interface ConfigureOptions { - autoescape?: boolean; - throwOnUndefined?: boolean; - trimBlocks?: boolean; - lstripBlocks?: boolean; - watch?: boolean; - noCache?: boolean; - web?: { - useCache?: boolean, - async?: boolean - }; - express?: Object; - tags?: { - blockStart?: string, - blockEnd?: string, - variableStart?: string, - variableEnd?: string, - commentStart?: string, - commentEnd?: string - }; - } - - class Environment { - options: { - autoescape: boolean; - }; - - constructor(loader?: ILoader | ILoader[], opts?: ConfigureOptions); - render(name: string, context?: Object): string; - render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; - - renderString(name: string, context: Object): string; - renderString(name: string, context: Object, callback?: (err: any, res: string) => any): void; - - addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void; - getFilter(name: string): void; - - addExtension(name: string, ext: Extension): void; - removeExtension(name: string): void; - getExtension(name: string): Extension; - hasExtension(name: string): void; - - addGlobal(name: string, value: any): void; - - getTemplate(name: string, eagerCompile?: boolean): Template; - getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void; - - express(app: Object): void; - } - - interface Extension { - tags: string[]; - // Parser API is undocumented it is suggested to check the source: https://github.com/mozilla/nunjucks/blob/master/src/parser.js - parse(parser: any, nodes: any, lexer: any): any; - } - - function installJinjaCompat(): void; - - interface ILoader { - async?: boolean; - getSource(name: string): LoaderSource; - extend?(extender: ILoader): ILoader; - } - - // Needs both Loader and ILoader since nunjucks uses a custom object system - // Object system is also responsible for the extend methods - class Loader { - on(name: string, func: (...args: any[]) => any): void; - emit(name: string, ...args: any[]): void; - resolve(from: string, to: string): string; - isRelative(filename: string): boolean; - extend(toExtend: ILoader): ILoader; - } - - interface LoaderSource { - src: string; - path: string; - noCache: boolean; - } - - interface FileSystemLoaderOptions { - /** if true, the system will automatically update templates when they are changed on the filesystem */ - watch?: boolean; - - /** if true, the system will avoid using a cache and templates will be recompiled every single time */ - noCache?: boolean; - } - - class FileSystemLoader extends Loader implements ILoader { - init(searchPaths: string[], opts: any): void; - getSource(name: string): LoaderSource; - constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions); - } - - class WebLoader implements ILoader { - constructor(baseUrl: string, opts?: any); - getSource(name: string): LoaderSource; - } - - class PrecompiledLoader extends Loader implements ILoader { - init(searchPaths: string[], opts: any): void; - getSource(name: string): LoaderSource; - } +export interface PrecompileOptions { + name?: string; + asFunction?: boolean; + force?: boolean; + env?: Environment; + include?: string[]; + exclude?: string[]; + wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string; } -export = Nunjucks; +export class Template { + constructor(src: string, env?: Environment, eagerCompile?: boolean); + render(context?: Object): string; + render(context?: Object, callback?: (err: any, res: string) => any): void; +} + +export function configure(options: ConfigureOptions): Environment; +export function configure(path: string | string[], options?: ConfigureOptions): Environment; + +export interface ConfigureOptions { + autoescape?: boolean; + throwOnUndefined?: boolean; + trimBlocks?: boolean; + lstripBlocks?: boolean; + watch?: boolean; + noCache?: boolean; + web?: { + useCache?: boolean, + async?: boolean + }; + express?: Object; + tags?: { + blockStart?: string, + blockEnd?: string, + variableStart?: string, + variableEnd?: string, + commentStart?: string, + commentEnd?: string + }; +} + +export class Environment { + options: { + autoescape: boolean; + }; + + constructor(loader?: ILoader | ILoader[], opts?: ConfigureOptions); + render(name: string, context?: Object): string; + render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; + + renderString(name: string, context: Object): string; + renderString(name: string, context: Object, callback?: (err: any, res: string) => any): void; + + addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void; + getFilter(name: string): void; + + addExtension(name: string, ext: Extension): void; + removeExtension(name: string): void; + getExtension(name: string): Extension; + hasExtension(name: string): void; + + addGlobal(name: string, value: any): void; + + getTemplate(name: string, eagerCompile?: boolean): Template; + getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void; + + express(app: Object): void; +} + +export interface Extension { + tags: string[]; + // Parser API is undocumented it is suggested to check the source: https://github.com/mozilla/nunjucks/blob/master/src/parser.js + parse(parser: any, nodes: any, lexer: any): any; +} + +export function installJinjaCompat(): void; + +export interface ILoader { + async?: boolean; + getSource(name: string): LoaderSource; + extend?(extender: ILoader): ILoader; +} + +// Needs both Loader and ILoader since nunjucks uses a custom object system +// Object system is also responsible for the extend methods +export class Loader { + on(name: string, func: (...args: any[]) => any): void; + emit(name: string, ...args: any[]): void; + resolve(from: string, to: string): string; + isRelative(filename: string): boolean; + extend(toExtend: ILoader): ILoader; +} + +export interface LoaderSource { + src: string; + path: string; + noCache: boolean; +} + +export interface FileSystemLoaderOptions { + /** if true, the system will automatically update templates when they are changed on the filesystem */ + watch?: boolean; + + /** if true, the system will avoid using a cache and templates will be recompiled every single time */ + noCache?: boolean; +} + +export class FileSystemLoader extends Loader implements ILoader { + init(searchPaths: string[], opts: any): void; + getSource(name: string): LoaderSource; + constructor(searchPaths?: string | string[], opts?: FileSystemLoaderOptions); +} + +export class WebLoader implements ILoader { + constructor(baseUrl: string, opts?: any); + getSource(name: string): LoaderSource; +} + +export class PrecompiledLoader extends Loader implements ILoader { + init(searchPaths: string[], opts: any): void; + getSource(name: string): LoaderSource; +} diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index 546b9566c1..d2ed987c9e 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "ban-types": false, - "export-just-namespace": false, "interface-name": false } } From 7019fca21631502712e2dad282bc1574a82da11b Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 11:17:39 +0900 Subject: [PATCH 44/54] cleanup ignore lint error: ban-types --- types/nunjucks/index.d.ts | 25 +++++++++++++------------ types/nunjucks/tslint.json | 1 - 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index 7cb6e22ccb..e8e654a1de 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -2,12 +2,13 @@ // Project: http://mozilla.github.io/nunjucks/ // Definitions by: Ruben Slabbert // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -export function render(name: string, context?: Object): string; -export function render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; +export function render(name: string, context?: object): string; +export function render(name: string, context?: object, callback?: (err: any, res: string) => any): void; -export function renderString(src: string, context: Object): string; -export function renderString(src: string, context: Object, callback?: (err: any, res: string) => any): void; +export function renderString(src: string, context: object): string; +export function renderString(src: string, context: object, callback?: (err: any, res: string) => any): void; export function compile(src: string, env?: Environment, callback?: (err: any, res: Template) => any): Template; @@ -26,8 +27,8 @@ export interface PrecompileOptions { export class Template { constructor(src: string, env?: Environment, eagerCompile?: boolean); - render(context?: Object): string; - render(context?: Object, callback?: (err: any, res: string) => any): void; + render(context?: object): string; + render(context?: object, callback?: (err: any, res: string) => any): void; } export function configure(options: ConfigureOptions): Environment; @@ -44,7 +45,7 @@ export interface ConfigureOptions { useCache?: boolean, async?: boolean }; - express?: Object; + express?: object; tags?: { blockStart?: string, blockEnd?: string, @@ -61,11 +62,11 @@ export class Environment { }; constructor(loader?: ILoader | ILoader[], opts?: ConfigureOptions); - render(name: string, context?: Object): string; - render(name: string, context?: Object, callback?: (err: any, res: string) => any): void; + render(name: string, context?: object): string; + render(name: string, context?: object, callback?: (err: any, res: string) => any): void; - renderString(name: string, context: Object): string; - renderString(name: string, context: Object, callback?: (err: any, res: string) => any): void; + renderString(name: string, context: object): string; + renderString(name: string, context: object, callback?: (err: any, res: string) => any): void; addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void; getFilter(name: string): void; @@ -80,7 +81,7 @@ export class Environment { getTemplate(name: string, eagerCompile?: boolean): Template; getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void; - express(app: Object): void; + express(app: object): void; } export interface Extension { diff --git a/types/nunjucks/tslint.json b/types/nunjucks/tslint.json index d2ed987c9e..2c7c1bed53 100644 --- a/types/nunjucks/tslint.json +++ b/types/nunjucks/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "ban-types": false, "interface-name": false } } From ef7fa932c6a9db43f2913516337bf9aa33cb0b84 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 11:42:37 +0900 Subject: [PATCH 45/54] Enable strictNullCheck (See: https://mozilla.github.io/nunjucks/api.html#constructor) --- types/nunjucks/index.d.ts | 2 +- types/nunjucks/tsconfig.json | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/types/nunjucks/index.d.ts b/types/nunjucks/index.d.ts index e8e654a1de..d307bd27d5 100644 --- a/types/nunjucks/index.d.ts +++ b/types/nunjucks/index.d.ts @@ -61,7 +61,7 @@ export class Environment { autoescape: boolean; }; - constructor(loader?: ILoader | ILoader[], opts?: ConfigureOptions); + constructor(loader?: ILoader | ILoader[] | null, opts?: ConfigureOptions); render(name: string, context?: object): string; render(name: string, context?: object, callback?: (err: any, res: string) => any): void; diff --git a/types/nunjucks/tsconfig.json b/types/nunjucks/tsconfig.json index 39cf9bfbca..5824ce2f1f 100644 --- a/types/nunjucks/tsconfig.json +++ b/types/nunjucks/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -20,4 +20,4 @@ "index.d.ts", "nunjucks-tests.ts" ] -} \ No newline at end of file +} From 86928c2c5fbefded577edbbd79bc0914af92200b Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 11:44:55 +0900 Subject: [PATCH 46/54] add test --- types/nunjucks/nunjucks-tests.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/types/nunjucks/nunjucks-tests.ts b/types/nunjucks/nunjucks-tests.ts index 2d5888ce62..9f3afcddfe 100644 --- a/types/nunjucks/nunjucks-tests.ts +++ b/types/nunjucks/nunjucks-tests.ts @@ -4,13 +4,18 @@ nunjucks.configure({ autoescape: false }); let rendered = nunjucks.render("./noexists.html"); +nunjucks.render('foo.html', { username: 'James' }); +nunjucks.render('async.html', (err: any, res: string) => {}); + const ctx = { items: ["Hello", "this", "is", "for", "testing"] }; const src = "{% for item in items %}{{item}}{% endfor %}"; rendered = nunjucks.renderString(src, ctx); +nunjucks.renderString('Hello {{ username }}', { username: 'James' }); const compiled = nunjucks.compile(src); rendered = compiled.render(ctx); +nunjucks.compile('Hello {{ username }}').render({ username: 'James' }); rendered = nunjucks.precompileString(src, { name: "TestyWesty" @@ -20,6 +25,11 @@ const template = new nunjucks.Template(src); rendered = template.render(ctx); let env = nunjucks.configure({ autoescape: false }); +nunjucks.configure('/views'); +nunjucks.configure('views', { + autoescape: true, + watch: true +}); rendered = env.renderString(src, ctx); env.addExtension("SpawnGlitter", { From c5641e472d4a224d742cb02c57694e9452c9acee Mon Sep 17 00:00:00 2001 From: Winslow Dalpe Date: Mon, 6 Nov 2017 19:33:15 -0800 Subject: [PATCH 47/54] Using import = require syntax in moment-holiday tests --- types/moment-holiday/moment-holiday-tests.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/moment-holiday/moment-holiday-tests.ts b/types/moment-holiday/moment-holiday-tests.ts index d6d0941f38..474cf246fb 100644 --- a/types/moment-holiday/moment-holiday-tests.ts +++ b/types/moment-holiday/moment-holiday-tests.ts @@ -1,4 +1,5 @@ -import * as moment from 'moment'; +import moment = require('moment'); +import 'moment-holiday'; let holidayResult: moment.Moment | false | { [holidayName: string]: moment.Moment }; holidayResult = moment().holiday([]); From 61ba997a57d977185eb073599c5a25fa4497f7f1 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 12:53:53 +0900 Subject: [PATCH 48/54] Activate unnecessarily ignored rules --- types/acorn/tslint.json | 62 +---------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/types/acorn/tslint.json b/types/acorn/tslint.json index a41bf5d19a..82b4a07c3c 100644 --- a/types/acorn/tslint.json +++ b/types/acorn/tslint.json @@ -1,79 +1,19 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, "callable-types": false, - "comment-format": false, "dt-header": false, - "eofline": false, "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, "semicolon": false, "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "typedef-whitespace": false } } From 916ddd19bd12992fdab84027990520a9a333301e Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 12:56:09 +0900 Subject: [PATCH 49/54] cleanup ignore lint error: only-arrow-functions --- types/acorn/acorn-tests.ts | 4 ++-- types/acorn/tslint.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/acorn/acorn-tests.ts b/types/acorn/acorn-tests.ts index 72ca71d2f6..fb25a80831 100644 --- a/types/acorn/acorn-tests.ts +++ b/types/acorn/acorn-tests.ts @@ -41,7 +41,7 @@ class LooseParser { } } -acorn.addLooseExports(function () { +acorn.addLooseExports(() => { return { type: 'Program', sourceType: 'script', @@ -63,7 +63,7 @@ acorn.isIdentifierChar(56); acorn.getLineInfo('string', 56); -acorn.plugins['test'] = function (p: acorn.Parser, config: any) { +acorn.plugins['test'] = (p: acorn.Parser, config: any) => { } acorn.tokenizer('console.log("hello world)', {locations: true}).getToken(); diff --git a/types/acorn/tslint.json b/types/acorn/tslint.json index 82b4a07c3c..7ae2899fe7 100644 --- a/types/acorn/tslint.json +++ b/types/acorn/tslint.json @@ -11,7 +11,6 @@ "no-unnecessary-class": false, "no-var-keyword": false, "no-trailing-whitespace": false, - "only-arrow-functions": false, "semicolon": false, "space-before-function-paren": false, "typedef-whitespace": false From c28f8bf286821bb959ed54cd5022cb19763e9140 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 12:59:27 +0900 Subject: [PATCH 50/54] cleanup ignore lint format errors: no-padding, no-trailing-whitespace, semicolon, space-before-function-paren, typedef-whitespace --- types/acorn/acorn-tests.ts | 13 ++++--------- types/acorn/index.d.ts | 14 ++++++-------- types/acorn/tslint.json | 7 +------ 3 files changed, 11 insertions(+), 23 deletions(-) diff --git a/types/acorn/acorn-tests.ts b/types/acorn/acorn-tests.ts index fb25a80831..9e8c3d42b9 100644 --- a/types/acorn/acorn-tests.ts +++ b/types/acorn/acorn-tests.ts @@ -32,14 +32,10 @@ const parser = new acorn.Parser({}, 'export default ""', 0); const node = new acorn.Node(parser, 1, 1); class LooseParser { - constructor(input: string, options = {}) { - - } + constructor(input: string, options = {}) {} // this means you can extend LooseParser - test() { - - } + test() {} } acorn.addLooseExports(() => { return { @@ -50,7 +46,7 @@ acorn.addLooseExports(() => { type: 'EmptyStatement' } ] - } + }; }, LooseParser, {}); acorn.parseExpressionAt('string', 2); @@ -63,8 +59,7 @@ acorn.isIdentifierChar(56); acorn.getLineInfo('string', 56); -acorn.plugins['test'] = (p: acorn.Parser, config: any) => { -} +acorn.plugins['test'] = (p: acorn.Parser, config: any) => {}; acorn.tokenizer('console.log("hello world)', {locations: true}).getToken(); acorn.tokenizer('console.log("hello world)', {locations: true})[Symbol.iterator]().next(); diff --git a/types/acorn/index.d.ts b/types/acorn/index.d.ts index ce7da6d368..15b8f1797e 100644 --- a/types/acorn/index.d.ts +++ b/types/acorn/index.d.ts @@ -181,7 +181,7 @@ declare namespace acorn { _typeof: TokenType; _void: TokenType; _delete: TokenType; - } + }; class TokContext { constructor(token: string, isExpr: boolean, preserveSpace: boolean, override: (p: Parser) => void); @@ -239,10 +239,10 @@ declare namespace acorn { function parseExpressionAt(input: string, pos?: number, options?: Options): ESTree.Expression; interface ITokenizer { - getToken() : Token, - [Symbol.iterator](): Iterator + getToken(): Token; + [Symbol.iterator](): Iterator; } - + function tokenizer(input: string, options: Options): ITokenizer; let parse_dammit: IParse | undefined; @@ -250,12 +250,10 @@ declare namespace acorn { let pluginsLoose: PluginsObject | undefined; interface ILooseParserClass { - new (input: string, options?: Options): ILooseParser + new (input: string, options?: Options): ILooseParser; } - interface ILooseParser { - - } + interface ILooseParser {} function addLooseExports(parse: IParse, parser: ILooseParserClass, plugins: PluginsObject): void; } diff --git a/types/acorn/tslint.json b/types/acorn/tslint.json index 7ae2899fe7..e1b07b5581 100644 --- a/types/acorn/tslint.json +++ b/types/acorn/tslint.json @@ -6,13 +6,8 @@ "export-just-namespace": false, "interface-name": false, "no-empty-interface": false, - "no-padding": false, "no-reference-import": false, "no-unnecessary-class": false, - "no-var-keyword": false, - "no-trailing-whitespace": false, - "semicolon": false, - "space-before-function-paren": false, - "typedef-whitespace": false + "no-var-keyword": false } } From 4858efccf5a9dba6ca3daca5795f61fb8bc874fb Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 13:01:31 +0900 Subject: [PATCH 51/54] cleanup ignore lint error: no-var-keyword --- types/acorn/acorn-tests.ts | 14 +++++++------- types/acorn/tslint.json | 3 +-- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/types/acorn/acorn-tests.ts b/types/acorn/acorn-tests.ts index 9e8c3d42b9..7574df2481 100644 --- a/types/acorn/acorn-tests.ts +++ b/types/acorn/acorn-tests.ts @@ -1,13 +1,13 @@ import acorn = require('acorn'); import * as ESTree from 'estree'; -declare var token: acorn.Token; -declare var tokens: acorn.Token[]; -declare var comment: acorn.Comment; -declare var comments: acorn.Comment[]; -declare var program: ESTree.Program; -var any: any; -var string: string; +declare let token: acorn.Token; +declare let tokens: acorn.Token[]; +declare let comment: acorn.Comment; +declare let comments: acorn.Comment[]; +declare let program: ESTree.Program; +let any: any; +let string: string; // acorn string = acorn.version; diff --git a/types/acorn/tslint.json b/types/acorn/tslint.json index e1b07b5581..4c1016fadc 100644 --- a/types/acorn/tslint.json +++ b/types/acorn/tslint.json @@ -7,7 +7,6 @@ "interface-name": false, "no-empty-interface": false, "no-reference-import": false, - "no-unnecessary-class": false, - "no-var-keyword": false + "no-unnecessary-class": false } } From 62798c507dae098edfeb0da67f9d7a07fef723f3 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 13:05:12 +0900 Subject: [PATCH 52/54] cleanup ignore lint error: no-reference-import --- types/acorn/index.d.ts | 2 -- types/acorn/tslint.json | 1 - 2 files changed, 3 deletions(-) diff --git a/types/acorn/index.d.ts b/types/acorn/index.d.ts index 15b8f1797e..5d4babd5c4 100644 --- a/types/acorn/index.d.ts +++ b/types/acorn/index.d.ts @@ -3,8 +3,6 @@ // Definitions by: RReverser , e-cloud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - export as namespace acorn; export = acorn; import * as ESTree from 'estree'; diff --git a/types/acorn/tslint.json b/types/acorn/tslint.json index 4c1016fadc..692404bfa1 100644 --- a/types/acorn/tslint.json +++ b/types/acorn/tslint.json @@ -6,7 +6,6 @@ "export-just-namespace": false, "interface-name": false, "no-empty-interface": false, - "no-reference-import": false, "no-unnecessary-class": false } } From 6ee0e959ce87b34db7d21e2351fdf6a53fde78f1 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 13:06:38 +0900 Subject: [PATCH 53/54] cleanup ignore lint error: dt-header --- types/acorn/index.d.ts | 2 +- types/acorn/tslint.json | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/types/acorn/index.d.ts b/types/acorn/index.d.ts index 5d4babd5c4..c82c24fa23 100644 --- a/types/acorn/index.d.ts +++ b/types/acorn/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Acorn v4.0.3 +// Type definitions for Acorn 4.0 // Project: https://github.com/marijnh/acorn // Definitions by: RReverser , e-cloud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/acorn/tslint.json b/types/acorn/tslint.json index 692404bfa1..9ca4ce24d0 100644 --- a/types/acorn/tslint.json +++ b/types/acorn/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "callable-types": false, - "dt-header": false, "export-just-namespace": false, "interface-name": false, "no-empty-interface": false, From dc75da079b4524d5e8ec3afc6d540604b873b395 Mon Sep 17 00:00:00 2001 From: segayuu Date: Tue, 7 Nov 2017 13:11:07 +0900 Subject: [PATCH 54/54] cleanup ignore lint error: callable-types --- types/acorn/index.d.ts | 5 ++--- types/acorn/tslint.json | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/types/acorn/index.d.ts b/types/acorn/index.d.ts index c82c24fa23..5d02bd716c 100644 --- a/types/acorn/index.d.ts +++ b/types/acorn/index.d.ts @@ -228,9 +228,8 @@ declare namespace acorn { const version: string; - interface IParse { - (input: string, options?: Options): ESTree.Program; - } + // TODO: rename type. + type IParse = (input: string, options?: Options) => ESTree.Program; const parse: IParse; diff --git a/types/acorn/tslint.json b/types/acorn/tslint.json index 9ca4ce24d0..2d05b8507c 100644 --- a/types/acorn/tslint.json +++ b/types/acorn/tslint.json @@ -1,7 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "callable-types": false, "export-just-namespace": false, "interface-name": false, "no-empty-interface": false,