From e670e0731cad74822fb9f7329f2f4dead346e7c5 Mon Sep 17 00:00:00 2001 From: rlindgren Date: Fri, 20 Oct 2017 12:01:00 -0400 Subject: [PATCH 01/78] Fix doWhilst, doUntil definitions and tests --- types/async/index.d.ts | 4 ++-- types/async/test/index.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/types/async/index.d.ts b/types/async/index.d.ts index 80f2888a8b..7c32079086 100644 --- a/types/async/index.d.ts +++ b/types/async/index.d.ts @@ -174,9 +174,9 @@ export function parallel(tasks: Dictionary>, callback? export function parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; export function parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; export function whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doWhilst(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; +export function doWhilst(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doUntil(fn: AsyncVoidFunction, test: () => boolean, callback: ErrorCallback): void; +export function doUntil(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; export function doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; export function forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; diff --git a/types/async/test/index.ts b/types/async/test/index.ts index 821ccd0650..3c6c2f5dfe 100644 --- a/types/async/test/index.ts +++ b/types/async/test/index.ts @@ -239,16 +239,16 @@ async.parallelLimit({ function whileFn(callback: any) { - count++; - setTimeout(callback, 1000); + setTimeout(() => callback(null, ++count), 1000); } function whileTest() { return count < 5; } +function doWhileTest(count: number) { return count < 5; } var count = 0; async.whilst(whileTest, whileFn, function (err) { }); async.until(whileTest, whileFn, function (err) { }); -async.doWhilst(whileFn, whileTest, function (err) { }); -async.doUntil(whileFn, whileTest, function (err) { }); +async.doWhilst(whileFn, doWhileTest, function (err) { }); +async.doUntil(whileFn, doWhileTest, function (err) { }); async.during(function (testCallback) { testCallback(new Error(), false); }, function (callback) { callback() }, function (error) { console.log(error) }); async.doDuring(function (callback) { callback() }, function (testCallback) { testCallback(new Error(), false); }, function (error) { console.log(error) }); From 6fb077d3e6c38d0bde5012462c22975c4da18cd9 Mon Sep 17 00:00:00 2001 From: rlindgren Date: Mon, 23 Oct 2017 10:07:19 -0400 Subject: [PATCH 02/78] iteratee should be of type AsyncFunction --- types/async/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/async/index.d.ts b/types/async/index.d.ts index 7c32079086..c94c8058c2 100644 --- a/types/async/index.d.ts +++ b/types/async/index.d.ts @@ -174,9 +174,9 @@ export function parallel(tasks: Dictionary>, callback? export function parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; export function parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; export function whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doWhilst(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; +export function doWhilst(fn: AsyncFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doUntil(fn: AsyncVoidFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; +export function doUntil(fn: AsyncFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; export function during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; export function doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; export function forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; From 25f6e77505eb95bff2ce5d7c2552e65385929982 Mon Sep 17 00:00:00 2001 From: Kewei Li Date: Tue, 24 Oct 2017 16:55:04 -0700 Subject: [PATCH 03/78] adding Service.Store namespace --- types/winrt-uwp/index.d.ts | 588 +++++++++++++++++++++++++++++++++++++ 1 file changed, 588 insertions(+) diff --git a/types/winrt-uwp/index.d.ts b/types/winrt-uwp/index.d.ts index 02490e6010..ada414474d 100644 --- a/types/winrt-uwp/index.d.ts +++ b/types/winrt-uwp/index.d.ts @@ -48901,6 +48901,594 @@ declare namespace Windows { namespace LocalSearch { } } + + /** Provides types and members you can use to access and manage Windows Store-related data for the current app. */ + namespace Store { + /** Defines values that represent the status of an request that is related to a consumable add-on. */ + enum StoreConsumableStatus { + /** The request did not succeed because the remaining balance of the consumable add-on is too low. */ + insufficentQuantity = 1, + /** The request did not succeed because of a network connectivity error. */ + networkError = 2, + /** The request did not succeed because of a server error returned by the Windows Store. */ + serverError = 3, + /** The request succeeded. */ + succeeded = 0, + } + + /** Defines values that represent the state of a package download or installation request. */ + enum StorePackageUpdateState { + /** The download or installation of the package updates was canceled. */ + canceled = 4, + /** The package updates have finished downloading or installing. */ + completed = 3, + /** The package updates are being deployed to the device. */ + deploying = 2, + /** The package updates are being downloaded. */ + downloading = 1, + /** The download or installation of the package updates did not succeed because the device does not have enough battery power. */ + errorLowBattery = 6, + /** The download did not succeed because a Wi-Fi connection is recommended to download the package updates. */ + errorWiFiRecommended = 7, + /** The download did not succeed because a Wi-Fi connection is required to download the package updates. */ + errorWiFiRequired = 8, + /** An unknown error occurred. */ + otherError = 5, + /** The download of the package updates has not started. */ + pending = 0, + } + + /** Defines values that represent the units of a trial period or billing period for a subscription. */ + enum StoreDurationUnit { + /** The period is defined in days. */ + day = 2, + /** The period is defined in hours. */ + hour = 1, + /** The period is defined in minutes. */ + minute = 0, + /** The period is defined in months. */ + month = 4, + /** The period is defined in weeks. */ + week = 3, + /** The period is defined in years. */ + year = 5, + } + + /** Defines values that represent the status of a request to purchase an app or add-on. */ + enum StorePurchaseStatus { + /** The current user has already purchased the specified app or add-on. */ + alreadyPurchased = 1, + /** The purchase request did not succeed because of a network connectivity error. */ + networkError = 3, + /** The purchase request did not succeed. */ + notPurchased = 2, + /** The purchase request did not succeed because of a server error returned by the Windows Store. */ + serverError = 4, + /** The purchase request succeeded. */ + succeeded = 0, + } + + /** Provides status info for a package that is associated with a download or installation request. */ + interface StorePackageUpdateStatus { + /** The number of bytes that have been downloaded. */ + packageBytesDownloaded: number; + /** The download (or download and install) progress of the current package, represented by a value from 0.0 to 1.0. When you use RequestDownloadStorePackageUpdatesAsync to download packages, this value increases from 0.0 to 1.0 during the download of each package. When you use RequestDownloadAndInstallStorePackageUpdatesAsync to download and install packages in a single operation, this value increases from 0.0 to 0.8 during the download of each package, and then it increases from 0.8 to 1.0 during the install phase. */ + packageDownloadProgress: number; + /** The size of the package that is being downloaded, in bytes. This is an estimate, and it might change during the download process. */ + packageDownloadSizeInBytes: number; + /** The family name of the package that is being downloaded or installed. */ + packageFamilyName: string; + /** A StorePackageUpdateState value that indicates the state of the package that is being downloaded or installed. */ + packageUpdateState: StorePackageUpdateState; + /** The current progress of all package downloads in the request, represented by a value from 0.0 to 1.0. */ + totalDownloadProgress: number; + } + + /** Provides response data for a request to acquire a downloadable content (DLC) package license. */ + abstract class StoreAcquireLicenseResult { + /** Gets the error code for the request, if the operation encountered an error. */ + extendedError: WinRTError; + /** Gets an object that represents the downloadable content (DLC) package license. */ + storePackageLicense: StorePackageLicense; + } + + /** Provides license info for the current app, including licenses for products that are offered by the app. */ + abstract class StoreAppLicense { + /** Gets the collection of licenses for add-ons that can be used offline (typically durable add-ons), for which the user has entitlements to use. This property does not include licenses for consumable add-ons. */ + addOnLicenses: Windows.Foundation.Collections.IMapView; + /** Gets the expiration date and time for the app license. */ + expirationDate: Date; + /** Gets complete license data in JSON format. */ + extendedJsonData: string; + /** Gets a value that indicates whether the license is active. */ + isActive: boolean; + /** Gets a value that indicates whether the license is a trial license. */ + isTrial: boolean; + /** Gets a value that indicates whether the current user has an entitlement for the usage-limited trial that is associated with this app license. */ + isTrialOwnedByThisUser: boolean; + /** Gets the Store ID of the licensed app SKU from the Windows Store catalog. */ + skuStoreId: string; + /** Gets the remaining time for the usage-limited trial that is associated with this app license. */ + trialTimeRemaining: number; + /** Gets a unique ID that identifies the combination of the current user and the usage-limited trial that is associated with this app license. */ + trialUniqueId: string; + } + + /** Represents a specific instance of a product SKU that can be purchased. */ + abstract class StoreAvailability { + /** Gets the end date for the current SKU availability. */ + endDate: Date; + /** Gets complete data for the current SKU availability from the Store in JSON format. */ + extendedJsonData: string; + /** Gets price info for the current SKU availability, including the base price, current price, and sale info. */ + price: StorePrice; + /** + * Requests the purchase of the current SKU availability and displays the UI that is used to complete the transaction via the Windows Store. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Requests the purchase of the current SKU availability and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase. + * @param {StorePurchaseProperties} storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Gets the Store ID of the current SKU availability from the Windows Store catalog. */ + storeId: string; + } + + /** Provides additional data for a product SKU that the user has an entitlement to use. */ + abstract class StoreCollectionData { + /** Gets the date on which the product SKU was acquired. */ + acquiredDate: Date; + /** Gets the promotion campaign ID that is associated with the product SKU. */ + campaignId: string; + /** Gets the developer offer ID that is associated with the product SKU. */ + developerOfferId: string; + /** Gets the end date of the trial for the product SKU, if the SKU is a trial version or a durable add-on that expires after a set duration. */ + endDate: Date; + /** Gets complete collection data for the product SKU in JSON format. */ + extendedJsonData: string; + /** Gets a value that indicates whether the product SKU is a trial version. */ + isTrial: boolean; + /** Gets the start date of the trial for the product SKU, if the SKU is a trial version or a durable add-on that expires after a set duration. */ + startDate: Date; + /** Gets the remaining trial time for the product SKU. */ + trialTimeRemaining: number; + } + + /** Provides response data for a request that involves a consumable add-on for the current app. */ + abstract class StoreConsumableResult { + /** Gets the remaining balance for the consumable add-on. */ + balanceRemaining: number; + /** Gets the error code for the request, if the operation encountered an error. */ + extendedError: WinRTError; + /** Gets the status of the request. */ + status: StoreConsumableStatus; + /** Gets the tracking ID that was submitted with the ReportConsumableFulfillmentAsync request. */ + trackingId: string; + } + + /** Provides members you can use to access and manage Windows Store-related data for the current app. For example, you can use members of this class to get Windows Store listing and license info for the current app, purchase the current app or products that are offered by the app, or download and install package updates for the app. */ + abstract class StoreContext { + /** + * Acquires a license for the specified downloadable content (DLC) package for the current app. + * @param optionalPackage The DLC package for which to acquire a license. + * @return An asynchronous operation that, on successful completion, returns a StoreAcquireLicenseResult object that contains the license. + */ + acquireStoreLicenseForOptionalPackageAsync(optionalPackage: Windows.ApplicationModel.Package): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets Store product details for the app or add-on that is associated with the specified package. + * @param productKinds An array of strings that specify the types of Store products that might be associated with the package. For a list of the supported string values, see the ProductKind property. + * @param package A Package that represents the package for which you want to get the corresponding Store product details. + * @return An asynchronous operation that, on successful completion, returns a StoreProductResult object. Use the Product property of this object to access a StoreProduct that contains Store product details for the specified package. + */ + findStoreProductForPackageAsync(productKinds: Windows.Foundation.Collections.IIterable, package: Windows.ApplicationModel.Package): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets the collection of packages for the current app that have updates available for download from the Windows Store, including optional packages for the app (also called downloadable content or DLC). + * @return An asynchronous operation that, on successful completion, returns a collection of StorePackageUpdate objects that represent the packages that have updates available. + */ + getAppAndOptionalStorePackageUpdatesAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets license info for the current app, including licenses for add-ons for the current app. + * @return An asynchronous operation that, on successful completion, returns a StoreAppLicense object that contains license info for the current app, including add-on licenses. + */ + getAppLicenseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets the list of products that can be purchased from within the current app. + * @param productKinds An array of strings that specify the types of products you want to get. For a list of the supported string values, see the ProductKind property. + * @return An asynchronous operation that, on successful completion, returns a StoreProductQueryResult that provides access to the associated products and relevant error info. + */ + getAssociatedStoreProductsAsync(productKinds: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets the list of products that can be purchased from within the current app. This method supports paging to return the results. + * @param productKinds An array of strings that specify the types of products you want to get. For a list of the supported string values, see the ProductKind property. + * @param maxItemsToRetrievePerPage The maximum number of products to return in each page of results. + * @return An asynchronous operation that, on successful completion, returns a StoreProductPagedQueryResult that provides access to the associated products, relevant error info, and the next page of results. + */ + getAssociatedStoreProductsWithPagingAsync(productKinds: Windows.Foundation.Collections.IIterable, maxItemsToRetrievePerPage: number): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets the remaining balance for the specified consumable add-on for the current app. + * @param productStoreId The Store ID for the add-on (as provided by the StoreId property of the StoreProduct that represents the add-on). + * @return An asynchronous operation that, on successful completion, returns a StoreConsumableResult that provides the remaining balance and other info. + */ + getConsumableBalanceRemainingAsync(productStoreId: string): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Retrieves a Windows Store collections ID key that can be used to query for product entitlements or to consume product entitlements that are owned by the current user. + * @param serviceTicket An Azure Active Directory access token that identifies the publisher of the current app. For more information about generating this token, see Manage product entitlements from a service. + * @param publisherUserId An anonymous ID that identifies the current user in the context of services that are managed by the publisher of the current app. If the publisher maintains anonymous user IDs for use in their services, they can use this parameter to correlate these user IDs with the calls they make to Windows Store services. This parameter is optional. + * @return An asynchronous operation that, on successful completion, returns the collections ID key for the current user. This key is valid for 90 days. + */ + getCustomerCollectionsIdAsync(serviceTicket: string, publisherUserId?: string): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Retrieves a Windows Store purchase ID key that can be used to grant entitlements for free products on behalf of the current user. + * @param serviceTicket An Azure Active Directory access token that identifies the publisher of the current app. For more information about generating this token, see Manage product entitlements from a service. + * @param publisherUserId An anonymous ID that identifies the current user in the context of services that are managed by the publisher of the current app. If the publisher maintains anonymous user IDs for use in their services, they can use this parameter to correlate these user IDs with the calls they make to Windows Store services. This parameter is optional. + * @return An asynchronous operation that, on successful completion, returns the purchase ID key for the current user. This key is valid for 90 days. + */ + getCustomerPurchaseIdAsync(serviceTicket: string, publisherUserId?: string): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets a StoreContext object that can be used to access and manage Windows Store-related data for the current user in the context of the current app. + * @return An object that you can use to access and manage Windows Store-related data for the current user. + */ + static getDefault(): StoreContext; + /** + * Gets a StoreContext object that can be used to access and manage Windows Store-related data for the specified user in the context of the current app. + * @param user An object that identifies the user whose Windows Store-related data you want to access and manage. + * @return An object that you can use to access and manage Windows Store-related data for the specified user. + */ + static getForUser(user: Windows.System.User): StoreContext; + /** + * Gets Windows Store listing info for the current app and provides access to a method that you can use to purchase the app for the current user. + * @return An asynchronous operation that, on successful completion, returns a StoreProductResult object that contains Windows Store listing info for the current app and any relevant error info. + */ + getStoreProductForCurrentAppAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets Windows Store listing info for the specified products that can be purchased from within the current app. + * @param productKinds An array of strings that specify the types of products for which you want to retrieve listing info. For a list of the supported string values, see the ProductKind property. + * @param storeIds An array of the Store ID strings for the products for which you want to retrieve listing info. + * @return An asynchronous operation that, on successful completion, returns a StoreProductQueryResult object that contains Windows Store listing info for the specified products and any relevant error info. + */ + getStoreProductsAsync(productKinds: Windows.Foundation.Collections.IIterable, storeIds: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets Windows Store info for the add-ons of the current app for which the user has entitlements to use. + * @param productKinds An array of strings that specify the types of add-ons for which you want to retrieve listing info. For a list of the supported string values, see the ProductKind property. + * @return An asynchronous operation that, on successful completion, returns a StoreProductQueryResult object that contains Windows Store listing info for the add-ons of the current app for which the user has entitlements to use. + */ + getUserCollectionAsync(productKinds: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Gets Windows Store info for the add-ons of the current app for which the user has entitlements to use. This method supports paging to return the results. + * @param productKinds An array of strings that specify the types of add-ons for which you want to retrieve listing info. For a list of the supported string values, see the ProductKind property. + * @param maxItemsToRetrievePerPage The maximum number of add-ons to return in each page of results. + * @return An asynchronous operation that, on successful completion, returns a StoreProductPagedQueryResult object that provides access to the Windows Store listing info for the add-ons of the current app for which the user has entitlements to use, as well as the next page of results. + */ + getUserCollectionWithPagingAsync(productKinds: Windows.Foundation.Collections.IIterable, maxItemsToRetrievePerPage: number): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Raised when the status of the app's license changes (for example, the trial period has expired or the user has purchased the full version of the app). */ + onofflinelicenseschanged: Windows.Foundation.TypedEventHandler; + /** + * Reports a consumable add-on for the current app as fulfilled in the Windows Store. + * @param productStoreId The Store ID of the consumable add-on that you want to report as fulfilled. + * @param quantity The number of units of the consumable add-on that you want to report as fulfilled. For a Store-managed consumable (that is, a consumable where Microsoft keeps track of the balance), specify the number of units that have been consumed. For a developer-managed consumable (that is, a consumable where the developer keeps track of the balance), specify 1. + * @param trackingId A developer-supplied GUID that identifies the specific transaction that the fulfillment operation is associated with for tracking purposes. For more information, see the remarks. + * @return An asynchronous operation that, on successful completion, returns a StoreConsumableResult object that contains info about the fulfillment operation, such as the remaining balance of add-on units. + */ + reportConsumableFulfillmentAsync(productStoreId: string, quantity: number, trackingId: string): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Downloads and installs the specified downloadable content (DLC) packages for the current app from the Windows Store. + * @param storeIds The product IDs of the add-on packages to install. + * @return An object that the caller can observe to track progress and completion for the operation. On successful completion, the result is a StorePackageUpdateResult object that provides info about the package updates. + */ + requestDownloadAndInstallStorePackagesAsync(storeIds: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + /** + * Downloads and installs the specified package updates for the current app from the Windows Store. + * @param storePackageUpdates The set of StorePackageUpdate objects that represent the updated packages to download and install. + * @return An object that the caller can observe to track progress and completion for the operation. On successful completion, the result is a StorePackageUpdateResult object that provides info about the package updates. + */ + requestDownloadAndInstallStorePackageUpdatesAsync(storePackageUpdates: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + /** + * Downloads the specified package updates for the current app from the Windows Store. + * @param storePackageUpdates The set of StorePackageUpdate objects that represent the updated packages to download. + * @return An object that the caller can observe to track progress and completion for the operation. On successful completion, the result is a StorePackageUpdateResult object that provides info about the package updates. + */ + requestDownloadStorePackageUpdatesAsync(storePackageUpdates: Windows.Foundation.Collections.IIterable): Windows.Foundation.IPromiseWithIAsyncOperationWithProgress; + /** + * Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Windows Store. + * @param storeId The Store ID of the app or the add-on that you want to purchase for the current user. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(storeId: string): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Requests the purchase for the specified app or add-on and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase. + * @param storeId The Store ID of the app or the add-on that you want to purchase for the current user. + * @param storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(storeId: string, storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Gets an object that provides info about the current user. */ + user: Windows.System.User; + } + + /** Represents an image that is associated with a product listing in the Windows Store. */ + abstract class StoreImage { + /** Gets the caption for the image. */ + caption: string; + /** Gets the height of the image, in pixels. */ + height: number; + /** Gets the tag for the image. */ + imagePurposeTag: string; + /** Gets the URI of the image. */ + uri: Windows.Foundation.Uri; + /** Gets the width of the image, in pixels. */ + width: number; + } + + /** Provides license info for an add-on that is associated with the current app. */ + abstract class StoreLicense { + /** Gets the expiration date and time for the add-on license. */ + expirationDate: Date; + /** Gets complete license data in JSON format. */ + extendedJsonData: string; + /** Gets in the product ID for the add-on. */ + inAppOfferToken: string; + /** Gets a value that indicates whether the add-on license is active. */ + isActive: boolean; + /** Gets the Store ID of the licensed add-on SKU from the Windows Store catalog. */ + skuStoreId: string; + } + + /** Provides license info for a downloadable content (DLC) package for the current app. */ + abstract class StorePackageLicense { + /** Closes and releases any resources used by this StorePackageLicense. */ + close(): void; + /** Gets a value that indicates whether the license is valid. */ + isValid: boolean; + /** Raised when user no longer has rights to the license on the current device (for example, the user has acquired the license on a different device). */ + onlicenselost: Windows.Foundation.TypedEventHandler; + /** Gets the downloadable content (DLC) package that is associated with the license. */ + package: Windows.ApplicationModel.Package; + /** Releases the license for the downloadable content (DLC) package. */ + releaseLicense(): void; + } + + /** Provides info about a package for the current app that has an update available for download from the Windows Store. */ + abstract class StorePackageUpdate { + /** Gets a value that indicates whether the package that has an update available for download from the Windows Store is a mandatory package, as specified by the developer in the Windows Dev Center dashboard. */ + mandatory: boolean; + /** Gets the package that has an update available for download from the Windows Store. */ + package: Windows.ApplicationModel.Package; + } + + /** Provides info about a completed package update request for the current app. */ + abstract class StorePackageUpdateResult { + /** Gets the state of the completed package update request. */ + overallState: StorePackageUpdateState; + /** Gets info about the status of each of the package updates that are associated with the completed request. */ + storePackageUpdateStatuses: Windows.Foundation.Collections.IVectorView; + } + + /** Contains pricing info for a product listing in the Windows Store. */ + abstract class StorePrice { + /** Gets the ISO 4217 currency code for the market of the current user. */ + currencyCode: string; + /** Gets the base price for the product with the appropriate formatting for the market of the current user. */ + formattedBasePrice: string; + /** Gets the purchase price for the product with the appropriate formatting for the market of the current user. */ + formattedPrice: string; + /** Gets the recurring price for the product with the appropriate formatting for the market of the current user, if recurring billing is enabled for this product. */ + formattedRecurrencePrice: string; + /** Gets a value that indicates whether the product is on sale. */ + isOnSale: boolean; + /** Gets the end date for the sale period for the product, if the product is on sale. */ + saleEndDate: Date; + } + + /** Represents a product that is available in the Windows Store. */ + abstract class StoreProduct { + /** Gets the product description from the Windows Store listing. */ + description: string; + /** Gets complete data for the product from the Store in JSON format. */ + extendedJsonData: string; + /** + * Indicates whether any SKU of this product is installed on the current device. This method is intended to be used for products that have downloadable content (DLC). + * @return An asynchronous operation that, on successful completion, returns true if a SKU of this product is installed on the current device; otherwise, false. + */ + getIsAnySkuInstalledAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Gets a value that indicates whether the product has optional downloadable content (DLC). */ + hasDigitalDownload: boolean; + /** Gets the images from the Windows Store listing for the product. */ + images: Windows.Foundation.Collections.IVectorView; + /** Gets the product ID for this product, if the current StoreProduct represents an add-on. */ + inAppOfferToken: string; + /** Gets a value that indicates whether the current user has an entitlement to use the default SKU of the product. */ + isInUserCollection: boolean; + /** Gets the keywords that are associated with the product in the Windows Dev Center dashboard. This property only applies to StoreProduct objects that represent add-ons. These strings correspond to the value of the Keywords field in the properties page for the add-on in the Windows Dev Center dashboard. */ + keywords: Windows.Foundation.Collections.IVectorView; + /** Gets the language for the data in the Windows Store listing for the product. */ + language: string; + /** Gets the URI to the Windows Store listing for the product. */ + linkUri: Windows.Foundation.Uri; + /** Gets the price for the default SKU and availability for the product. */ + price: StorePrice; + /** Gets the type of the product. These values are currently supported: Application, Game, Consumable, UnmanagedConsumable, and Durable. */ + productKind: string; + /** + * Requests the purchase of the default SKU and availability for the product and displays the UI that is used to complete the transaction via the Windows Store. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Requests the purchase of the default SKU and availability for the product and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase. + * @param storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Gets the list of available SKUs for the product. */ + skus: Windows.Foundation.Collections.IVectorView; + /** Gets the Store ID for this product. */ + storeId: string; + /** Gets the product title from the Windows Store listing. */ + title: string; + /** Gets the videos from the Windows Store listing for the product. */ + videos: Windows.Foundation.Collections.IVectorView; + } + + /** Provides response data for a paged request to retrieve details about products that can be purchased from within the current app. */ + abstract class StoreProductPagedQueryResult { + /** Gets the error code for the request, if the operation encountered an error. */ + extendedError: WinRTError; + /** + * Returns the next page of results. To determine if there are more pages of results, use the HasMoreResults property. + * @return An asynchronous operation that, on successful completion, returns a StoreProductPagedQueryResult object that provides the next page of results. + */ + getNextAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Gets a value that indicates whether there are additional pages of results. To get the next page of results, use the GetNextAsync method. */ + hasMoreResults: boolean; + /** Gets the collection of products returned by the request. */ + products: Windows.Foundation.Collections.IMapView; + } + + /** Provides response data for a request to retrieve details about products that can be purchased from within the current app. */ + abstract class StoreProductQueryResult { + /** Gets the error code for the request, if the operation encountered an error. */ + extendedError: WinRTError; + /** Gets the collection of products returned by the request. */ + products: Windows.Foundation.Collections.IMapView; + } + + /** Provides response data for a request to retrieve details about the current app. */ + abstract class StoreProductResult { + /** Gets the error code for the request, if the operation encountered an error. */ + extendedError: WinRTError; + /** Gets info about the current app. */ + product: StoreProduct; + } + + /** Contains additional details that you can pass to a purchase request for a product, including the product name to display to the user during the purchase. */ + class StorePurchaseProperties { + /** Initializes a new instance of the StorePurchaseProperties class. */ + constructor(); + /** Initializes a new instance of the StorePurchaseProperties class. This overload provides the option to specify the product name that is displayed to the user during the purchase. + * @param name The product name that is displayed to the user during the purchase. + */ + constructor(name: string); + /** Gets or sets a JSON-formatted string that contains extended data to pass with the purchase request to the Windows Store. */ + extendedJsonData: string; + /** Gets or sets the product name that is displayed to the user during the purchase. The specified name appears in the title bar of the purchase UI. */ + name: string; + } + + /** Provides response data for a request to purchase an app or product that is offered by the app. */ + abstract class StorePurchaseResult { + /** Gets the error code for the purchase request, if the operation encountered an error. */ + extendedError: WinRTError; + /** Gets the status of the purchase request. */ + status: StorePurchaseStatus; + } + + /** Provides a helper method that can be used to send requests to the Windows Store for operations that do not yet have a corresponding API available in the Windows SDK. */ + abstract class StoreRequestHelper { + /** + * Sends the specified request to the Windows Store with the provided context and parameters. + * @param context An object that specifies the user for which to perform the operation. If your app is a single-user app (that is, it runs only in the context of the user that launched the app), use the StoreContext.GetDefault method to get a StoreContext object that you can use to send a request that operates in the context of the user. If your app is a multi-user app, use the StoreContext.GetForUser method to get a StoreContext object that you can use to send a request that operates in the context of a specific user. + * @param requestKind A value that identifies the request that you want to send to the Windows Store. + * @param parametersAsJson A JSON-formatted string that contains the arguments to pass to the request. + * @return An asynchronous operation that, on successful completion, returns a StoreSendRequestResult object that provides status and error info about the request. + */ + sendRequestAsync(context: StoreContext, requestKind: number, parametersAsJson: string): Windows.Foundation.IPromiseWithIAsyncOperation; + } + + /** Provides response data for a request that is sent to the Windows Store. */ + abstract class StoreSendRequestResult { + /** Gets the error code for the request, if the operation encountered an error. */ + extendedError: WinRTError; + /** Gets the HTTP status code for the request. */ + httpStatusCode: Windows.Web.Http.HttpStatusCode; + /** Gets the response data for the request. */ + response: string; + } + + /** Provides info for a SKU of a product in the Windows Store. */ + abstract class StoreSku { + /** Gets the availabilities for the current product SKU. Each product SKU can have one or more availabilities that have different prices. */ + availabilities: Windows.Foundation.Collections.IVectorView; + /** Gets the list of Store IDs for the apps or add-ons that are bundled with this product SKU. */ + bundledSkus: Windows.Foundation.Collections.IVectorView; + /** Gets additional data for the current product SKU, if the user has an entitlement to use the SKU. */ + collectionData: StoreCollectionData; + /** Gets the custom developer data string (also called a tag) that contains custom information about the add-on that this product SKU represents. This string corresponds to the value of the Custom developer data field in the properties page for the add-on in the Windows Dev Center dashboard. */ + customDeveloperData: string; + /** Gets the product SKU description from the Windows Store listing. */ + description: string; + /** Gets complete data for the current product SKU from the Store in JSON format. */ + extendedJsonData: string; + /** + * Indicates whether this product SKU is installed on the current device. + * @return An asynchronous operation that, on successful completion, returns true if this product SKU is installed on the current device; otherwise, false. + */ + getIsInstalledAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Gets the images from the Windows Store listing for the product SKU. */ + images: Windows.Foundation.Collections.IVectorView; + /** Gets a value that indicates whether the current user has an entitlement to use the current product SKU. */ + isInUserCollection: boolean; + /** Gets a value that indicates whether the current product SKU is a subscription with recurring billing. For more information about the subscription, see the SubscriptionInfo property. */ + isSubscription: boolean; + /** Gets a value that indicates whether the current product SKU is a trial SKU. */ + isTrial: boolean; + /** Gets the language for the data in the Windows Store listing for the product SKU. */ + language: string; + /** Gets the price of the default availability for this product SKU. */ + price: StorePrice; + /** + * Requests the purchase of the product SKU and displays the UI that is used to complete the transaction via the Windows Store. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(): Windows.Foundation.IPromiseWithIAsyncOperation; + /** + * Requests the purchase of the product SKU and displays the UI that is used to complete the transaction via the Windows Store. This method provides the option to specify additional details for a specific offer within a large catalog of products that are represented by a single listing in the Windows Store, including the product name to display to the user during the purchase. + * @param storePurchaseProperties An object that specifies additional info for the purchase request, including the product name to display to the user during the purchase. + * @return An asynchronous operation that, on successful completion, returns a StorePurchaseResult object that provides status and error info about the purchase. + */ + requestPurchaseAsync(storePurchaseProperties: StorePurchaseProperties): Windows.Foundation.IPromiseWithIAsyncOperation; + /** Gets the Store ID of this product SKU. */ + storeId: string; + /** Gets subscription information for this product SKU, if this product SKU is a subscription with recurring billing. To determine whether this product SKU is a subscription, use the IsSubscription property. */ + subscriptionInfo: StoreSubscriptionInfo; + /** Gets the product SKU title from the Windows Store listing. */ + title: string; + /** Gets the videos from the Windows Store listing for the product SKU. */ + videos: Windows.Foundation.Collections.IVectorView; + } + + /** Provides subscription info for a product SKU that represents a subscription with recurring billing. */ + abstract class StoreSubscriptionInfo { + /** Gets the duration of the billing period for a subscription, in the units specified by the BillingPeriodUnit property. */ + billingPeriod: number; + /** Gets the units of the billing period for a subscription. */ + billingPeriodUnit: StoreDurationUnit; + /** Gets a value that indicates whether the subscription contains a trial period. */ + hasTrialPeriod: boolean; + /** Gets the duration of the trial period for the subscription, in the units specified by the TrialPeriodUnit property. To determine whether the subscription has a trial period, use the HasTrialPeriod property. */ + trialPeriod: number; + /** Gets the units of the trial period for the subscription. */ + trialPeriodUnit: StoreDurationUnit; + } + + /** Represents a video that is associated with a product listing in the Windows Store. */ + abstract class StoreVideo { + /** Gets the caption for the video. */ + caption: string; + /** Gets the height of the video, in pixels. */ + height: number; + /** Gets the preview image that is displayed for the video. */ + previewImage: StoreImage; + /** Gets the URI of the video. */ + uri: Windows.Foundation.Uri; + /** Gets the tag for the video. */ + videoPurposeTag: string; + /** Gets the width of the video, in pixels. */ + width: number; + } + } } /** Provides classes for managing files, folders, and application settings. */ namespace Storage { From 30ae02db23ac3c98efdcb48096a2dfb9a2081c54 Mon Sep 17 00:00:00 2001 From: segayuu Date: Thu, 26 Oct 2017 10:23:22 +0900 Subject: [PATCH 04/78] cleanup lint error: no-redundant-undefined --- types/bluebird/index.d.ts | 4 ++-- types/bluebird/tslint.json | 1 - 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/types/bluebird/index.d.ts b/types/bluebird/index.d.ts index 49bd5e3808..9046d082fb 100644 --- a/types/bluebird/index.d.ts +++ b/types/bluebird/index.d.ts @@ -55,7 +55,7 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { * Alias `.caught();` for compatibility with earlier ECMAScript version. */ catch(onReject: (error: any) => R | PromiseLike): Bluebird; - catch(onReject?: ((error: any) => U | PromiseLike) | undefined | null): Bluebird; + catch(onReject: ((error: any) => U | PromiseLike) | undefined | null): Bluebird; /** * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. @@ -195,7 +195,7 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { * Alias `.caught();` for compatibility with earlier ECMAScript version. */ caught(onReject: (error: any) => R | PromiseLike): Bluebird; - caught(onReject?: ((error: any) => U | PromiseLike) | undefined | null): Bluebird; + caught(onReject: ((error: any) => U | PromiseLike) | undefined | null): Bluebird; /** * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. diff --git a/types/bluebird/tslint.json b/types/bluebird/tslint.json index 85497e648a..fa9263f910 100644 --- a/types/bluebird/tslint.json +++ b/types/bluebird/tslint.json @@ -2,7 +2,6 @@ "extends": "dtslint/dt.json", "rules": { "max-line-length": [true, 490], - "no-redundant-undefined": false, "no-unnecessary-generics": false, "prefer-const": false } From 60f879e6e192c4fd9df5acd886511a01e7e6d70b Mon Sep 17 00:00:00 2001 From: Alan Agius Date: Thu, 26 Oct 2017 16:21:23 +0200 Subject: [PATCH 05/78] feat(chalk): remove types as these are now in the library (#20789) --- notNeededPackages.json | 6 ++ types/chalk/chalk-tests.ts | 42 ------------ types/chalk/index.d.ts | 133 ------------------------------------- types/chalk/tsconfig.json | 24 ------- 4 files changed, 6 insertions(+), 199 deletions(-) delete mode 100644 types/chalk/chalk-tests.ts delete mode 100644 types/chalk/index.d.ts delete mode 100644 types/chalk/tsconfig.json diff --git a/notNeededPackages.json b/notNeededPackages.json index 4307815cfa..498e2e1c4a 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -114,6 +114,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/camel-case", "asOfVersion": "1.2.1" }, + { + "libraryName": "chalk", + "typingsPackageName": "chalk", + "sourceRepoURL": "https://github.com/chalk/chalk", + "asOfVersion": "2.2.0" + }, { "libraryName": "change-case", "typingsPackageName": "change-case", diff --git a/types/chalk/chalk-tests.ts b/types/chalk/chalk-tests.ts deleted file mode 100644 index 20bdd9382c..0000000000 --- a/types/chalk/chalk-tests.ts +++ /dev/null @@ -1,42 +0,0 @@ -import chalk = require('chalk'); - -var str = ''; -var bool = false; -var chain: chalk.ChalkChain; - -chalk.enabled = bool; -str = chalk.stripColor(str); - -bool = chalk.supportsColor; -bool = chalk.hasColor(str); - -// style a string -console.log( chalk.blue('Hello world!') ); - -// combine styled and normal strings -console.log( chalk.blue('Hello'), 'World' + chalk.red('!') ); - -// compose multiple styles using the chainable API -console.log( chalk.blue.bgRed.bold('Hello world!') ); - -// pass in multiple arguments -console.log( chalk.blue('Hello', 'World!', 'Foo', 'bar', 'biz', 'baz') ); - -// nest styles -console.log( chalk.red('Hello', chalk.underline.bgBlue('world') + '!') ); - -// nest styles of the same type even (color, underline, background) -console.log( chalk.green('I am a green line ' + chalk.blue('with a blue substring') + ' that becomes green again!') ); - -chain = chalk.green; -chain = chain.underline; -str = chain('someString'); - -chalk.enabled = chalk.supportsColor = bool; - -var chalkObj = new chalk.constructor({enabled: false}); - -chain = chalkObj.green; -chain = chalkObj.underline; -chalkObj.enabled = true; -str = chain('foo'); diff --git a/types/chalk/index.d.ts b/types/chalk/index.d.ts deleted file mode 100644 index 3651e8077d..0000000000 --- a/types/chalk/index.d.ts +++ /dev/null @@ -1,133 +0,0 @@ -// Type definitions for chalk v0.4.0 -// Project: https://github.com/sindresorhus/chalk -// Definitions by: Diullei Gomes , Bart van der Schoor , Nico Jansen -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = Chalk; - -declare namespace Chalk { - export var enabled: boolean; - export var supportsColor: boolean; - export var styles: ChalkStyleMap; - - export function stripColor(value: string): any; - export function hasColor(str: string): boolean; - - export interface ChalkChain extends ChalkStyle { - (): boolean; - (...text: string[]): string; - } - - export interface ChalkStyleElement { - open: string; - close: string; - } - - // General - export var reset: ChalkChain; - export var bold: ChalkChain; - export var dim: ChalkChain; - export var italic: ChalkChain; - export var underline: ChalkChain; - export var inverse: ChalkChain; - export var hidden: ChalkChain; - export var strikethrough: ChalkChain; - - // Text colors - export var black: ChalkChain; - export var red: ChalkChain; - export var green: ChalkChain; - export var yellow: ChalkChain; - export var blue: ChalkChain; - export var magenta: ChalkChain; - export var cyan: ChalkChain; - export var white: ChalkChain; - export var gray: ChalkChain; - export var grey: ChalkChain; - - // Background colors - export var bgBlack: ChalkChain; - export var bgRed: ChalkChain; - export var bgGreen: ChalkChain; - export var bgYellow: ChalkChain; - export var bgBlue: ChalkChain; - export var bgMagenta: ChalkChain; - export var bgCyan: ChalkChain; - export var bgWhite: ChalkChain; - - - export interface ChalkStyle { - // General - reset: ChalkChain; - bold: ChalkChain; - dim: ChalkChain; - italic: ChalkChain; - underline: ChalkChain; - inverse: ChalkChain; - hidden: ChalkChain; - strikethrough: ChalkChain; - - // Text colors - black: ChalkChain; - red: ChalkChain; - green: ChalkChain; - yellow: ChalkChain; - blue: ChalkChain; - magenta: ChalkChain; - cyan: ChalkChain; - white: ChalkChain; - gray: ChalkChain; - grey: ChalkChain; - - // Background colors - bgBlack: ChalkChain; - bgRed: ChalkChain; - bgGreen: ChalkChain; - bgYellow: ChalkChain; - bgBlue: ChalkChain; - bgMagenta: ChalkChain; - bgCyan: ChalkChain; - bgWhite: ChalkChain; - } - - export interface ChalkStyleMap { - // General - reset: ChalkStyleElement; - bold: ChalkStyleElement; - dim: ChalkStyleElement; - italic: ChalkStyleElement; - underline: ChalkStyleElement; - inverse: ChalkStyleElement; - hidden: ChalkStyleElement; - strikethrough: ChalkStyleElement; - - // Text colors - black: ChalkStyleElement; - red: ChalkStyleElement; - green: ChalkStyleElement; - yellow: ChalkStyleElement; - blue: ChalkStyleElement; - magenta: ChalkStyleElement; - cyan: ChalkStyleElement; - white: ChalkStyleElement; - gray: ChalkStyleElement; - - // Background colors - bgBlack: ChalkStyleElement; - bgRed: ChalkStyleElement; - bgGreen: ChalkStyleElement; - bgYellow: ChalkStyleElement; - bgBlue: ChalkStyleElement; - bgMagenta: ChalkStyleElement; - bgCyan: ChalkStyleElement; - bgWhite: ChalkStyleElement; - } - - export const constructor: { - new (options: {enabled: boolean}): Chalk; - } - - export interface Chalk extends ChalkStyle { - enabled: boolean; - } -} diff --git a/types/chalk/tsconfig.json b/types/chalk/tsconfig.json deleted file mode 100644 index 13ab93883b..0000000000 --- a/types/chalk/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "chalk-tests.ts" - ] -} \ No newline at end of file From 516497967484f80588dc9e38b02c7c26601aa6d0 Mon Sep 17 00:00:00 2001 From: Nazim Hajidin Date: Thu, 26 Oct 2017 10:38:49 -0400 Subject: [PATCH 06/78] Update klaw to v2.1.0 (#20781) --- types/klaw/index.d.ts | 3 ++- types/klaw/v1/index.d.ts | 44 +++++++++++++++++++++++++++++++++++++ types/klaw/v1/klaw-tests.ts | 43 ++++++++++++++++++++++++++++++++++++ types/klaw/v1/tsconfig.json | 28 +++++++++++++++++++++++ 4 files changed, 117 insertions(+), 1 deletion(-) create mode 100644 types/klaw/v1/index.d.ts create mode 100644 types/klaw/v1/klaw-tests.ts create mode 100644 types/klaw/v1/tsconfig.json diff --git a/types/klaw/index.d.ts b/types/klaw/index.d.ts index cbe78af067..8134b728c0 100644 --- a/types/klaw/index.d.ts +++ b/types/klaw/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for klaw v1.3.0 +// Type definitions for klaw v2.1.0 // Project: https://github.com/jprichardson/node-klaw // Definitions by: Matthew McEachen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -25,6 +25,7 @@ declare module "klaw" { pathSorter?: (pathA: string, pathB: string) => number fs?: any // fs or mock-fs filter?: (path: string) => boolean + depthLimit?: number } type Event = "close" | "data" | "end" | "readable" | "error" diff --git a/types/klaw/v1/index.d.ts b/types/klaw/v1/index.d.ts new file mode 100644 index 0000000000..cbe78af067 --- /dev/null +++ b/types/klaw/v1/index.d.ts @@ -0,0 +1,44 @@ +// Type definitions for klaw v1.3.0 +// Project: https://github.com/jprichardson/node-klaw +// Definitions by: Matthew McEachen +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare module "klaw" { + + import * as fs from "fs" + import { Readable, ReadableOptions } from 'stream' + + function K(root: string, options?: K.Options): K.Walker + + namespace K { + interface Item { + path: string + stats: fs.Stats + } + + type QueueMethod = "shift" | "pop" + + interface Options extends ReadableOptions { + queueMethod?: QueueMethod + pathSorter?: (pathA: string, pathB: string) => number + fs?: any // fs or mock-fs + filter?: (path: string) => boolean + } + + type Event = "close" | "data" | "end" | "readable" | "error" + + interface Walker { + on(event: Event, listener: Function): this + on(event: "close", listener: () => void): this + on(event: "data", listener: (item: Item) => void): this + on(event: "end", listener: () => void): this + on(event: "readable", listener: () => void): this + on(event: "error", listener: (err: Error) => void): this + read(): Item + } + } + + export = K +} diff --git a/types/klaw/v1/klaw-tests.ts b/types/klaw/v1/klaw-tests.ts new file mode 100644 index 0000000000..2487aafd85 --- /dev/null +++ b/types/klaw/v1/klaw-tests.ts @@ -0,0 +1,43 @@ +import * as klaw from "klaw"; +const path = require('path'); + +// README.md: Streams 1 (push) example: + +let items: klaw.Item[] = [] // files, directories, symlinks, etc + +klaw('/some/dir') + .on('data', function(item: klaw.Item) { + items.push(item) + }) + .on('end', function() { + console.dir(items) // => [ ... array of files] + }) + +// README.md: Streams 2 & 3 (pull) with error handling + +klaw('/some/dir') + .on('readable', function() { + let item: klaw.Item; + while (item = this.read()) { + items.push(item) + } + }) + .on('error', function(err: Error, item: klaw.Item) { + console.log(err.message) + console.log(item.path) // the file the error occurred on + }) + .on('end', function() { + console.log(items) // => [ ... array of files] + }) + +// README.md: Example (ignore hidden directories): + +var filterFunc = function(item: string): boolean { + var basename = path.basename(item); + return basename === '.' || basename[0] !== '.' +} + +klaw('/some/dir', { filter: filterFunc }) + .on('data', function(item: klaw.Item) { + // only items of none hidden folders will reach here + }) diff --git a/types/klaw/v1/tsconfig.json b/types/klaw/v1/tsconfig.json new file mode 100644 index 0000000000..35caa3f9ea --- /dev/null +++ b/types/klaw/v1/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "paths": { + "klaw": [ + "klaw/v1" + ] + }, + "noImplicitAny": true, + "noImplicitThis": false, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "klaw-tests.ts" + ] +} \ No newline at end of file From 04f08a9952284638f5c699aebbfc695f8dd5fb4e Mon Sep 17 00:00:00 2001 From: Isaac Wolkerstorfer Date: Thu, 26 Oct 2017 16:45:17 +0200 Subject: [PATCH 07/78] Add typedefs for grasp (graspjs.com) (#21007) * Add typedefs for grasp (graspjs.com) * Add package.json to specify dependencies * Incorporate PR feedback --- types/grasp/grasp-tests.ts | 50 ++++++++++++++++++++++++++ types/grasp/index.d.ts | 72 ++++++++++++++++++++++++++++++++++++++ types/grasp/tsconfig.json | 16 +++++++++ types/grasp/tslint.json | 1 + 4 files changed, 139 insertions(+) create mode 100644 types/grasp/grasp-tests.ts create mode 100644 types/grasp/index.d.ts create mode 100644 types/grasp/tsconfig.json create mode 100644 types/grasp/tslint.json diff --git a/types/grasp/grasp-tests.ts b/types/grasp/grasp-tests.ts new file mode 100644 index 0000000000..647f57d8fd --- /dev/null +++ b/types/grasp/grasp-tests.ts @@ -0,0 +1,50 @@ +import fs = require("fs"); +import * as grasp from "grasp"; + +grasp(); // $ExpectError +grasp({ args: [] }); // $ExpectType void + +// $ExpectType void +grasp({ + args: [], + error: console.error, + callback: console.log, + exit: process.exit, + console, + stdin: process.stdin, + fs, + input: "foo bar" +}); + +// $ExpectError +grasp({ + args: [], + textFormat: { cyan: "cyan" } +}); + +// $ExpectType string +grasp.VERSION; + +const fooquery = grasp.search("fooquery"); // $ExpectError +const equery = grasp.search("equery"); +const squery = grasp.search("squery"); + +// $ExpectType Node[] +grasp.search("equery", "pattern", "input"); + +// $ExpectType Node[] +equery("pattern")("input"); + +// $ExpectType (input: string) => Node[] +squery("pattern"); + +const replacer = grasp.replace("equery", "pattern"); + +// $ExpectType string +replacer("replacement", "input"); + +// $ExpectType string +replacer((getRaw, node, query, named) => { + getRaw(node); // $ExpectType string + return "foo"; +}, "input"); diff --git a/types/grasp/index.d.ts b/types/grasp/index.d.ts new file mode 100644 index 0000000000..bafaac5fdb --- /dev/null +++ b/types/grasp/index.d.ts @@ -0,0 +1,72 @@ +// Type definitions for grasp 0.6 +// Project: http://graspjs.com +// Definitions by: Isaac Wolkerstorfer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +import * as fs from "fs"; +import * as cliColor from "cli-color"; +// Though Grasp does not use esprima, the parser it uses (flow-parser) has a compatible Node type and existing typedefs +import { Node } from "estree"; + +export = grasp; + +declare function grasp(options: { + args: string[] | Record | string; + error?: (message: string) => void; + callback?: (result: string) => void; + exit?: (code: number) => void; + input?: string; + + // The following are "overrides" for defaults, such as console, cli-color, + // process.stdin, or fs. In most cases grasp only makes use of a small + // surface area of the types, but I think if someone really wants to pass a + // fake fs that only implements the subset of methods they think grasp uses, + // it should be up to them to use a cast rather than the typedef to be + // overly lenient. We never know if grasp might change their internal use of + // fs, after all. + fs?: typeof fs; + console?: typeof console; + textFormat?: typeof cliColor; + stdin?: typeof process.stdin; +}): void; + +declare namespace grasp { + const VERSION: string; + + // Both the search and replace functions are curryable, which leads to quite + // a bit of noise. Using generic currying will discard variable name + // information, so we hand-roll it here + + function search(engine: QueryEngineType, selector: string, input: string): Node[]; + function search(engine: QueryEngineType, selector: string): (input: string) => Node[]; + function search(engine: QueryEngineType): GraspSearchWithQueryEngine; + + function replace(engine: QueryEngineType, selector: string, replacement: Replacement, input: string): string; + function replace(engine: QueryEngineType, selector: string, replacement: Replacement): (input: string) => string; + function replace(engine: QueryEngineType, selector: string): GraspReplaceWithSelector; + function replace(engine: QueryEngineType): GraspReplaceWithQueryEngine; + + type QueryEngineType = "squery" | "equery"; + + type Replacement = + | string + | (( + getRaw: (node: Node) => string, + node: Node, + query: (q: string) => Node[], + named: { [key: string]: string | Node } + ) => string); + + type GraspSearchWithQueryEngine = ((selector: string, input: string) => Node[]) & + ((selector: string) => (input: string) => Node[]); + + type GraspReplaceWithQueryEngine = ((selector: string) => GraspReplaceWithSelector) & + ((selector: string, replacement: Replacement) => (input: string) => string) & + ((selector: string, replacement: Replacement, input: string) => string); + + type GraspReplaceWithSelector = ((replacement: Replacement) => (input: string) => string) & + ((replacement: Replacement, input: string) => string); +} diff --git a/types/grasp/tsconfig.json b/types/grasp/tsconfig.json new file mode 100644 index 0000000000..e0996e4408 --- /dev/null +++ b/types/grasp/tsconfig.json @@ -0,0 +1,16 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": ["index.d.ts", "grasp-tests.ts"] +} diff --git a/types/grasp/tslint.json b/types/grasp/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/grasp/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 02c987c7daf57076435cf681a4a7e5d8632bc35b Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 26 Oct 2017 07:45:50 -0700 Subject: [PATCH 08/78] vis: Fix lint (#20974) --- types/vis/index.d.ts | 434 ++++++++----------------------------------- 1 file changed, 75 insertions(+), 359 deletions(-) diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index dbb1d68647..ccf74b2567 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -295,8 +295,6 @@ export interface TimelineEventPropertiesResult { /** * Options that can be passed to a DataSet. - * - * @interface DataSetOptions */ export interface DataSetOptions extends DataSetQueueOptions { /** @@ -304,9 +302,6 @@ export interface DataSetOptions extends DataSetQueueOptions { * When data is fetched from a server which uses some specific field to identify items, * this field name can be specified in the DataSet using the option fieldId. * For example CouchDB uses the field "_id" to identify documents. - * - * @type {string} - * @memberOf DataSetOptions */ fieldId?: string; @@ -317,9 +312,6 @@ export interface DataSetOptions extends DataSetQueueOptions { * This is useful for example to automatically convert stringified dates coming * from a server into JavaScript Date objects. * The available data types are listed in section Data Types. - * - * @type {*} - * @memberOf DataSetOptions */ type?: any; } @@ -335,9 +327,6 @@ export interface DataSetQueueOptions { * Default value is null. * max: number - When the queue exceeds the given maximum number of entries, the queue is flushed automatically. Default value is Infinity. * Default value is Infinity. - * - * @type {(any | boolean)} - * @memberOf DataSetOptions */ queue?: any | boolean; } @@ -346,27 +335,20 @@ export class DataSet { /** * Creates an instance of DataSet. * - * @param {DataSetOptions} [options] DataSet options. - * - * @memberOf DataSet + * @param [options] DataSet options. */ constructor(options: DataSetOptions); /** * Creates an instance of DataSet. * - * @param {T[]} [data] An Array with items. - * @param {DataSetOptions} [options] DataSet options. - * - * @memberOf DataSet + * @param [data] An Array with items. + * @param [options] DataSet options. */ constructor(data?: T[], options?: DataSetOptions); /** * The number of items in the DataSet. - * - * @type {number} - * @memberOf DataSet */ length: number; @@ -374,21 +356,17 @@ export class DataSet { * Add one or multiple items to the DataSet. * Adding an item will fail when there already is an item with the same id. * - * @param {(T | T[])} data data can be a single item or an array with items. - * @param {IdType} [senderId] Optional sender id. - * @returns {IdType[]} The function returns an array with the ids of the added items. - * - * @memberOf DataSet + * @param data data can be a single item or an array with items. + * @param [senderId] Optional sender id. + * @returns The function returns an array with the ids of the added items. */ add(data: T | T[], senderId?: IdType): IdType[]; /** * Clear all data from the DataSet. * - * @param {IdType} [senderId] Optional sender id. - * @returns {IdType[]} The function returns an array with the ids of the removed items. - * - * @memberOf DataSet + * @param [senderId] Optional sender id. + * @returns The function returns an array with the ids of the removed items. */ clear(senderId?: IdType): IdType[]; @@ -396,63 +374,50 @@ export class DataSet { * Find all distinct values of a specified field. * If data items do not contain the specified field are ignored. * - * @param {string} field The search term. - * @returns {any[]} Returns an unordered array containing all distinct values. - * - * @memberOf DataSet + * @param field The search term. + * @returns Returns an unordered array containing all distinct values. */ distinct(field: string): any[]; /** * Flush queued changes. * Only available when the DataSet is configured with the option queue. - * - * @memberOf DataSet */ flush(): void; /** * Execute a callback function for every item in the dataset. * - * @param {(item: T, id: IdType) => void} callback The item callback. - * @param {DataSelectionOptions} [options] Optional options - * - * @memberOf DataSet + * @param callback The item callback. + * @param [options] Optional options */ forEach(callback: (item: T, id: IdType) => void, options?: DataSelectionOptions): void; /** * Get all items from the DataSet. * - * @param {DataSelectionOptions} [options] Optional options. - * @returns {T[]} When no item is found, null is returned when a single item was requested, + * @param [options] Optional options. + * @returns When no item is found, null is returned when a single item was requested, * and and empty Array is returned in case of multiple id's. - * - * @memberOf DataSet */ get(options?: DataSelectionOptions): T[]; /** * Get a single item from the DataSet. * - * @param {IdType} id The item id. - * @param {DataSelectionOptions} [options] - * @returns {T} When no item is found, null is returned when a single item was requested, + * @param id The item id. + * @returns When no item is found, null is returned when a single item was requested, * and and empty Array is returned in case of multiple id's. - * - * @memberOf DataSet */ get(id: IdType, options?: DataSelectionOptions): T; /** * Get multiple items from the DataSet. * - * @param {IdType[]} ids Array of item ids. - * @param {DataSelectionOptions} [options] Optional options. - * @returns {T[]} When no item is found, null is returned when a single item was requested, + * @param ids Array of item ids. + * @param [options] Optional options. + * @returns When no item is found, null is returned when a single item was requested, * and and empty Array is returned in case of multiple id's. - * - * @memberOf DataSet */ get(ids: IdType[], options?: DataSelectionOptions): T[]; @@ -461,92 +426,69 @@ export class DataSet { * In case of a DataView, this function does not return the DataSet * to which the DataView is connected. * - * @returns {DataSet} The DataSet itself. - * - * @memberOf DataSet + * @returns The DataSet itself. */ getDataSet(): DataSet; /** * Get ids of all items or of a filtered set of items. * - * @param {DataSelectionOptions} [options] - * @returns {IdType[]} ids of all items or of a filtered set of items. - * - * @memberOf DataSet + * @returns ids of all items or of a filtered set of items. */ getIds(options?: DataSelectionOptions): IdType[]; /** * Map every item in the DataSet. * - * @param {(item: T, id: IdType) => T} callback The mapping callback. - * @param {DataSelectionOptions} [options] Optional options. - * @returns {T[]} The mapped items. - * - * @memberOf DataSet + * @param callback The mapping callback. + * @param [options] Optional options. + * @returns The mapped items. */ map(callback: (item: T, id: IdType) => any, options?: DataSelectionOptions): any[]; /** * Find the item with maximum value of specified field. * - * @param {string} field - * @returns {T} Returns null if no item is found. - * - * @memberOf DataSet + * @returns Returns null if no item is found. */ max(field: string): T; /** * Find the item with minimum value of specified field. * - * @param {string} field - * @returns {T} Returns null if no item is found. - * - * @memberOf DataSet + * @returns Returns null if no item is found. */ min(field: string): T; /** * Subscribe from an event. * - * @param {string} event The event name. - * @param {((event: string, properties: any, senderId: IdType) => void)} callback + * @param event The event name. + * @param callback * a callback function which will be called each time the event occurs. - * - * @memberOf DataSet */ on(event: string, callback: (event: string, properties: any, senderId: IdType) => void): void; /** * Unsubscribe to an event. * - * @param {string} event The event name. - * @param {((event: string, properties: any, senderId: IdType) => void)} callback + * @param event The event name. + * @param callback * The exact same callback that was used when calling 'on'. - * - * @memberOf DataSet */ off(event: string, callback: (event: string, properties: any, senderId: IdType) => void): void; /** * Remove one or more items by id. * - * @param {IdType} id The item id. - * @param {IdType} [senderId] The sender id. - * @returns {IdType[]} Returns an array with the ids of the removed items. - * - * @memberOf DataSet + * @param id The item id. + * @param [senderId] The sender id. + * @returns Returns an array with the ids of the removed items. */ remove(id: IdType | IdType[], senderId?: IdType): IdType[]; /** * Set options for the DataSet. - * - * @param {DataSetQueueOptions} [options] - * - * @memberOf DataSet */ setOptions(options?: DataSetQueueOptions): void; @@ -554,11 +496,8 @@ export class DataSet { * Update one or multiple existing items. * When an item doesn't exist, it will be created. * - * @param {(T | T[])} data a single item or an array with items. - * @param {IdType} [senderId] - * @returns {IdType[]} Returns an array with the ids of the updated items. - * - * @memberOf DataSet + * @param data a single item or an array with items. + * @returns Returns an array with the ids of the updated items. */ update(data: T | T[], senderId?: IdType): IdType[]; } @@ -567,8 +506,6 @@ export class DataSet { * The DataSet contains functionality to format, filter, and sort data retrieved * via the methods get, getIds, forEach, and map. * These methods can have these options as a parameter. - * - * @interface DataSelectionOptions */ export interface DataSelectionOptions { /** @@ -577,9 +514,6 @@ export interface DataSelectionOptions { * By default, all properties of the items are emitted. * When fields is defined, only the properties whose name is specified * in fields will be included in the returned items. - * - * @type {(string[] | any)} - * @memberOf DataSelectionOptions */ fields?: string[] | any; @@ -589,9 +523,6 @@ export interface DataSelectionOptions { * When a field type is specified, this field in the items will be converted to the specified type. * This can be used for example to convert ISO strings containing a date to a JavaScript Date object, * or convert strings to numbers or vice versa. The available data types are listed in section Data Types. - * - * @type {*} - * @memberOf DataSelectionOptions */ type?: any; @@ -602,16 +533,11 @@ export interface DataSelectionOptions { * The function must return a boolean. * All items for which the filter function returns true will be emitted. * See section Data Filtering. - * - * @memberOf DataSelectionOptions */ filter?(item: T): boolean; /** * Order the items by a field name or custom sort function. - * - * @type {(string | any)} - * @memberOf DataSelectionOptions */ order?: string | any; @@ -620,9 +546,6 @@ export interface DataSelectionOptions { * Allowed values are 'Array' | 'Object'. * The default returnType is an Array. * The Object type will return a JSON object with the ID's as keys. - * - * @type {string} - * @memberOf DataSelectionOptions */ returnType?: string; } @@ -920,27 +843,19 @@ export type NetworkEvents = * The visualization is easy to use and supports custom shapes, styles, colors, sizes, images, and more. * The network visualization works smooth on any modern browser for up to a few thousand nodes and edges. * To handle a larger amount of nodes, Network has clustering support. Network uses HTML canvas for rendering. - * - * @export - * @class Network - * @implements {INetwork} */ export class Network { /** * Creates an instance of Network. * - * @param {HTMLElement} container the HTML element representing the network container - * @param {IData} data network data - * @param {IOptions} [options] optional network options - * - * @memberOf Network + * @param container the HTML element representing the network container + * @param data network data + * @param [options] optional network options */ constructor(container: HTMLElement, data: Data, options?: Options); /** * Remove the network from the DOM and remove all Hammer bindings and references. - * - * @memberOf Network */ destroy(): void; @@ -950,9 +865,7 @@ export class Network { * the network will stabilize again. * This method is also performed when first initializing the network. * - * @param {IData} data network data - * - * @memberOf Network + * @param data network data */ setData(data: Data): void; @@ -961,9 +874,7 @@ export class Network { * All available options can be found in the modules above. * Each module requires it's own container with the module name to contain its options. * - * @param {IOptions} options network options - * - * @memberOf Network + * @param options network options */ setOptions(options: Options): void; @@ -971,10 +882,8 @@ export class Network { * Set an event listener. * Depending on the type of event you get different parameters for the callback function. * - * @param {string} eventName the name of the event, f.e. 'click' - * @param {(params?: any) => void} callback the callback function that will be raised - * - * @memberOf Network + * @param eventName the name of the event, f.e. 'click' + * @param callback the callback function that will be raised */ on(eventName: NetworkEvents, callback: (params?: any) => void): void; @@ -983,10 +892,8 @@ export class Network { * The function you supply has to be the exact same as the one you used in the on function. * If no function is supplied, all listeners will be removed. * - * @param {string} eventName the name of the event, f.e. 'click' - * @param {(params?: any) => void} [callback] the exact same callback function that was used when calling 'on' - * - * @memberOf Network + * @param eventName the name of the event, f.e. 'click' + * @param [callback] the exact same callback function that was used when calling 'on' */ off(eventName: NetworkEvents, callback?: (params?: any) => void): void; @@ -995,10 +902,8 @@ export class Network { * After it has taken place, the event listener will be removed. * Depending on the type of event you get different parameters for the callback function. * - * @param {string} eventName the name of the event, f.e. 'click' - * @param {(params?: any) => void} callback the callback function that will be raised once - * - * @memberOf Network + * @param eventName the name of the event, f.e. 'click' + * @param callback the callback function that will be raised once */ once(eventName: NetworkEvents, callback: (params?: any) => void): void; @@ -1007,10 +912,8 @@ export class Network { * Input and output are in the form of {x:Number, y:Number} (IPosition interface). * The DOM values are relative to the network container. * - * @param {IPosition} position the canvas coordinates - * @returns {IPosition} the DOM coordinates - * - * @memberOf Network + * @param position the canvas coordinates + * @returns the DOM coordinates */ canvasToDOM(position: Position): Position; @@ -1019,17 +922,13 @@ export class Network { * Input and output are in the form of {x:Number,y:Number} (IPosition interface). * The DOM values are relative to the network container. * - * @param {IPosition} position the DOM coordinates - * @returns {IPosition} the canvas coordinates - * - * @memberOf Network + * @param position the DOM coordinates + * @returns the canvas coordinates */ DOMtoCanvas(position: Position): Position; /** * Redraw the network. - * - * @memberOf Network */ redraw(): void; @@ -1037,19 +936,13 @@ export class Network { * Set the size of the canvas. * This is automatically done on a window resize. * - * @param {string} width width in a common format, f.e. '100px' - * @param {string} height height in a common format, f.e. '100px' - * - * @memberOf Network + * @param width width in a common format, f.e. '100px' + * @param height height in a common format, f.e. '100px' */ setSize(width: string, height: string): void; /** * The joinCondition function is presented with all nodes. - * - * @param {IClusterOptions} [options] - * - * @memberOf Network */ cluster(options?: ClusterOptions): void; @@ -1059,10 +952,8 @@ export class Network { * All options of this object are explained below. * The joinCondition is only presented with the connected nodes. * - * @param {string} nodeId the id of the node - * @param {IClusterOptions} [options] the cluster options - * - * @memberOf Network + * @param nodeId the id of the node + * @param [options] the cluster options */ clusterByConnection(nodeId: string, options?: ClusterOptions): void; @@ -1074,19 +965,15 @@ export class Network { * For all qualifying nodes, clusterByConnection is performed on each of them. * The options object is described for clusterByConnection and does the same here. * - * @param {number} [hubsize] optional hubsize - * @param {IClusterOptions} [options] optional cluster options - * - * @memberOf Network + * @param [hubsize] optional hubsize + * @param [options] optional cluster options */ clusterByHubsize(hubsize?: number, options?: ClusterOptions): void; /** * This method will cluster all nodes with 1 edge with their respective connected node. * - * @param {IClusterOptions} [options] optional cluster options - * - * @memberOf Network + * @param [options] optional cluster options */ clusterOutliers(options?: ClusterOptions): void; @@ -1101,10 +988,8 @@ export class Network { * * network.clustering.findNode('fred') will return ['A','B','C','fred']. * - * @param {IdType} nodeId the node id. - * @returns {IdType[]} an array of nodeIds showing where the node is - * - * @memberOf Network + * @param nodeId the node id. + * @returns an array of nodeIds showing where the node is */ findNode(nodeId: IdType): IdType[]; @@ -1112,8 +997,8 @@ export class Network { * Similar to findNode in that it returns all the edge ids that were * created from the provided edge during clustering. * - * @param {IdType} baseEdgeId the base edge id - * @returns {IdType[]} an array of edgeIds + * @param baseEdgeId the base edge id + * @returns an array of edgeIds */ getClusteredEdges(baseEdgeId: IdType): IdType[]; @@ -1122,9 +1007,6 @@ export class Network { * baseEdgeId provided in data.edges ie. * After clustering the 'SelectEdge' event is fired but provides only the clustered edge. * This method can then be used to return the baseEdgeId. - * - * @param {IdType} clusteredEdgeId - * @returns {IdType} */ getBaseEdge(clusteredEdgeId: IdType): IdType; @@ -1134,9 +1016,6 @@ export class Network { * the edges between clusters are created and the previous edges are hidden, * until the cluster is opened. This method takes an edgeId (ie. a base edgeId from data.edges) * and applys the options to it and any edges that were created from it while clustering. - * - * @param {IdType} startEdgeId - * @param {IEdgeOptions} [options] */ updateEdge(startEdgeId: IdType, options?: EdgeOptions): void; @@ -1149,10 +1028,7 @@ export class Network { /** * Returns true if the node whose ID has been supplied is a cluster. * - * @param {IdType} nodeId the node id. - * @returns {boolean} - * - * @memberOf Network + * @param nodeId the node id. */ isCluster(nodeId: IdType): boolean; @@ -1160,10 +1036,7 @@ export class Network { * Returns an array of all nodeIds of the nodes that * would be released if you open the cluster. * - * @param {IdType} clusterNodeId the id of the cluster node - * @returns {IdType[]} - * - * @memberOf Network + * @param clusterNodeId the id of the cluster node */ getNodesInCluster(clusterNodeId: IdType): IdType[]; @@ -1174,10 +1047,8 @@ export class Network { * releaseFunction, which is a function that can be used to manually * position the nodes after the cluster is opened. * - * @param {IdType} nodeId the node id - * @param {IOpenClusterOptions} [options] optional open cluster options - * - * @memberOf Network + * @param nodeId the node id + * @param [options] optional open cluster options */ openCluster(nodeId: IdType, options?: OpenClusterOptions): void; @@ -1186,25 +1057,19 @@ export class Network { * and would like it to start in the same way next time, * ask for the seed using this method and put it in the layout.randomSeed option. * - * @returns {number} the current seed of the network. - * - * @memberOf Network + * @returns the current seed of the network. */ getSeed(): number; /** * Programatically enable the edit mode. * Similar effect to pressing the edit button. - * - * @memberOf Network */ enableEditMode(): void; /** * Programatically disable the edit mode. * Similar effect to pressing the close icon (small cross in the corner of the toolbar). - * - * @memberOf Network */ disableEditMode(): void; @@ -1213,40 +1078,30 @@ export class Network { * To get out of this mode, call disableEditMode(). * The callback functions defined in handlerFunctions still apply. * To use these methods without having the manipulation GUI, make sure you set enabled to false. - * - * @memberOf Network */ addNodeMode(): void; /** * Edit the selected node. * The explaination from addNodeMode applies here as well. - * - * @memberOf Network */ editNode(): void; /** * Go into addEdge mode. * The explaination from addNodeMode applies here as well. - * - * @memberOf Network */ addEdgeMode(): void; /** * Go into editEdge mode. * The explaination from addNodeMode applies here as well. - * - * @memberOf Network */ editEdgeMode(): void; /** * Delete selected. * Having edit mode or manipulation enabled is not required. - * - * @memberOf Network */ deleteSelected(): void; @@ -1256,11 +1111,6 @@ export class Network { * Alternative inputs are a String containing a nodeId or nothing. * When a String is supplied, the position of the node corresponding to the ID is returned. * When nothing is supplied, the positions of all nodes are returned. - * - * @param {string[]} nodeIds - * @returns {{[nodeId: IdType]: IPosition}} - * - * @memberOf Network */ getPositions(nodeIds?: IdType[]): { [nodeId: string]: Position }; getPositions(nodeId: IdType): Position; @@ -1278,8 +1128,6 @@ export class Network { * This method does not support clustering. * At the moment it is not possible to cache positions when using clusters since * they cannot be correctly initialized from just the positions. - * - * @memberOf Network */ storePositions(): void; @@ -1287,21 +1135,15 @@ export class Network { * You can use this to programatically move a node. * The supplied x and y positions have to be in canvas space! * - * @param {IdType} nodeId the node that will be moved - * @param {number} x new canvas space x position - * @param {number} y new canvas space y position - * - * @memberOf Network + * @param nodeId the node that will be moved + * @param x new canvas space x position + * @param y new canvas space y position */ moveNode(nodeId: IdType, x: number, y: number): void; /** * Returns a bounding box for the node including label. * - * @param {IdType} nodeId - * @returns {IBoundingBox} - * - * @memberOf Network */ getBoundingBox(nodeId: IdType): BoundingBox; @@ -1310,20 +1152,14 @@ export class Network { * If you supply an edgeId, vis will first match the id to nodes. * If no match is found, it will search in the edgelist and return an array: [fromId, toId]. * - * @param {IdType} nodeOrEdgeId a node or edge id - * @returns {(IdType[] | {fromId: IdType, toId: IdType}[])} - * - * @memberOf Network + * @param nodeOrEdgeId a node or edge id */ getConnectedNodes(nodeOrEdgeId: IdType): IdType[] | Array<{ fromId: IdType, toId: IdType }>; /** * Returns an array of edgeIds of the edges connected to this node. * - * @param {IdType} nodeId the node id - * @returns {IdType[]} - * - * @memberOf Network + * @param nodeId the node id */ getConnectedEdges(nodeId: IdType): IdType[]; @@ -1331,8 +1167,6 @@ export class Network { * Start the physics simulation. * This is normally done whenever needed and is only really useful * if you stop the simulation yourself and wish to continue it afterwards. - * - * @memberOf Network */ startSimulation(): void; @@ -1340,8 +1174,6 @@ export class Network { * This stops the physics simulation and triggers a stabilized event. * Tt can be restarted by dragging a node, * altering the dataset or calling startSimulation(). - * - * @memberOf Network */ stopSimulation(): void; @@ -1350,18 +1182,13 @@ export class Network { * All the stabilization options above are used. * You can optionally supply the number of iterations it should do. * - * @param {number} [iterations] the number of iterations it should do - * - * @memberOf Network + * @param [iterations] the number of iterations it should do */ stabilize(iterations?: number): void; /** * Returns an object with selected nodes and edges ids. * - * @returns {{ nodes: IdType[], edges: IdType[] }} - * - * @memberOf Network */ getSelection(): { nodes: IdType[], edges: IdType[] }; @@ -1369,9 +1196,6 @@ export class Network { * Returns an array of selected node ids like so: * [nodeId1, nodeId2, ..]. * - * @returns {IdType[]} - * - * @memberOf Network */ getSelectedNodes(): IdType[]; @@ -1379,9 +1203,6 @@ export class Network { * Returns an array of selected edge ids like so: * [edgeId1, edgeId2, ..]. * - * @returns {IdType[]} - * - * @memberOf Network */ getSelectedEdges(): IdType[]; @@ -1389,10 +1210,6 @@ export class Network { * Returns a nodeId or undefined. * The DOM positions are expected to be in pixels from the top left corner of the canvas. * - * @param {IPosition} position - * @returns {IdType} - * - * @memberOf Network */ getNodeAt(position: Position): IdType; @@ -1400,10 +1217,6 @@ export class Network { * Returns a edgeId or undefined. * The DOM positions are expected to be in pixels from the top left corner of the canvas. * - * @param {IPosition} position - * @returns {IdType} - * - * @memberOf Network */ getEdgeAt(position: Position): IdType; @@ -1412,10 +1225,6 @@ export class Network { * If highlightEdges is true or undefined, the neighbouring edges will also be selected. * This method unselects all other objects before selecting its own objects. Does not fire events. * - * @param {IdType[]} nodeIds - * @param {boolean} [highlightEdges] - * - * @memberOf Network */ selectNodes(nodeIds: IdType[], highlightEdges?: boolean): void; @@ -1424,9 +1233,6 @@ export class Network { * This method unselects all other objects before selecting its own objects. * Does not fire events. * - * @param {IdType[]} edgeIds - * - * @memberOf Network */ selectEdges(edgeIds: IdType[]): void; @@ -1434,18 +1240,12 @@ export class Network { * Sets the selection. * You can also pass only nodes or edges in selection object. * - * @param {{ nodes: IdType[], edges: IdType[] }} selection - * @param {ISelectionOptions} [options] - * - * @memberOf Network */ setSelection(selection: { nodes: IdType[], edges: IdType[] }, options?: SelectionOptions): void; /** * Unselect all objects. * Does not fire events. - * - * @memberOf Network */ unselectAll(): void; @@ -1453,27 +1253,21 @@ export class Network { * Returns the current scale of the network. * 1.0 is comparible to 100%, 0 is zoomed out infinitely. * - * @returns {number} the current scale of the network - * - * @memberOf Network + * @returns the current scale of the network */ getScale(): number; /** * Returns the current central focus point of the view in the form: { x: {Number}, y: {Number} } * - * @returns {IPosition} the view position; - * - * @memberOf Network + * @returns the view position; */ getViewPosition(): Position; /** * Zooms out so all nodes fit on the canvas. * - * @param {IFitOptions} [options] All options are optional for the fit method - * - * @memberOf Network + * @param [options] All options are optional for the fit method */ fit(options?: FitOptions): void; @@ -1482,26 +1276,17 @@ export class Network { * What that means is the view will lock onto that node, if it is moving, the view will also move accordingly. * If the view is dragged by the user, the focus is broken. You can supply options to customize the effect. * - * @param {IdType} nodeId - * @param {IFocusOptions} [options] - * - * @memberOf Network */ focus(nodeId: IdType, options?: FocusOptions): void; /** * You can animate or move the camera using the moveTo method. * - * @param {IMoveToOptions} options - * - * @memberOf Network */ moveTo(options: MoveToOptions): void; /** * Programatically release the focussed node. - * - * @memberOf Network */ releaseNode(): void; @@ -1509,63 +1294,41 @@ export class Network { * If you use the configurator, you can call this method to get an options object that contains * all differences from the default options caused by users interacting with the configurator. * - * @returns {*} - * - * @memberOf Network */ getOptionsFromConfigurator(): any; } /** * Options interface for focus function. - * - * @export - * @interface IFocusOptions - * @extends {IViewPortOptions} */ export interface FocusOptions extends ViewPortOptions { /** * Locked denotes whether or not the view remains locked to * the node once the zoom-in animation is finished. * Default value is true. - * - * @type {boolean} - * @memberOf IFocusOptions */ locked?: boolean; } /** * Base options interface for some viewport functions. - * - * @export - * @interface IViewPortOptions */ export interface ViewPortOptions { /** * The scale is the target zoomlevel. * Default value is 1.0. - * - * @type {number} the scale. - * @memberOf IFocusOptions */ scale?: number; /** * The offset (in DOM units) is how many pixels from the center the view is focussed. * Default value is {x:0,y:0} - * - * @type {IPosition} - * @memberOf IFocusOptions */ offset?: Position; /** * For animation you can either use a Boolean to use it with the default options or * disable it or you can define the duration (in milliseconds) and easing function manually. - * - * @type {(IAnimationOptions | boolean)} - * @memberOf IFitOptions */ animation?: AnimationOptions | boolean; } @@ -1573,33 +1336,20 @@ export interface ViewPortOptions { /** * You will have to define at least a scale, position or offset. * Otherwise, there is nothing to move to. - * - * @export - * @interface IMoveToOptions - * @extends {IViewPortOptions} */ export interface MoveToOptions extends ViewPortOptions { /** * The position (in canvas units!) is the position of the central focus point of the camera. - * - * @type {IPosition} - * @memberOf IMoveToOptions */ position?: Position; } /** * Animation options interface. - * - * @export - * @interface IAnimationOptions */ export interface AnimationOptions { /** * The duration (in milliseconds). - * - * @type {number} - * @memberOf IAnimationOptions */ duration: number; /** @@ -1609,34 +1359,22 @@ export interface AnimationOptions { * linear, easeInQuad, easeOutQuad, easeInOutQuad, easeInCubic, * easeOutCubic, easeInOutCubic, easeInQuart, easeOutQuart, easeInOutQuart, * easeInQuint, easeOutQuint, easeInOutQuint. - * - * @type {string} - * @memberOf IAnimationOptions */ easingFunction: string; } /** * Optional options for the fit method. - * - * @export - * @interface IFitOptions */ export interface FitOptions { /** * The nodes can be used to zoom to fit only specific nodes in the view. - * - * @type {string[]} - * @memberOf IFitOptions */ nodes?: string[]; /** * For animation you can either use a Boolean to use it with the default options or * disable it or you can define the duration (in milliseconds) and easing function manually. - * - * @type {(IAnimationOptions | boolean)} - * @memberOf IFitOptions */ animation: AnimationOptions | boolean; } @@ -1648,9 +1386,6 @@ export interface SelectionOptions { /** * These values are in canvas space. - * - * @export - * @interface IBoundingBox */ export interface BoundingBox { top: number; @@ -1661,9 +1396,6 @@ export interface BoundingBox { /** * Cluster methods options interface. - * - * @export - * @interface IClusterOptions */ export interface ClusterOptions { /** @@ -1672,8 +1404,6 @@ export interface ClusterOptions { * and calls this function with their data as argument. If this function returns true, * this node will be added to the cluster. You have access to all options (including the default) * as well as any custom fields you may have added to the node to determine whether or not to include it in the cluster. - * - * @memberOf IClusterOptions */ joinCondition?(nodeOptions: any): boolean; @@ -1683,9 +1413,6 @@ export interface ClusterOptions { * supplied by you (clusterNodeProperties), all contained nodes and all contained edges. * You can use this to update the properties of the cluster based on which items it contains. * The function should return the properties to create the cluster node. - * - * @type {(clusterOptions: any, childNodesOptions: any[], childEdgesOptions: any[])} - * @memberOf IClusterOptions */ processProperties?(clusterOptions: any, childNodesOptions: any[], childEdgesOptions: any[]): any; @@ -1696,9 +1423,6 @@ export interface ClusterOptions { * This allows you to style your cluster node any way you want. * This is also the style object that is provided in the processProperties function for fine tuning. * If undefined, default node options will be used. - * - * @type {INodeOptions} - * @memberOf IClusterOptions */ clusterNodeProperties?: NodeOptions; @@ -1709,18 +1433,12 @@ export interface ClusterOptions { * Using this, you can style the edges connecting to the cluster any way you want. * If none are provided, the options from the edges that are replaced are used. * If undefined, default edge options will be used. - * - * @type {IEdgeOptions} - * @memberOf IClusterOptions */ clusterEdgeProperties?: EdgeOptions; } /** * Options for the openCluster function of Network. - * - * @export - * @interface IOpenClusterOptions */ export interface OpenClusterOptions { /** @@ -1734,8 +1452,6 @@ export interface OpenClusterOptions { * For all nodeIds not listed in this returned object, * we will position them at the location of the cluster. * This is also the default behaviour when no releaseFunction is defined. - * - * @memberOf IOpenClusterOptions */ releaseFunction( clusterPosition: Position, From 0fca415085b80f3de023a02733ed7c39b9e3fbe0 Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 26 Oct 2017 07:58:07 -0700 Subject: [PATCH 09/78] gulp-util: Lint and fix "chalk" dependency (#21032) * gulp-util: Lint and fix "chalk" dependency * Remove "chalk" directory --- types/chalk/tslint.json | 79 ---------- types/gulp-util/gulp-util-tests.ts | 234 ++++++++++++++--------------- types/gulp-util/index.d.ts | 106 +++++++------ types/gulp-util/tslint.json | 78 +--------- 4 files changed, 171 insertions(+), 326 deletions(-) delete mode 100644 types/chalk/tslint.json diff --git a/types/chalk/tslint.json b/types/chalk/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/chalk/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/gulp-util/gulp-util-tests.ts b/types/gulp-util/gulp-util-tests.ts index 651f9bff9b..67468829d3 100644 --- a/types/gulp-util/gulp-util-tests.ts +++ b/types/gulp-util/gulp-util-tests.ts @@ -7,15 +7,16 @@ import path = require('path'); import should = require('should'); import Stream = require('stream'); import through = require('through2'); -var es = require('event-stream'); +const es = require('event-stream'); +//TODO: import es = require('event-stream'); // ReSharper disable WrongExpressionStatement describe('File()', () => { it('should return a valid file', done => { - var fname = path.join(__dirname, './fixtures/test.coffee'); - var base = path.join(__dirname, './fixtures/'); - var file = new util.File({ - base: base, + const fname = path.join(__dirname, './fixtures/test.coffee'); + const base = path.join(__dirname, './fixtures/'); + const file = new util.File({ + base, cwd: __dirname, path: fname }); @@ -32,10 +33,10 @@ describe('File()', () => { }); it('should return a valid file 2', done => { - var fname = path.join(__dirname, './fixtures/test.coffee'); - var base = __dirname; - var file = new util.File({ - base: base, + const fname = path.join(__dirname, './fixtures/test.coffee'); + const base = __dirname; + const file = new util.File({ + base, cwd: __dirname, path: fname }); @@ -54,32 +55,31 @@ describe('File()', () => { describe('replaceExtension()', () => { it('should return a valid replaced extension on nested', done => { - var fname = path.join(__dirname, './fixtures/test.coffee'); - var expected = path.join(__dirname, './fixtures/test.js'); - var nu = util.replaceExtension(fname, '.js'); + const fname = path.join(__dirname, './fixtures/test.coffee'); + const expected = path.join(__dirname, './fixtures/test.js'); + const nu = util.replaceExtension(fname, '.js'); should.exist(nu); nu.should.equal(expected); done(); }); it('should return a valid replaced extension on flat', done => { - var fname = 'test.coffee'; - var expected = 'test.js'; - var nu = util.replaceExtension(fname, '.js'); + const fname = 'test.coffee'; + const expected = 'test.js'; + const nu = util.replaceExtension(fname, '.js'); should.exist(nu); nu.should.equal(expected); done(); }); it('should not return a valid replaced extension on empty string', done => { - var fname = ''; - var expected = ''; - var nu = util.replaceExtension(fname, '.js'); + const fname = ''; + const expected = ''; + const nu = util.replaceExtension(fname, '.js'); should.exist(nu); nu.should.equal(expected); done(); }); - }); describe('colors', () => { @@ -96,14 +96,14 @@ describe('date', () => { done(); }); it('should return today\'s date', done => { - var time = new Date(); - var dateutil = util.date('HH:MM:ss'); - dateutil.should.equal(('0' + time.getHours()).slice(-2) + ':' + ('0' + time.getMinutes()).slice(-2) + ':' + ('0' + time.getSeconds()).slice(-2)); + const time = new Date(); + const dateutil = util.date('HH:MM:ss'); + dateutil.should.equal(`${('0' + time.getHours()).slice(-2)}:${('0' + time.getMinutes()).slice(-2)}:${('0' + time.getSeconds()).slice(-2)}`); done(); }); }); -var now = new Date(); +const now = new Date(); // Basic usage util.date(now, 'dddd, mmmm dS, yyyy, h:MM:ss TT'); @@ -157,11 +157,11 @@ util.date(now, 'N'); describe('log()', () => { it('should work i guess', done => { - var writtenValue = ''; + const writtenValue = ''; util.log(1, 2, 3, 4, 'five'); - var time = util.date(new Date(), 'HH:MM:ss'); - writtenValue.should.eql('[' + util.colors.gray(time) + '] 1 2 3 4 five\n'); + const time = util.date(new Date(), 'HH:MM:ss'); + writtenValue.should.eql(`[${util.colors.gray(time)}] 1 2 3 4 five\n`); done(); }); @@ -169,34 +169,34 @@ describe('log()', () => { describe('template()', () => { it('should work with just a template', done => { - var opt = { + const opt = { name: 'todd', file: { path: 'hi.js' } }; - var expected = 'test todd hi.js'; + const expected = 'test todd hi.js'; - var tmpl = util.template('test <%= name %> <%= file.path %>'); + const tmpl = util.template('test <%= name %> <%= file.path %>'); should.exist(tmpl); 'function'.should.equal(typeof (tmpl)); // eval it now - var etmpl = tmpl(opt); + const etmpl = tmpl(opt); 'string'.should.equal(typeof (etmpl)); etmpl.should.equal(expected); done(); }); it('should work with a template and data', done => { - var opt = { + const opt = { name: 'todd', file: { path: 'hi.js' } }; - var expected = 'test todd hi.js'; - var tmpl = util.template('test <%= name %> <%= file.path %>', opt); + const expected = 'test todd hi.js'; + const tmpl = util.template('test <%= name %> <%= file.path %>', opt); should.exist(tmpl); 'string'.should.equal(typeof (tmpl)); tmpl.should.equal(expected); @@ -204,11 +204,11 @@ describe('template()', () => { }); //it('should throw an error when no file object is passed', done => { - // var opt = { + // const opt = { // name: 'todd' // }; // try { - // var tmpl = util.template('test <%= name %> <%= file.path %>', opt); + // const tmpl = util.template('test <%= name %> <%= file.path %>', opt); // } catch (err) { // should.exist(err); // done(); @@ -216,23 +216,23 @@ describe('template()', () => { //}); it('should ignore modified templateSettings', done => { - var templateSettings = require('lodash.templatesettings'); + const templateSettings = require('lodash.templatesettings'); templateSettings.interpolate = /\{\{([\s\S]+?)\}\}/g; - var opt = { + const opt = { name: 'todd', file: { path: 'hi.js' } }; - var expected = 'test {{name}} hi.js'; + const expected = 'test {{name}} hi.js'; - var tmpl = util.template('test {{name}} <%= file.path %>'); + const tmpl = util.template('test {{name}} <%= file.path %>'); should.exist(tmpl); 'function'.should.equal(typeof (tmpl)); // eval it now - var etmpl = tmpl(opt); + const etmpl = tmpl(opt); 'string'.should.equal(typeof (etmpl)); etmpl.should.equal(expected); @@ -240,26 +240,25 @@ describe('template()', () => { }); it('should allow ES6 delimiters', done => { - var opt = { + const opt = { name: 'todd', file: { path: 'hi.js' } }; - var expected = 'test todd hi.js'; + const expected = 'test todd hi.js'; - var tmpl = util.template('test ${name} ${file.path}'); + const tmpl = util.template('test ${name} ${file.path}'); // tslint:disable-line no-invalid-template-strings should.exist(tmpl); 'function'.should.equal(typeof (tmpl)); // eval it now - var etmpl = tmpl(opt); + const etmpl = tmpl(opt); 'string'.should.equal(typeof (etmpl)); etmpl.should.equal(expected); done(); }); - }); describe('env', () => { @@ -276,8 +275,8 @@ describe('noop()', () => { done(); }); it('should return a stream that passes through all data', done => { - var inp = [1, 2, 3, 4, 5, 6, 7, 8, 9]; - var stream = util.noop(); + const inp = [1, 2, 3, 4, 5, 6, 7, 8, 9]; + const stream = util.noop(); es.readArray(inp) .pipe(stream) .pipe(es.writeArray((err: Error, arr: any[]) => { @@ -291,7 +290,7 @@ describe('noop()', () => { describe('beep()', () => { it('should send the right code to stdout', done => { - var writtenValue = ''; + const writtenValue = ''; util.beep(); writtenValue.should.equal('\x07'); @@ -338,45 +337,45 @@ describe('isNull()', () => { }); // linefeed -declare var lines: string[]; +declare const lines: string[]; lines.join(util.linefeed); describe('combine()', () => { it('should return a function', done => { - var src = [1, 2, 3]; - var inp = es.readArray(src); - var factory = util.combine(inp); + const src = [1, 2, 3]; + const inp = es.readArray(src); + const factory = util.combine(inp); factory.should.be.type('function'); done(); }); it('should return a function that returns a stream combination', done => { - var src = [1, 2, 3]; - var inp = es.readArray(src); - var inp2 = es.writeArray((err: Error, data: any[]) => { + const src = [1, 2, 3]; + const inp = es.readArray(src); + const inp2 = es.writeArray((err: Error, data: any[]) => { should.not.exist(err); data.should.eql(src); done(); }); - var factory = util.combine(inp, inp2); + const factory = util.combine(inp, inp2); factory().should.be.instanceof(Stream.Readable); }); it('should return a function that returns a stream combination when given an array', done => { - var src = [1, 2, 3]; - var inp = es.readArray(src); - var inp2 = es.writeArray((err: Error, data: any[]) => { + const src = [1, 2, 3]; + const inp = es.readArray(src); + const inp2 = es.writeArray((err: Error, data: any[]) => { should.not.exist(err); data.should.eql(src); done(); }); - var factory = util.combine([inp, inp2]); + const factory = util.combine([inp, inp2]); factory().should.be.instanceof(Stream.Readable); }); }); describe('buffer()', () => { it('should buffer stuff and return an array into the callback', done => { - var src = [1, 2, 3]; - var inp = es.readArray(src); + const src = [1, 2, 3]; + const inp = es.readArray(src); inp.pipe(util.buffer((err: Error, data: any[]) => { should.not.exist(err); should.exist(data); @@ -385,8 +384,8 @@ describe('buffer()', () => { })); }); it('should buffer stuff and emit it as a data event', done => { - var src = [1, 2, 3]; - var inp = es.readArray(src); + const src = [1, 2, 3]; + const inp = es.readArray(src); inp.pipe(util.buffer()).on('data', (data: any[]) => { should.exist(data); data.should.eql(src); @@ -394,8 +393,8 @@ describe('buffer()', () => { }); }); it('should buffer stuff and return a stream with the buffered data', done => { - var src = [1, 2, 3]; - var inp = es.readArray(src); + const src = [1, 2, 3]; + const inp = es.readArray(src); inp.pipe(util.buffer()).pipe(es.through((data: any[]) => { should.exist(data); data.should.eql(src); @@ -406,35 +405,35 @@ describe('buffer()', () => { describe('PluginError()', () => { it('should default name to Error', () => { - var err = new util.PluginError('test', 'something broke'); + const err = new util.PluginError('test', 'something broke'); err.name.should.equal('Error'); }); it('should default name to Error, even when wrapped error has no name', () => { - var realErr = { message: 'something broke' }; - var err = new util.PluginError('test', realErr); + const realErr = { message: 'something broke' }; + const err = new util.PluginError('test', realErr); err.name.should.equal('Error'); }); it('should print the plugin name in toString', () => { - var err = new util.PluginError('test', 'something broke'); + const err = new util.PluginError('test', 'something broke'); err.toString().indexOf('test').should.not.equal(-1); }); it('should not include the stack by default in toString', () => { - var err = new util.PluginError('test', 'something broke'); + const err = new util.PluginError('test', 'something broke'); // just check that there are no 'at' lines err.toString().indexOf('at').should.equal(-1); }); it('should include the stack when specified in toString', () => { - var err = new util.PluginError('test', 'something broke', { stack: "at huh", showStack: true }); + const err = new util.PluginError('test', 'something broke', { stack: "at huh", showStack: true }); // just check that there are 'at' lines err.toString().indexOf('at').should.not.equal(-1); }); it('should take arguments as one object', () => { - var err = new util.PluginError({ + const err = new util.PluginError({ plugin: 'test', message: 'something broke' }); @@ -443,7 +442,7 @@ describe('PluginError()', () => { }); it('should take arguments as plugin name and one object', () => { - var err = new util.PluginError('test', { + const err = new util.PluginError('test', { message: 'something broke' }); err.plugin.should.equal('test'); @@ -451,22 +450,22 @@ describe('PluginError()', () => { }); it('should take arguments as plugin name and message', () => { - var err = new util.PluginError('test', 'something broke'); + const err = new util.PluginError('test', 'something broke'); err.plugin.should.equal('test'); err.message.should.equal('something broke'); }); it('should take arguments as plugin name, message, and one object', () => { - var err = new util.PluginError('test', 'something broke', { showStack: true }); + const err = new util.PluginError('test', 'something broke', { showStack: true }); err.plugin.should.equal('test'); err.message.should.equal('something broke'); err.showStack.should.equal(true); }); it('should take arguments as plugin name, error, and one object', () => { - var realErr = new Error('something broke'); - (realErr).fileName = 'original.js'; - var err = new util.PluginError('test', realErr, { showStack: true, fileName: 'override.js' }); + const realErr = new Error('something broke') as Error & { fileName: string }; + realErr.fileName = 'original.js'; + const err = new util.PluginError('test', realErr, { showStack: true, fileName: 'override.js' }); err.plugin.should.equal('test'); err.message.should.equal('something broke'); err.fileName.should.equal('override.js'); @@ -474,26 +473,27 @@ describe('PluginError()', () => { }); it('should take properties from error', () => { - var realErr = new Error('something broke'); - (realErr).abstractProperty = 'abstract'; - var err = new util.PluginError('test', realErr); + const realErr = new Error('something broke') as Error & { abstractProperty: string }; + realErr.abstractProperty = 'abstract'; + const err = new util.PluginError('test', realErr); err.plugin.should.equal('test'); err.message.should.equal('something broke'); - (err).abstractProperty.should.equal('abstract'); + // TODO: use generics to make this work without a cast? + (err as util.PluginError & { abstractProperty: string }).abstractProperty.should.equal('abstract'); }); it('should be configured to show properties by default', () => { - var err = new util.PluginError('test', 'something broke'); + const err = new util.PluginError('test', 'something broke'); err.showProperties.should.be.true; }); it('should not be configured to take option to show properties', () => { - var err = new util.PluginError('test', 'something broke', { showProperties: false }); + const err = new util.PluginError('test', 'something broke', { showProperties: false }); err.showProperties.should.be.false; }); it('should show properties', () => { - var err = new util.PluginError('test', 'it broke', { showProperties: true }); + const err = new util.PluginError('test', 'it broke', { showProperties: true }); err.fileName = 'original.js'; err.lineNumber = 35; err.toString().indexOf('it broke').should.not.equal(-1); @@ -502,25 +502,25 @@ describe('PluginError()', () => { }); it('should show properties', () => { - var realErr = new Error('something broke'); - (realErr).fileName = 'original.js'; - (realErr).lineNumber = 35; - var err = new util.PluginError('test', realErr, { showProperties: true }); + const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number }; + realErr.fileName = 'original.js'; + realErr.lineNumber = 35; + const err = new util.PluginError('test', realErr, { showProperties: true }); err.toString().indexOf('message:').should.equal(-1); err.toString().indexOf('fileName:').should.not.equal(-1); }); it('should not show properties', () => { - var realErr = new Error('something broke'); - (realErr).fileName = 'original.js'; - (realErr).lineNumber = 35; - var err = new util.PluginError('test', realErr, { showProperties: false }); + const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number }; + realErr.fileName = 'original.js'; + realErr.lineNumber = 35; + const err = new util.PluginError('test', realErr, { showProperties: false }); err.toString().indexOf('message:').should.equal(-1); err.toString().indexOf('fileName:').should.equal(-1); }); it('should not show properties, but should show stack', () => { - var err = new util.PluginError('test', 'it broke', { stack: 'test stack', showStack: true, showProperties: false }); + const err = new util.PluginError('test', 'it broke', { stack: 'test stack', showStack: true, showProperties: false }); err.fileName = 'original.js'; err.lineNumber = 35; err.toString().indexOf('message:').should.equal(-1); @@ -529,40 +529,40 @@ describe('PluginError()', () => { }); it('should not show properties, but should show stack for real error', () => { - var realErr = new Error('something broke'); - (realErr).fileName = 'original.js'; - (realErr).lineNumber = 35; - (realErr).stack = 'test stack'; - var err = new util.PluginError('test', realErr, { showStack: true, showProperties: false }); + const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number }; + realErr.fileName = 'original.js'; + realErr.lineNumber = 35; + realErr.stack = 'test stack'; + const err = new util.PluginError('test', realErr, { showStack: true, showProperties: false }); err.toString().indexOf('message:').should.equal(-1); err.toString().indexOf('fileName:').should.equal(-1); err.toString().indexOf('test stack').should.not.equal(-1); }); it('should not show properties, but should show stack for _stack', () => { - var realErr = new Error('something broke'); - (realErr).fileName = 'original.js'; - (realErr).lineNumber = 35; - (realErr)._stack = 'test stack'; - var err = new util.PluginError('test', realErr, { showStack: true, showProperties: false }); + const realErr = new Error('something broke') as Error & { fileName: string, lineNumber: number, _stack: string }; + realErr.fileName = 'original.js'; + realErr.lineNumber = 35; + realErr._stack = 'test stack'; + const err = new util.PluginError('test', realErr, { showStack: true, showProperties: false }); err.toString().indexOf('message:').should.equal(-1); err.toString().indexOf('fileName:').should.equal(-1); err.toString().indexOf('test stack').should.not.equal(-1); }); it('should show properties and stack', () => { - var realErr = new Error('something broke'); - (realErr).fileName = 'original.js'; - (realErr).stack = 'test stack'; - var err = new util.PluginError('test', realErr, { showStack: true }); + const realErr = new Error('something broke') as Error & { fileName: string }; + realErr.fileName = 'original.js'; + realErr.stack = 'test stack'; + const err = new util.PluginError('test', realErr, { showStack: true }); err.toString().indexOf('message:').should.equal(-1); err.toString().indexOf('fileName:').should.not.equal(-1); err.toString().indexOf('test stack').should.not.equal(-1); }); it('should show properties added after the error is created', () => { - var realErr = new Error('something broke'); - var err = new util.PluginError('test', realErr); + const realErr = new Error('something broke'); + const err = new util.PluginError('test', realErr); err.fileName = 'original.js'; err.toString().indexOf('message:').should.equal(-1); err.toString().indexOf('fileName:').should.not.equal(-1); @@ -571,8 +571,8 @@ describe('PluginError()', () => { it('should toString quickly', function(done) { this.timeout(100); - var err = new util.PluginError('test', 'it broke', { showStack: true }); - var str = err.toString(); + const err = new util.PluginError('test', 'it broke', { showStack: true }); + const str = err.toString(); done(); }); @@ -580,15 +580,15 @@ describe('PluginError()', () => { it('should toString quickly with original error', function(done) { this.timeout(100); - var realErr = new Error('it broke'); - var err = new util.PluginError('test', realErr, { showStack: true }); - var str = err.toString(); + const realErr = new Error('it broke'); + const err = new util.PluginError('test', realErr, { showStack: true }); + const str = err.toString(); done(); }); it('should not show "Details:" if there are no properties to show', () => { - var err = new util.PluginError('plugin', 'message'); + const err = new util.PluginError('plugin', 'message'); err.toString().indexOf('Details:').should.equal(-1); }); }); diff --git a/types/gulp-util/index.d.ts b/types/gulp-util/index.d.ts index ee059ca986..d7538ee572 100644 --- a/types/gulp-util/index.d.ts +++ b/types/gulp-util/index.d.ts @@ -1,53 +1,50 @@ -// Type definitions for gulp-util v3.0.x +// Type definitions for gulp-util 3.0 // Project: https://github.com/gulpjs/gulp-util // Definitions by: jedmao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -/// -/// import vinyl = require('vinyl'); -import chalk = require('chalk'); +import chalk from 'chalk'; import through2 = require('through2'); export { vinyl as File }; /** -* Replaces a file extension in a path. Returns the new path. -*/ + * Replaces a file extension in a path. Returns the new path. + */ export function replaceExtension(npath: string, ext: string): string; -export var colors: typeof chalk; +export const colors: typeof chalk; -export var date: { - (now?: Date, mask?: string, convertLocalTimeToUTC?: boolean): any; - (date?: string, mask?: string, convertLocalTimeToUTC?: boolean): any; +export const date: { + (now?: Date | string, mask?: string, convertLocalTimeToUTC?: boolean): any; masks: any; }; /** -* Logs stuff. Already prefixed with [gulp] and all that. Use the right colors -* for values. If you pass in multiple arguments it will join them by a space. -*/ + * Logs stuff. Already prefixed with [gulp] and all that. Use the right colors + * for values. If you pass in multiple arguments it will join them by a space. + */ export function log(message?: any, ...optionalParams: any[]): void; /** -* This is a lodash.template function wrapper. You must pass in a valid gulp -* file object so it is available to the user or it will error. You can not -* configure any of the delimiters. Look at the lodash docs for more info. -*/ + * This is a lodash.template function wrapper. You must pass in a valid gulp + * file object so it is available to the user or it will error. You can not + * configure any of the delimiters. Look at the lodash docs for more info. + */ export function template(tmpl: string): (opt: { file: { path: string } }) => string; export function template(tmpl: string, opt: { file: { path: string } }): string; -export var env: any; +export const env: any; export function beep(): void; /** -* Returns a stream that does nothing but pass data straight through. -*/ -export var noop: typeof through2; + * Returns a stream that does nothing but pass data straight through. + */ +export const noop: typeof through2; export function isStream(obj: any): boolean; @@ -55,47 +52,46 @@ export function isBuffer(obj: any): boolean; export function isNull(obj: any): boolean; -export var linefeed: string; +export const linefeed: string; export function combine(streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream; export function combine(...streams: NodeJS.ReadWriteStream[]): () => NodeJS.ReadWriteStream; /** -* This is similar to es.wait but instead of buffering text into one string -* it buffers anything into an array (so very useful for file objects). -*/ + * This is similar to es.wait but instead of buffering text into one string + * it buffers anything into an array (so very useful for file objects). + */ export function buffer(cb?: (err: Error, data: any[]) => void): NodeJS.ReadWriteStream; export class PluginError implements Error, PluginErrorOptions { constructor(options?: PluginErrorOptions); constructor(pluginName: string, options?: PluginErrorOptions); - constructor(pluginName: string, message: string, options?: PluginErrorOptions); - constructor(pluginName: string, message: Error, options?: PluginErrorOptions); + constructor(pluginName: string, message: string | Error, options?: PluginErrorOptions); /** - * The module name of your plugin. - */ + * The module name of your plugin. + */ name: string; /** - * Can be a string or an existing error. - */ + * Can be a string or an existing error. + */ message: any; fileName: string; lineNumber: number; /** - * You need to include the message along with this stack. If you pass an - * error in as the message the stack will be pulled from that, otherwise one - * will be created. - */ + * You need to include the message along with this stack. If you pass an + * error in as the message the stack will be pulled from that, otherwise one + * will be created. + */ stack: string; /** - * By default the stack will not be shown. Set this to true if you think the - * stack is important for your error. - */ + * By default the stack will not be shown. Set this to true if you think the + * stack is important for your error. + */ showStack: boolean; /** - * Error properties will be included in err.toString(). Can be omitted by - * setting this to false. - */ + * Error properties will be included in err.toString(). Can be omitted by + * setting this to false. + */ showProperties: boolean; plugin: string; error: Error; @@ -103,30 +99,30 @@ export class PluginError implements Error, PluginErrorOptions { export interface PluginErrorOptions { /** - * The module name of your plugin. - */ + * The module name of your plugin. + */ name?: string; /** - * Can be a string or an existing error. - */ + * Can be a string or an existing error. + */ message?: any; fileName?: string; lineNumber?: number; /** - * You need to include the message along with this stack. If you pass an - * error in as the message the stack will be pulled from that, otherwise one - * will be created. - */ + * You need to include the message along with this stack. If you pass an + * error in as the message the stack will be pulled from that, otherwise one + * will be created. + */ stack?: string; /** - * By default the stack will not be shown. Set this to true if you think the - * stack is important for your error. - */ + * By default the stack will not be shown. Set this to true if you think the + * stack is important for your error. + */ showStack?: boolean; /** - * Error properties will be included in err.toString(). Can be omitted by - * setting this to false. - */ + * Error properties will be included in err.toString(). Can be omitted by + * setting this to false. + */ showProperties?: boolean; plugin?: string; error?: Error; diff --git a/types/gulp-util/tslint.json b/types/gulp-util/tslint.json index e87060ef20..a1de4a6061 100644 --- a/types/gulp-util/tslint.json +++ b/types/gulp-util/tslint.json @@ -1,80 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-invalid-template-strings": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "comment-format": false, // TODO + "no-reference-import": false, // TODO: fix "should" + "no-var-requires": false // TODO } } From e030d2140c5216ca5824fec7aa78ecf9656c7f7c Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Thu, 26 Oct 2017 13:38:50 -0400 Subject: [PATCH 10/78] react-autosuggest change theme to allow inline styles --- types/react-autosuggest/index.d.ts | 22 +++++-------------- .../react-autosuggest-tests.tsx | 3 ++- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/types/react-autosuggest/index.d.ts b/types/react-autosuggest/index.d.ts index 9205f63d4c..2d0034fd46 100644 --- a/types/react-autosuggest/index.d.ts +++ b/types/react-autosuggest/index.d.ts @@ -9,6 +9,7 @@ // TypeScript Version: 2.3 import * as React from 'react'; + declare class Autosuggest extends React.Component {} export = Autosuggest; @@ -57,22 +58,11 @@ declare namespace Autosuggest { method: 'click' | 'enter'; } - interface Theme { - container?: string; - containerOpen?: string; - input?: string; - inputOpen?: string; - inputFocused?: string; - suggestionsContainer?: string; - suggestionsContainerOpen?: string; - suggestionsList?: string; - suggestion?: string; - suggestionFirst?: string; - suggestionHighlighted?: string; - sectionContainer?: string; - sectionContainerFirst?: string; - sectionTitle?: string; - } + type ThemeKey = 'container' | 'containerOpen' | 'input' | 'inputOpen' | 'inputFocused' | 'suggestionsContainer' | + 'suggestionsContainerOpen' | 'suggestionsList' | 'suggestion' | 'suggestionFirst' | 'suggestionHighlighted' | + 'sectionContainer' | 'sectionContainerFirst' | 'sectionTitle'; + + type Theme = Partial>; interface AutosuggestProps extends React.Props { suggestions: any[]; diff --git a/types/react-autosuggest/react-autosuggest-tests.tsx b/types/react-autosuggest/react-autosuggest-tests.tsx index c67a5c72ad..23841519e4 100644 --- a/types/react-autosuggest/react-autosuggest-tests.tsx +++ b/types/react-autosuggest/react-autosuggest-tests.tsx @@ -85,7 +85,8 @@ export class ReactAutosuggestBasicTest extends React.Component { const theme = { input: 'themed-input-class', container: 'themed-container-class', - suggestionFocused: 'active' + suggestionFocused: 'active', + sectionTitle: { color: 'blue' } }; return Date: Thu, 26 Oct 2017 13:56:00 -0400 Subject: [PATCH 11/78] [mocha] Add require to MochaSetupOptions (#20791) * Add require to MochaSetupOptions Added require to MochaSetupOptions and updated tests to reflect change. * Update tests to remove unnecessary option from constructor --- types/mocha/index.d.ts | 3 +++ types/mocha/mocha-tests.ts | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/types/mocha/index.d.ts b/types/mocha/index.d.ts index 07f59e6628..4ae915f683 100644 --- a/types/mocha/index.d.ts +++ b/types/mocha/index.d.ts @@ -27,6 +27,9 @@ interface MochaSetupOptions { // grep string or regexp to filter tests with grep?: any; + + // require modules before running tests + require?: string[]; } declare var mocha: Mocha; diff --git a/types/mocha/mocha-tests.ts b/types/mocha/mocha-tests.ts index 55ba6fa961..c3fa00da84 100644 --- a/types/mocha/mocha-tests.ts +++ b/types/mocha/mocha-tests.ts @@ -339,6 +339,10 @@ function test_setup_reporter_string_option() { mocha.setup({ reporter: 'html' }); } +function test_setup_require_stringArray_option() { + mocha.setup({ require: ['ts-node/register'] }); +} + function test_setup_reporter_function_option() { mocha.setup({ reporter: class { } }); } @@ -372,7 +376,8 @@ function test_setup_all_options() { reporter: 'html', bail: true, ignoreLeaks: true, - grep: 'test' + grep: 'test', + require: ['ts-node/register'] }); } From 732ff64967e531b3fee356a7778e59771761c365 Mon Sep 17 00:00:00 2001 From: Matt Lewis Date: Thu, 26 Oct 2017 19:08:06 +0100 Subject: [PATCH 12/78] twitter-text: add missing options arg to extractUrlsWithIndices (#21026) --- types/twitter-text/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/twitter-text/index.d.ts b/types/twitter-text/index.d.ts index accac12333..b09af9d34c 100644 --- a/types/twitter-text/index.d.ts +++ b/types/twitter-text/index.d.ts @@ -42,7 +42,7 @@ export declare function splitTags(text: string): string[]; export declare function extractHashtags(text: string): string[]; export declare function extractHashtagsWithIndices(text: string): HashtagWithIndices[]; export declare function extractUrls(text: string): string[]; -export declare function extractUrlsWithIndices(text: string): UrlWithIndices[]; +export declare function extractUrlsWithIndices(text: string, options?: {extractUrlsWithoutProtocol: boolean}): UrlWithIndices[]; export declare function extractMentions(text: string): string[]; export declare function extractMentionsWithIndices(text: string): MentionWithIndices[]; export declare function extractMentionsOrListsWithIndices(text: string): MentionOrListWithIndices[]; From d92b971c92e3e45e1f72d4d6e289d4988b5c3b97 Mon Sep 17 00:00:00 2001 From: Alex Lockwood Date: Thu, 26 Oct 2017 11:16:55 -0700 Subject: [PATCH 13/78] Make the 'name' arg optional in d3.transition() (#21039) --- types/d3-transition/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/d3-transition/index.d.ts b/types/d3-transition/index.d.ts index 1ff8d46d04..eb60cec49f 100644 --- a/types/d3-transition/index.d.ts +++ b/types/d3-transition/index.d.ts @@ -569,7 +569,7 @@ export interface Transition(name: string): Transition; +export function transition(name?: string): Transition; /** * Returns a new transition from an existing transition. From a5cc1d82d9775ab408fec1642100633ae77408d1 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 26 Oct 2017 14:23:16 -0400 Subject: [PATCH 14/78] Added typing for url-metadata 2.1 (#21035) --- types/url-metadata/index.d.ts | 57 ++++++++++++++++++++++++ types/url-metadata/tsconfig.json | 23 ++++++++++ types/url-metadata/tslint.json | 1 + types/url-metadata/url-metadata-tests.ts | 15 +++++++ 4 files changed, 96 insertions(+) create mode 100644 types/url-metadata/index.d.ts create mode 100644 types/url-metadata/tsconfig.json create mode 100644 types/url-metadata/tslint.json create mode 100644 types/url-metadata/url-metadata-tests.ts diff --git a/types/url-metadata/index.d.ts b/types/url-metadata/index.d.ts new file mode 100644 index 0000000000..2d909b15e1 --- /dev/null +++ b/types/url-metadata/index.d.ts @@ -0,0 +1,57 @@ +// Type definitions for url-metadata 2.1 +// Project: https://github.com/LevelNewsOrg/url-metadata +// Definitions by: Kevin Gravier +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = urlMetadata; + +declare function urlMetadata(url: string, options?: urlMetadata.Options): Promise; + +declare namespace urlMetadata { + interface Options { + userAgent?: string; + fromEmail?: string; + maxRedirects?: number; + timeout?: number; + descriptionLength?: number; + ensureSecureImageRequest?: boolean; + sourceMap?: { [key: string]: string }; + encode?: () => void; + } + + interface Result { + "url": string; + "canonical": string; + "title": string; + "image": string; + "author": string; + "description": string; + "keywords": string; + "source": string; + "og:url": string; + "og:locale": string; + "og:locale:alternate": string; + "og:title": string; + "og:type": string; + "og:description": string; + "og:determiner": string; + "og:site_name": string; + "og:image": string; + "og:image:secure_url": string; + "og:image:type": string; + "og:image:width": string; + "og:image:height": string; + "article:published_time"?: string; + "article:modified_time"?: string; + "article:expiration_time"?: string; + "article:author"?: string; + "article:section"?: string; + "article:tag"?: string; + "og:article:published_time"?: string; + "og:article:modified_time"?: string; + "og:article:expiration_time"?: string; + "og:article:author"?: string; + "og:article:section"?: string; + "og:article:tag"?: string; + } +} diff --git a/types/url-metadata/tsconfig.json b/types/url-metadata/tsconfig.json new file mode 100644 index 0000000000..e12ebe2932 --- /dev/null +++ b/types/url-metadata/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "url-metadata-tests.ts" + ] +} diff --git a/types/url-metadata/tslint.json b/types/url-metadata/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/url-metadata/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/url-metadata/url-metadata-tests.ts b/types/url-metadata/url-metadata-tests.ts new file mode 100644 index 0000000000..ab45090783 --- /dev/null +++ b/types/url-metadata/url-metadata-tests.ts @@ -0,0 +1,15 @@ +import * as urlMetadata from "url-metadata"; + +const opts: urlMetadata.Options = { + userAgent: "url-metadata-test", + fromEmail: "testing@url-metadata.com", + maxRedirects: 3, + timeout: 10000, + descriptionLength: 10000, + ensureSecureImageRequest: true +}; +const url = "https://google.com"; + +urlMetadata(url, opts).then((result: urlMetadata.Result) => { + result; // $ExpectType Result +}); From 078fd0160930a20e8c82544daa49470dd44354e6 Mon Sep 17 00:00:00 2001 From: Endel Dreyer Date: Thu, 26 Oct 2017 16:25:09 -0200 Subject: [PATCH 15/78] fossil-delta: update version number (#21030) Documentation for the new argument: https://github.com/dchest/fossil-delta-js/commit/4f24034cbc342e5787a59547bcc1ed851517550e --- types/fossil-delta/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/fossil-delta/index.d.ts b/types/fossil-delta/index.d.ts index 98ab4cc600..3b79af9cc4 100644 --- a/types/fossil-delta/index.d.ts +++ b/types/fossil-delta/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for fossil-delta 0.2.5 +// Type definitions for fossil-delta 1.0.0 // Project: https://github.com/dchest/fossil-delta-js // Definitions by: Endel Dreyer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,5 +8,5 @@ type ByteArray = Array | Uint8Array | Buffer; export function create(origin: ByteArray, target: ByteArray): Array; -export function apply(origin: ByteArray, delta: Array): Array; +export function apply(origin: ByteArray, delta: Array, ops?: { verifyChecksum: boolean }): Array; export function outputSize(delta: Array): number; From 57989134a3323e9541d82ec556aaf6f99426d5eb Mon Sep 17 00:00:00 2001 From: Shane Fitzpatrick Date: Thu, 26 Oct 2017 20:25:34 +0200 Subject: [PATCH 16/78] react-native: Adding the fadeDuration property to ImagePropertiesAndroid (#21029) --- types/react-native/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 8a3545a267..2dcec3f6eb 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3299,6 +3299,11 @@ interface ImagePropertiesAndroid { * It should also be used if the image is slightly bigger than the view. */ resizeMethod?: 'auto' | 'resize' | 'scale' + + /** + * Duration of fade in animation. + */ + fadeDuration?: number; } /** From e063f03d60f8b092067d8f8b8edefe8dd272bc8a Mon Sep 17 00:00:00 2001 From: Bond Date: Thu, 26 Oct 2017 19:26:57 +0100 Subject: [PATCH 17/78] Add typings for mongoose-geojson-schema (#21028) * Add typings fro mongoose-geojson-schema * Fix lint errors --- types/mongoose-geojson-schema/index.d.ts | 79 +++++++++++++++++++ .../mongoose-geojson-schema-tests.ts | 22 ++++++ types/mongoose-geojson-schema/tsconfig.json | 23 ++++++ types/mongoose-geojson-schema/tslint.json | 1 + 4 files changed, 125 insertions(+) create mode 100644 types/mongoose-geojson-schema/index.d.ts create mode 100644 types/mongoose-geojson-schema/mongoose-geojson-schema-tests.ts create mode 100644 types/mongoose-geojson-schema/tsconfig.json create mode 100644 types/mongoose-geojson-schema/tslint.json diff --git a/types/mongoose-geojson-schema/index.d.ts b/types/mongoose-geojson-schema/index.d.ts new file mode 100644 index 0000000000..2cd97a8141 --- /dev/null +++ b/types/mongoose-geojson-schema/index.d.ts @@ -0,0 +1,79 @@ +// Type definitions for mongoose-geojson-schema 2.1 +// Project: https://github.com/rideamigoscorp/mongoose-geojson-schema#readme +// Definitions by: Bond +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +import mongoose = require('mongoose'); + +declare module 'mongoose' { + namespace Schema { + namespace Types { + class GeoJSON extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'GeoJSON'; + } + + class Point extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'Point'; + } + + class MultiPoint extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'MultiPoint'; + } + + class LineString extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'LineString'; + } + + class MultiLineString extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'MultiLineString'; + } + + class Polygon extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'Polygon'; + } + + class MultiPolygon extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'MultiPolygon'; + } + + class Geometry extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'Geometry'; + } + + class GeometryCollection extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'GeometryCollection'; + } + + class Feature extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'Feature'; + } + + class FeatureCollection extends SchemaType { + constructor(key: string, options?: object); + cast(geojson: object): this; + static schemaName: 'FeatureCollection'; + } + } + } +} diff --git a/types/mongoose-geojson-schema/mongoose-geojson-schema-tests.ts b/types/mongoose-geojson-schema/mongoose-geojson-schema-tests.ts new file mode 100644 index 0000000000..3694ab5144 --- /dev/null +++ b/types/mongoose-geojson-schema/mongoose-geojson-schema-tests.ts @@ -0,0 +1,22 @@ +'use strict'; + +import * as mongoose from 'mongoose'; +import * as mongooseGeoJSONSchema from 'mongoose-geojson-schema'; + +const TestSchema = new mongoose.Schema( + { + title: String, + test: {}, + point: mongoose.Schema.Types.Point, + multipoint: mongoose.Schema.Types.MultiPoint, + linestring: mongoose.Schema.Types.LineString, + multilinestring: mongoose.Schema.Types.MultiLineString, + polygon: mongoose.Schema.Types.Polygon, + multipolygon: mongoose.Schema.Types.MultiPolygon, + geometry: mongoose.Schema.Types.Geometry, + geometrycollection: mongoose.Schema.Types.GeometryCollection, + feature: mongoose.Schema.Types.Feature, + featurecollection: mongoose.Schema.Types.FeatureCollection, + }, + { typeKey: '$type', collection: 'echoes' } +); diff --git a/types/mongoose-geojson-schema/tsconfig.json b/types/mongoose-geojson-schema/tsconfig.json new file mode 100644 index 0000000000..9d3afc8952 --- /dev/null +++ b/types/mongoose-geojson-schema/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "mongoose-geojson-schema-tests.ts" + ] +} diff --git a/types/mongoose-geojson-schema/tslint.json b/types/mongoose-geojson-schema/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/mongoose-geojson-schema/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1c477ddb35721606199fd65ae30e924b74e85092 Mon Sep 17 00:00:00 2001 From: Damian Senn Date: Thu, 26 Oct 2017 20:37:39 +0200 Subject: [PATCH 18/78] Add missing params from selectize API (#21001) --- types/selectize/index.d.ts | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/types/selectize/index.d.ts b/types/selectize/index.d.ts index f6c2498d70..449d09ce52 100644 --- a/types/selectize/index.d.ts +++ b/types/selectize/index.d.ts @@ -244,6 +244,14 @@ declare namespace Selectize { */ searchConjunction?: string; + /** + * If truthy, Selectize will make all optgroups be in the same order as they were added (by the `$order` + * property). Otherwise, it will order based on the score of the results in each. + * + * Default: false + */ + lockOptgroupOrder?: boolean; + /** * An array of optgroup values that indicates the order they should be listed in in the dropdown. * If not provided, groups will be ordered by the ranking of the options within them. @@ -426,7 +434,7 @@ declare namespace Selectize { /** * Resets / clears all selected items from the control. */ - clear(): void; + clear(silent?: boolean): void; /** * Returns the jQuery element of the item matching the given value. @@ -436,18 +444,18 @@ declare namespace Selectize { /** * "Selects" an item. Adds it to the list at the current caret position. */ - addItem(value: T): void; + addItem(value: T, silent?: boolean): void; /** * Removes the selected item matching the provided value. */ - removeItem(value: T): void; + removeItem(value: T, silent?: boolean): void; /** * Invokes the "create" method provided in the selectize options that should provide the data for the * new item, given the user input. Once this completes, it will be added to the item list. */ - createItem(value: T): void; + createItem(value: T, triggerDropdown?: boolean, callback?: (data?: any) => void): void; /** * Re-renders the selected item lists. From 1cebcbc7c08a91519d3b62bc9276a0cce0bc2ac6 Mon Sep 17 00:00:00 2001 From: Jan Bevers Date: Thu, 26 Oct 2017 20:40:03 +0200 Subject: [PATCH 19/78] [Redux-first-router] redirect and setKind do not require meta / payload properties to be set inside the action property / actionToPath has an optional querySerializer param (#20995) * [Redux-first-router] redirect and setKind do not require meta / payload properties to be set inside the action property / actionToPath has an optional querySerializer param * Use fixed string value for NOT_FOUND const * [Redux-first-router] Add ExceptType comments to tests --- types/redux-first-router/index.d.ts | 9 +++--- .../redux-first-router-tests.ts | 28 ++++++++++++++++++- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/types/redux-first-router/index.d.ts b/types/redux-first-router/index.d.ts index 89be27f524..410cbc74cc 100644 --- a/types/redux-first-router/index.d.ts +++ b/types/redux-first-router/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/faceyspacey/redux-first-router#readme // Definitions by: Valbrand // viggyfresh +// janb87 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -113,8 +114,8 @@ export interface Meta { export interface Action { type: string; - payload: Payload; - meta: Meta; + payload?: Payload; + meta?: Meta; query?: object; navKey?: Nullable; } @@ -193,9 +194,9 @@ export type Payload = object; export type ScrollUpdater = (performedByUser: boolean) => void; -export const NOT_FOUND: string; +export const NOT_FOUND: '@@redux-first-router/NOT_FOUND'; -export function actionToPath(action: ReceivedAction, routesMap: RoutesMap): string; +export function actionToPath(action: ReceivedAction, routesMap: RoutesMap, querySerializer?: QuerySerializer): string; export function back(): void; diff --git a/types/redux-first-router/redux-first-router-tests.ts b/types/redux-first-router/redux-first-router-tests.ts index 8b8a7b1c5d..39b00c7a94 100644 --- a/types/redux-first-router/redux-first-router-tests.ts +++ b/types/redux-first-router/redux-first-router-tests.ts @@ -1,4 +1,13 @@ -import { connectRoutes, LocationState, RoutesMap } from 'redux-first-router'; +import { + connectRoutes, + LocationState, + RoutesMap, + actionToPath, + ReceivedAction, + redirect, + Action as ReduxFirstRouterAction, + QuerySerializer +} from 'redux-first-router'; import { createStore, applyMiddleware, @@ -40,5 +49,22 @@ const storeEnhancer = compose(enhancer const store = createStore(reducer, storeEnhancer); +const receivedAction: ReceivedAction = { + type: 'HOME', + payload: {} +}; +actionToPath(receivedAction, routesMap); // $ExpectType string + +const querySerializer: QuerySerializer = { + stringify: (params) => '', + parse: (queryString) => ({}) +}; +actionToPath(receivedAction, routesMap, querySerializer); // $ExpectType string + +const action: ReduxFirstRouterAction = { + type: 'HOME' +}; +redirect(action); // $ExpectType Action + // $ExpectType Store store; From 59f0906db672253ded14c731a4f17d66b438eb81 Mon Sep 17 00:00:00 2001 From: Tiago Moraes Date: Thu, 26 Oct 2017 15:41:37 -0300 Subject: [PATCH 20/78] update detect-browser to version 2.0 (#20718) --- types/detect-browser/detect-browser-tests.ts | 10 ++- types/detect-browser/index.d.ts | 31 +++++--- types/detect-browser/tsconfig.json | 2 +- types/detect-browser/tslint.json | 79 ++------------------ 4 files changed, 34 insertions(+), 88 deletions(-) diff --git a/types/detect-browser/detect-browser-tests.ts b/types/detect-browser/detect-browser-tests.ts index 336da5150a..48abb964f8 100644 --- a/types/detect-browser/detect-browser-tests.ts +++ b/types/detect-browser/detect-browser-tests.ts @@ -1,5 +1,7 @@ +import { detect } from 'detect-browser'; +const browser = detect(); -import detectBrowser = require("detect-browser"); - -const n: string = detectBrowser.name; -const v: string = detectBrowser.version; +if (browser) { + const name: string = browser.name; + const version: string = browser.version; +} diff --git a/types/detect-browser/index.d.ts b/types/detect-browser/index.d.ts index 57ed80c411..351067ff59 100644 --- a/types/detect-browser/index.d.ts +++ b/types/detect-browser/index.d.ts @@ -1,14 +1,27 @@ -// Type definitions for detect-browser v1.6.2 +// Type definitions for detect-browser 2.0 // Project: https://github.com/DamonOehlman/detect-browser // Definitions by: Rogier Schouten // Definitions: https://github.com/borisyankov/DefinitelyTyped -/** - * Browser name - */ -export const name: "edge" | "yandexbrowser" | "chrome" | "crios" | "firefox" | "opera" | "ie" | "bb10" | "android" | "ios" | "safari"; +export type BrowserName = + "android" | + "bb10" | + "chrome" | + "crios" | + "edge" | + "firefox" | + "fxios" | + "ie" | + "ios" | + "kakaotalk" | + "opera" | + "phantomjs" | + "safari" | + "vivaldi" | + "yandexbrowser"; -/** - * Browser version - */ -export const version: string; +export function detect(): null | { + name: BrowserName | "node"; + version: string; + os: string; +}; diff --git a/types/detect-browser/tsconfig.json b/types/detect-browser/tsconfig.json index 076582077e..b1319407fc 100644 --- a/types/detect-browser/tsconfig.json +++ b/types/detect-browser/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/detect-browser/tslint.json b/types/detect-browser/tslint.json index a41bf5d19a..dc8ddaa586 100644 --- a/types/detect-browser/tslint.json +++ b/types/detect-browser/tslint.json @@ -1,79 +1,10 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "indent": [ + true, + "spaces", + 4 + ] } } From 8a6a758e904b2f52ea785b472b40f5fe7a85947e Mon Sep 17 00:00:00 2001 From: "ohze.net" Date: Fri, 27 Oct 2017 01:46:09 +0700 Subject: [PATCH 21/78] add `angular.element(callback)` (#21011) see document for `ready()` method at https://docs.angularjs.org/api/ng/function/angular.element#angularjs-s-jqlite --- types/angular/angular-tests.ts | 3 +++ types/angular/jqlite.d.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 6d8b11bffe..9c0671601f 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -644,6 +644,9 @@ isolateScope = element.find('div').isolateScope(); isolateScope = element.children().isolateScope(); let element2 = angular.element(element); let elementArray = angular.element(document.querySelectorAll('div')); +let elementReadyFn = angular.element(() => { + console.log('ready'); +}); // $timeout signature tests namespace TestTimeout { diff --git a/types/angular/jqlite.d.ts b/types/angular/jqlite.d.ts index 858201fb18..a9da89cf65 100644 --- a/types/angular/jqlite.d.ts +++ b/types/angular/jqlite.d.ts @@ -684,7 +684,7 @@ interface JQuery { } interface JQueryStatic { - (element: string | Element | Document | JQuery | ArrayLike): JQLite; + (element: string | Element | Document | JQuery | ArrayLike | (() => void)): JQLite; } /** From fe25b8915d6520837ddb6dcd022bdb74fbe7a0d8 Mon Sep 17 00:00:00 2001 From: Josh Goldberg Date: Thu, 26 Oct 2017 11:47:28 -0700 Subject: [PATCH 22/78] Added missing ...args to setInterval, setTimeout (#21020) The methods should be able to take them. --- types/lolex/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/lolex/index.d.ts b/types/lolex/index.d.ts index de08060883..c0dec4cd56 100644 --- a/types/lolex/index.d.ts +++ b/types/lolex/index.d.ts @@ -70,9 +70,10 @@ export interface LolexClock { * * @param callback Callback to be fired. * @param timeout How many ticks to wait to run the callback. + * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ - setTimeout(callback: () => any, timeout: number): TTimerId; + setTimeout(callback: () => any, timeout: number, ...args: any[]): TTimerId; /** * Clears a timer, as long as it was created using setTimeout. @@ -86,9 +87,10 @@ export interface LolexClock { * * @param callback Callback to be fired. * @param timeout How many ticks to wait between callbacks. + * @param args Any extra arguments to pass to the callback. * @returns Time identifier for cancellation. */ - setInterval(callback: () => any, timeout: number): TTimerId; + setInterval(callback: () => any, timeout: number, ...args: any[]): TTimerId; /** * Clears a timer, as long as it was created using setInterval. From 7d7bd099fce96ec22ed36318ec15f279963d8b34 Mon Sep 17 00:00:00 2001 From: deadNightTiger Date: Thu, 26 Oct 2017 22:48:05 +0400 Subject: [PATCH 23/78] Add types for jest-json-schema (#20991) --- types/jest-json-schema/index.d.ts | 19 +++++++++++++++ .../jest-json-schema-tests.ts | 13 +++++++++++ types/jest-json-schema/package.json | 6 +++++ types/jest-json-schema/tsconfig.json | 23 +++++++++++++++++++ types/jest-json-schema/tslint.json | 1 + 5 files changed, 62 insertions(+) create mode 100644 types/jest-json-schema/index.d.ts create mode 100644 types/jest-json-schema/jest-json-schema-tests.ts create mode 100644 types/jest-json-schema/package.json create mode 100644 types/jest-json-schema/tsconfig.json create mode 100644 types/jest-json-schema/tslint.json diff --git a/types/jest-json-schema/index.d.ts b/types/jest-json-schema/index.d.ts new file mode 100644 index 0000000000..67f1c51f7e --- /dev/null +++ b/types/jest-json-schema/index.d.ts @@ -0,0 +1,19 @@ +// Type definitions for jest-json-schema 1.2 +// Project: https://github.com/americanexpress/jest-json-schema#readme +// Definitions by: Igor Korolev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +/// +import * as ajv from "ajv"; + +declare global { + namespace jest { + interface Matchers { + toMatchSchema(schema: object): R; + } + } +} + +export const matchers: jest.ExpectExtendMap; +export function matchersWithOptions(options: ajv.Options): jest.ExpectExtendMap; diff --git a/types/jest-json-schema/jest-json-schema-tests.ts b/types/jest-json-schema/jest-json-schema-tests.ts new file mode 100644 index 0000000000..a66c54a7e9 --- /dev/null +++ b/types/jest-json-schema/jest-json-schema-tests.ts @@ -0,0 +1,13 @@ +import { matchers } from 'jest-json-schema'; + +expect.extend(matchers); + +it('validates my json', () => { + const schema = { + properties: { + hello: { type: 'string' }, + }, + required: ['hello'], + }; + expect({ hello: 'world' }).toMatchSchema(schema); +}); diff --git a/types/jest-json-schema/package.json b/types/jest-json-schema/package.json new file mode 100644 index 0000000000..ee16c03768 --- /dev/null +++ b/types/jest-json-schema/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "ajv": "^4.11.5" + } +} diff --git a/types/jest-json-schema/tsconfig.json b/types/jest-json-schema/tsconfig.json new file mode 100644 index 0000000000..e8d55cbd89 --- /dev/null +++ b/types/jest-json-schema/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "jest-json-schema-tests.ts" + ] +} diff --git a/types/jest-json-schema/tslint.json b/types/jest-json-schema/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/jest-json-schema/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 73823c7492a83f0f83c9ac2b86181c9408513cd5 Mon Sep 17 00:00:00 2001 From: Jay Ongg Date: Thu, 26 Oct 2017 11:50:24 -0700 Subject: [PATCH 24/78] Update version number to 1.2 (#21016) --- types/microsoftteams/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/microsoftteams/index.d.ts b/types/microsoftteams/index.d.ts index 669488a7df..4ff2d9813a 100644 --- a/types/microsoftteams/index.d.ts +++ b/types/microsoftteams/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for microsoftteams 1.1 +// Type definitions for microsoftteams 1.2 // Project: https://github.com/OfficeDev/microsoft-teams-library-js // Definitions by: Bhargav Krishna // Jay Ongg From 0ec4bb301caa4e3c6cdd036cc442baf76d10d675 Mon Sep 17 00:00:00 2001 From: Erik Mavrinac Date: Thu, 26 Oct 2017 11:53:10 -0700 Subject: [PATCH 25/78] Add types for express-ejs-layouts NPM package (#20992) * Revert "Add tsline file" This reverts commit a0f8c9acc3e6adab166ea0e65e871203a504e5f3. * Revert "Rename .d.ts file per guidelines" This reverts commit 7eb6f76ab53988f7cbec6fb27ecb4b06785bdc25. * Revert "Add types for ZeroMQ.js, derived from the 'zmq' type definitions" This reverts commit d5d3cd0fca29f1202453fac0fb4c14faa380269f. * Add types for express-ejs-layouts NPM package * Fix PR comment on tests --- .../express-ejs-layouts-tests.ts | 7 ++++++ types/express-ejs-layouts/index.d.ts | 15 ++++++++++++ types/express-ejs-layouts/tsconfig.json | 23 +++++++++++++++++++ types/express-ejs-layouts/tslint.json | 3 +++ 4 files changed, 48 insertions(+) create mode 100644 types/express-ejs-layouts/express-ejs-layouts-tests.ts create mode 100644 types/express-ejs-layouts/index.d.ts create mode 100644 types/express-ejs-layouts/tsconfig.json create mode 100644 types/express-ejs-layouts/tslint.json diff --git a/types/express-ejs-layouts/express-ejs-layouts-tests.ts b/types/express-ejs-layouts/express-ejs-layouts-tests.ts new file mode 100644 index 0000000000..9d77105a9d --- /dev/null +++ b/types/express-ejs-layouts/express-ejs-layouts-tests.ts @@ -0,0 +1,7 @@ +import * as express from 'express'; +import * as expressEjsLayouts from 'express-ejs-layouts'; + +function expressRequestHandlerTest() { + const app = express() + .use(expressEjsLayouts()); +} diff --git a/types/express-ejs-layouts/index.d.ts b/types/express-ejs-layouts/index.d.ts new file mode 100644 index 0000000000..b9c87cf5c1 --- /dev/null +++ b/types/express-ejs-layouts/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for express-ejs-layouts 2.3 +// Project: https://github.com/Soarez/express-ejs-layouts +// Definitions by: Erik Mavrinac +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { RequestHandler } from 'express'; + +declare function expressEjsLayouts(): RequestHandler; + +declare namespace expressEjsLayouts { +} + +export = expressEjsLayouts; diff --git a/types/express-ejs-layouts/tsconfig.json b/types/express-ejs-layouts/tsconfig.json new file mode 100644 index 0000000000..7ade9f8819 --- /dev/null +++ b/types/express-ejs-layouts/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "express-ejs-layouts-tests.ts" + ] +} diff --git a/types/express-ejs-layouts/tslint.json b/types/express-ejs-layouts/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/express-ejs-layouts/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} From 5761cfc6f2bb9de0af9085e4f119d0ef590c500e Mon Sep 17 00:00:00 2001 From: Andy Date: Thu, 26 Oct 2017 12:25:08 -0700 Subject: [PATCH 26/78] express-serve-static-core: Restore compatibility with ts2.1 (#21044) --- types/body-parser/index.d.ts | 2 +- types/express-rate-limit/index.d.ts | 2 +- types/express-serve-static-core/index.d.ts | 17 +++++++---------- types/express-session/index.d.ts | 2 +- types/express/express-tests.ts | 7 +++---- types/express/index.d.ts | 9 ++------- types/i18n/index.d.ts | 2 +- types/koa-morgan/index.d.ts | 2 +- types/morgan/index.d.ts | 2 +- types/multer/index.d.ts | 2 +- types/oauth2-server/index.d.ts | 2 +- types/optics-agent/index.d.ts | 2 +- types/passport-oauth2/index.d.ts | 2 +- types/passport-saml/index.d.ts | 2 +- types/swagger-node-runner/index.d.ts | 2 +- 15 files changed, 24 insertions(+), 33 deletions(-) diff --git a/types/body-parser/index.d.ts b/types/body-parser/index.d.ts index 497f3c8dc7..b4943e8023 100644 --- a/types/body-parser/index.d.ts +++ b/types/body-parser/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/expressjs/body-parser // Definitions by: Santi Albo , Vilic Vane , Jonathan Häberle , Gevik Babakhani , Tomasz Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 /// diff --git a/types/express-rate-limit/index.d.ts b/types/express-rate-limit/index.d.ts index cb0d16ec61..fe8d8e4284 100644 --- a/types/express-rate-limit/index.d.ts +++ b/types/express-rate-limit/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/nfriedly/express-rate-limit // Definitions by: Cyril Schumacher , makepost // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 import express = require("express"); diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index 6d8b771e58..b0e463306d 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -2,6 +2,8 @@ // Project: http://expressjs.com // Definitions by: Boris Yankov , Michał Lytek , Kacper Polak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + // This extracts the core definitions from express to prevent a circular dependency between express and serve-static /// @@ -174,12 +176,7 @@ interface RequestRanges extends Array { type: string; } interface Errback { (err: Error): void; } -interface Request< - Body = any, - Query = any, - Params = any, - Cookies = any -> extends http.IncomingMessage, Express.Request { +interface Request extends http.IncomingMessage, Express.Request { /** * Return request header. @@ -440,14 +437,14 @@ interface Request< xhr: boolean; //body: { username: string; password: string; remember: boolean; title: string; }; - body: Body; + body: any; //cookies: { string; remember: boolean; }; - cookies: Cookies; + cookies: any; method: string; - params: Params; + params: any; /** * Clear cookie `name`. @@ -457,7 +454,7 @@ interface Request< */ clearCookie(name: string, options?: any): Response; - query: Query; + query: any; route: any; diff --git a/types/express-session/index.d.ts b/types/express-session/index.d.ts index 8c5faa7873..be289b9940 100644 --- a/types/express-session/index.d.ts +++ b/types/express-session/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Definitions by: Jacob Bogers diff --git a/types/express/express-tests.ts b/types/express/express-tests.ts index d578a24886..0c1081b49b 100644 --- a/types/express/express-tests.ts +++ b/types/express/express-tests.ts @@ -17,10 +17,9 @@ namespace express_tests { next(); }); - app.use((err: any, req: express.Request<{ hello: string; }>, res: express.Response, next: express.NextFunction) => { - console.log(req.body.hello); - console.error(err); - next(err); + app.use((err: any, req: express.Request, res: express.Response, next: express.NextFunction) => { + console.error(err); + next(err); }); app.get('/', (req, res) => { diff --git a/types/express/index.d.ts b/types/express/index.d.ts index 66bf4180c8..59f60e92df 100644 --- a/types/express/index.d.ts +++ b/types/express/index.d.ts @@ -2,7 +2,7 @@ // Project: http://expressjs.com // Definitions by: Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.2 /* =================== USAGE =================== @@ -76,12 +76,7 @@ declare namespace e { interface IRouterMatcher extends core.IRouterMatcher { } interface MediaType extends core.MediaType { } interface NextFunction extends core.NextFunction { } - interface Request< - Body = any, - Query = any, - Params = any, - Cookies = any - > extends core.Request { } + interface Request extends core.Request { } interface RequestHandler extends core.RequestHandler { } interface RequestParamHandler extends core.RequestParamHandler { } export interface Response extends core.Response { } diff --git a/types/i18n/index.d.ts b/types/i18n/index.d.ts index 0ddc39ffbf..6ed7e9fb8a 100644 --- a/types/i18n/index.d.ts +++ b/types/i18n/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Maxime LUCE // FindQ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 declare namespace i18n { interface ConfigurationOptions { diff --git a/types/koa-morgan/index.d.ts b/types/koa-morgan/index.d.ts index f52baa788c..b4be38122b 100644 --- a/types/koa-morgan/index.d.ts +++ b/types/koa-morgan/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/koa-modules/morgan // Definitions by: Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 import { IncomingMessage, ServerResponse } from 'http'; import * as Koa from 'koa'; diff --git a/types/morgan/index.d.ts b/types/morgan/index.d.ts index 1558f24ee4..097758465a 100644 --- a/types/morgan/index.d.ts +++ b/types/morgan/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: James Roland Cabresos // Paolo Scanferla // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.2 import express = require('express'); diff --git a/types/multer/index.d.ts b/types/multer/index.d.ts index 5c300a5585..d6e73f9ddf 100644 --- a/types/multer/index.d.ts +++ b/types/multer/index.d.ts @@ -6,7 +6,7 @@ // Michael Ledin // HyunSeob Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 import * as express from 'express'; diff --git a/types/oauth2-server/index.d.ts b/types/oauth2-server/index.d.ts index 93e3e9398b..44d158690a 100644 --- a/types/oauth2-server/index.d.ts +++ b/types/oauth2-server/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Robbie Van Gorkom , // Charles Irick // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 import { Request, RequestHandler } from "express"; diff --git a/types/optics-agent/index.d.ts b/types/optics-agent/index.d.ts index 496437994f..b4c171bdd8 100644 --- a/types/optics-agent/index.d.ts +++ b/types/optics-agent/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/apollostack/optics-agent-js#readme // Definitions by: Crevil // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 import { GraphQLSchema } from "graphql"; import { Request, Response } from "express"; diff --git a/types/passport-oauth2/index.d.ts b/types/passport-oauth2/index.d.ts index 09facb2ef7..6be0c6ad44 100644 --- a/types/passport-oauth2/index.d.ts +++ b/types/passport-oauth2/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jaredhanson/passport-oauth2#readme // Definitions by: Pasi Eronen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.2 import { Request } from 'express'; import { Strategy } from 'passport'; diff --git a/types/passport-saml/index.d.ts b/types/passport-saml/index.d.ts index e93869ca87..930a05dbfe 100644 --- a/types/passport-saml/index.d.ts +++ b/types/passport-saml/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bergie/passport-saml // Definitions by: Chris Barth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.1 import passport = require('passport'); import express = require('express'); diff --git a/types/swagger-node-runner/index.d.ts b/types/swagger-node-runner/index.d.ts index 89af13679d..92ee7919dd 100644 --- a/types/swagger-node-runner/index.d.ts +++ b/types/swagger-node-runner/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/swagger-node-runner // Definitions by: Michael Mrowetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.2 /* =================== USAGE =================== From a83743d071bcad41dee30cfa07ffc7f59c116699 Mon Sep 17 00:00:00 2001 From: segayuu Date: Fri, 27 Oct 2017 14:25:44 +0900 Subject: [PATCH 27/78] [WIP] cleanup lint error: max-line-length(490->280) --- types/bluebird/index.d.ts | 282 +++++++++++++++++++++++++++++-------- types/bluebird/tslint.json | 2 +- 2 files changed, 223 insertions(+), 61 deletions(-) diff --git a/types/bluebird/index.d.ts b/types/bluebird/index.d.ts index 9046d082fb..ba7a8bd172 100644 --- a/types/bluebird/index.d.ts +++ b/types/bluebird/index.d.ts @@ -43,14 +43,21 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { constructor(callback: (resolve: (thenableOrResult?: R | PromiseLike) => void, reject: (error?: any) => void, onCancel?: (callback: () => void) => void) => void); /** - * Promises/A+ `.then()`. Returns a new promise chained from this promise. The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. + * Promises/A+ `.then()`. Returns a new promise chained from this promise. + * + * The new promise will be rejected or resolved dedefer on the passed `fulfilledHandler`, `rejectedHandler` and the state of this promise. */ // Based on PromiseLike.then, but returns a Bluebird instance. then(onFulfill?: (value: R) => U | PromiseLike, onReject?: (error: any) => U | PromiseLike): Bluebird; // For simpler signature help. - then(onfulfilled?: ((value: R) => TResult1 | PromiseLike) | null, onrejected?: ((reason: any) => TResult2 | PromiseLike) | null): Bluebird; + then( + onfulfilled?: ((value: R) => TResult1 | PromiseLike) | null, + onrejected?: ((reason: any) => TResult2 | PromiseLike) | null + ): Bluebird; /** - * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. + * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. + * + * Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. * * Alias `.caught();` for compatibility with earlier ECMAScript version. */ @@ -58,9 +65,15 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { catch(onReject: ((error: any) => U | PromiseLike) | undefined | null): Bluebird; /** - * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * This extends `.catch` to work more like catch-clauses in languages like Java or C#. * - * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. + * Instead of manually checking `instanceof` or `.name === "SomeError"`, + * you may specify a number of error constructors which are eligible for this catch handler. + * The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * + * This method also supports predicate-based filters. + * If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. + * The return result of the predicate will be used determine whether the error handler should be called. * * Alias `.caught();` for compatibility with earlier ECMAScript version. */ @@ -190,7 +203,9 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { ): Bluebird; /** - * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. + * This is a catch-all exception handler, shortcut for calling `.then(null, handler)` on this promise. + * + * Any exception happening in a `.then`-chain will propagate to nearest `.catch` handler. * * Alias `.caught();` for compatibility with earlier ECMAScript version. */ @@ -198,9 +213,13 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { caught(onReject: ((error: any) => U | PromiseLike) | undefined | null): Bluebird; /** - * This extends `.catch` to work more like catch-clauses in languages like Java or C#. Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * This extends `.catch` to work more like catch-clauses in languages like Java or C#. * - * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. The return result of the predicate will be used determine whether the error handler should be called. + * Instead of manually checking `instanceof` or `.name === "SomeError"`, you may specify a number of error constructors which are eligible for this catch handler. + * The catch handler that is first met that has eligible constructors specified, is the one that will be called. + * + * This method also supports predicate-based filters. If you pass a predicate function instead of an error constructor, the predicate will receive the error as an argument. + * The return result of the predicate will be used determine whether the error handler should be called. * * Alias `.caught();` for compatibility with earlier ECMAScript version. */ @@ -335,7 +354,9 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { error(onReject: (reason: any) => U | PromiseLike): Bluebird; /** - * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. There are special semantics for `.finally()` in that the final value cannot be modified from the handler. + * Pass a handler that will be called regardless of this promise's fate. Returns a new promise chained from this promise. + * + * There are special semantics for `.finally()` in that the final value cannot be modified from the handler. * * Alias `.lastly();` for compatibility with earlier ECMAScript version. */ @@ -344,7 +365,9 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { lastly(handler: () => U | PromiseLike): Bluebird; /** - * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. + * Create a promise that follows this promise, but is bound to the given `thisArg` value. A bound promise will call its handlers with the bound value set to `this`. + * + * Additionally promises derived from a bound promise will also be bound promises with the same `thisArg` binding as the original promise. */ bind(thisArg: any): Bluebird; @@ -409,7 +432,11 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { timeout(ms: number, message?: string | Error): Bluebird; /** - * Register a node-style callback on this promise. When this promise is is either fulfilled or rejected, the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. The error argument will be `null` in case of success. + * Register a node-style callback on this promise. + * + * When this promise is is either fulfilled or rejected, + * the node callback will be called back with the node.js convention where error reason is the first argument and success value is the second argument. + * The error argument will be `null` in case of success. * If the `callback` argument is not a function, this method does not do anything. */ nodeify(callback: (err: any, value?: R) => void, options?: Bluebird.SpreadOption): this; @@ -694,7 +721,8 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { /** * Start the chain of promises with `Promise.try`. Any synchronous exceptions will be turned into rejections on the returned promise. * - * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. Otherwise it is passed as is as the first argument for the function call. + * Note about second argument: if it's specifically a true array, its values become respective arguments for the function call. + * Otherwise it is passed as is as the first argument for the function call. * * Alias for `attempt();` for compatibility with earlier ECMAScript version. */ @@ -702,7 +730,8 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static attempt(fn: () => R | PromiseLike): Bluebird; /** - * Returns a new function that wraps the given function `fn`. The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. + * Returns a new function that wraps the given function `fn`. + * The new function will always return a promise that is fulfilled with the original functions return values or rejected with thrown exceptions from the original function. * This method is convenient when a function can sometimes return synchronously or throw synchronously. */ static method(fn: (arg1: A1) => R | PromiseLike): (arg1: A1) => Bluebird; @@ -729,7 +758,10 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static defer(): Bluebird.Resolver; /** - * Cast the given `value` to a trusted promise. If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. + * Cast the given `value` to a trusted promise. + * + * If `value` is already a trusted `Promise`, it is returned as is. If `value` is not a thenable, a fulfilled is: Promise returned with `value` as its fulfillment value. + * If `value` is a thenable (Promise-like object, like those returned by jQuery's `$.ajax`), returns a trusted that: Promise assimilates the state of the thenable. */ static cast(value: R | PromiseLike): Bluebird; @@ -744,7 +776,10 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static is(value: any): boolean; /** - * Call this right after the library is loaded to enabled long stack traces. Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. + * Call this right after the library is loaded to enabled long stack traces. + * + * Long stack traces cannot be disabled after being enabled, and cannot be enabled after promises have already been created. + * Long stack traces imply a substantial performance penalty, around 4-5x for throughput and 0.5x for latency. */ static longStackTraces(): void; @@ -757,24 +792,49 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static delay(ms: number): Bluebird; /** - * Returns a function that will wrap the given `nodeFunction`. Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. The node function should conform to node.js convention of accepting a callback as last argument and calling that callback with error as the first argument and success value on the second argument. + * Returns a function that will wrap the given `nodeFunction`. + * + * Instead of taking a callback, the returned function will return a promise whose fate is decided by the callback behavior of the given node function. + * The node function should conform to node.js convention of accepting a callback as last argument and + * calling that callback with error as the first argument and success value on the second argument. * * If the `nodeFunction` calls its callback with multiple success values, the fulfillment value will be an array of them. * * If you pass a `receiver`, the `nodeFunction` will be called as a method on the `receiver`. */ - static promisify(func: (callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): () => Bluebird; - static promisify(func: (arg1: A1, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1) => Bluebird; - static promisify(func: (arg1: A1, arg2: A2, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2) => Bluebird; - static promisify(func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3) => Bluebird; - static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird; - static promisify(func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void, options?: Bluebird.PromisifyOptions): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird; + static promisify( + func: (callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions + ): () => Bluebird; + static promisify( + func: (arg1: A1, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions + ): (arg1: A1) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions + ): (arg1: A1, arg2: A2) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, arg3: A3, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions + ): (arg1: A1, arg2: A2, arg3: A3) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions + ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => Bluebird; + static promisify( + func: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5, callback: (err: any, result?: T) => void) => void, + options?: Bluebird.PromisifyOptions + ): (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => Bluebird; static promisify(nodeFunction: (...args: any[]) => void, options?: Bluebird.PromisifyOptions): (...args: any[]) => Bluebird; /** - * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. The promisified method name will be the original method name postfixed with `Async`. Returns the input object. + * Promisifies the entire object by going through the object's properties and creating an async equivalent of each function on the object and its prototype chain. * - * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. + * The promisified method name will be the original method name postfixed with `Async`. Returns the input object. + * + * Note that the original methods on the object are not overwritten but new methods are created with the `Async`-postfix. For example, + * if you `promisifyAll()` the node.js `fs` object use `fs.statAsync()` to call the promisified `stat` method. */ // TODO how to model promisifyAll? static promisifyAll(target: T, options?: Bluebird.PromisifyAllOptions): T; @@ -788,19 +848,49 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static fromCallback(resolver: (callback: (err: any, result?: T) => void) => void, options?: Bluebird.FromNodeOptions): Bluebird; /** - * Returns a function that can use `yield` to run asynchronous code synchronously. This feature requires the support of generators which are drafted in the next version of the language. Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. + * Returns a function that can use `yield` to run asynchronous code synchronously. + * + * This feature requires the support of generators which are drafted in the next version of the language. + * Node version greater than `0.11.2` is required and needs to be executed with the `--harmony-generators` (or `--harmony`) command-line switch. */ // TODO: After https://github.com/Microsoft/TypeScript/issues/2983 is implemented, we can use // the return type propagation of generators to automatically infer the return type T. - static coroutine(generatorFunction: () => IterableIterator, options?: Bluebird.CoroutineOptions): () => Bluebird; - static coroutine(generatorFunction: (a1: A1) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1) => Bluebird; - static coroutine(generatorFunction: (a1: A1, a2: A2) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2) => Bluebird; - static coroutine(generatorFunction: (a1: A1, a2: A2, a3: A3) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3) => Bluebird; - static coroutine(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4) => Bluebird; - static coroutine(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Bluebird; - static coroutine(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Bluebird; - static coroutine(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Bluebird; - static coroutine(generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator, options?: Bluebird.CoroutineOptions): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Bluebird; + static coroutine( + generatorFunction: () => IterableIterator, + options?: Bluebird.CoroutineOptions + ): () => Bluebird; + static coroutine( + generatorFunction: (a1: A1) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1, a2: A2) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1, a2: A2, a3: A3) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1, a2: A2, a3: A3, a4: A4) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7) => Bluebird; + static coroutine( + generatorFunction: (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => IterableIterator, + options?: Bluebird.CoroutineOptions + ): (a1: A1, a2: A2, a3: A3, a4: A4, a5: A5, a6: A6, a7: A7, a8: A8) => Bluebird; /** * Add `handler` as the handler to call when there is a possibly unhandled rejection. The default handler logs the error stack to stderr or `console.error` in browsers. @@ -820,7 +910,9 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static onPossiblyUnhandledRejection(handler?: (error: Error, promise: Bluebird) => void): void; /** - * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. If any promise in the array rejects, the returned promise is rejected with the rejection reason. + * Given an array, or a promise of an array, which contains promises (or a mix of promises and values) return a promise that is fulfilled when all the items in the array are fulfilled. + * The promise's fulfillment value is an array with fulfillment values at respective positions to the original array. + * If any promise in the array rejects, the returned promise is rejected with the rejection reason. */ // TODO enable more overloads // array with promises of different types @@ -833,9 +925,13 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static all(values: PromiseLike | R>> | Iterable | R>): Bluebird; /** - * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. If any promise in the object rejects, the returned promise is rejected with the rejection reason. + * Like ``Promise.all`` but for object properties instead of array items. Returns a promise that is fulfilled when all the properties of the object are fulfilled. * - * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. + * The promise's fulfillment value is an object with fulfillment values at respective keys to the original object. + * If any promise in the object rejects, the returned promise is rejected with the rejection reason. + * + * If `object` is a trusted `Promise`, then it will be treated as a promise for object rather than for its properties. + * All other objects are treated for their properties as is returned by `Object.keys` - the object's own enumerable properties. * * *The original object is not modified.* */ @@ -859,7 +955,8 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { static race(values: PromiseLike | R>> | Iterable | R>): Bluebird; /** - * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. + * Initiate a competetive race between multiple promises or values (values will become immediately fulfilled promises). + * When `count` amount of promises have been fulfilled, the returned promise is fulfilled with an array that contains the fulfillment values of the winners in order of resolution. * * If too many promises are rejected so that the promise can never become fulfilled, it will be immediately rejected with an array of rejection reasons in the order they were thrown in. * @@ -874,60 +971,112 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { * ) -> Promise * For coordinating multiple concurrent discrete promises. * - * Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array. This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply + * Note: In 1.x and 0.x Promise.join used to be a Promise.all that took the values in as arguments instead in an array. + * This behavior has been deprecated but is still supported partially - when the last argument is an immediate function value the new semantics will apply */ - static join(arg1: A1 | PromiseLike, handler: (arg1: A1) => R | PromiseLike): Bluebird; - static join(arg1: A1 | PromiseLike, arg2: A2 | PromiseLike, handler: (arg1: A1, arg2: A2) => R | PromiseLike): Bluebird; - static join(arg1: A1 | PromiseLike, arg2: A2 | PromiseLike, arg3: A3 | PromiseLike, handler: (arg1: A1, arg2: A2, arg3: A3) => R | PromiseLike): Bluebird; - static join(arg1: A1 | PromiseLike, arg2: A2 | PromiseLike, arg3: A3 | PromiseLike, arg4: A4 | PromiseLike, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R | PromiseLike): Bluebird; - static join(arg1: A1 | PromiseLike, arg2: A2 | PromiseLike, arg3: A3 | PromiseLike, arg4: A4 | PromiseLike, arg5: A5 | PromiseLike, handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R | PromiseLike): Bluebird; + static join( + arg1: A1 | PromiseLike, + handler: (arg1: A1) => R | PromiseLike + ): Bluebird; + static join( + arg1: A1 | PromiseLike, + arg2: A2 | PromiseLike, + handler: (arg1: A1, arg2: A2) => R | PromiseLike + ): Bluebird; + static join( + arg1: A1 | PromiseLike, + arg2: A2 | PromiseLike, + arg3: A3 | PromiseLike, + handler: (arg1: A1, arg2: A2, arg3: A3) => R | PromiseLike + ): Bluebird; + static join( + arg1: A1 | PromiseLike, + arg2: A2 | PromiseLike, + arg3: A3 | PromiseLike, + arg4: A4 | PromiseLike, + handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4) => R | PromiseLike + ): Bluebird; + static join( + arg1: A1 | PromiseLike, + arg2: A2 | PromiseLike, + arg3: A3 | PromiseLike, + arg4: A4 | PromiseLike, + arg5: A5 | PromiseLike, + handler: (arg1: A1, arg2: A2, arg3: A3, arg4: A4, arg5: A5) => R | PromiseLike + ): Bluebird; // variadic array /** @deprecated use .all instead */ static join(...values: Array>): Bluebird; /** - * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * Map an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `mapper` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. + * If any promise in the input array is rejected the returned promise is rejected as well. * * If the `mapper` function returns promises or thenables, the returned promise will wait for all the mapped results to be resolved as well. * * *The original array is not modified.* */ - static map(values: PromiseLike | R>> | Iterable | R>, mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike, options?: Bluebird.ConcurrencyOption): Bluebird; + static map( + values: PromiseLike | R>> | Iterable | R>, + mapper: (item: R, index: number, arrayLength: number) => U | PromiseLike, + options?: Bluebird.ConcurrencyOption + ): Bluebird; /** - * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * Reduce an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `reducer` function with the signature `(total, current, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. + * If any promise in the input array is rejected the returned promise is rejected as well. * * If the reducer function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. * - * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* + * *The original array is not modified. If no `intialValue` is given and the array doesn't contain at least 2 items, the callback will not be called and `undefined` is returned. + * If `initialValue` is given and the array doesn't have at least 1 item, `initialValue` is returned.* */ - static reduce(values: PromiseLike | R>> | Iterable | R>, reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike, initialValue?: U): Bluebird; + static reduce( + values: PromiseLike | R>> | Iterable | R>, + reducer: (total: U, current: R, index: number, arrayLength: number) => U | PromiseLike, + initialValue?: U + ): Bluebird; /** - * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. If any promise in the input array is rejected the returned promise is rejected as well. + * Filter an array, or a promise of an array, which contains a promises (or a mix of promises and values) with the given `filterer` function with the signature `(item, index, arrayLength)` where `item` is the resolved value of a respective promise in the input array. + * If any promise in the input array is rejected the returned promise is rejected as well. * * The return values from the filtered functions are coerced to booleans, with the exception of promises and thenables which are awaited for their eventual result. * * *The original array is not modified. */ - static filter(values: PromiseLike | R>> | Iterable | R>, filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike, option?: Bluebird.ConcurrencyOption): Bluebird; + static filter( + values: PromiseLike | R>> | Iterable | R>, + filterer: (item: R, index: number, arrayLength: number) => boolean | PromiseLike, + option?: Bluebird.ConcurrencyOption + ): Bluebird; /** - * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. + * Iterate over an array, or a promise of an array, which contains promises (or a mix of promises and values) with the given iterator function with the signature (item, index, value) where item is the resolved value of a respective promise in the input array. + * Iteration happens serially. If any promise in the input array is rejected the returned promise is rejected as well. * - * Resolves to the original array unmodified, this method is meant to be used for side effects. If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. + * Resolves to the original array unmodified, this method is meant to be used for side effects. + * If the iterator function returns a promise or a thenable, the result for the promise is awaited for before continuing with next iteration. */ - static each(values: PromiseLike | R>> | Iterable | R>, iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike): Bluebird; + static each( + values: PromiseLike | R>> | Iterable | R>, + iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike + ): Bluebird; /** * Given an Iterable(arrays are Iterable), or a promise of an Iterable, which produces promises (or a mix of promises and values), iterate over all the values in the Iterable into an array and iterate over the array serially, in-order. * - * Returns a promise for an array that contains the values returned by the iterator function in their respective positions. The iterator won't be called for an item until its previous item, and the promise returned by the iterator for that item are fulfilled. This results in a mapSeries kind of utility but it can also be used simply as a side effect iterator similar to Array#forEach. + * Returns a promise for an array that contains the values returned by the iterator function in their respective positions. + * The iterator won't be called for an item until its previous item, and the promise returned by the iterator for that item are fulfilled. + * This results in a mapSeries kind of utility but it can also be used simply as a side effect iterator similar to Array#forEach. * * If any promise in the input array is rejected or any promise returned by the iterator function is rejected, the result will be rejected as well. */ - static mapSeries(values: PromiseLike | R>> | Iterable | R>, iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike): Bluebird; + static mapSeries( + values: PromiseLike | R>> | Iterable | R>, + iterator: (item: R, index: number, arrayLength: number) => U | PromiseLike + ): Bluebird; /** * A meta method used to specify the disposer method that cleans up a resource when using `Promise.using`. @@ -946,9 +1095,21 @@ declare class Bluebird implements PromiseLike, Bluebird.Inspection { * will be called when the promise returned by the callback passed to using has settled. The disposer is * necessary because there is no standard interface in node for disposing resources. */ - static using(disposer: Bluebird.Disposer, executor: (transaction: R) => PromiseLike): Bluebird; - static using(disposer: Bluebird.Disposer, disposer2: Bluebird.Disposer, executor: (transaction1: R1, transaction2: R2) => PromiseLike): Bluebird; - static using(disposer: Bluebird.Disposer, disposer2: Bluebird.Disposer, disposer3: Bluebird.Disposer, executor: (transaction1: R1, transaction2: R2, transaction3: R3) => PromiseLike): Bluebird; + static using( + disposer: Bluebird.Disposer, + executor: (transaction: R) => PromiseLike + ): Bluebird; + static using( + disposer: Bluebird.Disposer, + disposer2: Bluebird.Disposer, + executor: (transaction1: R1, transaction2: R2 + ) => PromiseLike): Bluebird; + static using( + disposer: Bluebird.Disposer, + disposer2: Bluebird.Disposer, + disposer3: Bluebird.Disposer, + executor: (transaction1: R1, transaction2: R2, transaction3: R3) => PromiseLike + ): Bluebird; /** * Configure long stack traces, warnings, monitoring and cancellation. @@ -1083,7 +1244,8 @@ declare namespace Bluebird { reject(reason: any): void; /** - * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. + * Gives you a callback representation of the `PromiseResolver`. Note that this is not a method but a property. + * The callback accepts error object in first argument and success values on the 2nd parameter and the rest, I.E. node js conventions. * * If the the callback is called with multiple success values, the resolver fullfills its promise with an array of the values. */ diff --git a/types/bluebird/tslint.json b/types/bluebird/tslint.json index fa9263f910..6abaaba4e3 100644 --- a/types/bluebird/tslint.json +++ b/types/bluebird/tslint.json @@ -1,7 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { - "max-line-length": [true, 490], + "max-line-length": [true, 280], "no-unnecessary-generics": false, "prefer-const": false } From 54c6d449f27fc5a629cf24cebeeed00e4f7c2c5f Mon Sep 17 00:00:00 2001 From: Sverre Johansen Date: Fri, 27 Oct 2017 11:23:19 +0200 Subject: [PATCH 28/78] Added missing getItemLayout prop to SectionList --- types/react-native/index.d.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index 2dcec3f6eb..58af56a5ac 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -3743,6 +3743,18 @@ export interface SectionListProperties extends ScrollViewProperties { */ extraData?: any + /** + * `getItemLayout` is an optional optimization that lets us skip measurement of dynamic + * content if you know the height of items a priori. getItemLayout is the most efficient, + * and is easy to use if you have fixed height items, for example: + * ``` + * getItemLayout={(data, index) => ( + * {length: ITEM_HEIGHT, offset: ITEM_HEIGHT * index, index} + * )} + * ``` + */ + getItemLayout?: (data: SectionListData[] | null, index: number) => {length: number, offset: number, index: number} + /** * How many items to render in the initial batch */ From e65cb3ba52b39d5afc9be6a6bd7d0258ea6adfef Mon Sep 17 00:00:00 2001 From: rlindgren Date: Fri, 27 Oct 2017 11:34:52 -0400 Subject: [PATCH 29/78] iteratee callback and test fn define variable number of parameters type T --- types/async/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/async/index.d.ts b/types/async/index.d.ts index c94c8058c2..f1b38e8130 100644 --- a/types/async/index.d.ts +++ b/types/async/index.d.ts @@ -15,6 +15,7 @@ export interface AsyncResultArrayCallback { (err?: E, results?: (T | undef export interface AsyncResultObjectCallback { (err: E | undefined, results: Dictionary): void; } export interface AsyncFunction { (callback: (err?: E, result?: T) => void): void; } +export interface AsyncFunctionEx { (callback: (err?: E, ...results: T[]) => void): void; } export interface AsyncIterator { (item: T, callback: ErrorCallback): void; } export interface AsyncForEachOfIterator { (item: T, key: number|string, callback: ErrorCallback): void; } export interface AsyncResultIterator { (item: T, callback: AsyncResultCallback): void; } @@ -174,9 +175,9 @@ export function parallel(tasks: Dictionary>, callback? export function parallelLimit(tasks: Array>, limit: number, callback?: AsyncResultArrayCallback): void; export function parallelLimit(tasks: Dictionary>, limit: number, callback?: AsyncResultObjectCallback): void; export function whilst(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doWhilst(fn: AsyncFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; +export function doWhilst(fn: AsyncFunctionEx, test: (...results: T[]) => boolean, callback: ErrorCallback): void; export function until(test: () => boolean, fn: AsyncVoidFunction, callback: ErrorCallback): void; -export function doUntil(fn: AsyncFunction, test: (result?: any) => boolean, callback: ErrorCallback): void; +export function doUntil(fn: AsyncFunctionEx, test: (...results: T[]) => boolean, callback: ErrorCallback): void; export function during(test: (testCallback : AsyncBooleanResultCallback) => void, fn: AsyncVoidFunction, callback: ErrorCallback): void; export function doDuring(fn: AsyncVoidFunction, test: (testCallback: AsyncBooleanResultCallback) => void, callback: ErrorCallback): void; export function forever(next: (next : ErrorCallback) => void, errBack: ErrorCallback) : void; From 055cf34ca936e62d61639eadd77026ec51281eea Mon Sep 17 00:00:00 2001 From: rlindgren Date: Fri, 27 Oct 2017 11:35:10 -0400 Subject: [PATCH 30/78] fix lint --- types/async/test/explicit.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/async/test/explicit.ts b/types/async/test/explicit.ts index b9ea9c84ed..0c0e1a44ee 100644 --- a/types/async/test/explicit.ts +++ b/types/async/test/explicit.ts @@ -47,13 +47,13 @@ interface NumberCallback { (err?: Error, result?: number): void; } interface AsyncNumberGetter { (callback: NumberCallback): void; } var taskDict: Lookup = { - one: function(callback){ - setTimeout(function(){ + one: function(callback) { + setTimeout(function() { callback(undefined, 1); }, 200); }, - two: function(callback){ - setTimeout(function(){ + two: function(callback) { + setTimeout(function() { callback(undefined, 2); }, 100); } From 11f8e487721b37bd11c1fc41a8f2fdbde6573e8f Mon Sep 17 00:00:00 2001 From: Bel Date: Fri, 27 Oct 2017 11:13:39 -0700 Subject: [PATCH 31/78] Add exports to other non default interfaces for Field props (#20964) --- types/redux-form/lib/Field.d.ts | 13 ++++++++----- types/redux-form/redux-form-tests.tsx | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/types/redux-form/lib/Field.d.ts b/types/redux-form/lib/Field.d.ts index 8020763db4..9acba639c6 100644 --- a/types/redux-form/lib/Field.d.ts +++ b/types/redux-form/lib/Field.d.ts @@ -16,15 +16,15 @@ export type Formatter = (value: any, name: string) => any; export type Parser = (value: any, name: string) => any; export type Validator = (value: any, allValues?: any, props?: any) => any; -interface EventHandler { +export interface EventHandler { (event: Event): void; } -interface EventOrValueHandler extends EventHandler { +export interface EventOrValueHandler extends EventHandler { (value: any): void; } -interface CommonFieldProps { +export interface CommonFieldProps { name: string; onBlur: EventOrValueHandler>; onChange: EventOrValueHandler>; @@ -33,7 +33,7 @@ interface CommonFieldProps { onFocus: EventHandler>; } -interface BaseFieldProps

extends Partial { +export interface BaseFieldProps

extends Partial { name: string; component?: ComponentType

| "input" | "select" | "textarea", format?: Formatter | null; @@ -53,7 +53,10 @@ export interface GenericField

extends Component & P> { getRenderedComponent(): Component; } -type GenericFieldHTMLAttributes = InputHTMLAttributes | SelectHTMLAttributes | TextareaHTMLAttributes; +export type GenericFieldHTMLAttributes = + InputHTMLAttributes | + SelectHTMLAttributes | + TextareaHTMLAttributes; export class Field

extends Component & P> implements GenericField

{ dirty: boolean; diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index dba9b95633..cde07c264c 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -14,6 +14,7 @@ import { WrappedFieldProps, Fields, GenericFields, + BaseFieldProps, WrappedFieldsProps, FieldArray, GenericFieldArray, From 4982aa760999364738299817b29c13556f845742 Mon Sep 17 00:00:00 2001 From: Daphne Date: Fri, 27 Oct 2017 20:14:17 +0200 Subject: [PATCH 32/78] react-data-grid: update index.d.ts to make grouping example work (#21037) * Update index.d.ts Types that are missing for this example to work with Typescript: http://adazzle.github.io/react-data-grid/examples.html#/grouping * Added a test for OnRowExpandToggle and enableDragAndDrop and exported the required type --- types/react-data-grid/index.d.ts | 33 +++++++++++++++++++ .../react-data-grid/react-data-grid-tests.tsx | 9 +++++ 2 files changed, 42 insertions(+) diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index d09784acb6..3e79703242 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -161,6 +161,13 @@ declare namespace AdazzleReactDataGrid { * @default false */ enableCellSelect?: boolean + + /** + * Enables cells to be dragged and dropped + * @default false + */ + enableDragAndDrop?: boolean + /** * Called when a cell is selected. * @param coordinates The row and column indices of the selected cell. @@ -198,6 +205,13 @@ declare namespace AdazzleReactDataGrid { * @param row object behind the row */ onRowClick?: (rowIdx : number, row : object) => void + + /** + * An event function called when a row is expanded with the toggle + * @param props OnRowExpandToggle object + */ + onRowExpandToggle?: (props: OnRowExpandToggle ) => void + /** * Responsible for returning an Array of values that can be used for filtering * a column that is column.filterable and using a column.filterRenderer that @@ -419,6 +433,24 @@ declare namespace AdazzleReactDataGrid { action: 'cellUpdate' | 'cellDrag' | 'columnFill' | 'copyPaste' } + /** + * Information about the row toggler + */ + interface OnRowExpandToggle { + /** + * The name of the column group the row is in + */ + columnGroupName: string + /** + * The name of the expanded row + */ + name: string + /** + * If it should expand or not + */ + shouldExpand: boolean + } + /** * Some filter to be applied to the grid's contents */ @@ -455,6 +487,7 @@ declare namespace AdazzleReactDataGrid { export import DragHandleDoubleClickEvent = AdazzleReactDataGrid.DragHandleDoubleClickEvent; export import CellCopyPasteEvent = AdazzleReactDataGrid.CellCopyPasteEvent; export import GridRowsUpdatedEvent = AdazzleReactDataGrid.GridRowsUpdatedEvent; + export import OnRowExpandToggle = AdazzleReactDataGrid.OnRowExpandToggle; // Actual classes exposed on module.exports /** diff --git a/types/react-data-grid/react-data-grid-tests.tsx b/types/react-data-grid/react-data-grid-tests.tsx index 6d5ff3b4da..1b42af7ae6 100644 --- a/types/react-data-grid/react-data-grid-tests.tsx +++ b/types/react-data-grid/react-data-grid-tests.tsx @@ -249,6 +249,13 @@ class Example extends React.Component { this.setState({rows: rows}); } + onRowExpandToggle = ({ columnGroupName, name, shouldExpand }:ReactDataGrid.OnRowExpandToggle ) => { + let expandedRows = Object.assign({}, this.state.expandedRows); + expandedRows[columnGroupName] = Object.assign({}, expandedRows[columnGroupName]); + expandedRows[columnGroupName][name] = {isExpanded: shouldExpand}; + this.setState({expandedRows: expandedRows}); + } + onRowClick(rowIdx:number, row: Object) { // Do nothing, just test that it accepts an event } @@ -300,10 +307,12 @@ class Example extends React.Component { } enableRowSelect={true} rowHeight={50} From 5dbba088ed6ba5fea960d027ec3627204185b36f Mon Sep 17 00:00:00 2001 From: Daniel Cottone Date: Fri, 27 Oct 2017 14:56:52 -0500 Subject: [PATCH 33/78] updating custom authorizer event --- types/aws-lambda/aws-lambda-tests.ts | 64 ++++++++++++++++------------ types/aws-lambda/index.d.ts | 55 +++++++++++++----------- 2 files changed, 67 insertions(+), 52 deletions(-) diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 4e404fcd55..c2eb8da77e 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -4,6 +4,7 @@ var anyObj: any = { abc: 123 }; var num: number = 5; var error: Error = new Error(); var b: boolean = true; +var apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; var apiGwEvt: AWSLambda.APIGatewayEvent; var customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; var clientCtx: AWSLambda.ClientContext; @@ -22,33 +23,33 @@ var snsEvtRec: AWSLambda.SNSEventRecord; var snsMsg: AWSLambda.SNSMessage; var snsMsgAttr: AWSLambda.SNSMessageAttribute; var snsMsgAttrs: AWSLambda.SNSMessageAttributes; -var S3EvtRec: AWSLambda.S3EventRecord = { +var S3EvtRec: AWSLambda.S3EventRecord = { eventVersion: '2.0', eventSource: 'aws:s3', awsRegion: 'us-east-1', eventTime: '1970-01-01T00:00:00.000Z', eventName: 'ObjectCreated:Put', - userIdentity: { + userIdentity: { principalId: 'AIDAJDPLRKLG7UEXAMPLE' }, - requestParameters:{ + requestParameters:{ sourceIPAddress: '127.0.0.1' }, - responseElements: { + responseElements: { 'x-amz-request-id': 'C3D13FE58DE4C810', 'x-amz-id-2': 'FMyUVURIY8/IgAtTv8xRjskZQpcIZ9KG4V5Wp6S7S/JRWeUWerMUE5JgHvANOjpD' }, - s3: { + s3: { s3SchemaVersion: '1.0', configurationId: 'testConfigRule', - bucket: { + bucket: { name: 'mybucket', - ownerIdentity: { + ownerIdentity: { principalId: 'A3NL1KOZZKExample' }, arn: 'arn:aws:s3:::mybucket' }, - object: { + object: { key: 'HappyFace.jpg', size: 1024, eTag: 'd41d8cd98f00b204e9800998ecf8427e', @@ -65,6 +66,27 @@ var cognitoUserPoolEvent: AWSLambda.CognitoUserPoolEvent; var cloudformationCustomResourceEvent: AWSLambda.CloudFormationCustomResourceEvent; var cloudformationCustomResourceResponse: AWSLambda.CloudFormationCustomResourceResponse; +/* API Gateway Event request context */ +str = apiGwEvtReqCtx.accountId; +str = apiGwEvtReqCtx.apiId; +str = apiGwEvtReqCtx.httpMethod; +str = apiGwEvtReqCtx.identity.accessKey; +str = apiGwEvtReqCtx.identity.accountId; +str = apiGwEvtReqCtx.identity.apiKey; +str = apiGwEvtReqCtx.identity.caller; +str = apiGwEvtReqCtx.identity.cognitoAuthenticationProvider; +str = apiGwEvtReqCtx.identity.cognitoAuthenticationType; +str = apiGwEvtReqCtx.identity.cognitoIdentityId; +str = apiGwEvtReqCtx.identity.cognitoIdentityPoolId; +str = apiGwEvtReqCtx.identity.sourceIp; +str = apiGwEvtReqCtx.identity.user; +str = apiGwEvtReqCtx.identity.userAgent; +str = apiGwEvtReqCtx.identity.userArn; +str = apiGwEvtReqCtx.stage; +str = apiGwEvtReqCtx.requestId; +str = apiGwEvtReqCtx.resourceId; +str = apiGwEvtReqCtx.resourcePath; + /* API Gateway Event */ str = apiGwEvt.body; str = apiGwEvt.headers["example"]; @@ -74,31 +96,17 @@ str = apiGwEvt.path; str = apiGwEvt.pathParameters["example"]; str = apiGwEvt.queryStringParameters["example"]; str = apiGwEvt.stageVariables["example"]; -str = apiGwEvt.requestContext.accountId; -str = apiGwEvt.requestContext.apiId; -str = apiGwEvt.requestContext.httpMethod; -str = apiGwEvt.requestContext.identity.accessKey; -str = apiGwEvt.requestContext.identity.accountId; -str = apiGwEvt.requestContext.identity.apiKey; -str = apiGwEvt.requestContext.identity.caller; -str = apiGwEvt.requestContext.identity.cognitoAuthenticationProvider; -str = apiGwEvt.requestContext.identity.cognitoAuthenticationType; -str = apiGwEvt.requestContext.identity.cognitoIdentityId; -str = apiGwEvt.requestContext.identity.cognitoIdentityPoolId; -str = apiGwEvt.requestContext.identity.sourceIp; -str = apiGwEvt.requestContext.identity.user; -str = apiGwEvt.requestContext.identity.userAgent; -str = apiGwEvt.requestContext.identity.userArn; -str = apiGwEvt.requestContext.stage; -str = apiGwEvt.requestContext.requestId; -str = apiGwEvt.requestContext.resourceId; -str = apiGwEvt.requestContext.resourcePath; +apiGwEvtReqCtx = apiGwEvt.requestContext; str = apiGwEvt.resource; /* API Gateway CustomAuthorizer Event */ str = customAuthorizerEvt.type; -str = customAuthorizerEvt.authorizationToken; str = customAuthorizerEvt.methodArn; +str = customAuthorizerEvt.authorizationToken; +str = apiGwEvt.pathParameters["example"]; +str = apiGwEvt.queryStringParameters["example"]; +str = apiGwEvt.stageVariables["example"]; +apiGwEvtReqCtx = apiGwEvt.requestContext; /* SNS Event */ snsEvtRecs = snsEvt.Records; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index b1ca69405b..bbe8be54e3 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -11,6 +11,31 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 +// API Gateway "event" request context +interface APIGatewayEventRequestContext { + accountId: string; + apiId: string; + httpMethod: string; + identity: { + accessKey: string | null; + accountId: string | null; + apiKey: string | null; + caller: string | null; + cognitoAuthenticationProvider: string | null; + cognitoAuthenticationType: string | null; + cognitoIdentityId: string | null; + cognitoIdentityPoolId: string | null; + sourceIp: string; + user: string | null; + userAgent: string | null; + userArn: string | null; + }, + stage: string; + requestId: string; + resourceId: string; + resourcePath: string; +} + // API Gateway "event" interface APIGatewayEvent { body: string | null; @@ -21,37 +46,19 @@ interface APIGatewayEvent { pathParameters: { [name: string]: string } | null; queryStringParameters: { [name: string]: string } | null; stageVariables: { [name: string]: string } | null; - requestContext: { - accountId: string; - apiId: string; - httpMethod: string; - identity: { - accessKey: string | null; - accountId: string | null; - apiKey: string | null; - caller: string | null; - cognitoAuthenticationProvider: string | null; - cognitoAuthenticationType: string | null; - cognitoIdentityId: string | null; - cognitoIdentityPoolId: string | null; - sourceIp: string; - user: string | null; - userAgent: string | null; - userArn: string | null; - }, - stage: string; - requestId: string; - resourceId: string; - resourcePath: string; - }; + requestContext: APIGatewayEventRequestContext; resource: string; } // API Gateway CustomAuthorizer "event" interface CustomAuthorizerEvent { type: string; - authorizationToken: string; methodArn: string; + authorizationToken?: string; + headers?: { [name: string]: string }; + pathParameters?: { [name: string]: string } | null; + queryStringParameters?: { [name: string]: string } | null; + requestContext?: APIGatewayEventRequestContext; } // SNS "event" From 19ab2f184e4a78d3713d723d927ae8789710b0f6 Mon Sep 17 00:00:00 2001 From: Daniel Cottone Date: Fri, 27 Oct 2017 14:58:35 -0500 Subject: [PATCH 34/78] adding contact info --- types/aws-lambda/index.d.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index bbe8be54e3..523aafd41f 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -8,6 +8,7 @@ // Yoriki Yamaguchi // wwwy3y3 // Ishaan Malhi +// Daniel Cottone // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 From 0a804aff1a4b75eeac09806ef6188101af406f27 Mon Sep 17 00:00:00 2001 From: Sarun Intaralawan Date: Sat, 28 Oct 2017 06:46:55 +0700 Subject: [PATCH 35/78] croppie: use correct return type on result method (#21083) --- types/croppie/index.d.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/types/croppie/index.d.ts b/types/croppie/index.d.ts index ec4626aa7f..e2e207db4c 100644 --- a/types/croppie/index.d.ts +++ b/types/croppie/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Foliotek/Croppie // Definitions by: Connor Peet // dklmuc +// Sarun Intaralawan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export default class Croppie { @@ -15,10 +16,10 @@ export default class Croppie { useCanvas?: boolean, }): Promise; - result(options: ResultOptions & { type: 'base64' }): Promise; + result(options: ResultOptions & { type: 'base64' | 'canvas' }): Promise; result(options: ResultOptions & { type: 'html' }): Promise; result(options: ResultOptions & { type: 'blob' }): Promise; - result(options: ResultOptions & { type: 'canvas' }): Promise; + result(options: ResultOptions & { type: 'rawcanvas' }): Promise; result(options?: ResultOptions): Promise; rotate(degrees: 90 | 180 | 270 | -90 | -180 | -270): void; From c6ecf40346e151af0583e9a66ecc05f337c88b75 Mon Sep 17 00:00:00 2001 From: John Woodruff Date: Fri, 27 Oct 2017 17:47:32 -0600 Subject: [PATCH 36/78] Add DataOptions interface and methods that take options as a param (#21082) --- .../electron-json-storage-tests.ts | 31 ++++++++++++++++++- types/electron-json-storage/index.d.ts | 18 ++++++++--- 2 files changed, 44 insertions(+), 5 deletions(-) diff --git a/types/electron-json-storage/electron-json-storage-tests.ts b/types/electron-json-storage/electron-json-storage-tests.ts index 07d8461bed..2429f6a95f 100644 --- a/types/electron-json-storage/electron-json-storage-tests.ts +++ b/types/electron-json-storage/electron-json-storage-tests.ts @@ -2,8 +2,9 @@ import electron = require('electron'); import storage = require('electron-json-storage'); const DATA_PATH = '~/Downloads'; +const NEW_DATA_PATH = `${DATA_PATH}/new-data-path`; -console.log(storage.DEFAULT_DATA_PATH.length); +console.log(storage.getDefaultDataPath().length); storage.setDataPath(DATA_PATH); console.log(DATA_PATH.length); @@ -12,31 +13,59 @@ console.log(storage.getDataPath().length); storage.set('foo', { foo: 'bar' }, (err: any) => { }); storage.set('bar', { foo: 'bar' }, (err: any) => { }); +storage.set('baz', { foo: 'bar' }, {dataPath: NEW_DATA_PATH}, (err: any) => { }); storage.get('foo', (err: any, data: object) => { console.log(JSON.stringify(data)); }); +storage.get('baz', {dataPath: NEW_DATA_PATH}, (err: any, data: object) => { + console.log(JSON.stringify(data)); +}); + storage.getMany(['foo', 'bar'], (err: any, data: object) => { console.log(JSON.stringify(data)); }); +storage.getMany(['baz'], {dataPath: NEW_DATA_PATH}, (err: any, data: object) => { + console.log(JSON.stringify(data)); +}); storage.getAll((err: any, data: object) => { console.log(JSON.stringify(data)); }); +storage.getAll({dataPath: NEW_DATA_PATH}, (err: any, data: object) => { + console.log(JSON.stringify(data)); +}); + storage.has('foo', (err: any, hasKey: boolean) => { console.log("hasKey?: %s", hasKey); }); +storage.has('baz', {dataPath: NEW_DATA_PATH}, (err: any, hasKey: boolean) => { + console.log("hasKey?: %s", hasKey); +}); + storage.keys((err: any, keys: string[]) => { console.log(keys); }); +storage.keys({dataPath: NEW_DATA_PATH}, (err: any, keys: string[]) => { + console.log(keys); +}); + storage.remove("foo", (err: any) => { console.log(err); }); +storage.remove("baz", {dataPath: NEW_DATA_PATH}, (err: any) => { + console.log(err); +}); + storage.clear((err: any) => { console.log(err); }); + +storage.clear({dataPath: NEW_DATA_PATH}, (err: any) => { + console.log(err); +}); diff --git a/types/electron-json-storage/index.d.ts b/types/electron-json-storage/index.d.ts index cafa6c4171..75d6cf3983 100644 --- a/types/electron-json-storage/index.d.ts +++ b/types/electron-json-storage/index.d.ts @@ -1,18 +1,28 @@ -// Type definitions for electron-json-storage 3.1 +// Type definitions for electron-json-storage 4.0 // Project: https://github.com/electron-userland/electron-json-storage // Definitions by: Sam Saint-Pettersen , -// nrlquaker +// nrlquaker , +// John Woodruff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export const DEFAULT_DATA_PATH: string; -export function setDataPath(directory: string): void; +export interface DataOptions { dataPath: string; } +export function getDefaultDataPath(): string; +export function setDataPath(directory?: string): void; export function getDataPath(): string; export function get(key: string, callback: (error: any, data: object) => void): void; +export function get(key: string, options: DataOptions, callback: (error: any, data: object) => void): void; export function getMany(keys: ReadonlyArray, callback: (error: any, data: object) => void): void; +export function getMany(keys: ReadonlyArray, options: DataOptions, callback: (error: any, data: object) => void): void; export function getAll(callback: (error: any, data: object) => void): void; +export function getAll(options: DataOptions, callback: (error: any, data: object) => void): void; export function set(key: string, json: object, callback: (error: any) => void): void; +export function set(key: string, json: object, options: DataOptions, callback: (error: any) => void): void; export function has(key: string, callback: (error: any, hasKey: boolean) => void): void; +export function has(key: string, options: DataOptions, callback: (error: any, hasKey: boolean) => void): void; export function keys(callback: (error: any, keys: string[]) => void): void; +export function keys(options: DataOptions, callback: (error: any, keys: string[]) => void): void; export function remove(key: string, callback: (error: any) => void): void; +export function remove(key: string, options: DataOptions, callback: (error: any) => void): void; export function clear(callback: (error: any) => void): void; +export function clear(options: DataOptions, callback: (error: any) => void): void; From 6c483277a46069b5457fda9aff001b1c61fbf6b6 Mon Sep 17 00:00:00 2001 From: Tyler Murphy Date: Fri, 27 Oct 2017 19:51:13 -0400 Subject: [PATCH 37/78] Fix/Add Universal Analytics Tracker and Model to google.analytics (#21077) * Updates the UniversalAnalytics.Tracker interface so it matches the specification in Google's documentation (https://developers.google.com/analytics/devguides/collection/analyticsjs/tracker-object-reference). * Adds a UniversalAnalytics.Model interface, as described in Google's documentation (https://developers.google.com/analytics/devguides/collection/analyticsjs/model-object-reference). * Adds my name to the list of contributors for google.analytics. * Fixes lint issues. --- .../google.analytics-tests.ts | 37 ++++++++++++++++--- types/google.analytics/index.d.ts | 19 ++++++---- 2 files changed, 43 insertions(+), 13 deletions(-) diff --git a/types/google.analytics/google.analytics-tests.ts b/types/google.analytics/google.analytics-tests.ts index 945f967dc9..5256f636c7 100644 --- a/types/google.analytics/google.analytics-tests.ts +++ b/types/google.analytics/google.analytics-tests.ts @@ -41,14 +41,39 @@ describe('UniversalAnalytics', () => { }); it('should excercise Tracker APIs', () => { const tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto'); - const aString: string = tracker.get('aString'); - const aNumber: number = tracker.get('aNumber'); - const anObject: {} = tracker.get<{}>('anObject'); + + tracker.get('fieldName'); + + tracker.set('aString', 'aString'); + tracker.set('aNumber', 1); + tracker.set('anObject', {}); + tracker.set({ + several: 'values', + at: 'once' + }); + tracker.send('pageview'); + tracker.send('pageview', '/some-path'); tracker.send('pageview', {some: 'details'}); - tracker.set('aString', aString); - tracker.set('aNumber', aNumber); - tracker.set('anObject', anObject); + }); + + it('should exercise Model APIs', () => { + const tracker: UniversalAnalytics.Tracker = ga.create('UA-65432-1', 'auto'); + + tracker.set('sendHitTask', (gaHitModel: UniversalAnalytics.Model) => { + gaHitModel.get('hitPayload'); + + gaHitModel.set('hitCallback', () => console.log('hit sent'), true); + gaHitModel.set('hitCallback', () => console.log('hit sent')); + gaHitModel.set({ + hitPayload: 'a=1&b=2', + otherField: 3 + }); + gaHitModel.set({ + hitPayload: 'a=1&b=2', + otherField: 3 + }, null, false); + }); }); }); diff --git a/types/google.analytics/index.d.ts b/types/google.analytics/index.d.ts index c6d188d1cb..b0412a362f 100644 --- a/types/google.analytics/index.d.ts +++ b/types/google.analytics/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Google Analytics (Classic and Universal) // Project: https://developers.google.com/analytics/devguides/collection/gajs/, https://developers.google.com/analytics/devguides/collection/analyticsjs/method-reference -// Definitions by: Ronnie Haakon Hegelund , Pat Kujawa +// Definitions by: Ronnie Haakon Hegelund , Pat Kujawa , Tyler Murphy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare class Tracker { @@ -620,12 +620,17 @@ declare namespace UniversalAnalytics { } interface Tracker { - get(fieldName: string): T; - send(hitType: string, opt_fieldObject?: {}): void; - set(fieldName: string, value: string): void; - set(fieldName: string, value: {}): void; - set(fieldName: string, value: number): void; - set(fieldName: string, value: boolean): void; + get(fieldName: string): any; + set(fieldName: string, fieldValue: any): void; + set(fieldsObject: {}): void; + send(hitType: string, ...fields: any[]): void; + send(hitType: string, fieldsObject: {}): void; + } + + interface Model { + get(fieldName: string): any; + set(fieldName: string, fieldValue: any, temporary?: boolean): void; + set(fields: {}, fieldValue?: null, temporary?: boolean): void; } } From 627dc0c3bda3a1ea17f2ad867bb3597e68897f29 Mon Sep 17 00:00:00 2001 From: Yury Abaitov Date: Sat, 28 Oct 2017 02:52:59 +0300 Subject: [PATCH 38/78] easeljs stageGL support (#21025) * stageGL support * fix * fixes --- types/easeljs/index.d.ts | 73 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 72 insertions(+), 1 deletion(-) diff --git a/types/easeljs/index.d.ts b/types/easeljs/index.d.ts index d47f631728..462c9f04cf 100644 --- a/types/easeljs/index.d.ts +++ b/types/easeljs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for EaselJS 0.8.0 +// Type definitions for EaselJS 1.0.0 // Project: http://www.createjs.com/#!/EaselJS // Definitions by: Pedro Ferreira , Chris Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -53,6 +53,22 @@ declare namespace createjs { clone(): Bitmap; } + export class BitmapCache { + constructor(); + + // properties + cacheID: number; + + // methods + static getFilterBounds(target: DisplayObject, output?: Rectangle): Rectangle; + toString(): string; + define(target: DisplayObject, x: number, y: number, width: number, height: number, scale?: number): void; + update(compositeOperation?: string): void; + release(): void; + getCacheDataURL(): string; + draw(ctx: CanvasRenderingContext2D): boolean; + } + export class ScaleBitmap extends DisplayObject { constructor(imageOrUrl: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | Object | string, scale9Grid: Rectangle); @@ -211,6 +227,7 @@ declare namespace createjs { // properties alpha: number; + bitmapCache: BitmapCache; cacheCanvas: HTMLCanvasElement | Object; cacheID: number; compositeOperation: string; @@ -924,6 +941,60 @@ declare namespace createjs { } + interface IStageGLOptions { + preserveBuffer?: boolean; + antialias?: boolean; + transparent?: boolean; + premultiply?: boolean; + autoPurge?: number; + } + + export class StageGL extends Stage { + constructor(canvas: HTMLCanvasElement | string | Object, options?: IStageGLOptions); + + // properties + static VERTEX_PROPERTY_COUNT: number; + static INDICIES_PER_CARD: number; + static DEFAULT_MAX_BATCH_SIZE: number; + static WEBGL_MAX_INDEX_NUM: number; + static UV_RECT: number; + static COVER_VERT: Float32Array; + static COVER_UV: Float32Array; + static COVER_UV_FLIP: Float32Array; + static REGULAR_VARYING_HEADER: string; + static REGULAR_VERTEX_HEADER: string; + static REGULAR_FRAGMENT_HEADER: string; + static REGULAR_VERTEX_BODY: string; + static REGULAR_FRAGMENT_BODY: string; + static REGULAR_FRAG_COLOR_NORMAL: string; + static REGULAR_FRAG_COLOR_PREMULTIPLY: string; + static PARTICLE_VERTEX_BODY: string; + static PARTICLE_FRAGMENT_BODY: string; + static COVER_VARYING_HEADER: string; + static COVER_VERTEX_HEADER: string; + static COVER_FRAGMENT_HEADER: string; + static COVER_VERTEX_BODY: string; + static COVER_FRAGMENT_BODY: string; + isWebGL: boolean; + autoPurge: number; + vocalDebug: boolean; + + // methods + static buildUVRects(spritesheet: SpriteSheet, target?: number, onlyTarget?: boolean): Object; + static isWebGLActive(ctx: CanvasRenderingContext2D): boolean; + cacheDraw(target: DisplayObject, filters: Filter[], manager: BitmapCache): boolean; + getBaseTexture(w?: number, h?: number): WebGLTexture | null; + getFilterShader(filter: Filter | Object): WebGLProgram; + getRenderBufferTexture (w: number, h: number): WebGLTexture; + getTargetRenderTexture (target: DisplayObject, w: number, h: number): Object; + protectTextureSlot(id: number, lock?: boolean): void; + purgeTextures(count?: number): void; + releaseTexture(item: DisplayObject | WebGLTexture | HTMLImageElement | HTMLCanvasElement): void; + setTextureParams(gl: WebGLRenderingContext, isPOT?: boolean): void; + updateSimultaneousTextureCount(count?: number): void; + updateViewport(width: number, height: number): void; + } + export class Text extends DisplayObject { constructor(text?: string, font?: string, color?: string); From c3a393c3d4dd799b8343fd91427adebc5790a06a Mon Sep 17 00:00:00 2001 From: Li Jinyao Date: Sat, 28 Oct 2017 07:54:18 +0800 Subject: [PATCH 39/78] [cheerio] add firstChild attribute to CheerioElement (#20829) * add firstChild attribute in CheerioElement * add credit --- types/cheerio/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 2037e83c7a..93f30e8a9f 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Cheerio v0.22.0 // Project: https://github.com/cheeriojs/cheerio -// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani +// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani , LiJinyao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped interface Cheerio { @@ -255,6 +255,7 @@ interface CheerioElement { children: CheerioElement[]; childNodes: CheerioElement[]; lastChild: CheerioElement; + firstChild: CheerioElement; next: CheerioElement; nextSibling: CheerioElement; prev: CheerioElement; From 0c3c44e043ebf9a7bbd227bdb728e9fe20f51bce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Flor=C3=AAncio?= Date: Sat, 28 Oct 2017 00:55:00 +0100 Subject: [PATCH 40/78] return type of runQuery should be a promise (#21073) Fix for https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20724 --- types/google-cloud__datastore/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/google-cloud__datastore/index.d.ts b/types/google-cloud__datastore/index.d.ts index 6eee49ba50..a8e64839e6 100644 --- a/types/google-cloud__datastore/index.d.ts +++ b/types/google-cloud__datastore/index.d.ts @@ -223,7 +223,7 @@ declare module '@google-cloud/datastore/request' { runQuery(query: Query, options: QueryOptions, callback: QueryCallback): void; runQuery(query: Query, callback: QueryCallback): void; - runQuery(query: Query, options?: QueryOptions): QueryResult; + runQuery(query: Query, options?: QueryOptions): Promise; runQueryStream(query: Query, options?: QueryOptions): NodeJS.ReadableStream; From 2b447c65580ca1686c58388865b14ae557ebfbe4 Mon Sep 17 00:00:00 2001 From: wittwert Date: Sat, 28 Oct 2017 01:55:18 +0200 Subject: [PATCH 41/78] Allow separators in toolbarGroups configuration. (#21075) --- types/ckeditor/ckeditor-tests.ts | 17 +++++++++++++++++ types/ckeditor/index.d.ts | 3 ++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/types/ckeditor/ckeditor-tests.ts b/types/ckeditor/ckeditor-tests.ts index b6471ddab6..dd0ec92164 100644 --- a/types/ckeditor/ckeditor-tests.ts +++ b/types/ckeditor/ckeditor-tests.ts @@ -52,6 +52,23 @@ function test_config() { [ 'list', 'indent', 'blocks', 'align', 'bidi' ], ], }; + var config3: CKEDITOR.config = { + toolbarGroups: [ + { name: 'clipboard', groups: [ 'clipboard', 'undo' ] }, + { name: 'editing', groups: [ 'find', 'selection', 'spellchecker', 'editing' ] }, + { name: 'links', groups: [ 'links' ] }, + { name: 'insert', groups: [ 'insert' ] }, + { name: 'tools', groups: [ 'tools' ] }, + { name: 'document', groups: [ 'mode' ] }, + { name: 'about', groups: [ 'about' ] }, + '/', + { name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] }, + { name: 'paragraph', groups: [ 'list', 'indent', 'blocks', 'align', 'paragraph' ] }, + '/', + { name: 'styles', groups: [ 'styles' ] }, + { name: 'colors', groups: [ 'colors' ] }, + ], + } } function test_dom_comment() { diff --git a/types/ckeditor/index.d.ts b/types/ckeditor/index.d.ts index 24ff341b38..c61dd9c467 100644 --- a/types/ckeditor/index.d.ts +++ b/types/ckeditor/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for CKEditor // Project: http://ckeditor.com/ // Definitions by: Ondrej Sevcik +// Thomas Wittwer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // WORK-IN-PROGRESS: Any contribution support welcomed. @@ -814,7 +815,7 @@ declare namespace CKEDITOR { toolbar?: string | (string | string[])[]; toolbarCanCollapse?: boolean; toolbarGroupCycling?: boolean; - toolbarGroups?: toolbarGroups[]; + toolbarGroups?: (toolbarGroups | string)[]; toolbarLocation?: string; toolbarStartupExpanded?: boolean; From bbe1bc92cf076fbd5d2ead01f2a273d9af444428 Mon Sep 17 00:00:00 2001 From: Tom Wanzek Date: Fri, 27 Oct 2017 19:56:16 -0400 Subject: [PATCH 42/78] [d3-zoom] Minor Version 1.7 (#21052) * [FEATURE] Add `constrain(...)` method * [DOC] Fix spelling error in JSDoc comment for `clickDistance(...)` * [CHORE] Bump minor version number --- types/d3-zoom/d3-zoom-tests.ts | 20 ++++++++++++++++++++ types/d3-zoom/index.d.ts | 19 ++++++++++++++++--- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/types/d3-zoom/d3-zoom-tests.ts b/types/d3-zoom/d3-zoom-tests.ts index 8ff3f566f5..669b4af8ff 100644 --- a/types/d3-zoom/d3-zoom-tests.ts +++ b/types/d3-zoom/d3-zoom-tests.ts @@ -121,6 +121,26 @@ let svgZoom: d3Zoom.ZoomBehavior; svgZoom = d3Zoom.zoom(); +// constrain() ------------------------------------------------------------- + +// chainable +svgZoom = svgZoom.constrain((transform, extent, translateExtent) => { + const t: d3Zoom.ZoomTransform = transform; + const ve: [[number, number], [number, number]] = extent; + const te: [[number, number], [number, number]] = translateExtent; + const dx0 = t.invertX(ve[0][0]) - te[0][0]; + const dx1 = t.invertX(ve[1][0]) - te[1][0]; + const dy0 = transform.invertY(ve[0][1]) - te[0][1]; + const dy1 = transform.invertY(ve[1][1]) - te[1][1]; + return t.translate( + dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), + dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1) + ); +}); + +let constraintFn: (transform: d3Zoom.ZoomTransform, extent: [[number, number], [number, number]], translateExtent: [[number, number], [number, number]]) => d3Zoom.ZoomTransform; +constraintFn = svgZoom.constrain(); + // filter() ---------------------------------------------------------------- // chainable diff --git a/types/d3-zoom/index.d.ts b/types/d3-zoom/index.d.ts index 1ca39261a5..cf9b1ac89d 100644 --- a/types/d3-zoom/index.d.ts +++ b/types/d3-zoom/index.d.ts @@ -1,9 +1,9 @@ -// Type definitions for d3JS d3-zoom module 1.6 +// Type definitions for d3JS d3-zoom module 1.7 // Project: https://github.com/d3/d3-zoom/ // Definitions by: Tom Wanzek , Alex Ford , Boris Yankov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// Last module patch version validated against: 1.6.0 +// Last module patch version validated against: 1.7.0 import { ArrayLike, Selection, TransitionLike, ValueFn } from 'd3-selection'; import { ZoomView, ZoomInterpolator } from 'd3-interpolate'; @@ -499,6 +499,19 @@ export interface ZoomBehavior, k: ValueFn): void; + /** + * Returns the current constraint function. + * The default implementation attempts to ensure that the viewport extent does not go outside the translate extent. + */ + constrain(): (transform: ZoomTransform, extent: [[number, number], [number, number]], translateExtent: [[number, number], [number, number]]) => ZoomTransform; + /** + * Sets the transform constraint function to the specified function and returns the zoom behavior. + * + * @param constraint A constraint function which returns a transform given the current transform, viewport extent and translate extent. + * The default implementation attempts to ensure that the viewport extent does not go outside the translate extent. + */ + constrain(constraint: ((transform: ZoomTransform, extent: [[number, number], [number, number]], translateExtent: [[number, number], [number, number]]) => ZoomTransform)): this; + /** * Returns the current filter function. */ @@ -647,7 +660,7 @@ export interface ZoomBehavior Date: Sat, 28 Oct 2017 01:57:55 +0200 Subject: [PATCH 43/78] emscripten: ccall and cwrap returnType type can also be null (#21071) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://kripken.github.io/emscripten-site/docs/api_reference/preamble.js.html > For a void function this can be null (note: the JavaScript null value, not a string containing the word “null”). --- types/emscripten/emscripten-tests.ts | 2 ++ types/emscripten/index.d.ts | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/types/emscripten/emscripten-tests.ts b/types/emscripten/emscripten-tests.ts index 153ea6b5de..627efba590 100644 --- a/types/emscripten/emscripten-tests.ts +++ b/types/emscripten/emscripten-tests.ts @@ -18,6 +18,7 @@ function ModuleTest(): void { Module.print = function(text) { alert('stdout: ' + text) }; var int_sqrt = Module.cwrap('int_sqrt', 'number', ['number']) + int_sqrt = Module.cwrap('int_sqrt', null, ['number']) int_sqrt(12) int_sqrt(28) @@ -27,6 +28,7 @@ function ModuleTest(): void { var x = Module.getValue(buf, 'i32') + 123; Module.HEAPU8.set(myTypedArray, buf); Module.ccall('my_function', 'number', ['number'], [buf]); + Module.ccall('my_function', null, ['number'], [buf]); Module._free(buf); Module.destroy({}); } diff --git a/types/emscripten/index.d.ts b/types/emscripten/index.d.ts index 14260dd9d4..4db8ac4925 100644 --- a/types/emscripten/index.d.ts +++ b/types/emscripten/index.d.ts @@ -40,8 +40,8 @@ declare namespace Module { var Runtime: any; - function ccall(ident: string, returnType: string, argTypes: string[], args: any[]): any; - function cwrap(ident: string, returnType: string, argTypes: string[]): any; + function ccall(ident: string, returnType: string | null, argTypes: string[], args: any[]): any; + function cwrap(ident: string, returnType: string | null, argTypes: string[]): any; function setValue(ptr: number, value: any, type: string, noSafe?: boolean): void; function getValue(ptr: number, type: string, noSafe?: boolean): number; From fc5404090d0469ea75714c302ae82d8c378d6202 Mon Sep 17 00:00:00 2001 From: Sergey Slipchenko Date: Sat, 28 Oct 2017 02:58:37 +0300 Subject: [PATCH 44/78] Change escape-string-regexp export to const (#21062) --- types/escape-string-regexp/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/escape-string-regexp/index.d.ts b/types/escape-string-regexp/index.d.ts index 1ef18aedb1..7a52a312b1 100644 --- a/types/escape-string-regexp/index.d.ts +++ b/types/escape-string-regexp/index.d.ts @@ -1,10 +1,11 @@ // Type definitions for escape-string-regexp // Project: https://github.com/sindresorhus/escape-string-regexp // Definitions by: kruncher +// faergeek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -declare function escapeStringRegexp(str: string): string; +declare const escapeStringRegexp: (str: string) => string; export = escapeStringRegexp; From aeba5ae6852893d7c53e683c6b625bac3fa54ae4 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Scheffer <31517030+carlosscheffer@users.noreply.github.com> Date: Fri, 27 Oct 2017 22:01:17 -0200 Subject: [PATCH 45/78] [passport-jwt] Fix the missing secretOrKeyProvider (#20615) * Fix the missing secretOrKeyProvider In passport-jwt v3.0.0 it has dynamic secretOrKey support, but has not been implemented so far in DefinitelyTyped. This commit corrects this. * Update index.d.ts --- types/passport-jwt/index.d.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/types/passport-jwt/index.d.ts b/types/passport-jwt/index.d.ts index f1c87c40ed..c300276fe2 100644 --- a/types/passport-jwt/index.d.ts +++ b/types/passport-jwt/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for passport-jwt 2.0 +// Type definitions for passport-jwt 3.0 // Project: https://github.com/themikenicholson/passport-jwt // Definitions by: TANAKA Koichi // Alex Young // David Ng +// Carlos Eduardo Scheffer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -15,7 +16,8 @@ export declare class Strategy extends PassportStrategy { } export interface StrategyOptions { - secretOrKey: string | Buffer; + secretOrKey?: string | Buffer; + secretOrKeyProvider?: any; jwtFromRequest: JwtFromRequestFunction; issuer?: string; audience?: string; From e533e6944b2565ecd3e920d9210c72ff60cf5cda Mon Sep 17 00:00:00 2001 From: Georgiy Razumkov Date: Sat, 28 Oct 2017 05:02:23 +0500 Subject: [PATCH 46/78] add option dictFileSizeUnits (#20997) --- types/dropzone/dropzone-tests.ts | 1 + types/dropzone/index.d.ts | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/types/dropzone/dropzone-tests.ts b/types/dropzone/dropzone-tests.ts index 53cedba333..4abc3a6223 100644 --- a/types/dropzone/dropzone-tests.ts +++ b/types/dropzone/dropzone-tests.ts @@ -56,6 +56,7 @@ const dropzoneWithOptions = new Dropzone(".test", { dictRemoveFile: "", dictRemoveFileConfirmation: "", dictMaxFilesExceeded: "", + dictFileSizeUnits: { tb: "", gb: "", mb: "", kb: "", b: "" }, accept: (file: Dropzone.DropzoneFile, done: (error?: string | Error) => void) => { if (file.accepted) { diff --git a/types/dropzone/index.d.ts b/types/dropzone/index.d.ts index f809f84227..0295afbed2 100644 --- a/types/dropzone/index.d.ts +++ b/types/dropzone/index.d.ts @@ -26,6 +26,14 @@ declare namespace Dropzone { accepted: boolean; xhr?: XMLHttpRequest; } + + export interface DropzoneDictFileSizeUnits { + tb?: string; + gb?: string; + mb?: string; + kb?: string; + b?: string; + } export interface DropzoneOptions { url?: string; @@ -72,6 +80,7 @@ declare namespace Dropzone { dictRemoveFile?: string; dictRemoveFileConfirmation?: string; dictMaxFilesExceeded?: string; + dictFileSizeUnits?: DropzoneDictFileSizeUnits; accept?(file: DropzoneFile, done: (error?: string | Error) => void): void; init?(): void; From f6f55fae8377fbf7f8275632757de358cc9a95b4 Mon Sep 17 00:00:00 2001 From: pdeva Date: Fri, 27 Oct 2017 17:02:34 -0700 Subject: [PATCH 47/78] Update index.d.ts for react-redux (#20848) * Update index.d.ts for react-redux known issue described in comments * minor * update --- types/react-redux/index.d.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 203ce7f791..38c880ba3b 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -7,9 +7,17 @@ // Frank Tan // Nicholas Boll // Dibyo Majumdar +// Prashant Deva // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 - + +// Known Issue: +// There is a known issue in TypeScript, which doesn't allow decorators to change the signature of the classes +// they are decorating. Due to this, if you are using @connect() decorator in your code, +// you will see a bunch of errors from TypeScript. The current workaround is to use connect() as a function call on +// a separate line instead of as a decorator. Discussed in this github issue: +// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/20796 + import * as React from 'react'; import * as Redux from 'redux'; From e0baf3e2f3de8b3be7c4821c78a79ef82ceef64c Mon Sep 17 00:00:00 2001 From: Bateast2 Date: Sat, 28 Oct 2017 02:03:00 +0200 Subject: [PATCH 48/78] Updated types for angulartics 1.4 (#20657) * Updated types for angulartics 1.4 * add support for AMD/Require & UMD module --- types/angulartics/angulartics-tests.ts | 2 +- types/angulartics/index.d.ts | 49 ++++++++++++++++++++------ 2 files changed, 40 insertions(+), 11 deletions(-) diff --git a/types/angulartics/angulartics-tests.ts b/types/angulartics/angulartics-tests.ts index 5a5660a3f8..a130ec64b2 100644 --- a/types/angulartics/angulartics-tests.ts +++ b/types/angulartics/angulartics-tests.ts @@ -1,5 +1,5 @@ import * as angular from 'angular'; -import { angulartics } from 'angulartics'; +import * as angulartics from 'angulartics'; namespace Analytics { angular.module("angulartics.app", ["angulartics"]) diff --git a/types/angulartics/index.d.ts b/types/angulartics/index.d.ts index 0d9ba1f17f..e1b36bc210 100644 --- a/types/angulartics/index.d.ts +++ b/types/angulartics/index.d.ts @@ -1,11 +1,14 @@ -// Type definitions for Angulartics 1.3 +// Type definitions for Angulartics 1.4 // Project: http://luisfarzati.github.io/angulartics/ // Definitions by: Steven Fan +// Bateast2 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import * as angular from 'angular'; +export = angulartics;//AMD/Require module support +export as namespace angulartics;//UMD module support declare namespace angulartics { interface IAngularticsStatic { @@ -13,41 +16,67 @@ declare namespace angulartics { } interface IAnalyticsService { - eventTrack(eventName: string, properties?: any): any; - getOptOut(): boolean; pageTrack(path: string, location?: angular.ILocationService): any; + eventTrack(eventName: string, properties?: any): any; + exceptionTrack(error: any, cause: string): any; + transactionTrack: any; setAlias(alias: string): any; - setOptOut(value: boolean): void; setUsername(username: string): any; - setUserProperties(properties: any): any; - setSuperProperties(properties: any): any; + setUserProperties(userProperties: any): any; + setUserPropertiesOnce(userProperties: any): any; + setSuperProperties(superProperties: any): any; + setSuperPropertiesOnce(superProperties: any): any; + incrementProperty(property: string, value?: any): any; + userTimings(properties: any): any; + clearCookies: any; + + getOptOut(): boolean; + setOptOut(value: boolean): void; } interface IAnalyticsServiceProvider extends angular.IServiceProvider { virtualPageviews(value: boolean): void; + trackStates(value: boolean): void; + trackRoutes(value: boolean): void; excludeRoutes(value: string[]): void; + queryKeysWhitelist(keys: string[]): void + queryKeysBlacklist(keys: string[]): void firstPageview(value: boolean): void; withBase(value: boolean): void; withAutoBase(value: boolean): void; - developerMode(value: boolean): void; trackExceptions(value: boolean): void; - trackRoutes(value: boolean): void; - trackStates(value: boolean): void; + developerMode(value: boolean): void; registerPageTrack(callback: (path: string, location?: angular.ILocationService) => any): void; registerEventTrack(callback: (eventName: string, properties?: any) => any): void; + registerTransactionTrack(callback: any): void; registerSetAlias(callback: (alias: string) => any): void; registerSetUsername(callback: (username: string) => any): void; registerSetUserProperties(callback: (userProperties: any) => any): void; + registerSetUserPropertiesOnce(callback: (userProperties: any) => any): void; registerSetSuperProperties(callback: (superProperties: any) => any): void; + registerSetSuperPropertiesOnce(callback: (superProperties: any) => any): void; + registerIncrementProperty(callback: (property: string, value?: any) => any): void; + registerUserTimings(callback: (properties: any) => any): void; + registerClearCookies(callback: any): void; settings: { pageTracking: { autoTrackingVirtualPages: boolean, autoTrackingFirstPage: boolean, + trackRelativePath: boolean, + trackRoutes: boolean, + trackStates: boolean, + autoBasePath: boolean, basePath: string, - autoBasePath: boolean + excludedRoutes: string[], + queryKeysWhitelisted: string[], + queryKeysBlacklisted: string[] }, + eventTracking: {}, + bufferFlushDelay: number, + trackExceptions: boolean, + optOut: boolean, developerMode: boolean }; } From 1587233ac6ea747217a63a573f3da2839b6d7c0b Mon Sep 17 00:00:00 2001 From: Dolan Date: Sat, 28 Oct 2017 01:18:02 +0100 Subject: [PATCH 49/78] Binary parser typings (#21041) * Initial commit * Add strict function type check --- types/binary-parser/binary-parser-tests.ts | 95 +++++++++++++ types/binary-parser/index.d.ts | 147 +++++++++++++++++++++ types/binary-parser/tsconfig.json | 23 ++++ types/binary-parser/tslint.json | 1 + 4 files changed, 266 insertions(+) create mode 100644 types/binary-parser/binary-parser-tests.ts create mode 100644 types/binary-parser/index.d.ts create mode 100644 types/binary-parser/tsconfig.json create mode 100644 types/binary-parser/tslint.json diff --git a/types/binary-parser/binary-parser-tests.ts b/types/binary-parser/binary-parser-tests.ts new file mode 100644 index 0000000000..d0d09e5ef7 --- /dev/null +++ b/types/binary-parser/binary-parser-tests.ts @@ -0,0 +1,95 @@ +import { Parser } from "binary-parser"; + +// Build an IP packet header Parser +const ipHeader = new Parser() + .endianess('big') + .bit4('version') + .bit4('headerLength') + .uint8('tos') + .uint16('packetLength') + .uint16('id') + .bit3('offset') + .bit13('fragOffset') + .uint8('ttl') + .uint8('protocol') + .uint16('checksum') + .array('src', { + type: 'uint8', + length: 4 + }) + .array('dst', { + type: 'uint8', + length: 4 + }); + +// Prepare buffer to parse. +const buf = new Buffer('450002c5939900002c06ef98adc24f6c850186d1', 'hex'); + +// Parse buffer and show result +ipHeader.parse(buf); + +const parser2 = new Parser() + // Signed 32-bit integer (little endian) + .int32le('a') + // Unsigned 8-bit integer + .uint8('b') + // Signed 16-bit integer (big endian) + .int16be('c'); + +const parser3 = new Parser() + // 32-bit floating value (big endian) + .floatbe('a') + // 64-bit floating value (little endian) + .doublele('b'); + +const parser4 = new Parser() + // Statically sized array + .array('data', { + type: 'int32', + length: 8 + }) + + // Dynamically sized array (references another variable) + .uint8('dataLength') + .array('data2', { + type: 'int32', + length: 'dataLength' + }) + + // Dynamically sized array (with some calculation) + .array('data3', { + type: 'int32', + length: () => 4 // other fields are available through this + }) + + // Statically sized array + .array('data4', { + type: 'int32', + lengthInBytes: 16 + }) + + // Dynamically sized array (references another variable) + .uint8('dataLengthInBytes') + .array('data5', { + type: 'int32', + lengthInBytes: 'dataLengthInBytes' + }) + + // Dynamically sized array (with some calculation) + .array('data6', { + type: 'int32', + lengthInBytes: () => 4, // other fields are available through this + }) + + // Dynamically sized array (with stop-check on parsed item) + .array('data7', { + type: 'int32', + readUntil: (item, buffer) => true // stop when specific item is parsed. buffer can be used to perform a read-ahead. + }); + +const parser5 = new Parser() + .array('ipv4', { + type: 'uint8', + length: '4', + formatter: (arr) => { } + }); diff --git a/types/binary-parser/index.d.ts b/types/binary-parser/index.d.ts new file mode 100644 index 0000000000..657996bd8d --- /dev/null +++ b/types/binary-parser/index.d.ts @@ -0,0 +1,147 @@ +// Type definitions for binary-parser 1.3 +// Project: https://github.com/keichi/binary-parser +// Definitions by: Benjamin Riggs , Dolan Miu +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +export interface Parser { + parse(buffer: Buffer, callback?: (err?: Error, result?: any) => void): Parser.Parsed; + + create(constructorFunction: ObjectConstructor): Parser; + + int8(name: string, options?: Parser.Options): Parser; + uint8(name: string, options?: Parser.Options): Parser; + + int16(name: string, options?: Parser.Options): Parser; + uint16(name: string, options?: Parser.Options): Parser; + int16le(name: string, options?: Parser.Options): Parser; + int16be(name: string, options?: Parser.Options): Parser; + uint16le(name: string, options?: Parser.Options): Parser; + uint16be(name: string, options?: Parser.Options): Parser; + + int32(name: string, options?: Parser.Options): Parser; + uint32(name: string, options?: Parser.Options): Parser; + int32le(name: string, options?: Parser.Options): Parser; + int32be(name: string, options?: Parser.Options): Parser; + uint32le(name: string, options?: Parser.Options): Parser; + uint32be(name: string, options?: Parser.Options): Parser; + + bit1(name: string, options?: Parser.Options): Parser; + bit2(name: string, options?: Parser.Options): Parser; + bit3(name: string, options?: Parser.Options): Parser; + bit4(name: string, options?: Parser.Options): Parser; + bit5(name: string, options?: Parser.Options): Parser; + bit6(name: string, options?: Parser.Options): Parser; + bit7(name: string, options?: Parser.Options): Parser; + bit8(name: string, options?: Parser.Options): Parser; + bit9(name: string, options?: Parser.Options): Parser; + bit10(name: string, options?: Parser.Options): Parser; + bit11(name: string, options?: Parser.Options): Parser; + bit12(name: string, options?: Parser.Options): Parser; + bit13(name: string, options?: Parser.Options): Parser; + bit14(name: string, options?: Parser.Options): Parser; + bit15(name: string, options?: Parser.Options): Parser; + bit16(name: string, options?: Parser.Options): Parser; + bit17(name: string, options?: Parser.Options): Parser; + bit18(name: string, options?: Parser.Options): Parser; + bit19(name: string, options?: Parser.Options): Parser; + bit20(name: string, options?: Parser.Options): Parser; + bit21(name: string, options?: Parser.Options): Parser; + bit22(name: string, options?: Parser.Options): Parser; + bit23(name: string, options?: Parser.Options): Parser; + bit24(name: string, options?: Parser.Options): Parser; + bit25(name: string, options?: Parser.Options): Parser; + bit26(name: string, options?: Parser.Options): Parser; + bit27(name: string, options?: Parser.Options): Parser; + bit28(name: string, options?: Parser.Options): Parser; + bit29(name: string, options?: Parser.Options): Parser; + bit30(name: string, options?: Parser.Options): Parser; + bit31(name: string, options?: Parser.Options): Parser; + bit32(name: string, options?: Parser.Options): Parser; + + float(name: string, options?: Parser.Options): Parser; + floatle(name: string, options?: Parser.Options): Parser; + floatbe(name: string, options?: Parser.Options): Parser; + + double(name: string, options?: Parser.Options): Parser; + doublele(name: string, options?: Parser.Options): Parser; + doublebe(name: string, options?: Parser.Options): Parser; + + string(name: string, options?: Parser.StringOptions): Parser; + + buffer(name: string, options: Parser.BufferOptions): Parser; + + array(name: string, options: Parser.ArrayOptions): Parser; + + choice(name: string, options: Parser.ChoiceOptions): Parser; + + nest(name: string, options: Parser.NestOptions): Parser; + + skip(length: number): Parser; + + endianess(endianess: Parser.Endianness): Parser; /* [sic] */ + + namely(alias: string): Parser; + + compile(): void; + + getCode(): string; +} + +export interface ParserConstructor { + new(): Parser; +} + +export const Parser: ParserConstructor; + +export namespace Parser { + type Data = number | string | Array | Parsed | Buffer; + interface Parsed { + [name: string]: Data; + } + + interface Options { + formatter?: ((value: Data) => any); + assert?: string | number | ((value: Data) => boolean); + } + + interface StringOptions extends Options { + encoding?: string; + length?: number | string | ((this: Parsed) => number); + zeroTerminated?: boolean; + greedy?: boolean; + stripNull?: boolean; + } + + interface BufferOptions extends Options { + clone?: boolean; + length?: number | string | ((this: Parsed) => number); + readUntil?: string | ((item: number, buffer: Buffer) => boolean); + } + + interface ArrayOptions extends Options { + type: string | Parser; + length?: number | string | ((this: Parsed) => number); + lengthInBytes?: number | string | ((this: Parsed) => number); + readUntil?: string | ((item: number, buffer: Buffer) => boolean); + } + + interface ChoiceOptions extends Options { + tag: string | ((this: Parsed) => number); + choices: { [item: number]: Parser | string }; + defaultChoice?: Parser | string; + } + + interface NestOptions extends Options { + type: Parser | string; + } + + type Endianness = + 'little' | + 'big'; + + interface Context { + [name: string]: Parsed; + } +} diff --git a/types/binary-parser/tsconfig.json b/types/binary-parser/tsconfig.json new file mode 100644 index 0000000000..cb361f52c5 --- /dev/null +++ b/types/binary-parser/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "binary-parser-tests.ts" + ] +} diff --git a/types/binary-parser/tslint.json b/types/binary-parser/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/binary-parser/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 2b67b8a4e3f3c9721ce786799255979e2e66edb3 Mon Sep 17 00:00:00 2001 From: Yasunori Ohoka Date: Sat, 28 Oct 2017 09:18:25 +0900 Subject: [PATCH 50/78] =?UTF-8?q?Add=20=E2=80=98moji=E2=80=99=20types=20(#?= =?UTF-8?q?21019)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Add ‘moji’ types * moji: Fix tsconfig * moji: Fix tslint * moji: Fix tslint --- types/moji/index.d.ts | 32 ++++++++++++++++++++++++++++++++ types/moji/moji-tests.ts | 23 +++++++++++++++++++++++ types/moji/tsconfig.json | 24 ++++++++++++++++++++++++ types/moji/tslint.json | 1 + 4 files changed, 80 insertions(+) create mode 100644 types/moji/index.d.ts create mode 100644 types/moji/moji-tests.ts create mode 100644 types/moji/tsconfig.json create mode 100644 types/moji/tslint.json diff --git a/types/moji/index.d.ts b/types/moji/index.d.ts new file mode 100644 index 0000000000..ae45f6ac26 --- /dev/null +++ b/types/moji/index.d.ts @@ -0,0 +1,32 @@ +// Type definitions for moji 0.5 +// Project: https://github.com/niwaringo/moji +// Definitions by: Yasunori Ohoka +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 + +declare namespace moji { + type Mojisyu = "ZE" | "HE" | "ZS" | "HS" | "HG" | "KK" | "ZK" | "HK"; + + interface MojisyuRange { + start: number; + end: number; + } + + interface MojisyuRegExp { + regexp: RegExp; + list: string[]; + } + + interface Moji { + convert(beforeType: Mojisyu, afterType: Mojisyu): Moji; + trim(): Moji; + filter(type: Mojisyu): Moji; + reject(type: Mojisyu): Moji; + toString(): string; + } + + function addMojisyu(type: string, mojisyu: MojisyuRange | MojisyuRegExp): void; +} + +declare function moji(moji: string): moji.Moji; +export = moji; diff --git a/types/moji/moji-tests.ts b/types/moji/moji-tests.ts new file mode 100644 index 0000000000..05be3e43c1 --- /dev/null +++ b/types/moji/moji-tests.ts @@ -0,0 +1,23 @@ +import moji = require('moji'); + +moji('ABCD01234').convert('ZE', 'HE').toString(); +moji('ABCD01234').convert('HE', 'ZE').toString(); +// tslint:disable-next-line:no-irregular-whitespace +moji(' ').convert('ZS', 'HS').toString(); +moji('あいうえお').convert('HG', 'KK').toString(); +moji('アイウエオ').convert('KK', 'HG').toString(); +moji('アイウエオ').convert('ZK', 'HK').toString(); +moji('アイウエオ').convert('HK', 'ZK').toString(); +moji('アイウエオ').convert('HK', 'ZK').convert('KK', 'HG').toString(); + +moji(' アイウエオ ').trim().toString(); + +moji('abcあいうアイウ123').filter('HG').toString(); + +moji('abcあいうアイウ123').reject('HG').toString(); + +moji.addMojisyu('ZE', { start: 0xff01, end: 0xff5e }); +moji.addMojisyu('HK', { + regexp: /([\uff66-\uff9c]\uff9e)|([\uff8a-\uff8e]\uff9f)|([\uff61-\uff9f])/g, + list: ["。", "「", "」"] +}); diff --git a/types/moji/tsconfig.json b/types/moji/tsconfig.json new file mode 100644 index 0000000000..a6b2e51f26 --- /dev/null +++ b/types/moji/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "target": "es6", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "moji-tests.ts" + ] +} diff --git a/types/moji/tslint.json b/types/moji/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/moji/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 160b4e5701e125dedc56a1e0676551fb6cb5c541 Mon Sep 17 00:00:00 2001 From: pheromonez Date: Sat, 28 Oct 2017 11:18:58 +1100 Subject: [PATCH 51/78] Added definitions for @google-cloud/pubsub (#21057) * Added definitions for @google-cloud/pubsub * Changed Project as requested by review comments --- .../google-cloud__pubsub-tests.ts | 578 ++++++++++++++++++ types/google-cloud__pubsub/index.d.ts | 344 +++++++++++ types/google-cloud__pubsub/tsconfig.json | 28 + types/google-cloud__pubsub/tslint.json | 1 + 4 files changed, 951 insertions(+) create mode 100644 types/google-cloud__pubsub/google-cloud__pubsub-tests.ts create mode 100644 types/google-cloud__pubsub/index.d.ts create mode 100644 types/google-cloud__pubsub/tsconfig.json create mode 100644 types/google-cloud__pubsub/tslint.json diff --git a/types/google-cloud__pubsub/google-cloud__pubsub-tests.ts b/types/google-cloud__pubsub/google-cloud__pubsub-tests.ts new file mode 100644 index 0000000000..7a9b9905c2 --- /dev/null +++ b/types/google-cloud__pubsub/google-cloud__pubsub-tests.ts @@ -0,0 +1,578 @@ +import * as PubSub from '@google-cloud/pubsub'; + +// AUTHOR NOTES: We use the examples directly from the library documentation +// where possible. If there is a problem with a given example (e.g. undocumented +// feature or option), we make a note of it and provide an alternative example +// call instead. + +/////////////////////////////////////////////////////////////////////////////// +// PUBSUB +/////////////////////////////////////////////////////////////////////////////// +{ + let pubsub: PubSub.PubSub; + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=PubSub + // When running on Google Cloud Platform: + pubsub = PubSub(); + // When running elsewhere: + pubsub = PubSub({ + projectId: 'grape-spaceship-123', + keyFilename: '/path/to/keyfile.json', + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=createSubscription + // Subscribe to a topic: + pubsub.createSubscription('messageCenter', 'newMessages', (err, subscription, apiResponse) => { }); + // Customize the subscription: + // NOTE: ackDeadline, as given in the example, is undocumented, so create a subscription only with the KNOWN options + pubsub.createSubscription('messageCenter', 'newMessages', { + retainAckedMessages: true, + }, (err, subscription, apiResponse) => { }); + // If the callback is omitted, we'll return a Promise. + pubsub.createSubscription('messageCenter', 'newMessages').then((data) => { + const subscription = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=createTopic + // Create topic with callback + pubsub.createTopic('my-new-topic', (err, topic, apiResponse) => { + if (!err) { + // The topic was created successfully. + } + }); + // If the callback is omitted, we'll return a Promise. + pubsub.createTopic('my-new-topic').then((data) => { + const topic = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=getSnapshots + // Get snapshots: + pubsub.getSnapshots((err, snapshots) => { + if (!err) { + // snapshots is an array of Snapshot objects. + } + }); + // If the callback is omitted, we'll return a Promise. + pubsub.getSnapshots().then((data) => { + const snapshots = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=getSnapshotsStream + // Get snapshots stream + pubsub.getSnapshotsStream() + .on('error', console.error) + .on('data', (snapshot) => { + // snapshot is a Snapshot object. + }) + .on('end', () => { + // All snapshots retrieved. + }); + // If you anticipate many results, you can end a stream early to prevent unnecessary processing and API requests. + // NOTE: this had to be modified to work around the 'this' keyword as used in the example + { + const stream = pubsub.getSnapshotsStream(); + stream.on('data', (snapshot) => { + stream.end(); + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=getSubscriptions + // Get subscriptions: + pubsub.getSubscriptions((err, subscriptions) => { + if (!err) { + // subscriptions is an array of Subscription objects. + } + }); + // If the callback is omitted, we'll return a Promise. + pubsub.getSubscriptions().then((data) => { + const subscriptions = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=getSubscriptionsStream + // Get subscriptions stream + pubsub.getSubscriptionsStream() + .on('error', console.error) + .on('data', (subscription) => { + // subscription is a Subscription object. + }) + .on('end', () => { + // All subscriptions retrieved. + }); + // If you anticipate many results, you can end a stream early to prevent unnecessary processing and API requests. + // Note: this had to be modified to work around the 'this' keyword as used in the example. + { + const stream = pubsub.getSubscriptionsStream(); + stream.on('data', (subscription) => { + stream.end(); + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=getTopics + // Get topics: + pubsub.getTopics((err, topics) => { + if (!err) { + // topics is an array of Topic objects. + } + }); + // Customize the query: + pubsub.getTopics({ + pageSize: 3 + }, (err, topics) => { }); + // If the callback is omitted, we'll return a Promise. + pubsub.getTopics().then((data) => { + const topics = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=getTopicsStream + // Get topics stream: + pubsub.getTopicsStream() + .on('error', console.error) + .on('data', (topic) => { + // topic is a Topic object. + }) + .on('end', () => { + // All topics retrieved. + }); + // If you anticipate many results, you can end a stream early to prevent unnecessary processing and API requests. + // Note: this had to be modified to work around the 'this' keyword as used in the example. + { + const stream = pubsub.getTopicsStream(); + stream.on('data', (topic) => { + stream.end(); + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=snapshot + // Snapshot: + { + const snapshot = pubsub.snapshot('my-snapshot'); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=subscription + // Subscription: + { + const subscription = pubsub.subscription('my-subscription'); + + // Register a listener for `message` events. + subscription.on('message', (message) => { + // Called every time a message is received. + // message.id = ID of the message. + // message.ackId = ID used to acknowledge the message receival. + // message.data = Contents of the message. + // message.attributes = Attributes of the message. + // message.publishTime = Timestamp when Pub/Sub received the message. + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub?method=topic + // Topic: + { + const topic = pubsub.topic('my-topic'); + } +} + +/////////////////////////////////////////////////////////////////////////////// +// PUBLISHER +/////////////////////////////////////////////////////////////////////////////// +{ + const pubsub = PubSub(); + const topic = pubsub.topic('my-topic'); + const publisher = topic.publisher(); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/publisher?method=publish + // Publish: + publisher.publish(new Buffer('Hello, world!'), (err, messageId) => { + if (err) { + // Error handling omitted. + } + }); + // Optionally you can provide an object containing attributes for the message. + publisher.publish(new Buffer('Hello, world!'), { key: 'value' }, (err, messageId) => { + if (err) { + // Error handling omitted. + } + }); +} + +/////////////////////////////////////////////////////////////////////////////// +// SNAPSHOT +/////////////////////////////////////////////////////////////////////////////// +{ + const pubsub = PubSub(); + const subscription = pubsub.subscription('my-subscription'); + + // There are two type of snapshots; the ones obtained from subscription.createSnapshot() have more functionality + const snapshot = pubsub.snapshot('my-snapshot'); + const snapshotFromSubscription = subscription.snapshot('my-snapshot'); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/snapshot?method=create + // Note: Only available to snapshots created via methods of Subscription + // Create snapshot + snapshotFromSubscription.create('my-snapshot', (err, snapshot, apiResponse) => { + if (!err) { + // The snapshot was created successfully. + } + }); + // If the callback is omitted, we'll return a Promise. + snapshotFromSubscription.create('my-snapshot').then((data) => { + const snapshot = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/snapshot?method=delete + // Delete the snapshot + snapshot.delete((err, apiResponse) => { }); + // If the callback is omitted, we'll return a Promise. + snapshot.delete().then((data) => { + const apiResponse = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/snapshot?method=seek + // Note: Only available to snapshots created via methods of Subscription + // Seek: + snapshotFromSubscription.seek((err, apiResponse) => { }); + // If the callback is omitted, we'll return a Promise. + snapshotFromSubscription.seek().then((data) => { + const apiResponse = data[0]; + }); +} + +/////////////////////////////////////////////////////////////////////////////// +// SUBSCRIPTION +/////////////////////////////////////////////////////////////////////////////// +{ + const pubsub = PubSub(); + const topic = pubsub.topic('my-topic'); + const subscription = topic.subscription('my-subscription'); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=close + // Close: + subscription.close((err) => { + if (err) { + // Error handling omitted. + } + }); + // If the callback is omitted, we'll return a Promise. + subscription.close().then(() => { }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=createSnapshot + // Create snapshot: + subscription.createSnapshot('my-snapshot', (err, snapshot, apiResponse) => { + if (!err) { + // The snapshot was created successfully. + } + }); + // If the callback is omitted, we'll return a Promise. + subscription.createSnapshot('my-snapshot').then((data) => { + const snapshot = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=delete + // Delete: + subscription.delete((err, apiResponse) => { }); + // If the callback is omitted, we'll return a Promise. + subscription.delete().then((data) => { + const apiResponse = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=exists + // Exists: + subscription.exists((err, exists) => { }); + // If the callback is omitted, we'll return a Promise. + subscription.exists().then((data) => { + const exists = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=get + // Get: + subscription.get((err, subscription, apiResponse) => { + // The `subscription` data has been populated. + }); + // If the callback is omitted, we'll return a Promise. + subscription.get().then((data) => { + const subscription = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=getMetadata + // Get metadata: + subscription.getMetadata((err, apiResponse) => { + if (err) { + // Error handling omitted. + } + }); + // If the callback is omitted, we'll return a Promise. + subscription.getMetadata().then((data) => { + const apiResponse = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=modifyPushConfig + // Modify push config: + // Note: Had to modify the code to force typings + { + const pushConfig: PubSub.Subscription.PushConfig = { + pushEndpoint: 'https://mydomain.com/push', + attributes: { + 'x-goog-version': 'v1', + } + }; + subscription.modifyPushConfig(pushConfig, (err, apiResponse) => { + if (err) { + // Error handling omitted. + } + }); + // If the callback is omitted, we'll return a Promise. + subscription.modifyPushConfig(pushConfig).then((data) => { + const apiResponse = data[0]; + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=seek + // Seek: + { + const callback: PubSub.Subscription.SeekCallback = (err, resp) => { + if (!err) { + // Seek was successful. + } + }; + subscription.seek('my-snapshot', callback); + // Alternatively, to specify a certain point in time, you can provide a Date object. + subscription.seek(new Date('October 21 2015'), callback); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=setMetadata + { + const metadata = { + key: 'value' + }; + + // Set metadata + subscription.setMetadata(metadata, (err, apiResponse) => { + if (err) { + // Error handling omitted. + } + }); + // If the callback is omitted, we'll return a Promise. + subscription.setMetadata(metadata).then((data) => { + const apiResponse = data[0]; + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=snapshot + // Snapshot: + subscription.snapshot('my-snapshot'); +} + +/////////////////////////////////////////////////////////////////////////////// +// TOPIC +/////////////////////////////////////////////////////////////////////////////// +{ + const pubsub = PubSub(); + const topic = pubsub.topic('my-topic'); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=create + // Create: + topic.create((err, topic, apiResponse) => { + if (!err) { + // The topic was created successfully. + } + }); + // If the callback is omitted, we'll return a Promise. + topic.create().then((data) => { + const topic = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=createSubscription + { + const callback: PubSub.Topic.CreateSubscriptionCallback = (err, subscription, apiResponse) => { }; + + // Without specifying any options. + topic.createSubscription('newMessages', callback); + + // With options. + // Note: ackDeadline not documented, so we use a different option + topic.createSubscription('newMessages', { + // ackDeadline: 90000 // 90 seconds + retainAckedMessages: true, + }, callback); + + // If the callback is omitted, we'll return a Promise. + topic.createSubscription('newMessages').then((data) => { + const subscription = data[0]; + const apiResponse = data[1]; + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=delete + // Delete: + topic.delete((err, apiResponse) => { }); + // If the callback is omitted, we'll return a Promise. + topic.delete().then((data) => { + const apiResponse = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=exists + // Exists: + topic.exists((err, exists) => { }); + // If the callback is omitted, we'll return a Promise. + topic.exists().then((data) => { + const exists = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=get + // Get: + topic.get((err, topic, apiResponse) => { + // The `topic` data has been populated. + }); + // If the callback is omitted, we'll return a Promise. + topic.get().then((data) => { + const topic = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=getMetadata + // Get metadata + topic.getMetadata((err, apiResponse) => { }); + // If the callback is omitted, we'll return a Promise. + topic.getMetadata().then((data) => { + const apiResponse = data[0]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=getSubscriptions + // Get subscriptions: + // Note: Modified so that the callback is a constant + { + const callback: PubSub.Topic.GetSubscriptionsCallback = (err, subscriptions) => { + // subscriptions is an array of `Subscription` objects. + }; + + topic.getSubscriptions(callback); + + // Customize the query. + topic.getSubscriptions({ + pageSize: 3 + }, callback); + + // If the callback is omitted, we'll return a Promise. + topic.getSubscriptions().then((data) => { + const subscriptions = data[0]; + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=getSubscriptionsStream + // Get subscriptions stream: + topic.getSubscriptionsStream() + .on('error', console.error) + .on('data', (subscription) => { + // subscription is a Subscription object. + }) + .on('end', () => { + // All subscriptions retrieved. + }); + // If you anticipate many results, you can end a stream early to prevent unnecessary processing and API requests. + { + const stream = topic.getSubscriptionsStream(); + stream.on('data', (subscription) => { + stream.end(); + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=publisher + topic.publisher().publish(new Buffer('Hello, world!'), (err, messageId) => { + if (err) { + // Error handling omitted. + } + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=subscription + // Register a listener for `message` events. + topic.subscription('my-subscription').on('message', (message) => { + // Called every time a message is received. + // message.id = ID of the message. + // message.ackId = ID used to acknowledge the message receival. + // message.data = Contents of the message. + // message.attributes = Attributes of the message. + // message.publishTime = Timestamp when Pub/Sub received the message. + }); +} + +/////////////////////////////////////////////////////////////////////////////// +// IAM +/////////////////////////////////////////////////////////////////////////////// +{ + const pubsub = PubSub(); + const topic = pubsub.topic('my-topic'); + const subscription = topic.subscription('my-subscription'); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=iam.getPolicy + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=iam.getPolicy + // Get policy: + topic.iam.getPolicy((err, policy, apiResponse) => { }); + subscription.iam.getPolicy((err, policy, apiResponse) => { }); + // If the callback is omitted, we'll return a Promise. + topic.iam.getPolicy().then((data) => { + const policy = data[0]; + const apiResponse = data[1]; + }); + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=iam.setPolicy + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=iam.setPolicy + { + const myPolicy = { + bindings: [ + { + role: 'roles/pubsub.subscriber', + members: ['serviceAccount:myotherproject@appspot.gserviceaccount.com'] + } + ] + }; + + // Set policy: + topic.iam.setPolicy(myPolicy, (err, policy, apiResponse) => { }); + subscription.iam.setPolicy(myPolicy, (err, policy, apiResponse) => { }); + + // If the callback is omitted, we'll return a Promise. + topic.iam.setPolicy(myPolicy).then((data) => { + const policy = data[0]; + const apiResponse = data[1]; + }); + } + + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/subscription?method=iam.testPermissions + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=iam.testPermissions + { + const test = 'pubsub.topics.update'; + + // Test permission + topic.iam.testPermissions(test, (err, permissions, apiResponse) => { + console.log(permissions); + // { + // "pubsub.topics.update": true + // } + }); + + // Test several permissions at once. + const tests = [ + 'pubsub.subscriptions.consume', + 'pubsub.subscriptions.update' + ]; + + subscription.iam.testPermissions(tests, (err, permissions) => { + console.log(permissions); + // { + // "pubsub.subscriptions.consume": true, + // "pubsub.subscriptions.update": false + // } + }); + + // If the callback is omitted, we'll return a Promise. + topic.iam.testPermissions(test).then((data) => { + const permissions = data[0]; + const apiResponse = data[1]; + }); + } +} diff --git a/types/google-cloud__pubsub/index.d.ts b/types/google-cloud__pubsub/index.d.ts new file mode 100644 index 0000000000..7c9014b7d3 --- /dev/null +++ b/types/google-cloud__pubsub/index.d.ts @@ -0,0 +1,344 @@ +// Type definitions for @google-cloud/pubsub 0.14 +// Project: https://github.com/GoogleCloudPlatform/google-cloud-node/tree/master/packages/pubsub +// Definitions by: Paul Huynh +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// +import { EventEmitter } from "events"; +import { Duplex } from "stream"; + +declare namespace PubSub { + // TODO write definitions for the for v1 + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/v1 + function v1(config?: GCloudConfiguration): any; + + interface GCloudConfiguration { + projectId?: string; + keyFilename?: string; + email?: string; + credentials?: { + client_email?: string; + private_key?: string + }; + autoRetry?: boolean; + maxRetries?: number; + promise?: any; + } + + interface PubSub { + createSubscription(topic: Topic | string, name: string, options?: PubSub.CreateSubscriptionOptions): Promise; + createSubscription(topic: Topic | string, name: string, callback: PubSub.CreateSubscriptionCallback): void; + createSubscription(topic: Topic | string, name: string, options: PubSub.CreateSubscriptionOptions, callback: PubSub.CreateSubscriptionCallback): void; + + createTopic(name: string, gaxOpts?: GAX.CallOptions): Promise; + createTopic(name: string, callback: PubSub.CreateTopicCallback): void; + createTopic(name: string, gaxOpts: GAX.CallOptions, callback: PubSub.CreateTopicCallback): void; + + getSnapshots(options?: PubSub.GetSnapshotsOptions): Promise; + getSnapshots(callback: PubSub.GetSnapshotsCallback): void; + getSnapshots(options: PubSub.GetSnapshotsOptions, callback: PubSub.GetSnapshotsCallback): void; + + getSnapshotsStream(options?: PubSub.GetSnapshotsOptions): Duplex; + + getSubscriptions(options?: PubSub.GetSubscriptionsOptions): Promise; + getSubscriptions(callback: PubSub.GetSubscriptionsCallback): void; + getSubscriptions(options: PubSub.GetSubscriptionsOptions, callback: PubSub.GetSubscriptionsCallback): void; + + getSubscriptionsStream(options?: PubSub.GetSubscriptionsOptions): Duplex; + + getTopics(query?: PubSub.GetTopicsQuery): Promise; + getTopics(callback: PubSub.GetTopicsCallback): void; + getTopics(query: PubSub.GetTopicsQuery, callback: PubSub.GetTopicsCallback): void; + + getTopicsStream(query?: PubSub.GetTopicsQuery): Duplex; + + snapshot(name: string): Snapshot; + + subscription(name: string, options?: PubSub.SubscriptionOptions): Subscription; + + topic(name: string): Topic; + } + namespace PubSub { + interface CreateSubscriptionOptions { + flowControl?: { + maxBytes?: number; + maxMessages?: number; + }; + gaxOpts?: GAX.CallOptions; + messageRetentionDuration?: number | Date; + pushEndpoint?: string; + retainAckedMessages?: boolean; + } + type CreateSubscriptionCallback = (err: Error | null, subscription: Subscription, apiResponse: object) => void; + + type CreateTopicCallback = (err: Error | null, topic: Topic, apiResponse: object) => void; + + interface GetSnapshotsOptions { + autoPaginate?: boolean; + gaxOpts?: GAX.CallOptions; + pageSize?: number; + pageToken?: string; + } + type GetSnapshotsCallback = (err: Error | null, snapshots: Snapshot[]) => void; + + interface GetSubscriptionsOptions { + autoPaginate?: boolean; + gaxOpts?: GAX.CallOptions; + pageSize?: number; + pageToken?: string; + topic?: Topic | string; + } + type GetSubscriptionsCallback = (err: Error | null, subscriptions: Subscription[], apiResponse: object) => void; + + interface GetTopicsQuery { + autoPaginate?: boolean; + gaxOpts?: GAX.CallOptions; + pageSize?: number; + pageToken?: string; + } + type GetTopicsCallback = (err: Error | null, topics: Topic[], apiResponse: object) => void; + + interface SubscriptionOptions { + flowControl?: { + maxBytes?: number; + maxMessages?: number; + }; + maxConnections?: number; + } + } + + interface Publisher { + publish(data: Buffer, callback: Publisher.PublishCallback): void; + publish(data: Buffer, attributes: object, callback: Publisher.PublishCallback): void; + publish(data: Buffer, attributes?: object): Promise; + } + namespace Publisher { + type PublishCallback = (error: Error | null, messageId: string) => void; + } + + interface Snapshot { + delete(): Promise; + delete(callback: Snapshot.DeleteCallback): void; + } + interface SnapshotFromSubscription extends Snapshot { + create(name: string): Promise; + create(name: string, callback: Snapshot.CreateCallback): void; + + seek(): Promise; + seek(callback: Snapshot.SeekCallback): void; + } + namespace Snapshot { + type DeleteCallback = (err: Error | null, apiResponse: object) => void; + + type CreateCallback = (err: Error | null, snapshot: Snapshot, apiResponse: object) => void; + + type SeekCallback = (err: Error | null, apiResponse: object) => void; + } + + interface Subscription extends EventEmitter { + close(): Promise; + close(callback: Subscription.CloseCallback): void; + + createSnapshot(name: string, gaxOpts?: GAX.CallOptions): Promise; + createSnapshot(name: string, callback: Subscription.CreateSnapshotCallback): void; + createSnapshot(name: string, gaxOpts: GAX.CallOptions, callback: Subscription.CreateSnapshotCallback): void; + + delete(gaxOpts?: GAX.CallOptions): Promise; + delete(callback: Subscription.DeleteCallback): void; + delete(gaxOpts: GAX.CallOptions, callback: Subscription.DeleteCallback): void; + + exists(): Promise; + exists(callback: Subscription.ExistsCallback): void; + + get(gaxOpts?: GAX.CallOptions): Promise; // TODO: only expose autoCreate + // NOTE: The following are not documented, but are possible signatures base on the source code + get(callback: Subscription.GetCallback): void; + get(gaxOpts: GAX.CallOptions, callback: Subscription.GetCallback): void; + + getMetadata(gaxOpts?: GAX.CallOptions): Promise; + getMetadata(callback: Subscription.GetMetadataCallback): void; + getMetadata(gaxOpts: GAX.CallOptions, callback: Subscription.GetMetadataCallback): void; + + iam: IAM; + + modifyPushConfig(config: Subscription.PushConfig, gaxOpts?: GAX.CallOptions): Promise; + modifyPushConfig(config: Subscription.PushConfig, callback: Subscription.ModifyPushConfigCallback): void; + modifyPushConfig(config: Subscription.PushConfig, gaxOpts: GAX.CallOptions, callback: Subscription.ModifyPushConfigCallback): void; + + seek(snapshot: string | Date, callback: Subscription.SeekCallback): void; + seek(snapshot: string | Date, gaxOpts: GAX.CallOptions, callback: Subscription.SeekCallback): void; + + setMetadata(metadata: object, gaxOpts?: GAX.CallOptions): Promise; + setMetadata(metadata: object, callback: Subscription.SetMetadataCallback): void; + setMetadata(metadata: object, gaxOpts: GAX.CallOptions, callback: Subscription.SetMetadataCallback): void; + + snapshot(name: string): SnapshotFromSubscription; + } + namespace Subscription { + type CloseCallback = (err: Error | null) => void; + + type CreateSnapshotCallback = (err: Error | null, snapshot: SnapshotFromSubscription, apiResponse: object) => void; + + type DeleteCallback = (err: Error | null, apiResponse: object) => void; + + type ExistsCallback = (err: Error | null, exists: boolean) => void; + + type GetCallback = (err: Error | null, subscription: Subscription, apiResponse: object) => void; + + type GetMetadataCallback = (err: Error | null, apiResponse: object) => void; + + interface PushConfig { + pushEndpoint?: string; + // https://cloud.google.com/pubsub/docs/reference/rest/v1/projects.subscriptions#pushconfig + attributes?: PushConfigAttributes; + } + interface PushConfigAttributes { + 'x-goog-version': 'v1beta' | 'v1' | 'v1beta2'; + } + type ModifyPushConfigCallback = (err: Error | null, apiResponse: object) => void; + + type SeekCallback = (err: Error | null, apiResponse: object) => void; + + type SetMetadataCallback = (err: Error | null, apiResponse: object) => void; + } + + interface Topic { + create(gaxOpts?: GAX.CallOptions): Promise; + create(callback: Topic.CreateCallback): void; + create(gaxOpts: GAX.CallOptions, callback: Topic.CreateCallback): void; + + createSubscription(nameOrOptions?: string | Topic.CreateSubscriptionOptions): Promise; + createSubscription(name: string, options: Topic.CreateSubscriptionOptions): Promise; + createSubscription(callback: Topic.CreateSubscriptionCallback): void; + createSubscription(nameOrOptions: string | Topic.CreateSubscriptionOptions, callback: Topic.CreateSubscriptionCallback): void; + createSubscription(name: string, options: Topic.CreateSubscriptionOptions, callback: Topic.CreateSubscriptionCallback): void; + + delete(gaxOpts?: GAX.CallOptions): Promise; + delete(callback: Topic.DeleteCallback): void; + delete(gaxOpts: GAX.CallOptions, callback: Topic.DeleteCallback): void; + + exists(): Promise; + exists(callback: Topic.ExistsCallback): void; + + // NOTE: The documentation in the link is incomplete; the function takes a callback + // as second argument (in the source): + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=get + get(gaxOpts?: GAX.CallOptions): Promise; + get(callback: Topic.GetCallback): void; + get(gaxOpts: GAX.CallOptions, callback: Topic.GetCallback): void; + + getMetadata(gaxOpts?: GAX.CallOptions): Promise; + getMetadata(callback: Topic.GetMetadataCallback): void; + getMetadata(gaxOpts: GAX.CallOptions, callback: Topic.GetMetadataCallback): void; + + getSubscriptions(options?: Topic.GetSubscriptionsOptions): Promise; + getSubscriptions(callback: Topic.GetSubscriptionsCallback): void; + getSubscriptions(options: Topic.GetSubscriptionsOptions, callback: Topic.GetSubscriptionsCallback): void; + + // Note: The documention lists the parameter as 'query', when it probably should be 'options'. + getSubscriptionsStream(options?: Topic.GetSubscriptionsOptions): Duplex; + + iam: IAM; + + publisher(options?: Topic.PublisherOptions): Publisher; + + subscription(name: string, options?: Topic.SubscriptionOptions): Subscription; + } + namespace Topic { + type CreateCallback = PubSub.CreateTopicCallback; + + type CreateSubscriptionOptions = PubSub.CreateSubscriptionOptions; + type CreateSubscriptionCallback = PubSub.CreateSubscriptionCallback; + + // Note: This is not fully documented in the link; browse the source code to find the callback parameters + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=delete + type DeleteCallback = (err: Error | null, apiResponse: object) => void; + + type ExistsCallback = (err: Error | null, exists: boolean) => void; + + // Note: This is not fully documented in the link; browse the source code to find the callback parameters + // https://googlecloudplatform.github.io/google-cloud-node/#/docs/pubsub/0.14.1/pubsub/topic?method=get + type GetCallback = (err: Error | null, topic: Topic, apiResponse: object) => void; + + type GetMetadataCallback = (err: Error | null, apiResponse: object) => void; + + // Options are SLIGHTLY different to PubSub.getSubscriptions(...), so we can't just reuse it + interface GetSubscriptionsOptions { + autoPaginate?: boolean; + gaxOpts?: GAX.CallOptions; + pageSize?: number; + pageToken?: string; + } + // Callback signature also slightly different to PubSub.getSubscriptions(callback), so we can't just reuse it + type GetSubscriptionsCallback = (err: Error | null, subscriptions: Subscription[]) => void; + + interface PublisherOptions { + batching?: { + maxBytes?: number; + maxMessages?: number; + maxMilliseconds?: number; + }; + } + + type SubscriptionOptions = PubSub.SubscriptionOptions; + } + + // Allow this interface to start with 'I', since it's an acronym! + // tslint:disable-next-line interface-name + interface IAM { + getPolicy(): Promise; + getPolicy(callback: IAM.GetPolicyCallback): void; + + setPolicy(policy: IAM.Policy): Promise; + setPolicy(policy: IAM.Policy, callback: IAM.SetPolicyCallback): void; + + testPermissions(permissions: string | string[]): Promise; + testPermissions(permissions: string | string[], callback: IAM.TestPermissionsCallback): void; + } + namespace IAM { + type GetPolicyCallback = (err: Error | null, policy: Policy, apiResponse: object) => void; + + type SetPolicyCallback = (err: Error | null, policy: Policy, apiResponse: object) => void; + + type TestPermissionsCallback = (err: Error | null, permissions: string | string[], apiResponse: object) => void; + + interface Policy { + bindings?: any[]; + rules?: object[]; + etag?: string; + } + } + + namespace GAX { + /** https://googleapis.github.io/gax-nodejs/global.html#CallOptions */ + interface CallOptions { + timeout?: number; + retry?: RetryOptions; + autoPaginate?: boolean; + pageToken?: object; + isBundling?: boolean; + longrunning?: BackoffSettings; + promise?: PromiseConstructor; // FIXME Unsure if this is the correct type; remove this comment if it is + } + + /** https://googleapis.github.io/gax-nodejs/global.html#RetryOptions */ + interface RetryOptions { + retryCodes: string[]; + backoffSettings: BackoffSettings; + } + + /** https://googleapis.github.io/gax-nodejs/global.html#BackoffSettings */ + interface BackoffSettings { + initialRetryDelayMillis: number; + retryDelayMultiplier: number; + maxRetryDelayMillis: number; + initialRpcTimeoutMillis: number; + maxRpcTimeoutMillis: number; + totalTimeoutMillis: number; + } + } +} + +declare function PubSub(config?: PubSub.GCloudConfiguration): PubSub.PubSub; +export = PubSub; diff --git a/types/google-cloud__pubsub/tsconfig.json b/types/google-cloud__pubsub/tsconfig.json new file mode 100644 index 0000000000..f71eb2a331 --- /dev/null +++ b/types/google-cloud__pubsub/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "paths": { + "@google-cloud/pubsub": [ + "google-cloud__pubsub" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "google-cloud__pubsub-tests.ts" + ] +} \ No newline at end of file diff --git a/types/google-cloud__pubsub/tslint.json b/types/google-cloud__pubsub/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/google-cloud__pubsub/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From e0c06b3b7170b18bf71e0d8dae17ddaffec6443e Mon Sep 17 00:00:00 2001 From: Vasya Aksyonov Date: Sat, 28 Oct 2017 03:23:12 +0300 Subject: [PATCH 52/78] Fixing react-ga .ga() signature (#20438) * Fixing react-ga ga signature * Adding additional overload --- types/react-ga/index.d.ts | 5 +++-- types/react-ga/react-ga-tests.ts | 6 ++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/types/react-ga/index.d.ts b/types/react-ga/index.d.ts index 83d7a7218e..56d9715ed1 100644 --- a/types/react-ga/index.d.ts +++ b/types/react-ga/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-ga 2.1 // Project: https://github.com/react-ga/react-ga -// Definitions by: Tim Aldridge +// Definitions by: Tim Aldridge , Vasya Aksyonov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export interface EventArgs { @@ -54,7 +54,8 @@ export interface OutboundLinkArgs { } export function initialize(trackingCode: string, options?: InitializeOptions): void; -export function ga(): any; +export function ga(): (...args: any[]) => any; +export function ga(...args: any[]): any; export function set(fieldsObject: FieldsObject): void; export function send(fieldsObject: FieldsObject): void; export function pageview(path: string): void; diff --git a/types/react-ga/react-ga-tests.ts b/types/react-ga/react-ga-tests.ts index dbc1d0970c..9e1ba7b23b 100644 --- a/types/react-ga/react-ga-tests.ts +++ b/types/react-ga/react-ga-tests.ts @@ -63,6 +63,12 @@ describe("Testing react-ga v2.1.2", () => { it("Able to make ga calls", () => { ga.ga(); }); + it("Able to make ga calls with any arguments", () => { + ga.ga("create", "UA-65432-1", "auto", "trackerName"); + }); + it("Able to make returned ga calls with any arguments", () => { + ga.ga()("create", "UA-65432-1", "auto", "trackerName"); + }); it("Able to make send calls", () => { const fieldObject: ga.FieldsObject = { page: '/users' From b8206423625f9170dc39869249d78eab6bec4872 Mon Sep 17 00:00:00 2001 From: Daniel Earwicker Date: Sat, 28 Oct 2017 01:24:45 +0100 Subject: [PATCH 53/78] react-router-dom - Added missing location property to NavLinkProps (#20793) * Added missing location property to NavLinkProps See https://reacttraining.com/react-router/web/api/NavLink * Version 4.2 --- types/react-router-dom/index.d.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/types/react-router-dom/index.d.ts b/types/react-router-dom/index.d.ts index c9555834a9..bb8a010d8d 100644 --- a/types/react-router-dom/index.d.ts +++ b/types/react-router-dom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for React Router 4.0 +// Type definitions for React Router 4.2 // Project: https://github.com/ReactTraining/react-router // Definitions by: Tanguy Krotoff // Huy Nguyen @@ -52,5 +52,6 @@ export interface NavLinkProps extends LinkProps { exact?: boolean; strict?: boolean; isActive?

(match: match

, location: H.Location): boolean; + location?: H.Location; } export class NavLink extends React.Component {} From 3f6568d6e1bd6495b9442a82152819b3ddf34fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Mosmann?= Date: Sat, 28 Oct 2017 01:29:27 +0100 Subject: [PATCH 54/78] [react-mdl] Change DOMAttributes generic type from Textfield to HTMLInputElement (#20649) Textfield redirect all DOMAttributes to the input component inside of it. The typings should match it --- types/react-mdl/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/react-mdl/index.d.ts b/types/react-mdl/index.d.ts index d157987929..33dccccd07 100644 --- a/types/react-mdl/index.d.ts +++ b/types/react-mdl/index.d.ts @@ -584,7 +584,7 @@ declare namespace __ReactMDL { class Tabs extends __MDLComponent { } - interface TextfieldProps extends MDLHTMLAttributes, React.DOMAttributes { + interface TextfieldProps extends MDLHTMLAttributes, React.DOMAttributes { label: string; disabled?: boolean; error?: React.ReactNode; @@ -594,7 +594,7 @@ declare namespace __ReactMDL { id?: string; inputClassName?: string; maxRows?: number; - onChange?: React.FormEventHandler; + onChange?: React.FormEventHandler; pattern?: string; required?: boolean; rows?: number; From 1fda81f987e9858a578546fc1b6021e30d99ce22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Einar=20Nor=C3=B0fj=C3=B6r=C3=B0?= Date: Sat, 28 Oct 2017 00:29:55 +0000 Subject: [PATCH 55/78] Fixes crossfilter bisect method (#20642) * Fixes crossfilter bisect method Crossfilters bisect methods second argument should be of the type returned by the accessor * Update crossfilter-tests.ts * fix tests --- types/crossfilter/crossfilter-tests.ts | 8 ++++---- types/crossfilter/index.d.ts | 14 +++++++------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/types/crossfilter/crossfilter-tests.ts b/types/crossfilter/crossfilter-tests.ts index 813ddae2b9..5d9981b6d1 100644 --- a/types/crossfilter/crossfilter-tests.ts +++ b/types/crossfilter/crossfilter-tests.ts @@ -118,10 +118,10 @@ var types = paymentCountByType.all(); paymentsByTotal.dispose(); crossfilter.bisect([], null, 0, 0); -var bisectBy = crossfilter.bisect.by(t => t); -bisectBy([], null, 0, 0); -bisectBy.left([], null, 0, 0); -bisectBy.right([], null, 0, 0); +var bisectBy = crossfilter.bisect.by<{value: string}, string>(t => t.value); +bisectBy([{value: 'a'}, {value: 'b'}], 'c', 0, 0); // 2 +bisectBy.left([], 'string', 0, 0); // 0 +bisectBy.right([], 'string', 0, 0); // 0 crossfilter.heap([], 0, 0); var heapBy = crossfilter.heap.by(t => t); diff --git a/types/crossfilter/index.d.ts b/types/crossfilter/index.d.ts index ed888f6959..a009e920dd 100644 --- a/types/crossfilter/index.d.ts +++ b/types/crossfilter/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for CrossFilter // Project: https://github.com/square/crossfilter -// Definitions by: Schmulik Raskin , Izaak Baker +// Definitions by: Schmulik Raskin , Izaak Baker , Einar Norðfjörð // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace CrossFilter { @@ -15,7 +15,7 @@ declare namespace CrossFilter { permute(array: T[], index: number[]): T[]; bisect: { (array: T[], value: T, lo: number, hi: number): number; - by(value: Selector): Bisector; + by(accessor: (x: T)=> U): Bisector; } heap: { (array: T[], lo: number, hi: number): T[]; @@ -36,13 +36,13 @@ declare namespace CrossFilter { } } - export interface Bisection { - (array: T[], value: T, lo: number, hi: number): number; + export interface Bisection { + (array: T[], value: U, lo: number, hi: number): number; } - export interface Bisector extends Bisection { - left: Bisection - right: Bisection + export interface Bisector extends Bisection { + left: Bisection + right: Bisection } export interface Heap { From 084ca6f60c7b6e99082dbd4375db2df576e50fcc Mon Sep 17 00:00:00 2001 From: Cassey Lottman Date: Fri, 27 Oct 2017 19:31:34 -0500 Subject: [PATCH 56/78] Underscore typings missing IterateePropertyShorthand on uniq (#20537) * missing comment * missing comment * add iteratee property shorthand for uniq in underscore * undo bad commit --- types/underscore/index.d.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/types/underscore/index.d.ts b/types/underscore/index.d.ts index 2803c89b96..8ef77dff02 100644 --- a/types/underscore/index.d.ts +++ b/types/underscore/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for Underscore 1.8 // Project: http://underscorejs.org/ -// Definitions by: Boris Yankov , Josh Baldwin , Christopher Currens +// Definitions by: Boris Yankov , Josh Baldwin , Christopher Currens , Cassey Lottman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare var _: _.UnderscoreStatic; @@ -920,7 +920,7 @@ declare module _ { **/ uniq( array: _.List, - iterator?: _.ListIterator, + iterator?: _.ListIterator | _.IterateePropertyShorthand, context?: any): T[]; /** @@ -937,7 +937,7 @@ declare module _ { unique( array: _.List, isSorted?: boolean, - iterator?: _.ListIterator, + iterator?: _.ListIterator | _.IterateePropertyShorthand, context?: any): T[]; @@ -4512,7 +4512,7 @@ declare module _ { * Wrapped type `any[]`. * @see _.uniq **/ - uniq(isSorted?: boolean, iterator?: _.ListIterator): T[]; + uniq(isSorted?: boolean, iterator?: _.ListIterator | _.IterateePropertyShorthand): T[]; /** * Wrapped type `any[]`. @@ -5472,23 +5472,23 @@ declare module _ { * Wrapped type `any[]`. * @see _.uniq **/ - uniq(isSorted?: boolean, iterator?: _.ListIterator): _Chain; + uniq(isSorted?: boolean, iterator?: _.ListIterator | _.IterateePropertyShorthand): _Chain; /** * Wrapped type `any[]`. * @see _.uniq **/ - uniq(iterator?: _.ListIterator, context?: any): _Chain; + uniq(iterator?: _.ListIterator | _.IterateePropertyShorthand, context?: any): _Chain; /** * @see _.uniq **/ - unique(isSorted?: boolean, iterator?: _.ListIterator): _Chain; + unique(isSorted?: boolean, iterator?: _.ListIterator | _.IterateePropertyShorthand): _Chain; /** * @see _.uniq **/ - unique(iterator?: _.ListIterator, context?: any): _Chain; + unique(iterator?: _.ListIterator | _.IterateePropertyShorthand, context?: any): _Chain; /** * Wrapped type `any[][]`. From cc2072646562721329de7e97a8e33b2b1a9660df Mon Sep 17 00:00:00 2001 From: Eric Eslinger Date: Fri, 27 Oct 2017 17:32:40 -0700 Subject: [PATCH 57/78] The db field in Redis's ClientOptions interface should be a number, not a string. (#20504) * this parameter should probably be a number * undid the prettier reformat * other modules send strings --- types/redis/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index 13b7cbeb45..5f7e1d1e10 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -41,7 +41,7 @@ export interface ClientOpts { retry_unfulfilled_commands?: boolean; auth_pass?: string; password?: string; - db?: string; + db?: string | number; family?: string; rename_commands?: { [command: string]: string }; tls?: any; From fa5088af4d7070b83f1858853b90a80f5cf4c763 Mon Sep 17 00:00:00 2001 From: Gilberto Stankiewicz Date: Fri, 27 Oct 2017 17:37:36 -0700 Subject: [PATCH 58/78] Declare chrome.declarativeContent.onPageChanged, chrome.declarativeContent.ShowPageAction, chrome.declarativeContent.PageStateMatcher (#20797) --- types/chrome/index.d.ts | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/types/chrome/index.d.ts b/types/chrome/index.d.ts index ca7b35bf0e..0b6e1fd6e4 100644 --- a/types/chrome/index.d.ts +++ b/types/chrome/index.d.ts @@ -1426,8 +1426,7 @@ declare namespace chrome.declarativeContent { ports?: (number | number[])[]; } - /** Matches the state of a web page by various criteria. */ - interface PageStateMatcher { + class PageStateMatcherProperties { /** Optional. Filters URLs for various criteria. See event filtering. All criteria are case sensitive. */ pageUrl?: PageStateUrlDetails; /** Optional. Matches if all of the CSS selectors in the array match displayed elements in a frame with the same origin as the page's main frame. All selectors in this array must be compound selectors to speed up matching. Note that listing hundreds of CSS selectors or CSS selectors that match hundreds of times per page can still slow down web sites. */ @@ -1439,6 +1438,19 @@ declare namespace chrome.declarativeContent { */ isBookmarked?: boolean; } + + /** Matches the state of a web page by various criteria. */ + class PageStateMatcher { + constructor(options: PageStateMatcherProperties); + } + + /** Declarative event action that shows the extension's page action while the corresponding conditions are met. */ + class ShowPageAction {} + + /** Provides the Declarative Event API consisting of addRules, removeRules, and getRules. */ + interface PageChangedEvent extends chrome.events.Event<() => void> {} + + var onPageChanged: PageChangedEvent; } //////////////////// @@ -5126,7 +5138,7 @@ declare namespace chrome.runtime { actions?: { type: string; }[]; - conditions?: chrome.declarativeContent.PageStateMatcher[] + conditions?: chrome.declarativeContent.PageStateMatcherProperties[] }[]; externally_connectable?: { ids?: string[]; From 8c4d9e234d34e29b2e5f20a41e24ee4b5091805f Mon Sep 17 00:00:00 2001 From: Arda TANRIKULU Date: Fri, 27 Oct 2017 20:38:42 -0400 Subject: [PATCH 59/78] [meteor/server-render] Sink methods are optional (#20747) * ServiceConfiguration types added * New usage of publishComposite added to meteor-publish-composite * meteor/underscore added * [meteor/server-render] Sink methods are optional --- types/meteor/server-render.d.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/types/meteor/server-render.d.ts b/types/meteor/server-render.d.ts index cbf814ed61..1695142ee4 100644 --- a/types/meteor/server-render.d.ts +++ b/types/meteor/server-render.d.ts @@ -7,10 +7,10 @@ declare module "meteor/server-render" { body?: string; htmlById?: { [key: string]: string }; maybeMadeChanges?: boolean; - appendToHead(html: string): void; - appendToBody(html: string): void; - appendToElementById(id: string, html: string): void; - renderIntoElementById(id: string, html: string): void; + appendToHead?(html: string): void; + appendToBody?(html: string): void; + appendToElementById?(id: string, html: string): void; + renderIntoElementById?(id: string, html: string): void; } function onPageLoad(sink: Sink): Promise | any; } From ceda0b6a499f3e588c9046807a332425bbd4bd8e Mon Sep 17 00:00:00 2001 From: Bernd Date: Sat, 28 Oct 2017 02:39:01 +0200 Subject: [PATCH 60/78] add types for H.map.render.RenderEngine (#20711) --- types/heremaps/heremaps-tests.ts | 13 ++ types/heremaps/index.d.ts | 261 +++++++++++++++++++++++++++++++ 2 files changed, 274 insertions(+) diff --git a/types/heremaps/heremaps-tests.ts b/types/heremaps/heremaps-tests.ts index 0856cd2616..9e92b92d72 100644 --- a/types/heremaps/heremaps-tests.ts +++ b/types/heremaps/heremaps-tests.ts @@ -179,3 +179,16 @@ pixelProjection.rescale(12); const point = pixelProjection.geoToPixel({ lat: 53, lng: 12 }); pixelProjection.xyToGeo(point.x, point.y); + +const engine = map.getEngine(); +engine.getAnimationDuration(); +engine.setAnimationDuration(1000); + +engine.getAnimationEase(); +engine.setAnimationEase(H.util.animation.ease.EASE_IN_QUAD); + +const engineListener = (e: Event) => { + console.log(e); +}; +engine.addEventListener('tap', engineListener); +engine.removeEventListener('tap', engineListener); diff --git a/types/heremaps/index.d.ts b/types/heremaps/index.d.ts index 0bda913919..8b68f11278 100644 --- a/types/heremaps/index.d.ts +++ b/types/heremaps/index.d.ts @@ -264,6 +264,12 @@ declare namespace H { * @param opt_scope {Object=} - An optional scope to call the callback in. */ addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; + + /** + * This returns the map's render engine + * @return {H.map.render.p2d.RenderEngine} - map render engine + */ + getEngine(): H.map.render.p2d.RenderEngine; } namespace Map { @@ -3606,6 +3612,261 @@ declare namespace H { } } } + + namespace render { + /** + * This is an abstract class representing a render engine. Render engines are used to render the geographical position from a view model on the + * screen (viewport element). The rendered result may be different for different engines, because every engine uses its own capabilities and + * specific implementation to present the current view model data in best possible way. For example, 2D engines create a two-dimensional flat + * map composed of tiles, while 3D engines can generate panoramas displaying the same coordinates as a 'street view'. + */ + class RenderEngine extends H.util.EventTarget { + /** + * Constructor + * @param viewPort {H.map.ViewPort} - An object representing the map viewport + * @param viewModel {H.map.ViewModel} - An object representing a view of the map + * @param dataModel {H.map.DataModel} - An object encapsulating the data to be rendered on the map (layers and objects) + * @param options {H.map.render.RenderEngine.Options} - An object containing the render engine initialization options + */ + constructor(viewPort: H.map.ViewPort, viewModel: H.map.ViewModel, dataModel: H.map.DataModel, options: H.map.render.RenderEngine.Options); + + /** + * This method adds a listener for a specific event. + * Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it. + * @param type {string} - The name of the event + * @param handler {!Function} - An event handler function + * @param opt_capture {boolean=} - true indicates that the method should listen in the capture phase (bubble otherwise) + * @param opt_scope {Object=} - An object defining the scope for the handler function + */ + addEventListener(type: string, handler: (evt: Event) => void, opt_capture?: boolean, opt_scope?: {}): void; + + /** + * This method removes a previously added listener from the EventTarget instance. + * @param type {string} - The name of the event + * @param handler {!Function} - A previously added event handler + * @param opt_capture {boolean=} - true indicates that the method should listen in the capture phase (bubble otherwise) + * @param opt_scope {Object=} - An object defining the scope for the handler function + */ + removeEventListener(type: string, handler: (evt: Event) => void, opt_capture?: boolean, opt_scope?: {}): void; + + /** + * This method dispatches an event on the EventTarget object. + * @param evt {H.util.Event|string} - An object representing the event or a string with the event name + */ + dispatchEvent(evt: H.util.Event | string): void; + + /** + * This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove + * references to DOM Elements and additional listeners. + */ + dispose(): void; + + /** + * This method adds a callback which is triggered when the EventTarget object is being disposed. + * @param callback {!Function} - The callback function. + * @param opt_scope {Object=} - An optional scope for the callback function + */ + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; + } + + namespace RenderEngine { + /** + * An object containing the render engine initialization options + */ + interface Options { + [key: string]: string; + } + + /** + * This object defines the modifiers to use for H.map.ViewPort#startInteraction. + */ + enum InteractionModifiers { + /** changes zoom level during the interaction */ + ZOOM, + /** changes map center during the interaction */ + HEADING, + /** changes heading angle during the interaction */ + TILT, + /** changes tilt angle during the interaction */ + INCLINE, + /** changes incline angle during the interaction */ + COORD, + } + } + + /** + * The rendering states of the layer. + */ + enum RenderState { + /** + * Data loading/processing is still in progress, but there is nothing to render. In this state rendering engine might go to sleep mode after + * certain amount of time to prevent draining of battery on the user device. + */ + PENDING, + /** Data rendering or animation is in progress. */ + ACTIVE, + /** Data rendering or animation is done. */ + DONE, + } + + /** + * An object containing rendering parameters. + */ + interface RenderingParams { + /** + * The geographical area to render. Note that it is not the same as visible viewport. Specified bounds also include H.Map.Options#margin and + * optionally an additional margin in case of DOM node rendering for a better rendering experience. + * @type {H.geo.Rect} + */ + bounds: H.geo.Rect; + + /** + * The zoom level to render the data for. + * @type {number} + */ + zoom: number; + + /** + * The coordinates of the screen center in CSS pixels. + * @type {H.math.Point} + */ + screenCenter: H.math.Point; + + /** + * The coordinates relative to the screen center where the rendering has the highest priority. If the layer has to request and/or process data + * asynchronously, it's recommended to prioritize the rendering close to this center. + * @type {H.math.Point} + */ + priorityCenter: H.math.Point; + + /** + * The pixel projection to use to project geographical coordinates into screen coordinates and vice versa. + * @type {H.geo.PixelProjection} + */ + projection: H.geo.PixelProjection; + + /** + * Indicates whether only cached data should be considered. + * @type {boolean} + */ + cacheOnly: boolean; + + /** + * The size of the area to render. + * @type {H.math.Size} + */ + size: H.math.Size; + + /** + * The pixelRatio to use for over-sampling in cases of high-resolution displays. + * See https://developer.mozilla.org/en-US/docs/Web/API/Window/devicePixelRatio. + * @type {number} + */ + pixelRatio: number; + } + + /** + * Contains functionality specific to 2D map rendering. + */ + namespace p2d { + /** + * This class implements a map render engine. It presents a geographic location (camera data from a view model) and renders all map layers in + * the order in which they are provided in a single 2D canvas element. + */ + class RenderEngine extends H.map.render.RenderEngine { + /** + * Constructor + * @param viewPort {H.map.ViewPort} - An object representing the map viewport + * @param viewModel {H.map.ViewModel} - An object representing a view of the map + * @param dataModel {H.map.DataModel} - An object encapsulating the data to be rendered on the map (layers and objects) + * @param options {H.map.render.RenderEngine.Options} - An object containing the render engine initialization options + */ + constructor(viewPort: H.map.ViewPort, viewModel: H.map.ViewModel, dataModel: H.map.DataModel, options: H.map.render.RenderEngine.Options); + + /** + * This method sets the length (duration) for all animations run by the render engine in milliseconds. + * @param duration {number} - A value indicating the duration of animations in milliseconds + */ + setAnimationDuration(duration: number): void; + + /** + * This method retrieves the current setting indicating the length of animations (duration) run by the the render engine in milliseconds. + * @return {number} + */ + getAnimationDuration(): number; + + /** + * This method sets a value indicating the easing to apply to animations run by the render engine. + * @param easeFunction {Function(number)} - A function that alters the progress ratio of an animation. It receives an argument indicating + * animation progress as a numeric value in the range between 0 and 1 and must return a numeric value in the same range. + */ + setAnimationEase(easeFunction: (progress: number) => number): void; + + /** + * This method retrieves the current setting representing the easing to be applied to animations. + * @return {Function(number) => number} - A numeric value in the range 0 to 1 + */ + getAnimationEase(): (progress: number) => number; + + /** + * This method resets animation settings on the render engine to defaults. + * Duration is set to 300ms and easing to H.util.animation.ease.EASE_OUT_QUAD. + */ + resetAnimationDefaults(): void; + + /** + * This method adds a listener for a specific event. + * Note that to prevent potential memory leaks, you must either call removeEventListener or dispose on the given object when you no longer need it. + * @param type {string} - The name of the event + * @param handler {!Function} - An event handler function + * @param opt_capture {boolean=} - true indicates that the method should listen in the capture phase (bubble otherwise) + * @param opt_scope {Object=} - An object defining the scope for the handler function + */ + addEventListener(type: string, handler: (evt: Event) => void, opt_capture?: boolean, opt_scope?: {}): void; + + /** + * This method removes a previously added listener from the EventTarget instance. + * @param type {string} - The name of the event + * @param handler {!Function} - A previously added event handler + * @param opt_capture {boolean=} - true indicates that the method should listen in the capture phase (bubble otherwise) + * @param opt_scope {Object=} - An object defining the scope for the handler function + */ + removeEventListener(type: string, handler: (evt: Event) => void, opt_capture?: boolean, opt_scope?: {}): void; + + /** + * This method dispatches an event on the EventTarget object. + * @param evt {H.util.Event|string} - An object representing the event or a string with the event name + */ + dispatchEvent(evt: H.util.Event | string): void; + + /** + * This method removes listeners from the given object. Classes that extend EventTarget may need to override this method in order to remove + * references to DOM Elements and additional listeners. + */ + dispose(): void; + + /** + * This method adds a callback which is triggered when the EventTarget object is being disposed. + * @param callback {!Function} - The callback function. + * @param opt_scope {Object=} - An optional scope for the callback function + */ + addOnDisposeCallback(callback: () => void, opt_scope?: {}): void; + } + + namespace RenderEngine { + interface Options { + /** Object describes how many cached zoom levels should be used as a base map background while base map tiles are */ + renderBaseBackground?: {}; + + /** The pixelRatio to use for over-sampling in cases of high-resolution displays */ + pixelRatio: number; + + /** optional */ + enableSubpixelRendering?: boolean; + } + } + } + } } /***** mapevents *****/ From f7f81bced2ae4efc9a8398e62a2f3a33651d775e Mon Sep 17 00:00:00 2001 From: b-szypelow Date: Sat, 28 Oct 2017 02:39:47 +0200 Subject: [PATCH 61/78] Reactstrap: Introduce typings for v5.0 (#20696) * reactstrap: Create v4 subfolder * reactstrap@5: change getRef to innerRef --- types/reactstrap/index.d.ts | 2 +- types/reactstrap/lib/Button.d.ts | 2 +- types/reactstrap/lib/CardLink.d.ts | 2 +- types/reactstrap/lib/Form.d.ts | 2 +- types/reactstrap/lib/Input.d.ts | 2 +- types/reactstrap/lib/NavLink.d.ts | 2 +- types/reactstrap/reactstrap-tests.tsx | 2 +- types/reactstrap/v4/index.d.ts | 87 + types/reactstrap/v4/lib/Alert.d.ts | 19 + types/reactstrap/v4/lib/Badge.d.ts | 12 + types/reactstrap/v4/lib/Breadcrumb.d.ts | 10 + types/reactstrap/v4/lib/BreadcrumbItem.d.ts | 15 + types/reactstrap/v4/lib/Button.d.ts | 21 + types/reactstrap/v4/lib/ButtonDropdown.d.ts | 12 + types/reactstrap/v4/lib/ButtonGroup.d.ts | 14 + types/reactstrap/v4/lib/ButtonToolbar.d.ts | 12 + types/reactstrap/v4/lib/Card.d.ts | 16 + types/reactstrap/v4/lib/CardBlock.d.ts | 11 + types/reactstrap/v4/lib/CardBody.d.ts | 10 + types/reactstrap/v4/lib/CardColumns.d.ts | 10 + types/reactstrap/v4/lib/CardDeck.d.ts | 10 + types/reactstrap/v4/lib/CardFooter.d.ts | 10 + types/reactstrap/v4/lib/CardGroup.d.ts | 10 + types/reactstrap/v4/lib/CardHeader.d.ts | 10 + types/reactstrap/v4/lib/CardImg.d.ts | 16 + types/reactstrap/v4/lib/CardImgOverlay.d.ts | 10 + types/reactstrap/v4/lib/CardLink.d.ts | 12 + types/reactstrap/v4/lib/CardSubtitle.d.ts | 10 + types/reactstrap/v4/lib/CardText.d.ts | 10 + types/reactstrap/v4/lib/CardTitle.d.ts | 10 + types/reactstrap/v4/lib/Col.d.ts | 24 + types/reactstrap/v4/lib/Collapse.d.ts | 18 + types/reactstrap/v4/lib/Container.d.ts | 11 + types/reactstrap/v4/lib/Dropdown.d.ts | 22 + types/reactstrap/v4/lib/DropdownItem.d.ts | 15 + types/reactstrap/v4/lib/DropdownMenu.d.ts | 11 + types/reactstrap/v4/lib/DropdownToggle.d.ts | 19 + types/reactstrap/v4/lib/Fade.d.ts | 20 + types/reactstrap/v4/lib/Form.d.ts | 12 + types/reactstrap/v4/lib/FormFeedback.d.ts | 10 + types/reactstrap/v4/lib/FormGroup.d.ts | 14 + types/reactstrap/v4/lib/FormText.d.ts | 12 + types/reactstrap/v4/lib/Input.d.ts | 52 + types/reactstrap/v4/lib/InputGroup.d.ts | 11 + types/reactstrap/v4/lib/InputGroupAddon.d.ts | 10 + types/reactstrap/v4/lib/InputGroupButton.d.ts | 13 + types/reactstrap/v4/lib/Jumbotron.d.ts | 11 + types/reactstrap/v4/lib/Label.d.ts | 26 + types/reactstrap/v4/lib/ListGroup.d.ts | 11 + types/reactstrap/v4/lib/ListGroupItem.d.ts | 17 + .../v4/lib/ListGroupItemHeading.d.ts | 10 + .../reactstrap/v4/lib/ListGroupItemText.d.ts | 10 + types/reactstrap/v4/lib/Media.d.ts | 21 + types/reactstrap/v4/lib/Modal.d.ts | 23 + types/reactstrap/v4/lib/ModalBody.d.ts | 10 + types/reactstrap/v4/lib/ModalFooter.d.ts | 10 + types/reactstrap/v4/lib/ModalHeader.d.ts | 12 + types/reactstrap/v4/lib/Nav.d.ts | 17 + types/reactstrap/v4/lib/NavDropdown.d.ts | 12 + types/reactstrap/v4/lib/NavItem.d.ts | 10 + types/reactstrap/v4/lib/NavLink.d.ts | 15 + types/reactstrap/v4/lib/Navbar.d.ts | 20 + types/reactstrap/v4/lib/NavbarBrand.d.ts | 10 + types/reactstrap/v4/lib/NavbarToggler.d.ts | 13 + types/reactstrap/v4/lib/Pagination.d.ts | 10 + types/reactstrap/v4/lib/PaginationItem.d.ts | 12 + types/reactstrap/v4/lib/PaginationLink.d.ts | 13 + types/reactstrap/v4/lib/Popover.d.ts | 34 + types/reactstrap/v4/lib/PopoverContent.d.ts | 10 + types/reactstrap/v4/lib/PopoverTitle.d.ts | 10 + types/reactstrap/v4/lib/Progress.d.ts | 18 + types/reactstrap/v4/lib/Row.d.ts | 11 + types/reactstrap/v4/lib/TabContent.d.ts | 11 + types/reactstrap/v4/lib/TabPane.d.ts | 11 + types/reactstrap/v4/lib/Table.d.ts | 18 + types/reactstrap/v4/lib/Tag.d.ts | 12 + types/reactstrap/v4/lib/TetherContent.d.ts | 18 + types/reactstrap/v4/lib/Tooltip.d.ts | 43 + types/reactstrap/v4/lib/Uncontrolled.d.ts | 29 + types/reactstrap/v4/reactstrap-tests.tsx | 3502 +++++++++++++++++ types/reactstrap/v4/tsconfig.json | 28 + types/reactstrap/v4/tslint.json | 1 + 82 files changed, 4687 insertions(+), 7 deletions(-) create mode 100644 types/reactstrap/v4/index.d.ts create mode 100644 types/reactstrap/v4/lib/Alert.d.ts create mode 100644 types/reactstrap/v4/lib/Badge.d.ts create mode 100644 types/reactstrap/v4/lib/Breadcrumb.d.ts create mode 100644 types/reactstrap/v4/lib/BreadcrumbItem.d.ts create mode 100644 types/reactstrap/v4/lib/Button.d.ts create mode 100644 types/reactstrap/v4/lib/ButtonDropdown.d.ts create mode 100644 types/reactstrap/v4/lib/ButtonGroup.d.ts create mode 100644 types/reactstrap/v4/lib/ButtonToolbar.d.ts create mode 100644 types/reactstrap/v4/lib/Card.d.ts create mode 100644 types/reactstrap/v4/lib/CardBlock.d.ts create mode 100644 types/reactstrap/v4/lib/CardBody.d.ts create mode 100644 types/reactstrap/v4/lib/CardColumns.d.ts create mode 100644 types/reactstrap/v4/lib/CardDeck.d.ts create mode 100644 types/reactstrap/v4/lib/CardFooter.d.ts create mode 100644 types/reactstrap/v4/lib/CardGroup.d.ts create mode 100644 types/reactstrap/v4/lib/CardHeader.d.ts create mode 100644 types/reactstrap/v4/lib/CardImg.d.ts create mode 100644 types/reactstrap/v4/lib/CardImgOverlay.d.ts create mode 100644 types/reactstrap/v4/lib/CardLink.d.ts create mode 100644 types/reactstrap/v4/lib/CardSubtitle.d.ts create mode 100644 types/reactstrap/v4/lib/CardText.d.ts create mode 100644 types/reactstrap/v4/lib/CardTitle.d.ts create mode 100644 types/reactstrap/v4/lib/Col.d.ts create mode 100644 types/reactstrap/v4/lib/Collapse.d.ts create mode 100644 types/reactstrap/v4/lib/Container.d.ts create mode 100644 types/reactstrap/v4/lib/Dropdown.d.ts create mode 100644 types/reactstrap/v4/lib/DropdownItem.d.ts create mode 100644 types/reactstrap/v4/lib/DropdownMenu.d.ts create mode 100644 types/reactstrap/v4/lib/DropdownToggle.d.ts create mode 100644 types/reactstrap/v4/lib/Fade.d.ts create mode 100644 types/reactstrap/v4/lib/Form.d.ts create mode 100644 types/reactstrap/v4/lib/FormFeedback.d.ts create mode 100644 types/reactstrap/v4/lib/FormGroup.d.ts create mode 100644 types/reactstrap/v4/lib/FormText.d.ts create mode 100644 types/reactstrap/v4/lib/Input.d.ts create mode 100644 types/reactstrap/v4/lib/InputGroup.d.ts create mode 100644 types/reactstrap/v4/lib/InputGroupAddon.d.ts create mode 100644 types/reactstrap/v4/lib/InputGroupButton.d.ts create mode 100644 types/reactstrap/v4/lib/Jumbotron.d.ts create mode 100644 types/reactstrap/v4/lib/Label.d.ts create mode 100644 types/reactstrap/v4/lib/ListGroup.d.ts create mode 100644 types/reactstrap/v4/lib/ListGroupItem.d.ts create mode 100644 types/reactstrap/v4/lib/ListGroupItemHeading.d.ts create mode 100644 types/reactstrap/v4/lib/ListGroupItemText.d.ts create mode 100644 types/reactstrap/v4/lib/Media.d.ts create mode 100644 types/reactstrap/v4/lib/Modal.d.ts create mode 100644 types/reactstrap/v4/lib/ModalBody.d.ts create mode 100644 types/reactstrap/v4/lib/ModalFooter.d.ts create mode 100644 types/reactstrap/v4/lib/ModalHeader.d.ts create mode 100644 types/reactstrap/v4/lib/Nav.d.ts create mode 100644 types/reactstrap/v4/lib/NavDropdown.d.ts create mode 100644 types/reactstrap/v4/lib/NavItem.d.ts create mode 100644 types/reactstrap/v4/lib/NavLink.d.ts create mode 100644 types/reactstrap/v4/lib/Navbar.d.ts create mode 100644 types/reactstrap/v4/lib/NavbarBrand.d.ts create mode 100644 types/reactstrap/v4/lib/NavbarToggler.d.ts create mode 100644 types/reactstrap/v4/lib/Pagination.d.ts create mode 100644 types/reactstrap/v4/lib/PaginationItem.d.ts create mode 100644 types/reactstrap/v4/lib/PaginationLink.d.ts create mode 100644 types/reactstrap/v4/lib/Popover.d.ts create mode 100644 types/reactstrap/v4/lib/PopoverContent.d.ts create mode 100644 types/reactstrap/v4/lib/PopoverTitle.d.ts create mode 100644 types/reactstrap/v4/lib/Progress.d.ts create mode 100644 types/reactstrap/v4/lib/Row.d.ts create mode 100644 types/reactstrap/v4/lib/TabContent.d.ts create mode 100644 types/reactstrap/v4/lib/TabPane.d.ts create mode 100644 types/reactstrap/v4/lib/Table.d.ts create mode 100644 types/reactstrap/v4/lib/Tag.d.ts create mode 100644 types/reactstrap/v4/lib/TetherContent.d.ts create mode 100644 types/reactstrap/v4/lib/Tooltip.d.ts create mode 100644 types/reactstrap/v4/lib/Uncontrolled.d.ts create mode 100644 types/reactstrap/v4/reactstrap-tests.tsx create mode 100644 types/reactstrap/v4/tsconfig.json create mode 100644 types/reactstrap/v4/tslint.json diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 81d4cec5bd..f484e15c25 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for reactstrap 4.6 +// Type definitions for reactstrap 5.0 // Project: https://github.com/reactstrap/reactstrap#readme // Definitions by: Ali Hammad Baig , Marco Falkenberg , Danilo Barros , Fábio Paiva // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/reactstrap/lib/Button.d.ts b/types/reactstrap/lib/Button.d.ts index e6ec222c14..fc2f34e4bb 100644 --- a/types/reactstrap/lib/Button.d.ts +++ b/types/reactstrap/lib/Button.d.ts @@ -7,7 +7,7 @@ interface Props extends React.HTMLProps { color?: string; disabled?: boolean; tag?: React.ReactType; - getRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: string | ((instance: HTMLButtonElement) => any); onClick?: React.MouseEventHandler; size?: any; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 3edf6b24f8..8c722a0102 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -2,7 +2,7 @@ import { CSSModule } from '../index'; interface Props { tag?: React.ReactType; - getRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: string | ((instance: HTMLButtonElement) => any); className?: string; cssModule?: CSSModule; href?: string; diff --git a/types/reactstrap/lib/Form.d.ts b/types/reactstrap/lib/Form.d.ts index dd06a2f855..a3f872d413 100644 --- a/types/reactstrap/lib/Form.d.ts +++ b/types/reactstrap/lib/Form.d.ts @@ -3,7 +3,7 @@ import { CSSModule } from '../index'; interface Props extends React.HTMLProps { inline?: boolean; tag?: React.ReactType; - getRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: string | ((instance: HTMLButtonElement) => any); className?: string; cssModule?: CSSModule; } diff --git a/types/reactstrap/lib/Input.d.ts b/types/reactstrap/lib/Input.d.ts index 541016ca02..eb82296e39 100644 --- a/types/reactstrap/lib/Input.d.ts +++ b/types/reactstrap/lib/Input.d.ts @@ -39,7 +39,7 @@ interface InputProps extends Intermediate { state?: string; valid?: boolean; tag?: React.ReactType; - getRef?: string | ((instance: HTMLInputElement) => any); + innerRef?: string | ((instance: HTMLInputElement) => any); static?: boolean; addon?: boolean; className?: string; diff --git a/types/reactstrap/lib/NavLink.d.ts b/types/reactstrap/lib/NavLink.d.ts index 2871fad72e..a72ff56fdf 100644 --- a/types/reactstrap/lib/NavLink.d.ts +++ b/types/reactstrap/lib/NavLink.d.ts @@ -2,7 +2,7 @@ import { CSSModule } from '../index'; interface Props extends React.HTMLProps { tag?: React.ReactType; - getRef?: string | ((instance: HTMLButtonElement) => any); + innerRef?: string | ((instance: HTMLButtonElement) => any); disabled?: boolean; active?: boolean; className?: string; diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index b094d4d019..4886d712eb 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -3302,7 +3302,7 @@ class Example107 extends React.Component { private input: HTMLInputElement; render() { - return { this.input = input; }} />; + return { this.input = input; }} />; } } diff --git a/types/reactstrap/v4/index.d.ts b/types/reactstrap/v4/index.d.ts new file mode 100644 index 0000000000..81d4cec5bd --- /dev/null +++ b/types/reactstrap/v4/index.d.ts @@ -0,0 +1,87 @@ +// Type definitions for reactstrap 4.6 +// Project: https://github.com/reactstrap/reactstrap#readme +// Definitions by: Ali Hammad Baig , Marco Falkenberg , Danilo Barros , Fábio Paiva +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export interface CSSModule { + [className: string]: string; +} + +export { default as Alert } from './lib/Alert'; +export { default as Badge } from './lib/Badge'; +export { default as Breadcrumb } from './lib/Breadcrumb'; +export { default as BreadcrumbItem } from './lib/BreadcrumbItem'; +export { default as Button } from './lib/Button'; +export { default as ButtonDropdown } from './lib/ButtonDropdown'; +export { default as ButtonGroup } from './lib/ButtonGroup'; +export { default as ButtonToolbar } from './lib/ButtonToolbar'; +export { default as Card } from './lib/Card'; +export { default as CardBody } from './lib/CardBody'; +export { default as CardBlock } from './lib/CardBlock'; +export { default as CardColumns } from './lib/CardColumns'; +export { default as CardDeck } from './lib/CardDeck'; +export { default as CardFooter } from './lib/CardFooter'; +export { default as CardGroup } from './lib/CardGroup'; +export { default as CardHeader } from './lib/CardHeader'; +export { default as CardImg } from './lib/CardImg'; +export { default as CardImgOverlay } from './lib/CardImgOverlay'; +export { default as CardLink } from './lib/CardLink'; +export { default as CardSubtitle } from './lib/CardSubtitle'; +export { default as CardText } from './lib/CardText'; +export { default as CardTitle } from './lib/CardTitle'; +export { default as Col } from './lib/Col'; +export { default as Collapse } from './lib/Collapse'; +export { default as Container } from './lib/Container'; +export { default as Dropdown } from './lib/Dropdown'; +export { default as DropdownItem } from './lib/DropdownItem'; +export { default as DropdownMenu } from './lib/DropdownMenu'; +export { default as DropdownToggle } from './lib/DropdownToggle'; +export { default as Fade } from './lib/Fade'; +export { default as Form } from './lib/Form'; +export { default as FormFeedback } from './lib/FormFeedback'; +export { default as FormGroup } from './lib/FormGroup'; +export { default as FormText } from './lib/FormText'; +export { default as Input } from './lib/Input'; +export { default as InputGroup } from './lib/InputGroup'; +export { default as InputGroupAddon } from './lib/InputGroupAddon'; +export { default as InputGroupButton } from './lib/InputGroupButton'; +export { default as Jumbotron } from './lib/Jumbotron'; +export { default as Label } from './lib/Label'; +export { default as ListGroup } from './lib/ListGroup'; +export { default as ListGroupItem } from './lib/ListGroupItem'; +export { default as ListGroupItemHeading } from './lib/ListGroupItemHeading'; +export { default as ListGroupItemText } from './lib/ListGroupItemText'; +export { default as Media } from './lib/Media'; +export { default as Modal } from './lib/Modal'; +export { default as ModalBody } from './lib/ModalBody'; +export { default as ModalFooter } from './lib/ModalFooter'; +export { default as ModalHeader } from './lib/ModalHeader'; +export { default as Nav } from './lib/Nav'; +export { default as Navbar } from './lib/Navbar'; +export { default as NavbarBrand } from './lib/NavbarBrand'; +export { default as NavbarToggler } from './lib/NavbarToggler'; +export { default as NavDropdown } from './lib/NavDropdown'; +export { default as NavItem } from './lib/NavItem'; +export { default as NavLink } from './lib/NavLink'; +export { default as Pagination } from './lib/Pagination'; +export { default as PaginationItem } from './lib/PaginationItem'; +export { default as PaginationLink } from './lib/PaginationLink'; +export { default as Popover } from './lib/Popover'; +export { default as PopoverContent } from './lib/PopoverContent'; +export { default as PopoverTitle } from './lib/PopoverTitle'; +export { default as Progress } from './lib/Progress'; +export { default as Row } from './lib/Row'; +export { default as TabContent } from './lib/TabContent'; +export { default as Table } from './lib/Table'; +export { default as TabPane } from './lib/TabPane'; +export { default as Tag } from './lib/Tag'; +export { default as TetherContent } from './lib/TetherContent'; +export { default as Tooltip } from './lib/Tooltip'; +export { + UncontrolledAlert, + UncontrolledButtonDropdown, + UncontrolledDropdown, + UncontrolledNavDropdown, + UncontrolledTooltip +} from './lib/Uncontrolled'; diff --git a/types/reactstrap/v4/lib/Alert.d.ts b/types/reactstrap/v4/lib/Alert.d.ts new file mode 100644 index 0000000000..e29d62cb0d --- /dev/null +++ b/types/reactstrap/v4/lib/Alert.d.ts @@ -0,0 +1,19 @@ +import { CSSModule } from '../index'; + +export interface UncontrolledProps { + className?: string; + cssModule?: CSSModule; + color?: string; + tag?: React.ReactType; + transitionAppearTimeout?: number; + transitionEnterTimeout?: number; + transitionLeaveTimeout?: number; +} + +interface Props extends UncontrolledProps { + isOpen?: boolean; + toggle?: () => void; +} + +declare var Alert: React.StatelessComponent; +export default Alert; diff --git a/types/reactstrap/v4/lib/Badge.d.ts b/types/reactstrap/v4/lib/Badge.d.ts new file mode 100644 index 0000000000..51f72e39d3 --- /dev/null +++ b/types/reactstrap/v4/lib/Badge.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props { + color?: string; + pill?: boolean; + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var Badge: React.StatelessComponent; +export default Badge; diff --git a/types/reactstrap/v4/lib/Breadcrumb.d.ts b/types/reactstrap/v4/lib/Breadcrumb.d.ts new file mode 100644 index 0000000000..54f581288c --- /dev/null +++ b/types/reactstrap/v4/lib/Breadcrumb.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: string; + className?: string; + cssModule?: CSSModule; +} + +declare var Breadcrumb: React.StatelessComponent; +export default Breadcrumb; diff --git a/types/reactstrap/v4/lib/BreadcrumbItem.d.ts b/types/reactstrap/v4/lib/BreadcrumbItem.d.ts new file mode 100644 index 0000000000..0277305b21 --- /dev/null +++ b/types/reactstrap/v4/lib/BreadcrumbItem.d.ts @@ -0,0 +1,15 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + active?: boolean; + className?: string; + cssModule?: CSSModule; + // if a is passed as a string + // this could be href + [others: string]: any; +} + +declare var BreadcrumbItem: React.StatelessComponent; +export default BreadcrumbItem; + diff --git a/types/reactstrap/v4/lib/Button.d.ts b/types/reactstrap/v4/lib/Button.d.ts new file mode 100644 index 0000000000..e6ec222c14 --- /dev/null +++ b/types/reactstrap/v4/lib/Button.d.ts @@ -0,0 +1,21 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + outline?: boolean; + active?: boolean; + block?: boolean; + color?: string; + disabled?: boolean; + tag?: React.ReactType; + getRef?: string | ((instance: HTMLButtonElement) => any); + + onClick?: React.MouseEventHandler; + size?: any; + id?: string; + style?: React.CSSProperties; + + cssModule?: CSSModule; +} + +declare var Button: React.StatelessComponent; +export default Button; diff --git a/types/reactstrap/v4/lib/ButtonDropdown.d.ts b/types/reactstrap/v4/lib/ButtonDropdown.d.ts new file mode 100644 index 0000000000..9ab54c7502 --- /dev/null +++ b/types/reactstrap/v4/lib/ButtonDropdown.d.ts @@ -0,0 +1,12 @@ +import { + UncontrolledProps as DropdownUncontrolledProps, + Props as DropdownProps +} from './Dropdown'; + +// tslint:disable-next-line +export interface UncontrolledProps extends DropdownUncontrolledProps { } +// tslint:disable-next-line +interface Props extends DropdownProps { } + +declare var ButtonDropdown: React.StatelessComponent; +export default ButtonDropdown; \ No newline at end of file diff --git a/types/reactstrap/v4/lib/ButtonGroup.d.ts b/types/reactstrap/v4/lib/ButtonGroup.d.ts new file mode 100644 index 0000000000..d807ea33cf --- /dev/null +++ b/types/reactstrap/v4/lib/ButtonGroup.d.ts @@ -0,0 +1,14 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + 'aria-label'?: string; + className?: string; + cssModule?: CSSModule; + role?: string; + size?: string; + vertical?: boolean; +} + +declare var ButtonGroup: React.StatelessComponent; +export default ButtonGroup; diff --git a/types/reactstrap/v4/lib/ButtonToolbar.d.ts b/types/reactstrap/v4/lib/ButtonToolbar.d.ts new file mode 100644 index 0000000000..fea31dd5d5 --- /dev/null +++ b/types/reactstrap/v4/lib/ButtonToolbar.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + 'aria-label'?: string; + className?: string; + cssModule?: CSSModule; + role?: string; +} + +declare var ButtonToolbar: React.StatelessComponent; +export default ButtonToolbar; diff --git a/types/reactstrap/v4/lib/Card.d.ts b/types/reactstrap/v4/lib/Card.d.ts new file mode 100644 index 0000000000..0dbde7f879 --- /dev/null +++ b/types/reactstrap/v4/lib/Card.d.ts @@ -0,0 +1,16 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + inverse?: boolean; + color?: string; + block?: boolean; + outline?: boolean; + className?: string; + cssModule?: CSSModule; + style?: React.CSSProperties; +} + +declare var Card: React.StatelessComponent; +export default Card; + diff --git a/types/reactstrap/v4/lib/CardBlock.d.ts b/types/reactstrap/v4/lib/CardBlock.d.ts new file mode 100644 index 0000000000..0aa31a63a7 --- /dev/null +++ b/types/reactstrap/v4/lib/CardBlock.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardBlock: React.StatelessComponent; +export default CardBlock; + diff --git a/types/reactstrap/v4/lib/CardBody.d.ts b/types/reactstrap/v4/lib/CardBody.d.ts new file mode 100644 index 0000000000..2b94e52ea8 --- /dev/null +++ b/types/reactstrap/v4/lib/CardBody.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardBody: React.StatelessComponent; +export default CardBody; diff --git a/types/reactstrap/v4/lib/CardColumns.d.ts b/types/reactstrap/v4/lib/CardColumns.d.ts new file mode 100644 index 0000000000..0cc1a80a1a --- /dev/null +++ b/types/reactstrap/v4/lib/CardColumns.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardColumns: React.StatelessComponent; +export default CardColumns; diff --git a/types/reactstrap/v4/lib/CardDeck.d.ts b/types/reactstrap/v4/lib/CardDeck.d.ts new file mode 100644 index 0000000000..1a5882aa54 --- /dev/null +++ b/types/reactstrap/v4/lib/CardDeck.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardDeck: React.StatelessComponent; +export default CardDeck; diff --git a/types/reactstrap/v4/lib/CardFooter.d.ts b/types/reactstrap/v4/lib/CardFooter.d.ts new file mode 100644 index 0000000000..0956cb06c9 --- /dev/null +++ b/types/reactstrap/v4/lib/CardFooter.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardFooter: React.StatelessComponent; +export default CardFooter; diff --git a/types/reactstrap/v4/lib/CardGroup.d.ts b/types/reactstrap/v4/lib/CardGroup.d.ts new file mode 100644 index 0000000000..5c0a0a1ab1 --- /dev/null +++ b/types/reactstrap/v4/lib/CardGroup.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardGroup: React.StatelessComponent; +export default CardGroup; diff --git a/types/reactstrap/v4/lib/CardHeader.d.ts b/types/reactstrap/v4/lib/CardHeader.d.ts new file mode 100644 index 0000000000..f063057c92 --- /dev/null +++ b/types/reactstrap/v4/lib/CardHeader.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardHeader: React.StatelessComponent; +export default CardHeader; diff --git a/types/reactstrap/v4/lib/CardImg.d.ts b/types/reactstrap/v4/lib/CardImg.d.ts new file mode 100644 index 0000000000..1c3fee274b --- /dev/null +++ b/types/reactstrap/v4/lib/CardImg.d.ts @@ -0,0 +1,16 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + top?: boolean; + bottom?: boolean; + className?: string; + cssModule?: CSSModule; + src?: string; + width?: string; + height?: string; + alt?: string; +} + +declare var CardImg: React.StatelessComponent; +export default CardImg; diff --git a/types/reactstrap/v4/lib/CardImgOverlay.d.ts b/types/reactstrap/v4/lib/CardImgOverlay.d.ts new file mode 100644 index 0000000000..05519847b2 --- /dev/null +++ b/types/reactstrap/v4/lib/CardImgOverlay.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardImgOverlay: React.StatelessComponent; +export default CardImgOverlay; diff --git a/types/reactstrap/v4/lib/CardLink.d.ts b/types/reactstrap/v4/lib/CardLink.d.ts new file mode 100644 index 0000000000..3edf6b24f8 --- /dev/null +++ b/types/reactstrap/v4/lib/CardLink.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + getRef?: string | ((instance: HTMLButtonElement) => any); + className?: string; + cssModule?: CSSModule; + href?: string; +} + +declare var CardLink: React.StatelessComponent; +export default CardLink; diff --git a/types/reactstrap/v4/lib/CardSubtitle.d.ts b/types/reactstrap/v4/lib/CardSubtitle.d.ts new file mode 100644 index 0000000000..bfacd4e794 --- /dev/null +++ b/types/reactstrap/v4/lib/CardSubtitle.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardSubtitle: React.StatelessComponent; +export default CardSubtitle; diff --git a/types/reactstrap/v4/lib/CardText.d.ts b/types/reactstrap/v4/lib/CardText.d.ts new file mode 100644 index 0000000000..13177fba67 --- /dev/null +++ b/types/reactstrap/v4/lib/CardText.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardText: React.StatelessComponent; +export default CardText; diff --git a/types/reactstrap/v4/lib/CardTitle.d.ts b/types/reactstrap/v4/lib/CardTitle.d.ts new file mode 100644 index 0000000000..2843800a4e --- /dev/null +++ b/types/reactstrap/v4/lib/CardTitle.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var CardTitle: React.StatelessComponent; +export default CardTitle; diff --git a/types/reactstrap/v4/lib/Col.d.ts b/types/reactstrap/v4/lib/Col.d.ts new file mode 100644 index 0000000000..a2ea76d607 --- /dev/null +++ b/types/reactstrap/v4/lib/Col.d.ts @@ -0,0 +1,24 @@ +export type ColumnProps + = string + | boolean + | number + | { + size?: boolean | number | string + push?: string | number + pull?: string | number + offset?: string | number + }; + +interface Props extends React.HTMLProps { + xs?: ColumnProps; + sm?: ColumnProps; + md?: ColumnProps; + lg?: ColumnProps; + xl?: ColumnProps; + + //custom widths + widths?: string[]; +} + +declare var Col: React.StatelessComponent; +export default Col; diff --git a/types/reactstrap/v4/lib/Collapse.d.ts b/types/reactstrap/v4/lib/Collapse.d.ts new file mode 100644 index 0000000000..50160bbcf6 --- /dev/null +++ b/types/reactstrap/v4/lib/Collapse.d.ts @@ -0,0 +1,18 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + isOpen?: boolean; + classNames?: string; + cssModule?: CSSModule; + tag?: React.ReactType; + navbar?: boolean; + delay?: { + show: number + hide: number + }; + onOpened?: () => void; + onClosed?: () => void; +} + +declare var Collapse: React.StatelessComponent; +export default Collapse; diff --git a/types/reactstrap/v4/lib/Container.d.ts b/types/reactstrap/v4/lib/Container.d.ts new file mode 100644 index 0000000000..f49951ba26 --- /dev/null +++ b/types/reactstrap/v4/lib/Container.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + fluid?: boolean; + className?: string; + cssModule?: CSSModule; +} + +declare var Container: React.StatelessComponent; +export default Container; diff --git a/types/reactstrap/v4/lib/Dropdown.d.ts b/types/reactstrap/v4/lib/Dropdown.d.ts new file mode 100644 index 0000000000..19d1500cbe --- /dev/null +++ b/types/reactstrap/v4/lib/Dropdown.d.ts @@ -0,0 +1,22 @@ +/// + +import { CSSModule } from '../index'; + +export interface UncontrolledProps { + isOpen?: boolean; + toggle?: () => void; + className?: string; + cssModule?: CSSModule; +} + +export interface Props extends UncontrolledProps { + disabled?: boolean; + dropup?: boolean; + group?: boolean; + size?: string; + tag?: React.ReactType; + tether?: boolean | Tether.ITetherOptions; +} + +declare var Dropdown: React.StatelessComponent; +export default Dropdown; diff --git a/types/reactstrap/v4/lib/DropdownItem.d.ts b/types/reactstrap/v4/lib/DropdownItem.d.ts new file mode 100644 index 0000000000..6fae837041 --- /dev/null +++ b/types/reactstrap/v4/lib/DropdownItem.d.ts @@ -0,0 +1,15 @@ +import { CSSModule } from '../index'; + +interface Props { + disabled?: boolean; + divider?: boolean; + tag?: React.ReactType; + header?: boolean; + onClick?: (event: React.MouseEvent) => void; + className?: string; + cssModule?: CSSModule; + href?: string; +} + +declare var DropdownItem: React.StatelessComponent; +export default DropdownItem; diff --git a/types/reactstrap/v4/lib/DropdownMenu.d.ts b/types/reactstrap/v4/lib/DropdownMenu.d.ts new file mode 100644 index 0000000000..7fae41b04b --- /dev/null +++ b/types/reactstrap/v4/lib/DropdownMenu.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + right?: boolean; + className?: string; + cssModule?: CSSModule; +} + +declare var DropdownMenu: React.StatelessComponent; +export default DropdownMenu; diff --git a/types/reactstrap/v4/lib/DropdownToggle.d.ts b/types/reactstrap/v4/lib/DropdownToggle.d.ts new file mode 100644 index 0000000000..5ef49db71f --- /dev/null +++ b/types/reactstrap/v4/lib/DropdownToggle.d.ts @@ -0,0 +1,19 @@ +import { CSSModule } from '../index'; + +interface Props { + caret?: boolean; + className?: string; + cssModule?: CSSModule; + disabled?: boolean; + onClick?: React.MouseEventHandler; + 'data-toggle'?: string; + 'aria-haspopup'?: boolean; + split?: boolean; + tag?: React.ReactType; + nav?: boolean; + color?: string; + size?: string; +} + +declare var DropdownToggle: React.StatelessComponent; +export default DropdownToggle; diff --git a/types/reactstrap/v4/lib/Fade.d.ts b/types/reactstrap/v4/lib/Fade.d.ts new file mode 100644 index 0000000000..30862d2e17 --- /dev/null +++ b/types/reactstrap/v4/lib/Fade.d.ts @@ -0,0 +1,20 @@ +import { CSSModule } from '../index'; + +interface Props { + baseClass?: string; + baseClassIn?: string; + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + transitionAppearTimeout?: number; + transitionEnterTimeout?: number; + transitionLeaveTimeout?: number; + transitionAppear?: boolean; + transitionEnter?: boolean; + transitionLeave?: boolean; + onLeave?: () => void; + onEnter?: () => void; +} + +declare var Fade: React.StatelessComponent; +export default Fade; diff --git a/types/reactstrap/v4/lib/Form.d.ts b/types/reactstrap/v4/lib/Form.d.ts new file mode 100644 index 0000000000..dd06a2f855 --- /dev/null +++ b/types/reactstrap/v4/lib/Form.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + inline?: boolean; + tag?: React.ReactType; + getRef?: string | ((instance: HTMLButtonElement) => any); + className?: string; + cssModule?: CSSModule; +} + +declare var Form: React.StatelessComponent; +export default Form; diff --git a/types/reactstrap/v4/lib/FormFeedback.d.ts b/types/reactstrap/v4/lib/FormFeedback.d.ts new file mode 100644 index 0000000000..7fde21b062 --- /dev/null +++ b/types/reactstrap/v4/lib/FormFeedback.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: string; + className?: string; + cssModule?: CSSModule; +} + +declare var FormFeedback: React.StatelessComponent; +export default FormFeedback; diff --git a/types/reactstrap/v4/lib/FormGroup.d.ts b/types/reactstrap/v4/lib/FormGroup.d.ts new file mode 100644 index 0000000000..6031ff2f75 --- /dev/null +++ b/types/reactstrap/v4/lib/FormGroup.d.ts @@ -0,0 +1,14 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + row?: boolean; + check?: boolean; + disabled?: boolean; + tag?: React.ReactType; + color?: string; + className?: string; + cssModule?: CSSModule; +} + +declare var FormGroup: React.StatelessComponent; +export default FormGroup; diff --git a/types/reactstrap/v4/lib/FormText.d.ts b/types/reactstrap/v4/lib/FormText.d.ts new file mode 100644 index 0000000000..3cfab3511e --- /dev/null +++ b/types/reactstrap/v4/lib/FormText.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props { + inline?: boolean; + tag?: React.ReactType; + color?: string; + className?: string; + cssModule?: CSSModule; +} + +declare var FormText: React.StatelessComponent; +export default FormText; diff --git a/types/reactstrap/v4/lib/Input.d.ts b/types/reactstrap/v4/lib/Input.d.ts new file mode 100644 index 0000000000..541016ca02 --- /dev/null +++ b/types/reactstrap/v4/lib/Input.d.ts @@ -0,0 +1,52 @@ +import { CSSModule } from '../index'; + +type InputType = + | 'text' + | 'email' + | 'select' + | 'file' + | 'radio' + | 'checkbox' + | 'textarea' + | 'button' + | 'reset' + | 'submit' + | 'date' + | 'datetime-local' + | 'hidden' + | 'image' + | 'month' + | 'number' + | 'range' + | 'search' + | 'tel' + | 'url' + | 'week' + | 'password' + | 'datetime' + | 'time' + | 'color'; + +// Intermediate interface to "redefine" the type of size to string +// size:number => size:any => size:string +interface Intermediate extends React.InputHTMLAttributes { + size?: any; +} + +interface InputProps extends Intermediate { + type?: InputType; + size?: string; + state?: string; + valid?: boolean; + tag?: React.ReactType; + getRef?: string | ((instance: HTMLInputElement) => any); + static?: boolean; + addon?: boolean; + className?: string; + cssModule?: CSSModule; + // We don't have the property 'static' here because 'static' is a reserved keyword in TypeScript + // Maybe reactstrap will support an 'isStatic' alias in the future +} + +declare var Input: React.StatelessComponent; +export default Input; diff --git a/types/reactstrap/v4/lib/InputGroup.d.ts b/types/reactstrap/v4/lib/InputGroup.d.ts new file mode 100644 index 0000000000..2de95edc94 --- /dev/null +++ b/types/reactstrap/v4/lib/InputGroup.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + size?: string; + className?: string; + cssModule?: CSSModule; +} + +declare var InputGroup: React.StatelessComponent; +export default InputGroup; diff --git a/types/reactstrap/v4/lib/InputGroupAddon.d.ts b/types/reactstrap/v4/lib/InputGroupAddon.d.ts new file mode 100644 index 0000000000..a98eb5d821 --- /dev/null +++ b/types/reactstrap/v4/lib/InputGroupAddon.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var InputGroupAddon: React.StatelessComponent; +export default InputGroupAddon; diff --git a/types/reactstrap/v4/lib/InputGroupButton.d.ts b/types/reactstrap/v4/lib/InputGroupButton.d.ts new file mode 100644 index 0000000000..fa7cb1995a --- /dev/null +++ b/types/reactstrap/v4/lib/InputGroupButton.d.ts @@ -0,0 +1,13 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + groupClassName?: string; + groupAttributes?: any; + className?: string; + cssModule?: CSSModule; + color?: string; +} + +declare var InputGroupButton: React.StatelessComponent; +export default InputGroupButton; diff --git a/types/reactstrap/v4/lib/Jumbotron.d.ts b/types/reactstrap/v4/lib/Jumbotron.d.ts new file mode 100644 index 0000000000..cc1f65c956 --- /dev/null +++ b/types/reactstrap/v4/lib/Jumbotron.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + fluid?: boolean; + className?: string; + cssModule?: CSSModule; +} + +declare var Jumbotron: React.StatelessComponent; +export default Jumbotron; diff --git a/types/reactstrap/v4/lib/Label.d.ts b/types/reactstrap/v4/lib/Label.d.ts new file mode 100644 index 0000000000..eb496d90a3 --- /dev/null +++ b/types/reactstrap/v4/lib/Label.d.ts @@ -0,0 +1,26 @@ +import { CSSModule } from '../index'; +import { ColumnProps } from './Col'; + +interface Intermediate extends React.LabelHTMLAttributes { + size?: any; +} + +interface Props extends Intermediate { + hidden?: boolean; + check?: boolean; + inline?: boolean; + disabled?: boolean; + size?: string; + for?: string; + tag?: string; + className?: string; + cssModule?: CSSModule; + xs?: ColumnProps; + sm?: ColumnProps; + md?: ColumnProps; + lg?: ColumnProps; + xl?: ColumnProps; +} + +declare var Label: React.StatelessComponent; +export default Label; diff --git a/types/reactstrap/v4/lib/ListGroup.d.ts b/types/reactstrap/v4/lib/ListGroup.d.ts new file mode 100644 index 0000000000..861c7a1d06 --- /dev/null +++ b/types/reactstrap/v4/lib/ListGroup.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + flush?: boolean; + className?: string; + cssModule?: CSSModule; +} + +declare var ListGroup: React.StatelessComponent; +export default ListGroup; diff --git a/types/reactstrap/v4/lib/ListGroupItem.d.ts b/types/reactstrap/v4/lib/ListGroupItem.d.ts new file mode 100644 index 0000000000..b2241998dc --- /dev/null +++ b/types/reactstrap/v4/lib/ListGroupItem.d.ts @@ -0,0 +1,17 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + active?: boolean; + disabled?: boolean; + color?: string; + action?: boolean; + className?: string; + cssModule?: CSSModule; + href?: string; + + onClick?: React.MouseEventHandler; +} + +declare var ListGroupItem: React.StatelessComponent; +export default ListGroupItem; diff --git a/types/reactstrap/v4/lib/ListGroupItemHeading.d.ts b/types/reactstrap/v4/lib/ListGroupItemHeading.d.ts new file mode 100644 index 0000000000..869a6b2708 --- /dev/null +++ b/types/reactstrap/v4/lib/ListGroupItemHeading.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var ListGroupItemHeading: React.StatelessComponent; +export default ListGroupItemHeading; diff --git a/types/reactstrap/v4/lib/ListGroupItemText.d.ts b/types/reactstrap/v4/lib/ListGroupItemText.d.ts new file mode 100644 index 0000000000..df263f30d8 --- /dev/null +++ b/types/reactstrap/v4/lib/ListGroupItemText.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var ListGroupItemText: React.StatelessComponent; +export default ListGroupItemText; diff --git a/types/reactstrap/v4/lib/Media.d.ts b/types/reactstrap/v4/lib/Media.d.ts new file mode 100644 index 0000000000..c5408d85d7 --- /dev/null +++ b/types/reactstrap/v4/lib/Media.d.ts @@ -0,0 +1,21 @@ +import { CSSModule } from '../index'; + +interface Props { + body?: boolean; + bottom?: boolean; + className?: string; + cssModule?: CSSModule; + heading?: boolean; + left?: boolean; + list?: boolean; + middle?: boolean; + object?: boolean; + right?: boolean; + tag?: React.ReactType; + top?: boolean; + href?: string; + alt?: string; +} + +declare var Media: React.StatelessComponent; +export default Media; diff --git a/types/reactstrap/v4/lib/Modal.d.ts b/types/reactstrap/v4/lib/Modal.d.ts new file mode 100644 index 0000000000..1e239fbe12 --- /dev/null +++ b/types/reactstrap/v4/lib/Modal.d.ts @@ -0,0 +1,23 @@ +import { CSSModule } from '../index'; + +interface Props { + isOpen?: boolean; + autoFocus?: boolean; + size?: string; + toggle?: () => void; + keyboard?: boolean; + backdrop?: boolean | 'static'; + onEnter?: () => void; + onExit?: () => void; + className?: string; + cssModule?: CSSModule; + wrapClassName?: string; + modalClassName?: string; + backdropClassName?: string; + contentClassName?: string; + zIndex?: number | string; + fade?: boolean; +} + +declare var Modal: React.StatelessComponent; +export default Modal; diff --git a/types/reactstrap/v4/lib/ModalBody.d.ts b/types/reactstrap/v4/lib/ModalBody.d.ts new file mode 100644 index 0000000000..98933b2fc2 --- /dev/null +++ b/types/reactstrap/v4/lib/ModalBody.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var ModalBody: React.StatelessComponent; +export default ModalBody; diff --git a/types/reactstrap/v4/lib/ModalFooter.d.ts b/types/reactstrap/v4/lib/ModalFooter.d.ts new file mode 100644 index 0000000000..84b3da7ec8 --- /dev/null +++ b/types/reactstrap/v4/lib/ModalFooter.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var ModalFooter: React.StatelessComponent; +export default ModalFooter; diff --git a/types/reactstrap/v4/lib/ModalHeader.d.ts b/types/reactstrap/v4/lib/ModalHeader.d.ts new file mode 100644 index 0000000000..494c9685a3 --- /dev/null +++ b/types/reactstrap/v4/lib/ModalHeader.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + wrapTag?: React.ReactType; + toggle?: () => void; +} + +declare var ModalHeader: React.StatelessComponent; +export default ModalHeader; diff --git a/types/reactstrap/v4/lib/Nav.d.ts b/types/reactstrap/v4/lib/Nav.d.ts new file mode 100644 index 0000000000..c646e94304 --- /dev/null +++ b/types/reactstrap/v4/lib/Nav.d.ts @@ -0,0 +1,17 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + inline?: boolean; + disabled?: boolean; + tabs?: boolean; + pills?: boolean; + stacked?: boolean; + navbar?: boolean; + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + vertical?: boolean; +} + +declare var Nav: React.StatelessComponent; +export default Nav; diff --git a/types/reactstrap/v4/lib/NavDropdown.d.ts b/types/reactstrap/v4/lib/NavDropdown.d.ts new file mode 100644 index 0000000000..6b480d495a --- /dev/null +++ b/types/reactstrap/v4/lib/NavDropdown.d.ts @@ -0,0 +1,12 @@ +import { + UncontrolledProps as DropdownUncontrolledProps, + Props as DropdownProps +} from './Dropdown'; + +// tslint:disable-next-line +export interface UncontrolledProps extends DropdownUncontrolledProps { } +// tslint:disable-next-line +interface Props extends DropdownProps { } + +declare var NavDropdown: React.StatelessComponent; +export default NavDropdown; \ No newline at end of file diff --git a/types/reactstrap/v4/lib/NavItem.d.ts b/types/reactstrap/v4/lib/NavItem.d.ts new file mode 100644 index 0000000000..db19f92c56 --- /dev/null +++ b/types/reactstrap/v4/lib/NavItem.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var NavItem: React.StatelessComponent; +export default NavItem; diff --git a/types/reactstrap/v4/lib/NavLink.d.ts b/types/reactstrap/v4/lib/NavLink.d.ts new file mode 100644 index 0000000000..2871fad72e --- /dev/null +++ b/types/reactstrap/v4/lib/NavLink.d.ts @@ -0,0 +1,15 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + tag?: React.ReactType; + getRef?: string | ((instance: HTMLButtonElement) => any); + disabled?: boolean; + active?: boolean; + className?: string; + cssModule?: CSSModule; + onClick?: React.MouseEventHandler; + href?: string; +} + +declare var NavLink: React.StatelessComponent; +export default NavLink; diff --git a/types/reactstrap/v4/lib/Navbar.d.ts b/types/reactstrap/v4/lib/Navbar.d.ts new file mode 100644 index 0000000000..58f9235140 --- /dev/null +++ b/types/reactstrap/v4/lib/Navbar.d.ts @@ -0,0 +1,20 @@ +import { CSSModule } from '../index'; + +interface Props { + light?: boolean; + dark?: boolean; + inverse?: boolean; + full?: boolean; + fixed?: string; + sticky?: string; + color?: string; + role?: string; + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + toggleable?: boolean | string; + expand?: boolean | string; +} + +declare var Navbar: React.StatelessComponent; +export default Navbar; diff --git a/types/reactstrap/v4/lib/NavbarBrand.d.ts b/types/reactstrap/v4/lib/NavbarBrand.d.ts new file mode 100644 index 0000000000..3748a2903f --- /dev/null +++ b/types/reactstrap/v4/lib/NavbarBrand.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var NavbarBrand: React.StatelessComponent; +export default NavbarBrand; diff --git a/types/reactstrap/v4/lib/NavbarToggler.d.ts b/types/reactstrap/v4/lib/NavbarToggler.d.ts new file mode 100644 index 0000000000..282eeaa672 --- /dev/null +++ b/types/reactstrap/v4/lib/NavbarToggler.d.ts @@ -0,0 +1,13 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + tag?: React.ReactType; + type?: string; + className?: string; + cssModule?: CSSModule; + right?: boolean; + left?: boolean; +} + +declare var NavbarToggler: React.StatelessComponent; +export default NavbarToggler; diff --git a/types/reactstrap/v4/lib/Pagination.d.ts b/types/reactstrap/v4/lib/Pagination.d.ts new file mode 100644 index 0000000000..a34401be35 --- /dev/null +++ b/types/reactstrap/v4/lib/Pagination.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + className?: string; + cssModule?: CSSModule; + size?: string; +} + +declare var Pagination: React.StatelessComponent; +export default Pagination; diff --git a/types/reactstrap/v4/lib/PaginationItem.d.ts b/types/reactstrap/v4/lib/PaginationItem.d.ts new file mode 100644 index 0000000000..183a7e9d84 --- /dev/null +++ b/types/reactstrap/v4/lib/PaginationItem.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props { + className?: string; + cssModule?: CSSModule; + active?: boolean; + disabled?: boolean; + tag?: React.ReactType; +} + +declare var PaginationItem: React.StatelessComponent; +export default PaginationItem; diff --git a/types/reactstrap/v4/lib/PaginationLink.d.ts b/types/reactstrap/v4/lib/PaginationLink.d.ts new file mode 100644 index 0000000000..16e194578d --- /dev/null +++ b/types/reactstrap/v4/lib/PaginationLink.d.ts @@ -0,0 +1,13 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps { + 'aria-label'?: string; + className?: string; + cssModule?: CSSModule; + next?: boolean; + previous?: boolean; + tag?: React.ReactType; +} + +declare var PaginationLink: React.StatelessComponent; +export default PaginationLink; diff --git a/types/reactstrap/v4/lib/Popover.d.ts b/types/reactstrap/v4/lib/Popover.d.ts new file mode 100644 index 0000000000..b779a33ede --- /dev/null +++ b/types/reactstrap/v4/lib/Popover.d.ts @@ -0,0 +1,34 @@ +/// + +import { CSSModule } from '../index'; + +type Placement + = 'top' + | 'bottom' + | 'left' + | 'right' + | 'top left' + | 'top center' + | 'top right' + | 'right top' + | 'right middle' + | 'right bottom' + | 'bottom right' + | 'bottom center' + | 'bottom left' + | 'left top' + | 'left middle' + | 'left bottom'; + +interface Props { + placement?: Placement; + target: string; + isOpen?: boolean; + tether?: Tether.ITetherOptions; + className?: string; + cssModule?: CSSModule; + toggle?: () => void; +} + +declare var Popover: React.StatelessComponent; +export default Popover; diff --git a/types/reactstrap/v4/lib/PopoverContent.d.ts b/types/reactstrap/v4/lib/PopoverContent.d.ts new file mode 100644 index 0000000000..cac45d14cb --- /dev/null +++ b/types/reactstrap/v4/lib/PopoverContent.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var PopoverContent: React.StatelessComponent; +export default PopoverContent; diff --git a/types/reactstrap/v4/lib/PopoverTitle.d.ts b/types/reactstrap/v4/lib/PopoverTitle.d.ts new file mode 100644 index 0000000000..796de02658 --- /dev/null +++ b/types/reactstrap/v4/lib/PopoverTitle.d.ts @@ -0,0 +1,10 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var PopoverTitle: React.StatelessComponent; +export default PopoverTitle; diff --git a/types/reactstrap/v4/lib/Progress.d.ts b/types/reactstrap/v4/lib/Progress.d.ts new file mode 100644 index 0000000000..09c4304373 --- /dev/null +++ b/types/reactstrap/v4/lib/Progress.d.ts @@ -0,0 +1,18 @@ +import { CSSModule } from '../index'; + +interface Props { + bar?: boolean; + multi?: boolean; + tag?: string; + value?: string | number; + max?: string | number; + animated?: boolean; + striped?: boolean; + color?: string; + className?: string; + cssModule?: CSSModule; + barClassName?: string; +} + +declare var Progress: React.StatelessComponent; +export default Progress; diff --git a/types/reactstrap/v4/lib/Row.d.ts b/types/reactstrap/v4/lib/Row.d.ts new file mode 100644 index 0000000000..1ffbb9f7e6 --- /dev/null +++ b/types/reactstrap/v4/lib/Row.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props extends React.HTMLProps< HTMLElement> { + className?: string; + cssModule?: CSSModule; + tag?: React.ReactType; + noGutters?: boolean; +} + +declare var Row: React.StatelessComponent; +export default Row; diff --git a/types/reactstrap/v4/lib/TabContent.d.ts b/types/reactstrap/v4/lib/TabContent.d.ts new file mode 100644 index 0000000000..af6feec078 --- /dev/null +++ b/types/reactstrap/v4/lib/TabContent.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + activeTab?: number | string; + className?: string; + cssModule?: CSSModule; +} + +declare var TabContent: React.StatelessComponent; +export default TabContent; diff --git a/types/reactstrap/v4/lib/TabPane.d.ts b/types/reactstrap/v4/lib/TabPane.d.ts new file mode 100644 index 0000000000..9eead420be --- /dev/null +++ b/types/reactstrap/v4/lib/TabPane.d.ts @@ -0,0 +1,11 @@ +import { CSSModule } from '../index'; + +interface Props { + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; + tabId?: number | string; +} + +declare var TabPane: React.StatelessComponent; +export default TabPane; diff --git a/types/reactstrap/v4/lib/Table.d.ts b/types/reactstrap/v4/lib/Table.d.ts new file mode 100644 index 0000000000..ec8bfc43fd --- /dev/null +++ b/types/reactstrap/v4/lib/Table.d.ts @@ -0,0 +1,18 @@ +import { CSSModule } from '../index'; + +interface Props { + className?: string; + cssModule?: CSSModule; + size?: string; + bordered?: boolean; + striped?: boolean; + inverse?: boolean; + hover?: boolean; + reflow?: boolean; + responsive?: boolean; + tag?: React.ReactType; + responsiveTag?: React.ReactType; +} + +declare var Table: React.StatelessComponent; +export default Table; diff --git a/types/reactstrap/v4/lib/Tag.d.ts b/types/reactstrap/v4/lib/Tag.d.ts new file mode 100644 index 0000000000..7dce8876f2 --- /dev/null +++ b/types/reactstrap/v4/lib/Tag.d.ts @@ -0,0 +1,12 @@ +import { CSSModule } from '../index'; + +interface Props { + color?: string; + pill?: boolean; + tag?: React.ReactType; + className?: string; + cssModule?: CSSModule; +} + +declare var Tag: React.StatelessComponent; +export default Tag; diff --git a/types/reactstrap/v4/lib/TetherContent.d.ts b/types/reactstrap/v4/lib/TetherContent.d.ts new file mode 100644 index 0000000000..cbc22373e3 --- /dev/null +++ b/types/reactstrap/v4/lib/TetherContent.d.ts @@ -0,0 +1,18 @@ +/// + +import { CSSModule } from '../index'; + +interface Props { + className?: string; + cssModule?: CSSModule; + arrow?: string; + disabled?: boolean; + isOpen: boolean; + toggle: () => void; + tether: Tether.ITetherOptions; + tetherRef?: (tether: Tether) => void; + style?: React.CSSProperties; +} + +declare var TetherContent: React.StatelessComponent; +export default TetherContent; diff --git a/types/reactstrap/v4/lib/Tooltip.d.ts b/types/reactstrap/v4/lib/Tooltip.d.ts new file mode 100644 index 0000000000..9dba615084 --- /dev/null +++ b/types/reactstrap/v4/lib/Tooltip.d.ts @@ -0,0 +1,43 @@ +/// + +import { CSSModule } from '../index'; + +type Placement + = 'top' + | 'bottom' + | 'left' + | 'right' + | 'top left' + | 'top center' + | 'top right' + | 'right top' + | 'right middle' + | 'right bottom' + | 'bottom right' + | 'bottom center' + | 'bottom left' + | 'left top' + | 'left middle' + | 'left bottom'; + +export interface UncontrolledProps { + placement?: Placement; + target: string; + disabled?: boolean; + tether?: Tether.ITetherOptions; + tetherRef?: (tether: Tether) => void; + className?: string; + cssModule?: CSSModule; + autohide?: boolean; + delay?: number | { show: number, hide: number }; +} + +interface Props extends UncontrolledProps { + toggle?: () => void; + isOpen?: boolean; +} + + + +declare var Tooltip: React.StatelessComponent; +export default Tooltip; diff --git a/types/reactstrap/v4/lib/Uncontrolled.d.ts b/types/reactstrap/v4/lib/Uncontrolled.d.ts new file mode 100644 index 0000000000..151ee012d3 --- /dev/null +++ b/types/reactstrap/v4/lib/Uncontrolled.d.ts @@ -0,0 +1,29 @@ +import { + UncontrolledProps as AlertUncontrolledProps +} from './Alert'; +import { + UncontrolledProps as ButtonDropdownUncontrolledProps +} from './ButtonDropdown'; +import { + UncontrolledProps as DropdownUncontrolledProps +} from './Dropdown'; +import { + UncontrolledProps as NavDropdownUncontrolledProps +} from './NavDropdown'; +import { + UncontrolledProps as TooltipUncontrolledProps +} from './Tooltip'; + +declare var UncontrolledAlert: React.StatelessComponent; +declare var UncontrolledButtonDropdown: React.StatelessComponent; +declare var UncontrolledDropdown: React.StatelessComponent; +declare var UncontrolledNavDropdown: React.StatelessComponent; +declare var UncontrolledTooltip: React.StatelessComponent; + +export { + UncontrolledAlert, + UncontrolledButtonDropdown, + UncontrolledDropdown, + UncontrolledNavDropdown, + UncontrolledTooltip +} \ No newline at end of file diff --git a/types/reactstrap/v4/reactstrap-tests.tsx b/types/reactstrap/v4/reactstrap-tests.tsx new file mode 100644 index 0000000000..b094d4d019 --- /dev/null +++ b/types/reactstrap/v4/reactstrap-tests.tsx @@ -0,0 +1,3502 @@ +import * as React from 'react'; +import { + Alert, + UncontrolledAlert, + Badge, + Breadcrumb, + BreadcrumbItem, + Button, + ButtonDropdown, + ButtonGroup, + ButtonToolbar, + Dropdown, + DropdownItem, + DropdownMenu, + DropdownToggle, + Card, + CardBody, + CardBlock, + CardColumns, + CardDeck, + CardFooter, + CardGroup, + CardHeader, + CardImg, + CardImgOverlay, + CardLink, + CardSubtitle, + CardText, + CardTitle, + Row, + Col, + Container, + Collapse, + Fade, + Form, + FormFeedback, + FormGroup, + FormText, + Input, + InputGroup, + InputGroupAddon, + InputGroupButton, + Pagination, + Label, + ListGroup, + ListGroupItem, + ListGroupItemHeading, + ListGroupItemText, + ModalFooter, + Modal, + ModalBody, + ModalHeader, + Jumbotron, + Media, + Nav, + Navbar, + NavbarBrand, + NavbarToggler, + NavDropdown, + NavItem, + NavLink, + PaginationItem, + PaginationLink, + Popover, + PopoverContent, + PopoverTitle, + Progress, + TabPane, + UncontrolledButtonDropdown, + UncontrolledDropdown, + UncontrolledNavDropdown, + UncontrolledTooltip, + TabContent, + Table, + Tag, + TetherContent, + Tooltip +} from 'reactstrap'; + +// --------------- Alert +const Examplea = (props: any) => { + return ( +

+ + Well done! You successfully read this important alert message. + + + Heads up! This alert needs your attention, but it's not super important. + + + Warning! Better check yourself, you're not looking too good. + + + Oh snap! Change a few things up and try submitting again. + +
+ ); +}; + +class AlertExample extends React.Component { + constructor(props: any) { + super(props); + + this.state = { + visible: true + }; + } + + onDismiss = () => { + this.setState({ visible: false }); + } + + render() { + return ( + + I am an alert and I can be dismissed! + + ); + } +} + +function AlertExample1() { + return ( + + I am an alert and I can be dismissed! + + ); +} + +// --------------- Badge +class Example2 extends React.Component { + render() { + return ( +
+

Heading New

+

Heading New

+

Heading New

+

Heading New

+
Heading New
+
Heading New
+
+ ); + } +} + +export class Example3 extends React.Component { + render() { + return ( +
+ default + primary + success + info + warning + danger +
+ ); + } +} + +class Example4 extends React.Component { + render() { + return ( +
+ default{' '} + primary{' '} + success{' '} + info{' '} + warning{' '} + danger +
+ ); + } +} + +// ------------- Breadcrumbs +const Example5 = (props: any) => { + return ( +
+ + Home + + + Home + Library + + + Home + Library + Data + +
+ ); +}; + +const Example6 = (props: any) => { + return ( +
+ + Home + Library + Data + Bootstrap + +
+ ); +}; + +// ------------- Buttons +class Example7 extends React.Component { + render() { + return ( +
+ {' '} + {' '} + {' '} + {' '} + {' '} + {' '} + +
+ ); + } +} + +class Example8 extends React.Component { + render() { + return ( +
+ {' '} + {' '} + {' '} + {' '} + {' '} + +
+ ); + } +} + +const Example9 = ( +
+ {' '} + +
+); + +const Example10 = ( +
+ {' '} + +
+); + +const Example11 = ( +
+ + +
+); + +const Example12 = ( +
+ {' '} + +
+); + +const Example13 = ( +
+ {' '} + +
+); + +class Example14 extends React.Component { + constructor(props: any) { + super(props); + + this.state = { cSelected: [] }; + + this.onRadioBtnClick = this.onRadioBtnClick.bind(this); + this.onCheckboxBtnClick = this.onCheckboxBtnClick.bind(this); + } + + onRadioBtnClick(rSelected: number) { + this.setState({ rSelected }); + } + + onCheckboxBtnClick(selected: number) { + const index = this.state.cSelected.indexOf(selected); + if (index < 0) { + this.state.cSelected.push(selected); + } else { + this.state.cSelected.splice(index, 1); + } + this.setState({ cSelected: [...this.state.cSelected] }); + } + + render() { + return ( +
+
Radio Buttons
+ + + + + +

Selected: {this.state.rSelected}

+ +
Checkbox Buttons
+ + + + + +

Selected: {JSON.stringify(this.state.cSelected)}

+
+ ); + } +} + +// ------------- Button Dropdown +class Example15 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + dropdownOpen: false + }; + } + + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen + }); + } + + render() { + return ( + + + Button Dropdown + + + Header + Action + Another Action + + { + // something happens here + }}>Another Action + + + ); + } +} + +const Example16 = ( + true}> + + Text + + + Header + Action + Another Action + + Another Action + + +); + +const Example17 = (props: any) => ( + true}> + + + + Header + Action + Another Action + + Another Action + + +); + +const Example18 = ( +
+ true}> + + Large Button + + + Another Action + Another Action + + + + true}> + + Small Button + + + Another Action + Another Action + + +
+); + +const Example19 = ( + true} dropup> + + Dropup + + + Another Action + Another Action + + +); + +// --------------- ButtonGroup +class Example20 extends React.Component { + render() { + return ( + + {' '} + {' '} + + + ); + } +} + +class Example21 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + ); + } +} + +const Example22 = (props: any) => ( +
+ + + + + + + + + + + + + + + + + +
+); + +const Example23 = (props: any) => ( + + + + true}> + + Dropdown + + + Dropdown Link + Dropdown Link + + + +); + +const Example24 = (props: any) => ( + + + + true}> + + Dropdown + + + Dropdown Link + Dropdown Link + + + +); + +// ------------------ Cards +const Example25 = (props: any) => { + return ( +
+ + + + Card title + Card subtitle + Some quick example text to build on the card title and make up the bulk of the card's content. + + + +
+ ); +}; + +const Example26 = (props: any) => { + return ( +
+ + + Card title + Card subtitle + + Card image cap + + Some quick example text to build on the card title and make up the bulk of the card's content. + Card Link + Another Link + + +
+ ); +}; + +const Example27 = (props: any) => { + return ( + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + + ); +}; + +const Example28 = (props: any) => { + return ( +
+ + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + +
+ ); +}; + +const Example29 = (props: any) => { + return ( +
+ + Header + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + Footer + + + + Featured + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + Footer + +
+ ); +}; + +const Example30 = (props: any) => { + return ( +
+ + + + Card Title + This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. + + Last updated 3 mins ago + + + + + + Card Title + This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. + + Last updated 3 mins ago + + + + +
+ ); +}; + +const Example31 = (props: any) => { + return ( +
+ + + + Card Title + This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. + + Last updated 3 mins ago + + + +
+ ); +}; + +const Example32 = (props: any) => { + return ( +
+ + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + +
+ ); +}; + +const Example33 = (props: any) => { + return ( +
+ + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + +
+ ); +}; + +const Example34 = (props: any) => { + return ( + + + + + Card title + Card subtitle + This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. + + + + + + + Card title + Card subtitle + This card has supporting text below as a natural lead-in to additional content. + + + + + + + Card title + Card subtitle + + This is a wider card with supporting text below as a natural lead-in to additional content. This + card has even longer content than the first to show that equal height action. + + + + + + ); +}; + +const Example35 = (props: any) => { + return ( + + + + + Card title + Card subtitle + This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. + + + + + + + Card title + Card subtitle + This card has supporting text below as a natural lead-in to additional content. + + + + + + + Card title + Card subtitle + + This is a wider card with supporting text below as a natural lead-in to additional content. This card has + even longer content than the first to show that equal height action. + + + + + + ); +}; + +const Example36 = (props: any) => { + return ( + + + + + Card title + Card subtitle + This is a wider card with supporting text below as a natural lead-in to additional content. This content is a little bit longer. + + + + + + + + + Card title + Card subtitle + This card has supporting text below as a natural lead-in to additional content. + + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + + + Card title + Card subtitle + + This is a wider card with supporting text below as a natural lead-in to additional content. This card + has even longer content than the first to show that equal height action. + + + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + ); +}; + +// ------------------ Collapse + +class Example37 extends React.Component { + constructor(props: any) { + super(props); + this.toggle = this.toggle.bind(this); + this.state = { collapse: false }; + } + + toggle() { + this.setState({ collapse: !this.state.collapse }); + } + + render() { + return ( +
+ + + + + Anim pariatur cliche reprehenderit, + enim eiusmod high life accusamus terry richardson ad squid. Nihil + anim keffiyeh helvetica, craft beer labore wes anderson cred + nesciunt sapiente ea proident. + + + +
+ ); + } +} + +class Example38 extends React.Component { + constructor(props: any) { + super(props); + this.onOpened = this.onOpened.bind(this); + this.onClosed = this.onClosed.bind(this); + this.toggle = this.toggle.bind(this); + this.state = { collapse: false, status: 'Closed' }; + } + + onOpened() { + this.setState({ ...this.state, status: 'Opened' }); + } + + onClosed() { + this.setState({ ...this.state, status: 'Closed' }); + } + + toggle() { + const status = !this.state.collapse ? 'Opening...' : 'Closing...'; + this.setState({ collapse: !this.state.collapse, status }); + } + + render() { + return ( +
+ +
Current state: {this.state.status}
+ + + + Anim pariatur cliche reprehenderit, + enim eiusmod high life accusamus terry richardson ad squid. Nihil + anim keffiyeh helvetica, craft beer labore wes anderson cred + nesciunt sapiente ea proident. + + + +
+ ); + } +} + +// ------- Dropdown + +class Example39 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + dropdownOpen: false + }; + } + + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen + }); + } + + render() { + return ( + + + Dropdown + + + Header + Action + Another Action + + Another Action + + + ); + } +} + +const Example40 = (props: any) => ( + false}> + + Dropdown + + + Header + Action + Another Action + + Another Action + + +); + +const Example41 = (props: any) => ( + Header +); + +const Example42 = (props: any) => ( +
+ + Action + Action + true}> + asdfasd + sadfas + + + true}> + sadfasd + sadf + + + true}> + asdf + sasdfsdf + + +
+); + +class Example43 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + dropdownOpen: false + }; + } + + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen + }); + } + + render() { + return ( + + + Custom Dropdown Content + + +
Custom dropdown item
+
Custom dropdown item
+
Custom dropdown item
+
Custom dropdown item
+
+
+ ); + } +} + +function Example44() { + return ( + + + Dropdown + + + Header + Action + Another Action + + Another Action + + + ); +} + +// ------------------ Form +class Example45 extends React.Component { + render() { + return ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is some placeholder block-level help text for the above input. + It's a bit lighter and easily wraps to a new line. + + + + Radio Buttons + + + + + + + + + + + + + + +
+ ); + } +} + +class Example46 extends React.Component { + render() { + return ( +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is some placeholder block-level help text for the above input. + It's a bit lighter and easily wraps to a new line. + + + + + Radio Buttons + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ); + } +} + +class Example47 extends React.Component { + render() { + return ( +
+ + {' '} + + + {' '} + + {' '} + + + {' '} + +
+ ); + } +} + +class Example48 extends React.Component { + render() { + return ( +
+ + + + Success! You did it! + Example help text that remains unchanged. + + + + + Whoops, check your formatting and try again. + Example help text that remains unchanged. + + + + + Oh noes! that name is already taken + Example help text that remains unchanged. + +
+ ); + } +} + +class Example49 extends React.Component { + render() { + return ( +
+ + + Some static value + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + This is some placeholder block-level help text for the above input. + It's a bit lighter and easily wraps to a new line. + + + + + + + + +
+ ); + } +} + +class Example50 extends React.Component { + render() { + return ( +
+ + + + + + + + + + + + +
+ ); + } +} + +class Example51 extends React.Component { + render() { + return ( +
+ + + + + {' '} + + + + + {' '} + +
+ ); + } +} + +const Example52 = (props: any) => { + return ( +
+ + @ + + +
+ + + + + + +
+ + + @example.com + +
+ + $ + $ + + $ + $ + +
+ + $ + + .00 + +
+ ); +}; + +const Example53 = (props: any) => { + return ( +
+ + To the Left! + + +
+ + + To the Right! + +
+ + To the Left! + + To the Right! + +
+ ); +}; + +const Example54 = (props: any) => { + return ( +
+ + @lg + + +
+ + @normal + + +
+ + @sm + + +
+ ); +}; + +const Example55 = (props: any) => { + return ( +
+ + + + +
+ + + + +
+ + + + + +
+ ); +}; + +const Example56 = (props: any) => { + return ( +
+ + @lg + + +
+ + @normal + + +
+ + @sm + + +
+ ); +}; + +const Example57 = (props: any) => { + return ( +
+ + + + +
+ + + + +
+ + + + + +
+ ); +}; + +const Example58 = (props: any) => { + return ( +
+ + To the Left! + + +
+ + + To the Right! + +
+ + To the Left! + + To the Right! + +
+ ); +}; + +const Example59 = (props: any) => { + return ( +
+ +

Hello, world!

+

This is a simple hero unit, a simple Jumbotron-style component for calling extra attention to featured content or information.

+
+

It uses utility classes for typgraphy and spacing to space content out within the larger container.

+

+ +

+
+
+ ); +}; + +const Example60 = (props: any) => { + return ( +
+ + +

Fluid jumbotron

+

This is a modified jumbotron that occupies the entire horizontal space of its parent.

+
+
+
+ ); +}; + +class Example61 extends React.Component { + render() { + return ( + + + .col + + + .col + .col + .col + .col + + + .col-3 + .col-auto - variable width content + .col-3 + + + .col-6 + .col-6 + + + .col-6 .col-sm-4 + .col-6 .col-sm-4 + .col .col-sm-4 + + + .col .col-sm-6 .col-sm-push-2 .col-sm-pull-2 .col-sm-offset-2 + + + .col .col-sm-12 .col-md-6 .col-md-offset-3 + + + .col .col-sm .col-sm-offset-1 + .col .col-sm .col-sm-offset-1 + + + ); + } +} + +class Example62 extends React.Component { + render() { + return ( + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Porta ac consectetur ac + Vestibulum at eros + + ); + } +} + +class Example63 extends React.Component { + render() { + return ( + + Cras justo odio 14 + Dapibus ac facilisis in 2 + Morbi leo risus 1 + + ); + } +} + +class Example64 extends React.Component { + render() { + return ( + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Porta ac consectetur ac + Vestibulum at eros + + ); + } +} + +class Example65 extends React.Component { + render() { + return ( +
+

Anchors

+

Be sure to not use the standard .btn classes here.

+ + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Porta ac consectetur ac + Vestibulum at eros + +

+

Buttons

+ + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Porta ac consectetur ac + Vestibulum at eros + +
+ ); + } +} + +class Example66 extends React.Component { + render() { + return ( + + Cras justo odio + Dapibus ac facilisis in + Morbi leo risus + Porta ac consectetur ac + + ); + } +} + +class Example67 extends React.Component { + render() { + return ( + + + List group item heading + + Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit. + + + + List group item heading + + Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit. + + + + List group item heading + + Donec id elit non mi porta gravida at eget metus. Maecenas sed diam eget risus varius blandit. + + + + ); + } +} + +// ------------- Media +const Example68 = () => { + return ( + + + + + + + Media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus + odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. + Donec lacinia congue felis in faucibus. + + + ); +}; + +const Example69 = () => { + return ( + + + + + + + Media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras purus + odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate fringilla. + Donec lacinia congue felis in faucibus. + + + + + + + Nested media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras + purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate + fringilla. Donec lacinia congue felis in faucibus. + + + + + ); +}; + +const Example70 = () => { + return ( +
+ + + + + + + Top aligned media + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras + purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate + fringilla. Donec lacinia congue felis in faucibus. + + + + + + + + + Middle aligned media + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras + purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate + fringilla. Donec lacinia congue felis in faucibus. + + + + + + + + + Bottom aligned media + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras + purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate + fringilla. Donec lacinia congue felis in faucibus. + + +
+ ); +}; + +const Example71 = () => { + return ( + + + + + + + + Media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras + purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate + fringilla. Donec lacinia congue felis in faucibus. + + + + + + + Nested media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. + Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi + vulputate fringilla. Donec lacinia congue felis in faucibus. + + + + + + + Nested media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. + Cras purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi + vulputate fringilla. Donec lacinia congue felis in faucibus. + + + + + + + + + + + Nested media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras + purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate + fringilla. Donec lacinia congue felis in faucibus. + + + + + + + + Media heading + + Cras sit amet nibh libero, in gravida nulla. Nulla vel metus scelerisque ante sollicitudin commodo. Cras + purus odio, vestibulum in vulputate at, tempus viverra turpis. Fusce condimentum nunc ac nisi vulputate + fringilla. Donec lacinia congue felis in faucibus. + + + + + + + ); +}; + +// --------------- Modal +class ModalExample72 extends React.Component { + constructor(props: any) { + super(props); + this.state = { + modal: false + }; + + this.toggle = this.toggle.bind(this); + } + + toggle() { + this.setState({ + modal: !this.state.modal + }); + } + + render() { + return ( +
+ + + Modal title + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex + ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat + nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit + anim id est laborum. + + + {' '} + + + +
+ ); + } +} + +class ModalExample73 extends React.Component { + constructor(props: any) { + super(props); + this.state = { + modal: false, + backdrop: true + }; + + this.toggle = this.toggle.bind(this); + this.changeBackdrop = this.changeBackdrop.bind(this); + } + + toggle() { + this.setState({ + modal: !this.state.modal + }); + } + + changeBackdrop(e: React.ChangeEvent) { + let value = e.target.value; + if (value !== 'static') { + value = JSON.parse(value); + } + this.setState({ backdrop: value }); + } + + render() { + return ( +
+
e.preventDefault()}> + + {' '} + + + + + + + {' '} + +
+ + Modal title + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip + ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt + mollit anim id est laborum. + + + {' '} + + + +
+ ); + } +} + +class ModalExample74 extends React.Component { + constructor(props: any) { + super(props); + this.state = { + modal: false, + nestedModal: false, + }; + + this.toggle = this.toggle.bind(this); + this.toggleNested = this.toggleNested.bind(this); + } + + toggle() { + this.setState({ + modal: !this.state.modal + }); + } + + toggleNested() { + this.setState({ + nestedModal: !this.state.nestedModal + }); + } + + render() { + return ( +
+ + + Modal title + + Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et + dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex + ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu + fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt + mollit anim id est laborum. +
+ + + Nested Modal title + Stuff and things + + {' '} + + + +
+ + {' '} + + +
+
+ ); + } +} + +class Example75 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + isOpen: false + }; + } + toggle() { + this.setState({ + isOpen: !this.state.isOpen + }); + } + render() { + return ( +
+ + + reactstrap + + + + +
+ ); + } +} + +class Example76 extends React.Component { + constructor(props: any) { + super(props); + + this.toggleNavbar = this.toggleNavbar.bind(this); + this.state = { + collapsed: true + }; + } + + toggleNavbar() { + this.setState({ + collapsed: !this.state.collapsed + }); + } + render() { + return ( +
+ + + + reactstrap + + + +
+ ); + } +} + +class Example77 extends React.Component { + render() { + return ( +
+

List Based

+ +
+

Link Based

+ +
+ ); + } +} + +class Example78 extends React.Component { + render() { + return ( +
+

List Based

+ +
+

Link based

+ +
+ ); + } +} + +class Example79 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + dropdownOpen: false + }; + } + + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen + }); + } + + render() { + return ( +
+ +
+ ); + } +} + +class Example80 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + dropdownOpen: false + }; + } + + toggle() { + this.setState({ + dropdownOpen: !this.state.dropdownOpen + }); + } + + render() { + return ( +
+ +
+ ); + } +} + +// ----------- Pagination +class Example81 extends React.Component { + render() { + return ( + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + + + ); + } +} + +class Example82 extends React.Component { + render() { + return ( + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + 4 + + + + + 5 + + + + + + + ); + } +} + +class Example83 extends React.Component { + render() { + return ( + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + + + ); + } +} + +class Example84 extends React.Component { + render() { + return ( + + + + + + + 1 + + + + + 2 + + + + + 3 + + + + + + + ); + } +} + +// ------------------------- Popover +class Example85 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + popoverOpen: false + }; + } + + toggle() { + this.setState({ + popoverOpen: !this.state.popoverOpen + }); + } + + render() { + return ( +
+ + + Popover Title + Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. + +
+ ); + } +} + +class PopoverItem extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + popoverOpen: false + }; + } + + toggle() { + this.setState({ + popoverOpen: !this.state.popoverOpen + }); + } + + render() { + return ( + + + + Popover Title + Sed posuere consectetur est at lobortis. Aenean eu leo quam. Pellentesque ornare sem lacinia quam venenatis vestibulum. + + + ); + } +} + +class PopoverExampleMulti extends React.Component}> { + constructor(props: any) { + super(props); + + this.state = { + popovers: [ + { + placement: 'top', + text: 'Top' + }, + { + placement: 'bottom', + text: 'Bottom' + }, + { + placement: 'left', + text: 'Left' + }, + { + placement: 'right', + text: 'Right' + } + ] + }; + } + + render() { + return ( +
+ {this.state.popovers.map((popover, i) => { + return ; + })} +
+ ); + } +} + +// ------------------------- Progress + +const Example86 = (props: any) => { + return ( +
+
0%
+ +
25%
+ +
50%
+ +
75%
+ +
100%
+ +
Multiple bars
+ + + + + + + +
+ ); +}; + +const Example87 = (props: any) => { + return ( +
+ + + + + +
+ ); +}; + +const Example88 = (props: any) => { + return ( +
+ 25% + 1/2 + You're almost there! + You did it! + + Meh + Wow! + Cool + 20% + !! + +
+ ); +}; + +const Example89 = (props: any) => { + return ( +
+ + + + + + + + + + + +
+ ); +}; + +const Example90 = (props: any) => { + return ( +
+ + + + + + + + + + + +
+ ); +}; + +const Example91 = (props: any) => { + return ( +
+
Plain
+ + + + + + + +
With Labels
+ + Meh + Wow! + 25% + LOOK OUT!! + +
Stripes and Animations
+ + Stripes + Animated Stripes + Plain + +
+ ); +}; + +const Example92 = (props: any) => { + return ( +
+
1 of 5
+ +
50 of 135
+ +
75 of 111
+ +
463 of 500
+ + +
Various (40) of 55
+ + 5 + 15 + 10 + 10 + +
+ ); +}; + +// --------------- Table +class Example93 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ ); + } +} + +class Example94 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ ); + } +} + +class Example95 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ ); + } +} + +class Example96 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ ); + } +} + +class Example97 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ ); + } +} + +class Example98 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#First NameLast NameUsername
1MarkOtto@mdo
2JacobThornton@fat
3Larrythe Bird@twitter
+ ); + } +} + +class Example99 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Table headingTable headingTable headingTable headingTable headingTable heading
1Table cellTable cellTable cellTable cellTable cellTable cell
2Table cellTable cellTable cellTable cellTable cellTable cell
3Table cellTable cellTable cellTable cellTable cellTable cell
+ ); + } +} + +class Example100 extends React.Component { + render() { + return ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
#Table headingTable headingTable headingTable headingTable headingTable heading
1Table cellTable cellTable cellTable cellTable cellTable cell
2Table cellTable cellTable cellTable cellTable cellTable cell
3Table cellTable cellTable cellTable cellTable cellTable cell
+ ); + } +} + +class Example101 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + activeTab: '1' + }; + } + + toggle(tab: string) { + if (this.state.activeTab !== tab) { + this.setState({ + activeTab: tab + }); + } + } + render() { + return ( +
+ + + + + +

Tab 1 Contents

+ +
+
+ + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + + + Special Title Treatment + With supporting text below as a natural lead-in to additional content. + + + + + +
+
+ ); + } +} + +class Example102 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + tooltipOpen: false + }; + } + + toggle() { + this.setState({ + tooltipOpen: !this.state.tooltipOpen + }); + } + + render() { + return ( +
+

Somewhere in here is a tooltip.

+ + Hello world! + +
+ ); + } +} + +class Example103 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + tooltipOpen: false + }; + } + + toggle() { + this.setState({ + tooltipOpen: !this.state.tooltipOpen + }); + } + + render() { + return ( +
+

Sometimes you need to allow users to select text within a tooltip.

+ + Try to select this text! + +
+ ); + } +} + +class TooltipItem extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + tooltipOpen: false + }; + } + + toggle() { + this.setState({ + tooltipOpen: !this.state.tooltipOpen + }); + } + + render() { + return ( + + + + Tooltip Content! + + + ); + } +} + +class TooltipExampleMulti extends React.Component { + constructor(props: any) { + super(props); + + this.state = { + tooltips: [ + { + placement: 'top', + text: 'Top' + }, + { + placement: 'bottom', + text: 'Bottom' + }, + { + placement: 'left', + text: 'Left' + }, + { + placement: 'right', + text: 'Right' + } + ] + }; + } + + render() { + return ( +
+ {this.state.tooltips.map((tooltip: {placement: string; text: string; }, i: number) => { + return ; + })} +
+ ); + } +} + +function Example() { + return ( +
+

Somewhere in here is a tooltip.

+ + Hello world! + +
+ ); +} + +function Example104() { + const props = { + className: 'my-input', + style: { + borderColor: 'black', + } + }; + + return ( + + + + + + + + ); +} + +function Example105() { + return ( + + + + +
+ Item +
+
+
+ ); +} + +function Example106() { + return ( + + ); +} + +const CSSModuleExample = (props: any) => { + const cssModule = { + btn: 'hash' + }; + + return ( + + ); +}; + +class Example107 extends React.Component { + private input: HTMLInputElement; + + render() { + return { this.input = input; }} />; + } +} + +class Example108 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + isOpen: false + }; + } + toggle() { + this.setState({ + isOpen: !this.state.isOpen + }); + } + render() { + return ( +
+ + + reactstrap + + + + +
+ ); + } +} + +class Example109 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + isOpen: false + }; + } + toggle() { + this.setState({ + isOpen: !this.state.isOpen + }); + } + render() { + return ( +
+ + + reactstrap + + + + +
+ ); + } +} + +class Example110 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + isOpen: false + }; + } + toggle() { + this.setState({ + isOpen: !this.state.isOpen + }); + } + render() { + return ( +
+ + + reactstrap + + + + +
+ ); + } +} + +class Example111 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + isOpen: false + }; + } + toggle() { + this.setState({ + isOpen: !this.state.isOpen + }); + } + render() { + return ( +
+ + + reactstrap + + + + +
+ ); + } +} + +class Example112 extends React.Component { + constructor(props: any) { + super(props); + + this.toggle = this.toggle.bind(this); + this.state = { + isOpen: false + }; + } + toggle() { + this.setState({ + isOpen: !this.state.isOpen + }); + } + render() { + return ( +
+ + + reactstrap + + + + +
+ ); + } +} + +const Example113 = (props: any) => { + return ( +
+ + + Anim pariatur cliche reprehenderit, + enim eiusmod high life accusamus terry richardson ad squid. Nihil + anim keffiyeh helvetica, craft beer labore wes anderson cred + nesciunt sapiente ea proident. + + +
+ ); + }; diff --git a/types/reactstrap/v4/tsconfig.json b/types/reactstrap/v4/tsconfig.json new file mode 100644 index 0000000000..73578a9178 --- /dev/null +++ b/types/reactstrap/v4/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "jsx": "react", + "baseUrl": "../../", + "typeRoots": [ + "../../" + ], + "paths": { + "reactstrap": ["reactstrap/v4"] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "reactstrap-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/reactstrap/v4/tslint.json b/types/reactstrap/v4/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/reactstrap/v4/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } From 1417a41506f312c6904ac95f3ee320ed65e917a3 Mon Sep 17 00:00:00 2001 From: cwmoo740 Date: Fri, 27 Oct 2017 20:43:19 -0400 Subject: [PATCH 62/78] react-autosuggest: expand themekey to allow any string keys --- types/react-autosuggest/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/react-autosuggest/index.d.ts b/types/react-autosuggest/index.d.ts index 2d0034fd46..b1f080efe5 100644 --- a/types/react-autosuggest/index.d.ts +++ b/types/react-autosuggest/index.d.ts @@ -62,7 +62,7 @@ declare namespace Autosuggest { 'suggestionsContainerOpen' | 'suggestionsList' | 'suggestion' | 'suggestionFirst' | 'suggestionHighlighted' | 'sectionContainer' | 'sectionContainerFirst' | 'sectionTitle'; - type Theme = Partial>; + type Theme = Record | Partial>; interface AutosuggestProps extends React.Props { suggestions: any[]; From da80f707e2058ed18305461c61bdea1e30860e11 Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Sat, 28 Oct 2017 14:17:43 -0700 Subject: [PATCH 63/78] add typing for endsWith --- types/ramda/index.d.ts | 8 ++++++++ types/ramda/ramda-tests.ts | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index f0c95c7a8c..a2a3b426d4 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -553,6 +553,14 @@ declare namespace R { */ empty(x: T): T; + /** + * Checks if a list ends with the provided values + */ + endsWith(a: string, list: string): boolean; + endsWith(a: string): (list: string) => boolean; + endsWith(a: T | T[], list: T[]): boolean; + endsWith(a: T | T[]): (list: T[]) => boolean; + /** * Takes a function and two values in its domain and returns true if the values map to the same value in the * codomain; false otherwise. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 2ce8bae2ca..699792feec 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -2241,6 +2241,15 @@ class Rectangle { R.isEmpty({a: 1}); // => false }; +() => { + R.endsWith("c", "abc"); // => true + R.endsWith("c")("abc"); // => true + R.endsWith(3, [1, 2, 3]); // => true + R.endsWith(3)([1, 2, 3]); // => true + R.endsWith([3], [1, 2, 3]); // => true + R.endsWith([3])([1, 2, 3]); // => true +}; + () => { R.not(true); // => false R.not(false); // => true From b0d60e347dc336fc6ed0f095fdfa0b5577cb78fb Mon Sep 17 00:00:00 2001 From: Samson Keung Date: Sat, 28 Oct 2017 14:22:59 -0700 Subject: [PATCH 64/78] up version --- types/ramda/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index a2a3b426d4..8187eb59f2 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ramda 0.24 +// Type definitions for ramda 0.25 // Project: https://github.com/donnut/typescript-ramda // Definitions by: Erwin Poeze // Matt DeKrey From ba33e49fa7c46ede875a031965855da569b2339c Mon Sep 17 00:00:00 2001 From: Liam Goodacre Date: Sun, 1 Oct 2017 11:36:00 +0100 Subject: [PATCH 65/78] Remove myself from ramda contributors --- types/ramda/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index f0c95c7a8c..b65b21eaa2 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -2,7 +2,6 @@ // Project: https://github.com/donnut/typescript-ramda // Definitions by: Erwin Poeze // Matt DeKrey -// Liam Goodacre // Matt Dziuban // Stephen King // Alejandro Fernandez Haro From 94755b8d90555514eeeaee2d9067f08828a60904 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 07:41:58 -0700 Subject: [PATCH 66/78] oauth2orize: Lint (#21045) --- types/oauth2orize/index.d.ts | 49 +++++++---------- types/oauth2orize/oauth2orize-tests.ts | 53 ++++++++++-------- types/oauth2orize/tslint.json | 75 +------------------------- 3 files changed, 51 insertions(+), 126 deletions(-) diff --git a/types/oauth2orize/index.d.ts b/types/oauth2orize/index.d.ts index 3e2d31b564..8aec610893 100644 --- a/types/oauth2orize/index.d.ts +++ b/types/oauth2orize/index.d.ts @@ -8,41 +8,30 @@ import { ServerRequest, ServerResponse } from "http"; -interface OAuth2 { +export interface OAuth2 { client: any; - user: any; - transactionID: string; - redirectURI: string; - req: OAuth2Req; - info: OAuth2Info; } -interface OAuth2Req { +export interface OAuth2Req { clientID: string; - redirectURI: string; - scope: string; - state: string; - type: string; - transactionID: string; } -interface OAuth2Info { +export interface OAuth2Info { scope: string; } export interface MiddlewareRequest extends ServerRequest { oauth2?: OAuth2; - user?: any; } @@ -51,7 +40,7 @@ export interface ServerOptions { loadTransaction: boolean; } -export const createServer: (options?: ServerOptions) => OAuth2Server; +export function createServer(options?: ServerOptions): OAuth2Server; export interface AuthorizeOptions { idLength?: number; @@ -68,33 +57,31 @@ export interface ErrorHandlerOptions { mode?: string; } -type MiddlewareFunction = (req: MiddlewareRequest, res: ServerResponse, next: MiddlewareNextFunction) => void; +export type MiddlewareFunction = (req: MiddlewareRequest, res: ServerResponse, next: MiddlewareNextFunction) => void; -type MiddlewareErrorFunction = (err: Error, req: MiddlewareRequest, res: ServerResponse, next: MiddlewareNextFunction) => void; +export type MiddlewareErrorFunction = (err: Error, req: MiddlewareRequest, res: ServerResponse, next: MiddlewareNextFunction) => void; -type MiddlewareNextFunction = (err?: Error) => void; +export type MiddlewareNextFunction = (err?: Error) => void; -type ValidateFunction = (clientId: string, redirectURI: string, validated: (err: Error | null, client?: any, redirectURI?: string) => void) => void; +export type ValidateFunction = (clientId: string, redirectURI: string, validated: (err: Error | null, client?: any, redirectURI?: string) => void) => void; -type ImmediateFunction = (client: any, user: any, scope: string[], type: string, areq: any, done: (err: Error | null, allow: boolean, info: any, locals: any) => void) => void; +export type ImmediateFunction = (client: any, user: any, scope: string[], type: string, areq: any, done: (err: Error | null, allow: boolean, info: any, locals: any) => void) => void; -type DecisionParseFunction = (req: MiddlewareRequest, done: (err: Error | null, params: any) => void) => void; +export type DecisionParseFunction = (req: MiddlewareRequest, done: (err: Error | null, params: any) => void) => void; -type SerializeClientFunction = (client: any, done: SerializeClientDoneFunction) => void; -type SerializeClientDoneFunction = (err: Error | null, id: string) => void; +export type SerializeClientFunction = (client: any, done: SerializeClientDoneFunction) => void; +export type SerializeClientDoneFunction = (err: Error | null, id: string) => void; -type DeserializeClientFunction = (id: string, done: DeserializeClientDoneFunction) => void; -type DeserializeClientDoneFunction = (err: Error | null, client?: any | boolean) => void; +export type DeserializeClientFunction = (id: string, done: DeserializeClientDoneFunction) => void; +export type DeserializeClientDoneFunction = (err: Error | null, client?: any | boolean) => void; -type IssueGrantCodeFunction = (client: any, redirectUri: string, user: any, res: any, issued: (err: Error | null, code?: string) => void) => void; +export type IssueGrantCodeFunction = (client: any, redirectUri: string, user: any, res: any, issued: (err: Error | null, code?: string) => void) => void; -type IssueGrantTokenFunction = (client: any, user: any, ares: any, issued: (err: Error | null, code?: string, params?: any) => void) => void; +export type IssueGrantTokenFunction = (client: any, user: any, ares: any, issued: (err: Error | null, code?: string, params?: any) => void) => void; +export type IssueExchangeCodeFunction = (client: any, code: string, redirectURI: string, issued: ExchangeDoneFunction) => void; -type IssueExchangeCodeFunction = (client: any, code: string, redirectURI: string, issued: ExchangeDoneFunction) => void; - -type ExchangeDoneFunction = (err: Error | null, accessToken?: string | boolean, refreshToken?: string, params?: any) => void; - +export type ExchangeDoneFunction = (err: Error | null, accessToken?: string | boolean, refreshToken?: string, params?: any) => void; export class OAuth2Server { grant(type: string, fn: MiddlewareFunction): OAuth2Server; diff --git a/types/oauth2orize/oauth2orize-tests.ts b/types/oauth2orize/oauth2orize-tests.ts index 49d7c94794..84d9fe95e9 100644 --- a/types/oauth2orize/oauth2orize-tests.ts +++ b/types/oauth2orize/oauth2orize-tests.ts @@ -17,19 +17,20 @@ server.grant(oauth2orize.grant.code((client, redirectURI, user, ares, done) => { // }); })); - // Register Exchanges -class AuthorizationCode { - static findOne(code: string, callback: (err: Error, code: { - clientId: string, userId: string, redirectURI: string, scope: string - }) => void): void {} -} +function findOne(code: string, callback: (err: Error, code: { + clientId: string, userId: string, redirectURI: string, scope: string +}) => void): void {} server.exchange(oauth2orize.exchange.code((client, code, redirectURI, done) => { - AuthorizationCode.findOne(code, (err, code) => { - if (err) { return done(err); } - if (client.id !== code.clientId) { return done(null, false); } - if (redirectURI !== code.redirectURI) { return done(null, false); } + findOne(code, (err, code) => { + if (err) { + done(err); + } else if (client.id !== code.clientId) { + done(null, false); + } else if (redirectURI !== code.redirectURI) { + done(null, false); + } // var token = utils.uid(256); // var at = new AccessToken(token, code.userId, code.clientId, code.scope); @@ -43,7 +44,7 @@ server.exchange(oauth2orize.exchange.code((client, code, redirectURI, done) => { // Implement Authorization Endpoint class Clients { static findOne(id: string, callback: (err: Error, client?: Clients) => void): void { - callback(new Error(), {} as Clients); + callback(new Error(), {} as Clients); // tslint:disable-line no-object-literal-type-assertion } redirectURI: string; } @@ -52,33 +53,41 @@ class Clients { // login.ensureLoggedIn(), server.authorize((clientID, redirectURI, done) => { Clients.findOne(clientID, (err, client) => { - if (err) { return done(err); } - if (!client) { return done(null, false); } - if (client.redirectURI != redirectURI) { return done(null, false); } - return done(null, client, client.redirectURI); + if (err) { + done(err); + } else if (!client) { + done(null, false); + } else if (client.redirectURI !== redirectURI) { + done(null, false); + } else { + done(null, client, client.redirectURI); + } }); - }), + }); (req: http.IncomingMessage, res: http.ServerResponse) => { // res.render('dialog', { transactionID: req.oauth2.transactionID, // user: req.user, client: req.oauth2.client }); - } + }; // ); // Session Serialization server.serializeClient((client, done) => { - return done(null, client.id); + done(null, client.id); }); server.deserializeClient((id, done) => { Clients.findOne(id, (err, client) => { - if (err) { return done(err); } - return done(null, client); + if (err) { + done(err); + } else { + done(null, client); + } }); }); // Implement Token Endpoint // app.post('/token', // passport.authenticate(['basic', 'oauth2-client-password'], { session: false }), - server.token(), - server.errorHandler() + server.token(); + server.errorHandler(); // ); diff --git a/types/oauth2orize/tslint.json b/types/oauth2orize/tslint.json index a41bf5d19a..f12cd9111f 100644 --- a/types/oauth2orize/tslint.json +++ b/types/oauth2orize/tslint.json @@ -1,79 +1,8 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, + // TODOs "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } } From 4e52c4dea610e2517f252d033ef65271c80b53f4 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 07:55:19 -0700 Subject: [PATCH 67/78] jquery: Fix lint (#20965) --- types/jquery/index.d.ts | 8 +++----- types/jquery/jquery-tests.ts | 9 ++++++--- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/types/jquery/index.d.ts b/types/jquery/index.d.ts index bac194ee78..ef3d33a09e 100644 --- a/types/jquery/index.d.ts +++ b/types/jquery/index.d.ts @@ -235,7 +235,6 @@ interface JQueryStatic { * * @param element The DOM element to query for the data. * @param key Name of the data stored. - * @param undefined * @see {@link https://api.jquery.com/jQuery.data/} * @since 1.2.3 */ @@ -728,7 +727,7 @@ interface JQueryStatic { * @see {@link https://api.jquery.com/jQuery.parseHTML/} * @since 1.8 */ - parseHTML(data: string, context_keepScripts?: Document | null | undefined | boolean): JQuery.Node[]; + parseHTML(data: string, context_keepScripts?: Document | null | boolean): JQuery.Node[]; /** * Takes a well-formed JSON string and returns the resulting JavaScript value. * @@ -3422,7 +3421,6 @@ interface JQuery extends Iterable * data(name, value) or by an HTML5 data-* attribute. * * @param key Name of the data stored. - * @param undefined * @see {@link https://api.jquery.com/data/} * @since 1.2.3 */ @@ -6774,7 +6772,7 @@ declare namespace JQuery { (failFilter?: ((t: TJ, u: UJ, v: VJ, ...s: SJ[]) => PromiseBase | Thenable | ARF) | undefined | null): PromiseBase | Thenable | ARF) | null): PromiseBase; @@ -7355,7 +7353,7 @@ declare namespace JQuery { (failFilter?: ((...t: TJ[]) => PromiseBase | Thenable | ARF) | undefined | null): PromiseBase | Thenable | ARF) | null): PromiseBase; diff --git a/types/jquery/jquery-tests.ts b/types/jquery/jquery-tests.ts index 32f26b1489..6cb790f408 100644 --- a/types/jquery/jquery-tests.ts +++ b/types/jquery/jquery-tests.ts @@ -7193,7 +7193,8 @@ function JQuery_Promise3() { } async function testAsync(p: JQuery.Promise3): Promise { - return await p; + const s: string = await p; + return s; } function compatibleWithPromise(): Promise { @@ -7336,7 +7337,8 @@ function JQuery_Promise2(p: JQuery.Promise2): Promise { - return await p; + const s: string = await p; + return s; } function compatibleWithPromise(): Promise { @@ -7456,7 +7458,8 @@ function JQuery_Promise(p: JQuery.Promise) { } async function testAsync(p: JQuery.Promise): Promise { - return await p; + const s: string = await p; + return s; } function compatibleWithPromise(): Promise { From 43a7bc6d9943a2069075632a0c726adba0d00130 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 07:55:37 -0700 Subject: [PATCH 68/78] signals: Fix lint (#20973) --- types/signals/index.d.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/types/signals/index.d.ts b/types/signals/index.d.ts index 50982ec988..be0a87df74 100644 --- a/types/signals/index.d.ts +++ b/types/signals/index.d.ts @@ -30,9 +30,7 @@ declare namespace signals { /** * Custom event broadcaster *
- inspired by Robert Penner's AS3 Signals. - * @name Signal * @author Miller Medeiros - * @constructor */ new (): Signal; From 3b321e99b2a5b9ee535a1f405c2115d8e017eed9 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 07:55:51 -0700 Subject: [PATCH 69/78] highcharts: Fix lint (#20979) --- types/highcharts/index.d.ts | 6 ------ 1 file changed, 6 deletions(-) diff --git a/types/highcharts/index.d.ts b/types/highcharts/index.d.ts index 9b2087b651..5ee84c77ee 100644 --- a/types/highcharts/index.d.ts +++ b/types/highcharts/index.d.ts @@ -1753,9 +1753,6 @@ declare namespace Highcharts { * @deprecated */ defaultSeriesType?: string; - /** - * - */ description?: string; /** * Event listeners for the chart. @@ -3666,9 +3663,6 @@ declare namespace Highcharts { * @default 0.1 */ brightness?: number; - /** - * - */ color?: string | Gradient; /** * Enable separate styles for the hovered series to visualize that the user hovers either the series itself or the From 1cf7a72cb6be7ccee2647c9aa57218c4abeb490c Mon Sep 17 00:00:00 2001 From: Paul Colleoni Date: Tue, 31 Oct 2017 00:04:35 +0900 Subject: [PATCH 70/78] [react] added backgroundSize to the CSSProperties (#20862) --- types/react/index.d.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/types/react/index.d.ts b/types/react/index.d.ts index 77356b922b..b2dc6057cc 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -926,6 +926,11 @@ declare namespace React { */ backgroundRepeat?: CSSWideKeyword | any; + /** + * Defines the size of the background images + */ + backgroundSize?: CSSWideKeyword | any; + /** * Obsolete - spec retired, not implemented. */ From b10fee8e1b54dbbb87d8caca208004adf72f48e7 Mon Sep 17 00:00:00 2001 From: Jacek Dargiel Date: Mon, 30 Oct 2017 17:27:13 +0100 Subject: [PATCH 71/78] [Chart.js] Update chart onClick Interface to be more specific and include `activeElements` array --- types/chart.js/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index ed4339f60f..e16b87aa0e 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -154,7 +154,7 @@ declare namespace Chart { responsiveAnimationDuration?: number; maintainAspectRatio?: boolean; events?: string[]; - onClick?(any?: any): any; + onClick?(event?: MouseEvent, activeElements?: Array<{}>): any; title?: ChartTitleOptions; legend?: ChartLegendOptions; tooltips?: ChartTooltipOptions; From ce6f98d3537a1481ec9d32bf18aa4f1de24c67f7 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 10:59:00 -0700 Subject: [PATCH 72/78] ember: Fix lint (#21123) --- types/ember/test/array-proxy.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/types/ember/test/array-proxy.ts b/types/ember/test/array-proxy.ts index 280ab52ded..763034bbd0 100755 --- a/types/ember/test/array-proxy.ts +++ b/types/ember/test/array-proxy.ts @@ -21,6 +21,7 @@ class MyNewProxy extends Ember.ArrayProxy { isNew = true; } -let x: MyNewProxy = MyNewProxy.create({ content: Ember.A([1, 2, 3]) }); -assertType(x.get('firstObject')); -assertType(x.isNew); +let x = MyNewProxy.create({ content: Ember.A([1, 2, 3]) }); +// TODO: type inference can't infer 'number', just '{}' +// x.get('firstObject'); // $ExpectType number | undefined +x.isNew; // $ExpectType boolean From 343d124ab1051986133f114dcf9c85c6c7264ef1 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 11:03:39 -0700 Subject: [PATCH 73/78] moment-strftime2 and react-widgets-moment: Add dependency on "moment" (#21124) --- types/moment-strftime2/package.json | 6 ++++++ types/react-widgets-moment/package.json | 6 ++++++ 2 files changed, 12 insertions(+) create mode 100644 types/moment-strftime2/package.json create mode 100644 types/react-widgets-moment/package.json diff --git a/types/moment-strftime2/package.json b/types/moment-strftime2/package.json new file mode 100644 index 0000000000..ac2bb42bad --- /dev/null +++ b/types/moment-strftime2/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": "^2.18.1" + } +} diff --git a/types/react-widgets-moment/package.json b/types/react-widgets-moment/package.json new file mode 100644 index 0000000000..ac2bb42bad --- /dev/null +++ b/types/react-widgets-moment/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "moment": "^2.18.1" + } +} From 3f7bbeaa51297fb4eaacb784f0baa9806b42ad1e Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 11:05:43 -0700 Subject: [PATCH 74/78] Miscellaneous lint fixes (#21116) --- types/adone/glosses/datetime.d.ts | 3 --- types/ignite-ui/index.d.ts | 36 ------------------------- types/jest-matcher-utils/package.json | 6 +++++ types/jquery/v1/jquery-tests.ts | 33 ++++++++++++----------- types/jquery/v2/jquery-tests.ts | 33 ++++++++++++----------- types/knuddels-userapps-api/tslint.json | 4 ++- types/markerclustererplus/index.d.ts | 2 -- types/restify-plugins/index.d.ts | 15 ----------- 8 files changed, 43 insertions(+), 89 deletions(-) create mode 100644 types/jest-matcher-utils/package.json diff --git a/types/adone/glosses/datetime.d.ts b/types/adone/glosses/datetime.d.ts index 417f706d95..5ce320f613 100644 --- a/types/adone/glosses/datetime.d.ts +++ b/types/adone/glosses/datetime.d.ts @@ -731,9 +731,6 @@ declare namespace adone { */ creationData(): DatetimeCreationData; - /** - * - */ parsingFlags(): DatetimeParsingFlags; /** diff --git a/types/ignite-ui/index.d.ts b/types/ignite-ui/index.d.ts index f4125c44cb..bff55ec33d 100644 --- a/types/ignite-ui/index.d.ts +++ b/types/ignite-ui/index.d.ts @@ -26081,8 +26081,6 @@ interface IgNumericEditor { */ toUpper?: any; - /** - */ textMode?: any; /** @@ -26636,8 +26634,6 @@ interface IgCurrencyEditor { */ toUpper?: any; - /** - */ textMode?: any; /** @@ -27068,8 +27064,6 @@ interface IgPercentEditor { */ toUpper?: any; - /** - */ textMode?: any; /** @@ -27429,8 +27423,6 @@ interface IgMaskEditor { */ dropDownOnReadOnly?: boolean; - /** - */ textMode?: any; /** @@ -27928,8 +27920,6 @@ interface IgDateEditor { */ dropDownOrientation?: string; - /** - */ textMode?: any; /** @@ -28450,8 +28440,6 @@ interface IgDatePicker { */ dropDownOrientation?: string; - /** - */ textMode?: any; /** @@ -30868,12 +30856,8 @@ interface JQuery { */ igNumericEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; - /** - */ igNumericEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igNumericEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -31777,12 +31761,8 @@ interface JQuery { */ igCurrencyEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; - /** - */ igCurrencyEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igCurrencyEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -32563,12 +32543,8 @@ interface JQuery { */ igPercentEditor(optionLiteral: 'option', optionName: "toUpper", optionValue: any): void; - /** - */ igPercentEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igPercentEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -33206,12 +33182,8 @@ interface JQuery { */ igMaskEditor(optionLiteral: 'option', optionName: "dropDownOnReadOnly", optionValue: boolean): void; - /** - */ igMaskEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igMaskEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -34144,12 +34116,8 @@ interface JQuery { */ igDateEditor(optionLiteral: 'option', optionName: "dropDownOrientation", optionValue: string): void; - /** - */ igDateEditor(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igDateEditor(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** @@ -35092,12 +35060,8 @@ interface JQuery { */ igDatePicker(optionLiteral: 'option', optionName: "dropDownOrientation", optionValue: string): void; - /** - */ igDatePicker(optionLiteral: 'option', optionName: "textMode"): any; - /** - */ igDatePicker(optionLiteral: 'option', optionName: "textMode", optionValue: any): void; /** diff --git a/types/jest-matcher-utils/package.json b/types/jest-matcher-utils/package.json new file mode 100644 index 0000000000..2cc9b48ed6 --- /dev/null +++ b/types/jest-matcher-utils/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chalk": "^2.2.0" + } +} diff --git a/types/jquery/v1/jquery-tests.ts b/types/jquery/v1/jquery-tests.ts index 4b6fc4e0db..d00c075125 100644 --- a/types/jquery/v1/jquery-tests.ts +++ b/types/jquery/v1/jquery-tests.ts @@ -2215,8 +2215,8 @@ function test_hide() { $("p").hide("slow"); }); $("#hidr").click(function () { - $("span:last-child").hide("fast", function () { - $(this).prev().hide("fast", arguments.callee); + $("span:last-child").hide("fast", function f() { + $(this).prev().hide("fast", f); }); }); $("#showr").click(function () { @@ -3126,20 +3126,21 @@ function test_map() { }).get().join(", ")); var mappedItems = $("li").map(function (index) { var replacement:any = $("
  • ").text($(this).text()).get(0); - if (index === 0) { - - // Make the first item all caps - $(replacement).text($(replacement).text().toUpperCase()); - } else if (index === 1 || index === 3) { - - // Delete the second and fourth items - replacement = null; - } else if (index === 2) { - - // Make two of the third item and add some text - replacement = [replacement, $("
  • ").get(0)]; - $(replacement[0]).append(" - A"); - $(replacement[1]).append("Extra - B"); + switch (index) { + case 0: + // Make the first item all caps + $(replacement).text($(replacement).text().toUpperCase()); + break; + case 1: + case 3: + // Delete the second and fourth items + replacement = null; + break; + case 2: + // Make two of the third item and add some text + replacement = [replacement, $("
  • ").get(0)]; + $(replacement[0]).append(" - A"); + $(replacement[1]).append("Extra - B"); } // Replacement will be a dom element, null, diff --git a/types/jquery/v2/jquery-tests.ts b/types/jquery/v2/jquery-tests.ts index 4b6fc4e0db..d00c075125 100644 --- a/types/jquery/v2/jquery-tests.ts +++ b/types/jquery/v2/jquery-tests.ts @@ -2215,8 +2215,8 @@ function test_hide() { $("p").hide("slow"); }); $("#hidr").click(function () { - $("span:last-child").hide("fast", function () { - $(this).prev().hide("fast", arguments.callee); + $("span:last-child").hide("fast", function f() { + $(this).prev().hide("fast", f); }); }); $("#showr").click(function () { @@ -3126,20 +3126,21 @@ function test_map() { }).get().join(", ")); var mappedItems = $("li").map(function (index) { var replacement:any = $("
  • ").text($(this).text()).get(0); - if (index === 0) { - - // Make the first item all caps - $(replacement).text($(replacement).text().toUpperCase()); - } else if (index === 1 || index === 3) { - - // Delete the second and fourth items - replacement = null; - } else if (index === 2) { - - // Make two of the third item and add some text - replacement = [replacement, $("
  • ").get(0)]; - $(replacement[0]).append(" - A"); - $(replacement[1]).append("Extra - B"); + switch (index) { + case 0: + // Make the first item all caps + $(replacement).text($(replacement).text().toUpperCase()); + break; + case 1: + case 3: + // Delete the second and fourth items + replacement = null; + break; + case 2: + // Make two of the third item and add some text + replacement = [replacement, $("
  • ").get(0)]; + $(replacement[0]).append(" - A"); + $(replacement[1]).append("Extra - B"); } // Replacement will be a dom element, null, diff --git a/types/knuddels-userapps-api/tslint.json b/types/knuddels-userapps-api/tslint.json index 67eb97841e..3c7d3fe9c7 100644 --- a/types/knuddels-userapps-api/tslint.json +++ b/types/knuddels-userapps-api/tslint.json @@ -3,6 +3,8 @@ "rules": { // TODOs "no-mergeable-namespace": false, - "no-unnecsesary-class": false + "no-redundant-jsdoc": false, + "no-redundant-jsdoc-2": false, + "no-unnecessary-class": false } } diff --git a/types/markerclustererplus/index.d.ts b/types/markerclustererplus/index.d.ts index 3277d1ba64..1485971e4c 100644 --- a/types/markerclustererplus/index.d.ts +++ b/types/markerclustererplus/index.d.ts @@ -85,7 +85,6 @@ declare class ClusterIcon extends google.maps.OverlayView { /** * A cluster icon. * - * @extends google.maps.OverlayView * @param cluster The cluster with which the icon is to be associated. * @param [styles] An array of {@link ClusterIconStyle} defining the cluster icons * to use for various cluster sizes. @@ -378,7 +377,6 @@ interface MarkerClustererOptions { declare class MarkerClusterer extends google.maps.OverlayView { /** * Creates a MarkerClusterer object with the options specified in {@link MarkerClustererOptions}. - * @extends google.maps.OverlayView * @param map The Google map to attach to. * @param [markers] The markers to be added to the cluster. * @param [options] The optional parameters. diff --git a/types/restify-plugins/index.d.ts b/types/restify-plugins/index.d.ts index 05a289c529..7a9155d5fa 100644 --- a/types/restify-plugins/index.d.ts +++ b/types/restify-plugins/index.d.ts @@ -14,9 +14,6 @@ export namespace pre { */ function context(): RequestHandler; - /** - * - */ function dedupeSlashes(): RequestHandler; /** @@ -73,9 +70,6 @@ export interface AuditLoggerOptions { */ printLog?: boolean; - /** - * - */ body?: boolean; } @@ -165,14 +159,8 @@ export interface BodyParserOptions { */ rejectUnknown?: boolean; - /** - * - */ reviver?: any; - /** - * - */ maxFieldsSize?: number; } @@ -342,9 +330,6 @@ export interface MetricsCallback { */ err: Error; - /** - * - */ metrics: MetricsCallbackOptions; req: Request; From 49f64329f1808a6923c9d8b7c69b586f734b03d2 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 11:45:47 -0700 Subject: [PATCH 75/78] jest-matcher-utils: Fix use of "chalk" dependency (#21126) --- types/jest-matcher-utils/index.d.ts | 12 ++++++------ types/jest-matcher-utils/jest-matcher-utils-tests.ts | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/types/jest-matcher-utils/index.d.ts b/types/jest-matcher-utils/index.d.ts index 92bc13070b..54e6db67b3 100644 --- a/types/jest-matcher-utils/index.d.ts +++ b/types/jest-matcher-utils/index.d.ts @@ -4,19 +4,19 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import * as chalk from 'chalk'; +import { Chalk } from 'chalk'; -export const EXPECTED_COLOR: chalk.ChalkChain; -export const RECEIVED_COLOR: chalk.ChalkChain; -export const EXPECTED_BG: chalk.ChalkChain; // TODO: removed in b430e51a -export const RECEIVED_BG: chalk.ChalkChain; // TODO: removed in b430e51a +export const EXPECTED_COLOR: Chalk; +export const RECEIVED_COLOR: Chalk; +export const EXPECTED_BG: Chalk; // TODO: removed in b430e51a +export const RECEIVED_BG: Chalk; // TODO: removed in b430e51a export const SUGGEST_TO_EQUAL: string; export function stringify(object: any, maxDepth?: number): string; export function highlightTrailingWhitespace( text: string, - bgColor: chalk.ChalkChain // removed in b430e51a + bgColor: Chalk // removed in b430e51a ): string; export function printReceived(object: any): string; diff --git a/types/jest-matcher-utils/jest-matcher-utils-tests.ts b/types/jest-matcher-utils/jest-matcher-utils-tests.ts index 6f9a4ddeab..6c59a7c274 100644 --- a/types/jest-matcher-utils/jest-matcher-utils-tests.ts +++ b/types/jest-matcher-utils/jest-matcher-utils-tests.ts @@ -1,8 +1,8 @@ -import * as chalk from 'chalk'; +import chalk from 'chalk'; import * as utils from 'jest-matcher-utils'; -utils.EXPECTED_COLOR; // $ExpectType ChalkChain -utils.RECEIVED_COLOR; // $ExpectType ChalkChain +utils.EXPECTED_COLOR; // $ExpectType Chalk +utils.RECEIVED_COLOR; // $ExpectType Chalk utils.SUGGEST_TO_EQUAL; // $ExpectType string utils.stringify({}); // $ExpectType string From 507e9d3c8e48b2db81d3e071d270a2a297eed151 Mon Sep 17 00:00:00 2001 From: Andy Date: Mon, 30 Oct 2017 11:58:51 -0700 Subject: [PATCH 76/78] express-serve-static-core: Lint (#21008) --- .../api-error-handler-tests.ts | 1 - types/api-error-handler/index.d.ts | 4 +- types/aws-serverless-express/index.d.ts | 1 + types/cookies/index.d.ts | 1 + .../express-serve-static-core-tests.ts | 4 +- types/express-serve-static-core/index.d.ts | 1341 ++++++++--------- types/express-serve-static-core/tslint.json | 74 +- types/hpp/index.d.ts | 1 + types/loopback-boot/index.d.ts | 2 +- types/node-sprite-generator/index.d.ts | 1 + 10 files changed, 641 insertions(+), 789 deletions(-) diff --git a/types/api-error-handler/api-error-handler-tests.ts b/types/api-error-handler/api-error-handler-tests.ts index 3bc39c4a7b..67afbb0fce 100644 --- a/types/api-error-handler/api-error-handler-tests.ts +++ b/types/api-error-handler/api-error-handler-tests.ts @@ -1,4 +1,3 @@ - import * as errorHandler from 'api-error-handler'; import * as express from 'express'; diff --git a/types/api-error-handler/index.d.ts b/types/api-error-handler/index.d.ts index e9337cc448..41e91a35ea 100644 --- a/types/api-error-handler/index.d.ts +++ b/types/api-error-handler/index.d.ts @@ -2,9 +2,7 @@ // Project: https://github.com/expressjs/api-error-handler // Definitions by: Tanguy Krotoff // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - - - +// TypeScript Version: 2.2 import * as express from 'express'; diff --git a/types/aws-serverless-express/index.d.ts b/types/aws-serverless-express/index.d.ts index e612d5d8d6..02ef0d846a 100644 --- a/types/aws-serverless-express/index.d.ts +++ b/types/aws-serverless-express/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/awslabs/aws-serverless-express // Definitions by: Ben Speakman , Josh Caffey , Matthias Meyer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// import * as http from 'http'; diff --git a/types/cookies/index.d.ts b/types/cookies/index.d.ts index 8a897cfeae..380ce03b7d 100644 --- a/types/cookies/index.d.ts +++ b/types/cookies/index.d.ts @@ -4,6 +4,7 @@ // jKey Lu // BendingBender // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 /// import { IncomingMessage, ServerResponse } from 'http'; diff --git a/types/express-serve-static-core/express-serve-static-core-tests.ts b/types/express-serve-static-core/express-serve-static-core-tests.ts index 5803337a65..4c2f0919c2 100644 --- a/types/express-serve-static-core/express-serve-static-core-tests.ts +++ b/types/express-serve-static-core/express-serve-static-core-tests.ts @@ -1,5 +1,3 @@ - - import * as express from 'express-serve-static-core'; -// null test file - everything should be tested from express.d.ts and serve-static.d.ts \ No newline at end of file +// null test file - everything should be tested from express.d.ts and serve-static.d.ts diff --git a/types/express-serve-static-core/index.d.ts b/types/express-serve-static-core/index.d.ts index b0e463306d..9119c8497f 100644 --- a/types/express-serve-static-core/index.d.ts +++ b/types/express-serve-static-core/index.d.ts @@ -9,85 +9,78 @@ declare global { namespace Express { - // These open interfaces may be extended in an application-specific manner via declaration merging. // See for example method-override.d.ts (https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/method-override/index.d.ts) - export interface Request { } - export interface Response { } - export interface Application { } + interface Request { } + interface Response { } + interface Application { } } } import * as http from "http"; -interface NextFunction { +export interface NextFunction { + // tslint:disable-next-line callable-types (In ts2.1 it thinks the type alias has no call signatures) (err?: any): void; } -interface RequestHandler { +export interface RequestHandler { + // tslint:disable-next-line callable-types (This is extended from and can't extend from a type alias in ts<2.2 (req: Request, res: Response, next: NextFunction): any; } -interface ErrorRequestHandler { - (err: any, req: Request, res: Response, next: NextFunction): any; -} +export type ErrorRequestHandler = (err: any, req: Request, res: Response, next: NextFunction) => any; -type PathParams = string | RegExp | (string | RegExp)[]; +export type PathParams = string | RegExp | Array; -type RequestHandlerParams = RequestHandler | ErrorRequestHandler | (RequestHandler | ErrorRequestHandler)[]; +export type RequestHandlerParams = RequestHandler | ErrorRequestHandler | Array; -interface IRouterMatcher { +export interface IRouterMatcher { (path: PathParams, ...handlers: RequestHandler[]): T; (path: PathParams, ...handlers: RequestHandlerParams[]): T; } -interface IRouterHandler { +export interface IRouterHandler { (...handlers: RequestHandler[]): T; (...handlers: RequestHandlerParams[]): T; } -interface IRouter extends RequestHandler { +export interface IRouter extends RequestHandler { /** - * Map the given param placeholder `name`(s) to the given callback(s). - * - * Parameter mapping is used to provide pre-conditions to routes - * which use normalized placeholders. For example a _:user_id_ parameter - * could automatically load a user's information from the database without - * any additional code, - * - * The callback uses the samesignature as middleware, the only differencing - * being that the value of the placeholder is passed, in this case the _id_ - * of the user. Once the `next()` function is invoked, just like middleware - * it will continue on to execute the route, or subsequent parameter functions. - * - * app.param('user_id', function(req, res, next, id){ - * User.find(id, function(err, user){ - * if (err) { - * next(err); - * } else if (user) { - * req.user = user; - * next(); - * } else { - * next(new Error('failed to load user')); - * } - * }); - * }); - * - * @param name - * @param fn - */ + * Map the given param placeholder `name`(s) to the given callback(s). + * + * Parameter mapping is used to provide pre-conditions to routes + * which use normalized placeholders. For example a _:user_id_ parameter + * could automatically load a user's information from the database without + * any additional code, + * + * The callback uses the samesignature as middleware, the only differencing + * being that the value of the placeholder is passed, in this case the _id_ + * of the user. Once the `next()` function is invoked, just like middleware + * it will continue on to execute the route, or subsequent parameter functions. + * + * app.param('user_id', function(req, res, next, id){ + * User.find(id, function(err, user){ + * if (err) { + * next(err); + * } else if (user) { + * req.user = user; + * next(); + * } else { + * next(new Error('failed to load user')); + * } + * }); + * }); + */ param(name: string, handler: RequestParamHandler): this; // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API // deprecated since express 4.11.0 param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; /** - * Special-cased "all" method, applying the given route `path`, - * middleware, and callback to _every_ HTTP method. - * - * @param path - * @param fn - */ + * Special-cased "all" method, applying the given route `path`, + * middleware, and callback to _every_ HTTP method. + */ all: IRouterMatcher; get: IRouterMatcher; post: IRouterMatcher; @@ -126,7 +119,7 @@ interface IRouter extends RequestHandler { stack: any[]; } -interface IRoute { +export interface IRoute { path: string; stack: any; all: IRouterHandler; @@ -153,12 +146,12 @@ interface IRoute { subscribe: IRouterHandler; trace: IRouterHandler; unlock: IRouterHandler; - unsubscribe: IRouterHandler + unsubscribe: IRouterHandler; } export interface Router extends IRouter { } -interface CookieOptions { +export interface CookieOptions { maxAge?: number; signed?: boolean; expires?: Date | boolean; @@ -170,35 +163,32 @@ interface CookieOptions { sameSite?: boolean | string; } -interface ByteRange { start: number; end: number; } +export interface ByteRange { start: number; end: number; } -interface RequestRanges extends Array { type: string; } +export interface RequestRanges extends Array { type: string; } -interface Errback { (err: Error): void; } - -interface Request extends http.IncomingMessage, Express.Request { +export type Errback = (err: Error) => void; +export interface Request extends http.IncomingMessage, Express.Request { /** - * Return request header. - * - * The `Referrer` header field is special-cased, - * both `Referrer` and `Referer` are interchangeable. - * - * Examples: - * - * req.get('Content-Type'); - * // => "text/plain" - * - * req.get('content-type'); - * // => "text/plain" - * - * req.get('Something'); - * // => undefined - * - * Aliased as `req.header()`. - * - * @param name - */ + * Return request header. + * + * The `Referrer` header field is special-cased, + * both `Referrer` and `Referer` are interchangeable. + * + * Examples: + * + * req.get('Content-Type'); + * // => "text/plain" + * + * req.get('content-type'); + * // => "text/plain" + * + * req.get('Something'); + * // => undefined + * + * Aliased as `req.header()`. + */ get(name: "set-cookie"): string[] | undefined; get(name: string): string | undefined; @@ -206,234 +196,223 @@ interface Request extends http.IncomingMessage, Express.Request { header(name: string): string | undefined; /** - * Check if the given `type(s)` is acceptable, returning - * the best match when true, otherwise `undefined`, in which - * case you should respond with 406 "Not Acceptable". - * - * The `type` value may be a single mime type string - * such as "application/json", the extension name - * such as "json", a comma-delimted list such as "json, html, text/plain", - * or an array `["json", "html", "text/plain"]`. When a list - * or array is given the _best_ match, if any is returned. - * - * Examples: - * - * // Accept: text/html - * req.accepts('html'); - * // => "html" - * - * // Accept: text/*, application/json - * req.accepts('html'); - * // => "html" - * req.accepts('text/html'); - * // => "text/html" - * req.accepts('json, text'); - * // => "json" - * req.accepts('application/json'); - * // => "application/json" - * - * // Accept: text/*, application/json - * req.accepts('image/png'); - * req.accepts('png'); - * // => undefined - * - * // Accept: text/*;q=.5, application/json - * req.accepts(['html', 'json']); - * req.accepts('html, json'); - * // => "json" - */ + * Check if the given `type(s)` is acceptable, returning + * the best match when true, otherwise `undefined`, in which + * case you should respond with 406 "Not Acceptable". + * + * The `type` value may be a single mime type string + * such as "application/json", the extension name + * such as "json", a comma-delimted list such as "json, html, text/plain", + * or an array `["json", "html", "text/plain"]`. When a list + * or array is given the _best_ match, if any is returned. + * + * Examples: + * + * // Accept: text/html + * req.accepts('html'); + * // => "html" + * + * // Accept: text/*, application/json + * req.accepts('html'); + * // => "html" + * req.accepts('text/html'); + * // => "text/html" + * req.accepts('json, text'); + * // => "json" + * req.accepts('application/json'); + * // => "application/json" + * + * // Accept: text/*, application/json + * req.accepts('image/png'); + * req.accepts('png'); + * // => undefined + * + * // Accept: text/*;q=.5, application/json + * req.accepts(['html', 'json']); + * req.accepts('html, json'); + * // => "json" + */ accepts(): string[]; accepts(type: string): string | false; accepts(type: string[]): string | false; accepts(...type: string[]): string | false; /** - * Returns the first accepted charset of the specified character sets, - * based on the request's Accept-Charset HTTP header field. - * If none of the specified charsets is accepted, returns false. - * - * For more information, or if you have issues or concerns, see accepts. - * @param charset - */ + * Returns the first accepted charset of the specified character sets, + * based on the request's Accept-Charset HTTP header field. + * If none of the specified charsets is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + */ acceptsCharsets(): string[]; acceptsCharsets(charset: string): string | false; acceptsCharsets(charset: string[]): string | false; acceptsCharsets(...charset: string[]): string | false; /** - * Returns the first accepted encoding of the specified encodings, - * based on the request's Accept-Encoding HTTP header field. - * If none of the specified encodings is accepted, returns false. - * - * For more information, or if you have issues or concerns, see accepts. - * @param encoding - */ + * Returns the first accepted encoding of the specified encodings, + * based on the request's Accept-Encoding HTTP header field. + * If none of the specified encodings is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + */ acceptsEncodings(): string[]; acceptsEncodings(encoding: string): string | false; acceptsEncodings(encoding: string[]): string | false; acceptsEncodings(...encoding: string[]): string | false; /** - * Returns the first accepted language of the specified languages, - * based on the request's Accept-Language HTTP header field. - * If none of the specified languages is accepted, returns false. - * - * For more information, or if you have issues or concerns, see accepts. - * - * @param lang - */ + * Returns the first accepted language of the specified languages, + * based on the request's Accept-Language HTTP header field. + * If none of the specified languages is accepted, returns false. + * + * For more information, or if you have issues or concerns, see accepts. + */ acceptsLanguages(): string[]; acceptsLanguages(lang: string): string | false; acceptsLanguages(lang: string[]): string | false; acceptsLanguages(...lang: string[]): string | false; /** - * Parse Range header field, - * capping to the given `size`. - * - * Unspecified ranges such as "0-" require - * knowledge of your resource length. In - * the case of a byte range this is of course - * the total number of bytes. If the Range - * header field is not given `null` is returned, - * `-1` when unsatisfiable, `-2` when syntactically invalid. - * - * NOTE: remember that ranges are inclusive, so - * for example "Range: users=0-3" should respond - * with 4 users when available, not 3. - * - * @param size - */ + * Parse Range header field, + * capping to the given `size`. + * + * Unspecified ranges such as "0-" require + * knowledge of your resource length. In + * the case of a byte range this is of course + * the total number of bytes. If the Range + * header field is not given `null` is returned, + * `-1` when unsatisfiable, `-2` when syntactically invalid. + * + * NOTE: remember that ranges are inclusive, so + * for example "Range: users=0-3" should respond + * with 4 users when available, not 3. + */ range(size: number): RequestRanges|null|-1|-2; /** - * Return an array of Accepted media types - * ordered from highest quality to lowest. - */ + * Return an array of Accepted media types + * ordered from highest quality to lowest. + */ accepted: MediaType[]; /** - * @deprecated Use either req.params, req.body or req.query, as applicable. - * - * Return the value of param `name` when present or `defaultValue`. - * - * - Checks route placeholders, ex: _/user/:id_ - * - Checks body params, ex: id=12, {"id":12} - * - Checks query string params, ex: ?id=12 - * - * To utilize request bodies, `req.body` - * should be an object. This can be done by using - * the `connect.bodyParser()` middleware. - * - * @param name - * @param defaultValue - */ + * @deprecated Use either req.params, req.body or req.query, as applicable. + * + * Return the value of param `name` when present or `defaultValue`. + * + * - Checks route placeholders, ex: _/user/:id_ + * - Checks body params, ex: id=12, {"id":12} + * - Checks query string params, ex: ?id=12 + * + * To utilize request bodies, `req.body` + * should be an object. This can be done by using + * the `connect.bodyParser()` middleware. + */ param(name: string, defaultValue?: any): string; /** - * Check if the incoming request contains the "Content-Type" - * header field, and it contains the give mime `type`. - * - * Examples: - * - * // With Content-Type: text/html; charset=utf-8 - * req.is('html'); - * req.is('text/html'); - * req.is('text/*'); - * // => true - * - * // When Content-Type is application/json - * req.is('json'); - * req.is('application/json'); - * req.is('application/*'); - * // => true - * - * req.is('html'); - * // => false - * - * @param type - */ + * Check if the incoming request contains the "Content-Type" + * header field, and it contains the give mime `type`. + * + * Examples: + * + * // With Content-Type: text/html; charset=utf-8 + * req.is('html'); + * req.is('text/html'); + * req.is('text/*'); + * // => true + * + * // When Content-Type is application/json + * req.is('json'); + * req.is('application/json'); + * req.is('application/*'); + * // => true + * + * req.is('html'); + * // => false + */ is(type: string): string | false; /** - * Return the protocol string "http" or "https" - * when requested with TLS. When the "trust proxy" - * setting is enabled the "X-Forwarded-Proto" header - * field will be trusted. If you're running behind - * a reverse proxy that supplies https for you this - * may be enabled. - */ + * Return the protocol string "http" or "https" + * when requested with TLS. When the "trust proxy" + * setting is enabled the "X-Forwarded-Proto" header + * field will be trusted. If you're running behind + * a reverse proxy that supplies https for you this + * may be enabled. + */ protocol: string; /** - * Short-hand for: - * - * req.protocol == 'https' - */ + * Short-hand for: + * + * req.protocol == 'https' + */ secure: boolean; /** - * Return the remote address, or when - * "trust proxy" is `true` return - * the upstream addr. - */ + * Return the remote address, or when + * "trust proxy" is `true` return + * the upstream addr. + */ ip: string; /** - * When "trust proxy" is `true`, parse - * the "X-Forwarded-For" ip address list. - * - * For example if the value were "client, proxy1, proxy2" - * you would receive the array `["client", "proxy1", "proxy2"]` - * where "proxy2" is the furthest down-stream. - */ + * When "trust proxy" is `true`, parse + * the "X-Forwarded-For" ip address list. + * + * For example if the value were "client, proxy1, proxy2" + * you would receive the array `["client", "proxy1", "proxy2"]` + * where "proxy2" is the furthest down-stream. + */ ips: string[]; /** - * Return subdomains as an array. - * - * Subdomains are the dot-separated parts of the host before the main domain of - * the app. By default, the domain of the app is assumed to be the last two - * parts of the host. This can be changed by setting "subdomain offset". - * - * For example, if the domain is "tobi.ferrets.example.com": - * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. - * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. - */ + * Return subdomains as an array. + * + * Subdomains are the dot-separated parts of the host before the main domain of + * the app. By default, the domain of the app is assumed to be the last two + * parts of the host. This can be changed by setting "subdomain offset". + * + * For example, if the domain is "tobi.ferrets.example.com": + * If "subdomain offset" is not set, req.subdomains is `["ferrets", "tobi"]`. + * If "subdomain offset" is 3, req.subdomains is `["tobi"]`. + */ subdomains: string[]; /** - * Short-hand for `url.parse(req.url).pathname`. - */ + * Short-hand for `url.parse(req.url).pathname`. + */ path: string; /** - * Parse the "Host" header field hostname. - */ + * Parse the "Host" header field hostname. + */ hostname: string; /** - * @deprecated Use hostname instead. - */ + * @deprecated Use hostname instead. + */ host: string; /** - * Check if the request is fresh, aka - * Last-Modified and/or the ETag - * still match. - */ + * Check if the request is fresh, aka + * Last-Modified and/or the ETag + * still match. + */ fresh: boolean; /** - * Check if the request is stale, aka - * "Last-Modified" and / or the "ETag" for the - * resource has changed. - */ + * Check if the request is stale, aka + * "Last-Modified" and / or the "ETag" for the + * resource has changed. + */ stale: boolean; /** - * Check if the request was an _XMLHttpRequest_. - */ + * Check if the request was an _XMLHttpRequest_. + */ xhr: boolean; //body: { username: string; password: string; remember: boolean; title: string; }; @@ -446,12 +425,7 @@ interface Request extends http.IncomingMessage, Express.Request { params: any; - /** - * Clear cookie `name`. - * - * @param name - * @param options - */ + /** Clear cookie `name`. */ clearCookie(name: string, options?: any): Response; query: any; @@ -469,275 +443,259 @@ interface Request extends http.IncomingMessage, Express.Request { app: Application; } -interface MediaType { +export interface MediaType { value: string; quality: number; type: string; subtype: string; } -interface Send { - (body?: any): Response; -} +export type Send = (body?: any) => Response; -interface Response extends http.ServerResponse, Express.Response { +export interface Response extends http.ServerResponse, Express.Response { /** - * Set status `code`. - * - * @param code - */ + * Set status `code`. + */ status(code: number): Response; /** - * Set the response HTTP status code to `statusCode` and send its string representation as the response body. - * @link http://expressjs.com/4x/api.html#res.sendStatus - * - * Examples: - * - * res.sendStatus(200); // equivalent to res.status(200).send('OK') - * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden') - * res.sendStatus(404); // equivalent to res.status(404).send('Not Found') - * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error') - * - * @param code - */ + * Set the response HTTP status code to `statusCode` and send its string representation as the response body. + * @link http://expressjs.com/4x/api.html#res.sendStatus + * + * Examples: + * + * res.sendStatus(200); // equivalent to res.status(200).send('OK') + * res.sendStatus(403); // equivalent to res.status(403).send('Forbidden') + * res.sendStatus(404); // equivalent to res.status(404).send('Not Found') + * res.sendStatus(500); // equivalent to res.status(500).send('Internal Server Error') + */ sendStatus(code: number): Response; /** - * Set Link header field with the given `links`. - * - * Examples: - * - * res.links({ - * next: 'http://api.example.com/users?page=2', - * last: 'http://api.example.com/users?page=5' - * }); - * - * @param links - */ + * Set Link header field with the given `links`. + * + * Examples: + * + * res.links({ + * next: 'http://api.example.com/users?page=2', + * last: 'http://api.example.com/users?page=5' + * }); + */ links(links: any): Response; /** - * Send a response. - * - * Examples: - * - * res.send(new Buffer('wahoo')); - * res.send({ some: 'json' }); - * res.send('

    some html

    '); - * res.send(404, 'Sorry, cant find that'); - * res.send(404); - */ + * Send a response. + * + * Examples: + * + * res.send(new Buffer('wahoo')); + * res.send({ some: 'json' }); + * res.send('

    some html

    '); + * res.send(404, 'Sorry, cant find that'); + * res.send(404); + */ send: Send; /** - * Send JSON response. - * - * Examples: - * - * res.json(null); - * res.json({ user: 'tj' }); - * res.json(500, 'oh noes!'); - * res.json(404, 'I dont have that'); - */ + * Send JSON response. + * + * Examples: + * + * res.json(null); + * res.json({ user: 'tj' }); + * res.json(500, 'oh noes!'); + * res.json(404, 'I dont have that'); + */ json: Send; /** - * Send JSON response with JSONP callback support. - * - * Examples: - * - * res.jsonp(null); - * res.jsonp({ user: 'tj' }); - * res.jsonp(500, 'oh noes!'); - * res.jsonp(404, 'I dont have that'); - */ + * Send JSON response with JSONP callback support. + * + * Examples: + * + * res.jsonp(null); + * res.jsonp({ user: 'tj' }); + * res.jsonp(500, 'oh noes!'); + * res.jsonp(404, 'I dont have that'); + */ jsonp: Send; /** - * Transfer the file at the given `path`. - * - * Automatically sets the _Content-Type_ response header field. - * The callback `fn(err)` is invoked when the transfer is complete - * or when an error occurs. Be sure to check `res.sentHeader` - * if you wish to attempt responding, as the header and some data - * may have already been transferred. - * - * Options: - * - * - `maxAge` defaulting to 0 (can be string converted by `ms`) - * - `root` root directory for relative filenames - * - `headers` object of headers to serve with file - * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them - * - * Other options are passed along to `send`. - * - * Examples: - * - * The following example illustrates how `res.sendFile()` may - * be used as an alternative for the `static()` middleware for - * dynamic situations. The code backing `res.sendFile()` is actually - * the same code, so HTTP cache support etc is identical. - * - * app.get('/user/:uid/photos/:file', function(req, res){ - * var uid = req.params.uid - * , file = req.params.file; - * - * req.user.mayViewFilesFrom(uid, function(yes){ - * if (yes) { - * res.sendFile('/uploads/' + uid + '/' + file); - * } else { - * res.send(403, 'Sorry! you cant see that.'); - * } - * }); - * }); - * - * @api public - */ + * Transfer the file at the given `path`. + * + * Automatically sets the _Content-Type_ response header field. + * The callback `fn(err)` is invoked when the transfer is complete + * or when an error occurs. Be sure to check `res.sentHeader` + * if you wish to attempt responding, as the header and some data + * may have already been transferred. + * + * Options: + * + * - `maxAge` defaulting to 0 (can be string converted by `ms`) + * - `root` root directory for relative filenames + * - `headers` object of headers to serve with file + * - `dotfiles` serve dotfiles, defaulting to false; can be `"allow"` to send them + * + * Other options are passed along to `send`. + * + * Examples: + * + * The following example illustrates how `res.sendFile()` may + * be used as an alternative for the `static()` middleware for + * dynamic situations. The code backing `res.sendFile()` is actually + * the same code, so HTTP cache support etc is identical. + * + * app.get('/user/:uid/photos/:file', function(req, res){ + * var uid = req.params.uid + * , file = req.params.file; + * + * req.user.mayViewFilesFrom(uid, function(yes){ + * if (yes) { + * res.sendFile('/uploads/' + uid + '/' + file); + * } else { + * res.send(403, 'Sorry! you cant see that.'); + * } + * }); + * }); + * + * @api public + */ sendFile(path: string): void; sendFile(path: string, options: any): void; sendFile(path: string, fn: Errback): void; sendFile(path: string, options: any, fn: Errback): void; /** - * @deprecated Use sendFile instead. - */ + * @deprecated Use sendFile instead. + */ sendfile(path: string): void; /** - * @deprecated Use sendFile instead. - */ + * @deprecated Use sendFile instead. + */ sendfile(path: string, options: any): void; /** - * @deprecated Use sendFile instead. - */ + * @deprecated Use sendFile instead. + */ sendfile(path: string, fn: Errback): void; /** - * @deprecated Use sendFile instead. - */ + * @deprecated Use sendFile instead. + */ sendfile(path: string, options: any, fn: Errback): void; /** - * Transfer the file at the given `path` as an attachment. - * - * Optionally providing an alternate attachment `filename`, - * and optional callback `fn(err)`. The callback is invoked - * when the data transfer is complete, or when an error has - * ocurred. Be sure to check `res.headerSent` if you plan to respond. - * - * This method uses `res.sendfile()`. - */ + * Transfer the file at the given `path` as an attachment. + * + * Optionally providing an alternate attachment `filename`, + * and optional callback `fn(err)`. The callback is invoked + * when the data transfer is complete, or when an error has + * ocurred. Be sure to check `res.headerSent` if you plan to respond. + * + * This method uses `res.sendfile()`. + */ download(path: string): void; download(path: string, filename: string): void; download(path: string, fn: Errback): void; download(path: string, filename: string, fn: Errback): void; /** - * Set _Content-Type_ response header with `type` through `mime.lookup()` - * when it does not contain "/", or set the Content-Type to `type` otherwise. - * - * Examples: - * - * res.type('.html'); - * res.type('html'); - * res.type('json'); - * res.type('application/json'); - * res.type('png'); - * - * @param type - */ + * Set _Content-Type_ response header with `type` through `mime.lookup()` + * when it does not contain "/", or set the Content-Type to `type` otherwise. + * + * Examples: + * + * res.type('.html'); + * res.type('html'); + * res.type('json'); + * res.type('application/json'); + * res.type('png'); + */ contentType(type: string): Response; /** - * Set _Content-Type_ response header with `type` through `mime.lookup()` - * when it does not contain "/", or set the Content-Type to `type` otherwise. - * - * Examples: - * - * res.type('.html'); - * res.type('html'); - * res.type('json'); - * res.type('application/json'); - * res.type('png'); - * - * @param type - */ + * Set _Content-Type_ response header with `type` through `mime.lookup()` + * when it does not contain "/", or set the Content-Type to `type` otherwise. + * + * Examples: + * + * res.type('.html'); + * res.type('html'); + * res.type('json'); + * res.type('application/json'); + * res.type('png'); + */ type(type: string): Response; /** - * Respond to the Acceptable formats using an `obj` - * of mime-type callbacks. - * - * This method uses `req.accepted`, an array of - * acceptable types ordered by their quality values. - * When "Accept" is not present the _first_ callback - * is invoked, otherwise the first match is used. When - * no match is performed the server responds with - * 406 "Not Acceptable". - * - * Content-Type is set for you, however if you choose - * you may alter this within the callback using `res.type()` - * or `res.set('Content-Type', ...)`. - * - * res.format({ - * 'text/plain': function(){ - * res.send('hey'); - * }, - * - * 'text/html': function(){ - * res.send('

    hey

    '); - * }, - * - * 'appliation/json': function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * In addition to canonicalized MIME types you may - * also use extnames mapped to these types: - * - * res.format({ - * text: function(){ - * res.send('hey'); - * }, - * - * html: function(){ - * res.send('

    hey

    '); - * }, - * - * json: function(){ - * res.send({ message: 'hey' }); - * } - * }); - * - * By default Express passes an `Error` - * with a `.status` of 406 to `next(err)` - * if a match is not made. If you provide - * a `.default` callback it will be invoked - * instead. - * - * @param obj - */ + * Respond to the Acceptable formats using an `obj` + * of mime-type callbacks. + * + * This method uses `req.accepted`, an array of + * acceptable types ordered by their quality values. + * When "Accept" is not present the _first_ callback + * is invoked, otherwise the first match is used. When + * no match is performed the server responds with + * 406 "Not Acceptable". + * + * Content-Type is set for you, however if you choose + * you may alter this within the callback using `res.type()` + * or `res.set('Content-Type', ...)`. + * + * res.format({ + * 'text/plain': function(){ + * res.send('hey'); + * }, + * + * 'text/html': function(){ + * res.send('

    hey

    '); + * }, + * + * 'appliation/json': function(){ + * res.send({ message: 'hey' }); + * } + * }); + * + * In addition to canonicalized MIME types you may + * also use extnames mapped to these types: + * + * res.format({ + * text: function(){ + * res.send('hey'); + * }, + * + * html: function(){ + * res.send('

    hey

    '); + * }, + * + * json: function(){ + * res.send({ message: 'hey' }); + * } + * }); + * + * By default Express passes an `Error` + * with a `.status` of 406 to `next(err)` + * if a match is not made. If you provide + * a `.default` callback it will be invoked + * instead. + */ format(obj: any): Response; /** - * Set _Content-Disposition_ header to _attachment_ with optional `filename`. - * - * @param filename - */ + * Set _Content-Disposition_ header to _attachment_ with optional `filename`. + */ attachment(filename?: string): Response; /** - * Set header `field` to `val`, or pass - * an object of header fields. - * - * Examples: - * - * res.set('Foo', ['bar', 'baz']); - * res.set('Accept', 'application/json'); - * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); - * - * Aliased as `res.header()`. - */ + * Set header `field` to `val`, or pass + * an object of header fields. + * + * Examples: + * + * res.set('Foo', ['bar', 'baz']); + * res.set('Accept', 'application/json'); + * res.set({ Accept: 'text/plain', 'X-API-Key': 'tobi' }); + * + * Aliased as `res.header()`. + */ set(field: any): Response; set(field: string, value?: string): Response; @@ -747,102 +705,91 @@ interface Response extends http.ServerResponse, Express.Response { // Property indicating if HTTP headers has been sent for the response. headersSent: boolean; - /** - * Get value for header `field`. - * - * @param field - */ + /** Get value for header `field`. */ get(field: string): string; - /** - * Clear cookie `name`. - * - * @param name - * @param options - */ + /** Clear cookie `name`. */ clearCookie(name: string, options?: any): Response; /** - * Set cookie `name` to `val`, with the given `options`. - * - * Options: - * - * - `maxAge` max-age in milliseconds, converted to `expires` - * - `signed` sign the cookie - * - `path` defaults to "/" - * - * Examples: - * - * // "Remember Me" for 15 minutes - * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); - * - * // save as above - * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) - */ + * Set cookie `name` to `val`, with the given `options`. + * + * Options: + * + * - `maxAge` max-age in milliseconds, converted to `expires` + * - `signed` sign the cookie + * - `path` defaults to "/" + * + * Examples: + * + * // "Remember Me" for 15 minutes + * res.cookie('rememberme', '1', { expires: new Date(Date.now() + 900000), httpOnly: true }); + * + * // save as above + * res.cookie('rememberme', '1', { maxAge: 900000, httpOnly: true }) + */ cookie(name: string, val: string, options: CookieOptions): Response; cookie(name: string, val: any, options: CookieOptions): Response; cookie(name: string, val: any): Response; /** - * Set the location header to `url`. - * - * The given `url` can also be the name of a mapped url, for - * example by default express supports "back" which redirects - * to the _Referrer_ or _Referer_ headers or "/". - * - * Examples: - * - * res.location('/foo/bar').; - * res.location('http://example.com'); - * res.location('../login'); // /blog/post/1 -> /blog/login - * - * Mounting: - * - * When an application is mounted and `res.location()` - * is given a path that does _not_ lead with "/" it becomes - * relative to the mount-point. For example if the application - * is mounted at "/blog", the following would become "/blog/login". - * - * res.location('login'); - * - * While the leading slash would result in a location of "/login": - * - * res.location('/login'); - * - * @param url - */ + * Set the location header to `url`. + * + * The given `url` can also be the name of a mapped url, for + * example by default express supports "back" which redirects + * to the _Referrer_ or _Referer_ headers or "/". + * + * Examples: + * + * res.location('/foo/bar').; + * res.location('http://example.com'); + * res.location('../login'); // /blog/post/1 -> /blog/login + * + * Mounting: + * + * When an application is mounted and `res.location()` + * is given a path that does _not_ lead with "/" it becomes + * relative to the mount-point. For example if the application + * is mounted at "/blog", the following would become "/blog/login". + * + * res.location('login'); + * + * While the leading slash would result in a location of "/login": + * + * res.location('/login'); + */ location(url: string): Response; /** - * Redirect to the given `url` with optional response `status` - * defaulting to 302. - * - * The resulting `url` is determined by `res.location()`, so - * it will play nicely with mounted apps, relative paths, - * `"back"` etc. - * - * Examples: - * - * res.redirect('/foo/bar'); - * res.redirect('http://example.com'); - * res.redirect(301, 'http://example.com'); - * res.redirect('http://example.com', 301); - * res.redirect('../login'); // /blog/post/1 -> /blog/login - */ + * Redirect to the given `url` with optional response `status` + * defaulting to 302. + * + * The resulting `url` is determined by `res.location()`, so + * it will play nicely with mounted apps, relative paths, + * `"back"` etc. + * + * Examples: + * + * res.redirect('/foo/bar'); + * res.redirect('http://example.com'); + * res.redirect(301, 'http://example.com'); + * res.redirect('http://example.com', 301); + * res.redirect('../login'); // /blog/post/1 -> /blog/login + */ redirect(url: string): void; redirect(status: number, url: string): void; redirect(url: string, status: number): void; /** - * Render `view` with the given `options` and optional callback `fn`. - * When a callback function is given a response will _not_ be made - * automatically, otherwise a response of _200_ and _text/html_ is given. - * - * Options: - * - * - `cache` boolean hinting to the engine it should cache - * - `filename` filename of the view being rendered - */ + * Render `view` with the given `options` and optional callback `fn`. + * When a callback function is given a response will _not_ be made + * automatically, otherwise a response of _200_ and _text/html_ is given. + * + * Options: + * + * - `cache` boolean hinting to the engine it should cache + * - `filename` filename of the view being rendered + */ render(view: string, options?: Object, callback?: (err: Error, html: string) => void): void; render(view: string, callback?: (err: Error, html: string) => void): void; @@ -862,17 +809,13 @@ interface Response extends http.ServerResponse, Express.Response { app: Application; } -interface Handler extends RequestHandler { } +export interface Handler extends RequestHandler { } -interface RequestParamHandler { - (req: Request, res: Response, next: NextFunction, value: any, name: string): any; -} +export type RequestParamHandler = (req: Request, res: Response, next: NextFunction, value: any, name: string) => any; -type ApplicationRequestHandler = IRouterHandler & IRouterMatcher & { - (...handlers: RequestHandlerParams[]): T; -}; +export type ApplicationRequestHandler = IRouterHandler & IRouterMatcher & ((...handlers: RequestHandlerParams[]) => T); -interface Application extends IRouter, Express.Application { +export interface Application extends IRouter, Express.Application { /** * Express instance itself is a request handler, which could be invoked without * third argument. @@ -880,165 +823,149 @@ interface Application extends IRouter, Express.Application { (req: Request, res: Response): any; /** - * Initialize the server. - * - * - setup default configuration - * - setup default middleware - * - setup route reflection methods - */ + * Initialize the server. + * + * - setup default configuration + * - setup default middleware + * - setup route reflection methods + */ init(): void; /** - * Initialize application configuration. - */ + * Initialize application configuration. + */ defaultConfiguration(): void; /** - * Register the given template engine callback `fn` - * as `ext`. - * - * By default will `require()` the engine based on the - * file extension. For example if you try to render - * a "foo.jade" file Express will invoke the following internally: - * - * app.engine('jade', require('jade').__express); - * - * For engines that do not provide `.__express` out of the box, - * or if you wish to "map" a different extension to the template engine - * you may use this method. For example mapping the EJS template engine to - * ".html" files: - * - * app.engine('html', require('ejs').renderFile); - * - * In this case EJS provides a `.renderFile()` method with - * the same signature that Express expects: `(path, options, callback)`, - * though note that it aliases this method as `ejs.__express` internally - * so if you're using ".ejs" extensions you dont need to do anything. - * - * Some template engines do not follow this convention, the - * [Consolidate.js](https://github.com/visionmedia/consolidate.js) - * library was created to map all of node's popular template - * engines to follow this convention, thus allowing them to - * work seamlessly within Express. - */ + * Register the given template engine callback `fn` + * as `ext`. + * + * By default will `require()` the engine based on the + * file extension. For example if you try to render + * a "foo.jade" file Express will invoke the following internally: + * + * app.engine('jade', require('jade').__express); + * + * For engines that do not provide `.__express` out of the box, + * or if you wish to "map" a different extension to the template engine + * you may use this method. For example mapping the EJS template engine to + * ".html" files: + * + * app.engine('html', require('ejs').renderFile); + * + * In this case EJS provides a `.renderFile()` method with + * the same signature that Express expects: `(path, options, callback)`, + * though note that it aliases this method as `ejs.__express` internally + * so if you're using ".ejs" extensions you dont need to do anything. + * + * Some template engines do not follow this convention, the + * [Consolidate.js](https://github.com/visionmedia/consolidate.js) + * library was created to map all of node's popular template + * engines to follow this convention, thus allowing them to + * work seamlessly within Express. + */ engine(ext: string, fn: Function): Application; /** - * Assign `setting` to `val`, or return `setting`'s value. - * - * app.set('foo', 'bar'); - * app.get('foo'); - * // => "bar" - * app.set('foo', ['bar', 'baz']); - * app.get('foo'); - * // => ["bar", "baz"] - * - * Mounted servers inherit their parent server's settings. - * - * @param setting - * @param val - */ + * Assign `setting` to `val`, or return `setting`'s value. + * + * app.set('foo', 'bar'); + * app.get('foo'); + * // => "bar" + * app.set('foo', ['bar', 'baz']); + * app.get('foo'); + * // => ["bar", "baz"] + * + * Mounted servers inherit their parent server's settings. + */ set(setting: string, val: any): Application; - get: { (name: string): any; } & IRouterMatcher; + get: ((name: string) => any) & IRouterMatcher; param(name: string | string[], handler: RequestParamHandler): this; // Alternatively, you can pass only a callback, in which case you have the opportunity to alter the app.param() API param(callback: (name: string, matcher: RegExp) => RequestParamHandler): this; /** - * Return the app's absolute pathname - * based on the parent(s) that have - * mounted it. - * - * For example if the application was - * mounted as "/admin", which itself - * was mounted as "/blog" then the - * return value would be "/blog/admin". - */ + * Return the app's absolute pathname + * based on the parent(s) that have + * mounted it. + * + * For example if the application was + * mounted as "/admin", which itself + * was mounted as "/blog" then the + * return value would be "/blog/admin". + */ path(): string; /** - * Check if `setting` is enabled (truthy). - * - * app.enabled('foo') - * // => false - * - * app.enable('foo') - * app.enabled('foo') - * // => true - */ + * Check if `setting` is enabled (truthy). + * + * app.enabled('foo') + * // => false + * + * app.enable('foo') + * app.enabled('foo') + * // => true + */ enabled(setting: string): boolean; /** - * Check if `setting` is disabled. - * - * app.disabled('foo') - * // => true - * - * app.enable('foo') - * app.disabled('foo') - * // => false - * - * @param setting - */ + * Check if `setting` is disabled. + * + * app.disabled('foo') + * // => true + * + * app.enable('foo') + * app.disabled('foo') + * // => false + */ disabled(setting: string): boolean; - /** - * Enable `setting`. - * - * @param setting - */ + /** Enable `setting`. */ enable(setting: string): Application; - /** - * Disable `setting`. - * - * @param setting - */ + /** Disable `setting`. */ disable(setting: string): Application; /** - * Configure callback for zero or more envs, - * when no `env` is specified that callback will - * be invoked for all environments. Any combination - * can be used multiple times, in any order desired. - * - * Examples: - * - * app.configure(function(){ - * // executed for all envs - * }); - * - * app.configure('stage', function(){ - * // executed staging env - * }); - * - * app.configure('stage', 'production', function(){ - * // executed for stage and production - * }); - * - * Note: - * - * These callbacks are invoked immediately, and - * are effectively sugar for the following: - * - * var env = process.env.NODE_ENV || 'development'; - * - * switch (env) { - * case 'development': - * ... - * break; - * case 'stage': - * ... - * break; - * case 'production': - * ... - * break; - * } - * - * @param env - * @param fn - */ + * Configure callback for zero or more envs, + * when no `env` is specified that callback will + * be invoked for all environments. Any combination + * can be used multiple times, in any order desired. + * + * Examples: + * + * app.configure(function(){ + * // executed for all envs + * }); + * + * app.configure('stage', function(){ + * // executed staging env + * }); + * + * app.configure('stage', 'production', function(){ + * // executed for stage and production + * }); + * + * Note: + * + * These callbacks are invoked immediately, and + * are effectively sugar for the following: + * + * var env = process.env.NODE_ENV || 'development'; + * + * switch (env) { + * case 'development': + * ... + * break; + * case 'stage': + * ... + * break; + * case 'production': + * ... + * break; + * } + */ configure(fn: Function): Application; configure(env0: string, fn: Function): Application; configure(env0: string, env1: string, fn: Function): Application; @@ -1047,41 +974,36 @@ interface Application extends IRouter, Express.Application { configure(env0: string, env1: string, env2: string, env3: string, env4: string, fn: Function): Application; /** - * Render the given view `name` name with `options` - * and a callback accepting an error and the - * rendered template string. - * - * Example: - * - * app.render('email', { name: 'Tobi' }, function(err, html){ - * // ... - * }) - * - * @param name - * @param options or fn - * @param fn - */ + * Render the given view `name` name with `options` + * and a callback accepting an error and the + * rendered template string. + * + * Example: + * + * app.render('email', { name: 'Tobi' }, function(err, html){ + * // ... + * }) + */ render(name: string, options?: Object, callback?: (err: Error, html: string) => void): void; render(name: string, callback: (err: Error, html: string) => void): void; - /** - * Listen for connections. - * - * A node `http.Server` is returned, with this - * application (which is a `Function`) as its - * callback. If you wish to create both an HTTP - * and HTTPS server you may do so with the "http" - * and "https" modules as shown here: - * - * var http = require('http') - * , https = require('https') - * , express = require('express') - * , app = express(); - * - * http.createServer(app).listen(80); - * https.createServer({ ... }, app).listen(443); - */ + * Listen for connections. + * + * A node `http.Server` is returned, with this + * application (which is a `Function`) as its + * callback. If you wish to create both an HTTP + * and HTTPS server you may do so with the "http" + * and "https" modules as shown here: + * + * var http = require('http') + * , https = require('https') + * , express = require('express') + * , app = express(); + * + * http.createServer(app).listen(80); + * https.createServer({ ... }, app).listen(443); + */ listen(port: number, hostname: string, backlog: number, callback?: Function): http.Server; listen(port: number, hostname: string, callback?: Function): http.Server; listen(port: number, callback?: Function): http.Server; @@ -1099,13 +1021,13 @@ interface Application extends IRouter, Express.Application { locals: any; /** - * The app.routes object houses all of the routes defined mapped by the - * associated HTTP verb. This object may be used for introspection - * capabilities, for example Express uses this internally not only for - * routing but to provide default OPTIONS behaviour unless app.options() - * is used. Your application or framework may also remove routes by - * simply by removing them from this object. - */ + * The app.routes object houses all of the routes defined mapped by the + * associated HTTP verb. This object may be used for introspection + * capabilities, for example Express uses this internally not only for + * routing but to provide default OPTIONS behaviour unless app.options() + * is used. Your application or framework may also remove routes by + * simply by removing them from this object. + */ routes: any; /** @@ -1116,8 +1038,7 @@ interface Application extends IRouter, Express.Application { use: ApplicationRequestHandler; } -interface Express extends Application { +export interface Express extends Application { request: Request; - response: Response; } diff --git a/types/express-serve-static-core/tslint.json b/types/express-serve-static-core/tslint.json index a41bf5d19a..9b8c6a0c20 100644 --- a/types/express-serve-static-core/tslint.json +++ b/types/express-serve-static-core/tslint.json @@ -1,79 +1,11 @@ { "extends": "dtslint/dt.json", "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, + // TODOs "ban-types": false, - "callable-types": false, "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false + "unified-signatures": false } -} + } diff --git a/types/hpp/index.d.ts b/types/hpp/index.d.ts index 6328df7d70..18439ee488 100644 --- a/types/hpp/index.d.ts +++ b/types/hpp/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/analog-nico/hpp // Definitions by: Michael Strobel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as express from 'express'; diff --git a/types/loopback-boot/index.d.ts b/types/loopback-boot/index.d.ts index 258800981b..5dc5fa7f60 100644 --- a/types/loopback-boot/index.d.ts +++ b/types/loopback-boot/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/strongloop/loopback-boot // Definitions by: Andres D Jimenez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 +// TypeScript Version: 2.3 /************************************************ * * diff --git a/types/node-sprite-generator/index.d.ts b/types/node-sprite-generator/index.d.ts index 6bd2b88973..05bad5fe8e 100644 --- a/types/node-sprite-generator/index.d.ts +++ b/types/node-sprite-generator/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/selaux/node-sprite-generator#readme // Definitions by: Gyusun Yeom // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 import * as e from "express"; From 47ee461380f00c37eff94a2c434cd518f5b92991 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 31 Oct 2017 09:32:34 -0700 Subject: [PATCH 77/78] redux-storage: Fix compile errors (#21128) --- types/redux-storage/redux-storage-tests.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/types/redux-storage/redux-storage-tests.ts b/types/redux-storage/redux-storage-tests.ts index 4e84468a64..b8d9ccdbb0 100644 --- a/types/redux-storage/redux-storage-tests.ts +++ b/types/redux-storage/redux-storage-tests.ts @@ -23,7 +23,7 @@ const initialStateLoader = createLoader(storageEngine); const storageMiddleware = createMiddleware(storageEngine, [], []); -const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer); +const store = applyMiddleware(storageMiddleware)(createStore)(enhancedReducer); initialStateLoader(store).then(() => { // render app @@ -33,7 +33,7 @@ initialStateLoader(store).then(() => { // Test for React Native Async Storage engine const storageEngineReactNative = createReactNativeAsyncStorageEngine("test"); const storageMiddlewareReactNative = createMiddleware(storageEngine); -const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer); +const storeReactNative = applyMiddleware(storageMiddlewareReactNative)(createStore)(enhancedReducer); initialStateLoader(storeReactNative).then(() => { // render app }) From a11a781688ef98a5859b14a3e465a4ef7bc2cc73 Mon Sep 17 00:00:00 2001 From: Andy Date: Tue, 31 Oct 2017 10:52:41 -0700 Subject: [PATCH 78/78] Fix some no-empty-interface lint errors (#21144) --- types/enzyme/index.d.ts | 1 + types/react-navigation/react-navigation-tests.tsx | 3 +-- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/types/enzyme/index.d.ts b/types/enzyme/index.d.ts index 101215462f..d4498397bd 100644 --- a/types/enzyme/index.d.ts +++ b/types/enzyme/index.d.ts @@ -437,6 +437,7 @@ export class ShallowWrapper

    { parent(): ShallowWrapper; } +// tslint:disable-next-line no-empty-interface export interface ReactWrapper

    extends CommonWrapper {} export class ReactWrapper

    { constructor(nodes: JSX.Element | JSX.Element[], root?: ReactWrapper, options?: MountRendererProps); diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 668621399d..62286dd4c3 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -45,12 +45,11 @@ interface StartScreenNavigationParams { s: string; } -interface StartScreenProps extends NavigationScreenProps { } /** * @desc Simple screen component class with typed component props that should * receive the navigation prop from the AppNavigator. */ -class StartScreen extends React.Component { +class StartScreen extends React.Component> { render() { // Implicit type checks. const navigationStateParams: StartScreenNavigationParams = this.props.navigation.state.params;