From de2833f8224cbf8abbb81377f1eebb04c6a929af Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Tue, 9 Jan 2018 14:49:25 -0800 Subject: [PATCH 01/15] Fix ej.web.all tests (#22768) --- types/ej.web.all/ej.web.all-tests.ts | 223 ++------------------------- 1 file changed, 14 insertions(+), 209 deletions(-) diff --git a/types/ej.web.all/ej.web.all-tests.ts b/types/ej.web.all/ej.web.all-tests.ts index d03f9ebf39..678754d5d4 100644 --- a/types/ej.web.all/ej.web.all-tests.ts +++ b/types/ej.web.all/ej.web.all-tests.ts @@ -1,3 +1,10 @@ +interface Window { + kanbanData: any; + themeVarient: string; + themeStyle: string; + themeColor: string; +} + module AccordionComponent { $(function () { var sample = new ej.Accordion($("#basicAccordion"), { @@ -18,8 +25,6 @@ module AccordionComponent { }); } - - module AutocompleteComponent{ var carList = [ "Audi S6", "Austin-Healey", "Alfa Romeo", "Aston Martin", @@ -54,10 +59,6 @@ module AutocompleteComponent{ }); } - - - - module Barcodecomponent { $(function () { var barcodesample = new ej.datavisualization.Barcode($("#Barcode"), { @@ -66,16 +67,13 @@ module Barcodecomponent { }); } - - - - module Bulletgraphcomponent { $(function () { var bulletsample = new ej.datavisualization.BulletGraph($("#BulletGraph"), { isResponsive: true, load: function () { var sender = $("#BulletGraph").data("ejBulletGraph"); + var theme: string; var bulletTheme = window.themeStyle + window.themeColor + window.themeVarient; if (bulletTheme) { switch (bulletTheme) { @@ -129,10 +127,6 @@ module Bulletgraphcomponent { }); } - - - - module ButtonComponent { $(function () { var basicButton = new ej.Button($("#buttonnormal"), { @@ -178,10 +172,8 @@ module ButtonComponent { }); } - - - module ChartComponent { + var theme = "???"; $(function () { var chartsample = new ej.datavisualization.Chart($("#Chart"), { primaryXAxis: { @@ -259,7 +251,6 @@ module ChartComponent { model.primaryYAxis.labelIntersectAction = "rotate45"; model.primaryYAxis.edgeLabelPlacement = "hide"; } - var theme = window.themeStyle + window.themeColor + window.themeVarient; if (theme) { switch (theme) { case "flatdark": @@ -301,16 +292,11 @@ module ChartComponent { }, title: { text: 'Efficiency of oil-fired power production' }, size: { height: "600" }, - legend: { visible: true}, - load:"loadTheme" + legend: { visible: true} }); }); } - - - - module circulargaugecomponent { $(function () { var circularsample = new ej.datavisualization.CircularGauge($("#CircularGauge"), { @@ -362,9 +348,6 @@ module circulargaugecomponent { }); } - - - module ColorPickerComponent { $(function () { var colorSample = new ej.ColorPicker($("#colorpick"), { @@ -373,31 +356,6 @@ module ColorPickerComponent { }); } - - - -module ComboBoxComponent{ - var BikeList = [ - { empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" }, - { empid: "bk4", text: "Discover" }, { empid: "bk5", text: "Dazzler" }, { empid: "bk6", text: "Flame" }, - { empid: "bk7", text: "Fazzer" }, { empid: "bk8", text: "FZ-S" }, { empid: "bk9", text: "Pulsar" }, - { empid: "bk10", text: "Shine" }, { empid: "bk11", text: "R15" }, { empid: "bk12", text: "Unicorn" } - ]; - $(function () { - var comboboxInstance =new ej.ComboBox($("#selectCar"), { - width: "100%", - placeholder: "Select a Bike", - fields: { text: "text", value: "empid" }, - dataSource: BikeList, - autofill: true - }); - }); -} - - - - - module DatePickerComponent { $(function () { var dateSample = new ej.DatePicker($("#datepick"), { @@ -406,9 +364,6 @@ module DatePickerComponent { }); } - - - module DateTimePickerComponent { $(function () { var datetimeSample = new ej.DateRangePicker($("#daterangepick"), { @@ -417,8 +372,6 @@ module DateTimePickerComponent { }); } - - module DateTimePickerComponent { $(function () { var datetimeSample = new ej.DateTimePicker($("#datetimepick"), { @@ -427,8 +380,6 @@ module DateTimePickerComponent { }); } - - $(function () { var diagram = new ej.datavisualization.Diagram($("#diagram"), { width: "1000px", @@ -501,8 +452,6 @@ function createLabel(options : any) { return options; } - - module DialogComponent { $(function () { var dialogInstance = new ej.Dialog($("#basicDialog"), { @@ -525,9 +474,6 @@ module DialogComponent { }); } - - - module digitalgaugecomponent { $(function () { var digitalgaugesample = new ej.datavisualization.DigitalGauge($("#DigitalGauge"), { @@ -551,10 +497,6 @@ module digitalgaugecomponent { } - - - - module DropDownListComponent { var BikeList = [ { empid: "bk1", text: "Apache RTR" }, { empid: "bk2", text: "CBR 150-R" }, { empid: "bk3", text: "CBZ Xtreme" }, @@ -586,10 +528,6 @@ module DropDownListComponent { } - - - - module ExplorerComponent { $(function () { var file = new ej.FileExplorer($("#fileExplorer"), { @@ -603,9 +541,6 @@ module ExplorerComponent { }); } - - - module GanttComponent { $(function () { var ganttInstance = new ej.Gantt($("#GanttContainer"), { @@ -656,8 +591,6 @@ module GanttComponent { }); } - - module GridComponent { $(function () { var gridInstance = new ej.Grid($("#Grid"), { @@ -693,8 +626,6 @@ module GridComponent { }); } - - var columns = ["Vegie-spread", "Tofuaa", "Alice Mutton", "Konbu", "Fl�temysost"] var itemSource: any[] = []; for (var i = 0; i < columns.length; i++) { @@ -740,13 +671,6 @@ $(function () { }); }); - - - -declare var window:myWindow; -export interface myWindow extends Window{ -kanbanData:any; -} module KanbanComponent { $(function () { var sample = new ej.Kanban($("#Kanban"), { @@ -769,9 +693,6 @@ module KanbanComponent { }); } - - - module lineargaugecomponent { $(function () { var linearsample = new ej.datavisualization.LinearGauge($("#LinearGauge"), { @@ -800,10 +721,6 @@ module lineargaugecomponent { }); } - - - - module ListBoxComponent { $(function () { var listboxInstance = new ej.ListBox($("#selectcar"), { @@ -812,8 +729,6 @@ module ListBoxComponent { }); } - - module ListviewComponent { $(function () { var listviewInstance = new ej.ListView($("#defaultlistview"), { @@ -823,7 +738,6 @@ module ListviewComponent { }); } - var world_map= { "type": "FeatureCollection", @@ -1050,11 +964,6 @@ module mapcomponenet { } - - - - - module MenuComponent { $(function () { var sample = new ej.Menu($("#syncfusionProducts"),{ @@ -1078,12 +987,6 @@ module MenuComponent { } - - - - - - module NavigationDrawerComponent { $(function () { var navigationdrawerInstance = new ej.NavigationDrawer($("#navpane"), { @@ -1105,8 +1008,6 @@ module NavigationDrawerComponent { }); } - - module PDFViewerComponent { $(function () { var pdfviewerControl = new ej.PdfViewer($("#pdfviewer"), { @@ -1116,8 +1017,6 @@ module PDFViewerComponent { }); } - - module PivotChartOlap { $(function () { var sample = new ej.PivotChart($("#PivotChart"),{ @@ -1154,14 +1053,11 @@ module PivotChartOlap { size: { height: "460px", width: "100%" }, primaryXAxis: { title: { text: "Date - Fiscal" }, labelRotation: 0 }, primaryYAxis: { title: { text: "Internet Sales Amount" } }, - legend: { visible: true, rowCount: 2 }, - load:"loadTheme" + legend: { visible: true, rowCount: 2 } }); }); } - - var pivot_dataset = [ { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, @@ -1229,14 +1125,11 @@ module PivotChartRelational { }, size: { height: "460px", width: "100%" }, primaryYAxis: { title: { text: "Amount" } }, - legend: { visible: true }, - load:"loadTheme" + legend: { visible: true } }); }); } - - module PivotGaugeOlap { $(function () { @@ -1342,8 +1235,6 @@ module PivotGaugeOlap { }); } - - var pivot_dataset = [ { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, @@ -1463,8 +1354,6 @@ module PivotGaugeRelational { }); } - - module PivotGridOlap { $(function () { @@ -1502,8 +1391,6 @@ module PivotGridOlap { }); } - - var pivot_dataset = [ { Amount: 100, Country: "Canada", Date: "FY 2005", Product: "Bike", Quantity: 2, State: "Alberta" }, { Amount: 200, Country: "Canada", Date: "FY 2006", Product: "Van", Quantity: 3, State: "British Columbia" }, @@ -1572,8 +1459,6 @@ module PivotGridRelational { }); } - - module PivotTreeMap { $(function () { var sample = new ej.PivotTreeMap($("#PivotTreeMap"),{ @@ -1607,8 +1492,6 @@ module PivotTreeMap { }); } - - module ProgressBarComponent { $(function () { var sample = new ej.ProgressBar($("#progressBar"),{ @@ -1625,9 +1508,6 @@ module ProgressBarComponent { } - - - declare var rteObj: any; declare var data: any; var radialEle = $('#defaultradialmenu'), action = 0, forRedo = 0; @@ -1671,7 +1551,6 @@ module RadialMenuComponent { }); } - function bold(e: any) { rteObj = rteEle.data("ejRTE"); @@ -1707,9 +1586,6 @@ function redo(e: any) { radialEle.focus(); } - - - module RadialSliderComponent { $(function () { var radialsliderInstance = new ej.RadialSlider($("#radialSlider"), { @@ -1718,7 +1594,6 @@ module RadialSliderComponent { }); } - module rangecomponent { $(function () { var linearsample = new ej.datavisualization.RangeNavigator($("#RangeNavigator"), { @@ -1833,8 +1708,6 @@ function GetData() { return data; }; - - module RatingComponent { $(function () { @@ -1889,8 +1762,6 @@ module RatingComponent { } - - module ReportViewerComponent { $(function () { var report = new ej.ReportViewer($("#territoryReportViewer"), { @@ -1903,8 +1774,6 @@ module ReportViewerComponent { }); } - - var fontfamily = ["Segoe UI", "Arial", "Times New Roman", "Tahoma", "Helvetica"], fontsize = ["1pt", "2pt", "3pt", "4pt", "5pt"], action1 = ["New", "Clear"], action2 = ["Bold", "Italic", "Underline", "strikethrough", "superscript", "subscript", "JustifyLeft", "JustifyCenter", "JustifyRight", "JustifyFull", "Undo", "Redo"]; module RibbonComponent { $(function () { @@ -2579,7 +2448,7 @@ module RibbonComponent { function colorHandler(args:any) { (this._id.indexOf("fillcolor") != -1) ? $("#contenteditor").css('background-color', args.value) : document.execCommand('forecolor', false, args.value); } -function onClick(args) { +function onClick(args: any) { var val, prop = args.text; val = (ej.isNullOrUndefined(args.model.text)) ? args.model.activeText : args.model.text; if (action1.indexOf(val) != -1) @@ -2595,10 +2464,6 @@ function onClick(args) { } - - - - module RotatorComponent { $(function () { var rotatorInstance = new ej.Rotator($("#sliderContent"), { @@ -2620,8 +2485,6 @@ module RotatorComponent { }); } - - module RTEComponent { $(function () { var sample = new ej.RTE($("#rteSample"),{ @@ -2692,8 +2555,6 @@ module RTEComponent { } - - module ScheduleComponent { $(function () { var sample = new ej.Schedule($("#Schedule1"), { @@ -2762,8 +2623,6 @@ module ScheduleComponent { }); } - - module ScrollerComponent { $(function () { var scrollerSample = new ej.Scroller($("#scrollcontent"), { @@ -2777,8 +2636,6 @@ module ScrollerComponent { }); } - - module SignatureComponent { $(function () { var basicSignature = new ej.Signature($("#signature"), { @@ -2789,9 +2646,6 @@ module SignatureComponent { }); } - - - module SliderComponent { $(function () { var slider = new ej.Slider($("#minSlider"), { @@ -2810,10 +2664,6 @@ module SliderComponent { } - - - - module linesparkline { $(function () { @@ -2942,10 +2792,6 @@ module piesparkline4 { } - - - - module SplitterComponent { $(function () { var splitterInstance = new ej.Splitter($("#outterSpliter"), { @@ -2961,8 +2807,6 @@ module SplitterComponent { }); } - - module SpreadsheetComponent { $(function () { var sample = new ej.Spreadsheet($("#basicSpreadsheet"), { @@ -2990,9 +2834,6 @@ $(function () { }); } - - - var default_data: Array = [ { Category : "Employees", Country : "USA", JobDescription : "Sales", JobGroup:"Executive", EmployeesCount : 50 }, { Category : "Employees", Country : "USA", JobDescription : "Sales", JobGroup : "Analyst", EmployeesCount : 40 }, @@ -3058,15 +2899,11 @@ module sunburstcomponent { }, title:{text:"Employees Count"}, zoomSettings:{enable:false}, - legend:{visible:true,position:'top'}, - load:"loadTheme" + legend:{visible:true,position:'top'} }); }); } - - - module TabComponent { $(function () { var sample = new ej.Tab($("#defaultTab"),{ @@ -3080,11 +2917,8 @@ module TabComponent { }); } - - module TagCloudComponent { - var websiteCollection = [ { text: "Google", url: "http://www.google.com", frequency: 12 }, { text: "All Things Digital", url: "http://allthingsd.com/", frequency: 3 }, @@ -3119,8 +2953,6 @@ module TagCloudComponent { }); } - - module EditorComponent { $(function () { var num = new ej.NumericTextbox($("#numeric"), { @@ -3153,10 +2985,6 @@ module EditorComponent { }); } - - - - module TileViewComponent { $(function () { var tile1 = new ej.Tile($("#tile1"), { @@ -3235,8 +3063,6 @@ module TileViewComponent { }); } - - module TimePickerComponent { $(function () { var timeSample = new ej.TimePicker($("#timepick"), { @@ -3245,9 +3071,6 @@ module TimePickerComponent { }); } - - - module ToolbarComponent { $(function () { @@ -3264,9 +3087,6 @@ module ToolbarComponent { } - - - module TooltipComponent { $(function () { @@ -3322,8 +3142,6 @@ module TooltipComponent { }); } - - module TreeGridComponent { $(function () { var treegridInstance = new ej.TreeGrid($("#TreeGridContainer"), { @@ -3365,9 +3183,6 @@ module TreeGridComponent { }); } - - - var population_data: Array = [ { Continent: "Asia", Country: "Indonesia", Growth: 3, Population: 237641326 }, { Continent: "Asia", Country: "Russia", Growth: 2, Population: 152518015 }, @@ -3406,10 +3221,6 @@ module treemapcomponent { }); } - - - - module TreeViewComponent { $(function () { var tree = new ej.TreeView($("#treeView"), { @@ -3421,9 +3232,6 @@ module TreeViewComponent { }); } - - - module UploadboxComponent { $(function () { @@ -3445,9 +3253,6 @@ module UploadboxComponent { } - - - module WaitingPopupComponent { $(function () { var sample = new ej.WaitingPopup($("#target"),{ From 389086e6d501918dfbad0229db16d81e62c6809a Mon Sep 17 00:00:00 2001 From: Adam Langley Date: Tue, 9 Jan 2018 15:21:52 -0800 Subject: [PATCH 02/15] webappsec-credential-management: include webauthn types. (#22683) [WebAuthn](https://w3c.github.io/webauthn/) builds upon the Credential Management API and provides for origin-scoped, public-key credentials. It replaces the FIDO U2F API which is currently used to implement this. While the webauthn spec is still only a candidate recommendation, the types in this change are sufficient to exercise basic functionality with Firefox Nightly. (Note: that requires changes in about:config to enable this API.) --- .../index.d.ts | 118 +++++++++++++++++- .../webappsec-credential-management-tests.ts | 71 ++++++++++- 2 files changed, 187 insertions(+), 2 deletions(-) diff --git a/types/webappsec-credential-management/index.d.ts b/types/webappsec-credential-management/index.d.ts index af99a50d27..533c26c8a2 100644 --- a/types/webappsec-credential-management/index.d.ts +++ b/types/webappsec-credential-management/index.d.ts @@ -122,7 +122,7 @@ interface CredentialData { id: string; } -type Credential = PasswordCredential|FederatedCredential; +type Credential = PasswordCredential|FederatedCredential|PublicKeyCredential; /** * A generic and extensible Credential interface from which all credentials @@ -309,6 +309,11 @@ interface CredentialRequestOptions { * request. */ mediation?: CredentialMediationRequirement; + + /** + * This property specifies options for requesting a public-key signature. + */ + publicKey?: PublicKeyCredentialRequestOptions; } /** @@ -333,6 +338,10 @@ interface CredentialCreationOptions { * @see {@link https://www.w3.org/TR/2017/WD-credential-management-1-20170804/#dom-credentialcreationoptions-federated} */ federated?: FederatedCredentialInit; + /** + * @see {@link https://w3c.github.io/webauthn/#dictionary-makecredentialoptions} + */ + publicKey?: MakePublicKeyCredentialOptions; } /** @@ -351,3 +360,110 @@ interface FederatedCredentialRequestOptions { */ protocols?: string[]; } + +// Type definitions for webauthn +// Spec: https://w3c.github.io/webauthn/ + +/** + * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialrequestoptions} + */ +interface PublicKeyCredentialRequestOptions { + challenge: BufferSource; + timeout: number; + rpId: string; + allowCredentials: PublicKeyCredentialDescriptor[]; + userVerification?: 'required' | 'preferred' | 'discouraged'; + extensions?: any; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialrpentity} + */ +interface PublicKeyCredentialRpEntity { + id: string; + name: string; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialuserentity} + */ +interface PublicKeyCredentialUserEntity { + id: BufferSource; + name: string; + displayName: string; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialparameters} + */ +interface PublicKeyCredentialParameters { + type: 'public-key'; + alg: number; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#dictdef-publickeycredentialdescriptor} + */ +interface PublicKeyCredentialDescriptor { + type: 'public-key'; + id: BufferSource; + transports?: Array; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#dictdef-authenticatorselectioncriteria} + */ +interface AuthenticatorSelectionCriteria { + authenticatorAttachment?: string; + requireResidentKey?: boolean; + requireUserVerification?: string; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#dictdef-makepublickeycredentialoptions} + */ +interface MakePublicKeyCredentialOptions { + rp: PublicKeyCredentialRpEntity; + user: PublicKeyCredentialUserEntity; + + challenge: BufferSource; + pubKeyCredParams: Array; + + timeout?: number; + excludeCredentials?: Array; + authenticatorSelection?: AuthenticatorSelectionCriteria; + attestation?: 'none' | 'indirect' | 'direct'; + extensions?: any; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#authenticatorresponse} + */ +interface AuthenticatorResponse { + readonly clientDataJSON: ArrayBuffer; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#authenticatorattestationresponse} + */ +interface AuthenticatorAttestationResponse extends AuthenticatorResponse { + readonly attestationObject: ArrayBuffer; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#iface-authenticatorassertionresponse} + */ +interface AuthenticatorAssertionResponse extends AuthenticatorResponse { + readonly authenticatorData: ArrayBuffer; + readonly signature: ArrayBuffer; + readonly userHandle: ArrayBuffer; +} + +/** + * @see {@link https://w3c.github.io/webauthn/#publickeycredential} + */ +interface PublicKeyCredential extends CredentialData { + readonly type: 'public-key'; + readonly rawId: ArrayBuffer; + readonly response: AuthenticatorAttestationResponse|AuthenticatorAssertionResponse; +} diff --git a/types/webappsec-credential-management/webappsec-credential-management-tests.ts b/types/webappsec-credential-management/webappsec-credential-management-tests.ts index 5850d86e72..58503208b3 100644 --- a/types/webappsec-credential-management/webappsec-credential-management-tests.ts +++ b/types/webappsec-credential-management/webappsec-credential-management-tests.ts @@ -138,9 +138,10 @@ function federatedSignIn() { break; } } else { + const pwCred = credential as PasswordCredential; fetch( 'https://example.com/loginEndpoint', - {credentials: credential, method: 'POST'}); + {credentials: pwCred, method: 'POST'}); } }); } @@ -270,3 +271,71 @@ function createFederatedCredential() { // Credential created! }); } + +function webauthnRegister() { + if (!navigator.credentials) { + return; + } + + const challenge = new Uint8Array(32); + window.crypto.getRandomValues(challenge); + + const credPromise = navigator.credentials.create({ + publicKey: { + rp: { + id: document.domain, + name: document.domain, + }, + user: { + id: (new Uint8Array(1)).buffer, + name: 'test user', + displayName: 'test user', + }, + challenge, + pubKeyCredParams: [ + {type: 'public-key', alg: -7}, + ], + timeout: 5000, + authenticatorSelection: {}, + } + }); + + credPromise.then((cred) => { + const pubKeyCred = cred as PublicKeyCredential; + console.log(pubKeyCred); + }, (e) => { + console.log(e.message); + }); +} + +function webauthnAuthenticate() { + if (!navigator.credentials) { + return; + } + + const credentialID = new Uint8Array(64); + const challenge = new Uint8Array(32); + window.crypto.getRandomValues(challenge); + + const authPromise = navigator.credentials.get({publicKey: { + challenge, + timeout: 5000, + rpId: document.domain, + allowCredentials: [{ + type: "public-key", + id: credentialID, + }], + }}); + + authPromise.then((cred) => { + if (cred === null) { + return; + } + + const pubKeyCred = cred as PublicKeyCredential; + const response = pubKeyCred.response; + const authData = new Uint8Array(response.authenticatorData); + }, (e) => { + console.log(e.message); + }); +} From 33e817dd09d2630287fb7a67b55867195ac868df Mon Sep 17 00:00:00 2001 From: salim7 Date: Wed, 10 Jan 2018 00:22:47 +0100 Subject: [PATCH 03/15] Updated to Onsen UI 2.8. Fixed typos. Added missing component PullHook. Added missing attributes to existing components. (#22791) --- types/react-onsenui/index.d.ts | 36 +++++++++++++++++---- types/react-onsenui/react-onsenui-tests.tsx | 5 +-- 2 files changed, 32 insertions(+), 9 deletions(-) diff --git a/types/react-onsenui/index.d.ts b/types/react-onsenui/index.d.ts index 72cd5658e8..9e31884558 100644 --- a/types/react-onsenui/index.d.ts +++ b/types/react-onsenui/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for React OnSenui (react-onsenui) 2.7 +// Type definitions for React Onsen UI (react-onsenui) 2.8 // Project: https://onsen.io/v2/docs/guide/react/ -// Definitions by: Ozytis +// Definitions by: Ozytis , Salim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -23,6 +23,10 @@ export interface AnimationOptions { timing?: string; } +export interface PullHookChangeEvent { + state: "initial" | "preaction" | "action"; +} + /*** splitter ***/ export class SplitterSide extends Component<{ side?: "left" | "right", @@ -33,13 +37,14 @@ export class SplitterSide extends Component<{ onPreClose?(e?: Event): void, onModeChange?(e?: Event): void, onClose?(e?: Event): void, - isSwipeable?: boolean, + swipeable?: boolean, swipeTargetWidth?: number, width?: number, animation?: "overlay" | "default" animationOptions?: AnimationOptions, openThreshold?: number, - mode?: "collapse" | "split" + mode?: "collapse" | "split", + className?: string }, any> { } export class SplitterContent extends Component { } @@ -89,11 +94,15 @@ export class Page extends Component<{ /*** Grid ***/ export class Col extends Component<{ verticalAlign?: "top" | "bottom" | "center", - width?: string + width?: string, + className?: string, + style?: React.CSSProperties, }, any> {} export class Row extends Component<{ verticalAlign?: "top" | "bottom" | "center", + className?: string, + style?: React.CSSProperties, }, any> {} /*** Navigation ***/ @@ -234,7 +243,7 @@ export class ProgressCircular extends Component<{ modifier?: string, value?: number, secondaryValue?: boolean, - intermediate?: boolean, + indeterminate?: boolean, }, any> {} export class Ripple extends Component<{ @@ -358,4 +367,17 @@ export class ListItem extends Component<{ onClick?: React.MouseEventHandler, }, any> {} -export class Card extends Component { } +export class Card extends Component<{ + modifier?: string, +}, any> {} + +/** Pull-to-refresh hook. */ +export class PullHook extends Component<{ + onChange?(e: PullHookChangeEvent): void, + onLoad?(done: () => void): void, + onPull?(): void, + disabled?: boolean, + height?: number, + thresholdHeight?: number, + fixedContent?: boolean, +}, any> {} diff --git a/types/react-onsenui/react-onsenui-tests.tsx b/types/react-onsenui/react-onsenui-tests.tsx index fc472b96d6..9286469e2c 100644 --- a/types/react-onsenui/react-onsenui-tests.tsx +++ b/types/react-onsenui/react-onsenui-tests.tsx @@ -28,14 +28,15 @@ export class App extends React.Component { return ( this.hide()} - isSwipeable={true}> + swipeable> Menu content - + From 1f6877622622b927ea3ca28ac26358a9c42ae73c Mon Sep 17 00:00:00 2001 From: austinried <4966622+austinried@users.noreply.github.com> Date: Tue, 9 Jan 2018 15:23:33 -0800 Subject: [PATCH 04/15] AttributeValue "N" should be string (#22790) AttributeValue's "N" is a string, not a number: http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_streams_AttributeValue.html This causes an incompatibility between this AttributeValue and the one in the AWS SDK types, which makes it impossible to use something like AWS.DynamoDB.Converter.unmarshall() for items in records on a DynamoDBStreamEvent. --- types/aws-lambda/aws-lambda-tests.ts | 14 +++++++------- types/aws-lambda/index.d.ts | 2 +- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 8eb9c509fe..1d756f21e0 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -120,7 +120,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { dynamodb: { Keys: { Id: { - N: 101 + N: '101' } }, NewImage: { @@ -128,7 +128,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { S: 'New item!' }, Id: { - N: 101 + N: '101' } }, StreamViewType: 'NEW_AND_OLD_IMAGES', @@ -150,13 +150,13 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { S: 'New item!' }, Id: { - N: 101 + N: '101' } }, SequenceNumber: '222', Keys: { Id: { - N: 101 + N: '101' } }, SizeBytes: 59, @@ -165,7 +165,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { S: 'This item has changed' }, Id: { - N: 101 + N: '101' } }, StreamViewType: 'NEW_AND_OLD_IMAGES' @@ -182,7 +182,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { dynamodb: { Keys: { Id: { - N: 101 + N: '101' } }, SizeBytes: 38, @@ -192,7 +192,7 @@ var dynamoDBStreamEvent: AWSLambda.DynamoDBStreamEvent = { S: 'This item has changed' }, Id: { - N: 101 + N: '101' } }, StreamViewType: 'NEW_AND_OLD_IMAGES' diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index da680178eb..320cf562f8 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -74,7 +74,7 @@ interface AttributeValue { BOOL?: boolean; L?: Array; M?: { [id: string]: AttributeValue }; - N?: number; + N?: string; NS?: Array; NULL?: boolean; S?: string; From f0b524190af13bf397840eaa0a6113294ecbcb23 Mon Sep 17 00:00:00 2001 From: Sianiuk Artur Date: Wed, 10 Jan 2018 02:24:58 +0300 Subject: [PATCH 05/15] Added type definitions for react-flags-select (#22787) * Added type definitions for react-flags-select * fixed test and definitions --- types/react-flags-select/index.d.ts | 29 ++++++++ .../react-flags-select-tests.tsx | 73 +++++++++++++++++++ types/react-flags-select/tsconfig.json | 25 +++++++ types/react-flags-select/tslint.json | 1 + 4 files changed, 128 insertions(+) create mode 100644 types/react-flags-select/index.d.ts create mode 100644 types/react-flags-select/react-flags-select-tests.tsx create mode 100644 types/react-flags-select/tsconfig.json create mode 100644 types/react-flags-select/tslint.json diff --git a/types/react-flags-select/index.d.ts b/types/react-flags-select/index.d.ts new file mode 100644 index 0000000000..6a2e1dc964 --- /dev/null +++ b/types/react-flags-select/index.d.ts @@ -0,0 +1,29 @@ +// Type definitions for react-flags-select 1.1 +// Project: https://github.com/ekwonye-richard/react-flags-select#readme +// Definitions by: Artur Sianiuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Component } from 'react'; + +interface Props { + countries?: string[]; + blackList?: boolean; + customLabels?: {[propName: string]: string}; + selectedSize?: number; + optionsSize?: number; + defaultCountry?: string; + placeholder?: string; + className?: string; + showSelectedLabel?: boolean; + showOptionLabel?: boolean; + alignOptions?: string; + onSelect?: (countryCode: string) => void; + disabled?: boolean; + searchable?: boolean; +} +declare class ReactFlagsSelect extends Component { + updateSelected(countryCode: string): void; +} + +export default ReactFlagsSelect; diff --git a/types/react-flags-select/react-flags-select-tests.tsx b/types/react-flags-select/react-flags-select-tests.tsx new file mode 100644 index 0000000000..31bf921154 --- /dev/null +++ b/types/react-flags-select/react-flags-select-tests.tsx @@ -0,0 +1,73 @@ +import * as React from 'react'; +import ReactFlagsSelect from 'react-flags-select'; + +export class ReactFlagsSelectTest extends React.Component { + countries = ['US', 'GB', 'FR', 'DE', 'IT']; + customLabels = {US: 'EN-US', GB: 'EN-GB', FR: 'FR', DE: 'DE', IT: 'IT'}; + onSelectFlag(countryCode: string) { } + render() { + return ( +
+ + + + + + + + + + + + + + + + +
+ ); + } +} diff --git a/types/react-flags-select/tsconfig.json b/types/react-flags-select/tsconfig.json new file mode 100644 index 0000000000..f42fa48c4a --- /dev/null +++ b/types/react-flags-select/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-flags-select-tests.tsx" + ] +} diff --git a/types/react-flags-select/tslint.json b/types/react-flags-select/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/react-flags-select/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file From 9f041991c6ae406645bb90a8c19edb0d5001c97a Mon Sep 17 00:00:00 2001 From: Ian Ker-Seymer Date: Wed, 10 Jan 2018 13:13:35 -0500 Subject: [PATCH 06/15] Make react-loadable export an assignment (#22340) * Make react-loadable export an assignment `react-loadable` does *not* actually have a default export. This can be shown by running: ``` > var L = require('react-loadable') undefined > L { [Function: Loadable] Map: [Function: LoadableMap], Capture: { [Function: Capture] propTypes: { report: [Function: bound checkType] }, childContextTypes: { loadable: [Function: bound checkType] } }, preloadAll: [Function], preloadReady: [Function] } ``` As a result, when attempting to use this with commonjs modules, an error error is thrown when `allowSyntheticDefaultExports` is set. ``` TypeError: react_loadable_1.default is not a function ``` This PR exports the module as an assignment, so now `import * as Loadable from 'react-loadable'` should be used to import the module. I am not entirely sure that I have used the best pattern for typings here; but my goal was to export the proper assignment yet still allow all of the namespace to be accessible via `(i.e.) Loadable.LoadingComponentProps`. If there is a better way, please let me know and I will be happy to adjust! * Use import assignment in react-loadable tests --- types/react-loadable/index.d.ts | 354 ++++++++++++++-------------- types/react-loadable/test/index.tsx | 4 +- 2 files changed, 182 insertions(+), 176 deletions(-) diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index 6220b23ea6..8b591d3f3a 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -1,184 +1,190 @@ // Type definitions for react-loadable 5.3 // Project: https://github.com/thejameskyle/react-loadable#readme -// Definitions by: Diogo Franco , Oden S. +// Definitions by: Diogo Franco , Oden S. , Ian Ker-Seymer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -import * as React from 'react'; +/// -export interface LoadingComponentProps { - isLoading: boolean; - pastDelay: boolean; - timedOut: boolean; - error: any; +declare namespace Loadable { + interface LoadingComponentProps { + isLoading: boolean; + pastDelay: boolean; + timedOut: boolean; + error: any; + } + + type Options = OptionsWithoutRender | OptionsWithRender; + + interface CommonOptions { + /** + * React component displayed after delay until loader() succeeds. Also responsible for displaying errors. + * + * If you don't want to render anything you can pass a function that returns null + * (this is considered a valid React component). + */ + // NOTE: () => null is only needed until React.SFC supports components returning null + loading: React.ComponentType | (() => null); + /** + * Defaults to 200, in milliseconds. + * + * Only show the loading component if the loader() has taken this long to succeed or error. + */ + delay?: number | false | null; + /** + * Disabled by default. + * + * After the specified time in milliseconds passes, the component's `timedOut` prop will be set to true. + */ + timeout?: number | false | null; + + /** + * Optional array of module paths that `Loadable.Capture`'s `report` function will be applied on during + * server-side rendering. This helps the server know which modules were imported/used during SSR. + * ```ts + * Loadable({ + * loader: () => import('./my-component'), + * modules: ['./my-component'], + * }); + * ``` + */ + modules?: string[]; + + /** + * An optional function which returns an array of Webpack module ids which you can get + * with require.resolveWeak. This is used by the client (inside `Loadable.preloadReady`) to + * guarantee each webpack module is preloaded before the first client render. + * ```ts + * Loadable({ + * loader: () => import('./Foo'), + * webpack: () => [require.resolveWeak('./Foo')], + * }); + * ``` + */ + webpack?: () => number[]; + } + + interface OptionsWithoutRender extends CommonOptions { + /** + * Function returning a promise which returns a React component displayed on success. + * + * Resulting React component receives all the props passed to the generated component. + */ + loader(): Promise | { default: React.ComponentType }>; + } + + interface OptionsWithRender extends CommonOptions { + /** + * Function returning a promise which returns an object to be passed to `render` on success. + */ + loader(): Promise; + /** + * If you want to customize what gets rendered from your loader you can also pass `render`. + * + * Note: If you want to load multiple resources at once, you can also use `Loadable.Map`. + * + * ```ts + * Loadable({ + * // ... + * render(loaded, props) { + * const Component = loaded.default; + * return + * } + * }); + * ``` + */ + render(loaded: Exports, props: Props): React.ReactNode; + + // NOTE: render is not optional if the loader return type is not compatible with the type + // expected in `OptionsWithoutRender`. If you do not want to provide a render function, ensure that your + // function is returning a promise for a React.ComponentType or is the result of import()ing a module + // that has a component as its `default` export. + } + + interface OptionsWithMap extends CommonOptions { + /** + * An object containing functions which return promises, which resolve to an object to be passed to `render` on success. + */ + loader: { + [P in keyof Exports]: () => Promise + }; + /** + * If you want to customize what gets rendered from your loader you can also pass `render`. + * + * Note: If you want to load multiple resources at once, you can also use `Loadable.Map`. + * + * ```ts + * Loadable({ + * // ... + * render(loaded, props) { + * const Component = loaded.default; + * return + * } + * }); + * ``` + */ + render(loaded: Exports, props: Props): React.ReactNode; + } + + interface LoadableComponent { + /** + * The generated component has a static method preload() for calling the loader function ahead of time. + * This is useful for scenarios where you think the user might do something next and want to load the + * next component eagerly. + * + * Note: preload() intentionally does not return a promise. You should not be depending on the timing of + * preload(). It's meant as a performance optimization, not for creating UI logic. + */ + preload(): void; + } + + interface LoadableCaptureProps { + /** + * Function called for every moduleName that is rendered via React Loadable. + */ + report: (moduleName: string) => void; + } + + interface Loadable { + (options: Options): React.ComponentType & LoadableComponent; + Map(options: OptionsWithMap): React.ComponentType & LoadableComponent; + + /** + * This will call all of the LoadableComponent.preload methods recursively until they are all + * resolved. Allowing you to preload all of your dynamic modules in environments like the server. + * ```ts + * Loadable.preloadAll().then(() => { + * app.listen(3000, () => { + * console.log('Running on http://localhost:3000/'); + * }); + * }); + * ``` + */ + preloadAll(): Promise; + + /** + * Check for modules that are already loaded in the browser and call the matching + * `LoadableComponent.preload` methods. + * ```ts + * window.main = () => { + * Loadable.preloadReady().then(() => { + * ReactDOM.hydrate( + * , + * document.getElementById('app'), + * ); + * }); + * }; + * ``` + */ + preloadReady(): Promise; + + Capture: React.ComponentType; + } } -export type Options = OptionsWithoutRender | OptionsWithRender; +declare const LoadableExport: Loadable.Loadable; -export interface CommonOptions { - /** - * React component displayed after delay until loader() succeeds. Also responsible for displaying errors. - * - * If you don't want to render anything you can pass a function that returns null - * (this is considered a valid React component). - */ - // NOTE: () => null is only needed until React.SFC supports components returning null - loading: React.ComponentType | (() => null); - /** - * Defaults to 200, in milliseconds. - * - * Only show the loading component if the loader() has taken this long to succeed or error. - */ - delay?: number | false | null; - /** - * Disabled by default. - * - * After the specified time in milliseconds passes, the component's `timedOut` prop will be set to true. - */ - timeout?: number | false | null; - - /** - * Optional array of module paths that `Loadable.Capture`'s `report` function will be applied on during - * server-side rendering. This helps the server know which modules were imported/used during SSR. - * ```ts - * Loadable({ - * loader: () => import('./my-component'), - * modules: ['./my-component'], - * }); - * ``` - */ - modules?: string[]; - - /** - * An optional function which returns an array of Webpack module ids which you can get - * with require.resolveWeak. This is used by the client (inside `Loadable.preloadReady`) to - * guarantee each webpack module is preloaded before the first client render. - * ```ts - * Loadable({ - * loader: () => import('./Foo'), - * webpack: () => [require.resolveWeak('./Foo')], - * }); - * ``` - */ - webpack?: () => number[]; +/* tslint:disable-next-line */ +declare module "react-loadable" { + export = LoadableExport; } - -export interface OptionsWithoutRender extends CommonOptions { - /** - * Function returning a promise which returns a React component displayed on success. - * - * Resulting React component receives all the props passed to the generated component. - */ - loader(): Promise | { default: React.ComponentType }>; -} - -export interface OptionsWithRender extends CommonOptions { - /** - * Function returning a promise which returns an object to be passed to `render` on success. - */ - loader(): Promise; - /** - * If you want to customize what gets rendered from your loader you can also pass `render`. - * - * Note: If you want to load multiple resources at once, you can also use `Loadable.Map`. - * - * ```ts - * Loadable({ - * // ... - * render(loaded, props) { - * const Component = loaded.default; - * return - * } - * }); - * ``` - */ - render(loaded: Exports, props: Props): React.ReactNode; - - // NOTE: render is not optional if the loader return type is not compatible with the type - // expected in `OptionsWithoutRender`. If you do not want to provide a render function, ensure that your - // function is returning a promise for a React.ComponentType or is the result of import()ing a module - // that has a component as its `default` export. -} - -export interface OptionsWithMap extends CommonOptions { - /** - * An object containing functions which return promises, which resolve to an object to be passed to `render` on success. - */ - loader: { - [P in keyof Exports]: () => Promise - }; - /** - * If you want to customize what gets rendered from your loader you can also pass `render`. - * - * Note: If you want to load multiple resources at once, you can also use `Loadable.Map`. - * - * ```ts - * Loadable({ - * // ... - * render(loaded, props) { - * const Component = loaded.default; - * return - * } - * }); - * ``` - */ - render(loaded: Exports, props: Props): React.ReactNode; -} - -export interface LoadableComponent { - /** - * The generated component has a static method preload() for calling the loader function ahead of time. - * This is useful for scenarios where you think the user might do something next and want to load the - * next component eagerly. - * - * Note: preload() intentionally does not return a promise. You should not be depending on the timing of - * preload(). It's meant as a performance optimization, not for creating UI logic. - */ - preload(): void; -} - -export interface LoadableCaptureProps { - /** - * Function called for every moduleName that is rendered via React Loadable. - */ - report: (moduleName: string) => void; -} - -export interface Loadable { - (options: Options): React.ComponentType & LoadableComponent; - Map(options: OptionsWithMap): React.ComponentType & LoadableComponent; - - /** - * This will call all of the LoadableComponent.preload methods recursively until they are all - * resolved. Allowing you to preload all of your dynamic modules in environments like the server. - * ```ts - * Loadable.preloadAll().then(() => { - * app.listen(3000, () => { - * console.log('Running on http://localhost:3000/'); - * }); - * }); - * ``` - */ - preloadAll(): Promise; - - /** - * Check for modules that are already loaded in the browser and call the matching - * `LoadableComponent.preload` methods. - * ```ts - * window.main = () => { - * Loadable.preloadReady().then(() => { - * ReactDOM.hydrate( - * , - * document.getElementById('app'), - * ); - * }); - * }; - * ``` - */ - preloadReady(): Promise; - - Capture: React.ComponentType; -} - -declare const LoadableExport: Loadable; -export default LoadableExport; diff --git a/types/react-loadable/test/index.tsx b/types/react-loadable/test/index.tsx index ee5ec82119..5045fdf125 100644 --- a/types/react-loadable/test/index.tsx +++ b/types/react-loadable/test/index.tsx @@ -1,7 +1,7 @@ import * as React from 'react'; -import Loadable, { LoadingComponentProps } from 'react-loadable'; +import Loadable = require('react-loadable'); -class LoadingComponent extends React.Component { +class LoadingComponent extends React.Component { render() { return (
From 48203ad4df536705d6e9039779899b067c81d8f5 Mon Sep 17 00:00:00 2001 From: Yu-Hsin Lu Date: Thu, 11 Jan 2018 02:13:53 +0800 Subject: [PATCH 07/15] Add concatLimit function (#22754) --- types/async/index.d.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/types/async/index.d.ts b/types/async/index.d.ts index 604e2c0525..17fecb467b 100644 --- a/types/async/index.d.ts +++ b/types/async/index.d.ts @@ -169,6 +169,8 @@ export const allLimit: typeof everyLimit; export function concat(arr: T[] | IterableIterator, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; export function concat(arr: Dictionary, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function concatLimit(arr: T[] | IterableIterator, limit: number, iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; +export function concatLimit(arr: Dictionary, limit: number,iterator: AsyncResultIterator, callback?: AsyncResultArrayCallback): void; export const concatSeries: typeof concat; // Control Flow From 88eda35486417472016935fc299040298b04d7bb Mon Sep 17 00:00:00 2001 From: Jordi Bunster Date: Wed, 10 Jan 2018 10:14:16 -0800 Subject: [PATCH 08/15] Add sax parser info (#22792) --- types/xmldoc/index.d.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/types/xmldoc/index.d.ts b/types/xmldoc/index.d.ts index 53f21f2027..d4e9f92ec6 100644 --- a/types/xmldoc/index.d.ts +++ b/types/xmldoc/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for xmldoc 1.1 // Project: https://www.npmjs.com/package/xmldoc -// Definitions by: Xavier Stouder , Andrew Sheehan +// Definitions by: Xavier Stouder +// Andrew Sheehan +// Jordi Bunster // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped): // TypeScript Version: 2.1 export class XmlDocument extends XmlElement { @@ -18,6 +20,10 @@ export class XmlElement { children: XmlElement[]; firstChild: XmlElement; lastChild: XmlElement; + line: number; + column: number; + position: number; + startTagPosition: number; eachChild(func: (child: XmlElement, index?: number, array?: XmlElement[]) => void): void; childNamed(name: string): XmlElement; From fab066becaaeae561b79351f6245f04d3beb5331 Mon Sep 17 00:00:00 2001 From: Aayush Kapoor Date: Wed, 10 Jan 2018 23:44:56 +0530 Subject: [PATCH 09/15] speakeasy: Update definition for missing functions (#22717) * Update speakeasy.d.ts for missing functions * Update tests for speakeasy * Fix namespace export for speakeasy * Update speakeasy to remove UMD definition --- types/speakeasy/index.d.ts | 77 ++++++++++++++++++++---------- types/speakeasy/speakeasy-tests.ts | 10 +++- 2 files changed, 60 insertions(+), 27 deletions(-) diff --git a/types/speakeasy/index.d.ts b/types/speakeasy/index.d.ts index 4e281f996f..06d79ea6aa 100644 --- a/types/speakeasy/index.d.ts +++ b/types/speakeasy/index.d.ts @@ -1,8 +1,13 @@ // Type definitions for speakeasy v2.0.0 -// Project: https://github.com/markbao/speakeasy -// Definitions by: Lucas Woo , Alexander Batukhtin +// Project: https://github.com/speakeasyjs/speakeasy +// Definitions by: Lucas Woo , Alexander Batukhtin , Aayush Kapoor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +interface SharedOptions { + encoding?: string; + algorithm?: string; +} + interface Key { ascii: string; base32: string; @@ -14,11 +19,9 @@ interface Key { otpauth_url?: string; } -interface DigestOptions { +interface DigestOptions extends SharedOptions { secret: string; counter: string; - encoding?: string; - algorithm?: string; key?: string; } @@ -39,56 +42,78 @@ interface GenerateSecretOptions { symbols?: boolean; } -interface TotpOptions { +interface TotpOptions extends SharedOptions { key?: string; step?: number; time?: number; initial_time?: number; length?: number; - encoding?: string; counter?: number; epoch?: number; secret?: string; digits?: number; digest?: () => string; - algorithm?: string; } -interface HotpOptions { +interface TotpVerifyOptions extends SharedOptions { + secret: string; + token: string; + time?: number; + step?: number; + epoch?: number; + counter?: number; + digits?: number; + window?: number; +} + +interface HotpOptions extends SharedOptions { key: string; counter: number; length?: number; - encoding?: string; digits?: number; digest?: () => string; } -interface OtpauthURLOptions { +interface HotpVerifyOptions extends SharedOptions { + secret: string; + token: string; + counter: number; + digits?: number; + window?: number; +} + +interface OtpauthURLOptions extends SharedOptions { secret: string; label: string; issuer?: any; type?: string; counter?: number; - algorithm?: string; digits?: number; period?: number; - encoding?: string; } -export declare function digest(options: DigestOptions): string; +interface Hotp { + (options: HotpOptions): string; + verifyDelta: (options: HotpVerifyOptions) => boolean; + verify: (options: HotpVerifyOptions) => boolean; +} -export declare function generate_key(options: GenerateOptions): Key; +interface Totp { + (options: TotpOptions): string; + verifyDelta: (options: TotpVerifyOptions) => boolean; + verify: (options: TotpVerifyOptions) => boolean; +} -export declare function generateSecret(options: GenerateSecretOptions): Key; - -export declare function generateSecretASCII(length?: number, symbols?: boolean): string; - -export declare function otpauthURL(options: OtpauthURLOptions): string; - -export declare function hotp(options: HotpOptions): string; - -export declare function counter(options: HotpOptions): string; - -export declare function totp(options: TotpOptions): string; +export declare const hotp: Hotp; +export declare const totp: Totp; export declare function time(options: TotpOptions): string; +export declare function counter(options: HotpOptions): string; +export declare function digest(options: DigestOptions): string; +export declare function generate_key(options: GenerateOptions): Key; +export declare function generateSecret(options?: GenerateSecretOptions): Key; +export declare function generateSecretASCII( + length?: number, + symbols?: boolean +): string; +export declare function otpauthURL(options: OtpauthURLOptions): string; diff --git a/types/speakeasy/speakeasy-tests.ts b/types/speakeasy/speakeasy-tests.ts index ae1ed061da..c807e568a3 100644 --- a/types/speakeasy/speakeasy-tests.ts +++ b/types/speakeasy/speakeasy-tests.ts @@ -37,4 +37,12 @@ speakeasy.generateSecretASCII(5, true); speakeasy.otpauthURL({ secret: 'otpauthURLSecret', label: 'otpauthURLLength' -}); \ No newline at end of file +}); + +speakeasy.totp.verify({secret: "secret", token: "123456"}) + +speakeasy.totp.verifyDelta({secret: "secret", token: "123456"}) + +speakeasy.hotp.verify({secret: "secret", token: "123456", counter: 123}) + +speakeasy.hotp.verifyDelta({secret: "secret", token: "123456", counter: 123}) From c31b287b4992eb454077441cbcef53e3524cbaa8 Mon Sep 17 00:00:00 2001 From: Dancespile Date: Wed, 10 Jan 2018 19:15:23 +0100 Subject: [PATCH 10/15] fix style code error (#22799) --- types/navigo/index.d.ts | 7 ++++--- types/navigo/navigo-tests.ts | 14 +++++++++++--- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/types/navigo/index.d.ts b/types/navigo/index.d.ts index 660e44dad7..73131a9d72 100644 --- a/types/navigo/index.d.ts +++ b/types/navigo/index.d.ts @@ -2,9 +2,10 @@ // Project: https://github.com/krasimir/navigo // Definitions by: Adrian Ehrsam // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 -type Keys = string -type State = {[k in Keys]: any} +type Keys = string; +type State = {[k in Keys]: any}; type Params = State; interface NavigoHooks { @@ -46,7 +47,7 @@ declare class Navigo { resolve(currentURL?: string): boolean; link(path: string): string; - + lastRouteResolved(): {url: string, query: string}; disableIfAPINotAvailable(): void; diff --git a/types/navigo/navigo-tests.ts b/types/navigo/navigo-tests.ts index a59bf3cfab..1aeb645ce8 100644 --- a/types/navigo/navigo-tests.ts +++ b/types/navigo/navigo-tests.ts @@ -1,14 +1,22 @@ import Navigo = require("navigo"); +type Keys = string; +type State = {[k in Keys]: any}; +type Params = State; + const root = null; const useHash = false; let router = new Navigo(root, useHash); +const before = (done: (suppress?: boolean) => void, params: Params) => done(); + +const after = (params: Params) => params; + router.hooks({ - before: function(done, params) { //do something }, - after: function(params) { //do something } - }); + before, + after +}); router .on('/products/list', () => { From a63026685a63cbc87e19605bd53a17effe8259c6 Mon Sep 17 00:00:00 2001 From: Gabriel Terwesten Date: Wed, 10 Jan 2018 19:20:32 +0100 Subject: [PATCH 11/15] @types/bull add jobId to signature of removeRepeatable (#22785) --- types/bull/index.d.ts | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index bcf7fcc770..28070ad44f 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -4,6 +4,7 @@ // Cameron Crothers // Marshall Cottrell // Weeco +// Gabriel Terwesten // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -456,18 +457,18 @@ declare namespace Bull { nextRepeatableJob(name: string, data: any, opts: JobOptions): Promise; /** - * Removes a given repeatable job. The RepeatOpts needs to be the same as the ones used for - * the job when it was added. + * Removes a given repeatable job. The RepeatOptions and JobId needs to be the same as the ones + * used for the job when it was added. */ - removeRepeatable(repeat: RepeatOptions): Promise; + removeRepeatable(repeat: RepeatOptions & { jobId?: JobId }): Promise; /** - * Removes a given repeatable job. The RepeatOpts needs to be the same as the ones used for - * the job when it was added. + * Removes a given repeatable job. The RepeatOptions and JobId needs to be the same as the ones + * used for the job when it was added. * * name: The name of the to be removed job */ - removeRepeatable(name: string, repeat: RepeatOptions): Promise; + removeRepeatable(name: string, repeat: RepeatOptions & { jobId?: JobId }): Promise; /** * Returns a promise that resolves with the job counts for the given queue. From 6771a470116198a1b60b7bad0020f8ed5c0a6d08 Mon Sep 17 00:00:00 2001 From: Eric Simonton Date: Wed, 10 Jan 2018 13:21:04 -0500 Subject: [PATCH 12/15] Chain#mapObject is for objects, not arrays (#22759) --- types/underscore/index.d.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 16ce938dd8..72a2c23c33 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -5694,6 +5694,12 @@ declare module _ { **/ values(): _Chain; + /** + * Wrapped type `object`. + * @see _.mapObject + **/ + mapObject(fn: _.ListIterator): _Chain; + /** * Wrapped type `object`. * @see _.pairs @@ -6096,6 +6102,5 @@ declare module _ { } interface _ChainOfArrays extends _Chain { flatten(shallow?: boolean): _Chain; - mapObject(fn: _.ListIterator): _ChainOfArrays; } } From 4380b9f74a06d07198c5fbf3aeeb922ea0948f74 Mon Sep 17 00:00:00 2001 From: Jimmy Gaussen Date: Wed, 10 Jan 2018 19:24:03 +0100 Subject: [PATCH 13/15] @types/sequelize Reverting #22755 due to breaking changes (#22786) * @types/sequelize Added generic types for various option classes * Revert "@types/sequelize Added generic types for various option classes (#22755)" This reverts commit 38983ce --- types/sequelize/index.d.ts | 48 +++++++++++++++++++------------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index 37baa11210..2db7dcfe11 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -141,7 +141,7 @@ declare namespace sequelize { */ ( values?: TAttributes, - options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions + options?: BelongsToCreateAssociationMixinOptions | CreateOptions | BelongsToSetAssociationMixinOptions ): Promise; } @@ -255,7 +255,7 @@ declare namespace sequelize { */ ( values?: TAttributes, - options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions + options?: HasOneCreateAssociationMixinOptions | HasOneSetAssociationMixinOptions | CreateOptions ): Promise; } @@ -496,7 +496,7 @@ declare namespace sequelize { */ ( values?: TAttributes, - options?: HasManyCreateAssociationMixinOptions | CreateOptions + options?: HasManyCreateAssociationMixinOptions | CreateOptions ): Promise; } @@ -959,7 +959,7 @@ declare namespace sequelize { */ ( values?: TAttributes, - options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions | { through: TJoinTableAttributes } + options?: BelongsToManyCreateAssociationMixinOptions | CreateOptions | { through: TJoinTableAttributes } ): Promise; } @@ -1332,8 +1332,8 @@ declare namespace sequelize { */ keyType?: DataTypeAbstract; /** - * A string to represent the name of the field to use as the key for an 1 to many association in the source table. - * + * A string to represent the name of the field to use as the key for an 1 to many association in the source table. + * * @see http://docs.sequelizejs.com/class/lib/model.js~Model.html#static-method-hasMany * @see https://github.com/sequelize/sequelize/blob/b4fd46426db9cdbb97074bea121203d565e4195d/lib/associations/has-many.js#L81 */ @@ -3187,7 +3187,7 @@ declare namespace sequelize { /** * Complex include options */ - interface IncludeOptions { + interface IncludeOptions { /** * The model you want to eagerly load @@ -3214,7 +3214,7 @@ declare namespace sequelize { /** * A list of attributes to select from the child model */ - attributes?: FindOptionsAttributesArray | { include?: FindOptionsAttributesArray, exclude?: keyof TAttributes }; + attributes?: FindOptionsAttributesArray | { include?: FindOptionsAttributesArray, exclude?: Array }; /** * If true, converts to an inner join, which means that the parent model will only be loaded if it has any @@ -3230,7 +3230,7 @@ declare namespace sequelize { /** * Load further nested related models */ - include?: Array | IncludeOptions>; + include?: Array | IncludeOptions>; /** * If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will @@ -3244,14 +3244,14 @@ declare namespace sequelize { /** * Shortcut for types used in FindOptions.attributes */ - type FindOptionsAttributesArray = Array; + type FindOptionsAttributesArray = Array; /** * Options that are passed to any model creating a SELECT query * * A hash of options to describe the scope of the search */ - interface FindOptions extends LoggingOptions, SearchPathOptions { + interface FindOptions extends LoggingOptions, SearchPathOptions { /** * A hash of attributes to describe your search. See above for examples. @@ -3264,7 +3264,7 @@ declare namespace sequelize { * `Sequelize.literal`, `Sequelize.fn` and so on), and the second is the name you want the attribute to * have in the returned instance */ - attributes?: FindOptionsAttributesArray | { include?: FindOptionsAttributesArray, exclude?: Array }; + attributes?: FindOptionsAttributesArray | { include?: FindOptionsAttributesArray, exclude?: Array }; /** * If true, only non-deleted records will be returned. If false, both deleted and non-deleted records will @@ -3278,7 +3278,7 @@ declare namespace sequelize { * If your association are set up with an `as` (eg. `X.hasMany(Y, { as: 'Z }`, you need to specify Z in * the as attribute when eager loading Y). */ - include?: Array | IncludeOptions>; + include?: Array | IncludeOptions>; /** * Specifies an ordering. If a string is provided, it will be escaped. Using an array, you can provide @@ -3319,7 +3319,7 @@ declare namespace sequelize { * Group by. It is not mentioned in sequelize's JSDoc, but mentioned in docs. * https://github.com/sequelize/sequelize/blob/master/docs/docs/models-usage.md#user-content-manipulating-the-dataset-with-limit-offset-order-and-group */ - group?: keyof T | keyof T[] | Object; + group?: string | string[] | Object; /** @@ -3338,12 +3338,12 @@ declare namespace sequelize { rejectOnEmpty?: boolean; } - type AnyFindOptions = FindOptions; + type AnyFindOptions = FindOptions; /** * Options for Model.count method */ - interface CountOptions extends LoggingOptions, SearchPathOptions { + interface CountOptions extends LoggingOptions, SearchPathOptions { /** * A hash of search attributes. @@ -3353,7 +3353,7 @@ declare namespace sequelize { /** * Include options. See `find` for details */ - include?: Array | IncludeOptions>; + include?: Array | IncludeOptions>; /** * Apply COUNT(DISTINCT(col)) @@ -3376,7 +3376,7 @@ declare namespace sequelize { /** * Options for Model.build method */ - interface BuildOptions extends ReturningOptions { + interface BuildOptions extends ReturningOptions { /** * If set to true, values will ignore field and virtual setters. @@ -3393,13 +3393,13 @@ declare namespace sequelize { * * TODO: See set */ - include?: Array | IncludeOptions>; + include?: Array | IncludeOptions>; } /** * Options for Model.create method */ - interface CreateOptions extends BuildOptions, InstanceSaveOptions { + interface CreateOptions extends BuildOptions, InstanceSaveOptions { /** * On Duplicate @@ -3867,7 +3867,7 @@ declare namespace sequelize { * * If you provide an `include` option, the number of matching associations will be counted instead. */ - count(options?: CountOptions): Promise; + count(options?: CountOptions): Promise; /** * Find all the rows matching your query, within a specified offset / limit, and get the total number of @@ -3925,17 +3925,17 @@ declare namespace sequelize { /** * Builds a new model instance. Values is an object of key value pairs, must be defined but can be empty. */ - build(record?: TAttributes, options?: BuildOptions): TInstance; + build(record?: TAttributes, options?: BuildOptions): TInstance; /** * Undocumented bulkBuild */ - bulkBuild(records: TAttributes[], options?: BuildOptions): TInstance[]; + bulkBuild(records: TAttributes[], options?: BuildOptions): TInstance[]; /** * Builds a new model instance and calls save on it. */ - create(values?: TAttributes, options?: CreateOptions): Promise; + create(values?: TAttributes, options?: CreateOptions): Promise; /** * Find a row that matches the query, or build (but don't save) the row if none is found. From 2b8c88b0b6844e16e41405fdfac6d296a5c59270 Mon Sep 17 00:00:00 2001 From: Samuel Martins Date: Wed, 10 Jan 2018 16:26:18 -0200 Subject: [PATCH 14/15] Add export namespace (lime-js) (#22748) * Add export namespace * Increase version number --- types/lime-js/index.d.ts | 8 +++++++- types/lime-js/lime-js-tests.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/types/lime-js/index.d.ts b/types/lime-js/index.d.ts index 28a844e924..96b8c12ffd 100644 --- a/types/lime-js/index.d.ts +++ b/types/lime-js/index.d.ts @@ -1,8 +1,14 @@ -// Type definitions for lime-js 0.0.3 +// Type definitions for lime-js 0.0.4 // Project: https://github.com/takenet/lime-js // Definitions by: Arthur Xavier // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// Support for painless dependency injection +export as namespace Lime; + +// Support AMD require +export = Lime; + declare namespace Lime { interface Envelope { diff --git a/types/lime-js/lime-js-tests.ts b/types/lime-js/lime-js-tests.ts index c81b3db1da..21d03e3099 100644 --- a/types/lime-js/lime-js-tests.ts +++ b/types/lime-js/lime-js-tests.ts @@ -1,4 +1,4 @@ - +import * as Lime from 'lime-js'; var transport = new Lime.WebSocketTransport(true); var clientChannel = new Lime.ClientChannel(transport, true, true); From 68e71f0c21ad557bbc9dbddde5304014586151df Mon Sep 17 00:00:00 2001 From: Igor Snake Date: Wed, 10 Jan 2018 23:29:28 +0500 Subject: [PATCH 15/15] Added redux-socket.io type (#22773) * Added redux-socket.io type * Fixed bad dependency on socket.io --- types/redux-socket.io/index.d.ts | 19 +++++++++++++++ types/redux-socket.io/package.json | 6 +++++ .../redux-socket.io/redux-socket.io-tests.ts | 10 ++++++++ types/redux-socket.io/tsconfig.json | 23 +++++++++++++++++++ types/redux-socket.io/tslint.json | 3 +++ 5 files changed, 61 insertions(+) create mode 100644 types/redux-socket.io/index.d.ts create mode 100644 types/redux-socket.io/package.json create mode 100644 types/redux-socket.io/redux-socket.io-tests.ts create mode 100644 types/redux-socket.io/tsconfig.json create mode 100644 types/redux-socket.io/tslint.json diff --git a/types/redux-socket.io/index.d.ts b/types/redux-socket.io/index.d.ts new file mode 100644 index 0000000000..dfd608868b --- /dev/null +++ b/types/redux-socket.io/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for redux-socket.io 1.4 +// Project: https://github.com/itaylor/redux-socket.io#readme +// Definitions by: Igor Voropaev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Middleware, Action, Dispatch } from 'redux'; + +export interface MiddlewareOptions { + eventName?: string; + execute?: (action: Action, emitBound: SocketIOClient.Socket, next: Dispatch, dispatch: Dispatch) => any; +} + +export default function createSocketIoMiddleware( + socket: SocketIOClient.Socket, + criteria: (string | ReadonlyArray | ((type: string, action: Action) => boolean)), + options?: MiddlewareOptions +): Middleware; diff --git a/types/redux-socket.io/package.json b/types/redux-socket.io/package.json new file mode 100644 index 0000000000..6d68bf2f9b --- /dev/null +++ b/types/redux-socket.io/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "redux": "^3.6.0" + } +} diff --git a/types/redux-socket.io/redux-socket.io-tests.ts b/types/redux-socket.io/redux-socket.io-tests.ts new file mode 100644 index 0000000000..f67a86393a --- /dev/null +++ b/types/redux-socket.io/redux-socket.io-tests.ts @@ -0,0 +1,10 @@ +import * as ioclient from 'socket.io-client'; +import createSocketIoMiddleware from 'redux-socket.io'; +import { Action } from 'redux'; + +const socketio = ioclient("test"); + +const SocketIOMiddleware1 = createSocketIoMiddleware(socketio, "test"); +const SocketIOMiddleware2 = createSocketIoMiddleware(socketio, ["test1", "test2"]); +const SocketIOMiddleware3 = createSocketIoMiddleware(socketio, (type: string, action: Action) => (type === 'test')); +const SocketIOMiddleware4 = createSocketIoMiddleware(socketio, "", { eventName: "test" }); diff --git a/types/redux-socket.io/tsconfig.json b/types/redux-socket.io/tsconfig.json new file mode 100644 index 0000000000..8636bd654d --- /dev/null +++ b/types/redux-socket.io/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redux-socket.io-tests.ts" + ] +} diff --git a/types/redux-socket.io/tslint.json b/types/redux-socket.io/tslint.json new file mode 100644 index 0000000000..6746359dda --- /dev/null +++ b/types/redux-socket.io/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +}