diff --git a/.gitignore b/.gitignore index f7927724d5..5b79863e52 100644 --- a/.gitignore +++ b/.gitignore @@ -38,5 +38,6 @@ node_modules .sublimets .settings/launch.json +.vs .vscode yarn.lock diff --git a/angular-material/index.d.ts b/angular-material/index.d.ts index 9118cd92c2..0e27fe3b60 100644 --- a/angular-material/index.d.ts +++ b/angular-material/index.d.ts @@ -106,6 +106,7 @@ declare module 'angular' { onComplete?: Function; onRemoving?: Function; skipHide?: boolean; + multiple?: boolean; fullscreen?: boolean; // default: false } diff --git a/babel-traverse/babel-traverse-tests.ts b/babel-traverse/babel-traverse-tests.ts index c02efe44ad..3779852c5f 100644 --- a/babel-traverse/babel-traverse-tests.ts +++ b/babel-traverse/babel-traverse-tests.ts @@ -109,3 +109,16 @@ const v1: Visitor = { path.scope.rename("n"); } }; + +// Binding.kind +const BindingKindTest: Visitor = { + Identifier(path) { + const kind = path.scope.getBinding("str").kind; + kind === 'module'; + kind === 'const'; + kind === 'let'; + kind === 'var'; + // The following should fail when uncommented + // kind === 'anythingElse'; + }, +}; diff --git a/babel-traverse/index.d.ts b/babel-traverse/index.d.ts index 67dd119e91..e307cd664d 100644 --- a/babel-traverse/index.d.ts +++ b/babel-traverse/index.d.ts @@ -126,7 +126,7 @@ export class Binding { identifier: t.Identifier; scope: Scope; path: NodePath; - kind: 'var' | 'let' | 'const'; + kind: 'var' | 'let' | 'const' | 'module'; referenced: boolean; references: number; referencePaths: NodePath[]; diff --git a/chrome/index.d.ts b/chrome/index.d.ts index cd6922f5fb..211375a3fe 100644 --- a/chrome/index.d.ts +++ b/chrome/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Chrome extension development // Project: http://developer.chrome.com/extensions/ -// Definitions by: Matthew Kimber , otiai10 , couven92 , RReverser +// Definitions by: Matthew Kimber , otiai10 , couven92 , RReverser , sreimer15 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -7062,13 +7062,12 @@ declare namespace chrome.webNavigation { transitionQualifiers: string[]; } - interface WebNavigationEventFilter { - /** Conditions that the URL being navigated to must satisfy. The 'schemes' and 'ports' fields of UrlFilter are ignored for this event. */ - url: chrome.events.UrlFilter[]; + interface WebNavigationRequestFilter extends chrome.webRequest.RequestFilter { + /** fulfills the webRequest.RequestFilter interface even though it is under web navigation **/ } interface WebNavigationEvent extends chrome.events.Event<(details: T) => void> { - addListener(callback: (details: T) => void, filters?: WebNavigationEventFilter): void; + addListener(callback: (details: T) => void, filters?: WebNavigationRequestFilter): void; } interface WebNavigationFramedEvent extends WebNavigationEvent {} @@ -7178,7 +7177,8 @@ declare namespace chrome.webRequest { */ types?: string[]; /** A list of URLs or URL patterns. Requests that cannot match any of the URLs will be filtered out. */ - urls: string[]; + urls: string[] | RegExp[] | ""; + /** Optional. */ windowId?: number; } diff --git a/chrome/test/index.ts b/chrome/test/index.ts index 7788397a4c..3074b8a0c3 100644 --- a/chrome/test/index.ts +++ b/chrome/test/index.ts @@ -171,6 +171,29 @@ function catBlock () { ["blocking"]); } +// webNavigation.onBeforeNavigate.addListener example similar api to onBeforeRequest but without extra spec +function beforeRedditNavigation() { + chrome.webNavigation.onBeforeNavigate.addListener(function (requestDetails) { + console.log("URL we want to redirect to: " + requestDetails.url); + // NOTE: This will search for top level frames with the value -1. + if (requestDetails.parentFrameId != -1) { + return; + } + + let url = new URL(requestDetails.url); + let splitUrl = url.hostname.split('.'); + //` Note: Does not cover the XX.co.uk type edge case + let host = (splitUrl[(splitUrl.length -1) - 1]); + + if (host === null) { + return; + } else if (host === "reddit") { + alert("Were you trying to go on reddit, during working hours? :(") + return; + } + },{urls: ["http://*/*"], types: ["image"]}); +} + // contrived settings example function proxySettings() { chrome.proxy.settings.get({ incognito: true }, (details) => { diff --git a/dockerode/index.d.ts b/dockerode/index.d.ts index 2c5caaf9cc..c317d5d32e 100644 --- a/dockerode/index.d.ts +++ b/dockerode/index.d.ts @@ -578,7 +578,7 @@ declare class Dockerode { getTask(id: string): Dockerode.Task; - getNode(id: string): Node; + getNode(id: string): Dockerode.Node; getNetwork(id: string): Dockerode.Network; @@ -640,4 +640,4 @@ declare class Dockerode { modem: any; } -export = Dockerode; \ No newline at end of file +export = Dockerode; diff --git a/dropkickjs/dropkickjs-tests.ts b/dropkickjs/dropkickjs-tests.ts new file mode 100644 index 0000000000..af46b43c02 --- /dev/null +++ b/dropkickjs/dropkickjs-tests.ts @@ -0,0 +1,91 @@ +/// + +//constructor +var constructorNoOptions = new Dropkick('#my-select'); +var constructorNoOptions2 = new Dropkick(new HTMLSelectElement()); +var constructorOptions = new Dropkick('#my-select', {}); +var constructorOptions2 = new Dropkick(new HTMLSelectElement(), {}); + +//options +var options : DropkickOptions = { + disabled: true, + form: new HTMLFormElement(), + length: 1, + mobile: true, + multiple: true, + options: ['test'], + selectedIndex: 0, + selectedOptions: ['test'], + value: 'test', + change() { }, + close() { }, + open() { }, + initialize: () => { } +} +var withFullOptions = new Dropkick('#test', options); + +var dk = new Dropkick('#test'); + +//fields (same as options) +var o1 = dk.disabled; +var o2 = dk.form; +var o3 = dk.length; +var o4 = dk.mobile; +var o5 = dk.multiple; +var o6 = dk.options; +var o7 = dk.selectedIndex; +var o8 = dk.selectedOptions; +var o9 = dk.value; + +//methods +dk.add('new'); +dk.add(new HTMLSelectElement()); +dk.add('new', 'old'); +dk.add('new', 1); + +dk.disable(); +dk.disable(false); +dk.disable(4, true); +dk.disable(4); + +dk.dispose(); + +dk.focus(); + +dk.hide(4); +dk.hide(4, false); + +var node = dk.item(4); + +dk.open(); + +dk.refresh(); + +dk.remove(4); + +dk.reset(); +dk.reset(true); + +var words = dk.search("qwer", "fuzzy"); + +var node2 = dk.select(4); +var node3 = dk.select("AL"); +var node4 = dk.select(4, true); + +var node5 = dk.selectOne(4); +var node6 = dk.selectOne(4, true); + +//real life example +var fieldValue = ''; +var selectOptions : DropkickOptions = { + open(this: Dropkick) { + const optionsList = (this).data.elem.lastChild; //undocumented but useful data field + if (optionsList.scrollWidth > optionsList.offsetWidth) { + optionsList.style.width = optionsList.scrollWidth + 25 + 'px'; + } + }, + change: () => { + fieldValue = select.value; + } +}; +var select = new Dropkick('#select', options); \ No newline at end of file diff --git a/dropkickjs/index.d.ts b/dropkickjs/index.d.ts new file mode 100644 index 0000000000..1e0a4f4acf --- /dev/null +++ b/dropkickjs/index.d.ts @@ -0,0 +1,51 @@ +// Type definitions for dropkickjs 2.1 +// Project: http://dropkickjs.com/ +// Definitions by: Dmitry Pesterev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +interface DropkickOptions { + disabled?: boolean; + form?: Node; + length?: number; + mobile?: boolean; + multiple?: boolean; + options?: string[]; + selectedIndex?: number; + selectedOptions?: string[]; + value?: string; + + change?: () => void; + close?: () => void; + initialize?: () => void; + open?: () => void; +} + +declare class Dropkick { + constructor(id: string|HTMLElement, options?: DropkickOptions); + + add(value: string | Node, before?: number | string): void; + close(): void; + disable(disabled?: boolean): void; + disable(index: number, disabled?: boolean): void; + dispose(): void; + focus(): void; + hide(index: number, hidden?: boolean): void; + item(index: number): Node; + open(): void; + refresh(): void; + remove(index: number): void; + reset(clear?: boolean): void; + search(string: string, mode?: string): string[]; + select(element: number|string, selectDisabled?: boolean): Node; + selectOne(element: number, selectDisabled?: boolean): Node; + + disabled: boolean; + form: Node; + length: number; + mobile: boolean; + multiple: boolean; + options: string[]; + selectedIndex: number; + selectedOptions: string[]; + value: string; +} \ No newline at end of file diff --git a/dropkickjs/tsconfig.json b/dropkickjs/tsconfig.json new file mode 100644 index 0000000000..e0699ecf5c --- /dev/null +++ b/dropkickjs/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "dropkickjs-tests.ts" + ] +} \ No newline at end of file diff --git a/dropkickjs/tslint.json b/dropkickjs/tslint.json new file mode 100644 index 0000000000..2221e40e4a --- /dev/null +++ b/dropkickjs/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } \ No newline at end of file diff --git a/jasmine-es6-promise-matchers/index.d.ts b/jasmine-es6-promise-matchers/index.d.ts index 493a6a5312..89e3146c2c 100644 --- a/jasmine-es6-promise-matchers/index.d.ts +++ b/jasmine-es6-promise-matchers/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bvaughn/jasmine-es6-promise-matchers // Definitions by: Stephen Lautier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/jasmine-expect/index.d.ts b/jasmine-expect/index.d.ts index c8ffd8dced..c2ee7e0ee5 100644 --- a/jasmine-expect/index.d.ts +++ b/jasmine-expect/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/JamieMason/Jasmine-Matchers // Definitions by: UserPixel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/jasmine-jquery/index.d.ts b/jasmine-jquery/index.d.ts index cbd713fd37..fb91e0c37b 100644 --- a/jasmine-jquery/index.d.ts +++ b/jasmine-jquery/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/velesin/jasmine-jquery // Definitions by: Gregor Stamac // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// /// diff --git a/jasmine-matchers/index.d.ts b/jasmine-matchers/index.d.ts index 23990c8364..ac44d25c1c 100644 --- a/jasmine-matchers/index.d.ts +++ b/jasmine-matchers/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/uxebu/jasmine-matchers // Definitions by: Bart van der Schoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /* Typings 2013 Bart van der Schoor diff --git a/jasmine-node/index.d.ts b/jasmine-node/index.d.ts index 59a3b11d8a..5c8022d706 100644 --- a/jasmine-node/index.d.ts +++ b/jasmine-node/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mhevery/jasmine-node // Definitions by: Sven Reglitzki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/jasmine-promise-matchers/index.d.ts b/jasmine-promise-matchers/index.d.ts index 1693c9fdca..c511019b62 100644 --- a/jasmine-promise-matchers/index.d.ts +++ b/jasmine-promise-matchers/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/bvaughn/jasmine-promise-matchers // Definitions by: Matthew Hill // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/jasmine/index.d.ts b/jasmine/index.d.ts index 7bf232acba..e18361dec4 100644 --- a/jasmine/index.d.ts +++ b/jasmine/index.d.ts @@ -2,6 +2,7 @@ // Project: http://jasmine.github.io/ // Definitions by: Boris Yankov , Theodore Brown , David Pärsson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 // For ddescribe / iit use : https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/karma-jasmine/karma-jasmine.d.ts @@ -35,7 +36,7 @@ interface DoneFn extends Function { fail: (message?: Error|string) => void; } -declare function spyOn(object: any, method: string): jasmine.Spy; +declare function spyOn(object: T, method: keyof T): jasmine.Spy; declare function runs(asyncMethod: Function): void; declare function waitsFor(latchMethod: () => boolean, failureMessage?: string, timeout?: number): void; diff --git a/jasminewd2/index.d.ts b/jasminewd2/index.d.ts index cff5236b50..9d8ecde76e 100644 --- a/jasminewd2/index.d.ts +++ b/jasminewd2/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/angular/jasminewd // Definitions by: Sammy Jelin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/kafka-node/index.d.ts b/kafka-node/index.d.ts index b3a67c4b9a..018b1a6f9e 100644 --- a/kafka-node/index.d.ts +++ b/kafka-node/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for kafka-node 0.2.22 +// Type definitions for kafka-node 1.3.3 // Project: https://github.com/SOHU-Co/kafka-node/ // Definitions by: Daniel Imrie-Situnayake // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -13,24 +13,24 @@ export declare class Client { export declare class Producer { constructor(client: Client); - on(eventName: string, cb: () => any): Producer; - on(eventName: string, cb: (error: any) => any): Producer; + on(eventName: string, cb: () => any): void; + on(eventName: string, cb: (error: any) => any): void; send(payloads: Array, cb: (error: any, data: any) => any): void; createTopics(topics: Array, async: boolean, cb?: (error: any, data: any) => any): void; } export declare class HighLevelProducer { - constructor(client: Client); - on(eventName: string, cb: () => any): HighLevelProducer; - on(eventName: string, cb: (error: any) => any): HighLevelProducer; + constructor(client: Client, options?: any); + on(eventName: string, cb: () => any): void; + on(eventName: string, cb: (error: any) => any): void; send(payloads: Array, cb: (error: any, data: any) => any): void; createTopics(topics: Array, async: boolean, cb?: (error: any, data: any) => any): void; } export declare class Consumer { - constructor(client: Client, fetchRequests: Array, options: ConsumerOptions); - on(eventName: string, cb: (message: string) => any): Consumer; - on(eventName: string, cb: (error: any) => any): Consumer; + constructor(client: Client, fetchRequests: Array, options: ConsumerOptions); + on(eventName: string, cb: (message: string) => any): void; + on(eventName: string, cb: (error: any) => any): void; addTopics(topics: Array, cb: (error: any, added: boolean) => any): void; addTopics(topics: Array, cb: (error: any, added: boolean) => any, fromOffset: boolean): void; removeTopics(topics: Array, cb: (error: any, removed: boolean) => any): void; @@ -45,8 +45,8 @@ export declare class Consumer { export declare class HighLevelConsumer { constructor(client: Client, payloads: Array, options: ConsumerOptions); - on(eventName: string, cb: (message: string) => any): HighLevelConsumer; - on(eventName: string, cb: (error: any) => any): HighLevelConsumer; + on(eventName: string, cb: (message: string) => any): void; + on(eventName: string, cb: (error: any) => any): void; addTopics(topics: Array, cb: (error: any, added: boolean) => any): void; addTopics(topics: Array, cb: (error: any, added: boolean) => any, fromOffset: boolean): void; removeTopics(topics: Array, cb: (error: any, removed: boolean) => any): void; @@ -59,14 +59,22 @@ export declare class HighLevelConsumer { close(force: boolean, cb: () => any): void; } +export declare class ConsumerGroup { + constructor(options: ConsumerGroupOptions, topics: string[]); + on(eventName: string, cb: (message: string) => any): void; + on(eventName: string, cb: (error: any) => any): void; + close(force: boolean, cb: (error: any) => any): void; +} + export declare class Offset { constructor(client: Client); - on(eventName: string, cb: () => any): Offset; + on(eventName: string, cb: () => any): void; fetch(payloads: Array, cb: (error: any, data: any) => any): void; commit(groupId: string, payloads: Array, cb: (error: any, data: any) => any): void; fetchCommits(groupId: string, payloads: Array, cb: (error: any, data: any) => any): void; fetchLatestOffsets(topics: Array, cb: (error: any, data: any) => any): void; - on(eventName: string, cb: (error: any) => any): Offset; + fetchEarliestOffsets(topics: Array, cb: (error: any, data: any) => any): void; + on(eventName: string, cb: (error: any) => any): void; } export declare class KeyedMessage { @@ -74,6 +82,11 @@ export declare class KeyedMessage { } // # Interfaces +export interface AckBatchOptions { + noAckBatchSize: number | null, + noAckBatchAge: number | null +} + export interface ZKOptions { sessionTimeout?: number; spinDelay?: number; @@ -90,6 +103,7 @@ export interface ProduceRequest { export interface ConsumerOptions { groupId?: string; + id?: string; autoCommit?: boolean; autoCommitIntervalMs?: number; fetchMaxWaitMs?: number; @@ -99,6 +113,27 @@ export interface ConsumerOptions { encoding?: string; } +export interface CustomPartitionAssignmentProtocol { + name: string; + version: number; + userData: {}; + assign: (topicPattern: any, groupMembers: any, callback: (error: any, result: any) => void) => void; +} + +export interface ConsumerGroupOptions { + host: string; + zk?: ZKOptions; + batch?: AckBatchOptions; + ssl?: boolean; + id: string; + groupId: string; + sessionTimeout: number; + protocol: Array<"roundrobin" | "range" | CustomPartitionAssignmentProtocol>; + fromOffset: "earliest" | "latest" | "none"; + migrateHLC: false; + migrateRolling: true; +} + export interface Topic { topic: string; offset?: number; @@ -123,10 +158,5 @@ export interface OffsetCommitRequest { export interface OffsetFetchRequest { topic: string; partition?: number; -} - -export interface FetchRequest { - topic: string; offset?: number; } - diff --git a/kafka-node/kafka-node-tests.ts b/kafka-node/kafka-node-tests.ts index a5b9e9ca3e..557c40de8c 100644 --- a/kafka-node/kafka-node-tests.ts +++ b/kafka-node/kafka-node-tests.ts @@ -1,4 +1,3 @@ - import kafka = require('kafka-node'); var basicClient = new kafka.Client('localhost:2181/', 'sendMessage'); @@ -138,6 +137,24 @@ hlConsumer.resumeTopics([ hlConsumer.close(true, function () {}); +var ackBatchOptions = {'noAckBatchSize': 1024, 'noAckBatchAge': 10}; +var cgOptions: kafka.ConsumerGroupOptions = { + host: 'localhost:2181/', + batch: ackBatchOptions, + groupId: 'groupID', + id: 'consumerID', + sessionTimeout: 15000, + protocol: ["roundrobin"], + fromOffset: "latest", + migrateHLC: false, + migrateRolling: true +}; + +var consumerGroup = new kafka.ConsumerGroup( cgOptions, ['topic1']); +consumerGroup.on('error', (err) => {}); +consumerGroup.on('message', (msg) => {}); +consumerGroup.close(true, () => {}); + var offset = new kafka.Offset(basicClient); offset.on('ready', function(){}); @@ -154,3 +171,6 @@ offset.commit('groupId', [ offset.fetchCommits('groupId', [ { topic: 't', partition: 0 } ], function (err, data) {}); + +offset.fetchLatestOffsets(['t'], (err, offsets) => {}) +offset.fetchEarliestOffsets(['t'], (err, offsets) => {}) diff --git a/karma-jasmine/index.d.ts b/karma-jasmine/index.d.ts index a5f0a22f5b..46b7978251 100644 --- a/karma-jasmine/index.d.ts +++ b/karma-jasmine/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/karma-runner/karma-jasmine // Definitions by: Michel Salib // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /// diff --git a/leaflet/index.d.ts b/leaflet/index.d.ts index 66a18a7e4c..5ca606811a 100644 --- a/leaflet/index.d.ts +++ b/leaflet/index.d.ts @@ -689,7 +689,7 @@ declare namespace L { /** * Returns a GeoJSON representation of the layer group (as a GeoJSON GeometryCollection, GeoJSONFeatureCollection or Multipoint). */ - toGeoJSON(): GeoJSONFeatureCollection | GeoJSONFeature; + toGeoJSON(): GeoJSONFeatureCollection | GeoJSONFeature | GeoJSONGeometryCollection; /** * Adds the given layer to the group. @@ -743,7 +743,7 @@ declare namespace L { */ getLayerId(layer: Layer): number; - feature: GeoJSONFeatureCollection | GeoJSONFeature; + feature: GeoJSONFeatureCollection | GeoJSONFeature | GeoJSONGeometryCollection; } /** diff --git a/mongodb/index.d.ts b/mongodb/index.d.ts index 6df1ae0a6e..dbd96c83c0 100644 --- a/mongodb/index.d.ts +++ b/mongodb/index.d.ts @@ -623,11 +623,8 @@ export interface Collection { /** @deprecated */ find(query: Object, fields?: Object, skip?: number, limit?: number, timeout?: number): Cursor; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOne - /** @deprecated use find().limit(1).next(function(err, doc){}) */ findOne(filter: Object, callback: MongoCallback): void; - /** @deprecated use find().limit(1).next(function(err, doc){}) */ findOne(filter: Object, options?: FindOneOptions): Promise; - /** @deprecated use find().limit(1).next(function(err, doc){}) */ findOne(filter: Object, options: FindOneOptions, callback: MongoCallback): void; //http://mongodb.github.io/node-mongodb-native/2.1/api/Collection.html#findOneAndDelete findOneAndDelete(filter: Object, callback: MongoCallback): void; diff --git a/passport-facebook/index.d.ts b/passport-facebook/index.d.ts index bcc742dae5..7b6cedeac5 100644 --- a/passport-facebook/index.d.ts +++ b/passport-facebook/index.d.ts @@ -19,6 +19,10 @@ interface Profile extends passport.Profile { _json: any; } +export interface AuthenticateOptions extends passport.AuthenticateOptions { + authType?: string; +} + interface IStrategyOption { clientID: string; clientSecret: string; diff --git a/range-parser/index.d.ts b/range-parser/index.d.ts new file mode 100644 index 0000000000..e90f448e11 --- /dev/null +++ b/range-parser/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for range-parser 1.2 +// Project: https://github.com/jshttp/range-parser +// Definitions by: Tomek Łaziuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function RangeParser(size: number, str: string, options?: RangeParser.Options): RangeParser.Result | RangeParser.Ranges; + +declare namespace RangeParser { + export interface Ranges extends Array { + type: string; + } + export interface Range { + start: number; + end: number; + } + export interface Options { + combine?: boolean; + } + export const enum Result { + invaild = -2, + unsatisifiable = -1, + } +} + +export = RangeParser; diff --git a/range-parser/range-parser-tests.ts b/range-parser/range-parser-tests.ts new file mode 100644 index 0000000000..77dab456c1 --- /dev/null +++ b/range-parser/range-parser-tests.ts @@ -0,0 +1,11 @@ +import * as RangeParser from 'range-parser'; + +console.assert(RangeParser(200, `malformed`) === RangeParser.Result.invaild); +console.assert(RangeParser(200, `bytes=500-20`) === RangeParser.Result.unsatisifiable); + +const range = RangeParser(1000, `bytes=0-499`); + +if (typeof range !== 'number') { + console.assert(range.type === `bytes`); + console.assert(range.length === 1); +} diff --git a/range-parser/tsconfig.json b/range-parser/tsconfig.json new file mode 100644 index 0000000000..7c7f4ffd03 --- /dev/null +++ b/range-parser/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "range-parser-tests.ts" + ] +} diff --git a/range-parser/tslint.json b/range-parser/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/range-parser/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/react-router/index.d.ts b/react-router/index.d.ts index da1f23c87e..84b9f2c152 100644 --- a/react-router/index.d.ts +++ b/react-router/index.d.ts @@ -33,6 +33,7 @@ export { RoutePattern, RouterProps, RouterState, + RedirectFunction, StringifyQuery, Query } from "react-router/lib/Router"; diff --git a/react-router/lib/Router.d.ts b/react-router/lib/Router.d.ts index 0f7806488a..3870f538fc 100644 --- a/react-router/lib/Router.d.ts +++ b/react-router/lib/Router.d.ts @@ -90,6 +90,7 @@ export interface RouteComponentProps { params: P & R; route: PlainRoute; router: InjectedRouter; + routes: PlainRoute[]; routeParams: R; } diff --git a/react-router/react-router-tests.tsx b/react-router/react-router-tests.tsx index 894dfec8c7..59186914e4 100644 --- a/react-router/react-router-tests.tsx +++ b/react-router/react-router-tests.tsx @@ -17,7 +17,9 @@ import { InjectedRouter, Link, RouterContext, - LinkProps + LinkProps, + RedirectFunction, + RouteComponentProps } from "react-router"; const NavLink = (props: LinkProps) => ( @@ -92,10 +94,12 @@ class NotFound extends React.Component<{}, {}> { } +interface UsersProps extends RouteComponentProps<{}, {}> { } -class Users extends React.Component<{}, {}> { +class Users extends React.Component { render() { + const { location, params, route, routes, router, routeParams } = this.props; return
This is a user list
diff --git a/react-sticky/index.d.ts b/react-sticky/index.d.ts new file mode 100644 index 0000000000..b3070b046a --- /dev/null +++ b/react-sticky/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for react-sticky 5.0 +// Project: https://github.com/captivationsoftware/react-sticky +// Definitions by: Matej Lednicky , Curtis Warren +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +import * as React from "react"; + +declare module "react-sticky" { + + export var StickyContainer: React.ComponentClass>; + + export interface StickyProps { + isActive: boolean; + className: string; + style: any; + stickyClassName: string; + stickyStyle: any; + topOffset: number; + bottomOffset: number; + onStickyStateChange: (isSticky: boolean) => void; + } + + export var Sticky: React.ComponentClass; + +} + diff --git a/react-sticky/react-sticky-tests.tsx b/react-sticky/react-sticky-tests.tsx new file mode 100644 index 0000000000..7ab99bf0c7 --- /dev/null +++ b/react-sticky/react-sticky-tests.tsx @@ -0,0 +1,9 @@ +import {Sticky, StickyContainer} from "react-sticky"; +import * as React from "react"; + +const StickyComponent: JSX.Element = + + undefined}> + + ; + diff --git a/react-sticky/tsconfig.json b/react-sticky/tsconfig.json new file mode 100644 index 0000000000..e2ea2938d1 --- /dev/null +++ b/react-sticky/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "jsx": "react", + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-sticky-tests.tsx" + ] +} + diff --git a/react-sticky/tslint.json b/react-sticky/tslint.json new file mode 100644 index 0000000000..ccdb64abf2 --- /dev/null +++ b/react-sticky/tslint.json @@ -0,0 +1,2 @@ +{ "extends": "../tslint.json" } + diff --git a/react/index.d.ts b/react/index.d.ts index ebb4a76e20..64879114cf 100644 --- a/react/index.d.ts +++ b/react/index.d.ts @@ -207,7 +207,7 @@ declare namespace React { (props: P & { children?: ReactNode }, context?: any): ReactElement; propTypes?: ValidationMap

; contextTypes?: ValidationMap; - defaultProps?: P; + defaultProps?: Partial

; displayName?: string; } @@ -216,7 +216,7 @@ declare namespace React { propTypes?: ValidationMap

; contextTypes?: ValidationMap; childContextTypes?: ValidationMap; - defaultProps?: P; + defaultProps?: Partial

; displayName?: string; } diff --git a/react/test/index.ts b/react/test/index.ts index 38ad574aa4..64d5d9d918 100644 --- a/react/test/index.ts +++ b/react/test/index.ts @@ -689,3 +689,18 @@ type InputChangeEvent = React.ChangeEvent; type InputFormEvent = React.FormEvent; const changeEvent:InputChangeEvent = undefined as any; const formEvent:InputFormEvent = changeEvent; + +// defaultProps should be optional of props +{ + interface ComponentProps { + prop1: string; + prop2: string; + prop3?: string; + } + class ComponentWithDefaultProps extends React.Component { + static defaultProps = { + prop3: "default value", + }; + } + const VariableWithAClass: React.ComponentClass = ComponentWithDefaultProps; +} diff --git a/wonder-commonlib/index.d.ts b/wonder-commonlib/index.d.ts index 464b6ada4e..1cad038d52 100644 --- a/wonder-commonlib/index.d.ts +++ b/wonder-commonlib/index.d.ts @@ -1,8 +1,11 @@ -// Type definitions for wonder-commonlib 0.1 +// Type definitions for wonder-commonlib 0.1.1 // Project: https://github.com/yyc-git/Wonder-CommonLib // Definitions by: YYC // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + declare module wdCb { class JudgeUtils { static isArray(arr: any): boolean; @@ -21,7 +24,8 @@ declare module wdCb { } } -declare var global: any, window: Window; +declare var global:NodeJS.Global,window:Window; + declare module wdCb { var root: any; } diff --git a/wonder-frp/index.d.ts b/wonder-frp/index.d.ts index c7459d6690..00910bc80d 100644 --- a/wonder-frp/index.d.ts +++ b/wonder-frp/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for wonder-frp 0.1 +// Type definitions for wonder-frp 0.1.1 // Project: https://github.com/yyc-git/Wonder-FRP // Definitions by: YYC // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// +/// declare module wdFrp { class JudgeUtils extends wdCb.JudgeUtils { @@ -103,7 +104,7 @@ declare module wdFrp { } } -declare var global: any, window: Window; +declare var global:NodeJS.Global,window:Window; declare module wdFrp { var root: any; } diff --git a/xdg-basedir/index.d.ts b/xdg-basedir/index.d.ts new file mode 100644 index 0000000000..d18bc389f9 --- /dev/null +++ b/xdg-basedir/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for xdg-basedir 2.0 +// Project: https://github.com/sindresorhus/xdg-basedir +// Definitions by: Tomek Łaziuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export const data: string | null; +export const config: string | null; +export const cache: string | null; +export const runtime: string | null; +export const dataDirs: string[]; +export const configDirs: string[]; diff --git a/xdg-basedir/tsconfig.json b/xdg-basedir/tsconfig.json new file mode 100644 index 0000000000..44428e6cc7 --- /dev/null +++ b/xdg-basedir/tsconfig.json @@ -0,0 +1,20 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "xdg-basedir-tests.ts" + ] +} diff --git a/xdg-basedir/tslint.json b/xdg-basedir/tslint.json new file mode 100644 index 0000000000..377cc837d4 --- /dev/null +++ b/xdg-basedir/tslint.json @@ -0,0 +1 @@ +{ "extends": "../tslint.json" } diff --git a/xdg-basedir/xdg-basedir-tests.ts b/xdg-basedir/xdg-basedir-tests.ts new file mode 100644 index 0000000000..a6b7073c18 --- /dev/null +++ b/xdg-basedir/xdg-basedir-tests.ts @@ -0,0 +1,3 @@ +import * as xdg from 'xdg-basedir'; + +console.log(JSON.stringify(xdg, undefined, 2)); diff --git a/xlsx/index.d.ts b/xlsx/index.d.ts index 3c78abb140..4e4eb060f7 100644 --- a/xlsx/index.d.ts +++ b/xlsx/index.d.ts @@ -143,7 +143,7 @@ export interface IUtils { range?: any; header?: "A"|number|string[]; }):T[]; - sheet_to_csv(worksheet: IWorkSheet):any; + sheet_to_csv(worksheet: IWorkSheet, options?: { FS: string, RS: string }): string; sheet_to_formulae(worksheet: IWorkSheet):any; encode_cell(cell: ICell): any; encode_range(s: ICell, e: ICell): any;