diff --git a/notNeededPackages.json b/notNeededPackages.json index 7683c07522..3abaa12d26 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -558,6 +558,12 @@ "sourceRepoURL": "http://arshaw.com/fullcalendar/", "asOfVersion": "3.8.0" }, + { + "libraryName": "fuse", + "typingsPackageName": "fuse", + "sourceRepoURL": "https://github.com/krisk/Fuse", + "asOfVersion": "2.6.0" + }, { "libraryName": "gaea-model", "typingsPackageName": "gaea-model", diff --git a/scripts/generate-tsconfigs.ts b/scripts/generate-tsconfigs.ts index 0115067e34..e1e1998950 100644 --- a/scripts/generate-tsconfigs.ts +++ b/scripts/generate-tsconfigs.ts @@ -5,7 +5,7 @@ import * as fs from 'fs'; import * as path from 'path'; -const home = path.join(__dirname, '..'); +const home = path.join(__dirname, "..", "types"); for (const dirName of fs.readdirSync(home)) { if (dirName.startsWith(".") || dirName === "node_modules" || dirName === "scripts") { diff --git a/types/accepts/index.d.ts b/types/accepts/index.d.ts index 33ee0db8a1..02cb0fbb97 100644 --- a/types/accepts/index.d.ts +++ b/types/accepts/index.d.ts @@ -12,36 +12,75 @@ declare namespace accepts { interface Accepts { /** * Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned. + * If no charsets are supplied, all accepted charsets are returned, in the order of the client's preference + * (most preferred first). */ + charset(): string[]; charset(charsets: string[]): string | false; charset(...charsets: string[]): string | false; /** - * Return the charsets that the request accepts, in the order of the client's preference (most preferred first). + * Return the first accepted charset. If nothing in `charsets` is accepted, then `false` is returned. + * If no charsets are supplied, all accepted charsets are returned, in the order of the client's preference + * (most preferred first). */ charsets(): string[]; + charsets(charsets: string[]): string | false; + charsets(...charsets: string[]): string | false; /** * Return the first accepted encoding. If nothing in `encodings` is accepted, then `false` is returned. + * If no encodings are supplied, all accepted encodings are returned, in the order of the client's preference + * (most preferred first). */ + encoding(): string[]; encoding(encodings: string[]): string | false; encoding(...encodings: string[]): string | false; /** - * Return the encodings that the request accepts, in the order of the client's preference (most preferred first). + * Return the first accepted encoding. If nothing in `encodings` is accepted, then `false` is returned. + * If no encodings are supplied, all accepted encodings are returned, in the order of the client's preference + * (most preferred first). */ encodings(): string[]; + encodings(encodings: string[]): string | false; + encodings(...encodings: string[]): string | false; /** * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). */ + language(): string[]; language(languages: string[]): string | false; language(...languages: string[]): string | false; /** - * Return the languages that the request accepts, in the order of the client's preference (most preferred first). + * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). */ languages(): string[]; + languages(languages: string[]): string | false; + languages(...languages: string[]): string | false; + + /** + * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). + */ + lang(): string[]; + lang(languages: string[]): string | false; + lang(...languages: string[]): string | false; + + /** + * Return the first accepted language. If nothing in `languages` is accepted, then `false` is returned. + * If no languaes are supplied, all accepted languages are returned, in the order of the client's preference + * (most preferred first). + */ + langs(): string[]; + langs(languages: string[]): string | false; + langs(...languages: string[]): string | false; /** * Return the first accepted type (and it is returned as the same text as what appears in the `types` array). If nothing in `types` is accepted, then `false` is returned. diff --git a/types/actions-on-google/actions-on-google-tests.ts b/types/actions-on-google/actions-on-google-tests.ts index e57e1e8d98..d24c3093b4 100644 --- a/types/actions-on-google/actions-on-google-tests.ts +++ b/types/actions-on-google/actions-on-google-tests.ts @@ -1,6 +1,6 @@ import { ActionsSdkApp, ActionsSdkAppOptions, DialogflowApp, DialogflowAppOptions, AssistantApp, Responses, Transactions } from 'actions-on-google'; -import * as express from 'express'; +import express = require('express'); function testActionsSdk(request: express.Request, response: express.Response) { const app = new ActionsSdkApp({request, response}); diff --git a/types/actions-on-google/index.d.ts b/types/actions-on-google/index.d.ts index 23a2c1483d..937943e1f0 100644 --- a/types/actions-on-google/index.d.ts +++ b/types/actions-on-google/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for actions-on-google 1.7 +// Type definitions for actions-on-google 1.8 // Project: https://github.com/actions-on-google/actions-on-google-nodejs // Definitions by: Joel Hegg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/actions-on-google/response-builder.d.ts b/types/actions-on-google/response-builder.d.ts index 4ebb9b3007..227d102958 100644 --- a/types/actions-on-google/response-builder.d.ts +++ b/types/actions-on-google/response-builder.d.ts @@ -20,7 +20,9 @@ export enum ImageDisplays { */ WHITE, /** - * Image is centered and resized so the image fits perfectly in the container. + * Image is scaled such that the image width matches the container width. This may crop the top + * and bottom of the image if the scaled image height is greater than the container height. This + * is similar to "Zoom Mode" on a widescreen TV when playing a 4:3 video. */ CROPPED } diff --git a/types/actions-on-google/transactions.d.ts b/types/actions-on-google/transactions.d.ts index 59e6cd9b37..06e44b33dd 100644 --- a/types/actions-on-google/transactions.d.ts +++ b/types/actions-on-google/transactions.d.ts @@ -594,7 +594,12 @@ export namespace TransactionValues { /** * Use external payment gateway tokenization API to tokenize selected payment method. */ - PAYMENT_GATEWAY + PAYMENT_GATEWAY, + /** + * Allows payment service to pass public key for payment info encryption and receive encrypted + * response. + */ + DIRECT } } diff --git a/types/actions-on-google/tsconfig.json b/types/actions-on-google/tsconfig.json index 6682b5c194..776b12264b 100644 --- a/types/actions-on-google/tsconfig.json +++ b/types/actions-on-google/tsconfig.json @@ -25,4 +25,4 @@ "transactions.d.ts", "actions-on-google-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/activex-diskquota/tsconfig.json b/types/activex-diskquota/tsconfig.json index b7430e47f9..597d998a96 100644 --- a/types/activex-diskquota/tsconfig.json +++ b/types/activex-diskquota/tsconfig.json @@ -1,8 +1,10 @@ - { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "scripthost"], + "lib": [ + "es5", + "scripthost" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-excel/index.d.ts b/types/activex-excel/index.d.ts index ec2044f1e7..cdf2a79551 100644 --- a/types/activex-excel/index.d.ts +++ b/types/activex-excel/index.d.ts @@ -2,13 +2,14 @@ // Project: https://msdn.microsoft.com/en-us/library/fp179694.aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// /// /// declare namespace Excel { + // tslint:disable-next-line:no-const-enum const enum Constants { xl3DBar = -4099, xl3DEffects1 = 13, @@ -179,6 +180,7 @@ declare namespace Excel { xlWorksheetShort = 5, } + // tslint:disable-next-line:no-const-enum const enum XlAboveBelow { xlAboveAverage = 0, xlAboveStdDev = 4, @@ -188,6 +190,7 @@ declare namespace Excel { xlEqualBelowAverage = 3, } + // tslint:disable-next-line:no-const-enum const enum XlActionType { xlActionTypeDrillthrough = 256, xlActionTypeReport = 128, @@ -195,21 +198,25 @@ declare namespace Excel { xlActionTypeUrl = 1, } + // tslint:disable-next-line:no-const-enum const enum XlAllocation { xlAutomaticAllocation = 2, xlManualAllocation = 1, } + // tslint:disable-next-line:no-const-enum const enum XlAllocationMethod { xlEqualAllocation = 1, xlWeightedAllocation = 2, } + // tslint:disable-next-line:no-const-enum const enum XlAllocationValue { xlAllocateIncrement = 2, xlAllocateValue = 1, } + // tslint:disable-next-line:no-const-enum const enum XlApplicationInternational { xl24HourClock = 33, xl4DigitYears = 43, @@ -258,11 +265,13 @@ declare namespace Excel { xlYearCode = 19, } + // tslint:disable-next-line:no-const-enum const enum XlApplyNamesOrder { xlColumnThenRow = 2, xlRowThenColumn = 1, } + // tslint:disable-next-line:no-const-enum const enum XlArabicModes { xlArabicBothStrict = 3, xlArabicNone = 0, @@ -270,6 +279,7 @@ declare namespace Excel { xlArabicStrictFinalYaa = 2, } + // tslint:disable-next-line:no-const-enum const enum XlArrangeStyle { xlArrangeStyleCascade = 7, xlArrangeStyleHorizontal = -4128, @@ -277,12 +287,14 @@ declare namespace Excel { xlArrangeStyleVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlArrowHeadLength { xlArrowHeadLengthLong = 3, xlArrowHeadLengthMedium = -4138, xlArrowHeadLengthShort = 1, } + // tslint:disable-next-line:no-const-enum const enum XlArrowHeadStyle { xlArrowHeadStyleClosed = 3, xlArrowHeadStyleDoubleClosed = 5, @@ -291,12 +303,14 @@ declare namespace Excel { xlArrowHeadStyleOpen = 2, } + // tslint:disable-next-line:no-const-enum const enum XlArrowHeadWidth { xlArrowHeadWidthMedium = -4138, xlArrowHeadWidthNarrow = 1, xlArrowHeadWidthWide = 3, } + // tslint:disable-next-line:no-const-enum const enum XlAutoFillType { xlFillCopy = 1, xlFillDays = 5, @@ -311,6 +325,7 @@ declare namespace Excel { xlLinearTrend = 9, } + // tslint:disable-next-line:no-const-enum const enum XlAutoFilterOperator { xlAnd = 1, xlBottom10Items = 4, @@ -328,6 +343,7 @@ declare namespace Excel { xlTop10Percent = 5, } + // tslint:disable-next-line:no-const-enum const enum XlAxisCrosses { xlAxisCrossesAutomatic = -4105, xlAxisCrossesCustom = -4114, @@ -335,23 +351,27 @@ declare namespace Excel { xlAxisCrossesMinimum = 4, } + // tslint:disable-next-line:no-const-enum const enum XlAxisGroup { xlPrimary = 1, xlSecondary = 2, } + // tslint:disable-next-line:no-const-enum const enum XlAxisType { xlCategory = 1, xlSeriesAxis = 3, xlValue = 2, } + // tslint:disable-next-line:no-const-enum const enum XlBackground { xlBackgroundAutomatic = -4105, xlBackgroundOpaque = 3, xlBackgroundTransparent = 2, } + // tslint:disable-next-line:no-const-enum const enum XlBarShape { xlBox = 0, xlConeToMax = 5, @@ -361,6 +381,7 @@ declare namespace Excel { xlPyramidToPoint = 1, } + // tslint:disable-next-line:no-const-enum const enum XlBordersIndex { xlDiagonalDown = 5, xlDiagonalUp = 6, @@ -372,6 +393,7 @@ declare namespace Excel { xlInsideVertical = 11, } + // tslint:disable-next-line:no-const-enum const enum XlBorderWeight { xlHairline = 1, xlMedium = -4138, @@ -379,6 +401,7 @@ declare namespace Excel { xlThin = 2, } + // tslint:disable-next-line:no-const-enum const enum XlBuiltInDialog { _xlDialogChartSourceData = 541, _xlDialogPhonetic = 538, @@ -641,53 +664,62 @@ declare namespace Excel { xlDialogZoom = 256, } + // tslint:disable-next-line:no-const-enum const enum XlCalcFor { xlAllValues = 0, xlColGroups = 2, xlRowGroups = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCalculatedMemberType { xlCalculatedMember = 0, xlCalculatedSet = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCalculation { xlCalculationAutomatic = -4105, xlCalculationManual = -4135, xlCalculationSemiautomatic = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCalculationInterruptKey { xlAnyKey = 2, xlEscKey = 1, xlNoKey = 0, } + // tslint:disable-next-line:no-const-enum const enum XlCalculationState { xlCalculating = 1, xlDone = 0, xlPending = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCategoryType { xlAutomaticScale = -4105, xlCategoryScale = 2, xlTimeScale = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCellChangedState { xlCellChangeApplied = 3, xlCellChanged = 2, xlCellNotChanged = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCellInsertionMode { xlInsertDeleteCells = 1, xlInsertEntireRows = 2, xlOverwriteCells = 0, } + // tslint:disable-next-line:no-const-enum const enum XlCellType { xlCellTypeAllFormatConditions = -4172, xlCellTypeAllValidation = -4174, @@ -701,17 +733,20 @@ declare namespace Excel { xlCellTypeVisible = 12, } + // tslint:disable-next-line:no-const-enum const enum XlChartElementPosition { xlChartElementPositionAutomatic = -4105, xlChartElementPositionCustom = -4114, } + // tslint:disable-next-line:no-const-enum const enum XlChartGallery { xlAnyGallery = 23, xlBuiltIn = 21, xlUserDefined = 22, } + // tslint:disable-next-line:no-const-enum const enum XlChartItem { xlAxis = 21, xlAxisTitle = 17, @@ -747,12 +782,14 @@ declare namespace Excel { xlYErrorBars = 11, } + // tslint:disable-next-line:no-const-enum const enum XlChartLocation { xlLocationAsNewSheet = 1, xlLocationAsObject = 2, xlLocationAutomatic = 3, } + // tslint:disable-next-line:no-const-enum const enum XlChartPicturePlacement { xlAllFaces = 7, xlEnd = 2, @@ -763,12 +800,14 @@ declare namespace Excel { xlSides = 1, } + // tslint:disable-next-line:no-const-enum const enum XlChartPictureType { xlStack = 2, xlStackScale = 3, xlStretch = 1, } + // tslint:disable-next-line:no-const-enum const enum XlChartSplitType { xlSplitByCustomSplit = 4, xlSplitByPercentValue = 3, @@ -776,6 +815,7 @@ declare namespace Excel { xlSplitByValue = 2, } + // tslint:disable-next-line:no-const-enum const enum XlChartType { xl3DArea = -4098, xl3DAreaStacked = 78, @@ -852,12 +892,14 @@ declare namespace Excel { xlXYScatterSmoothNoMarkers = 73, } + // tslint:disable-next-line:no-const-enum const enum XlCheckInVersionType { xlCheckInMajorVersion = 1, xlCheckInMinorVersion = 0, xlCheckInOverwriteVersion = 2, } + // tslint:disable-next-line:no-const-enum const enum XlClipboardFormat { xlClipboardFormatBIFF = 8, xlClipboardFormatBIFF12 = 63, @@ -895,6 +937,7 @@ declare namespace Excel { xlClipboardFormatWK1 = 10, } + // tslint:disable-next-line:no-const-enum const enum XlCmdType { xlCmdCube = 1, xlCmdDefault = 4, @@ -903,11 +946,13 @@ declare namespace Excel { xlCmdTable = 3, } + // tslint:disable-next-line:no-const-enum const enum XlColorIndex { xlColorIndexAutomatic = -4105, xlColorIndexNone = -4142, } + // tslint:disable-next-line:no-const-enum const enum XlColumnDataType { xlDMYFormat = 4, xlDYMFormat = 7, @@ -921,18 +966,21 @@ declare namespace Excel { xlYMDFormat = 5, } + // tslint:disable-next-line:no-const-enum const enum XlCommandUnderlines { xlCommandUnderlinesAutomatic = -4105, xlCommandUnderlinesOff = -4146, xlCommandUnderlinesOn = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCommentDisplayMode { xlCommentAndIndicator = 1, xlCommentIndicatorOnly = -1, xlNoIndicator = 0, } + // tslint:disable-next-line:no-const-enum const enum XlConditionValueTypes { xlConditionValueAutomaticMax = 7, xlConditionValueAutomaticMin = 6, @@ -945,6 +993,7 @@ declare namespace Excel { xlConditionValuePercentile = 5, } + // tslint:disable-next-line:no-const-enum const enum XlConnectionType { xlConnectionTypeODBC = 2, xlConnectionTypeOLEDB = 1, @@ -953,6 +1002,7 @@ declare namespace Excel { xlConnectionTypeXMLMAP = 3, } + // tslint:disable-next-line:no-const-enum const enum XlConsolidationFunction { xlAverage = -4106, xlCount = -4112, @@ -968,6 +1018,7 @@ declare namespace Excel { xlVarP = -4165, } + // tslint:disable-next-line:no-const-enum const enum XlContainsOperator { xlBeginsWith = 2, xlContains = 0, @@ -975,27 +1026,32 @@ declare namespace Excel { xlEndsWith = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCopyPictureFormat { xlBitmap = 2, xlPicture = -4147, } + // tslint:disable-next-line:no-const-enum const enum XlCorruptLoad { xlExtractData = 2, xlNormalLoad = 0, xlRepairFile = 1, } + // tslint:disable-next-line:no-const-enum const enum XlCreator { xlCreatorCode = 1480803660, } + // tslint:disable-next-line:no-const-enum const enum XlCredentialsMethod { xlCredentialsMethodIntegrated = 0, xlCredentialsMethodNone = 1, xlCredentialsMethodStored = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCubeFieldSubType { xlCubeAttribute = 4, xlCubeCalculatedMeasure = 5, @@ -1009,17 +1065,20 @@ declare namespace Excel { xlCubeSet = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCubeFieldType { xlHierarchy = 1, xlMeasure = 2, xlSet = 3, } + // tslint:disable-next-line:no-const-enum const enum XlCutCopyMode { xlCopy = 1, xlCut = 2, } + // tslint:disable-next-line:no-const-enum const enum XlCVError { xlErrDiv0 = 2007, xlErrNA = 2042, @@ -1030,27 +1089,32 @@ declare namespace Excel { xlErrValue = 2015, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarAxisPosition { xlDataBarAxisAutomatic = 0, xlDataBarAxisMidpoint = 1, xlDataBarAxisNone = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarBorderType { xlDataBarBorderNone = 0, xlDataBarBorderSolid = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarFillType { xlDataBarFillGradient = 1, xlDataBarFillSolid = 0, } + // tslint:disable-next-line:no-const-enum const enum XlDataBarNegativeColorType { xlDataBarColor = 0, xlDataBarSameAsPositive = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDataLabelPosition { xlLabelPositionAbove = 0, xlLabelPositionBelow = 1, @@ -1065,10 +1129,12 @@ declare namespace Excel { xlLabelPositionRight = -4152, } + // tslint:disable-next-line:no-const-enum const enum XlDataLabelSeparator { xlDataLabelSeparatorDefault = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDataLabelsType { xlDataLabelsShowBubbleSizes = 6, xlDataLabelsShowLabel = 4, @@ -1078,6 +1144,7 @@ declare namespace Excel { xlDataLabelsShowValue = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDataSeriesDate { xlDay = 1, xlMonth = 3, @@ -1085,6 +1152,7 @@ declare namespace Excel { xlYear = 4, } + // tslint:disable-next-line:no-const-enum const enum XlDataSeriesType { xlAutoFill = 4, xlChronological = 3, @@ -1092,11 +1160,13 @@ declare namespace Excel { xlGrowth = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDeleteShiftDirection { xlShiftToLeft = -4159, xlShiftUp = -4162, } + // tslint:disable-next-line:no-const-enum const enum XlDirection { xlDown = -4121, xlToLeft = -4159, @@ -1104,18 +1174,21 @@ declare namespace Excel { xlUp = -4162, } + // tslint:disable-next-line:no-const-enum const enum XlDisplayBlanksAs { xlInterpolated = 3, xlNotPlotted = 1, xlZero = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDisplayDrawingObjects { xlDisplayShapes = -4104, xlHide = 3, xlPlaceholders = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDisplayUnit { xlHundredMillions = -8, xlHundreds = -2, @@ -1128,17 +1201,20 @@ declare namespace Excel { xlThousands = -3, } + // tslint:disable-next-line:no-const-enum const enum XlDupeUnique { xlDuplicate = 1, xlUnique = 0, } + // tslint:disable-next-line:no-const-enum const enum XlDVAlertStyle { xlValidAlertInformation = 3, xlValidAlertStop = 1, xlValidAlertWarning = 2, } + // tslint:disable-next-line:no-const-enum const enum XlDVType { xlValidateCustom = 7, xlValidateDate = 4, @@ -1150,6 +1226,7 @@ declare namespace Excel { xlValidateWholeNumber = 1, } + // tslint:disable-next-line:no-const-enum const enum XlDynamicFilterCriteria { xlFilterAboveAverage = 33, xlFilterAllDatesInPeriodApril = 24, @@ -1187,6 +1264,7 @@ declare namespace Excel { xlFilterYesterday = 2, } + // tslint:disable-next-line:no-const-enum const enum XlEditionFormat { xlBIFF = 2, xlPICT = 1, @@ -1194,6 +1272,7 @@ declare namespace Excel { xlVALU = 8, } + // tslint:disable-next-line:no-const-enum const enum XlEditionOptionsOption { xlAutomaticUpdate = 4, xlCancel = 1, @@ -1205,33 +1284,39 @@ declare namespace Excel { xlUpdateSubscriber = 2, } + // tslint:disable-next-line:no-const-enum const enum XlEditionType { xlPublisher = 1, xlSubscriber = 2, } + // tslint:disable-next-line:no-const-enum const enum XlEnableCancelKey { xlDisabled = 0, xlErrorHandler = 2, xlInterrupt = 1, } + // tslint:disable-next-line:no-const-enum const enum XlEnableSelection { xlNoRestrictions = 0, xlNoSelection = -4142, xlUnlockedCells = 1, } + // tslint:disable-next-line:no-const-enum const enum XlEndStyleCap { xlCap = 1, xlNoCap = 2, } + // tslint:disable-next-line:no-const-enum const enum XlErrorBarDirection { xlX = -4168, xlY = 1, } + // tslint:disable-next-line:no-const-enum const enum XlErrorBarInclude { xlErrorBarIncludeBoth = 1, xlErrorBarIncludeMinusValues = 3, @@ -1239,6 +1324,7 @@ declare namespace Excel { xlErrorBarIncludePlusValues = 2, } + // tslint:disable-next-line:no-const-enum const enum XlErrorBarType { xlErrorBarTypeCustom = -4114, xlErrorBarTypeFixedValue = 1, @@ -1247,6 +1333,7 @@ declare namespace Excel { xlErrorBarTypeStError = 4, } + // tslint:disable-next-line:no-const-enum const enum XlErrorChecks { xlEmptyCellReferences = 7, xlEvaluateToError = 1, @@ -1259,11 +1346,13 @@ declare namespace Excel { xlUnlockedFormulaCells = 6, } + // tslint:disable-next-line:no-const-enum const enum XlFileAccess { xlReadOnly = 3, xlReadWrite = 2, } + // tslint:disable-next-line:no-const-enum const enum XlFileFormat { xlAddIn = 18, xlAddIn8 = 18, @@ -1321,23 +1410,27 @@ declare namespace Excel { xlXMLSpreadsheet = 46, } + // tslint:disable-next-line:no-const-enum const enum XlFileValidationPivotMode { xlFileValidationPivotDefault = 0, xlFileValidationPivotRun = 1, xlFileValidationPivotSkip = 2, } + // tslint:disable-next-line:no-const-enum const enum XlFillWith { xlFillWithAll = -4104, xlFillWithContents = 2, xlFillWithFormats = -4122, } + // tslint:disable-next-line:no-const-enum const enum XlFilterAction { xlFilterCopy = 2, xlFilterInPlace = 1, } + // tslint:disable-next-line:no-const-enum const enum XlFilterAllDatesInPeriod { xlFilterAllDatesInPeriodDay = 2, xlFilterAllDatesInPeriodHour = 3, @@ -1347,22 +1440,26 @@ declare namespace Excel { xlFilterAllDatesInPeriodYear = 0, } + // tslint:disable-next-line:no-const-enum const enum XlFindLookIn { xlComments = -4144, xlFormulas = -4123, xlValues = -4163, } + // tslint:disable-next-line:no-const-enum const enum XlFixedFormatQuality { xlQualityMinimum = 1, xlQualityStandard = 0, } + // tslint:disable-next-line:no-const-enum const enum XlFixedFormatType { xlTypePDF = 0, xlTypeXPS = 1, } + // tslint:disable-next-line:no-const-enum const enum XlFormatConditionOperator { xlBetween = 1, xlEqual = 3, @@ -1374,6 +1471,7 @@ declare namespace Excel { xlNotEqual = 4, } + // tslint:disable-next-line:no-const-enum const enum XlFormatConditionType { xlAboveAverageCondition = 12, xlBlanksCondition = 10, @@ -1391,6 +1489,7 @@ declare namespace Excel { xlUniqueValues = 8, } + // tslint:disable-next-line:no-const-enum const enum XlFormatFilterTypes { xlFilterBottom = 0, xlFilterBottomPercent = 2, @@ -1398,6 +1497,7 @@ declare namespace Excel { xlFilterTopPercent = 3, } + // tslint:disable-next-line:no-const-enum const enum XlFormControl { xlButtonControl = 0, xlCheckBox = 1, @@ -1411,6 +1511,7 @@ declare namespace Excel { xlSpinner = 9, } + // tslint:disable-next-line:no-const-enum const enum XlFormulaLabel { xlColumnLabels = 2, xlMixedLabels = 3, @@ -1418,16 +1519,19 @@ declare namespace Excel { xlRowLabels = 1, } + // tslint:disable-next-line:no-const-enum const enum XlGenerateTableRefs { xlGenerateTableRefA1 = 0, xlGenerateTableRefStruct = 1, } + // tslint:disable-next-line:no-const-enum const enum XlGradientFillType { xlGradientFillLinear = 0, xlGradientFillPath = 1, } + // tslint:disable-next-line:no-const-enum const enum XlHAlign { xlHAlignCenter = -4108, xlHAlignCenterAcrossSelection = 7, @@ -1439,6 +1543,7 @@ declare namespace Excel { xlHAlignRight = -4152, } + // tslint:disable-next-line:no-const-enum const enum XlHebrewModes { xlHebrewFullScript = 0, xlHebrewMixedAuthorizedScript = 3, @@ -1446,12 +1551,14 @@ declare namespace Excel { xlHebrewPartialScript = 1, } + // tslint:disable-next-line:no-const-enum const enum XlHighlightChangesTime { xlAllChanges = 2, xlNotYetReviewed = 3, xlSinceMyLastSave = 1, } + // tslint:disable-next-line:no-const-enum const enum XlHtmlType { xlHtmlCalc = 1, xlHtmlChart = 3, @@ -1459,6 +1566,7 @@ declare namespace Excel { xlHtmlStatic = 0, } + // tslint:disable-next-line:no-const-enum const enum XlIcon { xlIcon0Bars = 37, xlIcon0FilledBoxes = 52, @@ -1515,6 +1623,7 @@ declare namespace Excel { xlIconYellowUpInclineArrow = 25, } + // tslint:disable-next-line:no-const-enum const enum XlIconSet { xl3Arrows = 1, xl3ArrowsGray = 2, @@ -1539,6 +1648,7 @@ declare namespace Excel { xlCustomSet = -1, } + // tslint:disable-next-line:no-const-enum const enum XlIMEMode { xlIMEModeAlpha = 8, xlIMEModeAlphaFull = 7, @@ -1553,33 +1663,39 @@ declare namespace Excel { xlIMEModeOn = 1, } + // tslint:disable-next-line:no-const-enum const enum XlImportDataAs { xlPivotTableReport = 1, xlQueryTable = 0, xlTable = 2, } + // tslint:disable-next-line:no-const-enum const enum XlInsertFormatOrigin { xlFormatFromLeftOrAbove = 0, xlFormatFromRightOrBelow = 1, } + // tslint:disable-next-line:no-const-enum const enum XlInsertShiftDirection { xlShiftDown = -4121, xlShiftToRight = -4161, } + // tslint:disable-next-line:no-const-enum const enum XlLayoutFormType { xlOutline = 1, xlTabular = 0, } + // tslint:disable-next-line:no-const-enum const enum XlLayoutRowType { xlCompactRow = 0, xlOutlineRow = 2, xlTabularRow = 1, } + // tslint:disable-next-line:no-const-enum const enum XlLegendPosition { xlLegendPositionBottom = -4107, xlLegendPositionCorner = 2, @@ -1589,6 +1705,7 @@ declare namespace Excel { xlLegendPositionTop = -4160, } + // tslint:disable-next-line:no-const-enum const enum XlLineStyle { xlContinuous = 1, xlDash = -4115, @@ -1600,6 +1717,7 @@ declare namespace Excel { xlSlantDashDot = 13, } + // tslint:disable-next-line:no-const-enum const enum XlLink { xlExcelLinks = 1, xlOLELinks = 2, @@ -1607,18 +1725,21 @@ declare namespace Excel { xlSubscribers = 6, } + // tslint:disable-next-line:no-const-enum const enum XlLinkInfo { xlEditionDate = 2, xlLinkInfoStatus = 3, xlUpdateState = 1, } + // tslint:disable-next-line:no-const-enum const enum XlLinkInfoType { xlLinkInfoOLELinks = 2, xlLinkInfoPublishers = 5, xlLinkInfoSubscribers = 6, } + // tslint:disable-next-line:no-const-enum const enum XlLinkStatus { xlLinkStatusCopiedValues = 10, xlLinkStatusIndeterminate = 5, @@ -1633,11 +1754,13 @@ declare namespace Excel { xlLinkStatusSourceOpen = 9, } + // tslint:disable-next-line:no-const-enum const enum XlLinkType { xlLinkTypeExcelLinks = 1, xlLinkTypeOLELinks = 2, } + // tslint:disable-next-line:no-const-enum const enum XlListConflict { xlListConflictDialog = 0, xlListConflictDiscardAllConflicts = 2, @@ -1645,6 +1768,7 @@ declare namespace Excel { xlListConflictRetryAllConflicts = 1, } + // tslint:disable-next-line:no-const-enum const enum XlListDataType { xlListDataTypeCheckbox = 9, xlListDataTypeChoice = 6, @@ -1661,6 +1785,7 @@ declare namespace Excel { xlListDataTypeText = 1, } + // tslint:disable-next-line:no-const-enum const enum XlListObjectSourceType { xlSrcExternal = 0, xlSrcQuery = 3, @@ -1668,6 +1793,7 @@ declare namespace Excel { xlSrcXml = 2, } + // tslint:disable-next-line:no-const-enum const enum XlLocationInTable { xlColumnHeader = -4110, xlColumnItem = 5, @@ -1680,23 +1806,27 @@ declare namespace Excel { xlTableBody = 8, } + // tslint:disable-next-line:no-const-enum const enum XlLookAt { xlPart = 2, xlWhole = 1, } + // tslint:disable-next-line:no-const-enum const enum XlLookFor { xlLookForBlanks = 0, xlLookForErrors = 1, xlLookForFormulas = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMailSystem { xlMAPI = 1, xlNoMailSystem = 0, xlPowerTalk = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMarkerStyle { xlMarkerStyleAutomatic = -4105, xlMarkerStyleCircle = 8, @@ -1712,18 +1842,21 @@ declare namespace Excel { xlMarkerStyleX = -4168, } + // tslint:disable-next-line:no-const-enum const enum XlMeasurementUnits { xlCentimeters = 1, xlInches = 0, xlMillimeters = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMouseButton { xlNoButton = 0, xlPrimaryButton = 1, xlSecondaryButton = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMousePointer { xlDefault = -4143, xlIBeam = 3, @@ -1731,6 +1864,7 @@ declare namespace Excel { xlWait = 2, } + // tslint:disable-next-line:no-const-enum const enum XlMSApplication { xlMicrosoftAccess = 4, xlMicrosoftFoxPro = 5, @@ -1741,39 +1875,46 @@ declare namespace Excel { xlMicrosoftWord = 1, } + // tslint:disable-next-line:no-const-enum const enum XlOartHorizontalOverflow { xlOartHorizontalOverflowClip = 1, xlOartHorizontalOverflowOverflow = 0, } + // tslint:disable-next-line:no-const-enum const enum XlOartVerticalOverflow { xlOartVerticalOverflowClip = 1, xlOartVerticalOverflowEllipsis = 2, xlOartVerticalOverflowOverflow = 0, } + // tslint:disable-next-line:no-const-enum const enum XlObjectSize { xlFitToPage = 2, xlFullPage = 3, xlScreenSize = 1, } + // tslint:disable-next-line:no-const-enum const enum XlOLEType { xlOLEControl = 2, xlOLEEmbed = 1, xlOLELink = 0, } + // tslint:disable-next-line:no-const-enum const enum XlOLEVerb { xlVerbOpen = 2, xlVerbPrimary = 1, } + // tslint:disable-next-line:no-const-enum const enum XlOrder { xlDownThenOver = 1, xlOverThenDown = 2, } + // tslint:disable-next-line:no-const-enum const enum XlOrientation { xlDownward = -4170, xlHorizontal = -4128, @@ -1781,22 +1922,26 @@ declare namespace Excel { xlVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlPageBreak { xlPageBreakAutomatic = -4105, xlPageBreakManual = -4135, xlPageBreakNone = -4142, } + // tslint:disable-next-line:no-const-enum const enum XlPageBreakExtent { xlPageBreakFull = 1, xlPageBreakPartial = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPageOrientation { xlLandscape = 2, xlPortrait = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPaperSize { xlPaper10x14 = 16, xlPaper11x17 = 17, @@ -1842,6 +1987,7 @@ declare namespace Excel { xlPaperUser = 256, } + // tslint:disable-next-line:no-const-enum const enum XlParameterDataType { xlParamTypeBigInt = -5, xlParamTypeBinary = -2, @@ -1866,12 +2012,14 @@ declare namespace Excel { xlParamTypeWChar = -8, } + // tslint:disable-next-line:no-const-enum const enum XlParameterType { xlConstant = 1, xlPrompt = 0, xlRange = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPasteSpecialOperation { xlPasteSpecialOperationAdd = 2, xlPasteSpecialOperationDivide = 5, @@ -1880,6 +2028,7 @@ declare namespace Excel { xlPasteSpecialOperationSubtract = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPasteType { xlPasteAll = -4104, xlPasteAllExceptBorders = 7, @@ -1895,6 +2044,7 @@ declare namespace Excel { xlPasteValuesAndNumberFormats = 12, } + // tslint:disable-next-line:no-const-enum const enum XlPattern { xlPatternAutomatic = -4105, xlPatternChecker = 9, @@ -1920,6 +2070,7 @@ declare namespace Excel { xlPatternVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlPhoneticAlignment { xlPhoneticAlignCenter = 2, xlPhoneticAlignDistributed = 3, @@ -1927,6 +2078,7 @@ declare namespace Excel { xlPhoneticAlignNoControl = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPhoneticCharacterType { xlHiragana = 2, xlKatakana = 1, @@ -1934,11 +2086,13 @@ declare namespace Excel { xlNoConversion = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPictureAppearance { xlPrinter = 2, xlScreen = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPictureConvertorType { xlBMP = 1, xlCGM = 7, @@ -1955,6 +2109,7 @@ declare namespace Excel { xlWPG = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPieSliceIndex { xlCenterPoint = 5, xlInnerCenterPoint = 8, @@ -1967,11 +2122,13 @@ declare namespace Excel { xlOuterCounterClockwisePoint = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPieSliceLocation { xlHorizontalCoordinate = 1, xlVerticalCoordinate = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPivotCellType { xlPivotCellBlankCell = 9, xlPivotCellCustomSubtotal = 7, @@ -1985,12 +2142,14 @@ declare namespace Excel { xlPivotCellValue = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPivotConditionScope { xlDataFieldScope = 2, xlFieldsScope = 1, xlSelectionScope = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldCalculation { xlDifferenceFrom = 2, xlIndex = 9, @@ -2009,12 +2168,14 @@ declare namespace Excel { xlRunningTotal = 5, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldDataType { xlDate = 2, xlNumber = -4145, xlText = -4158, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldOrientation { xlColumnField = 2, xlDataField = 4, @@ -2023,11 +2184,13 @@ declare namespace Excel { xlRowField = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFieldRepeatLabels { xlDoNotRepeatLabels = 1, xlRepeatLabels = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFilterType { xlAfter = 33, xlAfterOrEqualTo = 34, @@ -2099,6 +2262,7 @@ declare namespace Excel { xlYearToDate = 52, } + // tslint:disable-next-line:no-const-enum const enum XlPivotFormatType { xlPTClassic = 20, xlPTNone = 21, @@ -2124,6 +2288,7 @@ declare namespace Excel { xlTable9 = 18, } + // tslint:disable-next-line:no-const-enum const enum XlPivotLineType { xlPivotLineBlank = 3, xlPivotLineGrandTotal = 2, @@ -2131,6 +2296,7 @@ declare namespace Excel { xlPivotLineSubtotal = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPivotTableMissingItems { xlMissingItemsDefault = -1, xlMissingItemsMax = 32500, @@ -2138,6 +2304,7 @@ declare namespace Excel { xlMissingItemsNone = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPivotTableSourceType { xlConsolidation = 3, xlDatabase = 1, @@ -2146,6 +2313,7 @@ declare namespace Excel { xlScenario = 4, } + // tslint:disable-next-line:no-const-enum const enum XlPivotTableVersionList { xlPivotTableVersion10 = 1, xlPivotTableVersion11 = 2, @@ -2155,24 +2323,28 @@ declare namespace Excel { xlPivotTableVersionCurrent = -1, } + // tslint:disable-next-line:no-const-enum const enum XlPlacement { xlFreeFloating = 3, xlMove = 2, xlMoveAndSize = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPlatform { xlMacintosh = 1, xlMSDOS = 3, xlWindows = 2, } + // tslint:disable-next-line:no-const-enum const enum XlPortugueseReform { xlPortugueseBoth = 3, xlPortuguesePostReform = 2, xlPortuguesePreReform = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPrintErrors { xlPrintErrorsBlank = 1, xlPrintErrorsDash = 2, @@ -2180,36 +2352,42 @@ declare namespace Excel { xlPrintErrorsNA = 3, } + // tslint:disable-next-line:no-const-enum const enum XlPrintLocation { xlPrintInPlace = 16, xlPrintNoComments = -4142, xlPrintSheetEnd = 1, } + // tslint:disable-next-line:no-const-enum const enum XlPriority { xlPriorityHigh = -4127, xlPriorityLow = -4134, xlPriorityNormal = -4143, } + // tslint:disable-next-line:no-const-enum const enum XlPropertyDisplayedIn { xlDisplayPropertyInPivotTable = 1, xlDisplayPropertyInPivotTableAndTooltip = 3, xlDisplayPropertyInTooltip = 2, } + // tslint:disable-next-line:no-const-enum const enum XlProtectedViewCloseReason { xlProtectedViewCloseEdit = 1, xlProtectedViewCloseForced = 2, xlProtectedViewCloseNormal = 0, } + // tslint:disable-next-line:no-const-enum const enum XlProtectedViewWindowState { xlProtectedViewWindowMaximized = 2, xlProtectedViewWindowMinimized = 1, xlProtectedViewWindowNormal = 0, } + // tslint:disable-next-line:no-const-enum const enum XlPTSelectionMode { xlBlanks = 4, xlButton = 15, @@ -2220,6 +2398,7 @@ declare namespace Excel { xlOrigin = 3, } + // tslint:disable-next-line:no-const-enum const enum XlQueryType { xlADORecordset = 7, xlDAORecordset = 2, @@ -2229,6 +2408,7 @@ declare namespace Excel { xlWebQuery = 4, } + // tslint:disable-next-line:no-const-enum const enum XlRangeAutoFormat { xlRangeAutoFormat3DEffects1 = 13, xlRangeAutoFormat3DEffects2 = 14, @@ -2275,17 +2455,20 @@ declare namespace Excel { xlRangeAutoFormatTable9 = 40, } + // tslint:disable-next-line:no-const-enum const enum XlRangeValueDataType { xlRangeValueDefault = 10, xlRangeValueMSPersistXML = 12, xlRangeValueXMLSpreadsheet = 11, } + // tslint:disable-next-line:no-const-enum const enum XlReferenceStyle { xlA1 = 1, xlR1C1 = -4150, } + // tslint:disable-next-line:no-const-enum const enum XlReferenceType { xlAbsolute = 1, xlAbsRowRelColumn = 2, @@ -2293,6 +2476,7 @@ declare namespace Excel { xlRelRowAbsColumn = 3, } + // tslint:disable-next-line:no-const-enum const enum XlRemoveDocInfoType { xlRDIAll = 99, xlRDIComments = 1, @@ -2313,6 +2497,7 @@ declare namespace Excel { xlRDISendForReview = 7, } + // tslint:disable-next-line:no-const-enum const enum XlRgbColor { rgbAliceBlue = 16775408, rgbAntiqueWhite = 14150650, @@ -2460,28 +2645,33 @@ declare namespace Excel { rgbYellowGreen = 3329434, } + // tslint:disable-next-line:no-const-enum const enum XlRobustConnect { xlAlways = 1, xlAsRequired = 0, xlNever = 2, } + // tslint:disable-next-line:no-const-enum const enum XlRoutingSlipDelivery { xlAllAtOnce = 2, xlOneAfterAnother = 1, } + // tslint:disable-next-line:no-const-enum const enum XlRoutingSlipStatus { xlNotYetRouted = 0, xlRoutingComplete = 2, xlRoutingInProgress = 1, } + // tslint:disable-next-line:no-const-enum const enum XlRowCol { xlColumns = 2, xlRows = 1, } + // tslint:disable-next-line:no-const-enum const enum XlRunAutoMacro { xlAutoActivate = 3, xlAutoClose = 2, @@ -2489,43 +2679,51 @@ declare namespace Excel { xlAutoOpen = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSaveAction { xlDoNotSaveChanges = 2, xlSaveChanges = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSaveAsAccessMode { xlExclusive = 3, xlNoChange = 1, xlShared = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSaveConflictResolution { xlLocalSessionChanges = 2, xlOtherSessionChanges = 3, xlUserResolution = 1, } + // tslint:disable-next-line:no-const-enum const enum XlScaleType { xlScaleLinear = -4132, xlScaleLogarithmic = -4133, } + // tslint:disable-next-line:no-const-enum const enum XlSearchDirection { xlNext = 1, xlPrevious = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSearchOrder { xlByColumns = 2, xlByRows = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSearchWithin { xlWithinSheet = 1, xlWithinWorkbook = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSheetType { xlChart = -4109, xlDialogSheet = -4116, @@ -2534,29 +2732,34 @@ declare namespace Excel { xlWorksheet = -4167, } + // tslint:disable-next-line:no-const-enum const enum XlSheetVisibility { xlSheetHidden = 0, xlSheetVeryHidden = 2, xlSheetVisible = -1, } + // tslint:disable-next-line:no-const-enum const enum XlSizeRepresents { xlSizeIsArea = 1, xlSizeIsWidth = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSlicerCrossFilterType { xlSlicerCrossFilterShowItemsWithDataAtTop = 2, xlSlicerCrossFilterShowItemsWithNoData = 3, xlSlicerNoCrossFilter = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSlicerSort { xlSlicerSortAscending = 2, xlSlicerSortDataSourceOrder = 1, xlSlicerSortDescending = 3, } + // tslint:disable-next-line:no-const-enum const enum XlSmartTagControlType { xlSmartTagControlActiveX = 13, xlSmartTagControlButton = 6, @@ -2574,27 +2777,32 @@ declare namespace Excel { xlSmartTagControlTextbox = 10, } + // tslint:disable-next-line:no-const-enum const enum XlSmartTagDisplayMode { xlButtonOnly = 2, xlDisplayNone = 1, xlIndicatorAndButton = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSortDataOption { xlSortNormal = 0, xlSortTextAsNumbers = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSortMethod { xlPinYin = 1, xlStroke = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSortMethodOld { xlCodePage = 2, xlSyllabary = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSortOn { xlSortOnCellColor = 1, xlSortOnFontColor = 2, @@ -2602,21 +2810,25 @@ declare namespace Excel { xlSortOnValues = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSortOrder { xlAscending = 1, xlDescending = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSortOrientation { xlSortColumns = 1, xlSortRows = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSortType { xlSortLabels = 2, xlSortValues = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSourceType { xlSourceAutoFilter = 3, xlSourceChart = 5, @@ -2628,35 +2840,41 @@ declare namespace Excel { xlSourceWorkbook = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSpanishModes { xlSpanishTuteoAndVoseo = 1, xlSpanishTuteoOnly = 0, xlSpanishVoseoOnly = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSparklineRowCol { xlSparklineColumnsSquare = 2, xlSparklineNonSquare = 0, xlSparklineRowsSquare = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSparkScale { xlSparkScaleCustom = 3, xlSparkScaleGroup = 1, xlSparkScaleSingle = 2, } + // tslint:disable-next-line:no-const-enum const enum XlSparkType { xlSparkColumn = 2, xlSparkColumnStacked100 = 3, xlSparkLine = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSpeakDirection { xlSpeakByColumns = 1, xlSpeakByRows = 0, } + // tslint:disable-next-line:no-const-enum const enum XlSpecialCellsValue { xlErrors = 16, xlLogical = 4, @@ -2664,6 +2882,7 @@ declare namespace Excel { xlTextValues = 2, } + // tslint:disable-next-line:no-const-enum const enum XlStdColorScale { xlColorScaleBlackWhite = 3, xlColorScaleGYR = 2, @@ -2671,31 +2890,37 @@ declare namespace Excel { xlColorScaleWhiteBlack = 4, } + // tslint:disable-next-line:no-const-enum const enum XlSubscribeToFormat { xlSubscribeToPicture = -4147, xlSubscribeToText = -4158, } + // tslint:disable-next-line:no-const-enum const enum XlSubtototalLocationType { xlAtBottom = 2, xlAtTop = 1, } + // tslint:disable-next-line:no-const-enum const enum XlSummaryColumn { xlSummaryOnLeft = -4131, xlSummaryOnRight = -4152, } + // tslint:disable-next-line:no-const-enum const enum XlSummaryReportType { xlStandardSummary = 1, xlSummaryPivotTable = -4148, } + // tslint:disable-next-line:no-const-enum const enum XlSummaryRow { xlSummaryAbove = 0, xlSummaryBelow = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTableStyleElementType { xlBlankRow = 19, xlColumnStripe1 = 7, @@ -2737,27 +2962,32 @@ declare namespace Excel { xlWholeTable = 0, } + // tslint:disable-next-line:no-const-enum const enum XlTabPosition { xlTabPositionFirst = 0, xlTabPositionLast = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTextParsingType { xlDelimited = 1, xlFixedWidth = 2, } + // tslint:disable-next-line:no-const-enum const enum XlTextQualifier { xlTextQualifierDoubleQuote = 1, xlTextQualifierNone = -4142, xlTextQualifierSingleQuote = 2, } + // tslint:disable-next-line:no-const-enum const enum XlTextVisualLayoutType { xlTextVisualLTR = 1, xlTextVisualRTL = 2, } + // tslint:disable-next-line:no-const-enum const enum XlThemeColor { xlThemeColorAccent1 = 5, xlThemeColorAccent2 = 6, @@ -2773,17 +3003,20 @@ declare namespace Excel { xlThemeColorLight2 = 4, } + // tslint:disable-next-line:no-const-enum const enum XlThemeFont { xlThemeFontMajor = 1, xlThemeFontMinor = 2, xlThemeFontNone = 0, } + // tslint:disable-next-line:no-const-enum const enum XlThreadMode { xlThreadModeAutomatic = 0, xlThreadModeManual = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTickLabelOrientation { xlTickLabelOrientationAutomatic = -4105, xlTickLabelOrientationDownward = -4170, @@ -2792,6 +3025,7 @@ declare namespace Excel { xlTickLabelOrientationVertical = -4166, } + // tslint:disable-next-line:no-const-enum const enum XlTickLabelPosition { xlTickLabelPositionHigh = -4127, xlTickLabelPositionLow = -4134, @@ -2799,6 +3033,7 @@ declare namespace Excel { xlTickLabelPositionNone = -4142, } + // tslint:disable-next-line:no-const-enum const enum XlTickMark { xlTickMarkCross = 4, xlTickMarkInside = 2, @@ -2806,6 +3041,7 @@ declare namespace Excel { xlTickMarkOutside = 3, } + // tslint:disable-next-line:no-const-enum const enum XlTimePeriods { xlLast7Days = 2, xlLastMonth = 5, @@ -2819,12 +3055,14 @@ declare namespace Excel { xlYesterday = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTimeUnit { xlDays = 0, xlMonths = 1, xlYears = 2, } + // tslint:disable-next-line:no-const-enum const enum XlToolbarProtection { xlNoButtonChanges = 1, xlNoChanges = 4, @@ -2833,11 +3071,13 @@ declare namespace Excel { xlToolbarProtectionNone = -4143, } + // tslint:disable-next-line:no-const-enum const enum XlTopBottom { xlTop10Bottom = 0, xlTop10Top = 1, } + // tslint:disable-next-line:no-const-enum const enum XlTotalsCalculation { xlTotalsCalculationAverage = 2, xlTotalsCalculationCount = 3, @@ -2851,6 +3091,7 @@ declare namespace Excel { xlTotalsCalculationVar = 8, } + // tslint:disable-next-line:no-const-enum const enum XlTrendlineType { xlExponential = 5, xlLinear = -4132, @@ -2860,6 +3101,7 @@ declare namespace Excel { xlPower = 4, } + // tslint:disable-next-line:no-const-enum const enum XlUnderlineStyle { xlUnderlineStyleDouble = -4119, xlUnderlineStyleDoubleAccounting = 5, @@ -2868,12 +3110,14 @@ declare namespace Excel { xlUnderlineStyleSingleAccounting = 4, } + // tslint:disable-next-line:no-const-enum const enum XlUpdateLinks { xlUpdateLinksAlways = 3, xlUpdateLinksNever = 2, xlUpdateLinksUserSetting = 1, } + // tslint:disable-next-line:no-const-enum const enum XlVAlign { xlVAlignBottom = -4107, xlVAlignCenter = -4108, @@ -2882,6 +3126,7 @@ declare namespace Excel { xlVAlignTop = -4160, } + // tslint:disable-next-line:no-const-enum const enum XlWBATemplate { xlWBATChart = -4109, xlWBATExcel4IntlMacroSheet = 4, @@ -2889,24 +3134,28 @@ declare namespace Excel { xlWBATWorksheet = -4167, } + // tslint:disable-next-line:no-const-enum const enum XlWebFormatting { xlWebFormattingAll = 1, xlWebFormattingNone = 3, xlWebFormattingRTF = 2, } + // tslint:disable-next-line:no-const-enum const enum XlWebSelectionType { xlAllTables = 2, xlEntirePage = 1, xlSpecifiedTables = 3, } + // tslint:disable-next-line:no-const-enum const enum XlWindowState { xlMaximized = -4137, xlMinimized = -4140, xlNormal = -4143, } + // tslint:disable-next-line:no-const-enum const enum XlWindowType { xlChartAsWindow = 5, xlChartInPlace = 4, @@ -2915,29 +3164,34 @@ declare namespace Excel { xlWorkbook = 1, } + // tslint:disable-next-line:no-const-enum const enum XlWindowView { xlNormalView = 1, xlPageBreakPreview = 2, xlPageLayoutView = 3, } + // tslint:disable-next-line:no-const-enum const enum XlXLMMacroType { xlCommand = 2, xlFunction = 1, xlNotXLM = 3, } + // tslint:disable-next-line:no-const-enum const enum XlXmlExportResult { xlXmlExportSuccess = 0, xlXmlExportValidationFailed = 1, } + // tslint:disable-next-line:no-const-enum const enum XlXmlImportResult { xlXmlImportElementsTruncated = 1, xlXmlImportSuccess = 0, xlXmlImportValidationFailed = 2, } + // tslint:disable-next-line:no-const-enum const enum XlXmlLoadOption { xlXmlLoadImportToList = 2, xlXmlLoadMapXml = 3, @@ -2945,6 +3199,7 @@ declare namespace Excel { xlXmlLoadPromptUser = 0, } + // tslint:disable-next-line:no-const-enum const enum XlYesNoGuess { xlGuess = 0, xlNo = 2, @@ -6547,7 +6802,7 @@ declare namespace Excel { /** @param Excel.XlSearchDirection [SearchDirection=1] */ Find(What: any, After?: any, LookIn?: XlFindLookIn, LookAt?: XlLookAt, SearchOrder?: XlSearchOrder, SearchDirection?: XlSearchDirection, MatchCase?: boolean, - MatchByte?: boolean, SearchFormat?: any): Range; + MatchByte?: boolean, SearchFormat?: any): Range; FindNext(After?: any): Range; FindPrevious(After?: any): Range; readonly Font: Font; @@ -7049,7 +7304,7 @@ declare namespace Excel { AddLabel(Orientation: Office.MsoTextOrientation, Left: number, Top: number, Width: number, Height: number): Shape; AddLine(BeginX: number, BeginY: number, EndX: number, EndY: number): Shape; AddOLEObject(ClassType?: any, Filename?: any, Link?: any, DisplayAsIcon?: any, IconFileName?: any, IconIndex?: any, IconLabel?: any, Left?: any, Top?: any, Width?: any, - Height?: any): Shape; + Height?: any): Shape; AddPicture(Filename: string, LinkToFile: Office.MsoTriState, SaveWithDocument: Office.MsoTriState, Left: number, Top: number, Width: number, Height: number): Shape; AddPolyline(SafeArrayOfPoints: any): Shape; AddShape(Type: Office.MsoAutoShapeType, Left: number, Top: number, Width: number, Height: number): Shape; @@ -9243,217 +9498,221 @@ declare namespace Excel { interface ActiveXObject { on( obj: Excel.Application, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Application, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Application, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Application, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Application, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Application, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Application, parameter: {pctinfo: number}) => void): void; + this: Excel.Application, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Application, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Application, parameter: { pctinfo: number }) => void): void; on( obj: Excel.Application, event: 'Invoke', argNames: Excel.EventHelperTypes.Application_Invoke_ArgNames, handler: ( this: Excel.Application, parameter: Excel.EventHelperTypes.Application_Invoke_Parameter) => void): void; on( obj: Excel.Application, event: 'NewWorkbook' | 'WorkbookActivate' | 'WorkbookAddinInstall' | 'WorkbookAddinUninstall' | 'WorkbookDeactivate' | 'WorkbookOpen', - argNames: ['Wb'], handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook}) => void): void; + argNames: ['Wb'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook }) => void): void; on( obj: Excel.Application, event: 'ProtectedViewWindowActivate' | 'ProtectedViewWindowDeactivate' | 'ProtectedViewWindowOpen' | 'ProtectedViewWindowResize', - argNames: ['Pvw'], handler: (this: Excel.Application, parameter: {readonly Pvw: Excel.ProtectedViewWindow}) => void): void; + argNames: ['Pvw'], handler: (this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow }) => void): void; on( obj: Excel.Application, event: 'ProtectedViewWindowBeforeClose', argNames: ['Pvw', 'Reason', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Pvw: Excel.ProtectedViewWindow, readonly Reason: Excel.XlProtectedViewCloseReason, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, readonly Reason: Excel.XlProtectedViewCloseReason, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'ProtectedViewWindowBeforeEdit', argNames: ['Pvw', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Pvw: Excel.ProtectedViewWindow, Cancel: boolean}) => void): void; - on(obj: Excel.Application, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Application, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; - on(obj: Excel.Application, event: 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Application, parameter: {readonly Sh: any}) => void): void; + this: Excel.Application, parameter: { readonly Pvw: Excel.ProtectedViewWindow, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Application, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; + on(obj: Excel.Application, event: 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Application, parameter: { readonly Sh: any }) => void): void; on( obj: Excel.Application, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.Range}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Range }) => void): void; on( obj: Excel.Application, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.Hyperlink}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.Hyperlink }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( this: Excel.Application, - parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean}) => void): void; + parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; on( obj: Excel.Application, event: 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Application, parameter: {readonly Sh: any, readonly Target: Excel.PivotTable}) => void): void; + this: Excel.Application, parameter: { readonly Sh: any, readonly Target: Excel.PivotTable }) => void): void; on( obj: Excel.Application, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wb', 'Wn'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Wn: Excel.Window}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Wn: Excel.Window }) => void): void; on( obj: Excel.Application, event: 'WorkbookAfterSave', argNames: ['Wb', 'Success'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Success: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Success: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookAfterXmlExport', argNames: ['Wb', 'Map', 'Url', 'Result'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; on( obj: Excel.Application, event: 'WorkbookAfterXmlImport', argNames: ['Wb', 'Map', 'IsRefresh', 'Result'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeClose' | 'WorkbookBeforePrint', argNames: ['Wb', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeSave', argNames: ['Wb', 'SaveAsUI', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly SaveAsUI: boolean, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SaveAsUI: boolean, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeXmlExport', argNames: ['Wb', 'Map', 'Url', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookBeforeXmlImport', argNames: ['Wb', 'Map', 'Url', 'IsRefresh', 'Cancel'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean}) => void): void; - on(obj: Excel.Application, event: 'WorkbookNewChart', argNames: ['Wb', 'Ch'], handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Ch: Excel.Chart}) => void): void; - on(obj: Excel.Application, event: 'WorkbookNewSheet', argNames: ['Wb', 'Sh'], handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Sh: any}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; + on(obj: Excel.Application, event: 'WorkbookNewChart', argNames: ['Wb', 'Ch'], handler: ( + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Ch: Excel.Chart }) => void): void; + on(obj: Excel.Application, event: 'WorkbookNewSheet', argNames: ['Wb', 'Sh'], handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Sh: any }) => void): void; on( obj: Excel.Application, event: 'WorkbookPivotTableCloseConnection' | 'WorkbookPivotTableOpenConnection', argNames: ['Wb', 'Target'], - handler: (this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Target: Excel.PivotTable}) => void): void; + handler: (this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Target: Excel.PivotTable }) => void): void; on( obj: Excel.Application, event: 'WorkbookRowsetComplete', argNames: ['Wb', 'Description', 'Sheet', 'Success'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly Description: string, readonly Sheet: string, readonly Success: boolean}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; on( obj: Excel.Application, event: 'WorkbookSync', argNames: ['Wb', 'SyncEventType'], handler: ( - this: Excel.Application, parameter: {readonly Wb: Excel.Workbook, readonly SyncEventType: Office.MsoSyncEventType}) => void): void; + this: Excel.Application, parameter: { readonly Wb: Excel.Workbook, readonly SyncEventType: Office.MsoSyncEventType }) => void): void; on( obj: Excel.Chart, event: 'BeforeDoubleClick', argNames: ['ElementID', 'Arg1', 'Arg2', 'Cancel'], handler: ( - this: Excel.Chart, parameter: {readonly ElementID: number, readonly Arg1: number, readonly Arg2: number, Cancel: boolean}) => void): void; - on(obj: Excel.Chart, event: 'BeforeRightClick', argNames: ['Cancel'], handler: (this: Excel.Chart, parameter: {Cancel: boolean}) => void): void; + this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number, Cancel: boolean }) => void): void; + on(obj: Excel.Chart, event: 'BeforeRightClick', argNames: ['Cancel'], handler: (this: Excel.Chart, parameter: { Cancel: boolean }) => void): void; on( obj: Excel.Chart, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Chart, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Chart, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Chart, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Chart, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Chart, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Chart, parameter: {pctinfo: number}) => void): void; + this: Excel.Chart, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Chart, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Chart, parameter: { pctinfo: number }) => void): void; on(obj: Excel.Chart, event: 'Invoke', argNames: Excel.EventHelperTypes.Chart_Invoke_ArgNames, handler: (this: Excel.Chart, parameter: Excel.EventHelperTypes.Chart_Invoke_Parameter) => void): void; on( obj: Excel.Chart, event: 'MouseDown' | 'MouseMove' | 'MouseUp', argNames: ['Button', 'Shift', 'x', 'y'], handler: ( - this: Excel.Chart, parameter: {readonly Button: number, readonly Shift: number, readonly x: number, readonly y: number}) => void): void; - on(obj: Excel.Chart, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Chart, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + this: Excel.Chart, parameter: { readonly Button: number, readonly Shift: number, readonly x: number, readonly y: number }) => void): void; + on(obj: Excel.Chart, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Chart, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on( obj: Excel.Chart, event: 'Select', argNames: ['ElementID', 'Arg1', 'Arg2'], handler: ( - this: Excel.Chart, parameter: {readonly ElementID: number, readonly Arg1: number, readonly Arg2: number}) => void): void; + this: Excel.Chart, parameter: { readonly ElementID: number, readonly Arg1: number, readonly Arg2: number }) => void): void; on( obj: Excel.Chart, event: 'SeriesChange', argNames: ['SeriesIndex', 'PointIndex'], handler: ( - this: Excel.Chart, parameter: {readonly SeriesIndex: number, readonly PointIndex: number}) => void): void; + this: Excel.Chart, parameter: { readonly SeriesIndex: number, readonly PointIndex: number }) => void): void; on( obj: Excel.OLEObject, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.OLEObject, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.OLEObject, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.OLEObject, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.OLEObject, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.OLEObject, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.OLEObject, parameter: {pctinfo: number}) => void): void; + this: Excel.OLEObject, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.OLEObject, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.OLEObject, parameter: { pctinfo: number }) => void): void; on( obj: Excel.OLEObject, event: 'Invoke', argNames: Excel.EventHelperTypes.OLEObject_Invoke_ArgNames, handler: ( this: Excel.OLEObject, parameter: Excel.EventHelperTypes.OLEObject_Invoke_Parameter) => void): void; - on(obj: Excel.OLEObject, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.OLEObject, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; - on(obj: Excel.QueryTable, event: 'AfterRefresh', argNames: ['Success'], handler: (this: Excel.QueryTable, parameter: {readonly Success: boolean}) => void): void; - on(obj: Excel.QueryTable, event: 'BeforeRefresh', argNames: ['Cancel'], handler: (this: Excel.QueryTable, parameter: {Cancel: boolean}) => void): void; + on(obj: Excel.OLEObject, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.OLEObject, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; + on(obj: Excel.QueryTable, event: 'AfterRefresh', argNames: ['Success'], handler: (this: Excel.QueryTable, parameter: { readonly Success: boolean }) => void): void; + on(obj: Excel.QueryTable, event: 'BeforeRefresh', argNames: ['Cancel'], handler: (this: Excel.QueryTable, parameter: { Cancel: boolean }) => void): void; on( obj: Excel.QueryTable, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.QueryTable, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.QueryTable, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.QueryTable, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.QueryTable, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.QueryTable, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.QueryTable, parameter: {pctinfo: number}) => void): void; + this: Excel.QueryTable, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.QueryTable, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.QueryTable, parameter: { pctinfo: number }) => void): void; on( obj: Excel.QueryTable, event: 'Invoke', argNames: Excel.EventHelperTypes.QueryTable_Invoke_ArgNames, handler: ( this: Excel.QueryTable, parameter: Excel.EventHelperTypes.QueryTable_Invoke_Parameter) => void): void; - on(obj: Excel.QueryTable, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.QueryTable, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; - on(obj: Excel.Workbook, event: 'AfterSave', argNames: ['Success'], handler: (this: Excel.Workbook, parameter: {readonly Success: boolean}) => void): void; + on(obj: Excel.QueryTable, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.QueryTable, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; + on(obj: Excel.Workbook, event: 'AfterSave', argNames: ['Success'], handler: (this: Excel.Workbook, parameter: { readonly Success: boolean }) => void): void; on( obj: Excel.Workbook, event: 'AfterXmlExport', argNames: ['Map', 'Url', 'Result'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly Result: Excel.XlXmlExportResult }) => void): void; on( obj: Excel.Workbook, event: 'AfterXmlImport', argNames: ['Map', 'IsRefresh', 'Result'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult}) => void): void; - on(obj: Excel.Workbook, event: 'BeforeClose' | 'BeforePrint', argNames: ['Cancel'], handler: (this: Excel.Workbook, parameter: {Cancel: boolean}) => void): void; - on(obj: Excel.Workbook, event: 'BeforeSave', argNames: ['SaveAsUI', 'Cancel'], handler: (this: Excel.Workbook, parameter: {readonly SaveAsUI: boolean, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly IsRefresh: boolean, readonly Result: Excel.XlXmlImportResult }) => void): void; + on(obj: Excel.Workbook, event: 'BeforeClose' | 'BeforePrint', argNames: ['Cancel'], handler: (this: Excel.Workbook, parameter: { Cancel: boolean }) => void): void; + on(obj: Excel.Workbook, event: 'BeforeSave', argNames: ['SaveAsUI', 'Cancel'], handler: (this: Excel.Workbook, parameter: { readonly SaveAsUI: boolean, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'BeforeXmlExport', argNames: ['Map', 'Url', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'BeforeXmlImport', argNames: ['Map', 'Url', 'IsRefresh', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: {readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Map: Excel.XmlMap, readonly Url: string, readonly IsRefresh: boolean, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Workbook, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Workbook, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Workbook, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Workbook, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Workbook, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Workbook, parameter: {pctinfo: number}) => void): void; + this: Excel.Workbook, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Workbook, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Workbook, parameter: { pctinfo: number }) => void): void; on( obj: Excel.Workbook, event: 'Invoke', argNames: Excel.EventHelperTypes.Workbook_Invoke_ArgNames, handler: ( this: Excel.Workbook, parameter: Excel.EventHelperTypes.Workbook_Invoke_Parameter) => void): void; - on(obj: Excel.Workbook, event: 'NewChart', argNames: ['Ch'], handler: (this: Excel.Workbook, parameter: {readonly Ch: Excel.Chart}) => void): void; - on(obj: Excel.Workbook, event: 'NewSheet' | 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: (this: Excel.Workbook, parameter: {readonly Sh: any}) => void): void; + on(obj: Excel.Workbook, event: 'NewChart', argNames: ['Ch'], handler: (this: Excel.Workbook, parameter: { readonly Ch: Excel.Chart }) => void): void; + on(obj: Excel.Workbook, event: 'NewSheet' | 'SheetActivate' | 'SheetCalculate' | 'SheetDeactivate', argNames: ['Sh'], handler: ( + this: Excel.Workbook, parameter: { readonly Sh: any }) => void): void; on( obj: Excel.Workbook, event: 'PivotTableCloseConnection' | 'PivotTableOpenConnection', argNames: ['Target'], handler: ( - this: Excel.Workbook, parameter: {readonly Target: Excel.PivotTable}) => void): void; - on(obj: Excel.Workbook, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Workbook, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + this: Excel.Workbook, parameter: { readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Workbook, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Workbook, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on( obj: Excel.Workbook, event: 'RowsetComplete', argNames: ['Description', 'Sheet', 'Success'], handler: ( - this: Excel.Workbook, parameter: {readonly Description: string, readonly Sheet: string, readonly Success: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Description: string, readonly Sheet: string, readonly Success: boolean }) => void): void; on( obj: Excel.Workbook, event: 'SheetBeforeDoubleClick' | 'SheetBeforeRightClick', argNames: ['Sh', 'Target', 'Cancel'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Range, Cancel: boolean }) => void): void; on( obj: Excel.Workbook, event: 'SheetChange' | 'SheetSelectionChange', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.Range}) => void): void; - on(obj: Excel.Workbook, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: (this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.Hyperlink}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Range }) => void): void; + on(obj: Excel.Workbook, event: 'SheetFollowHyperlink', argNames: ['Sh', 'Target'], handler: ( + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.Hyperlink }) => void): void; on( obj: Excel.Workbook, event: 'SheetPivotTableAfterValueChange', argNames: ['Sh', 'TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; on( obj: Excel.Workbook, event: 'SheetPivotTableBeforeAllocateChanges' | 'SheetPivotTableBeforeCommitChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( this: Excel.Workbook, - parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean}) => void): void; + parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; on( - obj: Excel.Workbook, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], - handler: (this: Excel.Workbook, parameter: {readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number}) => void): void; + obj: Excel.Workbook, event: 'SheetPivotTableBeforeDiscardChanges', argNames: ['Sh', 'TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], handler: ( + this: Excel.Workbook, parameter: { readonly Sh: any, readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; on( obj: Excel.Workbook, event: 'SheetPivotTableChangeSync' | 'SheetPivotTableUpdate', argNames: ['Sh', 'Target'], handler: ( - this: Excel.Workbook, parameter: {readonly Sh: any, readonly Target: Excel.PivotTable}) => void): void; - on(obj: Excel.Workbook, event: 'Sync', argNames: ['SyncEventType'], handler: (this: Excel.Workbook, parameter: {readonly SyncEventType: Office.MsoSyncEventType}) => void): void; - on(obj: Excel.Workbook, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wn'], handler: (this: Excel.Workbook, parameter: {readonly Wn: Excel.Window}) => void): void; + this: Excel.Workbook, parameter: { readonly Sh: any, readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Workbook, event: 'Sync', argNames: ['SyncEventType'], handler: (this: Excel.Workbook, parameter: { readonly SyncEventType: Office.MsoSyncEventType }) => void): void; + on(obj: Excel.Workbook, event: 'WindowActivate' | 'WindowDeactivate' | 'WindowResize', argNames: ['Wn'], handler: (this: Excel.Workbook, parameter: { readonly Wn: Excel.Window }) => void): void; on( obj: Excel.Worksheet, event: 'BeforeDoubleClick' | 'BeforeRightClick', argNames: ['Target', 'Cancel'], handler: ( - this: Excel.Worksheet, parameter: {readonly Target: Excel.Range, Cancel: boolean}) => void): void; - on(obj: Excel.Worksheet, event: 'Change' | 'SelectionChange', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: {readonly Target: Excel.Range}) => void): void; - on(obj: Excel.Worksheet, event: 'FollowHyperlink', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: {readonly Target: Excel.Hyperlink}) => void): void; + this: Excel.Worksheet, parameter: { readonly Target: Excel.Range, Cancel: boolean }) => void): void; + on(obj: Excel.Worksheet, event: 'Change' | 'SelectionChange', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.Range }) => void): void; + on(obj: Excel.Worksheet, event: 'FollowHyperlink', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: { readonly Target: Excel.Hyperlink }) => void): void; on( obj: Excel.Worksheet, event: 'GetIDsOfNames', argNames: ['riid', 'rgszNames', 'cNames', 'lcid', 'rgdispid'], handler: ( - this: Excel.Worksheet, parameter: {readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number}) => void): void; + this: Excel.Worksheet, parameter: { readonly riid: stdole.GUID, readonly rgszNames: number, readonly cNames: number, readonly lcid: number, rgdispid: number }) => void): void; on( obj: Excel.Worksheet, event: 'GetTypeInfo', argNames: ['itinfo', 'lcid', 'pptinfo'], handler: ( - this: Excel.Worksheet, parameter: {readonly itinfo: number, readonly lcid: number, pptinfo: undefined}) => void): void; - on(obj: Excel.Worksheet, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Worksheet, parameter: {pctinfo: number}) => void): void; + this: Excel.Worksheet, parameter: { readonly itinfo: number, readonly lcid: number, pptinfo: undefined }) => void): void; + on(obj: Excel.Worksheet, event: 'GetTypeInfoCount', argNames: ['pctinfo'], handler: (this: Excel.Worksheet, parameter: { pctinfo: number }) => void): void; on( obj: Excel.Worksheet, event: 'Invoke', argNames: Excel.EventHelperTypes.Worksheet_Invoke_ArgNames, handler: ( this: Excel.Worksheet, parameter: Excel.EventHelperTypes.Worksheet_Invoke_Parameter) => void): void; on( obj: Excel.Worksheet, event: 'PivotTableAfterValueChange', argNames: ['TargetPivotTable', 'TargetRange'], handler: ( - this: Excel.Worksheet, parameter: {readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range}) => void): void; + this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly TargetRange: Excel.Range }) => void): void; on( obj: Excel.Worksheet, event: 'PivotTableBeforeAllocateChanges' | 'PivotTableBeforeCommitChanges', argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd', 'Cancel'], handler: ( - this: Excel.Worksheet, parameter: {readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean}) => void): void; + this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number, Cancel: boolean }) => void): void; on( obj: Excel.Worksheet, event: 'PivotTableBeforeDiscardChanges', argNames: ['TargetPivotTable', 'ValueChangeStart', 'ValueChangeEnd'], - handler: (this: Excel.Worksheet, parameter: {readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number}) => void): void; - on(obj: Excel.Worksheet, event: 'PivotTableChangeSync' | 'PivotTableUpdate', argNames: ['Target'], handler: (this: Excel.Worksheet, parameter: {readonly Target: Excel.PivotTable}) => void): void; - on(obj: Excel.Worksheet, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Worksheet, parameter: {readonly riid: stdole.GUID, ppvObj: undefined}) => void): void; + handler: (this: Excel.Worksheet, parameter: { readonly TargetPivotTable: Excel.PivotTable, readonly ValueChangeStart: number, readonly ValueChangeEnd: number }) => void): void; + on(obj: Excel.Worksheet, event: 'PivotTableChangeSync' | 'PivotTableUpdate', argNames: ['Target'], handler: ( + this: Excel.Worksheet, parameter: { readonly Target: Excel.PivotTable }) => void): void; + on(obj: Excel.Worksheet, event: 'QueryInterface', argNames: ['riid', 'ppvObj'], handler: (this: Excel.Worksheet, parameter: { readonly riid: stdole.GUID, ppvObj: undefined }) => void): void; on(obj: Excel.Application, event: 'AddRef' | 'AfterCalculate' | 'Release', handler: (this: Excel.Application, parameter: {}) => void): void; on(obj: Excel.Chart, event: 'Activate' | 'AddRef' | 'Calculate' | 'Deactivate' | 'DragOver' | 'DragPlot' | 'Release' | 'Resize', handler: (this: Excel.Chart, parameter: {}) => void): void; on(obj: Excel.OLEObject, event: 'AddRef' | 'GotFocus' | 'LostFocus' | 'Release', handler: (this: Excel.OLEObject, parameter: {}) => void): void; @@ -9464,7 +9723,7 @@ interface ActiveXObject { set(obj: Excel.Workbook, propertyName: 'Colors', parameterTypes: [any], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', parameterTypes: [Excel.XlRangeValueDataType], newValue: any): void; set(obj: Excel.Range, propertyName: 'Value', newValue: any): void; // because Value is defined on the type as a method, not a property - new(progid: K): ActiveXObjectNameMap[K]; + new (progid: K): ActiveXObjectNameMap[K]; } interface ActiveXObjectNameMap { @@ -9474,26 +9733,8 @@ interface ActiveXObjectNameMap { } interface EnumeratorConstructor { - new(col: Excel.Actions): Enumerator; - new(col: Excel.AddIns | Excel.AddIns2): Enumerator; - new(col: Excel.AllowEditRanges): Enumerator; - new(col: Excel.Areas | Excel.Ranges): Enumerator; - new(col: Excel.Borders): Enumerator; - new(col: Excel.CalculatedFields): Enumerator; - new(col: Excel.CalculatedItems | Excel.PivotItemList): Enumerator; - new(col: Excel.CalculatedMembers): Enumerator; - new(col: Excel.Comments): Enumerator; - new(col: Excel.Connections): Enumerator; - new(col: Excel.CubeFields): Enumerator; - new(col: Excel.CustomProperties): Enumerator; - new(col: Excel.CustomViews): Enumerator; - new(col: Excel.DiagramNodeChildren | Excel.DiagramNodes): Enumerator; - new(col: Excel.Dialogs): Enumerator; - new(col: Excel.FileExportConverters): Enumerator; - new(col: Excel.Filters): Enumerator; - new( - col: Excel.FormatConditions | Excel.IconSets | Excel.MenuItems | Excel.Modules | Excel.Phonetics | Excel.PivotFields | Excel.Range | Excel.ServerViewableItems | - Excel.SheetViews | Excel.UsedObjects): Enumerator; // tslint:disable-line:use-default-type-parameter + new(col: Excel.Range): Enumerator; + new(col: Excel.GroupShapes | Excel.ShapeRange | Excel.Shapes): Enumerator; new(col: Excel.HPageBreaks): Enumerator; new(col: Excel.Hyperlinks): Enumerator; @@ -9544,7 +9785,3 @@ interface EnumeratorConstructor { new(col: Excel.XmlNamespaces): Enumerator; new(col: Excel.XmlSchemas): Enumerator; } - -interface SafeArray { - _brand: SafeArray; -} diff --git a/types/activex-excel/tslint.json b/types/activex-excel/tslint.json index 3224b40b8b..f93cf8562a 100644 --- a/types/activex-excel/tslint.json +++ b/types/activex-excel/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-const-enum": false - } + "extends": "dtslint/dt.json" } diff --git a/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts index 9ae8c7641d..ef3e403998 100644 --- a/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts +++ b/types/activex-faxcomexlib/activex-faxcomexlib-tests.ts @@ -27,7 +27,7 @@ const getServer = () => { return server; }; -(() => { +{ // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693376(v=vs.85).aspx const server = new ActiveXObject('FaxComEx.FaxServer'); const document = new ActiveXObject('FaxComEx.FaxDocument'); @@ -35,10 +35,10 @@ const getServer = () => { // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692919(v=vs.85).aspx server.Connect(''); server.Connect('computername'); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx -(() => { +{ const getInitializedDevice = () => { const ret = getServer().GetDevices().ItemById(1); ret.ReceiveMode = FAXCOMEXLib.FAX_DEVICE_RECEIVE_MODE_ENUM.fdrmAUTO_ANSWER; @@ -54,17 +54,17 @@ const getServer = () => { // abandoning changes to configuration, using the Refresh method device = getInitializedDevice(); device.Refresh(); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693502(v=vs.85).aspx -(() => { +{ const incomingJob = getServer().Folders.IncomingQueue.GetJobs().Item(1); incomingJob.Refresh(); const currentPage = incomingJob.CurrentPage; -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692922(v=vs.85).aspx -(() => { +{ const server = getServer(); WScript.Echo(`Server information: @@ -72,10 +72,10 @@ API Version: ${server.APIVersion} Debug: ${server.Debug} Build and version: ${server.MajorBuild}.${server.MinorBuild}.${server.MajorVersion}.${server.MinorVersion} Server name: ${server.ServerName}`); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693455(v=vs.85).aspx -(() => { +{ const activity = getServer().Activity; activity.Refresh(); @@ -84,10 +84,10 @@ ${activity.IncomingMessages} incoming messages ${activity.OutgoingMessages} outgoing messages ${activity.RoutingMessages} routing messages ${activity.QueuedMessages} queued messages`); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693400(v=vs.85).aspx -(() => { +{ const device = getServer().GetDevices().Item(1); device.CSID = 'Accounts payable'; device.Description = 'Primary fax device'; @@ -96,10 +96,10 @@ ${activity.QueuedMessages} queued messages`); device.SendEnabled = true; device.TSID = 'Accounts payable'; device.Save(); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692985(v=vs.85).aspx -(() => { +{ const devices = getServer().GetDevices(); WScript.Echo(`This server has ${devices.Count} fax devices`); for (let i = 1; i <= devices.Count; i++) { @@ -124,10 +124,10 @@ Sending now: ${device.SendingNow}`); device.UseRoutingMethod(routingMethods[0], false); device.Save(); }); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693486(v=vs.85).aspx -(() => { +{ const outputRuleInfo = (rule: FAXCOMEXLib.FaxOutboundRoutingRule, index?: number) => { WScript.Echo(` Outbound routing rule number: ${index || 'unknown'} @@ -193,13 +193,11 @@ Input 1, 2, 3, 4, or 0 to exit areaCode = parseInt(VB.InputBox('Enter the area code'), 10); rule = outboundRoutingRules.Add(countryCode, areaCode, true, '', id); break; - default: - return; } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693408(v=vs.85).aspx -(() => { +{ const server = getServer(); const outboundRouting = server.OutboundRouting; const outboundRoutingGroups = outboundRouting.GetGroups(); @@ -233,13 +231,14 @@ Device status: ${routingGroup.Status} }); // allow user to remove a routing group - if (VB.InputBox('Do you want to remove a routing group (Y/N)?') === 'N') { return; } - const itemNumber = VB.InputBox('Enter the item number for the group you want to remove'); - outboundRoutingGroups.Remove(itemNumber); -})(); + if (VB.InputBox('Do you want to remove a routing group (Y/N)?') === 'Y') { + const itemNumber = VB.InputBox('Enter the item number for the group you want to remove'); + outboundRoutingGroups.Remove(itemNumber); + } +} // https://msdn.microsoft.com/en-us/library/windows/desktop/aa964960(v=vs.85).aspx -(() => { +{ const accountSet = getServer().FaxAccountSet; const accounts = collectionToArray(accountSet.GetAccounts()); WScript.Echo(`Number of accounts: ${accounts.length}`); @@ -248,10 +247,10 @@ Device status: ${routingGroup.Status} const accountName = VB.InputBox('Enter an account name'); accountSet.AddAccount(accountName); accountSet.RemoveAccount(accountName); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692952(v=vs.85).aspx -(() => { +{ const incomingJobs = collectionToArray(getServer().Folders.IncomingQueue.GetJobs()); WScript.Echo(`There are ${incomingJobs.length} jobs in the incoming queue.`); const n = parseInt(VB.InputBox('Input the number of a job for which you want information'), 10); @@ -284,10 +283,10 @@ TSID: ${job.TSID} job.CopyTiff(fileName); new ActiveXObject('WScript.Shell').Run(fileName); } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692914(v=vs.85).aspx -(() => { +{ const server = new ActiveXObject('FaxComEx.FaxServer'); server.Connect(''); const outgoingQueue = server.Folders.OutgoingQueue; @@ -300,10 +299,10 @@ TSID: ${job.TSID} outgoingQueue.DiscountRateStart = new Date(0, 0, 0, 1).getVarDate(); outgoingQueue.UseDeviceTSID = true; outgoingQueue.Save(); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693393(v=vs.85).aspx -(() => { +{ const outgoingQueue = getServer().Folders.OutgoingQueue; outgoingQueue.Refresh(); WScript.Echo(`There are ${outgoingQueue.GetJobs().Count} faxes in the outgoing queue`); @@ -357,10 +356,10 @@ the job? job.Resume(); break; } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692936(v=vs.85).aspx -(() => { +{ const document = new ActiveXObject('FaxComEx.FaxDocument'); document.Body = 'C:\\docs\\body.txt'; document.DocumentName = 'My First Fax'; @@ -401,10 +400,10 @@ the job? WScript.Echo(`The job ID is ${jobID}`); server.Disconnect(); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693479(v=vs.85).aspx -(() => { +{ const document = new ActiveXObject('FaxComEx.FaxDocument'); document.Body = 'C:\\docs\\body.txt'; document.DocumentName = 'My First Fax'; @@ -428,10 +427,10 @@ the job? while (recipients.Count > 0) { recipients.Remove(1); } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/aa964962(v=vs.85).aspx -(() => { +{ const server = getServer(); const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10); server.CurrentAccount.Folders.IncomingArchive.Refresh(); @@ -442,7 +441,7 @@ the job? const message = messageIterator.Message as FAXCOMEXLib.FaxIncomingMessage; if (messageIterator.AtEOF) { WScript.Echo(`End of file reached`); - return; + break; } if (!message.WasReAssigned) { if (VB.InputBox('Message not reassigned. Reassign (Y/N)?') === 'Y') { @@ -455,10 +454,10 @@ the job? } messageIterator.MoveNext(); } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693402(v=vs.85).aspx -(() => { +{ const server = getServer(); const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10); server.Folders.OutgoingArchive.Refresh(); @@ -468,7 +467,7 @@ the job? if (i > 1 && VB.InputBox('View next message? (Y/N)') !== 'Y') { break; } if (messageIterator.AtEOF) { WScript.Echo(`End of file reached`); - return; + break; } const message = messageIterator.Message as FAXCOMEXLib.FaxOutgoingMessage; @@ -498,10 +497,10 @@ TSID: ${message.TSID}`); message.Delete(); } } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693472(v=vs.85).aspx -(() => { +{ const server = getServer(); const outgoingArchive = server.Folders.OutgoingArchive; WScript.Echo(` @@ -526,12 +525,11 @@ Is archive used? ${outgoingArchive.UseArchive}`.trim() outgoingArchive.GetMessage(messageID).CopyTiff(fileName); new ActiveXObject('WScript.Shell').Run(fileName); } -})(); +} -(() => { +{ const server = getServer(); const messageIterator = server.Folders.OutgoingArchive.GetMessages(); - if (messageIterator.AtEOF) { return; } messageIterator.MoveFirst(); while (!messageIterator.AtEOF) { const message = messageIterator.Message; @@ -543,10 +541,10 @@ Transmission start: ${new Date(message.TransmissionStart)} `.trim()); messageIterator.MoveNext(); } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms692976(v=vs.85).aspx -(() => { +{ const server = getServer(); const prefetchCount = parseInt(VB.InputBox('How many messages should be prefetched?'), 10); server.Folders.IncomingArchive.Refresh(); @@ -557,7 +555,7 @@ Transmission start: ${new Date(message.TransmissionStart)} const message = messageIterator.Message as FAXCOMEXLib.FaxIncomingMessage; if (messageIterator.AtEOF) { WScript.Echo(`End of file reached`); - return; + break; } const fileName = VB.InputBox('Enter path to save TIFF file'); message.CopyTiff(fileName); @@ -565,10 +563,10 @@ Transmission start: ${new Date(message.TransmissionStart)} messageIterator.MoveNext(); } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693406(v=vs.85).aspx -(() => { +{ const server = getServer(); const incomingArchive = server.Folders.IncomingArchive; incomingArchive.Refresh(); @@ -587,9 +585,9 @@ Is archive used? ${incomingArchive.UseArchive} incomingArchive.Save(); const messageID = VB.InputBox('Message ID to retrieve information? (Leave empty, or Cancel, to exit)'); - if (messageID === '') { return; } - const message = incomingArchive.GetMessage(messageID); - WScript.Echo(` + if (messageID !== '') { + const message = incomingArchive.GetMessage(messageID); + WScript.Echo(` Caller ID: ${message.CallerId} CSID: ${message.CSID} Device name: ${message.DeviceName} @@ -603,13 +601,14 @@ Transmission end: ${new Date(message.TransmissionEnd)} TSID: ${message.TSID} `.trim()); - if (VB.InputBox('Delete this message from the archive (Y/N)?') === 'Y') { - message.Delete(); + if (VB.InputBox('Delete this message from the archive (Y/N)?') === 'Y') { + message.Delete(); + } } -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693401(v=vs.85).aspx -(() => { +{ const server = getServer(); const loggingOptions = server.LoggingOptions; const activityLogging = loggingOptions.ActivityLogging; @@ -626,10 +625,10 @@ TSID: ${message.TSID} eventLogging.InitEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllMAX; eventLogging.OutboundEventsLevel = FAXCOMEXLib.FAX_LOG_LEVEL_ENUM.fllNONE; eventLogging.Save(); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693387(v=vs.85).aspx -(() => { +{ const server = getServer(); const receiptOptions = server.ReceiptOptions; receiptOptions.Refresh(); @@ -649,10 +648,10 @@ Use for inbound routing? ${receiptOptions.UseForInboundRouting} receiptOptions.SMTPServer = 'My SMTP Server'; receiptOptions.UseForInboundRouting = true; receiptOptions.Save(); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693462(v=vs.85).aspx -(() => { +{ const server = getServer(); collectionToArray(server.GetDeviceProviders()).forEach((provider, index) => { WScript.Echo(` @@ -668,29 +667,29 @@ Unique name: ${provider.UniqueName} new VBArray(provider.DeviceIds).toArray().forEach(id => WScript.Echo(id)); }); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693437(v=vs.85).aspx -- for a fax device -(() => { +{ const server = getServer(); const device = server.GetDevices().Item(1); const deviceProperty = toSafeArray(1, 2, 3); const propertyName = '{B1F944B9-9A16-45d1-933A-4060A4871AB0}'; device.SetExtensionProperty(propertyName, deviceProperty); new VBArray(device.GetExtensionProperty(propertyName)).toArray().forEach(x => WScript.Echo(x)); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693437(v=vs.85).aspx -- for a fax device -(() => { +{ const server = getServer(); const serverProperty = toSafeArray(4, 2, 3); const propertyName = `{AC7D0DEE-B6E5-4a44-AF45-835C58CB44D2}`; server.SetExtensionProperty(propertyName, serverProperty); new VBArray(server.GetExtensionProperty(propertyName)).toArray().forEach(x => WScript.Echo(x)); -})(); +} // https://msdn.microsoft.com/en-us/library/windows/desktop/ms693013(v=vs.85).aspx -(() => { +{ const server = getServer(); ActiveXObject.on(server, 'OnOutgoingJobAdded', ['pFaxServer', 'bstrJobId'], prm => WScript.Echo('New job added to queue')); @@ -727,4 +726,4 @@ TSID: ${status.TSID} FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetFXSSVC_ENDED + FAXCOMEXLib.FAX_SERVER_EVENTS_TYPE_ENUM.fsetOUT_QUEUE ); -})(); +} diff --git a/types/activex-faxcomexlib/index.d.ts b/types/activex-faxcomexlib/index.d.ts index 237c841fda..d4078061f7 100644 --- a/types/activex-faxcomexlib/index.d.ts +++ b/types/activex-faxcomexlib/index.d.ts @@ -7,7 +7,7 @@ /// declare namespace FAXCOMEXLib { - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_ACCESS_RIGHTS_ENUM { farMANAGE_CONFIG = 64, farMANAGE_IN_ARCHIVE = 256, @@ -22,7 +22,7 @@ declare namespace FAXCOMEXLib { farSUBMIT_NORMAL = 2, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_ACCESS_RIGHTS_ENUM_2 { far2MANAGE_ARCHIVES = 256, far2MANAGE_CONFIG = 64, @@ -36,7 +36,7 @@ declare namespace FAXCOMEXLib { far2SUBMIT_NORMAL = 2, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_ACCOUNT_EVENTS_TYPE_ENUM { faetFXSSVC_ENDED = 16, faetIN_ARCHIVE = 4, @@ -46,21 +46,21 @@ declare namespace FAXCOMEXLib { faetOUT_QUEUE = 2, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_COVERPAGE_TYPE_ENUM { fcptLOCAL = 1, fcptNONE = 0, fcptSERVER = 2, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_DEVICE_RECEIVE_MODE_ENUM { fdrmAUTO_ANSWER = 1, fdrmMANUAL_ANSWER = 2, fdrmNO_ANSWER = 0, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_GROUP_STATUS_ENUM { fgsALL_DEV_NOT_VALID = 2, fgsALL_DEV_VALID = 0, @@ -68,7 +68,7 @@ declare namespace FAXCOMEXLib { fgsSOME_DEV_NOT_VALID = 3, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_JOB_EXTENDED_STATUS_ENUM { fjesANSWERED = 5, fjesBAD_ADDRESS = 10, @@ -93,7 +93,7 @@ declare namespace FAXCOMEXLib { fjesTRANSMITTING = 4, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_JOB_OPERATIONS_ENUM { fjoDELETE = 16, fjoPAUSE = 2, @@ -104,7 +104,7 @@ declare namespace FAXCOMEXLib { fjoVIEW = 1, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_JOB_STATUS_ENUM { fjsCANCELED = 512, fjsCANCELING = 1024, @@ -119,14 +119,14 @@ declare namespace FAXCOMEXLib { fjsROUTING = 2048, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_JOB_TYPE_ENUM { fjtRECEIVE = 1, fjtROUTING = 2, fjtSEND = 0, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_LOG_LEVEL_ENUM { fllMAX = 3, fllMED = 2, @@ -134,14 +134,14 @@ declare namespace FAXCOMEXLib { fllNONE = 0, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_PRIORITY_TYPE_ENUM { fptHIGH = 2, fptLOW = 0, fptNORMAL = 1, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_PROVIDER_STATUS_ENUM { fpsBAD_GUID = 2, fpsBAD_VERSION = 3, @@ -152,19 +152,19 @@ declare namespace FAXCOMEXLib { fpsSUCCESS = 0, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_RECEIPT_TYPE_ENUM { frtMAIL = 1, frtMSGBOX = 4, frtNONE = 0, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_ROUTING_RULE_CODE_ENUM { frrcANY_CODE = 0, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_RULE_STATUS_ENUM { frsALL_GROUP_DEV_NOT_VALID = 2, frsBAD_DEVICE = 4, @@ -173,14 +173,14 @@ declare namespace FAXCOMEXLib { frsVALID = 0, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_SCHEDULE_TYPE_ENUM { fstDISCOUNT_PERIOD = 2, fstNOW = 0, fstSPECIFIC_TIME = 1, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_SERVER_APIVERSION_ENUM { fsAPI_VERSION_0 = 0, fsAPI_VERSION_1 = 65536, @@ -188,7 +188,7 @@ declare namespace FAXCOMEXLib { fsAPI_VERSION_3 = 196608, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_SERVER_EVENTS_TYPE_ENUM { fsetACTIVITY = 8, fsetCONFIG = 4, @@ -203,14 +203,14 @@ declare namespace FAXCOMEXLib { fsetQUEUE_STATE = 16, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FAX_SMTP_AUTHENTICATION_TYPE_ENUM { fsatANONYMOUS = 0, fsatBASIC = 1, fsatNTLM = 2, } - // tslint:disable-next-line no-const-enum + // tslint:disable-next-line:no-const-enum const enum FaxConstants { bstrGROUPNAME_ALLDEVICES = '', lDEFAULT_PREFETCH_SIZE = 100, @@ -326,11 +326,10 @@ declare namespace FAXCOMEXLib { } /** FaxAccounts Class */ - class FaxAccounts { - private 'FAXCOMEXLib.FaxAccounts_typekey': FaxAccounts; - private constructor(); + interface FaxAccounts { readonly Count: number; Item(vIndex: any): FaxAccount; + (vIndex: any): FaxAccount; } /** FaxAccountSet Class */ @@ -535,10 +534,7 @@ declare namespace FAXCOMEXLib { } /** FaxDeviceIds Class */ - class FaxDeviceIds { - private 'FAXCOMEXLib.FaxDeviceIds_typekey': FaxDeviceIds; - private constructor(); - + interface FaxDeviceIds { /** Add a device */ Add(lDeviceId: number): void; readonly Count: number; @@ -549,6 +545,7 @@ declare namespace FAXCOMEXLib { /** Set order of the device */ SetOrder(lDeviceId: number, lNewOrder: number): void; + (lIndex: number): number; } /** FaxDeviceProvider Class */ @@ -594,22 +591,20 @@ declare namespace FAXCOMEXLib { } /** FaxDeviceProviders Class */ - class FaxDeviceProviders { - private 'FAXCOMEXLib.FaxDeviceProviders_typekey': FaxDeviceProviders; - private constructor(); + interface FaxDeviceProviders { readonly Count: number; Item(vIndex: any): FaxDeviceProvider; + (vIndex: any): FaxDeviceProvider; } /** FaxDevices Class */ - class FaxDevices { - private 'FAXCOMEXLib.FaxDevices_typekey': FaxDevices; - private constructor(); + interface FaxDevices { readonly Count: number; Item(vIndex: any): FaxDevice; /** Get device by its ID */ ItemById(lId: number): FaxDevice; + (vIndex: any): FaxDevice; } /** FaxDocument Class */ @@ -630,10 +625,10 @@ declare namespace FAXCOMEXLib { CallHandle: number; /** Submit the fax document on the already connected server */ - ConnectedSubmit(pFaxServer: IFaxServer): any; + ConnectedSubmit(pFaxServer: IFaxServer): SafeArray; /** Submit the fax document on the already connected server */ - ConnectedSubmit2(pFaxServer: IFaxServer, pvFaxOutgoingJobIDs: any): number; + ConnectedSubmit2(pFaxServer: IFaxServer, pvFaxOutgoingJobIDs: SafeArray): number; /** Cover page file path */ CoverPage: string; @@ -765,7 +760,7 @@ declare namespace FAXCOMEXLib { readonly MajorVersion: number; /** Array of methods exposed by extension */ - readonly Methods: any; + readonly Methods: SafeArray; /** The minor part of extension's build number */ readonly MinorBuild: number; @@ -781,11 +776,10 @@ declare namespace FAXCOMEXLib { } /** FaxInboundRoutingExtensions Class */ - class FaxInboundRoutingExtensions { - private 'FAXCOMEXLib.FaxInboundRoutingExtensions_typekey': FaxInboundRoutingExtensions; - private constructor(); + interface FaxInboundRoutingExtensions { readonly Count: number; Item(vIndex: any): FaxInboundRoutingExtension; + (vIndex: any): FaxInboundRoutingExtension; } /** FaxInboundRoutingMethod Class */ @@ -819,11 +813,10 @@ declare namespace FAXCOMEXLib { } /** FaxInboundRoutingMethods Class */ - class FaxInboundRoutingMethods { - private 'FAXCOMEXLib.FaxInboundRoutingMethods_typekey': FaxInboundRoutingMethods; - private constructor(); + interface FaxInboundRoutingMethods { readonly Count: number; Item(vIndex: any): FaxInboundRoutingMethod; + (vIndex: any): FaxInboundRoutingMethod; } /** FaxIncomingArchive Class */ @@ -935,11 +928,10 @@ declare namespace FAXCOMEXLib { } /** FaxIncomingJobs Class */ - class FaxIncomingJobs { - private 'FAXCOMEXLib.FaxIncomingJobs_typekey': FaxIncomingJobs; - private constructor(); + interface FaxIncomingJobs { readonly Count: number; Item(vIndex: any): FaxIncomingJob; + (vIndex: any): FaxIncomingJob; } /** FaxIncomingMessage Class */ @@ -1117,10 +1109,7 @@ declare namespace FAXCOMEXLib { } /** FaxOutboundRoutingGroups Class */ - class FaxOutboundRoutingGroups { - private 'FAXCOMEXLib.FaxOutboundRoutingGroups_typekey': FaxOutboundRoutingGroups; - private constructor(); - + interface FaxOutboundRoutingGroups { /** Add a group */ Add(bstrName: string): FaxOutboundRoutingGroup; readonly Count: number; @@ -1128,6 +1117,7 @@ declare namespace FAXCOMEXLib { /** Remove a group */ Remove(vIndex: number | string): void; + (vIndex: number | string): FaxOutboundRoutingGroup; } /** FaxOutboundRoutingRule Class */ @@ -1161,10 +1151,7 @@ declare namespace FAXCOMEXLib { } /** FaxOutboundRoutingRules Class */ - class FaxOutboundRoutingRules { - private 'FAXCOMEXLib.FaxOutboundRoutingRules_typekey': FaxOutboundRoutingRules; - private constructor(); - + interface FaxOutboundRoutingRules { /** Add a rule */ Add(lCountryCode: number, lAreaCode: number, bUseDevice: boolean, bstrGroupName: string, lDeviceId: number): FaxOutboundRoutingRule; readonly Count: number; @@ -1178,6 +1165,7 @@ declare namespace FAXCOMEXLib { /** Remove a rule by criteria */ RemoveByCountryAndArea(lCountryCode: number, lAreaCode: number): void; + (lIndex: number): FaxOutboundRoutingRule; } /** FaxOutgoingArchive Class */ @@ -1334,11 +1322,10 @@ declare namespace FAXCOMEXLib { } /** FaxOutgoingJobs Class */ - class FaxOutgoingJobs { - private 'FAXCOMEXLib.FaxOutgoingJobs_typekey': FaxOutgoingJobs; - private constructor(); + interface FaxOutgoingJobs { readonly Count: number; Item(vIndex: any): IFaxOutgoingJob; + (vIndex: any): IFaxOutgoingJob; } /** FaxOutgoingMessage Class */ @@ -1486,10 +1473,7 @@ declare namespace FAXCOMEXLib { } /** FaxRecipients Class */ - class FaxRecipients { - private 'FAXCOMEXLib.FaxRecipients_typekey': FaxRecipients; - private constructor(); - + interface FaxRecipients { /** * Add a recipient * @param string [bstrRecipientName=''] @@ -1500,6 +1484,7 @@ declare namespace FAXCOMEXLib { /** Remove a recipient */ Remove(lIndex: number): void; + (lIndex: number): FaxRecipient; } /** FaxSecurity Class */ @@ -2033,21 +2018,3 @@ interface ActiveXObjectNameMap { 'FaxComEx.FaxDocument': FAXCOMEXLib.FaxDocument; 'FaxComEx.FaxServer': FAXCOMEXLib.FaxServer; } - -interface EnumeratorConstructor { - new(col: FAXCOMEXLib.FaxAccounts): Enumerator; - new(col: FAXCOMEXLib.FaxDeviceIds): Enumerator; - new(col: FAXCOMEXLib.FaxDeviceProviders): Enumerator; - new(col: FAXCOMEXLib.FaxDevices): Enumerator; - new(col: FAXCOMEXLib.FaxInboundRoutingExtensions): Enumerator; - new(col: FAXCOMEXLib.FaxInboundRoutingMethods): Enumerator; - new(col: FAXCOMEXLib.FaxIncomingJobs): Enumerator; - new(col: FAXCOMEXLib.FaxOutboundRoutingGroups): Enumerator; - new(col: FAXCOMEXLib.FaxOutboundRoutingRules): Enumerator; - new(col: FAXCOMEXLib.FaxOutgoingJobs): Enumerator; - new(col: FAXCOMEXLib.FaxRecipients): Enumerator; -} - -interface SafeArray { - _brand: SafeArray; -} diff --git a/types/activex-faxcomexlib/tsconfig.json b/types/activex-faxcomexlib/tsconfig.json index 50b3ab1a0a..6509ab4701 100644 --- a/types/activex-faxcomexlib/tsconfig.json +++ b/types/activex-faxcomexlib/tsconfig.json @@ -1,8 +1,10 @@ - { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "scripthost"], + "lib": [ + "es5", + "scripthost" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts index f39627cc1a..14a90f9a8a 100644 --- a/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts +++ b/types/activex-iwshruntimelibrary/activex-iwshruntimelibrary-tests.ts @@ -4,11 +4,11 @@ const wshn = new ActiveXObject('WScript.Network'); // https://msdn.microsoft.com/en-us/library/wck0hkd7(v=vs.84).aspx // https://msdn.microsoft.com/en-us/library/tte130y1(v=vs.84).aspx // https://msdn.microsoft.com/en-us/library/3fxhka75(v=vs.84).aspx -(() => { +{ WScript.Echo('Domain = ' + wshn.UserDomain); WScript.Echo('Computer Name = ' + wshn.ComputerName); WScript.Echo('User Name = ' + wshn.UserName); -})(); +} // https://msdn.microsoft.com/en-us/library/zsdh7hkb(v=vs.84).aspx wshn.AddWindowsPrinterConnection('\\\\printserv\\DefaultPrinter'); @@ -18,7 +18,7 @@ wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); // https://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.84).aspx // https://msdn.microsoft.com/en-us/library/zhds6k80(v=vs.84).aspx -(() => { +{ const drives = wshn.EnumNetworkDrives(); const printers = wshn.EnumPrinterConnections(); WScript.Echo("Network drive mappings:"); @@ -30,7 +30,7 @@ wshn.AddPrinterConnection("LPT1", "\\\\Server\\Print1"); for (let i = 0; i < printers.length; i += 2) { WScript.Echo(`Port ${printers.Item(i)} = ${printers.Item(i + 1)}`); } -})(); +} // https://msdn.microsoft.com/en-us/library/8kst88h6(v=vs.84).aspx wshn.MapNetworkDrive('E:', '\\\\Server\\Public'); @@ -42,8 +42,8 @@ wshn.RemoveNetworkDrive('E:'); wshn.RemovePrinterConnection('\\\\PRN-CORP1\\B41-4523-A', true, true); // https://msdn.microsoft.com/en-us/library/2ccwwdct(v=vs.84).aspx -(() => { +{ const printerPath = "\\\\research\\library1"; wshn.AddWindowsPrinterConnection(printerPath); wshn.SetDefaultPrinter(printerPath); -})(); +} diff --git a/types/activex-iwshruntimelibrary/index.d.ts b/types/activex-iwshruntimelibrary/index.d.ts index c50c9670a2..d5b052eaae 100644 --- a/types/activex-iwshruntimelibrary/index.d.ts +++ b/types/activex-iwshruntimelibrary/index.d.ts @@ -5,6 +5,9 @@ // TypeScript Version: 2.6 declare namespace IWshRuntimeLibrary { + type WindowStyle = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10; + type ShortcutWindowStyle = 1 | 3 | 7; + // tslint:disable-next-line no-const-enum const enum ButtonType { OK, @@ -16,6 +19,16 @@ declare namespace IWshRuntimeLibrary { CancelTryagainContinue } + // tslint:disable-next-line no-const-enum + const enum EventType { + AuditFailure = 5, + AuditSuccess = 4, + Error = 1, + Information = 3, + Success = 0, + Warning = 2 + } + // tslint:disable-next-line no-const-enum const enum IconType { Stop = 16, @@ -85,22 +98,20 @@ declare namespace IWshRuntimeLibrary { } /** Generic Collection Object */ - class WshCollection { - private 'IWshRuntimeLibrary.WshCollection_typekey': WshCollection; - private constructor(); + interface WshCollection { Count(): number; Item(Index: any): any; readonly length: number; + (Index: any): any; } /** Environment Variables Collection Object */ - class WshEnvironment { - private 'IWshRuntimeLibrary.WshEnvironment_typekey': WshEnvironment; - private constructor(); + interface WshEnvironment { Count(): number; Item(Name: string): string; readonly length: number; Remove(Name: string): void; + (Name: string): string; } /** WSHExec object */ @@ -161,7 +172,7 @@ declare namespace IWshRuntimeLibrary { * @param Force [false] Remove the connections even if the resource is in use * @param UpdateProfile [false] Remove the mapping from the user's profile */ - RemoveNetworkDrive(Name: string, Force?: any, UpdateProfile?: any): void; + RemoveNetworkDrive(Name: string, Force?: boolean, UpdateProfile?: boolean): void; /** * Removes a shared network printer connection from your computer system @@ -173,7 +184,7 @@ declare namespace IWshRuntimeLibrary { * _Name_ must be the printer's local name. If the printer was connected using the **AddWindowsPrinterConnection** method or was added manually (using the Add Printer wizard), * then _Name_ must be the printer's UNC name. */ - RemovePrinterConnection(Name: string, Force?: any, UpdateProfile?: any): void; + RemovePrinterConnection(Name: string, Force?: true, UpdateProfile?: true): void; SetDefaultPrinter(Name: string): void; readonly Site: string; readonly UserDomain: string; @@ -185,21 +196,107 @@ declare namespace IWshRuntimeLibrary { class WshShell { private 'IWshRuntimeLibrary.WshShell_typekey': WshShell; private constructor(); - AppActivate(App: any, Wait?: any): boolean; - CreateShortcut(PathLink: string): any; + + /** + * Activates an application window + * @param App Title of application as it appears in the title bar, or the process ID + * @param Wait + * + * This method changes the focus to the named application or window. The window must be attached to the calling thread's message queue. It does not affect whether it is maximized or + * minimized. Focus moves from the activated application window when the user takes action to change the focus (or closes the window). + * + * In determining which application to activate, the specified title is compared to the title string of each running application. If no exact match exists, any application whose title + * string begins with title is activated. If an application still cannot be found, any application whose title string ends with title is activated. If more than one instance of the + * application named by title exists, one instance is arbitrarily activated. + * + * The method might return `false` under the following conditions: + * + * * The window is not brought to the foreground. + * * The window is brought to the foreground but is not given keyboard focus. + * * A Command Prompt window (`cmd.exe`) is brought to the foreground and is given keyboard focus. + */ + AppActivate(App: string | number, Wait?: any): boolean; + + /** + * Creates a shortcut + * @param PathLink Path where the shortcut should be created + * + * The shortcut object exists in memory until you save it to disk with the **Save** method. + */ + CreateShortcut(PathLink: string): WshShortcut | WshURLShortcut; CurrentDirectory: string; - Environment(Type?: any): WshEnvironment; + + /** + * Note that **Environment** doesn't actually return a callable object; the call is only usable in the context of the **Environment** property. The following: + * + * let env = new ActiveXObject('WScript.Shell').Environment; + * WScript.Echo(env('System')); + * + * will return an empty string, unless there is an environment variable named `System` + */ + Environment: WshEnvironment & ((Type: 'System' | 'User' | 'Process' | 'Volatile') => WshEnvironment); Exec(Command: string): WshExec; ExpandEnvironmentStrings(Src: string): string; - /** @param string [Target=''] */ - LogEvent(Type: any, Message: string, Target?: string): boolean; - Popup(Text: any, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; + /** @param string [Target=''] Name of the computer system where the event should be logged; default is the local computer system */ + LogEvent(Type: EventType, Message: string, Target?: string): boolean; + Popup(Text: string, SecondsToWait?: number, Title?: string, Type?: ButtonType | IconType | PopupType): PopupSelection; RegDelete(Name: string): void; - RegRead(Name: string): any; - RegWrite(Name: string, Value: any, Type?: any): void; - Run(Command: string, WindowStyle?: any, WaitOnReturn?: any): number; - SendKeys(Keys: string, Wait?: any): void; + + /** + * Returns the value of a key or value-name from the registry + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * + * Returns one of the following, based on the registry value type: + * + * * **REG_SZ** -- a string + * * **REG_DWORD** -- a number + * * **REG_SBINARY** -- a binary value, as a COM SafeArray containing integers + * * **REG_EXPAND_SZ** -- an expandable string + * * **REG_MULTI_SZ** -- an array of srings, as a COM SafeArray + */ + RegRead(Name: string): string | number | SafeArray | SafeArray; + + /** + * Creates a new key, adds another value-name to an existing key and assigns it a value, or changes the value of an existing value-name + * @param Name Key (ends with a final `\`) or value-name (doesn't end with a final `\`) + * @param Value Will be coerced to `string` or `integer` based on the value-name type: + * `REG_SZ | REG_EXPAND_SZ` will be converted to `string`; + * `REG_DWORD | REG_BINARY` will be converted to `integer` + * @param Type + */ + RegWrite(Name: string, Value: any, Type?: 'REG_SZ' | 'REG_DWORD' | 'REG_BINARY' | 'REG_EXPAND_SZ'): void; + + /** + * Runs a program in a new process. + * @param Command Command-line, including any parameters you want to pass to the executable file. + * @param WindowStyle Appearance of the program window. Not all programs make use of this information. + * @param WaitOnReturn Block script until program finishes executing. + * + * If `false` is passed into **WaitOnReturn**, the **Run** method will return 0 immediately. If `true` is passed in, **Run** will return the program's error code, if any. + * + * Environment variables will be expanded within the command line. + * + * Passing a registered file type will automatically open the program registered to the file type. + * + * Possible values for **WindowStyle**: + * + * * **0** -- Hides the window and activates another window. + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **2** -- Activates the window and displays it as a minimized window. + * * **3** -- Activates the window and displays it as a maximized window. + * * **4** -- Displays a window in its most recent size and position. The active window remains active. + * * **5** -- Activates the window and displays it in its current size and position. + * * **6** -- Minimizes the specified window and activates the next top-level window in the Z order. + * * **7** -- Displays the window as a minimized window. The active window remains active. + * * **8** -- Displays the window in its current state. The active window remains active. + * * **9** -- Activates and displays the window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when restoring a minimized window. + * * **10** -- Sets the show-state based on the state of the program that started the application. + */ + Run(Command: string, WindowStyle?: WindowStyle, WaitOnReturn?: boolean): number; + SendKeys(Keys: string, Wait?: boolean): void; readonly SpecialFolders: WshCollection; } @@ -216,7 +313,16 @@ declare namespace IWshRuntimeLibrary { readonly RelativePath: string; Save(): void; TargetPath: string; - WindowStyle: number; + + /** + * Possible values: + * + * * **1** -- Activates and displays a window. If the window is minimized or maximized, the system restores it to its original size and position. An application should specify this flag + * when displaying the window for the first time. + * * **3** -- Activates the window and displays it as a maximized window. + * * **7** -- Displays the window as a minimized window. The active window remains active. + */ + WindowStyle: ShortcutWindowStyle; WorkingDirectory: string; } @@ -240,8 +346,3 @@ interface ActiveXObjectNameMap { 'WScript.Network': IWshRuntimeLibrary.WshNetwork; 'WScript.Shell': IWshRuntimeLibrary.WshShell; } - -interface EnumeratorConstructor { - new(col: IWshRuntimeLibrary.WshCollection): Enumerator; - new(col: IWshRuntimeLibrary.WshEnvironment): Enumerator; -} diff --git a/types/activex-iwshruntimelibrary/tsconfig.json b/types/activex-iwshruntimelibrary/tsconfig.json index d2d55bbe09..1fa5abc39b 100644 --- a/types/activex-iwshruntimelibrary/tsconfig.json +++ b/types/activex-iwshruntimelibrary/tsconfig.json @@ -1,8 +1,10 @@ - { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "scripthost"], + "lib": [ + "es5", + "scripthost" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-scripting/activex-scripting-tests.ts b/types/activex-scripting/activex-scripting-tests.ts index 2297548b81..313e480cb5 100644 --- a/types/activex-scripting/activex-scripting-tests.ts +++ b/types/activex-scripting/activex-scripting-tests.ts @@ -1,60 +1,324 @@ -// source -- https://msdn.microsoft.com/en-us/library/ebkhfaaz.aspx +// Note -- running these tests under cscript requires some ES5 polyfills -// Generates a string describing the drive type of a given Drive object. -function showDriveType(drive: Scripting.Drive) { - switch (drive.DriveType) { - case Scripting.DriveTypeConst.Removable: - return 'Removeable'; - case Scripting.DriveTypeConst.Fixed: - return 'Fixecd'; - case Scripting.DriveTypeConst.Remote: - return 'Network'; - case Scripting.DriveTypeConst.CDRom: - return 'CD-ROM'; - case Scripting.DriveTypeConst.RamDisk: - return 'RAM Disk'; - default: - return 'Unknown'; +const collectionToArray = (col: { Item(key: any): T }): T[] => { + const results: T[] = []; + const enumerator = new Enumerator(col); + enumerator.moveFirst(); + while (!enumerator.atEnd()) { + results.push(enumerator.item()); + enumerator.moveNext(); } -} + return results; +}; -// Generates a string describing the attributes of a file or folder. -function showFileAttributes(file: Scripting.File) { - const attr = file.Attributes; - if (attr === 0) { - return 'Normal'; +const fso = new ActiveXObject('Scripting.FileSystemObject'); + +// https://msdn.microsoft.com/en-us/library/ebkhfaaz(v=vs.84).aspx +{ + /** Generates a string describing the drive type of a given Drive object. */ + const driveTypeString = (drive: Scripting.Drive) => { + switch (drive.DriveType) { + case Scripting.DriveTypeConst.Removable: + return 'Removeable'; + case Scripting.DriveTypeConst.Fixed: + return 'Fixecd'; + case Scripting.DriveTypeConst.Remote: + return 'Network'; + case Scripting.DriveTypeConst.CDRom: + return 'CD-ROM'; + case Scripting.DriveTypeConst.RamDisk: + return 'RAM Disk'; + default: + return 'Unknown'; + } + }; + + /** Generates a string describing the attributes of a file or folder. */ + const attributesString = (f: Scripting.File | Scripting.Folder) => { + const attr = f.Attributes; + if (attr === 0) { + return 'Normal'; + } + const attributeStrings: string[] = []; + if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); } + if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); } + if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); } + if (attr & Scripting.FileAttribute.System) { attributeStrings.push('System'); } + if (attr & Scripting.FileAttribute.Volume) { attributeStrings.push('Volume'); } + if (attr & Scripting.FileAttribute.Archive) { attributeStrings.push('Archive'); } + if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); } + if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); } + return attributeStrings.join(','); + }; + + const drivesInfoReport = () => { + const driveLine = (d: Scripting.Drive) => { + let parts: Array = [ + d.DriveLetter, + d.Path, + driveTypeString(d), + d.IsReady ? 'true' : 'false' + ]; + if (d.IsReady) { + parts = parts.concat([ + d.DriveType === Scripting.DriveTypeConst.Remote ? d.ShareName : d.VolumeName, + d.FileSystem, + d.TotalSize, + d.FreeSpace, + d.AvailableSpace, + d.SerialNumber.toString(16) + ]); + } + return parts.join(' '); + }; + + const ret = ` +Number of drives: ${fso.Drives.Count} + + Drive File Total Free Available Serial +Letter Path Type Ready? Name System Space Space Space Number +${new Array(106).join('-')} +${collectionToArray(fso.Drives).map(driveLine).join('\n')}` + .trim().replace(' ', '\t'); + }; + + type fiileFolderKey = keyof Scripting.File & keyof Scripting.Folder; + type keys = fiileFolderKey | 'Attribs' | 'Created' | 'Accessed' | 'Modified'; + const detailBuilder = (f: Scripting.File | Scripting.Folder, x: fiileFolderKey | 'Attribs' | 'Created' | 'Accessed' | 'Modified') => { + if (x === 'Attribs') { return attributesString(f); } + const label = x; + switch (x) { + case 'Created': + x = 'DateCreated'; + break; + case 'Accessed': + x = 'DateLastAccessed'; + break; + case 'Modified': + x = 'DateLastModified'; + break; + } + return `${label}\t${f[x]}\n`; + }; + + const fileDetailsString = (f: Scripting.File) => { + const keys: keys[] = ['Path', 'Name', 'Type', 'Attribs', 'Created', 'Accessed', 'Modified', 'Size']; + return keys.map(x => detailBuilder(f, x)).join(''); + }; + + const folderDetailsString = (f: Scripting.Folder) => { + const keys: keys[] = ['Path', 'Name', 'Attribs', 'Created', 'Accessed', 'Modified', 'Size']; + return keys.map(x => detailBuilder(f, x)).join(''); + }; + + const folderContentsString = (f: Scripting.Folder): string => { + const files = collectionToArray(f.Files); + const subfolders = collectionToArray(f.SubFolders); + return ` +Folder: ${f.Path} + +There ${files.length === 1 ? 'is 1 file' : `are ${files.length} files`} +${files.map(fileDetailsString).join('')} + +There ${subfolders.length === 1 ? 'is 1 subfolder' : `are ${subfolders.length} subfolders`} +${subfolders.map(folderDetailsString).join('')} +${subfolders.map(folderContentsString).join('')}` + .trim().replace(' ', '\t'); + }; + + const testDrive = 'C:\\'; + const testPath = 'C:\\test'; + const testfolderInfo = () => { + if (!fso.DriveExists(testDrive) || !fso.FolderExists(testPath)) { return ''; } + return folderContentsString(fso.GetFolder(testPath)); + }; + + const deleteTestFolder = () => { + // two ways to delete a file: + const filepathToDelete = `${testPath}\\LoremIpsum\\Paragraph1.txt`; + fso.DeleteFile(filepathToDelete); + // fso.GetFile(filepathToDelete).Delete(); + + // two ways to delete a folder: + fso.DeleteFolder(`${testPath}\\LoremIpsum`); + fso.GetFolder(testPath).Delete(); + }; + + const createLyrics = (folder: Scripting.Folder) => { + let stream = folder.CreateTextFile('Paragraph1.txt'); + stream.Write('Lorem Ipsum - Paragraph 1'); + stream.WriteBlankLines(1); + stream.WriteLine('Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas sem.'); + stream.WriteLine('Donec ante. Nulla facilisi. Phasellus interdum nulla a nunc. Morbi laoreet nunc.'); + stream.WriteBlankLines(2); + stream.Close(); + + stream = folder.CreateTextFile('Paragraph2.txt'); + stream.WriteLine('Lorem Ipsum - Paragraph 2'); + stream.WriteBlankLines(1); + stream.WriteLine('Nullam nulla quam, sollicitudin ut, lobortis ornare, tristique a, augue.'); + stream.WriteLine('Vestibulum sem felis, fermentum eu, volutpat eu, vulputate eget, elit. '); + stream.WriteBlankLines(2); + stream.Close(); + }; + + const getLyrics = () => { + const folderPath = `${testPath}\\LoremIpsum`; + let lyrics = ''; + + // One way to read from a file + let stream = fso.OpenTextFile(fso.BuildPath(folderPath, 'Paragraph1.txt')); + lyrics = stream.ReadAll() + '\n\n'; + stream.Close(); + + // Another way to read from a file + stream = fso.GetFile(fso.BuildPath(folderPath, 'Paragraph2.txt')).OpenAsTextStream(); + while (!stream.AtEndOfStream) { + lyrics += stream.ReadLine() + '\n'; + } + stream.Close(); + + return lyrics; + }; + + const buildTestFolder = () => { + // Bail out if the drive doesn't exists ... + if (!fso.DriveExists(testDrive)) { return false; } + // or the directory already exists + if (fso.FolderExists(testPath)) { return false; } + + const testFolder = fso.CreateFolder(testPath); + + const stream = fso.CreateTextFile(fso.BuildPath(testPath, 'readme.txt')); + stream.WriteLine('My sample text collection'); + stream.Close(); + + const subfolder = testFolder.SubFolders.Add('LoremIpsum'); + createLyrics(subfolder); + return true; + }; + + const echoLines = (linecount = 1) => new Array(linecount).forEach(() => WScript.Echo('')); + + if (!buildTestFolder()) { + WScript.Echo('Test directory already exists or cannot be created. Cannot continue.'); + } else { + drivesInfoReport(); + echoLines(2); + WScript.Echo(testfolderInfo()); + echoLines(2); + WScript.Echo(getLyrics()); + echoLines(2); + deleteTestFolder(); } - const attributeStrings: string[] = []; - if (attr & Scripting.FileAttribute.Directory) { attributeStrings.push('Directory'); } - if (attr & Scripting.FileAttribute.ReadOnly) { attributeStrings.push('Read-only'); } - if (attr & Scripting.FileAttribute.Hidden) { attributeStrings.push('Hidden'); } - if (attr & Scripting.FileAttribute.System) { attributeStrings.push('System'); } - if (attr & Scripting.FileAttribute.Volume) { attributeStrings.push('Volume'); } - if (attr & Scripting.FileAttribute.Archive) { attributeStrings.push('Archive'); } - if (attr & Scripting.FileAttribute.Alias) { attributeStrings.push('Alias'); } - if (attr & Scripting.FileAttribute.Compressed) { attributeStrings.push('Compressed'); } - return attributeStrings.join(','); } // source --https://msdn.microsoft.com/en-us/library/ts2t8ybh(v=vs.84).aspx -function showFreeSpace(drvPath: string) { - const fso = new ActiveXObject('Scripting.FileSystemObject'); - const d = fso.GetDrive(fso.GetDriveName(drvPath)); - let s = `Drive ${drvPath} - `; - s += d.VolumeName + '
'; - s += `Free Space: ${d.FreeSpace / 1024} Kbytes`; - return (s); +{ + const showFreeSpace = (drvPath: string) => { + const d = fso.GetDrive(fso.GetDriveName(drvPath)); + let s = `Drive ${drvPath} - `; + s += d.VolumeName + '
'; + s += `Free Space: ${d.FreeSpace / 1024} Kbytes`; + return (s); + }; } // source -- https://msdn.microsoft.com/en-us/library/kaf6yaft(v=vs.84).aspx -function getALine(filespec: string) { - const fso = new ActiveXObject('Scripting.FileSystemObject'); - const file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false); +{ + const getALine = (filespec: string) => { + const file = fso.OpenTextFile(filespec, Scripting.IOMode.ForReading, false); - let s = ''; - while (!file.AtEndOfLine) { - s += file.Read(1); - } - file.Close(); - return (s); + let s = ''; + while (!file.AtEndOfLine) { + s += file.Read(1); + } + file.Close(); + return (s); + }; +} + +// https://msdn.microsoft.com/en-us/library/ch28h2s7(v=vs.84).aspx +{ + const showDriveInfo = (path: string) => { + const bytesPerGB = 1024 * 1024 * 1024; + const drv = fso.GetDrive(fso.GetDriveName(path)); + const ret = + drv.IsReady ? + `${drv.Path} - ${drv.FreeSpace / bytesPerGB} GB free of ${drv.TotalSize / bytesPerGB} GB` : + 'Not ready'; + WScript.Echo(ret); + }; + + const showFolderInfo = () => { + const fldr = fso.GetFolder("c:\\"); + let ret = ` +Folder: ${fldr.Path} +Drive: ${fldr.Drive} +${fldr.IsRootFolder ? 'Is root folder' : `Parent folder: ${fldr.ParentFolder}`} + `.trim(); + + // Create and delete a folder. + const newFolderName = 'C:\\TempFolder1'; + fso.CreateFolder(newFolderName); + ret += `Base Name of Added Folder: ${fso.GetBaseName(newFolderName)}`; + fso.DeleteFolder(newFolderName); + + WScript.Echo(ret); + }; +} + +// https://msdn.microsoft.com/en-us/library/czxefwt8(v=vs.84).aspx +{ + const readFiles = () => { + const file = fso.CreateTextFile("c:\\testfile.txt", true); + + // Write a line. + WScript.Echo('Writing file'); + file.WriteLine("Hello World"); + file.WriteBlankLines(1); + file.Close(); + + // Read the contents of the file. + WScript.Echo('Reading file'); + const textStream = fso.OpenTextFile("c:\\testfile.txt", Scripting.IOMode.ForReading); + WScript.Echo(`File contents = "${textStream.ReadLine()}"`); + textStream.Close(); + }; + + const manipulateFiles = () => { + const file = fso.CreateTextFile("c:\\testfile.txt", true); + + WScript.Echo('Writing file'); + + // Write a line. + file.Write("This is a test."); + + // Close the file to writing. + file.Close(); + + WScript.Echo('Moving file to c:\\tmp'); + + // Get a handle to the file in root of C:\. + let file2 = fso.GetFile("c:\\testfile.txt"); + + // Move the file to \tmp directory. + file2.Move("c:\\tmp\\testfile.txt"); + + WScript.Echo('Copying file to c:\\temp
'); + + // Copy the file to \temp. + file2.Copy('c:\\temp\\testfile.txt'); + + WScript.Echo('Deleting files
'); + + // Get handles to files' current location. + file2 = fso.GetFile('c:\\tmp\\testfile.txt'); + const file3 = fso.GetFile('c:\\temp\\testfile.txt'); + + // Delete the files. + file2.Delete(); + file3.Delete(); + WScript.Echo('All done!'); + }; } diff --git a/types/activex-scripting/index.d.ts b/types/activex-scripting/index.d.ts index c4a64c54af..42e4f0c9e0 100644 --- a/types/activex-scripting/index.d.ts +++ b/types/activex-scripting/index.d.ts @@ -1,24 +1,28 @@ // Type definitions for Microsoft Scripting Runtime 1.0 -// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7.aspx +// Project: https://msdn.microsoft.com/en-us/library/bstcxhf7(v=vs.84).aspx // Definitions by: Zev Spitz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 declare namespace Scripting { + // tslint:disable-next-line:no-const-enum const enum CompareMethod { BinaryCompare = 0, DatabaseCompare = 2, - TextCompare = 1 + TextCompare = 1, } + // tslint:disable-next-line:no-const-enum const enum DriveTypeConst { CDRom = 4, Fixed = 2, RamDisk = 5, Remote = 3, Removable = 1, - UnknownType = 0 + UnknownType = 0, } + // tslint:disable-next-line:no-const-enum const enum FileAttribute { Alias = 1024, Archive = 32, @@ -28,38 +32,42 @@ declare namespace Scripting { Normal = 0, ReadOnly = 1, System = 4, - Volume = 8 + Volume = 8, } + // tslint:disable-next-line:no-const-enum const enum IOMode { ForAppending = 8, ForReading = 1, - ForWriting = 2 + ForWriting = 2, } + // tslint:disable-next-line:no-const-enum const enum SpecialFolderConst { SystemFolder = 1, TemporaryFolder = 2, - WindowsFolder = 0 + WindowsFolder = 0, } + // tslint:disable-next-line:no-const-enum const enum StandardStreamTypes { StdErr = 2, StdIn = 0, - StdOut = 1 + StdOut = 1, } + // tslint:disable-next-line:no-const-enum const enum Tristate { TristateFalse = 0, TristateMixed = -2, TristateTrue = -1, - TristateUseDefault = -2 + TristateUseDefault = -2, } /** Scripting.Dictionary */ - interface Dictionary { + interface Dictionary { /** Add a new key and item to the dictionary. */ - Add(Key: any, Item: any): void; + Add(Key: TKey, Item: TItem): void; /** Set or get the string comparison method. */ CompareMode: CompareMethod; @@ -68,32 +76,38 @@ declare namespace Scripting { readonly Count: number; /** Determine if a given key is in the dictionary. */ - Exists(Key: any): boolean; - HashVal(Key: any): any; + Exists(Key: TKey): boolean; + HashVal(Key: TKey): any; /** Set or get the item for a given key */ - Item(Key: any): any; + Item(Key: TKey): TItem; /** Get an array containing all items in the dictionary. */ - Items(): any; + Items(): SafeArray; /** Change a key to a different key. */ - Key(Key: any): any; + Key(Key: TKey): TKey; /** Get an array containing all keys in the dictionary. */ - Keys(): any; + Keys(): SafeArray; /** Remove a given key from the dictionary. */ - Remove(Key: any): void; + Remove(Key: TKey): void; /** Remove all information from the dictionary. */ RemoveAll(): void; + + /** Set or get the item for a given key */ + (Key: TKey): TItem; } /** Drive Object */ - interface Drive { + class Drive { + private constructor(); + private 'Scripting.Drive_typekey': Drive; + /** Get available space */ - readonly AvailableSpace: any; + readonly AvailableSpace: number; /** Drive letter */ readonly DriveLetter: string; @@ -105,7 +119,7 @@ declare namespace Scripting { readonly FileSystem: string; /** Get drive free space */ - readonly FreeSpace: any; + readonly FreeSpace: number; /** Check if disk is available */ readonly IsReady: boolean; @@ -123,7 +137,7 @@ declare namespace Scripting { readonly ShareName: string; /** Get total drive size */ - readonly TotalSize: any; + readonly TotalSize: number; /** Name of volume */ VolumeName: string; @@ -134,18 +148,27 @@ declare namespace Scripting { /** Number of drives */ readonly Count: number; - /** Get drive */ - Item(Key: any): Drive; + /** Get drive using the drive letter (`C`) or path (`C:\\`) */ + Item(Key: string): Drive; + + /** Get drive using the drive letter (`C`) or path (`C:\\`) */ + (Key: string): Drive; } /** Script Encoder Object */ interface Encoder { /** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */ EncodeScriptFile(szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string; + + /** Call the Encoder determined by szExt, passing bstrStreamIn and optional arguments */ + (szExt: string, bstrStreamIn: string, cFlags: number, bstrDefaultLang: string): string; } /** File object */ - interface File { + class File { + private constructor(); + private 'Scripting.File_typekey': File; + /** File attributes */ Attributes: FileAttribute; @@ -166,7 +189,7 @@ declare namespace Scripting { /** * Delete this file - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to delete the file even if the read-only attribute is set */ Delete(Force?: boolean): void; @@ -199,7 +222,7 @@ declare namespace Scripting { readonly ShortPath: string; /** File size */ - readonly Size: any; + readonly Size: number; /** Type description */ readonly Type: string; @@ -210,12 +233,18 @@ declare namespace Scripting { /** Number of folders */ readonly Count: number; + /** Get file object using the name and extension of the file */ + Item(Key: string): File; + /** Get file */ - Item(Key: any): File; + (Key: string): File; } /** FileSystem Object */ - interface FileSystemObject { + class FileSystemObject { + private constructor(); + private 'Scripting.FileSystemObject_typekey': FileSystemObject; + /** Generate a path from an existing path and a name */ BuildPath(Path: string, Name: string): string; @@ -243,13 +272,13 @@ declare namespace Scripting { /** * Delete a file - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to also delete files with the read-only attribute set */ DeleteFile(FileSpec: string, Force?: boolean): void; /** * Delete a folder - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to also delete folders with the read-only attribute set */ DeleteFolder(FolderSpec: string, Force?: boolean): void; @@ -317,13 +346,16 @@ declare namespace Scripting { * Open a file as a TextStream * @param Scripting.IOMode [IOMode=1] * @param boolean [Create=false] - * @param Scripting.Tristate [Format=0] + * @param Scripting.Tristate [Format=0] **TristateTrue** opens the file as Unicode; **TristateFalse** opens the file as ASCII; **TristateUseDefault** opens the file with the system default */ OpenTextFile(FileName: string, IOMode?: IOMode, Create?: boolean, Format?: Tristate): TextStream; } /** Folder object */ - interface Folder { + class Folder { + private constructor(); + private 'Scripting.Folder_typekey': Folder; + /** Folder attributes */ Attributes: FileAttribute; @@ -351,7 +383,7 @@ declare namespace Scripting { /** * Delete this folder - * @param boolean [Force=false] + * @param boolean [Force=false] Pass `true` to delete the folder even if the read-only attribute set */ Delete(Force?: boolean): void; @@ -383,7 +415,7 @@ declare namespace Scripting { readonly ShortPath: string; /** Sum of files and subfolders */ - readonly Size: any; + readonly Size: number; /** Get folders collection */ readonly SubFolders: Folders; @@ -400,12 +432,18 @@ declare namespace Scripting { /** Number of folders */ readonly Count: number; - /** Get folder */ - Item(Key: any): Folder; + /** Get folder in collection using the folder's name */ + Item(Key: string): Folder; + + /** Get folder in collection using the folder's name */ + (Key: string): Folder; } /** TextStream object */ - interface TextStream { + class TextStream { + private constructor(); + private 'Scripting.TextStream_typekey': TextStream; + /** Is the current position at the end of a line? */ readonly AtEndOfLine: boolean; @@ -451,15 +489,12 @@ declare namespace Scripting { } interface ActiveXObject { + new (progid: K): ActiveXObjectNameMap[K]; set(obj: Scripting.Dictionary, propertyName: 'Item', parameterTypes: [any], newValue: any): void; - new(progid: 'Scripting.Dictionary'): Scripting.Dictionary; - new(progid: 'Scripting.Encoder'): Scripting.Encoder; - new(progid: 'Scripting.FileSystemObject'): Scripting.FileSystemObject; } -interface EnumeratorConstructor { - new(col: Scripting.Dictionary): any; - new(col: Scripting.Drives): Scripting.Drive; - new(col: Scripting.Files): Scripting.File; - new(col: Scripting.Folders): Scripting.Folder; +interface ActiveXObjectNameMap { + 'Scripting.Dictionary': Scripting.Dictionary; + 'Scripting.Encoder': Scripting.Encoder; + 'Scripting.FileSystemObject': Scripting.FileSystemObject; } diff --git a/types/activex-scripting/tslint.json b/types/activex-scripting/tslint.json index 3224b40b8b..f93cf8562a 100644 --- a/types/activex-scripting/tslint.json +++ b/types/activex-scripting/tslint.json @@ -1,6 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - "no-const-enum": false - } + "extends": "dtslint/dt.json" } diff --git a/types/activex-shdocvw/tsconfig.json b/types/activex-shdocvw/tsconfig.json index 1759b6965f..1907cb1ef6 100644 --- a/types/activex-shdocvw/tsconfig.json +++ b/types/activex-shdocvw/tsconfig.json @@ -1,8 +1,10 @@ - { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "scripthost"], + "lib": [ + "es5", + "scripthost" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/activex-shell/activex-shell-tests.ts b/types/activex-shell/activex-shell-tests.ts index 1a7e08754c..f236f6e592 100644 --- a/types/activex-shell/activex-shell-tests.ts +++ b/types/activex-shell/activex-shell-tests.ts @@ -59,7 +59,7 @@ shell.ShowBrowserBar(Shell32.ExplorerBarCLSID.Favorites, true); // https://msdn.microsoft.com/en-us/library/windows/desktop/bb774107(v=vs.85).aspx const wshShell = new ActiveXObject('WScript.Shell'); -wshShell.Popup(shell.Windows().Count); +wshShell.Popup(shell.Windows().Count.toString()); // https://msdn.microsoft.com/en-us/library/windows/desktop/bb787866(v=vs.85).aspx shell.NameSpace(`c:\\windows`)!.CopyHere('c:\\autoexec.bat'); diff --git a/types/activex-shell/tsconfig.json b/types/activex-shell/tsconfig.json index 97b3ee81cb..f4b549f649 100644 --- a/types/activex-shell/tsconfig.json +++ b/types/activex-shell/tsconfig.json @@ -1,8 +1,10 @@ - { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "scripthost"], + "lib": [ + "es5", + "scripthost" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/add-zero/tsconfig.json b/types/add-zero/tsconfig.json index e71d235cdf..d7645a2e3c 100644 --- a/types/add-zero/tsconfig.json +++ b/types/add-zero/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "add-zero-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/adone/glosses/collections.d.ts b/types/adone/glosses/collections.d.ts deleted file mode 100644 index 178921136d..0000000000 --- a/types/adone/glosses/collections.d.ts +++ /dev/null @@ -1,1965 +0,0 @@ -declare namespace adone { - namespace collection { - namespace I.LinkedList { - /** - * Represents the node of a linked list - */ - interface Node { - /** - * The next node - */ - next?: Node; - - /** - * The previous node - */ - prev?: Node; - - /** - * The value this node contains - */ - value: T; - } - } - - /** - * Represents a linked list - */ - class LinkedList { - /** - * The maximum length of the list - */ - readonly maxLength: number; - - /** - * Current length of the list - */ - readonly length: number; - - /** - * Whether the list is autoresizable - */ - readonly autoresize: boolean; - - /** - * @param maxLength Maximum length of the linked list - */ - constructor(maxLength?: number); - - /** - * Whether the list is full - */ - readonly full: boolean; - - /** - * Whether the list is empty - */ - readonly empty: boolean; - - /** - * Resizes the list - */ - resize(newLength: number): this; - - /** - * Adds a new node to the end - * - * @returns Added node - */ - push(value: T): I.LinkedList.Node; - - /** - * Removes the last node, returns undefined if the list is empty - */ - pop(): T | undefined; - - /** - * Removes the first node, returns undefined if the list is empty - */ - shift(): T | undefined; - - /** - * Inserts a new node at the beginning of the list - * - * @returns Added node - */ - unshift(value: T): I.LinkedList.Node; - - /** - * Moves the given node to the end of the list - */ - pushNode(node: I.LinkedList.Node): void; - - /** - * Moved the given node to the beginning of the list - */ - unshiftNode(node: I.LinkedList.Node): void; - - /** - * Removes the given node from the list - */ - removeNode(node: I.LinkedList.Node): void; - - /** - * Clears the list - * - * @param strong Whether to reset all the node's values - */ - clear(strong?: boolean): void; - - /** - * Convers the list to an array - */ - toArray(): T[]; - - /** - * The first element of the list - */ - readonly front: T; - - /** - * The last element of the list - */ - readonly back: T; - - /** - * Returns an iterator over the list elements - */ - [Symbol.iterator](): IterableIterator; - - /** - * Returns the next node for the given node - */ - nextNode(node: I.LinkedList.Node): I.LinkedList.Node; - - /** - * Maps this linked list to a new one using the given function - */ - map(fn: (value: T, index: number) => R): LinkedList; - - /** - * Invokes the given callback for each value from the beginning to the end (much faster than for-of). - * If the given function returns false it stops iterating. - */ - forEach(callback: (value: T, index: number) => void | boolean): void; - - /** - * Default length of a new created linked list - */ - static DEFAULT_LENGTH: number; - } - - namespace I { - type Long = math.Long; - - type Longable = math.I.Longable; - - namespace ByteArray { - interface Varint32 { - value: number; - length: number; - } - - interface Varint64 { - value: Long; - length: number; - } - - interface String { - string: string; - length: number; - } - - type Wrappable = string | ByteArray | Buffer | Uint8Array | ArrayBuffer; - - type Metrics = "b" | "c"; - } - } - - /** - * Represents an array of bytes, enhanced Node.js Buffer - */ - class ByteArray { - /** - * Constructs a new ByteArray - * - * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - constructor(capacity?: number, noAssert?: boolean); - - /** - * Reads a BitSet as an array of booleans. - * - * @param offset Offset to read from. Will use and increase offset by length if omitted. - */ - readBitSet(offset?: number): boolean[]; - - /** - * Reads the specified number of bytes. - * - * @param length Number of bytes to read - * @param offset Offset to read from. Will use and increase offset by length if omitted. - */ - read(length: number, offset?: number): ByteArray; - - /** - * Reads an 8bit signed integer - * - * @param offset Offset to read from - */ - readInt8(offset?: number): number; - - /** - * Reads an 8bit unsigned integer - * - * @param offset Offset to read from - */ - readUInt8(offset?: number): number; - - /** - * Reads a 16bit signed le integer - * - * @param offset Offset to read from - */ - readInt16LE(offset?: number): number; - - /** - * Reads a 16bit unsigned le integer - * - * @param offset Offset to read from - */ - readUInt16LE(offset?: number): number; - - /** - * Reads a 16bit signed be integer - * - * @param offset Offset to read from - */ - readInt16BE(offset?: number): number; - - /** - * Reads a 16bit unsigned be integer - * - * @param offset Offset to read from - */ - readUInt16BE(offset?: number): number; - - /** - * Reads a 32bit signed le integer - * - * @param offset Offset to read from - */ - readInt32LE(offset?: number): number; - - /** - * Reads a 32bit unsigned le integer - * - * @param offset Offset to read from - */ - readUInt32LE(offset?: number): number; - - /** - * Reads a 32bit signed be integer - * - * @param offset Offset to read from - */ - readInt32BE(offset?: number): number; - - /** - * Reads a 32bit unsigned be integer - * - * @param offset Offset to read from - */ - readUInt32BE(offset?: number): number; - - /** - * Reads a 64bit signed le integer as math.Long - * - * @param offset Offset to read from - */ - readInt64LE(offset?: number): math.Long; - - /** - * Reads a 64bit unsigned le integer as math.Long - * - * @param offset Offset to read from - */ - readUInt64LE(offset?: number): math.Long; - - /** - * Reads a 64bit signed be integer as math.Long - * - * @param offset Offset to read from - */ - readInt64BE(offset?: number): math.Long; - - /** - * Reads a 64bit unsigned be integer as math.Long - * - * @param offset Offset to read from - */ - readUInt64BE(offset?: number): math.Long; - - /** - * Reads a 32bit le float - * - * @param offset Offset to read from - */ - readFloatLE(offset?: number): number; - - /** - * Reads a 32bit be float - * - * @param offset Offset to read from - */ - readFloatBE(offset?: number): number; - - /** - * Reads a 64bit le float - * - * @param offset Offset to read from - */ - readDoubleLE(offset?: number): number; - - /** - * Reads a 64bit be float - * - * @param offset Offset to read from - */ - readDoubleBE(offset?: number): number; - - /** - * Appends some data to this ByteArray. - * This will overwrite any contents behind the specified offset up to the appended data's length. - * - * @param source The source write from - * @param offset Offset to write to - * @param length length to read from the source - * @param encoding encoding to use for wrapping the source in bytearray - */ - write(source: I.ByteArray.Wrappable, offset?: number, length?: number, encoding?: string): this; - - /** - * Writes the array as a bitset. - * @param value Array of booleans to write - */ - writeBitSet(value: number[]): this; - - /** - * Writes the array as a bitset. - * @param value Array of booleans to write - * @param offset Offset to write to - */ - writeBitSet(value: number[], offset: number): number; - - /** - * Writes an 8bit signed integer - * - * @param offset Offset to write to - */ - writeInt8(value: number, offset?: number): this; - - /** - * Writes an 8bit unsigned integer - * - * @param offset Offset to write to - */ - writeUInt8(value: number, offset?: number): this; - - /** - * Writes a 16bit signed le integer - * - * @param offset Offset to write to - */ - writeInt16LE(value: number, offset?: number): this; - - /** - * Writes a 16bit signed be integer - * - * @param offset Offset to write to - */ - writeInt16BE(value: number, offset?: number): this; - - /** - * Writes a 16bit unsigned le integer - * - * @param offset Offset to write to - */ - writeUInt16LE(value: number, offset?: number): this; - - /** - * Writes a 16bit unsigned be integer - * - * @param offset Offset to write to - */ - writeUInt16BE(value: number, offset?: number): this; - - /** - * Writes a 32bit signed le integer - * - * @param offset Offset to write to - */ - writeInt32LE(value: number, offset?: number): this; - - /** - * Writes a 32bit signed be integer - * - * @param offset Offset to write to - */ - writeInt32BE(value: number, offset?: number): this; - - /** - * Writes a 32bit unsigned le integer - * - * @param offset Offset to write to - */ - writeUInt32LE(value: number, offset?: number): this; - - /** - * Writes a 32bit unsigned be integer - * - * @param offset Offset to write to - */ - writeUInt32BE(value: number, offset?: number): this; - - /** - * Writes a 64bit signed le long integer - * - * @param offset Offset to write to - */ - writeInt64LE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 64bit signed be long integer - * - * @param offset Offset to write to - */ - writeInt64BE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 64bit unsigned le long integer - * - * @param offset Offset to write to - */ - writeUInt64LE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 64bit unsigned be long integer - * - * @param offset Offset to write to - */ - writeUInt64BE(value: math.Long | string | number, offset?: number): this; - - /** - * Writes a 32bit le float - * - * @param offset Offset to write to - */ - writeFloatLE(value: number, offset?: number): this; - - /** - * Writes a 32bit be float - * - * @param offset Offset to write to - */ - writeFloatBE(value: number, offset?: number): this; - - /** - * Writes a 64bit le float - * - * @param offset Offset to write to - */ - writeDoubleLE(value: number, offset?: number): this; - - /** - * Writes a 64bit be float - * - * @param offset Offset to write to - */ - writeDoubleBE(value: number, offset?: number): this; - - /** - * Writes a 32bit base 128 variable-length integer - */ - writeVarint32(value: number): this; - - /** - * Writes a 32bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint32(value: number, offset: number): number; - - /** - * Writes a zig-zag encoded 32bit base 128 variable-length integer - */ - writeVarint32ZigZag(value: number): this; - - /** - * Writes a zig-zag encoded 32bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint32ZigZag(value: number, offset: number): number; - - /** - * Reads a 32bit base 128 variable-length integer - */ - readVarint32(): number; - - /** - * Reads a 32bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint32(offset: number): I.ByteArray.Varint32; - - /** - * Reads a zig-zag encoded 32bit base 128 variable-length integer - */ - readVarint32ZigZag(): number; - - /** - * Reads a zig-zag encoded 32bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint32ZigZag(offset: number): I.ByteArray.Varint32; - - /** - * Writes a 64bit base 128 variable-length integer - */ - writeVarint64(value: math.Long | string | number): this; - - /** - * Writes a 64bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint64(value: math.Long | string | number, offset: number): number; - - /** - * Writes a zig-zag encoded 64bit base 128 variable-length integer - */ - writeVarint64ZigZag(value: math.Long | string | number): this; - - /** - * Writes a zig-zag encoded 64bit base 128 variable-length integer - * - * @param offset Offset to write to - */ - writeVarint64ZigZag(value: math.Long | string | number, offset: number): number; - - /** - * Reads a 64bit base 128 variable-length integer - */ - readVarint64(): I.Long; - - /** - * Reads a 64bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint64(offset: number): I.ByteArray.Varint64; - - /** - * Reads a zig-zag encoded 64bit base 128 variable-length integer - */ - readVarint64ZigZag(): math.Long; - - /** - * Reads a zig-zag encoded 64bit base 128 variable-length integer - * - * @param offset Offset to read from - */ - readVarint64ZigZag(offset: number): I.ByteArray.Varint64; - - /** - * Writes a NULL-terminated UTF8 encoded string. - * For this to work the specified string must not contain any NULL characters itself - */ - writeCString(str: string): this; - - /** - * Writes a NULL-terminated UTF8 encoded string. - * For this to work the specified string must not contain any NULL characters itself - * - * @param offset Offset to write to - */ - writeCString(str: string, offset: number): number; - - /** - * Reads a NULL-terminated UTF8 encoded string. - * For this to work the string read must not contain any NULL characters itself - */ - readCString(): string; - - /** - * Reads a NULL-terminated UTF8 encoded string. - * For this to work the string read must not contain any NULL characters itself - * - * @param offset Offset to read from - */ - readCString(offset: number): I.ByteArray.String; - - /** - * Writes an UTF8 encoded string - */ - writeString(str: string): this; - - /** - * Writes an UTF8 encoded string - * - * @param offset Offset to write to - */ - writeString(str: string, offset: number): number; - - /** - * Reads an UTF8 encoded string - * - * @param length Number of characters or bytes to read - * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") - */ - readString(length: number, metrics?: I.ByteArray.Metrics): string; - - /** - * Reads an UTF8 encoded string - * - * @param length Number of characters or bytes to read - * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") - * @param offset Offset to read from - */ - readString(length: number, metrics: I.ByteArray.Metrics, offset: number): I.ByteArray.String; - - /** - * Reads an UTF8 encoded string - * - * @param length Number of characters or bytes to read - * @param offset Offset to read from - */ - readString(length: number, offset: number): I.ByteArray.String; - - /** - * Writes a length as varint32 prefixed UTF8 encoded string - */ - writeVString(str: string): this; - - /** - * Writes a length as varint32 prefixed UTF8 encoded string - * - * @param offset Offset to read from - */ - writeVString(str: string, offset: number): number; - - /** - * Reads a length as varint32 prefixed UTF8 encoded string - */ - readVString(): string; - - /** - * Reads a length as varint32 prefixed UTF8 encoded string - * - * @param offset Offset to read from - */ - readVString(offset: number): I.ByteArray.String; - - /** - * Appends this ByteArray's contents to another ByteArray. - * This will overwrite any contents behind the specified offset up to the length of this ByteArray's data - * - * @param offset Offset to append to - */ - appendTo(target: ByteArray, offset?: number): this; - - /** - * Enables or disables assertions of argument types and offsets. - * Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid - */ - assert(assert?: boolean): this; - - /** - * Gets the capacity of this ByteArray's backing buffer - */ - capacity(): number; - - /** - * Clears this ByteArray's offsets by setting offset to 0 and limit to the backing buffer's capacity - */ - clear(): this; - - /** - * Creates a cloned instance of this ByteArray, - * preset with this ByteArray's values for offset, markedOffset and limit - * - * @param copy Whether to copy the backing buffer or to return another view on the same, false by default - */ - clone(copy?: boolean): ByteArray; - - /** - * Compacts this ByteArray to be backed by a buffer of its contents' length. - * Will set offset = 0 and limit = capacity and adapt markedOffset to the same relative position if set - * - * @param begin Offset to start at, buffer offset by default - * @param end Offset to end at, buffer limit by default - */ - compact(begin?: number, end?: number): this; - - /** - * Creates a copy of this ByteArray's contents. - * - * @param begin Begin offset, buffer offset by default - * @param end End offset, buffer limit by default - */ - copy(begin?: number, end?: number): ByteArray; - - /** - * Copies this ByteArray's contents to another ByteArray. - * - * @param targetOffset Offset to copy to. Will use and increase the target's offset by the number of bytes copied if omitted - * @param sourceOffset Offset to start copying from. Will use and increase offset by the number of bytes copied if omitted - * @param sourceLimit Offset to end copying from, defaults to the buffer limit - */ - copyTo(target: ByteArray, targetOffset?: number, souceOffset?: number, sourceLimit?: number): this | ByteArray; - - /** - * Makes sure that this ByteArray is backed by a ByteArray#buffer of at least the specified capacity. - * If the current capacity is exceeded, it will be doubled. - * If double the current capacity is less than the required capacity, the required capacity will be used instead - */ - ensureCapacity(capacity: number): this; - - /** - * Overwrites this ByteArray's contents with the specified value. - * - * @param value Byte value to fill with. If given as a string, the first character is used - * @param begin Begin offset. Will use and increase offset by the number of bytes written if omitted. defaults to offset - * @param end End offset, defaults to limit. - */ - fill(value: string | number, begin?: number, end?: number): this; - - /** - * Makes this ByteArray ready for a new sequence of write or relative read operations. - * Sets limit = offset and offset = 0. - * Make sure always to flip a ByteArray when all relative read or write operations are complete - */ - flip(): this; - - /** - * Marks an offset on this ByteArray to be used later - * - * @param offset Offset to mark. Defaults to offset. - */ - mark(offset?: number): this; - - /** - * Prepends some data to this ByteArray. - * This will overwrite any contents before the specified offset up to the prepended data's length. - * If there is not enough space available before the specified offset, - * the backing buffer will be resized and its contents moved accordingly - * - * @param source Data to prepend - * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. - */ - prepend(source: I.ByteArray.Wrappable, offset: number): this; - - /** - * Prepends some data to this ByteArray. - * This will overwrite any contents before the specified offset up to the prepended data's length. - * If there is not enough space available before the specified offset, - * the backing buffer will be resized and its contents moved accordingly - * - * @param source Data to prepend - * @param encoding Encoding if data is a string - * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. - */ - prepend(source: I.ByteArray.Wrappable, encoding?: string, offset?: number): this; - - /** - * Prepends this ByteArray to another ByteArray. - * This will overwrite any contents before the specified offset up to the prepended data's length. - * If there is not enough space available before the specified offset, - * the backing buffer will be resized and its contents moved accordingly - * - * @param offset Offset to prepend at - */ - prependTo(target: ByteArray, offset?: number): this; - - /** - * Gets the number of remaining readable bytes - */ - remaining(): number; - - /** - * Resets this ByteArray's offset. - * If an offset has been marked through mark before, offset will be set to markedOffset, which will then be discarded. - * If no offset has been marked, sets offset = 0 - */ - reset(): this; - - /** - * Resizes this ByteArray to be backed by a buffer of at least the given capacity. - * Will do nothing if already that large or larger. - * - * @param capacity Capacity required - */ - resize(capacity: number): this; - - /** - * Reverses this ByteArray's contents. - * - * @param begin Offset to start at, defaults to offset - * @param end Offset to end at, defaults to limit - */ - reverse(begin?: number, end?: number): this; - - /** - * Skips the next length bytes. This will just advance - */ - skip(length: number): this; - - /** - * Slices this ByteArray by creating a cloned instance with offset = begin and limit = end - * - * @param begin Begin offset, defaults to offset - * @param end End offset, defaults to limit - */ - slice(begin?: number, end?: number): ByteArray; - - /** - * Returns a copy of the backing buffer that contains this ByteArray's contents. - * - * @param forceCopy If true returns a copy, otherwise returns a view referencing the same memory if possible, false by default - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toBuffer(forceCopy?: boolean, begin?: number, end?: number): Buffer; - - /** - * Returns a raw buffer compacted to contain this ByteArray's contents - */ - toArrayBuffer(): ArrayBuffer; - - /** - * Converts the ByteArray's contents to a string - * - * @param encoding Output encoding - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toString(encoding?: string, begin?: number, end?: number): string; - - /** - * Encodes this ByteArray's contents to a base64 encoded string - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toBase64(begin?: number, end?: number): string; - - /** - * Encodes this ByteArray to a binary encoded string, that is using only characters 0x00-0xFF as bytes - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toBinary(begin?: number, end?: number): string; - - /** - * Encodes this ByteArray to a hex encoded string with marked offsets - * - * @param columns If true returns two columns hex + ascii, defaults to false - */ - toDebug(columns?: boolean): string; - - /** - * Encodes this ByteArray's contents to a hex encoded string - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toHex(begin?: number, end?: number): string; - - /** - * Encodes this ByteArray's contents to an UTF8 encoded string - * - * @param begin Begin offset, offset by default - * @param end End offset, limit by default - */ - toUTF8(begin?: number, end?: number): string; - - static accessor(): typeof Buffer; - - /** - * Allocates a new ByteArray backed by a buffer of the specified capacity. - * - * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - static allocate(capacity?: number, noAssert?: boolean): ByteArray; - - /** - * Concatenates multiple ByteArrays into one - * - * @param encoding Encoding for strings - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - static concat(buffers: I.ByteArray.Wrappable[], encoding?: string, noAssert?: boolean): ByteArray; - - static type(): typeof Buffer; - - /** - * Wraps a buffer or a string. - * Sets the allocated ByteArray's offset to 0 and its limit to the length of the wrapped data - * - * @param encoding Encoding for strings - * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) - */ - static wrap(buffer: I.ByteArray.Wrappable, encoding?: string, noAssert?: boolean): ByteArray; - - /** - * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer - */ - static calculateVarint32(value: number): number; - - /** - * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding - */ - static zigZagEncode32(n: number): number; - - /** - * Decodes a zigzag encoded signed 32bit integer - */ - static zigZagDecode32(n: number): number; - - /** - * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer - */ - static calculateVarint64(value: number | string): number; - - /** - * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding - */ - static zigZagEncode64(value: number | string | I.Long): I.Long; - - /** - * Decodes a zigzag encoded signed 64bit integer. - */ - static zigZagDecode64(value: number | string | I.Long): I.Long; - - /** - * Calculates the number of UTF8 characters of a string. - * JavaScript itself uses UTF-16, - * so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF - */ - static calculateUTF8Chars(str: string): number; - - /** - * Calculates the number of UTF8 bytes of a string. - */ - static calculateString(str: string): number; - - /** - * Decodes a base64 encoded string to a ByteArray - */ - static fromBase64(str: string): ByteArray; - - /** - * Encodes a binary string to base64 like window.btoa does - */ - static btoa(str: string): string; - - /** - * Decodes a base64 encoded string to binary like window.atob does - */ - static atob(b64: string): string; - - /** - * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteArray - */ - static fromBinary(str: string): ByteArray; - - /** - * Decodes a hex encoded string with marked offsets to a ByteArray - */ - static fromDebug(str: string, noAssert?: boolean): ByteArray; - - /** - * Decodes a hex encoded string to a ByteArray - */ - static fromHex(str: string, noAssert?: boolean): ByteArray; - - /** - * Decodes an UTF8 encoded string to a ByteArray - */ - static fromUTF8(str: string, noAssert?: boolean): ByteArray; - - /** - * Default initial capacity - */ - static DEFAULT_CAPACITY: number; - - /** - * Default no assertions flag - */ - static DEFAULT_NOASSERT: boolean; - - /** - * Maximum number of bytes required to store a 32bit base 128 variable-length integer - */ - static MAX_VARINT32_BYTES: number; - - /** - * Maximum number of bytes required to store a 64bit base 128 variable-length integer - */ - static MAX_VARINT64_BYTES: number; - - /** - * Metrics representing number of UTF8 characters. Evaluates to `c`. - */ - static METRICS_CHARS: string; - - /** - * Metrics representing number of bytes. Evaluates to `b`. - */ - static METRICS_BYTES: string; - } - - /** - * Represents a queue - */ - class Queue { - /** - * Whether the queue is full - */ - readonly full: boolean; - - /** - * The length of the queue - */ - readonly length: number; - - /** - * Whether the queue is empty - */ - readonly empty: boolean; - - /** - * Inserts a new element at the end - */ - push(x: S): this; - - /** - * Removes and returns an element from the beginning - */ - pop(): T | undefined; - } - - /** - * Represents an asynchronous queue, each pop is a promise - * that is resolved with an existing element or an element that will be pushed in the future - */ - class AsyncQueue extends Queue> { - /** - * Returns a promise that will be resolved with an existing element or an element that will be pushed in the future - */ - pop(): Promise; - } - - namespace I.PriorityQueue { - interface ConstructorOptions { - /** - * Function that compares objects. - * - * Must return a positive value if a > b, a negative if a < b, and zero for equal objects - */ - compare?(a: T, b: T): number; - - /** - * Function that evaluates the priority value by the given objects, - * if the returned value > 0, then the first argument has higher priority, - * = 0 same priority, < 0 lower priority. - * By default the top element is an element that has the highest priority, - * the default priority function is equal to the compare function - */ - priority?(a: T, b: T): number; - } - } - - /** - * Represents a priority queue - */ - class PriorityQueue { - /** - * Whether the queue is empty - */ - readonly empty: boolean; - - /** - * The length of the queue - */ - readonly length: number; - - constructor(options?: I.PriorityQueue.ConstructorOptions); - - /** - * Clones the queue - */ - clone(): PriorityQueue; - - /** - * Inserts a new element - */ - push(x: T): this; - - /** - * Removes the top element (that has the highest priority) - */ - pop(): T | undefined; - - /** - * Deletes the given element from the queue - */ - delete(x: T): this; - - /** - * Replaces the top element (pop + push) - */ - replace(x: T): T; - - /** - * Faster push + pop - */ - pushpop(x: T): T; - - /** - * Converts the queue to an array, it works with a clone of the queue, so the original queue is untouched - */ - toArray(): T[]; - - /** - * Creates a queue object from the given iterable - */ - static from(iterable: Iterable, options?: I.PriorityQueue.ConstructorOptions): PriorityQueue; - } - - /** - * Represents a faster LRU cache but with less functionality - */ - class FastLRU { - /** - * @param size Cache size, unlimited by default - */ - constructor(size?: number, options?: { - /** - * Function that is called when a value is deleted - */ - dispose?(key: K, value: V): void - }); - - /** - * The actual size of the cache - */ - readonly size: number; - - /** - * Gets the value by the given key - */ - get(key: K): V | undefined; - - /** - * Sets a new value for the given key - */ - set(key: K, value: V): void; - - /** - * Deletes the given key from the cache - */ - delete(key: K): boolean; - - /** - * Checks whether the cache has an element with the given key - */ - has(key: K): boolean; - - /** - * Returns the keys iterator - */ - keys(): IterableIterator; - - /** - * Returns the values iterator - */ - values(): IterableIterator; - - /** - * Returns the entries iterator - */ - entries(): IterableIterator<[K, V]>; - - /** - * Clears the cache - */ - clear(): void; - } - - /** - * Represents a stack - */ - class Stack { - /** - * Whether the stack is empty - */ - readonly empty: boolean; - - /** - * The top element of the stack - */ - readonly top: T; - - /** - * Inserts a new element - */ - push(x: T): this; - - /** - * Removes the top element - */ - pop(): T | undefined; - - /** - * Returns an iterator over the values - */ - [Symbol.iterator](): IterableIterator; - - /** - * Creates a stack and pushed all the values from the given iterable object - */ - static from(iterable: Iterable): Stack; - } - - namespace I.BinarySearchTree { - interface ConstructorOptions { - /** - * The parent tree - */ - parent?: Tree; - - /** - * Value to keep in this node - */ - value?: V; - - /** - * WHether the values must be unique, false by default. - * If false you can store many values for same keys, otherwise only one - */ - unique?: boolean; - - /** - * Custom keys comparator, by default if a > b => -1, a < b -1, a === b => 0 - */ - compareKeys?(a: K, b: K): number; - - /** - * Function that defines whether 2 values are the same, by default a === b - */ - checkValueEquality?(a: V, b: V): boolean; - } - - interface Query { - $lt?: K; - $lte?: K; - $gt?: K; - $gte?: K; - } - } - - /** - * Represents a binary search tree - */ - class BinarySearchTree { - constructor(options?: I.BinarySearchTree.ConstructorOptions>); - - /** - * Returns the max descendant tree - */ - getMaxKeyDescendant(): BinarySearchTree; - - /** - * Returns the maximum key - */ - getMaxKey(): K; - - /** - * Returns the min descendant tree - */ - getMinKeyDescendant(): BinarySearchTree; - - /** - * Returns the minumum key - */ - getMinKey(): K; - - /** - * Traverses the tree and calls the given function for each node - */ - checkAllNodesFullfillCondition(test: (key: K, value: V) => void): void; - - /** - * Checks whether the tree is a binary search tree - */ - checkIsBST(): void; - - /** - * Returns the of keys in the tree - */ - getNumberOfKeys(): number; - - /** - * Inserts a new key/value - */ - insert(key: K, value: V): void; - - /** - * Searches the given key in the tree - */ - search(key: K): V[]; - - /** - * Returns all the values from the given key bounds - */ - betweenBounds(query: I.BinarySearchTree.Query): V[]; - - /** - * Deletes the given key/value from the tree - */ - delete(key: K, value?: V): void; - - /** - * Executed the given callback for each node from left to right - */ - executeOnEveryNode(fn: (tree: BinarySearchTree) => void): void; - - /** - * Prints the tree - */ - prettyPrint(printData?: boolean, spacing?: string): void; - } - - /** - * Represents an AVL tree, a self-balancing binary search tree - */ - class AVLTree { - constructor(options?: I.BinarySearchTree.ConstructorOptions>); - - /** - * Checks whether the tree is an avl tree - */ - checkIsAVLT(): void; - - /** - * Inserts a new key/value - */ - insert(key: K, value: V): void; - - /** - * Deletes the given key/value from the tree - */ - delete(key: K, value?: V): void; - - /** - * Returns the of keys in the tree - */ - getNumberOFKeys(): number; - - /** - * Searches the given key in the tree - */ - search(key: K): V[]; - - /** - * Returns all the values from the given key bounds - */ - betweenBounds(query: I.BinarySearchTree.Query): V[]; - - /** - * Executed the given callback for each node from left to right - */ - executeOnEveryNode(fn: (tree: AVLTree) => void): void; - - /** - * Prints the tree - */ - prettyPrint(printDate?: boolean, spacing?: string): void; - } - - namespace I.RedBlackTree { - interface Node { - /** - * The key associated to the node - */ - key: K; - - /** - * The value associated to the node - */ - value: V; - - /** - * The left subtree of the node - */ - left?: Node; - - /** - * The right subtree of the node - */ - right?: Node; - } - - interface Iterator { - /** - * Checks if the iterator is valid - */ - readonly valid: boolean; - - /** - * The value of the node at the iterator's current position, null if invalid - */ - readonly node: Node | null; - - /** - * The key of the item referenced by the iterator, undefined if invalid - */ - readonly key?: K; - - /** - * The value of the item referenced by the iterator, undefined if invalid - */ - readonly value?: V; - - /** - * Returns the position of this iterator in the sequence - */ - readonly index: number; - - /** - * If true, then the iterator is not at the end of the sequence - */ - readonly hasNext: boolean; - - /** - * If true, then the iterator is not at the beginning of the sequence - */ - readonly hasPrev: boolean; - - /** - * The tree associated to the iterator - */ - tree: RedBlackTree; - - /** - * Makes a copy of the iterator - */ - clone(): Iterator; - - /** - * Removes the item at the position of the iterator and returns a new rb-tree - */ - remove(): RedBlackTree; - - /** - * Advances the iterator to the next position - */ - next(): void; - - /** - * Updates the value of the node in the tree at this iterator and returns a new rb-tree - */ - update(value: V): RedBlackTree; - - /** - * Moves the iterator backward one element - */ - prev(): void; - } - } - - /** - * Represents a fully persistent red-black tree - */ - class RedBlackTree { - /** - * The root node of the tree - */ - root: I.RedBlackTree.Node; - - constructor(compare?: (a: K, b: K) => number, root?: RedBlackTree); - - /** - * A sorted array of all the keys in the tree - */ - readonly keys: K[]; - - /** - * An array of all the values in the tree - */ - readonly values: V[]; - - /** - * The number of items in the tree - */ - readonly length: number; - - /** - * An iterator pointing to the first element in the tree - */ - readonly begin: I.RedBlackTree.Iterator; - - /** - * An iterator pointing to the last element in the tree - */ - readonly end: I.RedBlackTree.Iterator; - - /** - * Creates a new tree with the new pair inserted - */ - insert(key: K, value: V): RedBlackTree; - - /** - * Walks a visitor function over the nodes of the tree in order - * - * @param visit A callback that gets executed on each node. - * If a truthy value is returned from the visitor, then iteration is stopped. - * @param lo An optional start of the range to visit (inclusive) - * @param hi An optional end of the range to visit (non-inclusive) - */ - forEach(visit: (key: K, value: V) => T, lo?: K, hi?: K): T; - - /** - * Finds an iterator starting at the given element - */ - at(idx: number): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is >= key - */ - ge(key: K): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is > key - */ - gt(key: K): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is < key - */ - lt(key: K): I.RedBlackTree.Iterator; - - /** - * Finds the first item in the tree whose key is <= key - */ - le(key: K): I.RedBlackTree.Iterator; - - /** - * Returns an iterator pointing to the first item in the tree with key, otherwise null - */ - find(key: K): I.RedBlackTree.Iterator | null; - - /** - * Removes the first item with key in the tree - */ - remove(key: K): RedBlackTree; - - /** - * Retrieves the value associated to the given key - */ - get(key: K): V | undefined; - } - - /** - * Respresetns a data structure which is a combination of an array and a set. - * Adding a new member is O(1), testing for membership is O(1), - * and finding the index of an element is O(1). - */ - class ArraySet { - /** - * The number of unique items in this ArraySet. - * If duplicates have been added, than those do not count towards the size. - */ - readonly length: number; - - /** - * Adds the given value to this set. - * - * @param allowDuplicates Whether to allow duplicates in the set, false by default - */ - add(value: T, allowDuplicates?: boolean): this; - - /** - * Checks whether the given value is a member of the set - */ - has(value: T): boolean; - - /** - * Returns the index of the given element. - * If the value is not present it will return -1 - */ - indexOf(value: T): number; - - /** - * Converts the set to an array - */ - toArray(): T[]; - - /** - * Creates an ArraySet from the given iterable object - * - * @param allowDuplicates Whether to allow duplicates in the set, false by default - */ - static from(iterable: Iterable, allowDuplicates?: boolean): ArraySet; - } - - namespace I.BufferList { - type Appendable = Buffer | BufferList | string | number | Array; - } - - /** - * Represents a Node.js Buffer list collector, reader and streamer with callback/promise interface support - */ - class BufferList extends std.stream.Duplex implements PromiseLike { - /** - * Creates a new buffer list - */ - constructor(); - - /** - * Creates a new buffer list and initiates with the given value - */ - constructor(buffer: I.BufferList.Appendable); - - /** - * Creates a new buffer list and subscribes the given callback on the end/error event - */ - constructor(callback: (err: any, data: Buffer) => void); - - /** - * Adds an additional buffer or BufferList to the internal list - */ - append(buf: I.BufferList.Appendable): this; - - /** - * Ends the stream - */ - end(chunk?: Buffer): void; - end(chunk?: () => void): void; - - /** - * Returns the byte at the specified index - */ - get(idx: number): number; - - /** - * Returns a new Buffer object containing the bytes within the range specified. - */ - slice(start?: number, end?: number): Buffer; - - /** - * Copies the content of the list in the dest buffer - * starting from destStart and containing the bytes within the range specified with srcStart to srcEnd - * - * @param dstStart writes from this position - * @param srcStart reads bytes from this position - * @param srcEnd read bytes to this position - */ - copy(dst: T, dstStart?: number, srcStart?: number, srcEnd?: number): T; - - /** - * Returns a new BufferList object containing the bytes within the range specified. - * No copies will be performed. All buffers in the result share memory with the original list. - * - * @param start slice from - * @param end slice to - */ - shallowSlice(start?: number, end?: number): BufferList; - - /** - * Return a string representation of the buffer - */ - toString(encoding?: fs.I.Encoding, start?: number, end?: number): string; - - /** - * Shifts bytes off the start of the list - */ - consume(bytes: number): this; - - /** - * Performs a shallow-copy of the list. - */ - duplicate(): BufferList; - - /** - * Destroys the stream - */ - destroy(): void; - - then( - onfulfilled?: ((value: Buffer) => T1 | PromiseLike) | null, - onrejected?: ((reason: any) => T2 | PromiseLike) | null - ): PromiseLike; - - catch(onrejected?: ((reason: any) => T | PromiseLike) | null): PromiseLike; - } - - /** - * Represents a Map that has a default values factory object or function. - * Each get of non-existent key goes through the factory - */ - class DefaultMap extends Map { - constructor(factory?: ((key: K) => V) | { [key: string]: V }, iterable?: Iterable<[K, V]>); - } - - namespace I.LRU { - type LengthCalculator = (value: V, key: K) => number; - interface ConstructorOptions { - /** - * The maximum size of the cache, checked by applying the length function to all values in the cache. - * Default is Infinity - */ - max?: number; - - /** - * Maximum age in ms. Items are not pro-actively pruned out as they age, - * but if you try to get an item that is too old, - * it'll drop it and return undefined instead of giving it to you - */ - maxAge?: number; - - /** - * Function that is used to calculate the length of stored items - */ - length?: LengthCalculator; - - /** - * Function that is called on items when they are dropped from the cache - */ - dispose?(key: K, value: V): void; - - /** - * Whether to return the stale value before deleting it - */ - stale?: boolean; - - /** - * Dispose will only be called when a key falls out of the cache, not when it is overwritten - */ - noDisposeOnSet?: boolean; - } - - interface SerializedEntry { - /** - * key - */ - key: K; - - /** - * value - */ - value: V; - - /** - * when it becomes expired - */ - e: number; - } - - interface Entry { - /** - * key - */ - key: K; - - /** - * value - */ - value: V; - - /** - * entry length - */ - length: number; - - /** - * Timestamp when the entry was created - */ - now: number; - - /** - * Maximum live time - */ - maxAge: number; - } - } - - /** - * Represent an LRU cache - */ - class LRU { - /** - * Creates an LRU cache of the given size - */ - constructor(max: number); - - /** - * Creates an LRU cache with the given options - */ - constructor(options?: I.LRU.ConstructorOptions); - - /** - * The length of the cache, setter resizes the cache - */ - max: number; - - /** - * stale setting - */ - allowStale: boolean; - - /** - * maxAge setting - */ - maxAge: number; - - /** - * length setting - */ - lengthCalculator: I.LRU.LengthCalculator; - - /** - * Total length of objects in cache taking into account length options function - */ - readonly length: number; - - /** - * Total quantity of objects currently in cache. - * Note, that stale items are returned as part of this item count. - */ - readonly itemCount: number; - - /** - * Iterates over all the keys in the cache, in reverse recent-ness order. (ie, less recently used items are iterated over first.) - */ - rforEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; - - /** - * Iterates over all the keys in the cache, in order of recent-ness - */ - forEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; - - /** - * Returns an array of the keys in the cache - */ - keys(): K[]; - - /** - * Returns an array of the values in the cache - */ - values(): V[]; - - /** - * Clears the cache entirely, throwing away all values - */ - reset(): void; - - /** - * Return an array of the cache entries ready for serialization and usage with 'destinationCache.load(arr)` - */ - dump(): Array>; - - /** - * Returns an internal lru list of entries - */ - dumpLru(): LinkedList>; - - /** - * @param opts std.util.inspect options - */ - inspect(opts?: object): string; - - /** - * Sets a new value for the given key. Updates the "recently used"-ness of the key - * - * @param maxAge maxAge option specific for this key - * @returns Whether the key was set - */ - set(key: K, value: V, maxAge?: number): boolean; - - /** - * Check if a key is in the cache, without updating the recent-ness or deleting it for being stale - */ - has(key: K): boolean; - - /** - * Gets the value of the given key. Updates the "recently used"-ness of the key - */ - get(key: K): V | undefined; - - /** - * Returns the key value without updating the "recently used"-ness of the key - */ - peek(key: K): V | undefined; - - /** - * Deletes the less recently used element - */ - pop(): I.LRU.Entry; - - /** - * Deletes a key out of the cache - */ - del(key: K): void; - - /** - * Loads another cache entries array, obtained with sourceCache.dump(), into the cache. - * The destination cache is reset before loading new entries - */ - load(arr: Array>): void; - - /** - * Manually iterates over the entire cache proactively pruning old entries - */ - prune(): void; - } - - /** - * Represents a Map that keeps keys only for a specified interval of time - */ - class TimedoutMap extends Map { - /** - * @param timeout maximum age of the keys, 1000 by default - * @param callback callback that is called with each key when the timeout is passed - */ - constructor(timeout?: number, callback?: (key: K) => void); - - /** - * Gets the timeout - */ - getTimeout(): number; - - /** - * Sets the timeout - */ - setTimeout(ms: number): void; - - /** - * Iterates over the map and calls the callback for each element - */ - forEach(callback: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): this; - - /** - * Deletes the given key - */ - delete(key: K): boolean; - } - } -} diff --git a/types/adone/glosses/collections/array_set.d.ts b/types/adone/glosses/collections/array_set.d.ts new file mode 100644 index 0000000000..c13d8769f1 --- /dev/null +++ b/types/adone/glosses/collections/array_set.d.ts @@ -0,0 +1,44 @@ +declare namespace adone.collection { + /** + * Respresetns a data structure which is a combination of an array and a set. + * Adding a new member is O(1), testing for membership is O(1), + * and finding the index of an element is O(1). + */ + class ArraySet { + /** + * The number of unique items in this ArraySet. + * If duplicates have been added, than those do not count towards the size. + */ + readonly length: number; + + /** + * Adds the given value to this set. + * + * @param allowDuplicates Whether to allow duplicates in the set, false by default + */ + add(value: T, allowDuplicates?: boolean): this; + + /** + * Checks whether the given value is a member of the set + */ + has(value: T): boolean; + + /** + * Returns the index of the given element. + * If the value is not present it will return -1 + */ + indexOf(value: T): number; + + /** + * Converts the set to an array + */ + toArray(): T[]; + + /** + * Creates an ArraySet from the given iterable object + * + * @param allowDuplicates Whether to allow duplicates in the set, false by default + */ + static from(iterable: Iterable, allowDuplicates?: boolean): ArraySet; + } +} diff --git a/types/adone/glosses/collections/async_queue.d.ts b/types/adone/glosses/collections/async_queue.d.ts new file mode 100644 index 0000000000..9a575a33be --- /dev/null +++ b/types/adone/glosses/collections/async_queue.d.ts @@ -0,0 +1,12 @@ +declare namespace adone.collection { + /** + * Represents an asynchronous queue, each pop is a promise + * that is resolved with an existing element or an element that will be pushed in the future + */ + class AsyncQueue extends Queue> { + /** + * Returns a promise that will be resolved with an existing element or an element that will be pushed in the future + */ + pop(): Promise; + } +} diff --git a/types/adone/glosses/collections/avl_tree.d.ts b/types/adone/glosses/collections/avl_tree.d.ts new file mode 100644 index 0000000000..2b5dc132b6 --- /dev/null +++ b/types/adone/glosses/collections/avl_tree.d.ts @@ -0,0 +1,48 @@ +declare namespace adone.collection { + /** + * Represents an AVL tree, a self-balancing binary search tree + */ + class AVLTree { + constructor(options?: I.BinarySearchTree.ConstructorOptions>); + + /** + * Checks whether the tree is an avl tree + */ + checkIsAVLT(): void; + + /** + * Inserts a new key/value + */ + insert(key: K, value: V): void; + + /** + * Deletes the given key/value from the tree + */ + delete(key: K, value?: V): void; + + /** + * Returns the of keys in the tree + */ + getNumberOFKeys(): number; + + /** + * Searches the given key in the tree + */ + search(key: K): V[]; + + /** + * Returns all the values from the given key bounds + */ + betweenBounds(query: I.BinarySearchTree.Query): V[]; + + /** + * Executed the given callback for each node from left to right + */ + executeOnEveryNode(fn: (tree: AVLTree) => void): void; + + /** + * Prints the tree + */ + prettyPrint(printDate?: boolean, spacing?: string): void; + } +} diff --git a/types/adone/glosses/collections/binary_search_tree.d.ts b/types/adone/glosses/collections/binary_search_tree.d.ts new file mode 100644 index 0000000000..878bd7e6a4 --- /dev/null +++ b/types/adone/glosses/collections/binary_search_tree.d.ts @@ -0,0 +1,110 @@ +declare namespace adone.collection { + namespace I.BinarySearchTree { + interface ConstructorOptions { + /** + * The parent tree + */ + parent?: Tree; + + /** + * Value to keep in this node + */ + value?: V; + + /** + * WHether the values must be unique, false by default. + * If false you can store many values for same keys, otherwise only one + */ + unique?: boolean; + + /** + * Custom keys comparator, by default if a > b => -1, a < b -1, a === b => 0 + */ + compareKeys?(a: K, b: K): number; + + /** + * Function that defines whether 2 values are the same, by default a === b + */ + checkValueEquality?(a: V, b: V): boolean; + } + + interface Query { + $lt?: K; + $lte?: K; + $gt?: K; + $gte?: K; + } + } + + /** + * Represents a binary search tree + */ + class BinarySearchTree { + constructor(options?: I.BinarySearchTree.ConstructorOptions>); + + /** + * Returns the max descendant tree + */ + getMaxKeyDescendant(): BinarySearchTree; + + /** + * Returns the maximum key + */ + getMaxKey(): K; + + /** + * Returns the min descendant tree + */ + getMinKeyDescendant(): BinarySearchTree; + + /** + * Returns the minumum key + */ + getMinKey(): K; + + /** + * Traverses the tree and calls the given function for each node + */ + checkAllNodesFullfillCondition(test: (key: K, value: V) => void): void; + + /** + * Checks whether the tree is a binary search tree + */ + checkIsBST(): void; + + /** + * Returns the of keys in the tree + */ + getNumberOfKeys(): number; + + /** + * Inserts a new key/value + */ + insert(key: K, value: V): void; + + /** + * Searches the given key in the tree + */ + search(key: K): V[]; + + /** + * Returns all the values from the given key bounds + */ + betweenBounds(query: I.BinarySearchTree.Query): V[]; + + /** + * Deletes the given key/value from the tree + */ + delete(key: K, value?: V): void; + + /** + * Executed the given callback for each node from left to right + */ + executeOnEveryNode(fn: (tree: BinarySearchTree) => void): void; + + /** + * Prints the tree + */ + prettyPrint(printData?: boolean, spacing?: string): void; + } +} diff --git a/types/adone/glosses/collections/buffer_list.d.ts b/types/adone/glosses/collections/buffer_list.d.ts new file mode 100644 index 0000000000..b2a4157385 --- /dev/null +++ b/types/adone/glosses/collections/buffer_list.d.ts @@ -0,0 +1,92 @@ +declare namespace adone.collection { + namespace I.BufferList { + type Appendable = Buffer | BufferList | string | number | Array; + } + + /** + * Represents a Node.js Buffer list collector, reader and streamer with callback/promise interface support + */ + class BufferList extends std.stream.Duplex implements PromiseLike { + /** + * Creates a new buffer list + */ + constructor(); + + /** + * Creates a new buffer list and initiates with the given value + */ + constructor(buffer: I.BufferList.Appendable); + + /** + * Creates a new buffer list and subscribes the given callback on the end/error event + */ + constructor(callback: (err: any, data: Buffer) => void); + + /** + * Adds an additional buffer or BufferList to the internal list + */ + append(buf: I.BufferList.Appendable): this; + + /** + * Ends the stream + */ + end(chunk?: Buffer): void; + end(chunk?: () => void): void; + + /** + * Returns the byte at the specified index + */ + get(idx: number): number; + + /** + * Returns a new Buffer object containing the bytes within the range specified. + */ + slice(start?: number, end?: number): Buffer; + + /** + * Copies the content of the list in the dest buffer + * starting from destStart and containing the bytes within the range specified with srcStart to srcEnd + * + * @param dstStart writes from this position + * @param srcStart reads bytes from this position + * @param srcEnd read bytes to this position + */ + copy(dst: T, dstStart?: number, srcStart?: number, srcEnd?: number): T; + + /** + * Returns a new BufferList object containing the bytes within the range specified. + * No copies will be performed. All buffers in the result share memory with the original list. + * + * @param start slice from + * @param end slice to + */ + shallowSlice(start?: number, end?: number): BufferList; + + /** + * Return a string representation of the buffer + */ + toString(encoding?: fs.I.Encoding, start?: number, end?: number): string; + + /** + * Shifts bytes off the start of the list + */ + consume(bytes: number): this; + + /** + * Performs a shallow-copy of the list. + */ + duplicate(): BufferList; + + /** + * Destroys the stream + */ + destroy(): void; + + then( + onfulfilled?: ((value: Buffer) => T1 | PromiseLike) | null, + onrejected?: ((reason: any) => T2 | PromiseLike) | null + ): PromiseLike; + + catch(onrejected?: ((reason: any) => T | PromiseLike) | null): PromiseLike; + } +} diff --git a/types/adone/glosses/collections/byte_array.d.ts b/types/adone/glosses/collections/byte_array.d.ts new file mode 100644 index 0000000000..1dc3080fb3 --- /dev/null +++ b/types/adone/glosses/collections/byte_array.d.ts @@ -0,0 +1,892 @@ +declare namespace adone.collection { + namespace I { + type Long = math.Long; + + type Longable = math.I.Longable; + + namespace ByteArray { + interface Varint32 { + value: number; + length: number; + } + + interface Varint64 { + value: Long; + length: number; + } + + interface String { + string: string; + length: number; + } + + type Wrappable = string | ByteArray | Buffer | Uint8Array | ArrayBuffer; + + type Metrics = "b" | "c"; + } + } + + /** + * Represents an array of bytes, enhanced Node.js Buffer + */ + class ByteArray { + readonly woffset: number; + + readonly roffset: number; + + readonly buffer: Buffer; + + readonly noAssert: boolean; + + /** + * Constructs a new ByteArray + * + * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + constructor(capacity?: number, noAssert?: boolean); + + /** + * Reads a BitSet as an array of booleans. + * + * @param offset Offset to read from. Will use and increase offset by length if omitted. + */ + readBitSet(offset?: number): boolean[]; + + /** + * Reads the specified number of bytes. + * + * @param length Number of bytes to read + * @param offset Offset to read from. Will use and increase offset by length if omitted. + */ + read(length: number, offset?: number): ByteArray; + + /** + * Reads an 8bit signed integer + * + * @param offset Offset to read from + */ + readInt8(offset?: number): number; + + /** + * Reads an 8bit unsigned integer + * + * @param offset Offset to read from + */ + readUInt8(offset?: number): number; + + /** + * Reads a 16bit signed le integer + * + * @param offset Offset to read from + */ + readInt16LE(offset?: number): number; + + /** + * Reads a 16bit unsigned le integer + * + * @param offset Offset to read from + */ + readUInt16LE(offset?: number): number; + + /** + * Reads a 16bit signed be integer + * + * @param offset Offset to read from + */ + readInt16BE(offset?: number): number; + + /** + * Reads a 16bit unsigned be integer + * + * @param offset Offset to read from + */ + readUInt16BE(offset?: number): number; + + /** + * Reads a 32bit signed le integer + * + * @param offset Offset to read from + */ + readInt32LE(offset?: number): number; + + /** + * Reads a 32bit unsigned le integer + * + * @param offset Offset to read from + */ + readUInt32LE(offset?: number): number; + + /** + * Reads a 32bit signed be integer + * + * @param offset Offset to read from + */ + readInt32BE(offset?: number): number; + + /** + * Reads a 32bit unsigned be integer + * + * @param offset Offset to read from + */ + readUInt32BE(offset?: number): number; + + /** + * Reads a 64bit signed le integer as math.Long + * + * @param offset Offset to read from + */ + readInt64LE(offset?: number): math.Long; + + /** + * Reads a 64bit unsigned le integer as math.Long + * + * @param offset Offset to read from + */ + readUInt64LE(offset?: number): math.Long; + + /** + * Reads a 64bit signed be integer as math.Long + * + * @param offset Offset to read from + */ + readInt64BE(offset?: number): math.Long; + + /** + * Reads a 64bit unsigned be integer as math.Long + * + * @param offset Offset to read from + */ + readUInt64BE(offset?: number): math.Long; + + /** + * Reads a 32bit le float + * + * @param offset Offset to read from + */ + readFloatLE(offset?: number): number; + + /** + * Reads a 32bit be float + * + * @param offset Offset to read from + */ + readFloatBE(offset?: number): number; + + /** + * Reads a 64bit le float + * + * @param offset Offset to read from + */ + readDoubleLE(offset?: number): number; + + /** + * Reads a 64bit be float + * + * @param offset Offset to read from + */ + readDoubleBE(offset?: number): number; + + /** + * Appends some data to this ByteArray. + * This will overwrite any contents behind the specified offset up to the appended data's length. + * + * @param source The source write from + * @param offset Offset to write at + * @param length length to read from the source + * @param encoding encoding to use for wrapping the source in bytearray + */ + write(source: I.ByteArray.Wrappable, offset?: number, length?: number, encoding?: string): this; + + /** + * Writes the array as a bitset. + * @param value Array of booleans to write + */ + writeBitSet(value: number[]): this; + + /** + * Writes the array as a bitset. + * @param value Array of booleans to write + * @param offset Offset to write at + */ + writeBitSet(value: number[], offset: number): number; + + /** + * Writes a buffer at the given offset + * @param buf Buffer to write + * @param offset Offset to write at + */ + writeBuffer(buf: Buffer, offset?: number): this; + + /** + * Writes an 8bit signed integer + * + * @param offset Offset to write at + */ + writeInt8(value: number, offset?: number): this; + + /** + * Writes an 8bit unsigned integer + * + * @param offset Offset to write at + */ + writeUInt8(value: number, offset?: number): this; + + /** + * Writes a 16bit signed le integer + * + * @param offset Offset to write at + */ + writeInt16LE(value: number, offset?: number): this; + + /** + * Writes a 16bit signed be integer + * + * @param offset Offset to write at + */ + writeInt16BE(value: number, offset?: number): this; + + /** + * Writes a 16bit unsigned le integer + * + * @param offset Offset to write at + */ + writeUInt16LE(value: number, offset?: number): this; + + /** + * Writes a 16bit unsigned be integer + * + * @param offset Offset to write at + */ + writeUInt16BE(value: number, offset?: number): this; + + /** + * Writes a 32bit signed le integer + * + * @param offset Offset to write at + */ + writeInt32LE(value: number, offset?: number): this; + + /** + * Writes a 32bit signed be integer + * + * @param offset Offset to write at + */ + writeInt32BE(value: number, offset?: number): this; + + /** + * Writes a 32bit unsigned le integer + * + * @param offset Offset to write at + */ + writeUInt32LE(value: number, offset?: number): this; + + /** + * Writes a 32bit unsigned be integer + * + * @param offset Offset to write at + */ + writeUInt32BE(value: number, offset?: number): this; + + /** + * Writes a 64bit signed le long integer + * + * @param offset Offset to write at + */ + writeInt64LE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 64bit signed be long integer + * + * @param offset Offset to write at + */ + writeInt64BE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 64bit unsigned le long integer + * + * @param offset Offset to write at + */ + writeUInt64LE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 64bit unsigned be long integer + * + * @param offset Offset to write at + */ + writeUInt64BE(value: math.Long | string | number, offset?: number): this; + + /** + * Writes a 32bit le float + * + * @param offset Offset to write at + */ + writeFloatLE(value: number, offset?: number): this; + + /** + * Writes a 32bit be float + * + * @param offset Offset to write at + */ + writeFloatBE(value: number, offset?: number): this; + + /** + * Writes a 64bit le float + * + * @param offset Offset to write at + */ + writeDoubleLE(value: number, offset?: number): this; + + /** + * Writes a 64bit be float + * + * @param offset Offset to write at + */ + writeDoubleBE(value: number, offset?: number): this; + + /** + * Writes a 32bit base 128 variable-length integer + */ + writeVarint32(value: number): this; + + /** + * Writes a 32bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint32(value: number, offset: number): number; + + /** + * Writes a zig-zag encoded 32bit base 128 variable-length integer + */ + writeVarint32ZigZag(value: number): this; + + /** + * Writes a zig-zag encoded 32bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint32ZigZag(value: number, offset: number): number; + + /** + * Reads a 32bit base 128 variable-length integer + */ + readVarint32(): number; + + /** + * Reads a 32bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint32(offset: number): I.ByteArray.Varint32; + + /** + * Reads a zig-zag encoded 32bit base 128 variable-length integer + */ + readVarint32ZigZag(): number; + + /** + * Reads a zig-zag encoded 32bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint32ZigZag(offset: number): I.ByteArray.Varint32; + + /** + * Writes a 64bit base 128 variable-length integer + */ + writeVarint64(value: math.Long | string | number): this; + + /** + * Writes a 64bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint64(value: math.Long | string | number, offset: number): number; + + /** + * Writes a zig-zag encoded 64bit base 128 variable-length integer + */ + writeVarint64ZigZag(value: math.Long | string | number): this; + + /** + * Writes a zig-zag encoded 64bit base 128 variable-length integer + * + * @param offset Offset to write at + */ + writeVarint64ZigZag(value: math.Long | string | number, offset: number): number; + + /** + * Reads a 64bit base 128 variable-length integer + */ + readVarint64(): I.Long; + + /** + * Reads a 64bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint64(offset: number): I.ByteArray.Varint64; + + /** + * Reads a zig-zag encoded 64bit base 128 variable-length integer + */ + readVarint64ZigZag(): math.Long; + + /** + * Reads a zig-zag encoded 64bit base 128 variable-length integer + * + * @param offset Offset to read from + */ + readVarint64ZigZag(offset: number): I.ByteArray.Varint64; + + /** + * Writes a NULL-terminated UTF8 encoded string. + * For this to work the specified string must not contain any NULL characters itself + */ + writeCString(str: string): this; + + /** + * Writes a NULL-terminated UTF8 encoded string. + * For this to work the specified string must not contain any NULL characters itself + * + * @param offset Offset to write at + */ + writeCString(str: string, offset: number): number; + + /** + * Reads a NULL-terminated UTF8 encoded string. + * For this to work the string read must not contain any NULL characters itself + */ + readCString(): string; + + /** + * Reads a NULL-terminated UTF8 encoded string. + * For this to work the string read must not contain any NULL characters itself + * + * @param offset Offset to read from + */ + readCString(offset: number): I.ByteArray.String; + + /** + * Writes an UTF8 encoded string + */ + writeString(str: string): this; + + /** + * Writes an UTF8 encoded string + * + * @param offset Offset to write at + */ + writeString(str: string, offset: number): number; + + /** + * Reads an UTF8 encoded string + * + * @param length Number of characters or bytes to read + * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") + */ + readString(length: number, metrics?: I.ByteArray.Metrics): string; + + /** + * Reads an UTF8 encoded string + * + * @param length Number of characters or bytes to read + * @param metrics Metrics specifying what n is meant to count. Defaults to ByteArray.METRICS_CHARS("c") + * @param offset Offset to read from + */ + readString(length: number, metrics: I.ByteArray.Metrics, offset: number): I.ByteArray.String; + + /** + * Reads an UTF8 encoded string + * + * @param length Number of characters or bytes to read + * @param offset Offset to read from + */ + readString(length: number, offset: number): I.ByteArray.String; + + /** + * Writes a length as varint32 prefixed UTF8 encoded string + */ + writeVString(str: string): this; + + /** + * Writes a length as varint32 prefixed UTF8 encoded string + * + * @param offset Offset to read from + */ + writeVString(str: string, offset: number): number; + + /** + * Reads a length as varint32 prefixed UTF8 encoded string + */ + readVString(): string; + + /** + * Reads a length as varint32 prefixed UTF8 encoded string + * + * @param offset Offset to read from + */ + readVString(offset: number): I.ByteArray.String; + + /** + * Appends this ByteArray's contents to another ByteArray. + * This will overwrite any contents behind the specified offset up to the length of this ByteArray's data + * + * @param offset Offset to append to + */ + appendTo(target: ByteArray, offset?: number): this; + + /** + * Enables or disables assertions of argument types and offsets. + * Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid + */ + assert(assert?: boolean): this; + + /** + * Gets the capacity of this ByteArray's backing buffer + */ + capacity(): number; + + /** + * Clears this ByteArray's offsets by setting offset to 0 and limit to the backing buffer's capacity + */ + clear(): this; + + /** + * Creates a cloned instance of this ByteArray, + * preset with this ByteArray's values for offset, markedOffset and limit + * + * @param copy Whether to copy the backing buffer or to return another view on the same, false by default + */ + clone(copy?: boolean): ByteArray; + + /** + * Compacts this ByteArray to be backed by a buffer of its contents' length. + * Will set offset = 0 and limit = capacity and adapt markedOffset to the same relative position if set + * + * @param begin Offset to start at, buffer offset by default + * @param end Offset to end at, buffer limit by default + */ + compact(begin?: number, end?: number): this; + + /** + * Creates a copy of this ByteArray's contents. + * + * @param begin Begin offset, buffer offset by default + * @param end End offset, buffer limit by default + */ + copy(begin?: number, end?: number): ByteArray; + + /** + * Copies this ByteArray's contents to another ByteArray. + * + * @param targetOffset Offset to copy to. Will use and increase the target's offset by the number of bytes copied if omitted + * @param sourceOffset Offset to start copying from. Will use and increase offset by the number of bytes copied if omitted + * @param sourceLimit Offset to end copying from, defaults to the buffer limit + */ + copyTo(target: ByteArray, targetOffset?: number, souceOffset?: number, sourceLimit?: number): this | ByteArray; + + /** + * Makes sure that this ByteArray is backed by a ByteArray#buffer of at least the specified capacity. + * If the current capacity is exceeded, it will be doubled. + * If double the current capacity is less than the required capacity, the required capacity will be used instead + */ + ensureCapacity(capacity: number): this; + + /** + * Overwrites this ByteArray's contents with the specified value. + * + * @param value Byte value to fill with. If given as a string, the first character is used + * @param begin Begin offset. Will use and increase offset by the number of bytes written if omitted. defaults to offset + * @param end End offset, defaults to limit. + */ + fill(value: string | number, begin?: number, end?: number): this; + + /** + * Makes this ByteArray ready for a new sequence of write or relative read operations. + * Sets limit = offset and offset = 0. + * Make sure always to flip a ByteArray when all relative read or write operations are complete + */ + flip(): this; + + /** + * Marks an offset on this ByteArray to be used later + * + * @param offset Offset to mark. Defaults to offset. + */ + mark(offset?: number): this; + + /** + * Prepends some data to this ByteArray. + * This will overwrite any contents before the specified offset up to the prepended data's length. + * If there is not enough space available before the specified offset, + * the backing buffer will be resized and its contents moved accordingly + * + * @param source Data to prepend + * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. + */ + prepend(source: I.ByteArray.Wrappable, offset: number): this; + + /** + * Prepends some data to this ByteArray. + * This will overwrite any contents before the specified offset up to the prepended data's length. + * If there is not enough space available before the specified offset, + * the backing buffer will be resized and its contents moved accordingly + * + * @param source Data to prepend + * @param encoding Encoding if data is a string + * @param offset Offset to prepend at. Will use and decrease offset by the number of bytes prepended if omitted. + */ + prepend(source: I.ByteArray.Wrappable, encoding?: string, offset?: number): this; + + /** + * Prepends this ByteArray to another ByteArray. + * This will overwrite any contents before the specified offset up to the prepended data's length. + * If there is not enough space available before the specified offset, + * the backing buffer will be resized and its contents moved accordingly + * + * @param offset Offset to prepend at + */ + prependTo(target: ByteArray, offset?: number): this; + + /** + * Gets the number of remaining readable bytes + */ + remaining(): number; + + /** + * Resets this ByteArray's offset. + * If an offset has been marked through mark before, offset will be set to markedOffset, which will then be discarded. + * If no offset has been marked, sets offset = 0 + */ + reset(): this; + + /** + * Resizes this ByteArray to be backed by a buffer of at least the given capacity. + * Will do nothing if already that large or larger. + * + * @param capacity Capacity required + */ + resize(capacity: number): this; + + /** + * Reverses this ByteArray's contents. + * + * @param begin Offset to start at, defaults to offset + * @param end Offset to end at, defaults to limit + */ + reverse(begin?: number, end?: number): this; + + /** + * Skips the next length bytes. This will just advance + */ + skip(length: number): this; + + /** + * Slices this ByteArray by creating a cloned instance with offset = begin and limit = end + * + * @param begin Begin offset, defaults to offset + * @param end End offset, defaults to limit + */ + slice(begin?: number, end?: number): ByteArray; + + /** + * Returns a copy of the backing buffer that contains this ByteArray's contents. + * + * @param forceCopy If true returns a copy, otherwise returns a view referencing the same memory if possible, false by default + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toBuffer(forceCopy?: boolean, begin?: number, end?: number): Buffer; + + /** + * Returns a raw buffer compacted to contain this ByteArray's contents + */ + toArrayBuffer(): ArrayBuffer; + + /** + * Converts the ByteArray's contents to a string + * + * @param encoding Output encoding + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toString(encoding?: string, begin?: number, end?: number): string; + + /** + * Encodes this ByteArray's contents to a base64 encoded string + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toBase64(begin?: number, end?: number): string; + + /** + * Encodes this ByteArray to a binary encoded string, that is using only characters 0x00-0xFF as bytes + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toBinary(begin?: number, end?: number): string; + + /** + * Encodes this ByteArray to a hex encoded string with marked offsets + * + * @param columns If true returns two columns hex + ascii, defaults to false + */ + toDebug(columns?: boolean): string; + + /** + * Encodes this ByteArray's contents to a hex encoded string + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toHex(begin?: number, end?: number): string; + + /** + * Encodes this ByteArray's contents to an UTF8 encoded string + * + * @param begin Begin offset, offset by default + * @param end End offset, limit by default + */ + toUTF8(begin?: number, end?: number): string; + + static accessor(): typeof Buffer; + + /** + * Allocates a new ByteArray backed by a buffer of the specified capacity. + * + * @param capacity Initial capacity. Defaults to ByteArray.DEFAULT_CAPACITY(64) + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + static allocate(capacity?: number, noAssert?: boolean): ByteArray; + + /** + * Concatenates multiple ByteArrays into one + * + * @param encoding Encoding for strings + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + static concat(buffers: I.ByteArray.Wrappable[], encoding?: string, noAssert?: boolean): ByteArray; + + static type(): typeof Buffer; + + /** + * Wraps a buffer or a string. + * Sets the allocated ByteArray's offset to 0 and its limit to the length of the wrapped data + * + * @param encoding Encoding for strings + * @param noAssert Whether to skip assertions of offsets and values. Defaults to ByteArray.DEFAULT_NOASSERT(false) + */ + static wrap(buffer: I.ByteArray.Wrappable, encoding?: string, noAssert?: boolean): ByteArray; + + /** + * Calculates the actual number of bytes required to store a 32bit base 128 variable-length integer + */ + static calculateVarint32(value: number): number; + + /** + * Zigzag encodes a signed 32bit integer so that it can be effectively used with varint encoding + */ + static zigZagEncode32(n: number): number; + + /** + * Decodes a zigzag encoded signed 32bit integer + */ + static zigZagDecode32(n: number): number; + + /** + * Calculates the actual number of bytes required to store a 64bit base 128 variable-length integer + */ + static calculateVarint64(value: number | string): number; + + /** + * Zigzag encodes a signed 64bit integer so that it can be effectively used with varint encoding + */ + static zigZagEncode64(value: number | string | I.Long): I.Long; + + /** + * Decodes a zigzag encoded signed 64bit integer. + */ + static zigZagDecode64(value: number | string | I.Long): I.Long; + + /** + * Calculates the number of UTF8 characters of a string. + * JavaScript itself uses UTF-16, + * so that a string's length property does not reflect its actual UTF8 size if it contains code points larger than 0xFFFF + */ + static calculateUTF8Chars(str: string): number; + + /** + * Calculates the number of UTF8 bytes of a string. + */ + static calculateString(str: string): number; + + /** + * Decodes a base64 encoded string to a ByteArray + */ + static fromBase64(str: string): ByteArray; + + /** + * Encodes a binary string to base64 like window.btoa does + */ + static btoa(str: string): string; + + /** + * Decodes a base64 encoded string to binary like window.atob does + */ + static atob(b64: string): string; + + /** + * Decodes a binary encoded string, that is using only characters 0x00-0xFF as bytes, to a ByteArray + */ + static fromBinary(str: string): ByteArray; + + /** + * Decodes a hex encoded string with marked offsets to a ByteArray + */ + static fromDebug(str: string, noAssert?: boolean): ByteArray; + + /** + * Decodes a hex encoded string to a ByteArray + */ + static fromHex(str: string, noAssert?: boolean): ByteArray; + + /** + * Decodes an UTF8 encoded string to a ByteArray + */ + static fromUTF8(str: string, noAssert?: boolean): ByteArray; + + /** + * Default initial capacity + */ + static DEFAULT_CAPACITY: number; + + /** + * Default no assertions flag + */ + static DEFAULT_NOASSERT: boolean; + + /** + * Maximum number of bytes required to store a 32bit base 128 variable-length integer + */ + static MAX_VARINT32_BYTES: number; + + /** + * Maximum number of bytes required to store a 64bit base 128 variable-length integer + */ + static MAX_VARINT64_BYTES: number; + + /** + * Metrics representing number of UTF8 characters. Evaluates to `c`. + */ + static METRICS_CHARS: string; + + /** + * Metrics representing number of bytes. Evaluates to `b`. + */ + static METRICS_BYTES: string; + } +} diff --git a/types/adone/glosses/collections/default_map.d.ts b/types/adone/glosses/collections/default_map.d.ts new file mode 100644 index 0000000000..46b8ccebfe --- /dev/null +++ b/types/adone/glosses/collections/default_map.d.ts @@ -0,0 +1,9 @@ +declare namespace adone.collection { + /** + * Represents a Map that has a default values factory object or function. + * Each get of non-existent key goes through the factory + */ + class DefaultMap extends Map { + constructor(factory?: ((key: K) => V) | { [key: string]: V }, iterable?: Iterable<[K, V]>); + } +} diff --git a/types/adone/glosses/collections/fast_lru.d.ts b/types/adone/glosses/collections/fast_lru.d.ts new file mode 100644 index 0000000000..e991322bc0 --- /dev/null +++ b/types/adone/glosses/collections/fast_lru.d.ts @@ -0,0 +1,61 @@ +declare namespace adone.collection { + /** + * Represents a faster LRU cache but with less functionality + */ + class FastLRU { + /** + * @param size Cache size, unlimited by default + */ + constructor(size?: number, options?: { + /** + * Function that is called when a value is deleted + */ + dispose?(key: K, value: V): void + }); + + /** + * The actual size of the cache + */ + readonly size: number; + + /** + * Gets the value by the given key + */ + get(key: K): V | undefined; + + /** + * Sets a new value for the given key + */ + set(key: K, value: V): void; + + /** + * Deletes the given key from the cache + */ + delete(key: K): boolean; + + /** + * Checks whether the cache has an element with the given key + */ + has(key: K): boolean; + + /** + * Returns the keys iterator + */ + keys(): IterableIterator; + + /** + * Returns the values iterator + */ + values(): IterableIterator; + + /** + * Returns the entries iterator + */ + entries(): IterableIterator<[K, V]>; + + /** + * Clears the cache + */ + clear(): void; + } +} diff --git a/types/adone/glosses/collections/index.d.ts b/types/adone/glosses/collections/index.d.ts new file mode 100644 index 0000000000..234ffe85f4 --- /dev/null +++ b/types/adone/glosses/collections/index.d.ts @@ -0,0 +1,28 @@ +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// + +declare namespace adone { + /** + * Data structures + */ + namespace collection { + // + } +} diff --git a/types/adone/glosses/collections/linked_list.d.ts b/types/adone/glosses/collections/linked_list.d.ts new file mode 100644 index 0000000000..69ffa4da4b --- /dev/null +++ b/types/adone/glosses/collections/linked_list.d.ts @@ -0,0 +1,150 @@ +declare namespace adone.collection { + namespace I.LinkedList { + /** + * Represents the node of a linked list + */ + interface Node { + /** + * The next node + */ + next?: Node; + + /** + * The previous node + */ + prev?: Node; + + /** + * The value this node contains + */ + value: T; + } + } + + /** + * Represents a linked list + */ + class LinkedList { + /** + * The maximum length of the list + */ + readonly maxLength: number; + + /** + * Current length of the list + */ + readonly length: number; + + /** + * Whether the list is autoresizable + */ + readonly autoresize: boolean; + + /** + * @param maxLength Maximum length of the linked list + */ + constructor(maxLength?: number); + + /** + * Whether the list is full + */ + readonly full: boolean; + + /** + * Whether the list is empty + */ + readonly empty: boolean; + + /** + * Resizes the list + */ + resize(newLength: number): this; + + /** + * Adds a new node to the end + * + * @returns Added node + */ + push(value: T): I.LinkedList.Node; + + /** + * Removes the last node, returns undefined if the list is empty + */ + pop(): T | undefined; + + /** + * Removes the first node, returns undefined if the list is empty + */ + shift(): T | undefined; + + /** + * Inserts a new node at the beginning of the list + * + * @returns Added node + */ + unshift(value: T): I.LinkedList.Node; + + /** + * Moves the given node to the end of the list + */ + pushNode(node: I.LinkedList.Node): void; + + /** + * Moved the given node to the beginning of the list + */ + unshiftNode(node: I.LinkedList.Node): void; + + /** + * Removes the given node from the list + */ + removeNode(node: I.LinkedList.Node): void; + + /** + * Clears the list + * + * @param strong Whether to reset all the node's values + */ + clear(strong?: boolean): void; + + /** + * Convers the list to an array + */ + toArray(): T[]; + + /** + * The first element of the list + */ + readonly front: T; + + /** + * The last element of the list + */ + readonly back: T; + + /** + * Returns an iterator over the list elements + */ + [Symbol.iterator](): IterableIterator; + + /** + * Returns the next node for the given node + */ + nextNode(node: I.LinkedList.Node): I.LinkedList.Node; + + /** + * Maps this linked list to a new one using the given function + */ + map(fn: (value: T, index: number) => R): LinkedList; + + /** + * Invokes the given callback for each value from the beginning to the end (much faster than for-of). + * If the given function returns false it stops iterating. + */ + forEach(callback: (value: T, index: number) => void | boolean): void; + + /** + * Default length of a new created linked list + */ + static DEFAULT_LENGTH: number; + } +} diff --git a/types/adone/glosses/collections/lru.d.ts b/types/adone/glosses/collections/lru.d.ts new file mode 100644 index 0000000000..7d41e32cd5 --- /dev/null +++ b/types/adone/glosses/collections/lru.d.ts @@ -0,0 +1,213 @@ +declare namespace adone.collection { + namespace I.LRU { + type LengthCalculator = (value: V, key: K) => number; + interface ConstructorOptions { + /** + * The maximum size of the cache, checked by applying the length function to all values in the cache. + * Default is Infinity + */ + max?: number; + + /** + * Maximum age in ms. Items are not pro-actively pruned out as they age, + * but if you try to get an item that is too old, + * it'll drop it and return undefined instead of giving it to you + */ + maxAge?: number; + + /** + * Function that is used to calculate the length of stored items + */ + length?: LengthCalculator; + + /** + * Function that is called on items when they are dropped from the cache + */ + dispose?(key: K, value: V): void; + + /** + * Whether to return the stale value before deleting it + */ + stale?: boolean; + + /** + * Dispose will only be called when a key falls out of the cache, not when it is overwritten + */ + noDisposeOnSet?: boolean; + } + + interface SerializedEntry { + /** + * key + */ + key: K; + + /** + * value + */ + value: V; + + /** + * when it becomes expired + */ + e: number; + } + + interface Entry { + /** + * key + */ + key: K; + + /** + * value + */ + value: V; + + /** + * entry length + */ + length: number; + + /** + * Timestamp when the entry was created + */ + now: number; + + /** + * Maximum live time + */ + maxAge: number; + } + } + + /** + * Represent an LRU cache + */ + class LRU { + /** + * Creates an LRU cache of the given size + */ + constructor(max: number); + + /** + * Creates an LRU cache with the given options + */ + constructor(options?: I.LRU.ConstructorOptions); + + /** + * The length of the cache, setter resizes the cache + */ + max: number; + + /** + * stale setting + */ + allowStale: boolean; + + /** + * maxAge setting + */ + maxAge: number; + + /** + * length setting + */ + lengthCalculator: I.LRU.LengthCalculator; + + /** + * Total length of objects in cache taking into account length options function + */ + readonly length: number; + + /** + * Total quantity of objects currently in cache. + * Note, that stale items are returned as part of this item count. + */ + readonly itemCount: number; + + /** + * Iterates over all the keys in the cache, in reverse recent-ness order. (ie, less recently used items are iterated over first.) + */ + rforEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; + + /** + * Iterates over all the keys in the cache, in order of recent-ness + */ + forEach(fn: (this: T, value: V, key: K, cache: LRU) => void, thisp?: T): void; + + /** + * Returns an array of the keys in the cache + */ + keys(): K[]; + + /** + * Returns an array of the values in the cache + */ + values(): V[]; + + /** + * Clears the cache entirely, throwing away all values + */ + reset(): void; + + /** + * Return an array of the cache entries ready for serialization and usage with 'destinationCache.load(arr)` + */ + dump(): Array>; + + /** + * Returns an internal lru list of entries + */ + dumpLru(): LinkedList>; + + /** + * @param opts std.util.inspect options + */ + inspect(opts?: object): string; + + /** + * Sets a new value for the given key. Updates the "recently used"-ness of the key + * + * @param maxAge maxAge option specific for this key + * @returns Whether the key was set + */ + set(key: K, value: V, maxAge?: number): boolean; + + /** + * Check if a key is in the cache, without updating the recent-ness or deleting it for being stale + */ + has(key: K): boolean; + + /** + * Gets the value of the given key. Updates the "recently used"-ness of the key + */ + get(key: K): V | undefined; + + /** + * Returns the key value without updating the "recently used"-ness of the key + */ + peek(key: K): V | undefined; + + /** + * Deletes the less recently used element + */ + pop(): I.LRU.Entry; + + /** + * Deletes a key out of the cache + */ + del(key: K): void; + + /** + * Loads another cache entries array, obtained with sourceCache.dump(), into the cache. + * The destination cache is reset before loading new entries + */ + load(arr: Array>): void; + + /** + * Manually iterates over the entire cache proactively pruning old entries + */ + prune(): void; + } +} diff --git a/types/adone/glosses/collections/map_cache.d.ts b/types/adone/glosses/collections/map_cache.d.ts new file mode 100644 index 0000000000..55bbb6e05f --- /dev/null +++ b/types/adone/glosses/collections/map_cache.d.ts @@ -0,0 +1,13 @@ +declare namespace adone.collection { + class MapCache { + has(key: string): boolean; + + get(key: string): T; + + set(key: string, value: T): void; + + delete(key: string): void; + + clear(): void; + } +} diff --git a/types/adone/glosses/collections/ns_cache.d.ts b/types/adone/glosses/collections/ns_cache.d.ts new file mode 100644 index 0000000000..5630c295d3 --- /dev/null +++ b/types/adone/glosses/collections/ns_cache.d.ts @@ -0,0 +1,17 @@ +declare namespace adone.collection { + class NSCache { + constructor(size: number, namespaces: string[]); + + resize(newSize: number): void; + + set(ns: string, key: string, value: T): void; + + get(ns: string, key: string): T; + + has(ns: string, key: string): boolean; + + delete(ns: string, key: string): void; + + clear(): void; + } +} diff --git a/types/adone/glosses/collections/priority_queue.d.ts b/types/adone/glosses/collections/priority_queue.d.ts new file mode 100644 index 0000000000..0fb1e92814 --- /dev/null +++ b/types/adone/glosses/collections/priority_queue.d.ts @@ -0,0 +1,78 @@ +declare namespace adone.collection { + namespace I.PriorityQueue { + interface ConstructorOptions { + /** + * Function that compares objects. + * + * Must return a positive value if a > b, a negative if a < b, and zero for equal objects + */ + compare?(a: T, b: T): number; + + /** + * Function that evaluates the priority value by the given objects, + * if the returned value > 0, then the first argument has higher priority, + * = 0 same priority, < 0 lower priority. + * By default the top element is an element that has the highest priority, + * the default priority function is equal to the compare function + */ + priority?(a: T, b: T): number; + } + } + + /** + * Represents a priority queue + */ + class PriorityQueue { + /** + * Whether the queue is empty + */ + readonly empty: boolean; + + /** + * The length of the queue + */ + readonly length: number; + + constructor(options?: I.PriorityQueue.ConstructorOptions); + + /** + * Clones the queue + */ + clone(): PriorityQueue; + + /** + * Inserts a new element + */ + push(x: T): this; + + /** + * Removes the top element (that has the highest priority) + */ + pop(): T | undefined; + + /** + * Deletes the given element from the queue + */ + delete(x: T): this; + + /** + * Replaces the top element (pop + push) + */ + replace(x: T): T; + + /** + * Faster push + pop + */ + pushpop(x: T): T; + + /** + * Converts the queue to an array, it works with a clone of the queue, so the original queue is untouched + */ + toArray(): T[]; + + /** + * Creates a queue object from the given iterable + */ + static from(iterable: Iterable, options?: I.PriorityQueue.ConstructorOptions): PriorityQueue; + } +} diff --git a/types/adone/glosses/collections/queue.d.ts b/types/adone/glosses/collections/queue.d.ts new file mode 100644 index 0000000000..e67eb8fda9 --- /dev/null +++ b/types/adone/glosses/collections/queue.d.ts @@ -0,0 +1,31 @@ +declare namespace adone.collection { + /** + * Represents a queue + */ + class Queue { + /** + * Whether the queue is full + */ + readonly full: boolean; + + /** + * The length of the queue + */ + readonly length: number; + + /** + * Whether the queue is empty + */ + readonly empty: boolean; + + /** + * Inserts a new element at the end + */ + push(x: S): this; + + /** + * Removes and returns an element from the beginning + */ + pop(): T | undefined; + } +} diff --git a/types/adone/glosses/collections/rb_tree.d.ts b/types/adone/glosses/collections/rb_tree.d.ts new file mode 100644 index 0000000000..2ed7a81323 --- /dev/null +++ b/types/adone/glosses/collections/rb_tree.d.ts @@ -0,0 +1,184 @@ +declare namespace adone.collection { + namespace I.RedBlackTree { + interface Node { + /** + * The key associated to the node + */ + key: K; + + /** + * The value associated to the node + */ + value: V; + + /** + * The left subtree of the node + */ + left?: Node; + + /** + * The right subtree of the node + */ + right?: Node; + } + + interface Iterator { + /** + * Checks if the iterator is valid + */ + readonly valid: boolean; + + /** + * The value of the node at the iterator's current position, null if invalid + */ + readonly node: Node | null; + + /** + * The key of the item referenced by the iterator, undefined if invalid + */ + readonly key?: K; + + /** + * The value of the item referenced by the iterator, undefined if invalid + */ + readonly value?: V; + + /** + * Returns the position of this iterator in the sequence + */ + readonly index: number; + + /** + * If true, then the iterator is not at the end of the sequence + */ + readonly hasNext: boolean; + + /** + * If true, then the iterator is not at the beginning of the sequence + */ + readonly hasPrev: boolean; + + /** + * The tree associated to the iterator + */ + tree: RedBlackTree; + + /** + * Makes a copy of the iterator + */ + clone(): Iterator; + + /** + * Removes the item at the position of the iterator and returns a new rb-tree + */ + remove(): RedBlackTree; + + /** + * Advances the iterator to the next position + */ + next(): void; + + /** + * Updates the value of the node in the tree at this iterator and returns a new rb-tree + */ + update(value: V): RedBlackTree; + + /** + * Moves the iterator backward one element + */ + prev(): void; + } + } + + /** + * Represents a fully persistent red-black tree + */ + class RedBlackTree { + /** + * The root node of the tree + */ + root: I.RedBlackTree.Node; + + constructor(compare?: (a: K, b: K) => number, root?: RedBlackTree); + + /** + * A sorted array of all the keys in the tree + */ + readonly keys: K[]; + + /** + * An array of all the values in the tree + */ + readonly values: V[]; + + /** + * The number of items in the tree + */ + readonly length: number; + + /** + * An iterator pointing to the first element in the tree + */ + readonly begin: I.RedBlackTree.Iterator; + + /** + * An iterator pointing to the last element in the tree + */ + readonly end: I.RedBlackTree.Iterator; + + /** + * Creates a new tree with the new pair inserted + */ + insert(key: K, value: V): RedBlackTree; + + /** + * Walks a visitor function over the nodes of the tree in order + * + * @param visit A callback that gets executed on each node. + * If a truthy value is returned from the visitor, then iteration is stopped. + * @param lo An optional start of the range to visit (inclusive) + * @param hi An optional end of the range to visit (non-inclusive) + */ + forEach(visit: (key: K, value: V) => T, lo?: K, hi?: K): T; + + /** + * Finds an iterator starting at the given element + */ + at(idx: number): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is >= key + */ + ge(key: K): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is > key + */ + gt(key: K): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is < key + */ + lt(key: K): I.RedBlackTree.Iterator; + + /** + * Finds the first item in the tree whose key is <= key + */ + le(key: K): I.RedBlackTree.Iterator; + + /** + * Returns an iterator pointing to the first item in the tree with key, otherwise null + */ + find(key: K): I.RedBlackTree.Iterator | null; + + /** + * Removes the first item with key in the tree + */ + remove(key: K): RedBlackTree; + + /** + * Retrieves the value associated to the given key + */ + get(key: K): V | undefined; + } +} diff --git a/types/adone/glosses/collections/refcounted_cache.d.ts b/types/adone/glosses/collections/refcounted_cache.d.ts new file mode 100644 index 0000000000..79410423a4 --- /dev/null +++ b/types/adone/glosses/collections/refcounted_cache.d.ts @@ -0,0 +1,9 @@ +declare namespace adone.collection { + class RefcountedCache extends MapCache { + ref(key: string): void; + + unref(key: string): void; + + references(key: string): number; + } +} diff --git a/types/adone/glosses/collections/set.d.ts b/types/adone/glosses/collections/set.d.ts new file mode 100644 index 0000000000..f1a6bae96d --- /dev/null +++ b/types/adone/glosses/collections/set.d.ts @@ -0,0 +1,17 @@ +declare namespace adone.collection { + class Set { + constructor(key?: (x: T) => any); + + has(value: T): boolean; + + add(value: T): void; + + delete(value: T): void; + + get(value: T): T; // ??? + + readonly size: number; + + only(): T; + } +} diff --git a/types/adone/glosses/collections/stack.d.ts b/types/adone/glosses/collections/stack.d.ts new file mode 100644 index 0000000000..90fe35b99b --- /dev/null +++ b/types/adone/glosses/collections/stack.d.ts @@ -0,0 +1,36 @@ +declare namespace adone.collection { + /** + * Represents a stack + */ + class Stack { + /** + * Whether the stack is empty + */ + readonly empty: boolean; + + /** + * The top element of the stack + */ + readonly top: T; + + /** + * Inserts a new element + */ + push(x: T): this; + + /** + * Removes the top element + */ + pop(): T | undefined; + + /** + * Returns an iterator over the values + */ + [Symbol.iterator](): IterableIterator; + + /** + * Creates a stack and pushed all the values from the given iterable object + */ + static from(iterable: Iterable): Stack; + } +} diff --git a/types/adone/glosses/collections/timedout_map.d.ts b/types/adone/glosses/collections/timedout_map.d.ts new file mode 100644 index 0000000000..fedcf79fa2 --- /dev/null +++ b/types/adone/glosses/collections/timedout_map.d.ts @@ -0,0 +1,32 @@ +declare namespace adone.collection { + /** + * Represents a Map that keeps keys only for a specified interval of time + */ + class TimedoutMap extends Map { + /** + * @param timeout maximum age of the keys, 1000 by default + * @param callback callback that is called with each key when the timeout is passed + */ + constructor(timeout?: number, callback?: (key: K) => void); + + /** + * Gets the timeout + */ + getTimeout(): number; + + /** + * Sets the timeout + */ + setTimeout(ms: number): void; + + /** + * Iterates over the map and calls the callback for each element + */ + forEach(callback: (this: T, value: V, key: K, cache: this) => void, thisArg?: T): this; + + /** + * Deletes the given key + */ + delete(key: K): boolean; + } +} diff --git a/types/adone/glosses/crypto/asn1.d.ts b/types/adone/glosses/crypto/asn1.d.ts new file mode 100644 index 0000000000..2c4f2134a0 --- /dev/null +++ b/types/adone/glosses/crypto/asn1.d.ts @@ -0,0 +1,597 @@ +declare namespace adone.crypto { + namespace asn1 { + namespace I { + interface LocalBaseBlockParams { + blockLength?: number; + error?: string; + warnings?: string[]; + valueBeforeDecode?: ArrayBuffer; + } + + interface JsonLocalBaseBlock { + blockName: string; + blockLength: number; + error: string; + warnings: string[]; + valueBeforeDecode: ArrayBuffer; + } + + class LocalBaseBlock { + blockLength: number; + error: string; + warnings: string[]; + valueBeforeDecode: ArrayBuffer; + + constructor(params?: LocalBaseBlockParams); + /** + * Aux function, need to get a block name. Need to have it here for inhiritence + */ + static blockName(): string; + /** + * Convertion for the block to JSON object + */ + toJSON(): JsonLocalBaseBlock; + } + + interface LocalHexBlockParams extends LocalBaseBlockParams { + isHexOnly?: boolean; + valueHex?: ArrayBuffer; + } + + class LocalHexBlock { + isHexOnly: boolean; + + valueHex: ArrayBuffer; + + constructor(params: any); + + /** + * Aux function, need to get a block name. Need to have it here for inhiritence + */ + static blockName(): string; + + /** + * Base function for converting block from BER encoded array of bytes + * + * @param inputBuffer ASN.1 BER encoded array + * @param inputOffset Offset in ASN.1 BER encoded array where decoding should be started + * @param inputLength Maximum length of array of bytes which can be using in this function + */ + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + + /** + * Encoding of current ASN.1 block into ASN.1 encoded array (BER rules) + * + * @param sizeOnly Flag that we need only a size of encoding, not a real array of bytes + */ + toBER(sizeOnly?: boolean): ArrayBuffer; + + /** + * Convertion for the block to JSON object + */ + toJSON(): any; + } + + interface LocalIdentificationBlockParams { + idBlock?: LocalHexBlockParams & { + isConstructed?: boolean; + tagClass?: number; + tagNumber?: number; + }; + } + + class LocalIdentificationBlock extends LocalBaseBlock { + isConstructed: boolean; + + tagClass: number; + + tagNumber: number; + + constructor(params?: LocalIdentificationBlockParams); + + // ILocalHexBlock implementation + isHexOnly: boolean; + valueHex: ArrayBuffer; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalLengthBlockParams { + lenBlock?: { + isIndefiniteForm?: boolean; + longFormUsed?: boolean; + length: number; + }; + } + + class LocalLengthBlock extends LocalBaseBlock { + isIndefiniteForm: boolean; + longFormUsed: boolean; + length: number; + constructor(params?: LocalLengthBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): void; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class LocalValueBlock extends LocalBaseBlock { + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): void; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface BaseBlockParams extends LocalBaseBlockParams { + name?: string; + optional?: boolean; + primitiveSchema?: object; + } + + interface LocalPrimitiveValueBlockParams extends LocalBaseBlockParams { + valueHex?: ArrayBuffer; + isHexOnly?: boolean; + } + + class LocalPrimitiveValueBlock extends LocalValueBlock { + valueHex: ArrayBuffer; + isHexOnly: boolean; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalConstructedValueBlockParams extends LocalBaseBlockParams { + value?: LocalValueBlock; + isIndefiniteForm?: boolean; + } + + class LocalConstructedValueBlock extends LocalValueBlock { + value: LocalValueBlock[]; + isIndefiniteForm: boolean; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class LocalEndOfContentValueBlock extends LocalValueBlock { + constructor(params?: LocalBaseBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalBooleanValueBlockParams extends LocalBaseBlockParams { + value?: boolean; + isHexOnly?: boolean; + valueHex?: ArrayBuffer; + } + + class LocalBooleanValueBlock extends LocalValueBlock { + value: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalOctetStringValueBlockParams extends LocalConstructedValueBlockParams, LocalHexBlockParams { + isConstructed?: boolean; + } + + class LocalOctetStringValueBlock extends LocalConstructedValueBlock { + isConstructed: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalOctetStringValueBlockParams); + } + + interface LocalBitStringValueBlockParams extends LocalConstructedValueBlockParams, LocalHexBlockParams { + unusedBits?: number; + isConstructed?: boolean; + blockLength?: number; + } + + class LocalBitStringValueBlock extends LocalConstructedValueBlock implements LocalHexBlock { + unusedBits: number; + isConstructed: boolean; + blockLength: number; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalBitStringValueBlockParams); + } + + interface LocalIntegerValueBlockParams extends LocalBaseBlockParams, LocalHexBlockParams { + } + + class LocalIntegerValueBlock extends LocalValueBlock implements LocalHexBlock { + valueDec: number; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalIntegerValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + /** + * Base function for converting block from DER encoded array of bytes + * + * @param inputBuffer ASN.1 DER encoded array + * @param inputOffset Offset in ASN.1 DER encoded array where decoding should be started + * @param inputLength Maximum length of array of bytes which can be using in this function + * @param expectedLength Expected length of converted "valueHex" buffer + */ + fromDER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number, expectedLength?: number): number; + /** + * Encoding of current ASN.1 block into ASN.1 encoded array (DER rules) + * + * @param sizeOnly Flag that we need only a size of encoding, not a real array of bytes + */ + toDER(sizeOnly?: boolean): ArrayBuffer; + } + + interface IntegerParams { + value?: number; + } + + interface LocalSidValueBlockParams extends LocalBaseBlockParams, LocalHexBlockParams { + valueDec?: number; + isFirstSid?: boolean; + } + + class LocalSidValueBlock extends LocalBaseBlock implements LocalHexBlock { + valueDec: number; + isFirstSid: boolean; + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalSidValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + toString(): string; + } + + interface LocalObjectIdentifierValueBlockParams extends LocalBaseBlockParams { + value?: string; + } + + class LocalObjectIdentifierValueBlock extends LocalValueBlock { + constructor(params?: LocalObjectIdentifierValueBlockParams); + + /** + * Create "LocalObjectIdentifierValueBlock" class from string + * + * @param string Input string to convert from + */ + fromString(data: string): boolean; + /** + * Converts "LocalObjectIdentifierValueBlock" class to string + */ + toString(): string; + } + + interface LocalUtf8StringValueBlockParams extends LocalBaseBlockParams, LocalHexBlock { + } + + class LocalUtf8StringValueBlock extends LocalBaseBlock implements LocalHexBlock { + isHexOnly: boolean; + valueHex: ArrayBuffer; + constructor(params?: LocalSidValueBlockParams); + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + toString(): string; + } + + interface Utf8StringParams { + value?: string; + } + + interface LocalBmpStringValueBlockParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalBmpStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalBmpStringValueBlockParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalUniversalStringValueParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalUniversalStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalUniversalStringValueParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalSimpleLocalSimpleStringValueBlockParams extends LocalHexBlockParams, LocalBaseBlockParams { + } + + class LocalSimpleLocalSimpleStringValueBlock extends LocalBaseBlock implements LocalHexBlock { + value: string; + isHexOnly: boolean; + valueHex: ArrayBuffer; + + constructor(params?: LocalSimpleLocalSimpleStringValueBlockParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + interface LocalSimpleStringBlockParams { + value?: string; + } + + class LocalSimpleStringBlock extends BaseBlock { + constructor(params?: LocalSimpleStringBlockParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + interface BmpStringParams { + value?: string; + } + + interface UniversalStringParams { + value?: string; + } + + interface UTCTimeParams extends LocalSimpleLocalSimpleStringValueBlockParams { + value?: string; + valueDate?: Date; + } + + interface ChoiceParams { + value?: LocalValueBlock[]; + optional?: boolean; + } + + interface AnyParams { + name?: string; + optional?: boolean; + } + + interface RepeatedParams { + name?: string; + optional?: boolean; + value?: Any; + local?: boolean; + } + + interface RawDataParams { + data?: ArrayBuffer; + } + } + + class BaseBlock extends I.LocalBaseBlock { + constructor(parameters?: I.BaseBlockParams, valueBlockType?: typeof I.LocalValueBlock); + idBlock: I.LocalIdentificationBlock; + lenBlock: I.LocalLengthBlock; + valueBlock: T; + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + class Primitive extends BaseBlock { + } + + class Constructed extends BaseBlock { } + + class EndOfContent extends BaseBlock { } + + class Boolean extends BaseBlock { } + + class Sequence extends Constructed { } + + class Set extends Constructed { } + + class Null extends BaseBlock { } + + class OctetString extends BaseBlock { + constructor(params?: I.LocalOctetStringValueBlockParams); + /** + * Checking that two OCTETSTRINGs are equal + */ + isEqual(octetString: OctetString): boolean; + } + + class BitString extends BaseBlock { + constructor(params?: I.LocalBitStringValueBlockParams); + /** + * Checking that two BITSTRINGs are equal + * @param bitString + */ + isEqual(bitString: BitString): boolean; + } + + class Integer extends BaseBlock { + constructor(params?: I.IntegerParams) + /** + * Compare two Integer object, or Integer and ArrayBuffer objects + */ + isEqual(otherValue: Integer | ArrayBuffer): boolean; + /** + * Convert current Integer value from BER into DER format + */ + convertToDER(): Integer; + /** + * Convert current Integer value from DER to BER format + */ + convertFromDER(): Integer; + } + + class Enumerated extends Integer { } + + class ObjectIdentifier extends BaseBlock { + constructor(params?: I.LocalObjectIdentifierValueBlockParams); + } + + class Utf8String extends BaseBlock { + constructor(params?: I.Utf8StringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + class BmpString extends BaseBlock { + constructor(params?: I.BmpStringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + class UniversalString extends BaseBlock { + constructor(params?: I.UniversalStringParams); + /** + * Function converting ArrayBuffer into ASN.1 internal string + * + * @param inputBuffer ASN.1 BER encoded array + */ + fromBuffer(inputBuffer: ArrayBuffer): void; + /** + * Function converting JavaScript string into ASN.1 internal class + * + * @param inputString ASN.1 BER encoded array + */ + fromString(inputString: string): void; + } + + class NumericString extends I.LocalSimpleStringBlock { } + + class PrintableString extends I.LocalSimpleStringBlock { } + + class TeletexString extends I.LocalSimpleStringBlock { } + + class VideotexString extends I.LocalSimpleStringBlock { } + + class IA5String extends I.LocalSimpleStringBlock { } + + class GraphicString extends I.LocalSimpleStringBlock { } + + class VisibleString extends I.LocalSimpleStringBlock { } + + class GeneralString extends I.LocalSimpleStringBlock { } + + class CharacterString extends I.LocalSimpleStringBlock { } + + class UTCTime extends VisibleString { + year: number; + month: number; + day: number; + hour: number; + minute: number; + second: number; + constructor(params?: I.UTCTimeParams); + /** + * Function converting ASN.1 internal string into ArrayBuffer + */ + toBuffer(): ArrayBuffer; + /** + * Function converting "Date" object into ASN.1 internal string + * + * @param inputDate JavaScript "Date" object + */ + fromDate(inputDate: Date): void; + /** + * Function converting ASN.1 internal string into "Date" object + */ + toDate(): Date; + } + + class GeneralizedTime extends UTCTime { + millisecond: number; + } + + class DATE extends Utf8String { } + + class TimeOfDay extends Utf8String { } + + class DateTime extends Utf8String { } + + class Duration extends Utf8String { } + + class TIME extends Utf8String { } + + class Choice { + value: I.LocalValueBlock[]; + optional: boolean; + constructor(params?: I.ChoiceParams); + } + + class Any { + name: string; + optional: boolean; + constructor(params?: I.AnyParams); + } + + class Repeated { + name: string; + optional: boolean; + value: Any; + local: boolean; + constructor(params?: I.RepeatedParams); + } + + class RawData { + data: ArrayBuffer; + + constructor(params?: I.RawDataParams); + + fromBER(inputBuffer: ArrayBuffer, inputOffset: number, inputLength: number): number; + toBER(sizeOnly?: boolean): ArrayBuffer; + } + + /** + * Major function for decoding ASN.1 BER array into internal library structuries + * + * @param inputBuffer ASN.1 BER encoded array of bytes + */ + function fromBER(inputBuffer: ArrayBuffer): { offset: number; result: I.LocalBaseBlock }; + + /** + * Compare of two ASN.1 object trees + * + * @param root Root of input ASN.1 object tree + * @param inputData Input ASN.1 object tree + * @param inputSchema Input ASN.1 schema to compare with + */ + function compareSchema(root: any, inputData: any, inputSchema: any): { verified: boolean, result?: any }; + + /** + * ASN.1 schema verification for ArrayBuffer data + * + * @param inputBuffer Input BER-encoded ASN.1 data + * @param inputSchema Input ASN.1 schema to verify against to + */ + function verifySchema(inputBuffer: ArrayBuffer, inputSchema: any): { verified: boolean, result?: any }; + } +} diff --git a/types/adone/glosses/crypto/ed25519.d.ts b/types/adone/glosses/crypto/ed25519.d.ts new file mode 100644 index 0000000000..7e4f6e2f33 --- /dev/null +++ b/types/adone/glosses/crypto/ed25519.d.ts @@ -0,0 +1,20 @@ +declare namespace adone.crypto { + namespace ed25519 { + const publicKeyLength: number; + + const privateKeyLength: number; + + namespace I { + interface KeyPair { + publicKey: Buffer; + privateKey: Buffer; + } + } + + function generateKeyPair(seed: Buffer): I.KeyPair; + + function sign(message: Buffer, seed: Buffer | I.KeyPair): Buffer; + + function verify(message: Buffer, signature: Buffer, publicKey: Buffer): boolean; + } +} diff --git a/types/adone/glosses/crypto/index.d.ts b/types/adone/glosses/crypto/index.d.ts new file mode 100644 index 0000000000..ea4b76967f --- /dev/null +++ b/types/adone/glosses/crypto/index.d.ts @@ -0,0 +1,9 @@ +/// +/// +/// + +declare namespace adone { + namespace crypto { + // + } +} diff --git a/types/adone/glosses/crypto/secp256k1.d.ts b/types/adone/glosses/crypto/secp256k1.d.ts new file mode 100644 index 0000000000..87167cc441 --- /dev/null +++ b/types/adone/glosses/crypto/secp256k1.d.ts @@ -0,0 +1,127 @@ +declare namespace adone.crypto { + namespace secp256k1 { + /** + * Verifies an ECDSA privateKey + */ + function privateKeyVerify(privateKey: Buffer): boolean; + + /** + * Exports a privateKey in DER format + */ + function privateKeyExport(privateKey: Buffer, compressed?: boolean): Buffer; + + /** + * Imports a privateKey in DER format + */ + function privateKeyImport(privateKey: Buffer): Buffer; + + /** + * Negates a privateKey by subtracting it from the order of the curve's base point + */ + function privateKeyNegate(privateKey: Buffer): Buffer; + + /** + * Computes the inverse of a privateKey (modulo the order of the curve's base point) + */ + function privateKeyModInverse(privateKey: Buffer): Buffer; + + /** + * Tweaks a privateKey by adding tweak to it + */ + function privateKeyTweakAdd(privateKey: Buffer, tweak: Buffer): Buffer; + + /** + * Tweaks a privateKey by multiplying it by a tweak + */ + function privateKeyTweakMul(privateKey: Buffer, tweak: Buffer): Buffer; + + /** + * Computes the public key for a privateKey + */ + function publicKeyCreate(privateKey: Buffer, compressed?: boolean): Buffer; + + /** + * Converts a publicKey to compressed or uncompressed form + */ + function publicKeyConvert(publicKey: Buffer, compressed?: boolean): Buffer; + + /** + * Verifies an ECDSA publicKey + */ + function publicKeyVerify(publicKey: Buffer): boolean; + + /** + * Tweaks a publicKey by adding tweak times the generator to it + */ + function publicKeyTweakAdd(publicKey: Buffer, tweak: Buffer, compressed?: boolean): Buffer; + + /** + * Tweaks a publicKey by multiplying it by a tweak value + */ + function publicKeyTweakMul(publicKey: Buffer, tweak: Buffer, compressed?: boolean): Buffer; + + /** + * Adds a given publicKeys together + */ + function publicKeyCombine(publicKeys: Buffer[], compressed?: boolean): Buffer; + + /** + * Converts a signature to a normalized lower-S form + */ + function signatureNormalize(signature: Buffer): Buffer; + + /** + * Serializes an ECDSA signature in DER format + */ + function signatureExport(signature: Buffer): Buffer; + + /** + * Parse a DER ECDSA signature (follow by BIP66) + */ + function signatureImport(signature: Buffer): Buffer; + + /** + * Same as signatureImport but not follow by BIP66 + */ + function signatureImportLax(signature: Buffer): Buffer; + + namespace I { + interface SignOptions { + noncefn?: (message: Buffer, privateKey: Buffer, algo: Buffer, data: Buffer, attempt: number) => Buffer; + data?: Buffer | null; + } + + interface SignResult { + signature: Buffer; + recovery: number; + } + } + + /** + * Creates an ECDSA signature. Always return low-S signature. + */ + function sign(message: Buffer, privateKey: Buffer, options?: I.SignOptions): I.SignResult; + + /** + * Verifies an ECDSA signature + * + * Note: return false for high signatures! + */ + function verify(message: Buffer, signature: Buffer, publicKey: Buffer): boolean; + + /** + * Recovers an ECDSA public key from a signature + */ + function recover(message: Buffer, signature: Buffer, recovery: number, compressed?: boolean): Buffer; + + /** + * Computes an EC Diffie-Hellman secret and applied sha256 to compressed public key + */ + function ecdh(publicKey: Buffer, privateKey: Buffer): Buffer; + + /** + * Computes an EC Diffie-Hellman secret and return public key as result + */ + function ecdhUnsafe(publicKey: Buffer, privateKey: Buffer, compressed?: boolean): Buffer; + } +} diff --git a/types/adone/glosses/data.d.ts b/types/adone/glosses/data.d.ts index a22ba10750..4d3dae7b2b 100644 --- a/types/adone/glosses/data.d.ts +++ b/types/adone/glosses/data.d.ts @@ -1050,5 +1050,183 @@ declare namespace adone { */ function decode(buf: Buffer, options?: I.DeserializeOptions): any; } + + namespace protobuf { + namespace schema { + namespace I { + interface Field { + name: string | null; + type: string | null; + tag: number; + map: { + from: string; + to: string; + } | null; + oneof: string | null; + required: boolean; + repeated: boolean; + options: object; + } + + interface Enum { + name: string; + values: object; + options: object; + } + + interface Extend { + name: string; + message: Message; + } + + interface Message { + name: string; + enums: Enum[]; + extends: Extend[]; + messages: Message[]; + fields: Field[]; + extensions: { + from: number, + to: number + } | null; + } + + interface RPCMethod { + name: string; + input_type: string | null; + output_type: string | null; + client_streaming: boolean; + server_streaming: boolean; + options: object; + } + + interface Service { + name: string; + methods: RPCMethod[]; + options: object; + } + + interface Schema { + syntax: any; // ?? + package: string | null; + imports: string[]; + enums: Enum[]; + messages: Message[]; + options: object; + extends: Extend[]; + services?: Service[]; + } + } + + function parse(buf: Buffer | string): I.Schema; + + function stringify(schema: object): string; + } + + function create(proto: Buffer | string | object, opts?: object): object; + } + + namespace base32 { + function charmap(alphabet: string, mappings?: T): T; + + namespace I { + interface Spec { + alphabet: string; + charmap: { + [c: string]: number; + }; + } + } + + const rfc4648: I.Spec; + + const crockford: I.Spec; + + const base32hex: I.Spec; + + namespace I { + interface DecoderOptions { + type: "rfc4648" | "crockford" | "base32hex"; + charmap?: object; + } + + interface EncoderOptions { + type: "rfc4648" | "crockford" | "base32hex"; + alphabet?: string; + } + } + + class Decoder { + constructor(options?: I.DecoderOptions); + + write(str: string): this; + + finalize(str?: string): Buffer; + } + + class Encoder { + constructor(options?: I.EncoderOptions); + + write(buf: Buffer): this; + + finalize(buf?: Buffer): string; + } + + function encode(buf: Buffer, options?: I.EncoderOptions): string; + + function decode(str: string, options?: I.DecoderOptions): Buffer; + } + + namespace I { + interface BaseX { + encode(buf: Buffer): string; + + decode(str: string): Buffer; + + decodeUnsafe(str: string): Buffer; + } + } + + function basex(alphabet: string): I.BaseX; + + const base58: I.BaseX; + + namespace base64url { + function unescape(str: string): string; + + function escape(str: string): string; + + namespace I { + interface EncodeOptions { + encoding?: string; + } + + interface DecodeOptions { + encoding?: string; + buffer?: boolean; + } + } + + function encode(str: Buffer | string, options?: I.EncodeOptions): string; + + function decode(str: string, options: I.DecodeOptions & { buffer: true }): Buffer; + function decode(str: string, options?: I.DecodeOptions): string; + } + + namespace varint { + function encode(num: number, out?: T[], offset?: number): T[]; + + function decode(buf: Buffer, offset?: number): number; + + function encodingLength(value: number): number; + } + + namespace varintSigned { + function encode(num: number, out?: T[], offset?: number): T[]; + + function decode(buf: Buffer, offset?: number): number; + + function encodingLength(value: number): number; + } } } diff --git a/types/adone/glosses/fake.d.ts b/types/adone/glosses/fake.d.ts new file mode 100644 index 0000000000..0c403747e4 --- /dev/null +++ b/types/adone/glosses/fake.d.ts @@ -0,0 +1,337 @@ +declare namespace adone { + namespace fake { + namespace I { + interface Card { + name: string; + username: string; + email: string; + address: FullAddress; + phone: string; + website: string; + company: Company; + posts: Post[]; + accountHistory: string[]; + } + + interface FullAddress { + streetA: string; + streetB: string; + streetC: string; + streetD: string; + city: string; + state: string; + county: string; + zipcode: string; + geo: Geo; + } + + interface Geo { + lat: string; + lng: string; + } + + interface Company { + name: string; + catchPhrase: string; + bs: string; + } + + interface Post { + words: string; + sentence: string; + sentences: string; + paragraph: string; + } + + interface ContextualCard { + name: string; + username: string; + email: string; + dob: Date; + phone: string; + address: Address; + website: string; + company: Company; + } + + interface Address { + street: string; + suite: string; + city: string; + state: string; + zipcode: string; + geo: Geo; + } + + interface UserCard { + name: string; + username: string; + email: string; + address: Address; + phone: string; + website: string; + company: Company; + } + + interface Transaction { + amount: string; + date: Date; + business: string; + name: string; + type: string; + account: string; + } + } + + namespace address { + function zipCode(format?: string): string; + function city(format?: number): string; + function cityPrefix(): string; + function citySuffix(): string; + function streetName(): string; + function streetAddress(useFullAddress?: boolean): string; + function streetSuffix(): string; + function streetPrefix(): string; + function secondaryAddress(): string; + function county(): string; + function country(): string; + function countryCode(): string; + function state(useAbbr?: boolean): string; + function stateAbbr(): string; + function latitude(): string; + function longitude(): string; + } + + namespace commerce { + function color(): string; + function department(): string; + function productName(): string; + function price(min?: number, max?: number, dec?: number, symbol?: string): string; + function productAdjective(): string; + function productMaterial(): string; + function product(): string; + } + + namespace company { + function suffixes(): string[]; + function companyName(format?: number): string; + function companySuffix(): string; + function catchPhrase(): string; + function bs(): string; + function catchPhraseAdjective(): string; + function catchPhraseDescriptor(): string; + function catchPhraseNoun(): string; + function bsAdjective(): string; + function bsBuzz(): string; + function bsNoun(): string; + } + + namespace database { + function column(): string; + function type(): string; + function collation(): string; + function engine(): string; + } + + namespace date { + function past(years?: number, refDate?: string|Date): Date; + function future(years?: number, refDate?: string|Date): Date; + function between(from: string|number|Date, to: string|Date): Date; + function recent(days?: number): Date; + function soon(days?: number): Date; + function month(options?: { abbr?: boolean, context?: boolean }): string; + function weekday(options?: { abbr?: boolean, context?: boolean }): string; + } + + function fake(str: string): string; + + namespace finance { + function account(length?: number): string; + function accountName(): string; + function mask(length?: number, parens?: boolean, elipsis?: boolean): string; + function amount(min?: number, max?: number, dec?: number, symbol?: string): string; + function transactionType(): string; + function currencyCode(): string; + function currencyName(): string; + function currencySymbol(): string; + function bitcoinAddress(): string; + function ethereumAddress(): string; + function iban(formatted?: boolean): string; + function bic(): string; + } + + namespace hacker { + function abbreviation(): string; + function adjective(): string; + function noun(): string; + function verb(): string; + function ingverb(): string; + function phrase(): string; + } + + namespace helpers { + function randomize(array: T[]): T; + function randomize(): string; + function slugify(string?: string): string; + function replaceSymbolWithNumber(string?: string, symbol?: string): string; + function replaceSymbols(string?: string): string; + function shuffle(o: T[]): T[]; + function shuffle(): string[]; + function mustache(str: string, data: { [key: string]: string|((substring: string, ...args: any[]) => string) }): string; + function createCard(): I.Card; + function contextualCard(): I.ContextualCard; + function userCard(): I.UserCard; + function createTransaction(): I.Transaction; + } + + namespace image { + function image(): string; + function avatar(): string; + function imageUrl(width?: number, height?: number, category?: string): string; + function abstract(width?: number, height?: number): string; + function animals(width?: number, height?: number): string; + function business(width?: number, height?: number): string; + function cats(width?: number, height?: number): string; + function city(width?: number, height?: number): string; + function food(width?: number, height?: number): string; + function nightlife(width?: number, height?: number): string; + function fashion(width?: number, height?: number): string; + function people(width?: number, height?: number): string; + function nature(width?: number, height?: number): string; + function sports(width?: number, height?: number): string; + function technics(width?: number, height?: number): string; + function transport(width?: number, height?: number): string; + function dataUri(width?: number, height?: number): string; + } + + namespace internet { + function avatar(): string; + function email(firstName?: string, lastName?: string, provider?: string): string; + function exampleEmail(firstName?: string, lastName?: string): string; + function userName(firstName?: string, lastName?: string): string; + function protocol(): string; + function url(): string; + function domainName(): string; + function domainSuffix(): string; + function domainWord(): string; + function ip(): string; + function ipv6(): string; + function userAgent(): string; + function color(baseRed255?: number, baseGreen255?: number, baseBlue255?: number): string; + function mac(): string; + function password(len?: number, memorable?: boolean, pattern?: string|RegExp, prefix?: string): string; + } + + namespace lorem { + function word(): string; + function words(num?: number): string; + function sentence(wordCount?: number, range?: number): string; + function slug(wordCount?: number): string; + function sentences(sentenceCount?: number): string; + function paragraph(sentenceCount?: number): string; + function paragraphs(paragraphCount?: number, separator?: string): string; + function text(times?: number): string; + function lines(lineCount?: number): string; + } + + namespace name { + function firstName(gender?: number): string; + function lastName(gender?: number): string; + function findName(firstName?: string, lastName?: string, gender?: number): string; + function jobTitle(): string; + function prefix(): string; + function suffix(): string; + function title(): string; + function jobDescriptor(): string; + function jobArea(): string; + function jobType(): string; + } + + namespace phone { + function phoneNumber(format?: string): string; + function phoneNumberFormat(phoneFormatsArrayIndex?: number): string; + function phoneFormats(): string; + } + + namespace random { + function number(max: number): number; + function number(options?: { min?: number, max?: number, precision?: number }): number; + function arrayElement(): string; + function arrayElement(array: T[]): T; + function objectElement(object?: { [key: string]: any }, field?: "key"): string; + function objectElement(object?: { [key: string]: T }, field?: any): T; + function uuid(): string; + function boolean(): boolean; + function word(type?: string): string; + function words(count?: number): string; + function image(): string; + function locale(): string; + function alphaNumeric(count?: number): string; + function hexaDecimal(count?: number): string; + } + + namespace system { + function fileName(ext: string, type: string): string; + function commonFileName(ext: string, type: string): string; + function mimeType(): string; + function commonFileType(): string; + function commonFileExt(): string; + function fileType(): string; + function fileExt(mimeType: string): string; + function directoryPath(): string; + function filePath(): string; + function semver(): string; + } + + function seed(value: number): void; + + namespace I { + type Locale = + | "az" + | "cz" + | "de" + | "de_AT" + | "de_CH" + | "el" + | "en" + | "en_AU" + | "en_BORK" + | "en_CA" + | "en_GB" + | "en_IE" + | "en_IND" + | "en_US" + | "en_au_ocker" + | "es" + | "es_MX" + | "fa" + | "fr" + | "fr_CA" + | "ge" + | "id_ID" + | "it" + | "ja" + | "ko" + | "lv" + | "nb_NO" + | "nep" + | "nl" + | "nl_BE" + | "pl" + | "pt_BR" + | "ro" + | "ru" + | "sk" + | "sv" + | "tr" + | "uk" + | "vi" + | "zh_CN" + | "zh_TW"; + } + + function getLocale(): I.Locale; + + function setLocale(locale: I.Locale): void; + } +} diff --git a/types/adone/glosses/is.d.ts b/types/adone/glosses/is.d.ts index 7df9559524..20d898ca7b 100644 --- a/types/adone/glosses/is.d.ts +++ b/types/adone/glosses/is.d.ts @@ -99,12 +99,12 @@ declare namespace adone { /** * Checks whether the given object is not a primitive, i.e. neither `undefined` nor `null` nor number nor string nor boolean nor symbol) */ - export function object(obj: any): boolean; + export function object(obj: any): obj is object; /** * Checks whether the given object is a plain object, i.e. created by Object */ - export function plainObject(obj: any): boolean; + export function plainObject(obj: any): obj is object; /** * Checks whether the given object is an adone namespace @@ -120,7 +120,7 @@ declare namespace adone { /** * Checks whether the given object is empty, i.e. it is an object(not a primitive), and Object.keys returns an empty array */ - export function emptyObject(obj: any): boolean; + export function emptyObject(obj: any): obj is object; /** * Checks whether the given object has the given owned property @@ -140,7 +140,7 @@ declare namespace adone { /** * Checks whether the given object is like an array, i.e. it is not a primitive, not a function and has length */ - export function arrayLikeObject(obj: any): boolean; + export function arrayLikeObject(obj: any): obj is ArrayLike; /** * Checks whether the given array has the given value @@ -227,13 +227,13 @@ declare namespace adone { /** * Checks whether the given object is a function */ - function _function(obj: any): boolean; + function _function(obj: any): obj is (...args: any[]) => any; export { _function as function }; /** * Checks whether the given object is an async function */ - export function asyncFunction(obj: any): boolean; + export function asyncFunction(obj: any): obj is (...args: any[]) => Promise; /** * Checks whether the given object is a promise @@ -258,7 +258,7 @@ declare namespace adone { /** * Checks whether the given object is a generator function */ - export function generator(obj: any): boolean; + export function generator(obj: any): obj is GeneratorFunction; /** * Checks whether the given object is NaN @@ -320,12 +320,12 @@ declare namespace adone { /** * Checks whether the given object is an adone subsystem */ - export function subsystem(obj: any): boolean; + export function subsystem(obj: any): obj is adone.application.Subsystem; /** * Checks whether the given object is an adone application */ - export function application(obj: any): boolean; + export function application(obj: any): obj is adone.application.Application; /** * Checks whether the given object is an adone logger @@ -335,22 +335,22 @@ declare namespace adone { /** * Checks whether the given object is a core stream */ - export function coreStream(obj: any): boolean; + export function coreStream(obj: any): obj is adone.stream.core.Stream; /** * Checks whether the given object is a fast local map stream */ - export function fastLocalMapStream(obj: any): boolean; + export function fastLocalMapStream(obj: any): obj is adone.fast.I.LocalMapStream; /** * Checks whether the given object is a fast local stream */ - export function fastLocalStream(obj: any): boolean; + export function fastLocalStream(obj: any): obj is adone.fast.I.LocalStream; /** * Checks whether the given object is a fast stream */ - export function fastStream(obj: any): boolean; + export function fastStream(obj: any): obj is adone.fast.I.Stream; /** * Checks whether the given object is a genesis netron @@ -430,7 +430,7 @@ declare namespace adone { /** * Checks whether the given object is iterable, has defined Symbol.iterator property */ - export function iterable(obj: any): boolean; + export function iterable(obj: any): obj is Iterable; /** * true if the OS is Windows @@ -672,5 +672,9 @@ declare namespace adone { * Checks whether the given object is a valid UUID identifier (v1, v2, v3, v4 or v5) */ export function uuid(obj: any, version?: "all"): obj is string; + + export function emitter(obj: any): obj is event.Emitter; + + export function asyncEmitter(obj: any): obj is event.AsyncEmitter; } } diff --git a/types/adone/glosses/net/http/client.d.ts b/types/adone/glosses/net/http/client.d.ts new file mode 100644 index 0000000000..33bccc95ac --- /dev/null +++ b/types/adone/glosses/net/http/client.d.ts @@ -0,0 +1,275 @@ +declare namespace adone.net.http { + namespace client { + namespace I { + interface RequestHeaders { + "Accept"?: string; + "Accept-Charset"?: string; + "Accept-Encoding"?: string; + "Accept-Language"?: string; + "Accept-Datetime"?: string; + "Access-Control-Request-Method"?: string; + "Access-Control-Request-Headers"?: string; + "Authorization"?: string; + "Cache-Control"?: string; + "Connection"?: string; + "Cookie"?: string; + "Content-Length"?: string; + "Content-MD5"?: string; + "Content-Type"?: string; + "Date"?: string; + "Expect"?: string; + "Forwarded"?: string; + "From"?: string; + "Host"?: string; + "If-Match"?: string; + "If-Modified-Since"?: string; + "If-None-Match"?: string; + "If-Range"?: string; + "If-Unmodified-Since"?: string; + "Max-Forwards"?: string; + "Origin"?: string; + "Pragma"?: string; + "Proxy-Authorization"?: string; + "Range"?: string; + "Referer"?: string; + "TE"?: string; + "User-Agent"?: string; + "Upgrade"?: string; + "Via"?: string; + "Warning"?: string; + "X-Requested-With"?: string; + "DNT"?: string; + "X-Forwarded-For"?: string; + "X-Forwarded-Host"?: string; + "X-Forwarded-Proto"?: string; + "Front-End-Https"?: string; + "X-Http-Method-Override"?: string; + "X-ATT-DeviceId"?: string; + "X-Wap-Profile"?: string; + "Proxy-Connection"?: string; + "X-UIDH"?: string; + "X-Csrf-Token"?: string; + "X-Request-ID"?: string; + "X-Correlation-ID"?: string; + + [name: string]: string | undefined; + } + + interface ResponseHeaders { + "accept-patch": string | undefined; + "accept-ranges": string | undefined; + "access-control-allow-credentials": string | undefined; + "access-control-allow-headers": string | undefined; + "access-control-allow-methods": string | undefined; + "access-control-allow-origin": string | undefined; + "access-control-expose-headers": string | undefined; + "access-control-max-age": string | undefined; + "age": string | undefined; + "allow": string | undefined; + "alt-svc": string | undefined; + "cache-control": string | undefined; + "connection": string| undefined; + "content-disposition": string | undefined; + "content-encoding": string| undefined; + "content-language": string | undefined; + "content-length": string| undefined; + "content-location": string| undefined; + "content-md5": string| undefined; + "content-range": string| undefined; + "content-security-policy": string | undefined; + "content-type": string| undefined; + "date": string| undefined; + "etag": string| undefined; + "expires": string| undefined; + "keep-alive": string | undefined; + "last-modified": string | undefined; + "link": string| undefined; + "location": string| undefined; + "p3p": string| undefined; + "pragma": string| undefined; + "proxy-authenticate": string | undefined; + "public-key-pins": string| undefined; + "referer-policy": string | undefined; + "refresh": string | undefined; + "retry-after": string | undefined; + "server": string | undefined; + "set-cookie": string | undefined; + "status": string | undefined; + "strict-transport-security": string| undefined; + "timing-allow-origin": string | undefined; + "tk": string| undefined; + "transfer-encoding": string | undefined; + "upgrade-insecure-requests": string | undefined; + "upgrade": string| undefined; + "vary": string | undefined; + "via": string| undefined; + "warning": string| undefined; + "www-authenticate": string | undefined; + "x-content-duration": string | undefined; + "x-content-security-policy": string | undefined; + "x-content-type-options": string | undefined; + "x-correlation-id": string | undefined; + "x-frame-options": string| undefined; + "x-powered-by": string | undefined; + "x-request-id": string | undefined; + "x-ua-compatible": string | undefined; + "x-webkit-csp": string | undefined; + "x-xss-protection": string | undefined; + + [header: string]: string | undefined; + } + + interface Response { + status: number; + statusText: string; + headers: ResponseHeaders; + data: T; + } + + type Transformer = (data: Data, headers: object, config: I.Options) => Data; + + interface FormValueOptions { + header?: string | { [key: string]: string }; + knownLength?: number; + filename?: string; + filepath?: string; + contentType?: string; + } + + type FormValue = string | Buffer | nodestd.stream.Readable | { + value: string | Buffer | nodestd.stream.Readable; + options: FormValueOptions + }; + + interface UploadProgressEvent { + lengthComputable: boolean; + loaded: number; + total: number; + } + + interface ProxyObject { + protocol?: string; + host?: string; + port?: number; + auth?: { + username?: string; + password?: string; + }; + } + + interface Config { + adapter(config: I.Config): Promise>; + transformRequest: Transformer[]; + transformResponse: Transformer[]; + timeout: number; + xsrfCookieName: string; + xsrfHeaderName: string; + maxContentLength: number; + validateStatus: (status: number) => boolean; + responseType: "buffer" | "string" | "stream" | "json"; + responseEncoding: adone.util.iconv.I.SupportedEncoding; + method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS"; + headers: RequestHeaders; + data: Data; + formData: { + [formKey: string]: FormValue | FormValue[]; + }; + auth: { + username?: string; + password?: string; + }; + httpsAgent: object; + httpAgent: object; + params: object; + rejectUnauthorized: boolean; + proxy: string | ProxyObject | false; + transport: object; + maxRedirects: number; + cancelToken: CancelToken; + onUploadProgress(event: UploadProgressEvent): void; + baseURL: string; + paramsSerializer(params: object): string; + } + + type Options = Partial; + + type Data = string | Buffer | ArrayBuffer | nodestd.stream.Readable | ArrayBufferView | object | undefined; + + interface Request extends Client { + (config: I.Options, ...args: any[]): Promise; + } + } + + class Client { + constructor(options?: I.Options); + + request(config: I.Options & { responseType: "json" }, ...args: any[]): Promise>; + request(config: I.Options & { responseType: "string" }, ...args: any[]): Promise>; + request(config: I.Options & { responseType: "buffer" }, ...args: any[]): Promise>; + request(config: I.Options & { responseType: "stream" }, ...args: any[]): Promise>; + request(config: I.Options, ...args: any[]): Promise>; + + get(url: string, options: I.Options & { responseType: "string" }): Promise>; + get(url: string, options: I.Options & { responseType: "buffer" }): Promise>; + get(url: string, options: I.Options & { responseType: "stream" }): Promise>; + get(url: string, options?: I.Options): Promise>; + + post(url: string, data: I.Data, options: I.Options & { responseType: "string" }): Promise>; + post(url: string, data: I.Data, options: I.Options & { responseType: "buffer" }): Promise>; + post(url: string, data: I.Data, options: I.Options & { responseType: "stream" }): Promise>; + post(url: string, data?: I.Data, options?: I.Options): Promise>; + + put(url: string, data: I.Data, options: I.Options & { responseType: "string" }): Promise>; + put(url: string, data: I.Data, options: I.Options & { responseType: "buffer" }): Promise>; + put(url: string, data: I.Data, options: I.Options & { responseType: "stream" }): Promise>; + put(url: string, data?: I.Data, options?: I.Options): Promise>; + + patch(url: string, data: I.Data, options: I.Options & { responseType: "string" }): Promise>; + patch(url: string, data: I.Data, options: I.Options & { responseType: "buffer" }): Promise>; + patch(url: string, data: I.Data, options: I.Options & { responseType: "stream" }): Promise>; + patch(url: string, data?: I.Data, options?: I.Options): Promise>; + + delete(url: string, options: I.Options & { responseType: "string" }): Promise>; + delete(url: string, options: I.Options & { responseType: "buffer" }): Promise>; + delete(url: string, options: I.Options & { responseType: "stream" }): Promise>; + delete(url: string, options?: I.Options): Promise>; + + options(url: string, options: I.Options & { responseType: "string" }): Promise>; + options(url: string, options: I.Options & { responseType: "buffer" }): Promise>; + options(url: string, options: I.Options & { responseType: "stream" }): Promise>; + options(url: string, options?: I.Options): Promise>; + } + + class Cancel { + message: string; + + constructor(message: string); + } + + namespace I { + type Canceller = (message?: string) => void; + + interface CancelTokenSource { + token: CancelToken; + cancel: Canceller; + } + } + + class CancelToken { + promise: Promise; + reason?: Cancel; + + constructor(executor: I.Canceller); + + throwIfRequested(): void; + + static source(): I.CancelTokenSource; + } + + const request: I.Request; + + function create(options?: I.Options): I.Request; + + function isCancel(obj: any): obj is Cancel; + } +} diff --git a/types/adone/glosses/net/http/index.d.ts b/types/adone/glosses/net/http/index.d.ts new file mode 100644 index 0000000000..a4fbe478d8 --- /dev/null +++ b/types/adone/glosses/net/http/index.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace adone.net { + namespace http { + // + } +} diff --git a/types/adone/glosses/net/index.d.ts b/types/adone/glosses/net/index.d.ts new file mode 100644 index 0000000000..5e773e4601 --- /dev/null +++ b/types/adone/glosses/net/index.d.ts @@ -0,0 +1,7 @@ +/// + +declare namespace adone { + namespace net { + // + } +} diff --git a/types/adone/glosses/regex.d.ts b/types/adone/glosses/regex.d.ts new file mode 100644 index 0000000000..e5c3be642a --- /dev/null +++ b/types/adone/glosses/regex.d.ts @@ -0,0 +1,25 @@ +declare namespace adone { + namespace regex { + function filename(): RegExp; + + function ip4(): RegExp; + + function ip6(): RegExp; + + function protocol(): RegExp; + + function idn(): RegExp; + + function punycode(): RegExp; + + function uri(): RegExp; + + function uuid4(): RegExp; + + function uuid5(): RegExp; + + function ansi(): RegExp; + + function shebang(): RegExp; + } +} diff --git a/types/adone/glosses/semver.d.ts b/types/adone/glosses/semver.d.ts new file mode 100644 index 0000000000..6c78695600 --- /dev/null +++ b/types/adone/glosses/semver.d.ts @@ -0,0 +1,237 @@ +declare namespace adone { + namespace semver { + const SEMVER_SPEC_VERSION: "2.0.0"; + + namespace I { + type ReleaseType = "major" + | "premajor" + | "minor" + | "preminor" + | "patch" + | "prepatch" + | "prerelease"; + + type Operator = '===' + | "!==" + | "" + | "=" + | "==" + | "!=" + | ">" + | ">=" + | "<" + | "<="; + } + + /** + * Returns the parsed version as a SemVer object, or null if it's not valid. + */ + function parse(v: string | SemVer, loose?: boolean): SemVer | null; + + /** + * Returns the parsed version, or null if it's not valid. + */ + function valid(v: string | SemVer, loose?: boolean): string | null; + + /** + * Returns cleaned (removed leading/trailing whitespace, remove '=v' prefix) and parsed version, or null if version is invalid. + */ + function clean(version: string, loose?: boolean): string | null; + + /** + * Returns the version incremented by the release type (major, minor, patch, or prerelease), or null if it's not valid. + */ + function inc(v: string | SemVer, release: I.ReleaseType, loose?: boolean, identifier?: string): string | null; + + /** + * Returns the major version number. + */ + function major(v: string | SemVer, loose?: boolean): number; + + /** + * Returns the minor version number. + */ + function minor(v: string | SemVer, loose?: boolean): number; + + /** + * Returns the patch version number. + */ + function patch(v: string | SemVer, loose?: boolean): number; + + /** + * Returns an array of prerelease components, or null if none exist. + */ + function prerelease(v: string | SemVer, loose?: boolean): string[] | null; + + // Comparison + + /** + * v1 > v2 + */ + function gt(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 >= v2 + */ + function gte(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 < v2 + */ + function lt(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 <= v2 + */ + function lte(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 == v2 This is true if they're logically equivalent, even if they're not the exact same string. You already know how to compare strings. + */ + function eq(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * v1 != v2 The opposite of eq. + */ + function neq(v1: string | SemVer, v2: string | SemVer, loose?: boolean): boolean; + + /** + * Pass in a comparison string, and it'll call the corresponding semver comparison function. + * "===" and "!==" do simple string comparison, but are included for completeness. + * Throws if an invalid comparison string is provided. + */ + function cmp(v1: string | SemVer, operator: I.Operator, v2: string | SemVer, loose?: boolean): boolean; + + /** + * Returns 0 if v1 == v2, or 1 if v1 is greater, or -1 if v2 is greater. Sorts in ascending order if passed to Array.sort(). + */ + function compare(v1: string | SemVer, v2: string | SemVer, loose?: boolean): 1 | 0 | -1; + + /** + * The reverse of compare. Sorts an array of versions in descending order when passed to Array.sort(). + */ + function rcompare(v1: string | SemVer, v2: string | SemVer, loose?: boolean): 1 | 0 | -1; + + /** + * Compares two identifiers, must be numeric strings or truthy/falsy values. Sorts in ascending order if passed to Array.sort(). + */ + function compareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1; + + /** + * The reverse of compareIdentifiers. Sorts in descending order when passed to Array.sort(). + */ + function rcompareIdentifiers(a: string | null, b: string | null): 1 | 0 | -1; + + /** + * Sorts an array of semver entries in ascending order. + */ + function sort(list: Array, loose?: boolean): Array; + + /** + * Sorts an array of semver entries in descending order. + */ + function rsort(list: Array, loose?: boolean): Array; + + /** + * Returns difference between two versions by the release type (major, premajor, minor, preminor, patch, prepatch, or prerelease), or null if the versions are the same. + */ + function diff(v1: string, v2: string, loose?: boolean): I.ReleaseType | null; + + // Ranges + + /** + * Returns the valid range or null if it's not valid + */ + function validRange(range: string | Range, loose?: boolean): string; + + /** + * Returns true if the version satisfies the range. + */ + function satisfies(version: string | SemVer, range: string | Range, loose?: boolean): boolean; + + /** + * Returns the highest version in the list that satisfies the range, or null if none of them do. + */ + function maxSatisfying(versions: Array, range: string | Range, loose?: boolean): string; + + /** + * Returns the lowest version in the list that satisfies the range, or null if none of them do. + */ + function minSatisfying(versions: Array, range: string, loose?: boolean): string; + + /** + * Returns true if version is greater than all the versions possible in the range. + */ + function gtr(version: string | SemVer, range: string | Range, loose?: boolean): boolean; + + /** + * Returns true if version is less than all the versions possible in the range. + */ + function ltr(version: string | SemVer, range: string | Range, loose?: boolean): boolean; + + /** + * Returns true if the version is outside the bounds of the range in either the high or low direction. + * The hilo argument must be either the string '>' or '<'. (This is the function called by gtr and ltr.) + */ + function outside(version: string | SemVer, range: string | Range, hilo: '>' | '<', loose?: boolean): boolean; + + /** + * Returns true if any of the ranges comparators intersect + */ + function intersects(range1: string | Range, range2: string | Range, loose?: boolean): boolean; + + // Coercion + + /** + * Coerces a string to semver if possible + */ + function coerce(version: string | SemVer): SemVer | null; + + class SemVer { + constructor(version: string | SemVer, loose?: boolean); + + raw: string; + loose: boolean; + format(): string; + inspect(): string; + + major: number; + minor: number; + patch: number; + version: string; + build: string[]; + prerelease: string[]; + + compare(other: string | SemVer): 1 | 0 | -1; + compareMain(other: string | SemVer): 1 | 0 | -1; + comparePre(other: string | SemVer): 1 | 0 | -1; + inc(release: I.ReleaseType, identifier?: string): SemVer; + } + + class Comparator { + constructor(comp: string | Comparator, loose?: boolean); + + semver: SemVer; + operator: string; + value: boolean; + parse(comp: string): void; + test(version: string | SemVer): boolean; + intersects(comp: Comparator, loose?: boolean): boolean; + } + + class Range { + constructor(range: string | Range, loose?: boolean); + + range: string; + raw: string; + loose: boolean; + format(): string; + inspect(): string; + + set: Comparator[][]; + parseRange(range: string): Comparator[]; + test(version: string | SemVer): boolean; + intersects(range: Range, loose?: boolean): boolean; + } + } +} diff --git a/types/adone/glosses/std.d.ts b/types/adone/glosses/std.d.ts index ec4bc4c37a..376b814d3e 100644 --- a/types/adone/glosses/std.d.ts +++ b/types/adone/glosses/std.d.ts @@ -1,34 +1,37 @@ -import * as assert from "assert"; -import * as fs from "fs"; -import * as path from "path"; -import * as util from "util"; -import * as events from "events"; -import * as stream from "stream"; -import * as url from "url"; -import * as net from "net"; -import * as http from "http"; -import * as https from "https"; -import * as child_process from "child_process"; -import * as os from "os"; -import * as cluster from "cluster"; -import * as repl from "repl"; -import * as punycode from "punycode"; -import * as readline from "readline"; -import * as string_decoder from "string_decoder"; -import * as querystring from "querystring"; -import * as crypto from "crypto"; -import * as vm from "vm"; -import * as v8 from "v8"; -import * as domain from "domain"; -import * as tty from "tty"; -import * as buffer from "buffer"; -import * as constants from "constants"; -import * as zlib from "zlib"; -import * as tls from "tls"; -import * as console from "console"; -import * as dns from "dns"; -import * as timers from "timers"; -import * as dgram from "dgram"; +import assert = require("assert"); +import fs = require("fs"); +import path = require("path"); +import util = require("util"); +import events = require("events"); +import stream = require("stream"); +import url = require("url"); +import net = require("net"); +import http = require("http"); +import http2 = require("http2"); +import https = require("https"); +import child_process = require("child_process"); +import os = require("os"); +import cluster = require("cluster"); +import repl = require("repl"); +import punycode = require("punycode"); +import readline = require("readline"); +import string_decoder = require("string_decoder"); +import querystring = require("querystring"); +import crypto = require("crypto"); +import vm = require("vm"); +import v8 = require("v8"); +import domain = require("domain"); +import module = require("module"); +import tty = require("tty"); +import buffer = require("buffer"); +import constants = require("constants"); +import zlib = require("zlib"); +import tls = require("tls"); +import console = require("console"); +import dns = require("dns"); +import timers = require("timers"); +import dgram = require("dgram"); +import perf_hooks = require("perf_hooks"); export { assert, @@ -40,6 +43,7 @@ export { url, net, http, + http2, https, child_process, os, @@ -53,6 +57,7 @@ export { vm, v8, domain, + module, tty, buffer, constants, @@ -62,6 +67,7 @@ export { dns, timers, dgram, + perf_hooks }; export as namespace nodestd; diff --git a/types/adone/glosses/system/env.d.ts b/types/adone/glosses/system/env.d.ts new file mode 100644 index 0000000000..3ad18ab041 --- /dev/null +++ b/types/adone/glosses/system/env.d.ts @@ -0,0 +1,19 @@ +declare namespace adone.system { + namespace env { + function user(): string; + + function prompt(): string; + + function hostname(): string; + + function tmpdir(): string; + + function home(): string; + + function path(): string; + + function editor(): string; + + function shell(): string; + } +} diff --git a/types/adone/glosses/system/index.d.ts b/types/adone/glosses/system/index.d.ts new file mode 100644 index 0000000000..7a3ceced9d --- /dev/null +++ b/types/adone/glosses/system/index.d.ts @@ -0,0 +1,9 @@ +/// +/// +/// + +declare namespace adone { + namespace system { + // + } +} diff --git a/types/adone/glosses/system/process.d.ts b/types/adone/glosses/system/process.d.ts new file mode 100644 index 0000000000..51d0c45ddc --- /dev/null +++ b/types/adone/glosses/system/process.d.ts @@ -0,0 +1,241 @@ +declare namespace adone.system.process { + function errname(code: number): string; + + function errnameFallback(uv: object, code: number): string; + + function stdio(opts: object): any[]; + + namespace I { + type StdIOOption = "pipe" | "ipc" | "ignore" | nodestd.stream.Stream | number | null | undefined; + + interface ExecCommonOptions { + /** + * Current working directory of the child process. + * @default `process.cwd()` + */ + cwd?: string; + + /** + * Environment key-value pairs. + * Extends automatically from `process.env`. + * Set `extendEnv` to `false` if you don"t want this. + * @default `process.env` + */ + env?: NodeJS.ProcessEnv; + + /** + * Set to `false` if you don't want to extend the environment variables when providing the `env` property. + * @default `true` + */ + extendEnv?: boolean; + + /** + * Explicitly set the value of `argv[0]` sent to the child process. + * This will be set to `command` or `file` if not specified. + */ + argv0?: string; + + /** + * The `stdio` option is used to configure the pipes that are established between the parent and child process. + * By default, the child's stdin, stdout, and stderr are redirected to corresponding `subprocess.stdin`, `subprocess.stdout`, and `subprocess.stderr` streams on the `ChildProcess` object. + * @default `'pipe'` + * + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdio?: "pipe" | "ignore" | "inherit" | StdIOOption[]; + + /** + * Prepare child to run independently of its parent process. + * Specific behavior depends on the platform. + * @see https://nodejs.org/api/child_process.html#child_process_options_detached + */ + detached?: boolean; + + /** + * Sets the user identity of the process. + */ + uid?: number; + + /** + * Sets the group identity of the process. + */ + gid?: number; + + /** + * If `true`, runs `command` inside of a shell. + * Uses `/bin/sh` on UNIX and `cmd.exe` on Windows. + * A different shell can be specified as a string. + * The shell should understand the `-c` switch on UNIX or `/d /s /c` on Windows. + * @default `false` + */ + shell?: boolean | string; + + /** + * If `true`, no quoting or escaping of arguments is done on Windows. + * Ignored on other platforms. + * This is set to `true` automatically when `shell` is specified. + * @default `false` + */ + windowsVerbatimArguments?: boolean; + + /** + * Strip EOF (last newline) from the output. + * @default `true` + * @see https://github.com/sindresorhus/strip-eof + */ + stripEof?: boolean; + + /** + * Prefer locally installed binaries when looking for a binary to execute. + * If you `$ npm install foo`, you can then `execa('foo')`. + * @default `true` + */ + preferLocal?: boolean; + + /** + * Preferred path to find locally installed binaries in (use with `preferLocal`). + * @default `process.cwd()` + */ + localDir?: string; + + /** + * Setting this to `false` resolves the promise with the error instead of rejecting it. + * @default `true` + */ + reject?: boolean; + + /** + * Keep track of the spawned process and `kill` it when the parent process exits. + * @default `true` + */ + cleanup?: boolean; + + /** + * Specify the character encoding used to decode the `stdout` and `stderr` output. + * @default `utf8` + */ + encoding?: string; + + /** + * If `timeout` is greater than `0`, the parent will send the signal identified by the `killSignal` property + * (the default is `SIGTERM`) if the child runs longer than `timeout` milliseconds. + * + * @default `0` + */ + timeout?: number; + + /** + * Largest amount of data in bytes allowed on `stdout` or `stderr`. + * @default `10000000` (10MB) + */ + maxBuffer?: number; + + /** + * Signal value to be used when the spawned process will be killed. + * @default `SIGTERM` + */ + killSignal?: string | number; + + /** + * Used to configure the stdin pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdin?: StdIOOption; + + /** + * Used to configure the stdout pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stdout?: StdIOOption; + + /** + * Used to configure the stderr pipe that is established between the parent and child process. + * @default `'pipe'` + * @see https://nodejs.org/api/child_process.html#child_process_options_stdio + */ + stderr?: StdIOOption; + } + + interface ExecOptions extends ExecCommonOptions { + /** + * Write some input to the `stdin` of your binary. + */ + input?: string | Buffer | nodestd.stream.Stream; + } + + interface ExecSyncOptions extends ExecCommonOptions { + /** + * Write some input to the `stdin` of your binary. + * Streams are not allowed when using the synchronous methods. + */ + input?: string | Buffer; + } + + interface ExecReturns { + /** + * The command that was run. + */ + cmd: string; + + /** + * The exit code of the process that was run. + */ + code: number; + + /** + * Whether the process failed to run. + */ + failed: boolean; + + /** + * Whether the process was killed. + */ + killed: boolean; + + /** + * The signal that was used to terminate the process. + */ + signal: string | null; + + /** + * The output of the process on stderr. + */ + stderr: string; + + /** + * The output of the process on stdout. + */ + stdout: string; + + /** + * Whether the process timed out. + */ + timedOut: boolean; + } + + type ExecError = Error & ExecReturns; + + interface ExecChildPromise { + catch(onrejected?: ((reason: ExecError) => TResult | PromiseLike) | null): Promise; + } + + type ExecChildProcess = nodestd.child_process.ChildProcess & ExecChildPromise & Promise; + } + + function exec(cmd: string, args?: string[], opts?: I.ExecOptions): I.ExecChildProcess; + function exec(cmd: string, opts?: I.ExecOptions): I.ExecChildProcess; + + function execStdout(cmd: string, args?: string[], opts?: I.ExecOptions): Promise; + function execStdout(cmd: string, opts?: I.ExecOptions): Promise; + + function execStderr(cmd: string, args?: string[], opts?: I.ExecOptions): Promise; + function execStderr(cmd: string, opts?: I.ExecOptions): Promise; + + function shell(cmd: string, opts?: I.ExecOptions): I.ExecChildProcess; + + function execSync(cmd: string, args?: string[], opts?: I.ExecSyncOptions): I.ExecReturns; + + function shellSync(cmd: string, opts?: I.ExecSyncOptions): I.ExecReturns; +} diff --git a/types/adone/glosses/system/user.d.ts b/types/adone/glosses/system/user.d.ts new file mode 100644 index 0000000000..508f67e894 --- /dev/null +++ b/types/adone/glosses/system/user.d.ts @@ -0,0 +1,31 @@ +declare namespace adone.system { + /** + * Utils for uid/gid + */ + namespace user { + /** + * Returns uid by the given username + */ + function uid(username: string): { uid: number, gid: number }; + + /** + * Returns gid by the given groupname + */ + function gid(groupname: string): number; + + /** + * Returns gids the given user belongs + */ + function gids(username: string): number[]; + + /** + * Returns username by the given uid + */ + function username(uid: number): string; + + /** + * Returns groupname by the given gid + */ + function groupname(gid: number): string; + } +} diff --git a/types/adone/glosses/templating/dot.d.ts b/types/adone/glosses/templating/dot.d.ts new file mode 100644 index 0000000000..500efe8d35 --- /dev/null +++ b/types/adone/glosses/templating/dot.d.ts @@ -0,0 +1,41 @@ +declare namespace adone.templating { + namespace dot { + namespace I { + type RenderFunction = (...args: any[]) => string; + + interface TemplateSettings { + evaluate: RegExp; + interpolate: RegExp; + encode: RegExp; + use: RegExp; + useParams: RegExp; + define: RegExp; + defineParams: RegExp; + conditional: RegExp; + iterate: RegExp; + varname: string; + strip: boolean; + append: boolean; + selfcontained: boolean; + } + } + const version: string; + + let templateSettings: I.TemplateSettings; + + function template(tmpl: string, c?: I.TemplateSettings, def?: {}): I.RenderFunction; + + function compile(tmpl: string, def?: object): I.RenderFunction; + + namespace I { + interface ProcessOptions { + path?: string; + destination?: string; + global?: string; + templateSettings?: Partial; + } + } + + function process(options?: I.ProcessOptions): { [path: string]: I.RenderFunction }; + } +} diff --git a/types/adone/glosses/templating/index.d.ts b/types/adone/glosses/templating/index.d.ts new file mode 100644 index 0000000000..81f9964335 --- /dev/null +++ b/types/adone/glosses/templating/index.d.ts @@ -0,0 +1,8 @@ +/// +/// + +declare namespace adone { + namespace templating { + // + } +} diff --git a/types/adone/glosses/templating/nunjucks.d.ts b/types/adone/glosses/templating/nunjucks.d.ts new file mode 100644 index 0000000000..d0aed211cc --- /dev/null +++ b/types/adone/glosses/templating/nunjucks.d.ts @@ -0,0 +1,121 @@ +declare namespace adone.templating { + namespace nunjucks { + namespace I { + interface EnvironmentOptions { + dev?: boolean; + autoescape?: boolean; + throOnUndefined?: boolean; + trimBlocks?: boolean; + lstripBlocks?: boolean; + } + + interface FileSystemLoaderOptions { + watch?: boolean; + noCache?: boolean; + } + + type ConfigureOptions = EnvironmentOptions & FileSystemLoaderOptions & { + tags?: { + blockStart?: string, + blockEnd?: string, + variableStart?: string, + variableEnd?: string, + commentStart?: string, + commentEnd?: string + }; + }; + + interface PrecompileOptions { + name?: string; + asFunction?: boolean; + force?: boolean; + env?: Environment; + include?: string[]; + exclude?: string[]; + wrapper?(templates: { name: string, template: string }, opts: PrecompileOptions): string; + } + + interface Extension { + tags: string[]; + parse(parser: any, nodes: any, lexer: any): any; + } + + interface LoaderSource { + src: string; + path: string; + noCache: boolean; + } + + interface Loader { + async?: boolean; + getSource(name: string): LoaderSource; + extend?(extender: Loader): Loader; + } + } + + class Environment { + options: { + autoescape: boolean; + }; + + constructor(loader?: I.Loader | I.Loader[] | null, opts?: I.EnvironmentOptions); + render(name: string, context?: object): string; + render(name: string, context?: object, callback?: (err: any, res: string) => any): void; + + renderString(name: string, context?: object): string; + renderString(name: string, context?: object, callback?: (err: any, res: string) => any): void; + + addFilter(name: string, func: (...args: any[]) => any, async?: boolean): void; + getFilter(name: string): (...args: any[]) => any; + + addExtension(name: string, ext: I.Extension): void; + removeExtension(name: string): void; + getExtension(name: string): I.Extension; + hasExtension(name: string): boolean; + + addGlobal(name: string, value: any): this; + + getTemplate(name: string, eagerCompile?: boolean): Template; + getTemplate(name: string, eagerCompile?: boolean, callback?: (err: any, templ: Template) => Template): void; + + express(app: object): void; + } + + class Template { + constructor(src: string, env?: Environment, eagerCompile?: boolean); + render(context?: object): string; + render(context?: object, callback?: (err: any, res: string) => any): void; + } + + class Loader { + on(name: string, func: (...args: any[]) => any): void; + emit(name: string, ...args: any[]): void; + resolve(from: string, to: string): string; + isRelative(filename: string): boolean; + extend(toExtend: I.Loader): I.Loader; + } + + class FileSystemLoader extends Loader implements I.Loader { + constructor(searchPaths?: string | string[], opts?: I.FileSystemLoaderOptions); + + getSource(name: string): I.LoaderSource; + } + + class PrecompiledLoader extends Loader implements I.Loader { + getSource(name: string): I.LoaderSource; + } + + function renderSync(name: string, context?: object): string; + function render(name: string, context?: object): Promise; + + function renderString(src: string, context?: object): Promise; + function renderStringSync(src: string, context?: object): string; + + function compile(src: string, env?: Environment, path?: string, eagerCompile?: boolean): Template; + + function configure(options?: I.ConfigureOptions): Environment; + function configure(path: string | string[], options?: I.ConfigureOptions): Environment; + + function installJinjaCompat(): void; + } +} diff --git a/types/adone/glosses/text/index.d.ts b/types/adone/glosses/text/index.d.ts new file mode 100644 index 0000000000..a640789765 --- /dev/null +++ b/types/adone/glosses/text/index.d.ts @@ -0,0 +1,77 @@ +/// +/// +/// +/// + +declare namespace adone { + namespace text { + namespace escape { + function regExpPattern(str: string): string; + + function regExpReplacement(str: string): string; + + function format(str: string): string; + + function shellArg(str: string): string; + + function control(str: string): string; + + function htmlSpecialChars(str: string): string; + } + + namespace regexp { + function array2alternatives(array: string[]): string; + } + + function escapeStringRegexp(str: string): string; + + function toCamelCase(str: string): string; + + function camelCaseToDashed(str: string): string; + + const endLineRegExp: RegExp; + + function splitLines(str: string): string[]; + + function regExpIndexOf(str: string, regex: RegExp, index?: number): string; + + function stripAnsi(str: string): string; + + function hasAnsi(str: string): boolean; + + function random(len: number): string; + + function detectNewLine(str: string): "\r\n" | "\n"; + + namespace I { + interface WordWrapOptions { + join?: boolean; + mode?: "soft" | "hard"; + countAnsiEscapeCodes?: boolean; + } + } + + function wordwrap(str: string, stop: number, options: I.WordWrapOptions & { join: false}): string[]; + function wordwrap(str: string, stop: number, options?: I.WordWrapOptions): string; + + function stringDistance(strA: string, strB: string, memo?: number[][]): number; + + function stringDistanceCapped(strA: string, strB: string, cap: number): number; + + function capitalize(str: string): string; + + function capitalizeWords(str: string): string; + + function width(str: string): number; + + function indent(string: string, spaces: number): string; + + function stripEof(str: string): string; + + function stripLastCRLF(str: string): string; + + function stripBOM(str: string): string; + + function toUTF8Array(str: string): number[]; + } +} diff --git a/types/adone/glosses/text/pretties.d.ts b/types/adone/glosses/text/pretties.d.ts new file mode 100644 index 0000000000..886901b268 --- /dev/null +++ b/types/adone/glosses/text/pretties.d.ts @@ -0,0 +1,55 @@ +declare namespace adone.text { + namespace pretty { + namespace I { + interface JSONOptions { + emptyArrayMsg?: string; + keysColor?: string; + dashColor?: string; + numberColor?: string; + stringColor?: string; + defaultIndentation?: number; + noColor?: boolean; + noAlign?: boolean; + } + } + + function json(data: any, options?: I.JSONOptions, indentation?: number): string; + + namespace I { + interface TableColumn { + id: string; + header?: string; + align?: "right" | "center" | "left"; + width?: string | number; + maxWidth?: number | string; + wordwrap?: "soft" | "hard" | adone.text.I.WordWrapOptions; + handle?: (item: object) => string; + format?: string | ((val: any, item: object) => string); + style?: string | ((val: any, str: string) => string); + } + + type TableModel = TableColumn[]; + + interface TableStyle { + "padding-left"?: number; + "padding-right"?: number; + head?: string[]; + broder?: string[]; + compact?: boolean; + } + + interface TableOptions { + model: TableModel; + noHeader?: boolean; + borderless?: boolean; + style?: TableStyle; + width?: number | string; + countAnsiEscapeCodes?: boolean; + } + + type TableData = Array<{ [id: string]: any }>; + } + + function table(data: I.TableData, options: I.TableOptions): string; + } +} diff --git a/types/adone/glosses/text/spinners.d.ts b/types/adone/glosses/text/spinners.d.ts new file mode 100644 index 0000000000..962a6aebab --- /dev/null +++ b/types/adone/glosses/text/spinners.d.ts @@ -0,0 +1,468 @@ +declare namespace adone.text { + namespace spinner { + const dots: { + interval: 80, + frames: [ + "⠋", + "⠙", + "⠹", + "⠸", + "⠼", + "⠴", + "⠦", + "⠧", + "⠇", + "⠏" + ] + }; + const dots2: { + interval: 80, + frames: [ + "⣾", + "⣽", + "⣻", + "⢿", + "⡿", + "⣟", + "⣯", + "⣷" + ] + }; + const dots3: { + interval: 80, + frames: [ + "⠋", + "⠙", + "⠚", + "⠞", + "⠖", + "⠦", + "⠴", + "⠲", + "⠳", + "⠓" + ] + }; + const dots4: { + interval: 80, + frames: [ + "⠄", + "⠆", + "⠇", + "⠋", + "⠙", + "⠸", + "⠰", + "⠠", + "⠰", + "⠸", + "⠙", + "⠋", + "⠇", + "⠆" + ] + }; + const dots5: { + interval: 80, + frames: [ + "⠋", + "⠙", + "⠚", + "⠒", + "⠂", + "⠂", + "⠒", + "⠲", + "⠴", + "⠦", + "⠖", + "⠒", + "⠐", + "⠐", + "⠒", + "⠓", + "⠋" + ] + }; + const dots6: { + interval: 80, + frames: [ + "⠁", + "⠉", + "⠙", + "⠚", + "⠒", + "⠂", + "⠂", + "⠒", + "⠲", + "⠴", + "⠤", + "⠄", + "⠄", + "⠤", + "⠴", + "⠲", + "⠒", + "⠂", + "⠂", + "⠒", + "⠚", + "⠙", + "⠉", + "⠁" + ] + }; + const dots7: { + interval: 80, + frames: [ + "⠈", + "⠉", + "⠋", + "⠓", + "⠒", + "⠐", + "⠐", + "⠒", + "⠖", + "⠦", + "⠤", + "⠠", + "⠠", + "⠤", + "⠦", + "⠖", + "⠒", + "⠐", + "⠐", + "⠒", + "⠓", + "⠋", + "⠉", + "⠈" + ] + }; + const dots8: { + interval: 80, + frames: [ + "⠁", + "⠁", + "⠉", + "⠙", + "⠚", + "⠒", + "⠂", + "⠂", + "⠒", + "⠲", + "⠴", + "⠤", + "⠄", + "⠄", + "⠤", + "⠠", + "⠠", + "⠤", + "⠦", + "⠖", + "⠒", + "⠐", + "⠐", + "⠒", + "⠓", + "⠋", + "⠉", + "⠈", + "⠈" + ] + }; + const dots9: { + interval: 80, + frames: [ + "⢹", + "⢺", + "⢼", + "⣸", + "⣇", + "⡧", + "⡗", + "⡏" + ] + }; + const dots10: { + interval: 80, + frames: [ + "⢄", + "⢂", + "⢁", + "⡁", + "⡈", + "⡐", + "⡠" + ] + }; + const dots11: { + interval: 100, + frames: [ + "⠁", + "⠂", + "⠄", + "⡀", + "⢀", + "⠠", + "⠐", + "⠈" + ] + }; + const dots12: { + interval: 80, + frames: [ + "⢀⠀", + "⡀⠀", + "⠄⠀", + "⢂⠀", + "⡂⠀", + "⠅⠀", + "⢃⠀", + "⡃⠀", + "⠍⠀", + "⢋⠀", + "⡋⠀", + "⠍⠁", + "⢋⠁", + "⡋⠁", + "⠍⠉", + "⠋⠉", + "⠋⠉", + "⠉⠙", + "⠉⠙", + "⠉⠩", + "⠈⢙", + "⠈⡙", + "⢈⠩", + "⡀⢙", + "⠄⡙", + "⢂⠩", + "⡂⢘", + "⠅⡘", + "⢃⠨", + "⡃⢐", + "⠍⡐", + "⢋⠠", + "⡋⢀", + "⠍⡁", + "⢋⠁", + "⡋⠁", + "⠍⠉", + "⠋⠉", + "⠋⠉", + "⠉⠙", + "⠉⠙", + "⠉⠩", + "⠈⢙", + "⠈⡙", + "⠈⠩", + "⠀⢙", + "⠀⡙", + "⠀⠩", + "⠀⢘", + "⠀⡘", + "⠀⠨", + "⠀⢐", + "⠀⡐", + "⠀⠠", + "⠀⢀", + "⠀⡀" + ] + }; + const line: { + interval: 130, + frames: [ + "-", + "\\", + "|", + "/" + ] + }; + const pipe: { + interval: 100, + frames: [ + "┤", + "┘", + "┴", + "└", + "├", + "┌", + "┬", + "┐" + ] + }; + const simpleDots: { + interval: 200, + frames: [ + ". ", + ".. ", + "...", + " ..", + " .", + " " + ] + }; + const flip: { + interval: 70, + frames: [ + "_", + "_", + "_", + "-", + "`", + "`", + "'", + "´", + "-", + "_", + "_", + "_" + ] + }; + const growVertical: { + interval: 120, + frames: [ + "▁", + "▃", + "▄", + "▅", + "▆", + "▇", + "▆", + "▅", + "▄", + "▃" + ] + }; + const growHorizontal: { + interval: 120, + frames: [ + "▏", + "▎", + "▍", + "▌", + "▋", + "▊", + "▉", + "▊", + "▋", + "▌", + "▍", + "▎" + ] + }; + const boxBounce: { + interval: 120, + frames: [ + "▖", + "▘", + "▝", + "▗" + ] + }; + const boxBounce2: { + interval: 100, + frames: [ + "▌", + "▀", + "▐", + "▄" + ] + }; + const triangle: { + interval: 50, + frames: [ + "◢", + "◣", + "◤", + "◥" + ] + }; + const squareCorners: { + interval: 180, + frames: [ + "◰", + "◳", + "◲", + "◱" + ] + }; + const circleQuarters: { + interval: 120, + frames: [ + "◴", + "◷", + "◶", + "◵" + ] + }; + const circleHalves: { + interval: 80, + frames: [ + "◐", + "◓", + "◑", + "◒" + ] + }; + const arrow: { + interval: 80, + frames: [ + "⬆️ ", + "↗️ ", + "➡️ ", + "↘️ ", + "⬇️ ", + "↙️ ", + "⬅️ ", + "↖️ " + ] + }; + const arrow3: { + interval: 120, + frames: [ + "▹▹▹▹▹", + "▸▹▹▹▹", + "▹▸▹▹▹", + "▹▹▸▹▹", + "▹▹▹▸▹", + "▹▹▹▹▸" + ] + }; + const bouncingBar: { + interval: 80, + frames: [ + "[ ]", + "[ =]", + "[ ==]", + "[ ===]", + "[====]", + "[=== ]", + "[== ]", + "[= ]" + ] + }; + const clock: { + interval: 100, + frames: [ + "🕐 ", + "🕑 ", + "🕒 ", + "🕓 ", + "🕔 ", + "🕕 ", + "🕖 ", + "🕗 ", + "🕘 ", + "🕙 ", + "🕚 " + ] + }; + } +} diff --git a/types/adone/glosses/text/table.d.ts b/types/adone/glosses/text/table.d.ts new file mode 100644 index 0000000000..2bfaaa07fd --- /dev/null +++ b/types/adone/glosses/text/table.d.ts @@ -0,0 +1,73 @@ +declare namespace adone.text { + namespace table { + namespace I { + interface CharsOptions { + top: string; + "top-mid": string; + "top-left": string; + "top-right": string; + bottom: string; + "bottom-mid": string; + "bottom-left": string; + "bottom-right": string; + left: string; + "left-mid": string; + mid: string; + "mid-mid": string; + right: string; + "right-mid": string; + middle: string; + } + + interface StyleOptions { + "padding-left": number; + "padding-right": number; + head: string[]; + border: string[]; + compact: boolean; + } + + interface CommonOptions { + truncate: string; + colWidths: number[]; + rowHeights: number[]; + colAligns: Array<"left" | "center" | "right">; + rowAligns: Array<"top" | "center" | "bottom">; + head: string[]; + } + + interface Options extends CommonOptions { + style: StyleOptions; + chars: CharsOptions; + } + + interface ConstructorOptions extends Partial { + style?: Partial; + chars?: Partial; + } + } + + class Table extends Array { + constructor(options?: I.ConstructorOptions); + + toString(): string; + + readonly width: number; + + static readonly defaultOptions: I.Options; + } + + namespace I { + interface BorderlessConstructorOptions { + colWidths?: number[]; + head?: string[]; + colAligns?: Array<"left" | "center" | "right">; + style?: Partial; + } + } + + class BorderlessTable extends Table { + constructor(options?: I.BorderlessConstructorOptions); + } + } +} diff --git a/types/adone/glosses/text/unicode.d.ts b/types/adone/glosses/text/unicode.d.ts new file mode 100644 index 0000000000..98b449b9a3 --- /dev/null +++ b/types/adone/glosses/text/unicode.d.ts @@ -0,0 +1,137 @@ +declare namespace adone.text { + namespace unicode { + const symbol: { + tick: "✔", + cross: "✖", + star: "★", + square: "▇", + squareSmall: "◻", + squareSmallFilled: "◼", + play: "▶", + circle: "◯", + circleFilled: "◉", + circleDotted: "◌", + circleDouble: "◎", + circleCircle: "ⓞ", + circleCross: "ⓧ", + circlePipe: "Ⓘ", + circleQuestionMark: "?⃝", + bullet: "●", + dot: "․", + line: "─", + ellipsis: "…", + pointer: "❯", + pointerSmall: "›", + info: "ℹ", + warning: "⚠", + hamburger: "☰", + smiley: "㋡", + mustache: "෴", + heart: "♥", + arrowUp: "↑", + arrowDown: "↓", + arrowLeft: "←", + arrowRight: "→", + radioOn: "◉", + radioOff: "◯", + checkboxOn: "☒", + checkboxOff: "☐", + checkboxCircleOn: "ⓧ", + checkboxCircleOff: "Ⓘ", + questionMarkPrefix: "?" | "?⃝", + oneHalf: "½", + oneThird: "⅓", + oneQuarter: "¼", + oneFifth: "⅕", + oneSixth: "⅙", + oneSeventh: "⅐", + oneEighth: "⅛", + oneNinth: "⅑", + oneTenth: "⅒", + twoThirds: "⅔", + twoFifths: "⅖", + threeQuarters: "¾", + threeFifths: "⅗", + threeEighths: "⅜", + fourFifths: "⅘", + fiveSixths: "⅚", + fiveEighths: "⅝", + sevenEighths: "⅞", + minus: "−" + }; + + const symbolFallback: { + tick: "√", + cross: "×", + star: "*", + square: "█", + squareSmall: "[ ]", + squareSmallFilled: "[█]", + play: "►", + circle: "( )", + circleFilled: "(*)", + circleDotted: "( )", + circleDouble: "( )", + circleCircle: "(○)", + circleCross: "(×)", + circlePipe: "(│)", + circleQuestionMark: "(?)", + bullet: "*", + dot: ".", + line: "─", + ellipsis: "...", + pointer: ">", + pointerSmall: "»", + info: "i", + warning: "‼", + hamburger: "≡", + smiley: "☺", + mustache: "┌─┐", + heart: "♥", + arrowUp: "↑", + arrowDown: "↓", + arrowLeft: "←", + arrowRight: "→", + radioOn: "(*)", + radioOff: "( )", + checkboxOn: "[×]", + checkboxOff: "[ ]", + checkboxCircleOn: "(×)", + checkboxCircleOff: "( )", + questionMarkPrefix: "?", + oneHalf: "1/2", + oneThird: "1/3", + oneQuarter: "1/4", + oneFifth: "1/5", + oneSixth: "1/6", + oneSeventh: "1/7", + oneEighth: "1/8", + oneNinth: "1/9", + oneTenth: "1/10", + twoThirds: "2/3", + twoFifths: "2/5", + threeQuarters: "3/4", + threeFifths: "3/5", + threeEighths: "3/8", + fourFifths: "4/5", + fiveSixths: "5/6", + fiveEighths: "5/8", + sevenEighths: "7/8", + minus: "-" + }; + + function approx(str: string): string; + + function length(str: string): number; + + function toArray(str: string): string[]; + + function surrogatePair(char: string): number; + + function isFullWidthCodePoint(code: number): boolean; + + function isFullWidth(char: string): boolean; + + function toFullWidth(str: string): string; + } +} diff --git a/types/adone/glosses/utils.d.ts b/types/adone/glosses/utils.d.ts index 480c2354ce..d84dce79c9 100644 --- a/types/adone/glosses/utils.d.ts +++ b/types/adone/glosses/utils.d.ts @@ -252,7 +252,225 @@ declare namespace adone { function delegate(object: object, property: string): I.Delegator; namespace iconv { - // TODO: need to normalize source code + namespace I { + namespace encoding { + type Native = "UTF-8" + | "UCS-2" + | "UTF-16LE" + | "ASCII" + | "Binary" + | "Base64" + | "Hex"; + + type Unicode = "UTF-16BE" | "UTF-16"; + + type Windows = "874" + | "1250" + | "1251" + | "1252" + | "1253" + | "1254" + | "1255" + | "1256" + | "1257" + | "1258" + | "CP874" + | "CP1251" + | "CP1252" + | "CP1253" + | "CP1254" + | "CP1255" + | "CP1256" + | "CP1257" + | "CP1258" + | "Win-1251" + | "Win-1252" + | "Win-1253" + | "Win-1254" + | "Win-1255" + | "Win-1256" + | "Win-1257" + | "Win-1258" + | "Windows-1251" + | "Windows-1252" + | "Windows-1253" + | "Windows-1254" + | "Windows-1255" + | "Windows-1256" + | "Windows-1257" + | "Windows-1258"; + + type ISO = "ISO-8829-1" + | "ISO-8859-2" + | "ISO-8859-3" + | "ISO-8859-4" + | "ISO-8859-5" + | "ISO-8859-6" + | "ISO-8859-7" + | "ISO-8859-8" + | "ISO-8859-9" + | "ISO-8859-10" + | "ISO-8859-11" + | "ISO-8859-12" + | "ISO-8859-13" + | "ISO-8859-14" + | "ISO-8859-15" + | "ISO-8859-16"; + + type IBM = "437" + | "737" + | "775" + | "808" + | "850" + | "852" + | "855" + | "856" + | "857" + | "858" + | "860" + | "861" + | "862" + | "863" + | "864" + | "865" + | "866" + | "869" + | "922" + | "1046" + | "1124" + | "1125" + | "1129" + | "1133" + | "1161" + | "1163" + | "CP437" + | "CP737" + | "CP775" + | "CP808" + | "CP850" + | "CP852" + | "CP855" + | "CP856" + | "CP857" + | "CP858" + | "CP860" + | "CP861" + | "CP862" + | "CP863" + | "CP864" + | "CP865" + | "CP866" + | "CP869" + | "CP922" + | "CP1046" + | "CP1124" + | "CP1125" + | "CP1129" + | "CP1133" + | "CP1161" + | "CP1163" + | "IBM437" + | "IBM737" + | "IBM775" + | "IBM808" + | "IBM850" + | "IBM852" + | "IBM855" + | "IBM856" + | "IBM857" + | "IBM858" + | "IBM860" + | "IBM861" + | "IBM862" + | "IBM863" + | "IBM864" + | "IBM865" + | "IBM866" + | "IBM869" + | "IBM922" + | "IBM1046" + | "IBM1124" + | "IBM1125" + | "IBM1129" + | "IBM1133" + | "IBM1161" + | "IBM1163"; + + type Mac = "MacCroatian" + | "MacCyrillic" + | "MacGreek" + | "MacIceland" + | "MacRoman" + | "MacThai" + | "MacTurkish" + | "MacUkraine" + | "MacCentEuro" + | "Macintosh"; + + type KOI8 = "KOI8-R" + | "KOI8-U" + | "KOI8-RU" + | "KOI8-T"; + + type Misc = "ArmSCII8" + | "RK1048" + | "TCVN" + | "GEORGIAN-ACADEMY" + | "GEORGIAN-PS" + | "PT154" + | "VISCII" + | "ISO-646-CN" + | "ISO-646-JP" + | "HP Roman-8" + | "TIS-620"; + + type Singlebyte = Windows + | ISO + | IBM + | Mac + | KOI8 + | Misc; + + type Japanese = "Shift_JIS" + | "Windows-31J" + | "windows-932" + | "EUC-JP"; + + type Chinese = "GB2312" + | "GBK" + | "GB18030" + | "Windows-936" + | "EUC-CN"; + + type Korean = "KS_C_5601" + | "Windows-949" + | "EUC-KR"; + + type TaiwanHongKong = "Big5" + | "Big5-HKSCS" + | "Windows-950"; + + type Multibyte = Japanese + | Chinese + | Korean + | TaiwanHongKong; + } + + type SupportedEncoding = encoding.Native + | encoding.Unicode + | encoding.Singlebyte + | encoding.Multibyte; + } + + const defaultCharUnicode: "�"; + + const defaultCharSingleByte: "?"; + + function encodingExists(encoding: string): boolean; + + function encode(buffer: string, encoding: I.SupportedEncoding, options?: object): Buffer; + + function decode(buffer: Buffer, encoding: I.SupportedEncoding, options?: object): string; } namespace sqlstring { @@ -337,7 +555,31 @@ declare namespace adone { drop?: boolean; dropLast?: boolean; } + + interface CreateFunction { + (fn: () => Promise): Promise; + (fn: () => R): Promise; + + (fn: (a: T1) => Promise, a: T1): Promise; + (fn: (a: T1) => R, a: T1): Promise; + + (fn: (a: T1, b: T2) => Promise, a: T1, b: T2): Promise; + (fn: (a: T1, b: T2) => R, a: T1, b: T2): Promise; + + (fn: (a: T1, b: T2, c: T3) => Promise, a: T1, b: T2, c: T3): Promise; + (fn: (a: T1, b: T2, c: T3) => R, a: T1, b: T2, c: T3): Promise; + + (fn: (a: T1, b: T2, c: T3, d: T4) => Promise, a: T1, b: T2, c: T3, d: T4): Promise; + (fn: (a: T1, b: T2, c: T3, d: T4) => R, a: T1, b: T2, c: T3, d: T4): Promise; + + (fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => Promise, a: T1, b: T2, c: T3, d: T4, e: T5): Promise; + (fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => R, a: T1, b: T2, c: T3, d: T4, e: T5): Promise; + + (fn: (...args: any[]) => Promise, ...args: any[]): Promise; + (fn: (...args: any[]) => R, ...args: any[]): Promise; + } } + function create(options?: I.Options): I.CreateFunction; function create(fn: () => R, options?: I.Options): () => Promise; function create(fn: (a: T1) => R, options?: I.Options): (a: T1) => Promise; function create(fn: (a: T1, b: T2) => R, options?: I.Options): (a: T1, b: T2) => Promise; diff --git a/types/adone/index.d.ts b/types/adone/index.d.ts index ad0645f04d..abcf5165c2 100644 --- a/types/adone/index.d.ts +++ b/types/adone/index.d.ts @@ -8,22 +8,30 @@ /// /// /// -/// +/// /// +/// /// /// /// /// +/// /// /// /// /// /// +/// /// -/// +/// +/// /// +/// /// /// +/// +/// +/// /// declare const _adone: typeof adone; diff --git a/types/adone/test/glosses/collections.ts b/types/adone/test/glosses/collections.ts deleted file mode 100644 index ec227d4440..0000000000 --- a/types/adone/test/glosses/collections.ts +++ /dev/null @@ -1,1003 +0,0 @@ -namespace collectionTests { - const { collection } = adone; - - namespace linkedListTests { - const { LinkedList } = collection; - - namespace creation { - new LinkedList(); - new LinkedList(10); - } - - namespace properties { - { const a: boolean = new LinkedList().full; } - { const a: boolean = new LinkedList().empty; } - { const a: number = new LinkedList().maxLength; } - { const a: number = new LinkedList().length; } - { const a: boolean = new LinkedList().autoresize; } - } - - namespace resize { - { const a: boolean = new LinkedList().resize(100).full; } - } - - namespace push { - const a = new LinkedList().push(10); - a.next; - a.prev; - const b: number = a.value; - } - - namespace pop { - const a: number | undefined = new LinkedList().pop(); - } - - namespace shift { - const a: number | undefined = new LinkedList().shift(); - } - - namespace unshift { - const a = new LinkedList().unshift("hello"); - a.next; - a.prev; - const b: string = a.value; - } - - namespace pushNode { - const a = new LinkedList(); - const node = a.push("1230"); - a.pushNode(node); - } - - namespace unshiftNode { - const a = new LinkedList(); - const node = a.push(10); - a.unshiftNode(node); - } - - namespace removeNode { - const a = new LinkedList(); - const node = a.unshift("10"); - a.removeNode(node); - } - - namespace clear { - new LinkedList().clear(); - new LinkedList().clear(true); - } - - namespace toArray { - const a = new LinkedList(); - const b: number[] = a.toArray(); - } - - namespace front { - const a = new LinkedList(); - const b: number = a.front; - } - - namespace back { - const a = new LinkedList(); - const b: number = a.back; - } - - namespace iterating { - const a = new LinkedList(); - for (const b of a) { - const i: string = b; - } - const c = new LinkedList(); - for (const b of c) { - const i: number = b; - } - } - - namespace nextNode { - const a = new LinkedList(); - const n1 = a.push("h"); - const n2 = a.nextNode(n1); - n1.next; - n1.prev; - const t: string = n1.value; - } - - namespace map { - const a = new LinkedList(); - const f = (a: number, idx: number) => `${a}${idx}`; - const b = a.map(f); - const c: string = b.front; - } - - namespace forEach { - const a = new LinkedList(); - - a.forEach((a: number, b: number) => { - const c = a + b; - }); - } - - namespace static { - const a: number = LinkedList.DEFAULT_LENGTH; - } - } - - namespace ByteArrayTests { - const { ByteArray } = collection; - - new ByteArray(); - new ByteArray(10); - new ByteArray(10, true); - - const buffer = new ByteArray(); - - namespace readBitSet { - const a: boolean[] = buffer.readBitSet(); - const b: boolean[] = buffer.readBitSet(10); - } - - namespace read { - const a: adone.collection.ByteArray = buffer.read(1); - const b: adone.collection.ByteArray = buffer.read(1, 10); - } - - namespace readInt8 { - const a: number = buffer.readInt8(); - const b: number = buffer.readInt8(10); - } - - namespace readUInt8 { - const a: number = buffer.readUInt8(); - const b: number = buffer.readUInt8(10); - } - - namespace readInt16LE { - const a: number = buffer.readInt16LE(); - const b: number = buffer.readInt16LE(10); - } - - namespace readUInt16LE { - const a: number = buffer.readUInt16LE(); - const b: number = buffer.readUInt16LE(10); - } - - namespace readInt16BE { - const a: number = buffer.readInt16BE(); - const b: number = buffer.readInt16BE(10); - } - - namespace readUInt16BE { - const a: number = buffer.readUInt16BE(); - const b: number = buffer.readUInt16BE(10); - } - - namespace readInt32LE { - const a: number = buffer.readInt32LE(); - const b: number = buffer.readInt32LE(10); - } - - namespace readUInt32LE { - const a: number = buffer.readUInt32LE(); - const b: number = buffer.readUInt32LE(10); - } - - namespace readInt32BE { - const a: number = buffer.readInt32BE(); - const b: number = buffer.readInt32BE(10); - } - - namespace readUInt32BE { - const a: number = buffer.readUInt32BE(); - const b: number = buffer.readUInt32BE(10); - } - - namespace readInt64LE { - const a: adone.math.Long = buffer.readInt64LE(); - const b: adone.math.Long = buffer.readInt64LE(10); - } - - namespace readUInt64LE { - const a: adone.math.Long = buffer.readUInt64LE(); - const b: adone.math.Long = buffer.readUInt64LE(10); - } - - namespace readInt64BE { - const a: adone.math.Long = buffer.readInt64BE(); - const b: adone.math.Long = buffer.readInt64BE(10); - } - - namespace readUInt64BE { - const a: adone.math.Long = buffer.readUInt64BE(); - const b: adone.math.Long = buffer.readUInt64BE(10); - } - - namespace readFloatLE { - const a: number = buffer.readFloatLE(); - const b: number = buffer.readFloatLE(10); - } - - namespace readFloatBE { - const a: number = buffer.readFloatBE(); - const b: number = buffer.readFloatBE(10); - } - - namespace readDoubleLE { - const a: number = buffer.readDoubleLE(); - const b: number = buffer.readDoubleLE(10); - } - - namespace readDoubleBE { - const a: number = buffer.readDoubleBE(); - const b: number = buffer.readDoubleBE(10); - } - - namespace write { - const a: adone.collection.ByteArray = buffer.write("1"); - const b: adone.collection.ByteArray = buffer.write(new ByteArray()); - const c: adone.collection.ByteArray = buffer.write(Buffer.alloc(10)); - const d: adone.collection.ByteArray = buffer.write(new Uint8Array([1, 2, 3])); - const e: adone.collection.ByteArray = buffer.write(new ArrayBuffer(10)); - const f: adone.collection.ByteArray = buffer.write("1", 10); - const g: adone.collection.ByteArray = buffer.write("1", 10, 10); - const h: adone.collection.ByteArray = buffer.write("1", 10, 10, "utf8"); - } - - namespace writeBitSet { - const a: adone.collection.ByteArray = buffer.writeBitSet([1, 2, 3]); - const b: number = buffer.writeBitSet([1, 2, 3], 10); - } - - namespace writeInt8 { - const a: adone.collection.ByteArray = buffer.writeInt8(10); - const b: adone.collection.ByteArray = buffer.writeInt8(10, 10); - } - - namespace writeUInt8 { - const a: adone.collection.ByteArray = buffer.writeUInt8(10); - const b: adone.collection.ByteArray = buffer.writeUInt8(10, 10); - } - - namespace writeInt16LE { - const a: adone.collection.ByteArray = buffer.writeInt16LE(10); - const b: adone.collection.ByteArray = buffer.writeInt16LE(10, 10); - } - - namespace writeInt16BE { - const a: adone.collection.ByteArray = buffer.writeInt16BE(10); - const b: adone.collection.ByteArray = buffer.writeInt16BE(10, 10); - } - - namespace writeUInt16LE { - const a: adone.collection.ByteArray = buffer.writeUInt16LE(10); - const b: adone.collection.ByteArray = buffer.writeUInt16LE(10, 10); - } - - namespace writeUInt16BE { - const a: adone.collection.ByteArray = buffer.writeUInt16BE(10); - const b: adone.collection.ByteArray = buffer.writeUInt16BE(10, 10); - } - - namespace writeInt32LE { - const a: adone.collection.ByteArray = buffer.writeInt32LE(10); - const b: adone.collection.ByteArray = buffer.writeInt32LE(10, 10); - } - - namespace writeInt32BE { - const a: adone.collection.ByteArray = buffer.writeInt32BE(10); - const b: adone.collection.ByteArray = buffer.writeInt32BE(10, 10); - } - - namespace writeUInt32LE { - const a: adone.collection.ByteArray = buffer.writeUInt32LE(10); - const b: adone.collection.ByteArray = buffer.writeUInt32LE(10, 10); - } - - namespace writeUInt32BE { - const a: adone.collection.ByteArray = buffer.writeUInt32BE(10); - const b: adone.collection.ByteArray = buffer.writeUInt32BE(10, 10); - } - - namespace writeInt64LE { - const a: adone.collection.ByteArray = buffer.writeInt64LE(10); - const b: adone.collection.ByteArray = buffer.writeInt64LE(10, 10); - } - - namespace writeInt64BE { - const a: adone.collection.ByteArray = buffer.writeInt64BE(10); - const b: adone.collection.ByteArray = buffer.writeInt64BE(10, 10); - } - - namespace writeUInt64LE { - const a: adone.collection.ByteArray = buffer.writeUInt64LE(10); - const b: adone.collection.ByteArray = buffer.writeUInt64LE(10, 10); - } - - namespace writeUInt64BE { - const a: adone.collection.ByteArray = buffer.writeUInt64BE(10); - const b: adone.collection.ByteArray = buffer.writeUInt64BE(10, 10); - } - - namespace writeFloatLE { - const a: adone.collection.ByteArray = buffer.writeFloatLE(10); - const b: adone.collection.ByteArray = buffer.writeFloatLE(10, 10); - } - - namespace writeFloatBE { - const a: adone.collection.ByteArray = buffer.writeFloatBE(10); - const b: adone.collection.ByteArray = buffer.writeFloatBE(10, 10); - } - - namespace writeDoubleLE { - const a: adone.collection.ByteArray = buffer.writeDoubleLE(10); - const b: adone.collection.ByteArray = buffer.writeDoubleLE(10, 10); - } - - namespace writeDoubleBE { - const a: adone.collection.ByteArray = buffer.writeDoubleBE(10); - const b: adone.collection.ByteArray = buffer.writeDoubleBE(10, 10); - } - - namespace writeVarInt32 { - const a: adone.collection.ByteArray = buffer.writeVarint32(10); - const b: number = buffer.writeVarint32(10, 10); - } - - namespace writeVarInt32ZigZag { - const a: adone.collection.ByteArray = buffer.writeVarint32ZigZag(10); - const b: number = buffer.writeVarint32ZigZag(10, 10); - } - - namespace readVarint32 { - const a: number = buffer.readVarint32(); - const b: { value: number, length: number } = buffer.readVarint32(10); - } - - namespace readVarint32ZigZag { - const a: number = buffer.readVarint32ZigZag(); - const b: { value: number, length: number } = buffer.readVarint32ZigZag(10); - } - - namespace writeVarint64 { - const a: adone.collection.ByteArray = buffer.writeVarint64(10); - const b: number = buffer.writeVarint64(10, 10); - } - - namespace writeVarint64ZigZag { - const a: adone.collection.ByteArray = buffer.writeVarint64ZigZag(10); - const b: number = buffer.writeVarint64ZigZag(10, 10); - } - - namespace readVarint64 { - const a: adone.math.Long = buffer.readVarint64(); - const b: { value: adone.math.Long, length: number } = buffer.readVarint64(10); - } - - namespace readVarint64ZigZag { - const a: adone.math.Long = buffer.readVarint64ZigZag(); - const b: { value: adone.math.Long, length: number } = buffer.readVarint64ZigZag(10); - } - - namespace writeCString { - const a: adone.collection.ByteArray = buffer.writeCString("asd"); - const b: number = buffer.writeCString("123", 10); - } - - namespace readCString { - const a: string = buffer.readCString(); - const b: { string: string, length: number } = buffer.readCString(10); - } - - namespace writeString { - const a: adone.collection.ByteArray = buffer.writeString("abc"); - const b: number = buffer.writeString("abc", 10); - } - - namespace readString { - const a: string = buffer.readString(10); - const b: string = buffer.readString(10, "b"); - const c: string = buffer.readString(10, "c"); - const d: { string: string, length: number } = buffer.readString(10, "c", 10); - } - - namespace writeVString { - const a: adone.collection.ByteArray = buffer.writeVString("abc"); - const b: number = buffer.writeVString("abc", 10); - } - - namespace readVString { - const a: string = buffer.readVString(); - const b: { string: string, length: number } = buffer.readVString(10); - } - - namespace appendTo { - const a: adone.collection.ByteArray = buffer.appendTo(new ByteArray()); - const b: adone.collection.ByteArray = buffer.appendTo(new ByteArray(), 10); - } - - namespace assert { - const a: adone.collection.ByteArray = buffer.assert(); - const b: adone.collection.ByteArray = buffer.assert(true); - } - - namespace capacity { - const a: number = buffer.capacity(); - } - - namespace clear { - const a: adone.collection.ByteArray = buffer.clear(); - } - - namespace copy { - const a: adone.collection.ByteArray = buffer.clone(); - const c: adone.collection.ByteArray = buffer.clone(true); - } - - namespace compact { - const a: adone.collection.ByteArray = buffer.compact(); - const b: adone.collection.ByteArray = buffer.compact(1); - const c: adone.collection.ByteArray = buffer.compact(1, 10); - } - - namespace copyTo { - const a: adone.collection.ByteArray = buffer.copyTo(new ByteArray()); - const b: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0); - const c: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0); - const d: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0, 10); - } - - namespace ensureCapacity { - const a: adone.collection.ByteArray = buffer.ensureCapacity(10); - } - - namespace fill { - const a: adone.collection.ByteArray = buffer.fill("0"); - const b: adone.collection.ByteArray = buffer.fill(0); - const c: adone.collection.ByteArray = buffer.fill(0, 0); - const d: adone.collection.ByteArray = buffer.fill(0, 0, 10); - } - - namespace flip { - const a: adone.collection.ByteArray = buffer.flip(); - } - - namespace mark { - const a: adone.collection.ByteArray = buffer.mark(); - const b: adone.collection.ByteArray = buffer.mark(10); - } - - namespace prepend { - const a: adone.collection.ByteArray = buffer.prepend(""); - const b: adone.collection.ByteArray = buffer.prepend(new ByteArray()); - const c: adone.collection.ByteArray = buffer.prepend(Buffer.alloc(10)); - const d: adone.collection.ByteArray = buffer.prepend(new Uint8Array([1, 2, 3])); - const e: adone.collection.ByteArray = buffer.prepend(new ArrayBuffer(10)); - const f: adone.collection.ByteArray = buffer.prepend("", "utf8"); - const g: adone.collection.ByteArray = buffer.prepend("", "utf8", 10); - const h: adone.collection.ByteArray = buffer.prepend("", 10); - } - - namespace prependTo { - const a: adone.collection.ByteArray = buffer.prependTo(new ByteArray()); - const b: adone.collection.ByteArray = buffer.prependTo(new ByteArray(), 10); - } - - namespace remaining { - const a: number = buffer.remaining(); - } - - namespace reset { - const a: adone.collection.ByteArray = buffer.reset(); - } - - namespace resize { - const a: adone.collection.ByteArray = buffer.resize(10); - } - - namespace reverse { - const a: adone.collection.ByteArray = buffer.reverse(); - const b: adone.collection.ByteArray = buffer.reverse(1); - const c: adone.collection.ByteArray = buffer.reverse(1, 10); - } - - namespace skip { - const a: adone.collection.ByteArray = buffer.skip(10); - } - - namespace slice { - const a: adone.collection.ByteArray = buffer.slice(); - const b: adone.collection.ByteArray = buffer.slice(1); - const c: adone.collection.ByteArray = buffer.slice(1, 10); - } - - namespace toBuffer { - const a: Buffer = buffer.toBuffer(); - const b: Buffer = buffer.toBuffer(true); - const c: Buffer = buffer.toBuffer(true, 0); - const d: Buffer = buffer.toBuffer(true, 0, 10); - } - - namespace toArrayBuffer { - const a: ArrayBuffer = buffer.toArrayBuffer(); - } - - namespace toString { - const a: string = buffer.toString(); - const b: string = buffer.toString("utf8"); - const c: string = buffer.toString("utf8", 0); - const d: string = buffer.toString("utf8", 0, 10); - } - - namespace toBase64 { - const a: string = buffer.toBase64(); - const b: string = buffer.toBase64(0); - const c: string = buffer.toBase64(0, 10); - } - - namespace toBinary { - const a: string = buffer.toBinary(); - const b: string = buffer.toBinary(0); - const c: string = buffer.toBinary(0, 10); - } - - namespace toDebug { - const a: string = buffer.toDebug(); - const b: string = buffer.toDebug(true); - } - - namespace toUTF8 { - const a: string = buffer.toUTF8(); - const b: string = buffer.toUTF8(0); - const c: string = buffer.toUTF8(0, 10); - } - - namespace static { - namespace accessor { - const a: typeof Buffer = ByteArray.accessor(); - } - - namespace allocate { - const a: adone.collection.ByteArray = ByteArray.allocate(); - const b: adone.collection.ByteArray = ByteArray.allocate(10); - const c: adone.collection.ByteArray = ByteArray.allocate(10, true); - } - - namespace concat { - const a: adone.collection.ByteArray = ByteArray.concat([ - new ByteArray(), - Buffer.alloc(10), - new Uint8Array([1, 2, 3]), - new ArrayBuffer(10) - ]); - const b: adone.collection.ByteArray = ByteArray.concat([ - new ByteArray(), - Buffer.alloc(10), - new Uint8Array([1, 2, 3]), - new ArrayBuffer(10) - ], "utf8"); - const c: adone.collection.ByteArray = ByteArray.concat([ - new ByteArray(), - Buffer.alloc(10), - new Uint8Array([1, 2, 3]), - new ArrayBuffer(10) - ], "utf8", true); - } - - namespace type { - const a: typeof Buffer = ByteArray.type(); - } - - namespace wrap { - const a: adone.collection.ByteArray = ByteArray.wrap(""); - const b: adone.collection.ByteArray = ByteArray.wrap(new ByteArray()); - const c: adone.collection.ByteArray = ByteArray.wrap(Buffer.alloc(10)); - const d: adone.collection.ByteArray = ByteArray.wrap(new Uint8Array([1, 2, 3])); - const e: adone.collection.ByteArray = ByteArray.wrap(new ArrayBuffer(10)); - const f: adone.collection.ByteArray = ByteArray.wrap("", "utf8"); - const g: adone.collection.ByteArray = ByteArray.wrap("", "utf8", true); - } - - namespace calculateVarint32 { - const a: number = ByteArray.calculateVarint32(10); - } - - namespace zigZagEncode32 { - const a: number = ByteArray.zigZagEncode32(10); - } - - namespace zigZagDecode32 { - const a: number = ByteArray.zigZagDecode32(10); - } - - namespace calculateVarint64 { - const a: number = ByteArray.calculateVarint64(10); - const b: number = ByteArray.calculateVarint64("10"); - } - - namespace zigZagEncode64 { - const a: adone.math.Long = ByteArray.zigZagEncode64(10); - const b: adone.math.Long = ByteArray.zigZagEncode64("10"); - const c: adone.math.Long = ByteArray.zigZagEncode64(adone.math.Long.fromValue(10)); - } - - namespace zigZagDecode64 { - const a: adone.math.Long = ByteArray.zigZagDecode64(10); - const b: adone.math.Long = ByteArray.zigZagDecode64("10"); - const c: adone.math.Long = ByteArray.zigZagDecode64(adone.math.Long.fromValue(10)); - } - - namespace calculateUTF8Chars { - const a: number = ByteArray.calculateUTF8Chars("123"); - } - - namespace calculateString { - const a: number = ByteArray.calculateString("123"); - } - - namespace fromBase64 { - const a: adone.collection.ByteArray = ByteArray.fromBase64("123"); - } - - namespace btoa { - const a: string = ByteArray.btoa("123"); - } - - namespace atob { - const a: string = ByteArray.atob("123"); - } - - namespace fromBinary { - const a: adone.collection.ByteArray = ByteArray.fromBinary("123"); - } - - namespace fromDebug { - const a: adone.collection.ByteArray = ByteArray.fromDebug("12"); - const b: adone.collection.ByteArray = ByteArray.fromDebug("12", true); - } - - namespace fromHex { - const a: adone.collection.ByteArray = ByteArray.fromHex("192"); - const b: adone.collection.ByteArray = ByteArray.fromHex("192", true); - } - - namespace fromUTF8 { - const a: adone.collection.ByteArray = ByteArray.fromUTF8("123"); - const b: adone.collection.ByteArray = ByteArray.fromUTF8("123", true); - } - - namespace constants { - const a: number = ByteArray.DEFAULT_CAPACITY; - const b: boolean = ByteArray.DEFAULT_NOASSERT; - const c: number = ByteArray.MAX_VARINT32_BYTES; - const d: number = ByteArray.MAX_VARINT64_BYTES; - const e: string = ByteArray.METRICS_CHARS; - const f: string = ByteArray.METRICS_BYTES; - } - } - } - - namespace queueTests { - const { Queue } = collection; - type Queue = adone.collection.Queue; - - new Queue(); - { const a: Queue = new Queue().push(123).push(123); } - { const a: number | undefined = new Queue().push(123).pop(); } - { const a: string | undefined = new Queue().push(123).pop(); } - { const a: boolean = new Queue().full; } - { const a: number = new Queue().length; } - { const a: boolean = new Queue().empty; } - } - - namespace asyncQueueTests { - const { AsyncQueue } = collection; - type AsyncQueue = adone.collection.AsyncQueue; - - { const a: AsyncQueue = new AsyncQueue().push(123); } - { const a: Promise = new AsyncQueue().push(123).pop(); } - } - - namespace priorityQueueTests { - const { PriorityQueue } = collection; - type PriorityQueue = adone.collection.PriorityQueue; - - { const a: boolean = new PriorityQueue().empty; } - { const a: number = new PriorityQueue().length; } - new PriorityQueue(); - new PriorityQueue({}); - new PriorityQueue({ - compare(a: number, b: number) { - return a - b; - } - }); - new PriorityQueue({ - priority(a: string, b: string) { - return a.length - b.length; - } - }); - { const a: PriorityQueue = new PriorityQueue().clone(); } - { const a: PriorityQueue = new PriorityQueue().push("123"); } - { const a: string | undefined = new PriorityQueue().pop(); } - { const a: PriorityQueue = new PriorityQueue().delete("123"); } - { const a: PriorityQueue = new PriorityQueue().delete("123"); } - { const a: string = new PriorityQueue().replace("123"); } - { const a: string = new PriorityQueue().pushpop("123"); } - { const a: string[] = new PriorityQueue().toArray(); } - { const a: PriorityQueue = PriorityQueue.from(["1"]); } - { const a: PriorityQueue = PriorityQueue.from(["1"], {}); } - { const a: PriorityQueue = PriorityQueue.from(["1"], { compare: (a: string, b: string) => a.length - b.length }); } - { const a: PriorityQueue = PriorityQueue.from(["1"], { priority: (a: string, b: string) => a.length - b.length }); } - } - - namespace fastlruTests { - const { FastLRU } = collection; - - new FastLRU(); - new FastLRU(100); - new FastLRU(100, { dispose: (key: string, value: number) => null }); - { const a: number = new FastLRU().size; } - { const a: number | undefined = new FastLRU().get("key"); } - new FastLRU().set("key", 123); - { const a: boolean = new FastLRU().delete("key"); } - { const a: boolean = new FastLRU().has("key"); } - { const a: string[] = [...new FastLRU().keys()]; } - { const a: number[] = [...new FastLRU().values()]; } - { const a: number[] = [...new FastLRU().values()]; } - { const a: Array<[string, number]> = [...new FastLRU().entries()]; } - new FastLRU().clear(); - } - - namespace stackTests { - const { Stack } = collection; - type Stack = adone.collection.Stack; - - { const a: boolean = new Stack().empty; } - { const a: number = new Stack().top; } - { const a: Stack = new Stack().push(123); } - { const a: number | undefined = new Stack().pop(); } - { const a: number[] = [...new Stack()]; } - { const a: Stack = Stack.from([1, 2, 3]); } - } - - namespace binarySearchTreeTests { - const { BinarySearchTree } = collection; - type BinarySearchTree = adone.collection.BinarySearchTree; - - new BinarySearchTree(); - new BinarySearchTree({}); - new BinarySearchTree({ checkValueEquality: (a: number, b: number) => a === b }); - new BinarySearchTree({ compareKeys: (a: string, b: string) => a.length - b.length }); - new BinarySearchTree({ parent: new BinarySearchTree() }); - new BinarySearchTree({ unique: true }); - new BinarySearchTree({ value: 123 }); - { const a: BinarySearchTree = new BinarySearchTree().getMaxKeyDescendant(); } - { const a: string = new BinarySearchTree().getMaxKey(); } - { const a: BinarySearchTree = new BinarySearchTree().getMinKeyDescendant(); } - { const a: string = new BinarySearchTree().getMinKey(); } - new BinarySearchTree().checkAllNodesFullfillCondition((key: string, value: number) => null); - new BinarySearchTree().checkIsBST(); - { const a: number = new BinarySearchTree().getNumberOfKeys(); } - new BinarySearchTree().insert("asd", 123); - { const a: number[] = new BinarySearchTree().search("asd"); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $gt: "" }); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $lt: "" }); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $lte: "" }); } - { const a: number[] = new BinarySearchTree().betweenBounds({ $gte: "" }); } - new BinarySearchTree().delete("key"); - new BinarySearchTree().delete("key", 123); - new BinarySearchTree().executeOnEveryNode((tree: BinarySearchTree) => null); - new BinarySearchTree().prettyPrint(); - new BinarySearchTree().prettyPrint(true); - new BinarySearchTree().prettyPrint(true, " "); - } - - namespace avlTreeTests { - const { AVLTree } = collection; - type AVLTree = adone.collection.AVLTree; - - new AVLTree(); - new AVLTree({ checkValueEquality: (a: number, b: number) => a === b }); - new AVLTree({ compareKeys: (a: string, b: string) => a.length - b.length }); - new AVLTree({ parent: new AVLTree() }); - new AVLTree({ unique: false }); - new AVLTree({ value: 123 }); - new AVLTree().checkIsAVLT(); - new AVLTree().insert("123", 123); - new AVLTree().delete("123"); - new AVLTree().delete("123", 123); - { const a: number = new AVLTree().getNumberOFKeys(); } - { const a: number[] = new AVLTree().search("key"); } - { const a: number[] = new AVLTree().betweenBounds({}); } - { const a: number[] = new AVLTree().betweenBounds({ $gt: "ads" }); } - { const a: number[] = new AVLTree().betweenBounds({ $lt: "ads" }); } - { const a: number[] = new AVLTree().betweenBounds({ $gte: "ads" }); } - { const a: number[] = new AVLTree().betweenBounds({ $lte: "ads" }); } - new AVLTree().executeOnEveryNode((tree: AVLTree) => null); - } - - namespace redBlackTreeTests { - const { RedBlackTree } = collection; - type RedBlackTree = adone.collection.RedBlackTree; - type RedBlackTreeIterator = adone.collection.I.RedBlackTree.Iterator; - type RedBlackTreeNode = adone.collection.I.RedBlackTree.Node; - - new RedBlackTree(); - new RedBlackTree((a: string, b: string) => a.length - b.length); - new RedBlackTree(undefined, new RedBlackTree()); - { const a: string[] = new RedBlackTree().keys; } - { const a: number[] = new RedBlackTree().values; } - { const a: number = new RedBlackTree().length; } - { - const a: RedBlackTreeIterator = new RedBlackTree().begin; - { const b: boolean = a.valid; } - { const b: RedBlackTreeNode | null = a.node; } - { const b: string | undefined = a.key; } - { const b: number | undefined = a.value; } - { const b: number = a.index; } - { const b: boolean = a.hasNext; } - { const b: boolean = a.hasPrev; } - { const b: RedBlackTree = a.tree; } - { const b: RedBlackTreeIterator = a.clone(); } - { const b: RedBlackTree = a.remove(); } - a.next(); - { const b: RedBlackTree = a.update(333); } - a.prev(); - } - { const a: RedBlackTreeIterator = new RedBlackTree().end; } - { const a: RedBlackTree = new RedBlackTree().insert("123", 456); } - { const a: number = new RedBlackTree().forEach((key: string, value: number) => value); } - { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1"); } - { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1", "2"); } - { const a: RedBlackTreeIterator = new RedBlackTree().at(1); } - { const a: RedBlackTreeIterator = new RedBlackTree().ge("1"); } - { const a: RedBlackTreeIterator = new RedBlackTree().gt("1"); } - { const a: RedBlackTreeIterator = new RedBlackTree().lt("1"); } - { const a: RedBlackTreeIterator = new RedBlackTree().le("1"); } - { const a: RedBlackTreeIterator | null = new RedBlackTree().find("1"); } - { const a: RedBlackTree = new RedBlackTree().remove("1"); } - { const a: RedBlackTree = new RedBlackTree().remove("1"); } - { const a: number | undefined = new RedBlackTree().get("1"); } - } - - namespace arraySetTests { - const { ArraySet } = collection; - type ArraySet = adone.collection.ArraySet; - - new ArraySet(); - { const a: number = new ArraySet().length; } - { const a: ArraySet = new ArraySet().add("hello"); } - { const a: ArraySet = new ArraySet().add("hello", true); } - { const a: boolean = new ArraySet().has("string"); } - { const a: number = new ArraySet().indexOf("hello"); } - { const a: string[] = new ArraySet().toArray(); } - { const a: ArraySet = ArraySet.from([1]); } - { const a: ArraySet = ArraySet.from([1], true); } - } - - namespace bufferListTests { - const { BufferList } = collection; - type BufferList = adone.collection.BufferList; - - new BufferList(); - new BufferList(Buffer.from("123")); - new BufferList("123"); - new BufferList(123); - new BufferList([Buffer.from("123"), "123", 123]); - new BufferList((err: any, data: Buffer) => null); - new BufferList().append(Buffer.from("123")); - new BufferList().append("123"); - new BufferList().append(123); - new BufferList().append([Buffer.from("123"), "123", 123]); - new BufferList().end(Buffer.from("123")); - new BufferList().end(); - { const a: number = new BufferList().get(123); } - { const a: Buffer = new BufferList().slice(); } - { const a: Buffer = new BufferList().slice(1); } - { const a: Buffer = new BufferList().slice(1, 2); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100)); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1); } - { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1, 2); } - { const a: BufferList = new BufferList().shallowSlice(); } - { const a: BufferList = new BufferList().shallowSlice(1); } - { const a: BufferList = new BufferList().shallowSlice(1, 2); } - { const a: string = new BufferList().toString(); } - { const a: string = new BufferList().toString("utf8"); } - { const a: string = new BufferList().toString("utf8", 1); } - { const a: string = new BufferList().toString("utf8", 1, 2); } - { const a: BufferList = new BufferList().consume(10); } - { const a: BufferList = new BufferList().duplicate(); } - new BufferList().destroy(); - new BufferList().then((x: Buffer) => null); - new BufferList().catch((err: any) => null); - } - - namespace defaultMapTests { - const { DefaultMap } = collection; - type DefaultMap = adone.collection.DefaultMap; - - new DefaultMap(); - { const a: DefaultMap = new DefaultMap(undefined, [["1", 2]]); } - { const a: DefaultMap = new DefaultMap((key: string) => 123); } - { const a: DefaultMap = new DefaultMap({ a: 123 }); } - } - - namespace lruTests { - const { LRU } = collection; - type LRU = adone.collection.LRU; - - new LRU(); - new LRU(100); - new LRU({}); - new LRU({ max: 100 }); - new LRU({ dispose: (key: string, value: number) => null }); - new LRU({ maxAge: 100 }); - new LRU({ noDisposeOnSet: false }); - new LRU({ stale: true }); - { const a: number = new LRU().max; } - { new LRU().max = 100; } - { const a: boolean = new LRU().allowStale; } - { new LRU().allowStale = false; } - { const a: number = new LRU().maxAge; } - { new LRU().maxAge = 100; } - { const a: (v: number, k: string) => number = new LRU().lengthCalculator; } - { new LRU().lengthCalculator = () => 123; } - { const a: number = new LRU().length; } - { const a: number = new LRU().itemCount; } - new LRU().rforEach((value: number, key: string) => null); - new LRU().rforEach(function (value: number, key: string) { - const b: number = this.a; - }, { a: 1 }); - new LRU().forEach((value: number, key: string) => null); - new LRU().forEach(function (value: number, key: string) { - const b: number = this.a; - }, { a: 1 }); - { const a: string[] = new LRU().keys(); } - { const a: number[] = new LRU().values(); } - new LRU().reset(); - { - const a: Array> = new LRU().dump(); - const [b] = a; - { const c: number = b.e; } - { const c: string = b.key; } - { const c: number = b.value; } - } - { - const a: adone.collection.LinkedList> = new LRU().dumpLru(); - const b = a.shift(); - if (b !== undefined) { - { const a: string = b.key; } - { const a: number = b.value; } - { const a: number = b.now; } - { const a: number = b.maxAge; } - } - } - { const a: string = new LRU().inspect(); } - { const a: string = new LRU().inspect({}); } - { const a: boolean = new LRU().set("asd", 13); } - { const a: boolean = new LRU().set("asd", 13, 100500); } - { const a: boolean = new LRU().has("asd"); } - { const a: number | undefined = new LRU().get("asd"); } - { const a: number | undefined = new LRU().peek("asd"); } - { const a: adone.collection.I.LRU.Entry = new LRU().pop(); } - new LRU().del("asd"); - new LRU().load(new LRU().dump()); - new LRU().prune(); - } - - namespace timedoutMapTests { - const { TimedoutMap } = collection; - type TimedoutMap = adone.collection.TimedoutMap; - - new TimedoutMap(); - new TimedoutMap(1000); - new TimedoutMap(1000, (key: string) => null); - { - const a: TimedoutMap = new TimedoutMap().forEach((value: number, key: string) => null); - } - { - const a: TimedoutMap = new TimedoutMap().forEach(function (value: number, key: string) { - const a: number = this.a; - }, { a: 1 }); - } - { const a: boolean = new TimedoutMap().delete("123"); } - } -} diff --git a/types/adone/test/glosses/collections/array_set.ts b/types/adone/test/glosses/collections/array_set.ts new file mode 100644 index 0000000000..49fd8582ce --- /dev/null +++ b/types/adone/test/glosses/collections/array_set.ts @@ -0,0 +1,19 @@ +namespace adoneTests.collection.ArraySet { + const { + collection: { + ArraySet + } + } = adone; + + type ArraySet = adone.collection.ArraySet; + + new ArraySet(); + { const a: number = new ArraySet().length; } + { const a: ArraySet = new ArraySet().add("hello"); } + { const a: ArraySet = new ArraySet().add("hello", true); } + { const a: boolean = new ArraySet().has("string"); } + { const a: number = new ArraySet().indexOf("hello"); } + { const a: string[] = new ArraySet().toArray(); } + { const a: ArraySet = ArraySet.from([1]); } + { const a: ArraySet = ArraySet.from([1], true); } +} diff --git a/types/adone/test/glosses/collections/async_queue.ts b/types/adone/test/glosses/collections/async_queue.ts new file mode 100644 index 0000000000..43374e6d3a --- /dev/null +++ b/types/adone/test/glosses/collections/async_queue.ts @@ -0,0 +1,12 @@ +namespace adoneTests.collection.AsyncQueue { + const { + collection: { + AsyncQueue + } + } = adone; + + type AsyncQueue = adone.collection.AsyncQueue; + + { const a: AsyncQueue = new AsyncQueue().push(123); } + { const a: Promise = new AsyncQueue().push(123).pop(); } +} diff --git a/types/adone/test/glosses/collections/avl_tree.ts b/types/adone/test/glosses/collections/avl_tree.ts new file mode 100644 index 0000000000..9c032deb2d --- /dev/null +++ b/types/adone/test/glosses/collections/avl_tree.ts @@ -0,0 +1,28 @@ +namespace adoneTests.collection.AVLTree { + const { + collection: { + AVLTree + } + } = adone; + + type AVLTree = adone.collection.AVLTree; + + new AVLTree(); + new AVLTree({ checkValueEquality: (a: number, b: number) => a === b }); + new AVLTree({ compareKeys: (a: string, b: string) => a.length - b.length }); + new AVLTree({ parent: new AVLTree() }); + new AVLTree({ unique: false }); + new AVLTree({ value: 123 }); + new AVLTree().checkIsAVLT(); + new AVLTree().insert("123", 123); + new AVLTree().delete("123"); + new AVLTree().delete("123", 123); + { const a: number = new AVLTree().getNumberOFKeys(); } + { const a: number[] = new AVLTree().search("key"); } + { const a: number[] = new AVLTree().betweenBounds({}); } + { const a: number[] = new AVLTree().betweenBounds({ $gt: "ads" }); } + { const a: number[] = new AVLTree().betweenBounds({ $lt: "ads" }); } + { const a: number[] = new AVLTree().betweenBounds({ $gte: "ads" }); } + { const a: number[] = new AVLTree().betweenBounds({ $lte: "ads" }); } + new AVLTree().executeOnEveryNode((tree: AVLTree) => null); +} diff --git a/types/adone/test/glosses/collections/binary_search_tree.ts b/types/adone/test/glosses/collections/binary_search_tree.ts new file mode 100644 index 0000000000..56f9a28e72 --- /dev/null +++ b/types/adone/test/glosses/collections/binary_search_tree.ts @@ -0,0 +1,36 @@ +namespace adoneTests.collection.BinarySearchTree { + const { + collection: { + BinarySearchTree + } + } = adone; + + type BinarySearchTree = adone.collection.BinarySearchTree; + + new BinarySearchTree(); + new BinarySearchTree({}); + new BinarySearchTree({ checkValueEquality: (a: number, b: number) => a === b }); + new BinarySearchTree({ compareKeys: (a: string, b: string) => a.length - b.length }); + new BinarySearchTree({ parent: new BinarySearchTree() }); + new BinarySearchTree({ unique: true }); + new BinarySearchTree({ value: 123 }); + { const a: BinarySearchTree = new BinarySearchTree().getMaxKeyDescendant(); } + { const a: string = new BinarySearchTree().getMaxKey(); } + { const a: BinarySearchTree = new BinarySearchTree().getMinKeyDescendant(); } + { const a: string = new BinarySearchTree().getMinKey(); } + new BinarySearchTree().checkAllNodesFullfillCondition((key: string, value: number) => null); + new BinarySearchTree().checkIsBST(); + { const a: number = new BinarySearchTree().getNumberOfKeys(); } + new BinarySearchTree().insert("asd", 123); + { const a: number[] = new BinarySearchTree().search("asd"); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $gt: "" }); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $lt: "" }); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $lte: "" }); } + { const a: number[] = new BinarySearchTree().betweenBounds({ $gte: "" }); } + new BinarySearchTree().delete("key"); + new BinarySearchTree().delete("key", 123); + new BinarySearchTree().executeOnEveryNode((tree: BinarySearchTree) => null); + new BinarySearchTree().prettyPrint(); + new BinarySearchTree().prettyPrint(true); + new BinarySearchTree().prettyPrint(true, " "); +} diff --git a/types/adone/test/glosses/collections/buffer_list.ts b/types/adone/test/glosses/collections/buffer_list.ts new file mode 100644 index 0000000000..265d54033f --- /dev/null +++ b/types/adone/test/glosses/collections/buffer_list.ts @@ -0,0 +1,42 @@ +namespace adoneTests.collection.BufferList { + const { + collection: { + BufferList + } + } = adone; + + type BufferList = adone.collection.BufferList; + + new BufferList(); + new BufferList(Buffer.from("123")); + new BufferList("123"); + new BufferList(123); + new BufferList([Buffer.from("123"), "123", 123]); + new BufferList((err: any, data: Buffer) => null); + new BufferList().append(Buffer.from("123")); + new BufferList().append("123"); + new BufferList().append(123); + new BufferList().append([Buffer.from("123"), "123", 123]); + new BufferList().end(Buffer.from("123")); + new BufferList().end(); + { const a: number = new BufferList().get(123); } + { const a: Buffer = new BufferList().slice(); } + { const a: Buffer = new BufferList().slice(1); } + { const a: Buffer = new BufferList().slice(1, 2); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100)); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1); } + { const a: Buffer = new BufferList().copy(Buffer.alloc(100), 0, 1, 2); } + { const a: BufferList = new BufferList().shallowSlice(); } + { const a: BufferList = new BufferList().shallowSlice(1); } + { const a: BufferList = new BufferList().shallowSlice(1, 2); } + { const a: string = new BufferList().toString(); } + { const a: string = new BufferList().toString("utf8"); } + { const a: string = new BufferList().toString("utf8", 1); } + { const a: string = new BufferList().toString("utf8", 1, 2); } + { const a: BufferList = new BufferList().consume(10); } + { const a: BufferList = new BufferList().duplicate(); } + new BufferList().destroy(); + new BufferList().then((x: Buffer) => null); + new BufferList().catch((err: any) => null); +} diff --git a/types/adone/test/glosses/collections/byte_array.ts b/types/adone/test/glosses/collections/byte_array.ts new file mode 100644 index 0000000000..7254008322 --- /dev/null +++ b/types/adone/test/glosses/collections/byte_array.ts @@ -0,0 +1,561 @@ +namespace adoneTests.collection.ByteArray { + const { + collection: { + ByteArray + } + } = adone; + + new ByteArray(); + new ByteArray(10); + new ByteArray(10, true); + + const buffer = new ByteArray(); + + buffer.woffset === 2; + buffer.roffset === 3; + buffer.noAssert === true; + buffer.buffer.writeUInt8(0, 0); + + namespace readBitSet { + const a: boolean[] = buffer.readBitSet(); + const b: boolean[] = buffer.readBitSet(10); + } + + namespace read { + const a: adone.collection.ByteArray = buffer.read(1); + const b: adone.collection.ByteArray = buffer.read(1, 10); + } + + namespace readInt8 { + const a: number = buffer.readInt8(); + const b: number = buffer.readInt8(10); + } + + namespace readUInt8 { + const a: number = buffer.readUInt8(); + const b: number = buffer.readUInt8(10); + } + + namespace readInt16LE { + const a: number = buffer.readInt16LE(); + const b: number = buffer.readInt16LE(10); + } + + namespace readUInt16LE { + const a: number = buffer.readUInt16LE(); + const b: number = buffer.readUInt16LE(10); + } + + namespace readInt16BE { + const a: number = buffer.readInt16BE(); + const b: number = buffer.readInt16BE(10); + } + + namespace readUInt16BE { + const a: number = buffer.readUInt16BE(); + const b: number = buffer.readUInt16BE(10); + } + + namespace readInt32LE { + const a: number = buffer.readInt32LE(); + const b: number = buffer.readInt32LE(10); + } + + namespace readUInt32LE { + const a: number = buffer.readUInt32LE(); + const b: number = buffer.readUInt32LE(10); + } + + namespace readInt32BE { + const a: number = buffer.readInt32BE(); + const b: number = buffer.readInt32BE(10); + } + + namespace readUInt32BE { + const a: number = buffer.readUInt32BE(); + const b: number = buffer.readUInt32BE(10); + } + + namespace readInt64LE { + const a: adone.math.Long = buffer.readInt64LE(); + const b: adone.math.Long = buffer.readInt64LE(10); + } + + namespace readUInt64LE { + const a: adone.math.Long = buffer.readUInt64LE(); + const b: adone.math.Long = buffer.readUInt64LE(10); + } + + namespace readInt64BE { + const a: adone.math.Long = buffer.readInt64BE(); + const b: adone.math.Long = buffer.readInt64BE(10); + } + + namespace readUInt64BE { + const a: adone.math.Long = buffer.readUInt64BE(); + const b: adone.math.Long = buffer.readUInt64BE(10); + } + + namespace readFloatLE { + const a: number = buffer.readFloatLE(); + const b: number = buffer.readFloatLE(10); + } + + namespace readFloatBE { + const a: number = buffer.readFloatBE(); + const b: number = buffer.readFloatBE(10); + } + + namespace readDoubleLE { + const a: number = buffer.readDoubleLE(); + const b: number = buffer.readDoubleLE(10); + } + + namespace readDoubleBE { + const a: number = buffer.readDoubleBE(); + const b: number = buffer.readDoubleBE(10); + } + + namespace write { + const a: adone.collection.ByteArray = buffer.write("1"); + const b: adone.collection.ByteArray = buffer.write(new ByteArray()); + const c: adone.collection.ByteArray = buffer.write(Buffer.alloc(10)); + const d: adone.collection.ByteArray = buffer.write(new Uint8Array([1, 2, 3])); + const e: adone.collection.ByteArray = buffer.write(new ArrayBuffer(10)); + const f: adone.collection.ByteArray = buffer.write("1", 10); + const g: adone.collection.ByteArray = buffer.write("1", 10, 10); + const h: adone.collection.ByteArray = buffer.write("1", 10, 10, "utf8"); + } + + namespace writeBitSet { + const a: adone.collection.ByteArray = buffer.writeBitSet([1, 2, 3]); + const b: number = buffer.writeBitSet([1, 2, 3], 10); + } + + namespace writeInt8 { + const a: adone.collection.ByteArray = buffer.writeInt8(10); + const b: adone.collection.ByteArray = buffer.writeInt8(10, 10); + } + + namespace writeUInt8 { + const a: adone.collection.ByteArray = buffer.writeUInt8(10); + const b: adone.collection.ByteArray = buffer.writeUInt8(10, 10); + } + + namespace writeInt16LE { + const a: adone.collection.ByteArray = buffer.writeInt16LE(10); + const b: adone.collection.ByteArray = buffer.writeInt16LE(10, 10); + } + + namespace writeInt16BE { + const a: adone.collection.ByteArray = buffer.writeInt16BE(10); + const b: adone.collection.ByteArray = buffer.writeInt16BE(10, 10); + } + + namespace writeUInt16LE { + const a: adone.collection.ByteArray = buffer.writeUInt16LE(10); + const b: adone.collection.ByteArray = buffer.writeUInt16LE(10, 10); + } + + namespace writeUInt16BE { + const a: adone.collection.ByteArray = buffer.writeUInt16BE(10); + const b: adone.collection.ByteArray = buffer.writeUInt16BE(10, 10); + } + + namespace writeInt32LE { + const a: adone.collection.ByteArray = buffer.writeInt32LE(10); + const b: adone.collection.ByteArray = buffer.writeInt32LE(10, 10); + } + + namespace writeInt32BE { + const a: adone.collection.ByteArray = buffer.writeInt32BE(10); + const b: adone.collection.ByteArray = buffer.writeInt32BE(10, 10); + } + + namespace writeUInt32LE { + const a: adone.collection.ByteArray = buffer.writeUInt32LE(10); + const b: adone.collection.ByteArray = buffer.writeUInt32LE(10, 10); + } + + namespace writeUInt32BE { + const a: adone.collection.ByteArray = buffer.writeUInt32BE(10); + const b: adone.collection.ByteArray = buffer.writeUInt32BE(10, 10); + } + + namespace writeInt64LE { + const a: adone.collection.ByteArray = buffer.writeInt64LE(10); + const b: adone.collection.ByteArray = buffer.writeInt64LE(10, 10); + } + + namespace writeInt64BE { + const a: adone.collection.ByteArray = buffer.writeInt64BE(10); + const b: adone.collection.ByteArray = buffer.writeInt64BE(10, 10); + } + + namespace writeUInt64LE { + const a: adone.collection.ByteArray = buffer.writeUInt64LE(10); + const b: adone.collection.ByteArray = buffer.writeUInt64LE(10, 10); + } + + namespace writeUInt64BE { + const a: adone.collection.ByteArray = buffer.writeUInt64BE(10); + const b: adone.collection.ByteArray = buffer.writeUInt64BE(10, 10); + } + + namespace writeFloatLE { + const a: adone.collection.ByteArray = buffer.writeFloatLE(10); + const b: adone.collection.ByteArray = buffer.writeFloatLE(10, 10); + } + + namespace writeFloatBE { + const a: adone.collection.ByteArray = buffer.writeFloatBE(10); + const b: adone.collection.ByteArray = buffer.writeFloatBE(10, 10); + } + + namespace writeDoubleLE { + const a: adone.collection.ByteArray = buffer.writeDoubleLE(10); + const b: adone.collection.ByteArray = buffer.writeDoubleLE(10, 10); + } + + namespace writeDoubleBE { + const a: adone.collection.ByteArray = buffer.writeDoubleBE(10); + const b: adone.collection.ByteArray = buffer.writeDoubleBE(10, 10); + } + + namespace writeVarInt32 { + const a: adone.collection.ByteArray = buffer.writeVarint32(10); + const b: number = buffer.writeVarint32(10, 10); + } + + namespace writeVarInt32ZigZag { + const a: adone.collection.ByteArray = buffer.writeVarint32ZigZag(10); + const b: number = buffer.writeVarint32ZigZag(10, 10); + } + + namespace readVarint32 { + const a: number = buffer.readVarint32(); + const b: { value: number, length: number } = buffer.readVarint32(10); + } + + namespace readVarint32ZigZag { + const a: number = buffer.readVarint32ZigZag(); + const b: { value: number, length: number } = buffer.readVarint32ZigZag(10); + } + + namespace writeVarint64 { + const a: adone.collection.ByteArray = buffer.writeVarint64(10); + const b: number = buffer.writeVarint64(10, 10); + } + + namespace writeVarint64ZigZag { + const a: adone.collection.ByteArray = buffer.writeVarint64ZigZag(10); + const b: number = buffer.writeVarint64ZigZag(10, 10); + } + + namespace readVarint64 { + const a: adone.math.Long = buffer.readVarint64(); + const b: { value: adone.math.Long, length: number } = buffer.readVarint64(10); + } + + namespace readVarint64ZigZag { + const a: adone.math.Long = buffer.readVarint64ZigZag(); + const b: { value: adone.math.Long, length: number } = buffer.readVarint64ZigZag(10); + } + + namespace writeCString { + const a: adone.collection.ByteArray = buffer.writeCString("asd"); + const b: number = buffer.writeCString("123", 10); + } + + namespace readCString { + const a: string = buffer.readCString(); + const b: { string: string, length: number } = buffer.readCString(10); + } + + namespace writeString { + const a: adone.collection.ByteArray = buffer.writeString("abc"); + const b: number = buffer.writeString("abc", 10); + } + + namespace readString { + const a: string = buffer.readString(10); + const b: string = buffer.readString(10, "b"); + const c: string = buffer.readString(10, "c"); + const d: { string: string, length: number } = buffer.readString(10, "c", 10); + } + + namespace writeVString { + const a: adone.collection.ByteArray = buffer.writeVString("abc"); + const b: number = buffer.writeVString("abc", 10); + } + + namespace readVString { + const a: string = buffer.readVString(); + const b: { string: string, length: number } = buffer.readVString(10); + } + + namespace appendTo { + const a: adone.collection.ByteArray = buffer.appendTo(new ByteArray()); + const b: adone.collection.ByteArray = buffer.appendTo(new ByteArray(), 10); + } + + namespace assert { + const a: adone.collection.ByteArray = buffer.assert(); + const b: adone.collection.ByteArray = buffer.assert(true); + } + + namespace capacity { + const a: number = buffer.capacity(); + } + + namespace clear { + const a: adone.collection.ByteArray = buffer.clear(); + } + + namespace copy { + const a: adone.collection.ByteArray = buffer.clone(); + const c: adone.collection.ByteArray = buffer.clone(true); + } + + namespace compact { + const a: adone.collection.ByteArray = buffer.compact(); + const b: adone.collection.ByteArray = buffer.compact(1); + const c: adone.collection.ByteArray = buffer.compact(1, 10); + } + + namespace copyTo { + const a: adone.collection.ByteArray = buffer.copyTo(new ByteArray()); + const b: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0); + const c: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0); + const d: adone.collection.ByteArray = buffer.copyTo(new ByteArray(), 0, 0, 10); + } + + namespace ensureCapacity { + const a: adone.collection.ByteArray = buffer.ensureCapacity(10); + } + + namespace fill { + const a: adone.collection.ByteArray = buffer.fill("0"); + const b: adone.collection.ByteArray = buffer.fill(0); + const c: adone.collection.ByteArray = buffer.fill(0, 0); + const d: adone.collection.ByteArray = buffer.fill(0, 0, 10); + } + + namespace flip { + const a: adone.collection.ByteArray = buffer.flip(); + } + + namespace mark { + const a: adone.collection.ByteArray = buffer.mark(); + const b: adone.collection.ByteArray = buffer.mark(10); + } + + namespace prepend { + const a: adone.collection.ByteArray = buffer.prepend(""); + const b: adone.collection.ByteArray = buffer.prepend(new ByteArray()); + const c: adone.collection.ByteArray = buffer.prepend(Buffer.alloc(10)); + const d: adone.collection.ByteArray = buffer.prepend(new Uint8Array([1, 2, 3])); + const e: adone.collection.ByteArray = buffer.prepend(new ArrayBuffer(10)); + const f: adone.collection.ByteArray = buffer.prepend("", "utf8"); + const g: adone.collection.ByteArray = buffer.prepend("", "utf8", 10); + const h: adone.collection.ByteArray = buffer.prepend("", 10); + } + + namespace prependTo { + const a: adone.collection.ByteArray = buffer.prependTo(new ByteArray()); + const b: adone.collection.ByteArray = buffer.prependTo(new ByteArray(), 10); + } + + namespace remaining { + const a: number = buffer.remaining(); + } + + namespace reset { + const a: adone.collection.ByteArray = buffer.reset(); + } + + namespace resize { + const a: adone.collection.ByteArray = buffer.resize(10); + } + + namespace reverse { + const a: adone.collection.ByteArray = buffer.reverse(); + const b: adone.collection.ByteArray = buffer.reverse(1); + const c: adone.collection.ByteArray = buffer.reverse(1, 10); + } + + namespace skip { + const a: adone.collection.ByteArray = buffer.skip(10); + } + + namespace slice { + const a: adone.collection.ByteArray = buffer.slice(); + const b: adone.collection.ByteArray = buffer.slice(1); + const c: adone.collection.ByteArray = buffer.slice(1, 10); + } + + namespace toBuffer { + const a: Buffer = buffer.toBuffer(); + const b: Buffer = buffer.toBuffer(true); + const c: Buffer = buffer.toBuffer(true, 0); + const d: Buffer = buffer.toBuffer(true, 0, 10); + } + + namespace toArrayBuffer { + const a: ArrayBuffer = buffer.toArrayBuffer(); + } + + namespace toString { + const a: string = buffer.toString(); + const b: string = buffer.toString("utf8"); + const c: string = buffer.toString("utf8", 0); + const d: string = buffer.toString("utf8", 0, 10); + } + + namespace toBase64 { + const a: string = buffer.toBase64(); + const b: string = buffer.toBase64(0); + const c: string = buffer.toBase64(0, 10); + } + + namespace toBinary { + const a: string = buffer.toBinary(); + const b: string = buffer.toBinary(0); + const c: string = buffer.toBinary(0, 10); + } + + namespace toDebug { + const a: string = buffer.toDebug(); + const b: string = buffer.toDebug(true); + } + + namespace toUTF8 { + const a: string = buffer.toUTF8(); + const b: string = buffer.toUTF8(0); + const c: string = buffer.toUTF8(0, 10); + } + + namespace static { + namespace accessor { + const a: typeof Buffer = ByteArray.accessor(); + } + + namespace allocate { + const a: adone.collection.ByteArray = ByteArray.allocate(); + const b: adone.collection.ByteArray = ByteArray.allocate(10); + const c: adone.collection.ByteArray = ByteArray.allocate(10, true); + } + + namespace concat { + const a: adone.collection.ByteArray = ByteArray.concat([ + new ByteArray(), + Buffer.alloc(10), + new Uint8Array([1, 2, 3]), + new ArrayBuffer(10) + ]); + const b: adone.collection.ByteArray = ByteArray.concat([ + new ByteArray(), + Buffer.alloc(10), + new Uint8Array([1, 2, 3]), + new ArrayBuffer(10) + ], "utf8"); + const c: adone.collection.ByteArray = ByteArray.concat([ + new ByteArray(), + Buffer.alloc(10), + new Uint8Array([1, 2, 3]), + new ArrayBuffer(10) + ], "utf8", true); + } + + namespace type { + const a: typeof Buffer = ByteArray.type(); + } + + namespace wrap { + const a: adone.collection.ByteArray = ByteArray.wrap(""); + const b: adone.collection.ByteArray = ByteArray.wrap(new ByteArray()); + const c: adone.collection.ByteArray = ByteArray.wrap(Buffer.alloc(10)); + const d: adone.collection.ByteArray = ByteArray.wrap(new Uint8Array([1, 2, 3])); + const e: adone.collection.ByteArray = ByteArray.wrap(new ArrayBuffer(10)); + const f: adone.collection.ByteArray = ByteArray.wrap("", "utf8"); + const g: adone.collection.ByteArray = ByteArray.wrap("", "utf8", true); + } + + namespace calculateVarint32 { + const a: number = ByteArray.calculateVarint32(10); + } + + namespace zigZagEncode32 { + const a: number = ByteArray.zigZagEncode32(10); + } + + namespace zigZagDecode32 { + const a: number = ByteArray.zigZagDecode32(10); + } + + namespace calculateVarint64 { + const a: number = ByteArray.calculateVarint64(10); + const b: number = ByteArray.calculateVarint64("10"); + } + + namespace zigZagEncode64 { + const a: adone.math.Long = ByteArray.zigZagEncode64(10); + const b: adone.math.Long = ByteArray.zigZagEncode64("10"); + const c: adone.math.Long = ByteArray.zigZagEncode64(adone.math.Long.fromValue(10)); + } + + namespace zigZagDecode64 { + const a: adone.math.Long = ByteArray.zigZagDecode64(10); + const b: adone.math.Long = ByteArray.zigZagDecode64("10"); + const c: adone.math.Long = ByteArray.zigZagDecode64(adone.math.Long.fromValue(10)); + } + + namespace calculateUTF8Chars { + const a: number = ByteArray.calculateUTF8Chars("123"); + } + + namespace calculateString { + const a: number = ByteArray.calculateString("123"); + } + + namespace fromBase64 { + const a: adone.collection.ByteArray = ByteArray.fromBase64("123"); + } + + namespace btoa { + const a: string = ByteArray.btoa("123"); + } + + namespace atob { + const a: string = ByteArray.atob("123"); + } + + namespace fromBinary { + const a: adone.collection.ByteArray = ByteArray.fromBinary("123"); + } + + namespace fromDebug { + const a: adone.collection.ByteArray = ByteArray.fromDebug("12"); + const b: adone.collection.ByteArray = ByteArray.fromDebug("12", true); + } + + namespace fromHex { + const a: adone.collection.ByteArray = ByteArray.fromHex("192"); + const b: adone.collection.ByteArray = ByteArray.fromHex("192", true); + } + + namespace fromUTF8 { + const a: adone.collection.ByteArray = ByteArray.fromUTF8("123"); + const b: adone.collection.ByteArray = ByteArray.fromUTF8("123", true); + } + + namespace constants { + const a: number = ByteArray.DEFAULT_CAPACITY; + const b: boolean = ByteArray.DEFAULT_NOASSERT; + const c: number = ByteArray.MAX_VARINT32_BYTES; + const d: number = ByteArray.MAX_VARINT64_BYTES; + const e: string = ByteArray.METRICS_CHARS; + const f: string = ByteArray.METRICS_BYTES; + } + } +} diff --git a/types/adone/test/glosses/collections/default_map.ts b/types/adone/test/glosses/collections/default_map.ts new file mode 100644 index 0000000000..1273b91982 --- /dev/null +++ b/types/adone/test/glosses/collections/default_map.ts @@ -0,0 +1,14 @@ +namespace adoneTests.collection.DefaultMap { + const { + collection: { + DefaultMap + } + } = adone; + + type DefaultMap = adone.collection.DefaultMap; + + new DefaultMap(); + { const a: DefaultMap = new DefaultMap(undefined, [["1", 2]]); } + { const a: DefaultMap = new DefaultMap((key: string) => 123); } + { const a: DefaultMap = new DefaultMap({ a: 123 }); } +} diff --git a/types/adone/test/glosses/collections/fast_lru.ts b/types/adone/test/glosses/collections/fast_lru.ts new file mode 100644 index 0000000000..0e61f51dc5 --- /dev/null +++ b/types/adone/test/glosses/collections/fast_lru.ts @@ -0,0 +1,21 @@ +namespace adoneTests.collection.FastLRU { + const { + collection: { + FastLRU + } + } = adone; + + new FastLRU(); + new FastLRU(100); + new FastLRU(100, { dispose: (key: string, value: number) => null }); + { const a: number = new FastLRU().size; } + { const a: number | undefined = new FastLRU().get("key"); } + new FastLRU().set("key", 123); + { const a: boolean = new FastLRU().delete("key"); } + { const a: boolean = new FastLRU().has("key"); } + { const a: string[] = [...new FastLRU().keys()]; } + { const a: number[] = [...new FastLRU().values()]; } + { const a: number[] = [...new FastLRU().values()]; } + { const a: Array<[string, number]> = [...new FastLRU().entries()]; } + new FastLRU().clear(); +} diff --git a/types/adone/test/glosses/collections/linked_list.ts b/types/adone/test/glosses/collections/linked_list.ts new file mode 100644 index 0000000000..f64a32c1aa --- /dev/null +++ b/types/adone/test/glosses/collections/linked_list.ts @@ -0,0 +1,123 @@ +namespace adoneTests.collection.LinkedList { + const { + collection: { + LinkedList + } + } = adone; + + namespace creation { + new LinkedList(); + new LinkedList(10); + } + + namespace properties { + { const a: boolean = new LinkedList().full; } + { const a: boolean = new LinkedList().empty; } + { const a: number = new LinkedList().maxLength; } + { const a: number = new LinkedList().length; } + { const a: boolean = new LinkedList().autoresize; } + } + + namespace resize { + { const a: boolean = new LinkedList().resize(100).full; } + } + + namespace push { + const a = new LinkedList().push(10); + a.next; + a.prev; + const b: number = a.value; + } + + namespace pop { + const a: number | undefined = new LinkedList().pop(); + } + + namespace shift { + const a: number | undefined = new LinkedList().shift(); + } + + namespace unshift { + const a = new LinkedList().unshift("hello"); + a.next; + a.prev; + const b: string = a.value; + } + + namespace pushNode { + const a = new LinkedList(); + const node = a.push("1230"); + a.pushNode(node); + } + + namespace unshiftNode { + const a = new LinkedList(); + const node = a.push(10); + a.unshiftNode(node); + } + + namespace removeNode { + const a = new LinkedList(); + const node = a.unshift("10"); + a.removeNode(node); + } + + namespace clear { + new LinkedList().clear(); + new LinkedList().clear(true); + } + + namespace toArray { + const a = new LinkedList(); + const b: number[] = a.toArray(); + } + + namespace front { + const a = new LinkedList(); + const b: number = a.front; + } + + namespace back { + const a = new LinkedList(); + const b: number = a.back; + } + + namespace iterating { + const a = new LinkedList(); + for (const b of a) { + const i: string = b; + } + const c = new LinkedList(); + for (const b of c) { + const i: number = b; + } + } + + namespace nextNode { + const a = new LinkedList(); + const n1 = a.push("h"); + const n2 = a.nextNode(n1); + n1.next; + n1.prev; + const t: string = n1.value; + } + + namespace map { + const a = new LinkedList(); + const f = (a: number, idx: number) => `${a}${idx}`; + const b = a.map(f); + const c: string = b.front; + } + + namespace forEach { + const a = new LinkedList(); + + a.forEach((a: number, b: number) => { + const c = a + b; + }); + } + + namespace static { + const a: number = LinkedList.DEFAULT_LENGTH; + } +} diff --git a/types/adone/test/glosses/collections/lru.ts b/types/adone/test/glosses/collections/lru.ts new file mode 100644 index 0000000000..934e5a1fbf --- /dev/null +++ b/types/adone/test/glosses/collections/lru.ts @@ -0,0 +1,67 @@ +namespace adoneTests.collection.LRU { + const { + collection: { + LRU + } + } = adone; + + type LRU = adone.collection.LRU; + + new LRU(); + new LRU(100); + new LRU({}); + new LRU({ max: 100 }); + new LRU({ dispose: (key: string, value: number) => null }); + new LRU({ maxAge: 100 }); + new LRU({ noDisposeOnSet: false }); + new LRU({ stale: true }); + { const a: number = new LRU().max; } + { new LRU().max = 100; } + { const a: boolean = new LRU().allowStale; } + { new LRU().allowStale = false; } + { const a: number = new LRU().maxAge; } + { new LRU().maxAge = 100; } + { const a: (v: number, k: string) => number = new LRU().lengthCalculator; } + { new LRU().lengthCalculator = () => 123; } + { const a: number = new LRU().length; } + { const a: number = new LRU().itemCount; } + new LRU().rforEach((value: number, key: string) => null); + new LRU().rforEach(function (value: number, key: string) { + const b: number = this.a; + }, { a: 1 }); + new LRU().forEach((value: number, key: string) => null); + new LRU().forEach(function (value: number, key: string) { + const b: number = this.a; + }, { a: 1 }); + { const a: string[] = new LRU().keys(); } + { const a: number[] = new LRU().values(); } + new LRU().reset(); + { + const a: Array> = new LRU().dump(); + const [b] = a; + { const c: number = b.e; } + { const c: string = b.key; } + { const c: number = b.value; } + } + { + const a: adone.collection.LinkedList> = new LRU().dumpLru(); + const b = a.shift(); + if (b !== undefined) { + { const a: string = b.key; } + { const a: number = b.value; } + { const a: number = b.now; } + { const a: number = b.maxAge; } + } + } + { const a: string = new LRU().inspect(); } + { const a: string = new LRU().inspect({}); } + { const a: boolean = new LRU().set("asd", 13); } + { const a: boolean = new LRU().set("asd", 13, 100500); } + { const a: boolean = new LRU().has("asd"); } + { const a: number | undefined = new LRU().get("asd"); } + { const a: number | undefined = new LRU().peek("asd"); } + { const a: adone.collection.I.LRU.Entry = new LRU().pop(); } + new LRU().del("asd"); + new LRU().load(new LRU().dump()); + new LRU().prune(); +} diff --git a/types/adone/test/glosses/collections/map_cache.ts b/types/adone/test/glosses/collections/map_cache.ts new file mode 100644 index 0000000000..bcd0ffb887 --- /dev/null +++ b/types/adone/test/glosses/collections/map_cache.ts @@ -0,0 +1,21 @@ +namespace adoneTests.collection.MapCache { + const { + collection: { + MapCache + } + } = adone; + + new MapCache(); + + new MapCache().has("hello"); + new MapCache().get("hello"); + new MapCache().set("hello", "world"); + new MapCache().delete("hello"); + new MapCache().clear(); + + { + const a = new MapCache(); + a.set("a", "b"); + a.get("a").charCodeAt(20); + } +} diff --git a/types/adone/test/glosses/collections/ns_cache.ts b/types/adone/test/glosses/collections/ns_cache.ts new file mode 100644 index 0000000000..a8e8c14397 --- /dev/null +++ b/types/adone/test/glosses/collections/ns_cache.ts @@ -0,0 +1,21 @@ +namespace adoneTests.collection.NSCache { + const { + collection: { + NSCache + } + } = adone; + + new NSCache(10, ["a", "b", "c"]); + new NSCache(10, ["a", "b", "c"]).resize(100); + new NSCache(10, ["a", "b", "c"]).set("a", "b", "c"); + new NSCache(10, ["a", "b", "c"]).get("a", "b"); + new NSCache(10, ["a", "b", "c"]).has("a", "b"); + new NSCache(10, ["a", "b", "c"]).delete("a", "b"); + new NSCache(10, ["a", "b", "c"]).clear(); + + { + const a = new NSCache(10, ["a", "b", "c"]); + a.set("a", "b", "c"); + a.get("a", "b").charCodeAt(100); + } +} diff --git a/types/adone/test/glosses/collections/priority_queue.ts b/types/adone/test/glosses/collections/priority_queue.ts new file mode 100644 index 0000000000..950e7394e7 --- /dev/null +++ b/types/adone/test/glosses/collections/priority_queue.ts @@ -0,0 +1,36 @@ +namespace adoneTests.collection.PriorityQueue { + const { + collection: { + PriorityQueue + } + } = adone; + + type PriorityQueue = adone.collection.PriorityQueue; + + { const a: boolean = new PriorityQueue().empty; } + { const a: number = new PriorityQueue().length; } + new PriorityQueue(); + new PriorityQueue({}); + new PriorityQueue({ + compare(a: number, b: number) { + return a - b; + } + }); + new PriorityQueue({ + priority(a: string, b: string) { + return a.length - b.length; + } + }); + { const a: PriorityQueue = new PriorityQueue().clone(); } + { const a: PriorityQueue = new PriorityQueue().push("123"); } + { const a: string | undefined = new PriorityQueue().pop(); } + { const a: PriorityQueue = new PriorityQueue().delete("123"); } + { const a: PriorityQueue = new PriorityQueue().delete("123"); } + { const a: string = new PriorityQueue().replace("123"); } + { const a: string = new PriorityQueue().pushpop("123"); } + { const a: string[] = new PriorityQueue().toArray(); } + { const a: PriorityQueue = PriorityQueue.from(["1"]); } + { const a: PriorityQueue = PriorityQueue.from(["1"], {}); } + { const a: PriorityQueue = PriorityQueue.from(["1"], { compare: (a: string, b: string) => a.length - b.length }); } + { const a: PriorityQueue = PriorityQueue.from(["1"], { priority: (a: string, b: string) => a.length - b.length }); } +} diff --git a/types/adone/test/glosses/collections/queue.ts b/types/adone/test/glosses/collections/queue.ts new file mode 100644 index 0000000000..fd6df7f39b --- /dev/null +++ b/types/adone/test/glosses/collections/queue.ts @@ -0,0 +1,17 @@ +namespace adoneTests.collection.Queue { + const { + collection: { + Queue + } + } = adone; + + type Queue = adone.collection.Queue; + + new Queue(); + { const a: Queue = new Queue().push(123).push(123); } + { const a: number | undefined = new Queue().push(123).pop(); } + { const a: string | undefined = new Queue().push(123).pop(); } + { const a: boolean = new Queue().full; } + { const a: number = new Queue().length; } + { const a: boolean = new Queue().empty; } +} diff --git a/types/adone/test/glosses/collections/rb_tree.ts b/types/adone/test/glosses/collections/rb_tree.ts new file mode 100644 index 0000000000..1b624284f6 --- /dev/null +++ b/types/adone/test/glosses/collections/rb_tree.ts @@ -0,0 +1,48 @@ +namespace adoneTests.collection.RedBlackTree { + const { + collection: { + RedBlackTree + } + } = adone; + + type RedBlackTree = adone.collection.RedBlackTree; + type RedBlackTreeIterator = adone.collection.I.RedBlackTree.Iterator; + type RedBlackTreeNode = adone.collection.I.RedBlackTree.Node; + + new RedBlackTree(); + new RedBlackTree((a: string, b: string) => a.length - b.length); + new RedBlackTree(undefined, new RedBlackTree()); + { const a: string[] = new RedBlackTree().keys; } + { const a: number[] = new RedBlackTree().values; } + { const a: number = new RedBlackTree().length; } + { + const a: RedBlackTreeIterator = new RedBlackTree().begin; + { const b: boolean = a.valid; } + { const b: RedBlackTreeNode | null = a.node; } + { const b: string | undefined = a.key; } + { const b: number | undefined = a.value; } + { const b: number = a.index; } + { const b: boolean = a.hasNext; } + { const b: boolean = a.hasPrev; } + { const b: RedBlackTree = a.tree; } + { const b: RedBlackTreeIterator = a.clone(); } + { const b: RedBlackTree = a.remove(); } + a.next(); + { const b: RedBlackTree = a.update(333); } + a.prev(); + } + { const a: RedBlackTreeIterator = new RedBlackTree().end; } + { const a: RedBlackTree = new RedBlackTree().insert("123", 456); } + { const a: number = new RedBlackTree().forEach((key: string, value: number) => value); } + { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1"); } + { const a: number = new RedBlackTree().forEach((key: string, value: number) => value, "1", "2"); } + { const a: RedBlackTreeIterator = new RedBlackTree().at(1); } + { const a: RedBlackTreeIterator = new RedBlackTree().ge("1"); } + { const a: RedBlackTreeIterator = new RedBlackTree().gt("1"); } + { const a: RedBlackTreeIterator = new RedBlackTree().lt("1"); } + { const a: RedBlackTreeIterator = new RedBlackTree().le("1"); } + { const a: RedBlackTreeIterator | null = new RedBlackTree().find("1"); } + { const a: RedBlackTree = new RedBlackTree().remove("1"); } + { const a: RedBlackTree = new RedBlackTree().remove("1"); } + { const a: number | undefined = new RedBlackTree().get("1"); } +} diff --git a/types/adone/test/glosses/collections/refcounted_cache.ts b/types/adone/test/glosses/collections/refcounted_cache.ts new file mode 100644 index 0000000000..6262d57d60 --- /dev/null +++ b/types/adone/test/glosses/collections/refcounted_cache.ts @@ -0,0 +1,17 @@ +namespace adoneTests.collection.RefcountedCache { + const { + collection: { + RefcountedCache + } + } = adone; + + new RefcountedCache(); + new RefcountedCache().ref("a"); + new RefcountedCache().unref("a"); + new RefcountedCache().references("a") === 5; + + { + const a = new RefcountedCache(); + a.get("b").charCodeAt(100); + } +} diff --git a/types/adone/test/glosses/collections/set.ts b/types/adone/test/glosses/collections/set.ts new file mode 100644 index 0000000000..2e2314956e --- /dev/null +++ b/types/adone/test/glosses/collections/set.ts @@ -0,0 +1,26 @@ +namespace adoneTests.collection.Set { + const { + collection: { + Set + } + } = adone; + + new Set().add("a"); + new Set().has("a"); + new Set().delete("a"); + new Set().get("a"); + new Set().has("a") === true; + new Set().only(); + new Set().size === 5; + + { + const a = new Set(); + + a.add(1); + a.has(2); + a.delete(2); + a.get(2); // ??? + a.only() === 5; + a.size === 5; + } +} diff --git a/types/adone/test/glosses/collections/stack.ts b/types/adone/test/glosses/collections/stack.ts new file mode 100644 index 0000000000..df13f82f8e --- /dev/null +++ b/types/adone/test/glosses/collections/stack.ts @@ -0,0 +1,16 @@ +namespace adoneTests.collection.Stack { + const { + collection: { + Stack + } + } = adone; + + type Stack = adone.collection.Stack; + + { const a: boolean = new Stack().empty; } + { const a: number = new Stack().top; } + { const a: Stack = new Stack().push(123); } + { const a: number | undefined = new Stack().pop(); } + { const a: number[] = [...new Stack()]; } + { const a: Stack = Stack.from([1, 2, 3]); } +} diff --git a/types/adone/test/glosses/collections/timedout_map.ts b/types/adone/test/glosses/collections/timedout_map.ts new file mode 100644 index 0000000000..ffca754e2a --- /dev/null +++ b/types/adone/test/glosses/collections/timedout_map.ts @@ -0,0 +1,22 @@ +namespace adoneTests.collection.TimedoutMap { + const { + collection: { + TimedoutMap + } + } = adone; + + type TimedoutMap = adone.collection.TimedoutMap; + + new TimedoutMap(); + new TimedoutMap(1000); + new TimedoutMap(1000, (key: string) => null); + { + const a: TimedoutMap = new TimedoutMap().forEach((value: number, key: string) => null); + } + { + const a: TimedoutMap = new TimedoutMap().forEach(function (value: number, key: string) { + const a: number = this.a; + }, { a: 1 }); + } + { const a: boolean = new TimedoutMap().delete("123"); } +} diff --git a/types/adone/test/glosses/crypto/asn1.ts b/types/adone/test/glosses/crypto/asn1.ts new file mode 100644 index 0000000000..447c71c34e --- /dev/null +++ b/types/adone/test/glosses/crypto/asn1.ts @@ -0,0 +1,3183 @@ +namespace adoneTests.crypto.asn1 { + const { + crypto: { + asn1 + } + } = adone; + + let arrBuf: ArrayBuffer; + let num: number; + let bool: boolean; + let str: string; + let date: Date; + + namespace BaseBlock { + const { + BaseBlock + } = asn1; + + new BaseBlock({ + blockLength: 10 + }); + new BaseBlock({ + error: "a" + }); + new BaseBlock({ + name: "a" + }); + new BaseBlock({ + optional: true + }); + new BaseBlock({ + primitiveSchema: {} + }); + new BaseBlock({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new BaseBlock({ + warnings: ["a"] + }); + + const b = new BaseBlock(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Primitive { + const { + Primitive + } = asn1; + + new Primitive({ + blockLength: 10 + }); + new Primitive({ + error: "a" + }); + new Primitive({ + name: "a" + }); + new Primitive({ + optional: true + }); + new Primitive({ + primitiveSchema: {} + }); + new Primitive({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Primitive({ + warnings: ["a"] + }); + + const b = new Primitive(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Constructed { + const { + Constructed + } = asn1; + + new Constructed({ + blockLength: 10 + }); + new Constructed({ + error: "a" + }); + new Constructed({ + name: "a" + }); + new Constructed({ + optional: true + }); + new Constructed({ + primitiveSchema: {} + }); + new Constructed({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Constructed({ + warnings: ["a"] + }); + + const b = new Constructed(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace EndOfContent { + const { + EndOfContent + } = asn1; + + new EndOfContent({ + blockLength: 10 + }); + new EndOfContent({ + error: "a" + }); + new EndOfContent({ + name: "a" + }); + new EndOfContent({ + optional: true + }); + new EndOfContent({ + primitiveSchema: {} + }); + new EndOfContent({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new EndOfContent({ + warnings: ["a"] + }); + + const b = new EndOfContent(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Boolean { + const { + Boolean: _Boolean + } = asn1; + + new _Boolean({ + blockLength: 10 + }); + new _Boolean({ + error: "a" + }); + new _Boolean({ + name: "a" + }); + new _Boolean({ + optional: true + }); + new _Boolean({ + primitiveSchema: {} + }); + new _Boolean({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new _Boolean({ + warnings: ["a"] + }); + + const b = new _Boolean(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Sequence { + const { + Sequence + } = asn1; + + new Sequence({ + blockLength: 10 + }); + new Sequence({ + error: "a" + }); + new Sequence({ + name: "a" + }); + new Sequence({ + optional: true + }); + new Sequence({ + primitiveSchema: {} + }); + new Sequence({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Sequence({ + warnings: ["a"] + }); + + const b = new Sequence(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Set { + const { + Set + } = asn1; + + new Set({ + blockLength: 10 + }); + new Set({ + error: "a" + }); + new Set({ + name: "a" + }); + new Set({ + optional: true + }); + new Set({ + primitiveSchema: {} + }); + new Set({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Set({ + warnings: ["a"] + }); + + const b = new Set(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace Null { + const { + Null: Null + } = asn1; + + new Null({ + blockLength: 10 + }); + new Null({ + error: "a" + }); + new Null({ + name: "a" + }); + new Null({ + optional: true + }); + new Null({ + primitiveSchema: {} + }); + new Null({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new Null({ + warnings: ["a"] + }); + + const b = new Null(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + } + + str = b.warnings[0]; + } + + namespace OctetString { + const { + OctetString + } = asn1; + + new OctetString({ + blockLength: 10 + }); + new OctetString({ + error: "a" + }); + new OctetString({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new OctetString({ + warnings: ["a"] + }); + + const b = new OctetString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isConstructed; + bool = b.valueBlock.isHexOnly; + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + const [v] = b.valueBlock.value; + num = v.blockLength; + str = v.error; + v.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = v.toBER(); + { + const j = v.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = v.valueBeforeDecode; + str = v.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace BitString { + const { + BitString + } = asn1; + + new BitString({ + blockLength: 10 + }); + new BitString({ + error: "a" + }); + new BitString({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new BitString({ + warnings: ["a"] + }); + + const b = new BitString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isConstructed; + bool = b.valueBlock.isHexOnly; + bool = b.valueBlock.isIndefiniteForm; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + const [v] = b.valueBlock.value; + num = v.blockLength; + str = v.error; + v.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = v.toBER(); + { + const j = v.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = v.valueBeforeDecode; + str = v.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace Integer { + const { + Integer + } = asn1; + + new Integer({ + value: 10 + }); + + const b = new Integer(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + num = b.valueBlock.valueDec; + } + + str = b.warnings[0]; + } + + namespace Enumerated { + const { + Enumerated + } = asn1; + + new Enumerated({ + value: 10 + }); + + const b = new Enumerated(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + num = b.valueBlock.valueDec; + } + + str = b.warnings[0]; + } + + namespace ObjectIdentifier { + const { + ObjectIdentifier + } = asn1; + + new ObjectIdentifier({ + blockLength: 10 + }); + new ObjectIdentifier({ + error: "a" + }); + new ObjectIdentifier({ + value: "ha" + }); + new ObjectIdentifier({ + valueBeforeDecode: new ArrayBuffer(10) + }); + new ObjectIdentifier({ + warnings: ["a"] + }); + + const b = new ObjectIdentifier(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace Utf8String { + const { + Utf8String + } = asn1; + + new Utf8String({ + value: "ha" + }); + + const b = new Utf8String({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace BmpString { + const { + BmpString + } = asn1; + + new BmpString({ + value: "ha" + }); + + const b = new BmpString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.value; + } + + str = b.warnings[0]; + } + + namespace UniversalString { + const { + UniversalString + } = asn1; + + new UniversalString({ + value: "ha" + }); + + const b = new UniversalString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.value; + } + + str = b.warnings[0]; + } + + namespace NumericString { + const { + NumericString + } = asn1; + + new NumericString({ + value: "123" + }); + + const b = new NumericString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace PrintableString { + const { + PrintableString + } = asn1; + + new PrintableString({ + value: "123" + }); + + const b = new PrintableString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace TeletexString { + const { + TeletexString + } = asn1; + + new TeletexString({ + value: "123" + }); + + const b = new TeletexString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace VideotexString { + const { + VideotexString + } = asn1; + + new VideotexString({ + value: "123" + }); + + const b = new VideotexString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace IA5String { + const { + IA5String + } = asn1; + + new IA5String({ + value: "123" + }); + + const b = new IA5String(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace GraphicString { + const { + GraphicString + } = asn1; + + new GraphicString({ + value: "123" + }); + + const b = new GraphicString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace VisibleString { + const { + VisibleString + } = asn1; + + new VisibleString({ + value: "123" + }); + + const b = new VisibleString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace GeneralString { + const { + GeneralString + } = asn1; + + new GeneralString({ + value: "123" + }); + + const b = new GeneralString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace CharacterString { + const { + CharacterString + } = asn1; + + new CharacterString({ + value: "123" + }); + + const b = new CharacterString(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace UTCTime { + const { + UTCTime + } = asn1; + + new UTCTime({ + value: "123" + }); + + new UTCTime({ + blockLength: 10 + }); + + new UTCTime({ + error: "a" + }); + + new UTCTime({ + isHexOnly: true + }); + + new UTCTime({ + valueBeforeDecode: new ArrayBuffer(10) + }); + + new UTCTime({ + valueDate: new Date() + }); + + new UTCTime({ + valueHex: new ArrayBuffer(10) + }); + + new UTCTime({ + warnings: ["a"] + }); + + const b = new UTCTime(); + + num = b.year; + num = b.month; + num = b.day; + num = b.hour; + num = b.minute; + num = b.second; + + arrBuf = b.toBuffer(); + + b.fromDate(new Date()); + + date = b.toDate(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace GeneralizedTime { + const { + GeneralizedTime + } = asn1; + + new GeneralizedTime({ + value: "123" + }); + + new GeneralizedTime({ + blockLength: 10 + }); + + new GeneralizedTime({ + error: "a" + }); + + new GeneralizedTime({ + isHexOnly: true + }); + + new GeneralizedTime({ + valueBeforeDecode: new ArrayBuffer(10) + }); + + new GeneralizedTime({ + valueDate: new Date() + }); + + new GeneralizedTime({ + valueHex: new ArrayBuffer(10) + }); + + new GeneralizedTime({ + warnings: ["a"] + }); + + const b = new GeneralizedTime(); + + num = b.year; + num = b.month; + num = b.day; + num = b.hour; + num = b.minute; + num = b.second; + num = b.millisecond; + + arrBuf = b.toBuffer(); + + b.fromDate(new Date()); + + date = b.toDate(); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + bool = b.valueBlock.isHexOnly; + str = b.valueBlock.value; + arrBuf = b.valueBlock.valueBeforeDecode; + arrBuf = b.valueBlock.valueHex; + str = b.valueBlock.warnings[0]; + } + + str = b.warnings[0]; + } + + namespace DATE { + const { + DATE + } = asn1; + + new DATE({ + value: "ha" + }); + + const b = new DATE({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace TimeOfDay { + const { + TimeOfDay + } = asn1; + + new TimeOfDay({ + value: "ha" + }); + + const b = new TimeOfDay({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace DateTime { + const { + DateTime + } = asn1; + + new DateTime({ + value: "ha" + }); + + const b = new DateTime({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace Duration { + const { + Duration + } = asn1; + + new Duration({ + value: "ha" + }); + + const b = new Duration({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace TIME { + const { + TIME + } = asn1; + + new TIME({ + value: "ha" + }); + + const b = new TIME({ + value: "a" + }); + + namespace idblock { + num = b.idBlock.blockLength; + str = b.idBlock.error; + bool = b.idBlock.isConstructed; + bool = b.idBlock.isHexOnly; + num = b.idBlock.tagClass; + num = b.idBlock.tagNumber; + arrBuf = b.idBlock.toBER(); + { + const j = b.idBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.idBlock.valueBeforeDecode; + arrBuf = b.idBlock.valueHex; + str = b.idBlock.warnings[0]; + } + + namespace lenblock { + num = b.lenBlock.blockLength; + str = b.lenBlock.error; + b.lenBlock.fromBER(new ArrayBuffer(10), 1, 1); + bool = b.lenBlock.isIndefiniteForm; + num = b.lenBlock.length; + bool = b.lenBlock.longFormUsed; + arrBuf = b.lenBlock.toBER(); + { + const j = b.lenBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.lenBlock.valueBeforeDecode; + str = b.lenBlock.warnings[0]; + } + + arrBuf = b.toBER(); + arrBuf = b.toBER(true); + + { + const j = b.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = b.valueBeforeDecode; + + namespace valueBlock { + num = b.valueBlock.blockLength; + str = b.valueBlock.error; + b.valueBlock.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = b.valueBlock.toBER(); + { + const j = b.valueBlock.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + str = b.valueBlock.toString(); + arrBuf = b.valueBlock.valueBeforeDecode; + str = b.valueBlock.warnings[0]; + bool = b.valueBlock.isHexOnly; + arrBuf = b.valueBlock.valueHex; + } + + str = b.warnings[0]; + } + + namespace Choice { + const { + Choice + } = asn1; + + new Choice({ + optional: true + }); + + const c = new Choice({ + value: [new asn1.Integer({ value: 10 })] + }); + + c.value[0].toBER(); + bool = c.optional; + } + + namespace Any { + const { + Any + } = asn1; + + const a = new Any({ + name: "A", + optional: true + }); + + str = a.name; + bool = a.optional; + } + + namespace Repeated { + const { + Repeated + } = asn1; + + new Repeated(); + new Repeated({ + local: true + }); + new Repeated({ + name: "a" + }); + new Repeated({ + optional: true + }); + const r = new Repeated({ + value: new asn1.Any() + }); + + str = r.name; + bool = r.optional; + str = r.value.name; + bool = r.value.optional; + bool = r.local; + } + + namespace RawData { + const { + RawData + } = asn1; + + const r = new RawData({ + data: new ArrayBuffer(10) + }); + arrBuf = r.data; + num = r.fromBER(new ArrayBuffer(10), 0, 0); + arrBuf = r.toBER(); + } + + namespace fromBER { + const r = asn1.fromBER(new ArrayBuffer(10)); + num = r.offset; + const { result } = r; + num = result.blockLength; + str = result.error; + { + const j = result.toJSON(); + num = j.blockLength; + str = j.blockName; + str = j.error; + arrBuf = j.valueBeforeDecode; + str = j.warnings[0]; + } + arrBuf = result.valueBeforeDecode; + str = result.warnings[0]; + } + + namespace compareSchema { + const res = asn1.compareSchema({}, {}, {}); + bool = res.verified; + res.result; + } + + namespace verifySchema { + const res = asn1.verifySchema(new ArrayBuffer(10), {}); + bool = res.verified; + res.result; + } +} diff --git a/types/adone/test/glosses/crypto/ed25519.ts b/types/adone/test/glosses/crypto/ed25519.ts new file mode 100644 index 0000000000..8c0326abf9 --- /dev/null +++ b/types/adone/test/glosses/crypto/ed25519.ts @@ -0,0 +1,28 @@ +namespace adoneTests.crypto.ed25519 { + const { + crypto: { + ed25519 + } + } = adone; + + let buf: Buffer; + let num: number; + let bool: boolean; + + num = ed25519.privateKeyLength; + num = ed25519.publicKeyLength; + + const pair = ed25519.generateKeyPair(Buffer.from("123")); + buf = pair.publicKey; + buf = pair.privateKey; + + buf = ed25519.sign(Buffer.from("hello"), Buffer.from("seed")); + buf = ed25519.sign(Buffer.from("hello"), { + publicKey: Buffer.from("hello"), + privateKey: Buffer.from("hello") + }); + + buf = ed25519.sign(Buffer.from("hello"), ed25519.generateKeyPair(Buffer.from("hello"))); + + bool = ed25519.verify(Buffer.from("hello"), Buffer.from("world"), Buffer.from("key")); +} diff --git a/types/adone/test/glosses/crypto/secp256k1.ts b/types/adone/test/glosses/crypto/secp256k1.ts new file mode 100644 index 0000000000..5f80b61537 --- /dev/null +++ b/types/adone/test/glosses/crypto/secp256k1.ts @@ -0,0 +1,97 @@ +namespace adoneTests.crypto.secp256k1 { + const { + crypto: { + secp256k1 + } + } = adone; + + let bool: boolean; + let buf: Buffer; + let num: number; + + const privateKey = Buffer.from("hello"); + const tweak = Buffer.from("world"); + const publicKey = Buffer.from("olleh"); + const signature = Buffer.from("dlrow"); + + bool = secp256k1.privateKeyVerify(privateKey); + + buf = secp256k1.privateKeyExport(privateKey); + buf = secp256k1.privateKeyExport(privateKey, true); + + buf = secp256k1.privateKeyImport(privateKey); + + buf = secp256k1.privateKeyNegate(privateKey); + + buf = secp256k1.privateKeyTweakAdd(privateKey, tweak); + + buf = secp256k1.privateKeyTweakMul(privateKey, tweak); + + buf = secp256k1.publicKeyConvert(publicKey); + buf = secp256k1.publicKeyConvert(publicKey, true); + + bool = secp256k1.publicKeyVerify(publicKey); + + buf = secp256k1.publicKeyTweakAdd(publicKey, tweak); + buf = secp256k1.publicKeyTweakAdd(publicKey, tweak, true); + + buf = secp256k1.publicKeyTweakMul(publicKey, tweak); + buf = secp256k1.publicKeyTweakMul(publicKey, tweak, true); + + buf = secp256k1.publicKeyCombine([publicKey, publicKey]); + buf = secp256k1.publicKeyCombine([publicKey, publicKey], true); + + buf = secp256k1.signatureNormalize(signature); + + buf = secp256k1.signatureExport(signature); + + buf = secp256k1.signatureImport(signature); + + buf = secp256k1.signatureImportLax(signature); + + const message = Buffer.from("msg"); + + { + const res = secp256k1.sign(message, privateKey); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, {}); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, { + data: null + }); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, { + data: Buffer.from("123") + }); + buf = res.signature; + num = res.recovery; + } + { + const res = secp256k1.sign(message, privateKey, { + noncefn(msg: Buffer, privateKey: Buffer, algo: Buffer, data: Buffer, attempt: number) { + return Buffer.from("hehe"); + } + }); + buf = res.signature; + num = res.recovery; + } + + bool = secp256k1.verify(message, signature, publicKey); + + buf = secp256k1.recover(message, signature, 1); + buf = secp256k1.recover(message, signature, 1, true); + + buf = secp256k1.ecdh(publicKey, privateKey); + + buf = secp256k1.ecdhUnsafe(publicKey, privateKey); + buf = secp256k1.ecdhUnsafe(publicKey, privateKey, true); +} diff --git a/types/adone/test/glosses/data.ts b/types/adone/test/glosses/data.ts index e9ef88d14b..00403a56da 100644 --- a/types/adone/test/glosses/data.ts +++ b/types/adone/test/glosses/data.ts @@ -570,4 +570,277 @@ namespace dataTests { bson.decode(bson.encode({ a: 1 }), { promoteLongs: false }).a; bson.decode(bson.encode({ a: 1 }), { promoteValues: true }).a; } + + namespace protobuf { + const { + protobuf + } = data; + + protobuf.create("hello"); + protobuf.create(Buffer.from("hello")); + protobuf.create({}); + protobuf.create({}, {}); + + namespace schema { + const { + schema + } = protobuf; + + const s = schema.parse("hello"); + s.syntax; + s.package; + if (!adone.is.null(s.package)) { + const c: string = s.package; + } + s.imports[0].charCodeAt(100); + + namespace enums { + const [a] = s.enums; + a.name.charCodeAt(100); + a.values; + a.options; + } + + namespace message { + const [msg] = s.messages; + msg.name; + { + const [a] = msg.enums; + a.name; + a.options; + a.values; + } + { + const [a] = msg.extends; + a.name; + a.message; + } + { + const [a] = msg.messages; + a.name; + a.enums; + a.extends; + a.messages; + a.fields; + a.extensions; + } + { + const [a] = msg.fields; + if (!adone.is.null(a.name)) { + a.name.charCodeAt(100); + } + if (!adone.is.null(a.type)) { + a.type.charCodeAt(100); + } + a.tag === 3; + if (!adone.is.null(a.map)) { + a.map.from.charCodeAt(100); + a.map.to.charCodeAt(100); + } + if (!adone.is.null(a.oneof)) { + a.oneof.charCodeAt(100); + } + a.required === false; + a.repeated === true; + a.options; + } + if (!adone.is.null(msg.extensions)) { + msg.extensions.from === 2; + msg.extensions.to === 3; + } + } + + s.options; + + s.extends[0].message; + s.extends[0].name; + + if (!adone.is.nil(s.services)) { + const [svc] = s.services; + + svc.name.charCodeAt(100); + svc.options; + + const [m] = svc.methods; + + m.name.charCodeAt(100); + if (!adone.is.null(m.input_type)) { + m.input_type.charCodeAt(100); + } + if (!adone.is.null(m.output_type)) { + m.output_type.charCodeAt(100); + } + m.client_streaming === true; + m.server_streaming === true; + m.options; + } + } + } + + namespace base32 { + const { + base32 + } = data; + + base32.charmap("asd"); + base32.charmap("asd", {}); + + base32.rfc4648.alphabet.charCodeAt(0); + base32.rfc4648.charmap["X"] === 2; + + base32.crockford.alphabet.charCodeAt(0); + base32.crockford.charmap["X"] === 2; + + base32.base32hex.alphabet.charCodeAt(0); + base32.base32hex.charmap["X"] === 2; + + namespace decoder { + const { + Decoder + } = base32; + new Decoder(); + new Decoder({ + type: "base32hex" + }); + new Decoder({ + type: "crockford" + }); + new Decoder({ + type: "rfc4648" + }); + new Decoder({ + type: "rfc4648", + charmap: {} + }); + const d = new Decoder(); + d.write("asd").write("aa"); + { const a: Buffer = d.finalize(); } + { const a: Buffer = d.finalize("c"); } + } + + namespace encoder { + const { + Encoder + } = base32; + + new Encoder(); + new Encoder({ + type: "base32hex" + }); + new Encoder({ + type: "crockford" + }); + new Encoder({ + type: "rfc4648" + }); + new Encoder({ + type: "rfc4648", + alphabet: "a" + }); + + const e = new Encoder(); + e.write(Buffer.from("b")).write(Buffer.from("a")); + { const a: string = e.finalize(); } + { const a: string = e.finalize(Buffer.from("c")); } + } + + base32.encode(Buffer.from("hello")).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "rfc4648" + }).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "crockford" + }).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "base32hex" + }).charCodeAt(100); + base32.encode(Buffer.from("hello"), { + type: "base32hex", + alphabet: "asd" + }).charCodeAt(100); + + base32.decode("asd").writeUInt8(100, 0); + base32.decode("asd", { + type: "base32hex" + }).writeUInt8(100, 0); + base32.decode("asd", { + type: "crockford" + }).writeUInt8(100, 0); + base32.decode("asd", { + type: "rfc4648" + }).writeUInt8(100, 0); + base32.decode("asd", { + type: "rfc4648", + charmap: {} + }).writeUInt8(100, 0); + } + + namespace basex { + const { + basex + } = data; + + const d = basex("abc"); + const a: Buffer = d.decode("str"); + const b: string = d.encode(Buffer.from("hello")); + const c: Buffer = d.decodeUnsafe("hello"); + } + + namespace base58 { + const { + base58 + } = data; + + const a: Buffer = base58.decode("str"); + const b: string = base58.encode(Buffer.from("hello")); + const c: Buffer = base58.decodeUnsafe("hello"); + } + + namespace base64url { + const { + base64url + } = data; + + base64url.unescape("a").charCodeAt(100); + base64url.escape("a").charCodeAt(100); + + base64url.encode("a").charCodeAt(100); + base64url.encode(Buffer.from("a")).charCodeAt(100); + base64url.encode(Buffer.from("a"), {}).charCodeAt(100); + base64url.encode(Buffer.from("a"), { + encoding: "utf8" + }).charCodeAt(100); + + base64url.decode("a").charCodeAt(100); + base64url.decode("a", { buffer: true }).writeUInt8(0, 0); + base64url.decode("a", { encoding: "utf8" }).charCodeAt(100); + } + + namespace varint { + const { + varint + } = data; + + varint.encode(12)[0]; + varint.encode(12, [])[0]; + varint.encode(12, [], 1)[0]; + + varint.decode(Buffer.from("hello")) === 5; + varint.decode(Buffer.from("hello"), 2) === 5; + varint.encodingLength(100500) === 5; + } + + namespace varintSigned { + const { + varintSigned + } = data; + + varintSigned.encode(12)[0]; + varintSigned.encode(12, [])[0]; + varintSigned.encode(12, [], 1)[0]; + + varintSigned.decode(Buffer.from("hello")) === 5; + varintSigned.decode(Buffer.from("hello"), 2) === 5; + varintSigned.encodingLength(100500) === 5; + } } diff --git a/types/adone/test/glosses/fake.ts b/types/adone/test/glosses/fake.ts new file mode 100644 index 0000000000..016d7ba7b0 --- /dev/null +++ b/types/adone/test/glosses/fake.ts @@ -0,0 +1,206 @@ +namespace adoneTests.fake { + const { + fake + } = adone; + + { const a: string = fake.address.zipCode(); } + { const a: string = fake.address.zipCode('###'); } + { const a: string = fake.address.city(); } + { const a: string = fake.address.city(0); } + { const a: string = fake.address.cityPrefix(); } + { const a: string = fake.address.citySuffix(); } + { const a: string = fake.address.streetName(); } + { const a: string = fake.address.streetAddress(); } + { const a: string = fake.address.streetAddress(false); } + { const a: string = fake.address.streetSuffix(); } + { const a: string = fake.address.streetPrefix(); } + { const a: string = fake.address.secondaryAddress(); } + { const a: string = fake.address.county(); } + { const a: string = fake.address.country(); } + { const a: string = fake.address.countryCode(); } + { const a: string = fake.address.state(); } + { const a: string = fake.address.state(false); } + { const a: string = fake.address.stateAbbr(); } + { const a: string = fake.address.latitude(); } + { const a: string = fake.address.longitude(); } + + { const a: string = fake.commerce.color(); } + { const a: string = fake.commerce.department(); } + { const a: string = fake.commerce.productName(); } + { const a: string = fake.commerce.price(); } + { const a: string = fake.commerce.price(0, 0, 0, '#'); } + { const a: string = fake.commerce.productAdjective(); } + { const a: string = fake.commerce.productMaterial(); } + { const a: string = fake.commerce.product(); } + + { const a: string[] = fake.company.suffixes(); } + { const a: string = fake.company.companyName(); } + { const a: string = fake.company.companyName(0); } + { const a: string = fake.company.companySuffix(); } + { const a: string = fake.company.catchPhrase(); } + { const a: string = fake.company.bs(); } + { const a: string = fake.company.catchPhraseAdjective(); } + { const a: string = fake.company.catchPhraseDescriptor(); } + { const a: string = fake.company.catchPhraseNoun(); } + { const a: string = fake.company.bsAdjective(); } + { const a: string = fake.company.bsBuzz(); } + { const a: string = fake.company.bsNoun(); } + + { const a: string = fake.database.column(); } + { const a: string = fake.database.type(); } + { const a: string = fake.database.collation(); } + { const a: string = fake.database.engine(); } + + { const a: Date = fake.date.past(); } + { const a: Date = fake.date.future(); } + { const a: Date = fake.date.between('foo', 'bar'); } + { const a: Date = fake.date.between(new Date(), new Date()); } + { const a: Date = fake.date.recent(); } + { const a: Date = fake.date.recent(100); } + { const a: Date = fake.date.soon(); } + { const a: Date = fake.date.soon(30); } + { const a: string = fake.date.month(); } + { const a: string = fake.date.month({ + abbr: true, + context: true + }); } + { const a: string = fake.date.weekday(); } + { const a: string = fake.date.weekday({ + abbr: true, + context: true + }); } + + { const a: string = fake.finance.account(); } + { const a: string = fake.finance.account(0); } + { const a: string = fake.finance.accountName(); } + { const a: string = fake.finance.mask(); } + { const a: string = fake.finance.mask(0, false, false); } + { const a: string = fake.finance.amount(); } + { const a: string = fake.finance.amount(0, 0, 0, '#'); } + { const a: string = fake.finance.transactionType(); } + { const a: string = fake.finance.currencyCode(); } + { const a: string = fake.finance.currencyName(); } + { const a: string = fake.finance.currencySymbol(); } + { const a: string = fake.finance.bitcoinAddress(); } + { const a: string = fake.finance.ethereumAddress(); } + { const a: string = fake.finance.iban(); } + { const a: string = fake.finance.iban(true); } + { const a: string = fake.finance.bic(); } + + { const a: string = fake.hacker.abbreviation(); } + { const a: string = fake.hacker.adjective(); } + { const a: string = fake.hacker.noun(); } + { const a: string = fake.hacker.verb(); } + { const a: string = fake.hacker.ingverb(); } + { const a: string = fake.hacker.phrase(); } + + { const a: string = fake.helpers.randomize(); } + { const a: number = fake.helpers.randomize([1, 2, 3, 4]); } + { const a: string = fake.helpers.randomize(['foo', 'bar', 'quux']); } + { const a: string = fake.helpers.slugify('foo bar quux'); } + { const a: string = fake.helpers.replaceSymbolWithNumber('foo# bar#'); } + { const a: string = fake.helpers.replaceSymbols('foo# bar? quux#'); } + { const a: string[] = fake.helpers.shuffle(['foo', 'bar', 'quux']); } + { const a: string = fake.helpers.mustache('{{foo}}{{bar}}', {foo: 'x', bar: 'y'}); } + + const card = fake.helpers.createCard(); + { const a: string = card.name; } + { const a: string = card.address.streetA; } + const contextualCard = fake.helpers.contextualCard(); + { const a: string = contextualCard.name; } + { const a: string = contextualCard.address.suite; } + const userCard = fake.helpers.userCard(); + { const a: string = userCard.name; } + { const a: string = userCard.address.suite; } + + { const a: string = fake.internet.avatar(); } + { const a: string = fake.internet.email(); } + { const a: string = fake.internet.email('foo', 'bar', 'quux'); } + { const a: string = fake.internet.exampleEmail(); } + { const a: string = fake.internet.exampleEmail('foo', 'bar'); } + { const a: string = fake.internet.protocol(); } + { const a: string = fake.internet.url(); } + { const a: string = fake.internet.domainName(); } + { const a: string = fake.internet.domainSuffix(); } + { const a: string = fake.internet.domainWord(); } + { const a: string = fake.internet.ip(); } + { const a: string = fake.internet.userAgent(); } + { const a: string = fake.internet.color(); } + { const a: string = fake.internet.color(0, 0, 0); } + { const a: string = fake.internet.mac(); } + { const a: string = fake.internet.password(); } + { const a: string = fake.internet.password(0, false, '#', 'foo'); } + + { const a: string = fake.lorem.word(); } + { const a: string = fake.lorem.words(); } + { const a: string = fake.lorem.words(0); } + { const a: string = fake.lorem.sentence(); } + { const a: string = fake.lorem.sentence(0, 0); } + { const a: string = fake.lorem.slug(); } + { const a: string = fake.lorem.slug(0); } + { const a: string = fake.lorem.sentences(); } + { const a: string = fake.lorem.sentences(0); } + { const a: string = fake.lorem.paragraph(); } + { const a: string = fake.lorem.paragraph(0); } + { const a: string = fake.lorem.paragraphs(); } + { const a: string = fake.lorem.paragraphs(0, ''); } + { const a: string = fake.lorem.text(); } + { const a: string = fake.lorem.text(0); } + { const a: string = fake.lorem.lines(); } + { const a: string = fake.lorem.lines(0); } + + { const a: string = fake.name.firstName(); } + { const a: string = fake.name.firstName(0); } + { const a: string = fake.name.lastName(); } + { const a: string = fake.name.lastName(0); } + { const a: string = fake.name.findName(); } + { const a: string = fake.name.findName('', '', 0); } + { const a: string = fake.name.jobTitle(); } + { const a: string = fake.name.prefix(); } + { const a: string = fake.name.suffix(); } + { const a: string = fake.name.title(); } + { const a: string = fake.name.jobDescriptor(); } + { const a: string = fake.name.jobArea(); } + { const a: string = fake.name.jobType(); } + + { const a: string = fake.phone.phoneNumber(); } + { const a: string = fake.phone.phoneNumber('#'); } + { const a: string = fake.phone.phoneNumberFormat(); } + { const a: string = fake.phone.phoneNumberFormat(0); } + { const a: string = fake.phone.phoneFormats(); } + + { const a: number = fake.random.number(); } + { const a: number = fake.random.number(0); } + { const a: number = fake.random.number({ + min: 0, + max: 0, + precision: 0 + }); } + { const a: string = fake.random.arrayElement(); } + { const a: string = fake.random.arrayElement(['foo', 'bar', 'quux']); } + { const a: string = fake.random.objectElement(); } + { const a: string = fake.random.objectElement({foo: 'bar', field: 'foo'}); } + { const a: string = fake.random.uuid(); } + { const a: boolean = fake.random.boolean(); } + { const a: string = fake.random.word(); } + { const a: string = fake.random.word("noun"); } + { const a: string = fake.random.words(); } + { const a: string = fake.random.words(0); } + { const a: string = fake.random.image(); } + { const a: string = fake.random.locale(); } + { const a: string = fake.random.alphaNumeric(); } + { const a: string = fake.random.alphaNumeric(0); } + { const a: string = fake.random.hexaDecimal(); } + { const a: string = fake.random.hexaDecimal(3); } + + { const a: string = fake.system.fileName("foo", "bar"); } + { const a: string = fake.system.commonFileName("foo", "bar"); } + { const a: string = fake.system.mimeType(); } + { const a: string = fake.system.commonFileType(); } + { const a: string = fake.system.commonFileExt(); } + { const a: string = fake.system.fileType(); } + { const a: string = fake.system.fileExt("foo"); } + { const a: string = fake.system.directoryPath(); } + { const a: string = fake.system.filePath(); } + { const a: string = fake.system.semver(); } +} diff --git a/types/adone/test/glosses/is.ts b/types/adone/test/glosses/is.ts index 13b00530d7..045818f0ec 100644 --- a/types/adone/test/glosses/is.ts +++ b/types/adone/test/glosses/is.ts @@ -99,15 +99,34 @@ namespace isTests { } } { const a: boolean = is.json({}); } - { const a: boolean = is.object({}); } - { const a: boolean = is.plainObject({}); } + { + const a: boolean = is.object({}); + const b: any = 2; + if (is.object(b)) { + const c: object = b; + } + } + { + const a: boolean = is.plainObject({}); + const b: any = 2; + if (is.plainObject(b)) { + const c: object = b; + } + } { const a: boolean = is.class({}); } { const a: boolean = is.emptyObject({}); } { const a: boolean = is.propertyOwned({}, "a"); } { const a: boolean = is.propertyDefined({}, "a"); } { const a: boolean = is.conforms({}, {}); } { const a: boolean = is.conforms({}, {}, true); } - { const a: boolean = is.arrayLikeObject({}); } + { + const a: boolean = is.arrayLikeObject({}); + const b: any = {}; + if (is.arrayLikeObject(b)) { + const c: number = b.length; + b[0]; + } + } { const a: boolean = is.inArray(1, [1, 2, 3]); } { const a: boolean = is.inArray(1, [1, 2, 3], 0); } { const a: boolean = is.inArray(1, [1, 2, 3], 0, (a, b) => a === b); } @@ -133,8 +152,20 @@ namespace isTests { } } { const a: boolean = is.dotfile("abc"); } - { const a: boolean = is.function(() => { }); } - { const a: boolean = is.asyncFunction(async () => { }); } + { + const a: boolean = is.function(() => { }); + const b: any = 2; + if (is.function(b)) { + b(); + } + } + { + const a: boolean = is.asyncFunction(async () => { }); + const b: any = 2; + if (is.asyncFunction(b)) { + b().then(() => {}); + } + } { const a: boolean = is.promise({}); const b: any = 2; @@ -155,7 +186,13 @@ namespace isTests { } } { const a: boolean = is.callback({}); } - { const a: boolean = is.generator({}); } + { + const a: boolean = is.generator({}); + const b: any = 2; + if (is.generator(b)) { + b().next(); + } + } { const a: boolean = is.nan({}); } { const a: boolean = is.finite({}); @@ -226,13 +263,51 @@ namespace isTests { } } { const a: boolean = is.transform({}); } - { const a: boolean = is.subsystem({}); } - { const a: boolean = is.application({}); } + { + const a: boolean = is.subsystem({}); + const b: any = 2; + if (is.subsystem(b)) { + b.configureSubsystems().then(() => {}); + } + } + { + const a: boolean = is.application({}); + const b: any = 2; + if (is.application(b)) { + b.exitOnSignal("SIGINT"); + } + } { const a: boolean = is.logger({}); } - { const a: boolean = is.coreStream({}); } - { const a: boolean = is.fastStream({}); } - { const a: boolean = is.fastLocalStream({}); } - { const a: boolean = is.fastLocalMapStream({}); } + { + const a: boolean = is.coreStream({}); + const b: any = 2; + if (is.coreStream(b)) { + b.map((x) => 2).forEach((t: number) => { + // + }); + } + } + { + const a: boolean = is.fastStream({}); + const b: any = 2; + if (is.fastStream(b)) { + b.compress("deflate"); + } + } + { + const a: boolean = is.fastLocalStream({}); + const b: any = 2; + if (is.fastLocalStream(b)) { + b.compress("gz"); + } + } + { + const a: boolean = is.fastLocalMapStream({}); + const b: any = 2; + if (is.fastLocalMapStream(b)) { + b.decompress("gz"); + } + } { const a: boolean = is.genesisNetron({}); } { const a: boolean = is.genesisPeer({}); } { const a: boolean = is.netronAdapter({}); } @@ -248,7 +323,14 @@ namespace isTests { { const a: boolean = is.netronStub({}); } { const a: boolean = is.netronRemoteStub({}); } { const a: boolean = is.netronStream({}); } - { const a: boolean = is.iterable({}); } + { + const a: boolean = is.iterable({}); + const b: any = 2; + if (is.iterable(b)) { + const it = b[Symbol.iterator](); + it.next(); + } + } { const a: boolean = is.windows; } { const a: boolean = is.linux; } { const a: boolean = is.freebsd; } diff --git a/types/adone/test/glosses/net/http/client.ts b/types/adone/test/glosses/net/http/client.ts new file mode 100644 index 0000000000..0992c1576c --- /dev/null +++ b/types/adone/test/glosses/net/http/client.ts @@ -0,0 +1,499 @@ +namespace adoneTests.net.http.client { + const { + net: { + http: { + client + } + } + } = adone; + + let bool: boolean; + let num: number; + let str: string; + let buf: Buffer; + let stream: nodestd.stream.Readable; + + namespace Client { + const { + Client + } = client; + + new Client(); + new Client({}); + new Client({ + auth: { + username: "a" + } + }); + new Client({ + auth: { + password: "a" + } + }); + new Client({ + cancelToken: new client.CancelToken(() => {}) + }); + new Client({ + data: Buffer.from("hello") + }); + new Client({ + data: "hello" + }); + new Client({ + data: adone.fs.createReadStream(__filename) + }); + new Client({ + data: new ArrayBuffer(10) + }); + new Client({ + formData: { + a: "string" + } + }); + new Client({ + formData: { + a: ["string"] + } + }); + new Client({ + formData: { + a: [adone.fs.createReadStream(__filename)] + } + }); + new Client({ + formData: { + a: { + value: "string", + options: {} + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + contentType: "a" + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + filename: "a" + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + header: "a" + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + header: { + a: "a" + } + } + } + } + }); + new Client({ + formData: { + a: { + value: "string", + options: { + knownLength: 100500 + } + } + } + }); + new Client({ + formData: { + a: [{ + value: "string", + options: { + knownLength: 100500 + } + }] + } + }); + new Client({ + headers: { + "User-Agent": "true" + } + }); + new Client({ + httpAgent: {} + }); + new Client({ + httpsAgent: {} + }); + new Client({ + maxContentLength: 100500 + }); + new Client({ + maxRedirects: 100500 + }); + new Client({ + method: "GET" + }); + new Client({ + onUploadProgress(event) { + bool = event.lengthComputable; + num = event.loaded; + num = event.total; + } + }); + new Client({ + params: { + a: 1 + } + }); + new Client({ + paramsSerializer(params: object) { + return "asd"; + } + }); + new Client({ + proxy: "socks5://localhost" + }); + new Client({ + proxy: { + protocol: "socks5", + host: "127.0.0.1", + port: 9000, + auth: { + username: "hello", + password: "world" + } + } + }); + + new Client({ + rejectUnauthorized: true + }); + new Client({ + responseEncoding: "CP1251" + }); + new Client({ + responseType: "stream" + }); + new Client({ + timeout: 100 + }); + new Client({ + transformRequest: [(data, headers, config) => { + return data; + }] + }); + new Client({ + transformResponse: [(data, headers, config) => { + return data; + }] + }); + new Client({ + transport: adone.std.http + }); + new Client({ + validateStatus(status) { + return status > 100; + } + }); + new Client({ + xsrfCookieName: "a" + }); + new Client({ + xsrfHeaderName: "a" + }); + + const req = new Client(); + + namespace request { + req.request({ + method: "GET" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + const len = resp.headers["content-length"]; + if (!adone.is.undefined(len)) { + str = len; + } + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.request({ + method: "GET", + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.request({ + method: "GET", + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.request({ + method: "GET", + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace get { + req.get("url").then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.get("url", { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.get("url", { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.get("url", { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace post { + req.post("url", {}).then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.post("url", {}, { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.post("url", {}, { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.post("url", {}, { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace put { + req.put("url", {}).then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.put("url", {}, { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.put("url", {}, { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.put("url", {}, { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace patch { + req.patch("url", {}).then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.patch("url", {}, { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.patch("url", {}, { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.patch("url", {}, { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace _delete { + req.delete("url").then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.delete("url", { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.delete("url", { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.delete("url", { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + + namespace options { + req.options("url").then((resp) => { + num = resp.status; + str = resp.statusText; + const data = resp.data; + if (!adone.is.object(data)) { + str = data; + } + }); + req.options("url", { + responseType: "string" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + str = resp.data; + }); + req.options("url", { + responseType: "buffer" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + buf = resp.data; + }); + req.options("url", { + responseType: "stream" + }).then((resp) => { + num = resp.status; + str = resp.statusText; + stream = resp.data; + }); + } + } + + namespace request { + client.request.get("htllo").then((x) => { + num = x.status; + }); + } + + namespace create { + client.create(); + client.create({}); + const req = client.create({ + headers: { + "User-Agent": "Hello" + } + }); + req.get("hello world").then((x) => { + num = x.status; + }); + } + + namespace cancel { + const { + Cancel, + CancelToken, + isCancel + } = client; + + new CancelToken((s: string) => 123).promise.then((x) => { + str = x.message; + }); + new CancelToken((s: string) => 123).reason; + CancelToken.source().token.promise; + CancelToken.source().cancel("hello"); + + new Cancel("hello").message; + + const a: any = 2; + + if (isCancel(a)) { + str = a.message; + } + } +} diff --git a/types/adone/test/glosses/regex.ts b/types/adone/test/glosses/regex.ts new file mode 100644 index 0000000000..7aab1e0d8d --- /dev/null +++ b/types/adone/test/glosses/regex.ts @@ -0,0 +1,17 @@ +namespace adoneTests.regex { + const { + regex + } = adone; + + regex.ansi().test("a"); + regex.filename().test("a"); + regex.idn().test("a"); + regex.ip4().test("a"); + regex.ip6().test("a"); + regex.protocol().test("a"); + regex.punycode().test("a"); + regex.shebang().test("a"); + regex.uri().test("a"); + regex.uuid4().test("a"); + regex.uuid5().test("a"); +} diff --git a/types/adone/test/glosses/semver.ts b/types/adone/test/glosses/semver.ts new file mode 100644 index 0000000000..e6ac7a50b0 --- /dev/null +++ b/types/adone/test/glosses/semver.ts @@ -0,0 +1,131 @@ +namespace adoneTests.semver { + const { + semver + } = adone; + + type ReleaseType = adone.semver.I.ReleaseType; + type Operator = adone.semver.I.Operator; + type SemVer = adone.semver.SemVer; + type Comparator = adone.semver.Comparator; + + let bool: boolean; + let num: number; + let str = ''; + let strn: string | null = ''; + let diff: ReleaseType | null; + const op: Operator = ''; + declare const arr: any[]; + declare const exp: RegExp; + let strArr: string[] | null; + declare const numArr: string[]; + let comparatorResult: -1 | 0 | 1; + let versionsArr: Array; + + const v1 = ''; + const v2 = ''; + const version = ''; + const versions: string[] = []; + const loose = true; + let sem: SemVer | null; + + sem = semver.parse(str); + strn = semver.valid(str); + strn = semver.clean(str); + + strn = semver.valid(str, loose); + strn = semver.clean(str, loose); + strn = semver.inc(str, "major", loose); + strn = semver.inc(str, "premajor", loose); + strn = semver.inc(str, "minor", loose); + strn = semver.inc(str, "preminor", loose); + strn = semver.inc(str, "patch", loose); + strn = semver.inc(str, "prepatch", loose); + strn = semver.inc(str, "prerelease", loose); + strn = semver.inc(str, "prerelease", loose, "alpha"); + num = semver.major(str, loose); + num = semver.minor(str, loose); + num = semver.patch(str, loose); + strArr = semver.prerelease(str, loose); + + // Comparison + bool = semver.gt(v1, v2, loose); + bool = semver.gte(v1, v2, loose); + bool = semver.lt(v1, v2, loose); + bool = semver.lte(v1, v2, loose); + bool = semver.eq(v1, v2, loose); + bool = semver.neq(v1, v2, loose); + bool = semver.cmp(v1, op, v2, loose); + comparatorResult = semver.compare(v1, v2, loose); + comparatorResult = semver.rcompare(v1, v2, loose); + comparatorResult = semver.compareIdentifiers(str, str); + comparatorResult = semver.rcompareIdentifiers(str, str); + versionsArr = semver.sort(['', new semver.SemVer('')]); + versionsArr = semver.rsort(['', new semver.SemVer('')]); + diff = semver.diff(v1, v2, loose); + + // Ranges + str = semver.validRange(str, loose); + bool = semver.satisfies(version, str, loose); + str = semver.maxSatisfying(versions, str, loose); + str = semver.minSatisfying(versions, str, loose); + bool = semver.gtr(version, str, loose); + bool = semver.ltr(version, str, loose); + bool = semver.outside(version, str, '<', loose); + bool = semver.intersects(str, str, loose); + + // Coercion + sem = semver.coerce(str); + + let ver = new semver.SemVer(str, bool); + str = ver.raw; + bool = ver.loose; + str = ver.format(); + str = ver.inspect(); + str = ver.toString(); + + num = ver.major; + num = ver.minor; + num = ver.patch; + str = ver.version; + strArr = ver.build; + strArr = ver.prerelease; + + comparatorResult = ver.compare(ver); + comparatorResult = ver.compareMain(ver); + comparatorResult = ver.comparePre(ver); + ver = ver.inc("major"); + ver = ver.inc("premajor"); + ver = ver.inc("minor"); + ver = ver.inc("preminor"); + ver = ver.inc("patch"); + ver = ver.inc("prepatch"); + ver = ver.inc("prerelease"); + ver = ver.inc("prerelease", "alpha"); + + const comp = new semver.Comparator(str, bool); + str = comp.toString(); + + ver = comp.semver; + str = comp.operator; + bool = comp.value; + comp.parse(str); + bool = comp.test(ver); + bool = comp.intersects(new semver.Comparator(str)); + bool = comp.intersects(new semver.Comparator(str), bool); + + const range = new semver.Range(str, bool); + str = range.raw; + bool = range.loose; + str = range.format(); + str = range.inspect(); + str = range.toString(); + bool = range.test(ver); + bool = range.intersects(new semver.Range('')); + bool = range.intersects(new semver.Range(''), bool); + + let sets: Comparator[][]; + sets = range.set; + + let lims: Comparator[]; + lims = range.parseRange(str); +} diff --git a/types/adone/test/glosses/std.ts b/types/adone/test/glosses/std.ts index 9bcb6687d4..a84d9cc901 100644 --- a/types/adone/test/glosses/std.ts +++ b/types/adone/test/glosses/std.ts @@ -39,6 +39,12 @@ namespace stdTests { std.http.get("http://localhost").end(); } + namespace http2 { + std.http2.connect("somewhere").on("stream", (stream) => { + stream.pipe(process.stdout); + }); + } + namespace https { std.https.get("https://adone.io").end(); } @@ -91,6 +97,10 @@ namespace stdTests { std.domain.create().members; } + namespace module { + new std.module.Module("1").exports; + } + namespace tty { const a: boolean = std.tty.isatty(1); } @@ -126,4 +136,8 @@ namespace stdTests { namespace dgram { std.dgram.createSocket("udp4").bind(31337); } + + namespace perf_hooks { + std.perf_hooks.performance.measure("1", "2", "3"); + } } diff --git a/types/adone/test/glosses/system/env.ts b/types/adone/test/glosses/system/env.ts new file mode 100644 index 0000000000..6f77ede2fa --- /dev/null +++ b/types/adone/test/glosses/system/env.ts @@ -0,0 +1,25 @@ +namespace adoneTests.system.env { + const { + system: { + env + } + } = adone; + + let str: string; + + str = env.user(); + + str = env.prompt(); + + str = env.hostname(); + + str = env.tmpdir(); + + str = env.home(); + + str = env.path(); + + str = env.editor(); + + str = env.shell(); +} diff --git a/types/adone/test/glosses/system/process.ts b/types/adone/test/glosses/system/process.ts new file mode 100644 index 0000000000..9ffd3c33a5 --- /dev/null +++ b/types/adone/test/glosses/system/process.ts @@ -0,0 +1,1200 @@ +namespace adoneTests.system.process { + const { + system: { + process + } + } = adone; + + let str: string; + let num: number; + let bool: boolean; + let anyArr: any[]; + + str = process.errname(1); + + str = process.errnameFallback({}, 1); + + anyArr = process.stdio({}); + + namespace exec { + process.exec("node"); + process.exec("node", ["1.js"]); + process.exec("node", ["1.js"], {}); + process.exec("node", ["1.js"], { + cwd: "hello" + }); + process.exec("node", ["1.js"], { + env: { + a: "a" + } + }); + process.exec("node", ["1.js"], { + extendEnv: true + }); + process.exec("node", ["1.js"], { + argv0: "a" + }); + { + process.exec("node", ["1.js"], { + stdio: "pipe" + }); + process.exec("node", ["1.js"], { + stdio: "ignore" + }); + process.exec("node", ["1.js"], { + stdio: "inherit" + }); + process.exec("node", ["1.js"], { + stdio: ["pipe"] + }); + process.exec("node", ["1.js"], { + stdio: ["ipc"] + }); + process.exec("node", ["1.js"], { + stdio: ["ignore"] + }); + process.exec("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.exec("node", ["1.js"], { + stdio: [0] + }); + process.exec("node", ["1.js"], { + stdio: [null] + }); + process.exec("node", ["1.js"], { + stdio: [undefined] + }); + } + process.exec("node", ["1.js"], { + detached: true + }); + process.exec("node", ["1.js"], { + uid: 1000 + }); + process.exec("node", ["1.js"], { + gid: 1000 + }); + process.exec("node", ["1.js"], { + shell: true + }); + process.exec("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.exec("node", ["1.js"], { + stripEof: true + }); + process.exec("node", ["1.js"], { + preferLocal: true + }); + process.exec("node", ["1.js"], { + localDir: "a" + }); + process.exec("node", ["1.js"], { + reject: false + }); + process.exec("node", ["1.js"], { + cleanup: true + }); + process.exec("node", ["1.js"], { + encoding: "utf8" + }); + process.exec("node", ["1.js"], { + timeout: 100 + }); + process.exec("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.exec("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.exec("node", ["1.js"], { + stdin: "pipe" + }); + process.exec("node", ["1.js"], { + stdin: "ignore" + }); + process.exec("node", ["1.js"], { + stdin: "ipc" + }); + process.exec("node", ["1.js"], { + stdin: "ignore" + }); + process.exec("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.exec("node", ["1.js"], { + stdin: 0 + }); + process.exec("node", ["1.js"], { + stdin: null + }); + process.exec("node", ["1.js"], { + stdin: undefined + }); + } + { + process.exec("node", ["1.js"], { + stdout: "pipe" + }); + process.exec("node", ["1.js"], { + stdout: "ignore" + }); + process.exec("node", ["1.js"], { + stdout: "ipc" + }); + process.exec("node", ["1.js"], { + stdout: "ignore" + }); + process.exec("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.exec("node", ["1.js"], { + stdout: 0 + }); + process.exec("node", ["1.js"], { + stdout: null + }); + process.exec("node", ["1.js"], { + stdout: undefined + }); + } + { + process.exec("node", ["1.js"], { + stderr: "pipe" + }); + process.exec("node", ["1.js"], { + stderr: "ignore" + }); + process.exec("node", ["1.js"], { + stderr: "ipc" + }); + process.exec("node", ["1.js"], { + stderr: "ignore" + }); + process.exec("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.exec("node", ["1.js"], { + stderr: 0 + }); + process.exec("node", ["1.js"], { + stderr: null + }); + process.exec("node", ["1.js"], { + stderr: undefined + }); + } + { + process.exec("node", ["1.js"], { + input: "a" + }); + process.exec("node", ["1.js"], { + input: Buffer.from("a") + }); + process.exec("node", ["1.js"], { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.exec("node", ["1.js"]); + ret.then((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + ret.catch((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + + ret.on("message", () => {}); + ret.stdout.pipe(adone.fs.createWriteStream(__filename)); + } + } + + namespace execStdout { + process.execStdout("node"); + process.execStdout("node", ["1.js"]); + process.execStdout("node", ["1.js"], {}); + process.execStdout("node", ["1.js"], { + cwd: "hello" + }); + process.execStdout("node", ["1.js"], { + env: { + a: "a" + } + }); + process.execStdout("node", ["1.js"], { + extendEnv: true + }); + process.execStdout("node", ["1.js"], { + argv0: "a" + }); + { + process.execStdout("node", ["1.js"], { + stdio: "pipe" + }); + process.execStdout("node", ["1.js"], { + stdio: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdio: "inherit" + }); + process.execStdout("node", ["1.js"], { + stdio: ["pipe"] + }); + process.execStdout("node", ["1.js"], { + stdio: ["ipc"] + }); + process.execStdout("node", ["1.js"], { + stdio: ["ignore"] + }); + process.execStdout("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.execStdout("node", ["1.js"], { + stdio: [0] + }); + process.execStdout("node", ["1.js"], { + stdio: [null] + }); + process.execStdout("node", ["1.js"], { + stdio: [undefined] + }); + } + process.execStdout("node", ["1.js"], { + detached: true + }); + process.execStdout("node", ["1.js"], { + uid: 1000 + }); + process.execStdout("node", ["1.js"], { + gid: 1000 + }); + process.execStdout("node", ["1.js"], { + shell: true + }); + process.execStdout("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.execStdout("node", ["1.js"], { + stripEof: true + }); + process.execStdout("node", ["1.js"], { + preferLocal: true + }); + process.execStdout("node", ["1.js"], { + localDir: "a" + }); + process.execStdout("node", ["1.js"], { + reject: false + }); + process.execStdout("node", ["1.js"], { + cleanup: true + }); + process.execStdout("node", ["1.js"], { + encoding: "utf8" + }); + process.execStdout("node", ["1.js"], { + timeout: 100 + }); + process.execStdout("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.execStdout("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.execStdout("node", ["1.js"], { + stdin: "pipe" + }); + process.execStdout("node", ["1.js"], { + stdin: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdin: "ipc" + }); + process.execStdout("node", ["1.js"], { + stdin: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.execStdout("node", ["1.js"], { + stdin: 0 + }); + process.execStdout("node", ["1.js"], { + stdin: null + }); + process.execStdout("node", ["1.js"], { + stdin: undefined + }); + } + { + process.execStdout("node", ["1.js"], { + stdout: "pipe" + }); + process.execStdout("node", ["1.js"], { + stdout: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdout: "ipc" + }); + process.execStdout("node", ["1.js"], { + stdout: "ignore" + }); + process.execStdout("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.execStdout("node", ["1.js"], { + stdout: 0 + }); + process.execStdout("node", ["1.js"], { + stdout: null + }); + process.execStdout("node", ["1.js"], { + stdout: undefined + }); + } + { + process.execStdout("node", ["1.js"], { + stderr: "pipe" + }); + process.execStdout("node", ["1.js"], { + stderr: "ignore" + }); + process.execStdout("node", ["1.js"], { + stderr: "ipc" + }); + process.execStdout("node", ["1.js"], { + stderr: "ignore" + }); + process.execStdout("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.execStdout("node", ["1.js"], { + stderr: 0 + }); + process.execStdout("node", ["1.js"], { + stderr: null + }); + process.execStdout("node", ["1.js"], { + stderr: undefined + }); + } + { + process.execStdout("node", ["1.js"], { + input: "a" + }); + process.execStdout("node", ["1.js"], { + input: Buffer.from("a") + }); + process.execStdout("node", ["1.js"], { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.execStdout("node", ["1.js"]); + ret.then((x) => { + str = x; + }); + } + } + + namespace execStderr { + process.execStderr("node"); + process.execStderr("node", ["1.js"]); + process.execStderr("node", ["1.js"], {}); + process.execStderr("node", ["1.js"], { + cwd: "hello" + }); + process.execStderr("node", ["1.js"], { + env: { + a: "a" + } + }); + process.execStderr("node", ["1.js"], { + extendEnv: true + }); + process.execStderr("node", ["1.js"], { + argv0: "a" + }); + { + process.execStderr("node", ["1.js"], { + stdio: "pipe" + }); + process.execStderr("node", ["1.js"], { + stdio: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdio: "inherit" + }); + process.execStderr("node", ["1.js"], { + stdio: ["pipe"] + }); + process.execStderr("node", ["1.js"], { + stdio: ["ipc"] + }); + process.execStderr("node", ["1.js"], { + stdio: ["ignore"] + }); + process.execStderr("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.execStderr("node", ["1.js"], { + stdio: [0] + }); + process.execStderr("node", ["1.js"], { + stdio: [null] + }); + process.execStderr("node", ["1.js"], { + stdio: [undefined] + }); + } + process.execStderr("node", ["1.js"], { + detached: true + }); + process.execStderr("node", ["1.js"], { + uid: 1000 + }); + process.execStderr("node", ["1.js"], { + gid: 1000 + }); + process.execStderr("node", ["1.js"], { + shell: true + }); + process.execStderr("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.execStderr("node", ["1.js"], { + stripEof: true + }); + process.execStderr("node", ["1.js"], { + preferLocal: true + }); + process.execStderr("node", ["1.js"], { + localDir: "a" + }); + process.execStderr("node", ["1.js"], { + reject: false + }); + process.execStderr("node", ["1.js"], { + cleanup: true + }); + process.execStderr("node", ["1.js"], { + encoding: "utf8" + }); + process.execStderr("node", ["1.js"], { + timeout: 100 + }); + process.execStderr("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.execStderr("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.execStderr("node", ["1.js"], { + stdin: "pipe" + }); + process.execStderr("node", ["1.js"], { + stdin: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdin: "ipc" + }); + process.execStderr("node", ["1.js"], { + stdin: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.execStderr("node", ["1.js"], { + stdin: 0 + }); + process.execStderr("node", ["1.js"], { + stdin: null + }); + process.execStderr("node", ["1.js"], { + stdin: undefined + }); + } + { + process.execStderr("node", ["1.js"], { + stdout: "pipe" + }); + process.execStderr("node", ["1.js"], { + stdout: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdout: "ipc" + }); + process.execStderr("node", ["1.js"], { + stdout: "ignore" + }); + process.execStderr("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.execStderr("node", ["1.js"], { + stdout: 0 + }); + process.execStderr("node", ["1.js"], { + stdout: null + }); + process.execStderr("node", ["1.js"], { + stdout: undefined + }); + } + { + process.execStderr("node", ["1.js"], { + stderr: "pipe" + }); + process.execStderr("node", ["1.js"], { + stderr: "ignore" + }); + process.execStderr("node", ["1.js"], { + stderr: "ipc" + }); + process.execStderr("node", ["1.js"], { + stderr: "ignore" + }); + process.execStderr("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.execStderr("node", ["1.js"], { + stderr: 0 + }); + process.execStderr("node", ["1.js"], { + stderr: null + }); + process.execStderr("node", ["1.js"], { + stderr: undefined + }); + } + { + process.execStderr("node", ["1.js"], { + input: "a" + }); + process.execStderr("node", ["1.js"], { + input: Buffer.from("a") + }); + process.execStderr("node", ["1.js"], { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.execStderr("node", ["1.js"]); + ret.then((x) => { + str = x; + }); + } + } + + namespace shell { + process.shell("node 1.js"); + process.shell("node 1.js", {}); + process.shell("node 1.js", { + cwd: "hello" + }); + process.shell("node 1.js", { + env: { + a: "a" + } + }); + process.shell("node 1.js", { + extendEnv: true + }); + process.shell("node 1.js", { + argv0: "a" + }); + { + process.shell("node 1.js", { + stdio: "pipe" + }); + process.shell("node 1.js", { + stdio: "ignore" + }); + process.shell("node 1.js", { + stdio: "inherit" + }); + process.shell("node 1.js", { + stdio: ["pipe"] + }); + process.shell("node 1.js", { + stdio: ["ipc"] + }); + process.shell("node 1.js", { + stdio: ["ignore"] + }); + process.shell("node 1.js", { + stdio: [new adone.std.stream.Stream()] + }); + process.shell("node 1.js", { + stdio: [0] + }); + process.shell("node 1.js", { + stdio: [null] + }); + process.shell("node 1.js", { + stdio: [undefined] + }); + } + process.shell("node 1.js", { + detached: true + }); + process.shell("node 1.js", { + uid: 1000 + }); + process.shell("node 1.js", { + gid: 1000 + }); + process.shell("node 1.js", { + shell: true + }); + process.shell("node 1.js", { + windowsVerbatimArguments: true + }); + process.shell("node 1.js", { + stripEof: true + }); + process.shell("node 1.js", { + preferLocal: true + }); + process.shell("node 1.js", { + localDir: "a" + }); + process.shell("node 1.js", { + reject: false + }); + process.shell("node 1.js", { + cleanup: true + }); + process.shell("node 1.js", { + encoding: "utf8" + }); + process.shell("node 1.js", { + timeout: 100 + }); + process.shell("node 1.js", { + maxBuffer: 1010101 + }); + process.shell("node 1.js", { + killSignal: "SIGINT" + }); + { + process.shell("node 1.js", { + stdin: "pipe" + }); + process.shell("node 1.js", { + stdin: "ignore" + }); + process.shell("node 1.js", { + stdin: "ipc" + }); + process.shell("node 1.js", { + stdin: "ignore" + }); + process.shell("node 1.js", { + stdin: new adone.std.stream.Stream() + }); + process.shell("node 1.js", { + stdin: 0 + }); + process.shell("node 1.js", { + stdin: null + }); + process.shell("node 1.js", { + stdin: undefined + }); + } + { + process.shell("node 1.js", { + stdout: "pipe" + }); + process.shell("node 1.js", { + stdout: "ignore" + }); + process.shell("node 1.js", { + stdout: "ipc" + }); + process.shell("node 1.js", { + stdout: "ignore" + }); + process.shell("node 1.js", { + stdout: new adone.std.stream.Stream() + }); + process.shell("node 1.js", { + stdout: 0 + }); + process.shell("node 1.js", { + stdout: null + }); + process.shell("node 1.js", { + stdout: undefined + }); + } + { + process.shell("node 1.js", { + stderr: "pipe" + }); + process.shell("node 1.js", { + stderr: "ignore" + }); + process.shell("node 1.js", { + stderr: "ipc" + }); + process.shell("node 1.js", { + stderr: "ignore" + }); + process.shell("node 1.js", { + stderr: new adone.std.stream.Stream() + }); + process.shell("node 1.js", { + stderr: 0 + }); + process.shell("node 1.js", { + stderr: null + }); + process.shell("node 1.js", { + stderr: undefined + }); + } + { + process.shell("node 1.js", { + input: "a" + }); + process.shell("node 1.js", { + input: Buffer.from("a") + }); + process.shell("node 1.js", { + input: adone.fs.createReadStream(__filename) + }); + } + { + const ret = process.shell("node 1.js"); + ret.then((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + ret.catch((x) => { + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + }); + + ret.on("message", () => {}); + ret.stdout.pipe(adone.fs.createWriteStream(__filename)); + } + } + + namespace execSync { + process.execSync("node"); + process.execSync("node", ["1.js"]); + process.execSync("node", ["1.js"], {}); + process.execSync("node", ["1.js"], { + cwd: "hello" + }); + process.execSync("node", ["1.js"], { + env: { + a: "a" + } + }); + process.execSync("node", ["1.js"], { + extendEnv: true + }); + process.execSync("node", ["1.js"], { + argv0: "a" + }); + { + process.execSync("node", ["1.js"], { + stdio: "pipe" + }); + process.execSync("node", ["1.js"], { + stdio: "ignore" + }); + process.execSync("node", ["1.js"], { + stdio: "inherit" + }); + process.execSync("node", ["1.js"], { + stdio: ["pipe"] + }); + process.execSync("node", ["1.js"], { + stdio: ["ipc"] + }); + process.execSync("node", ["1.js"], { + stdio: ["ignore"] + }); + process.execSync("node", ["1.js"], { + stdio: [new adone.std.stream.Stream()] + }); + process.execSync("node", ["1.js"], { + stdio: [0] + }); + process.execSync("node", ["1.js"], { + stdio: [null] + }); + process.execSync("node", ["1.js"], { + stdio: [undefined] + }); + } + process.execSync("node", ["1.js"], { + detached: true + }); + process.execSync("node", ["1.js"], { + uid: 1000 + }); + process.execSync("node", ["1.js"], { + gid: 1000 + }); + process.execSync("node", ["1.js"], { + shell: true + }); + process.execSync("node", ["1.js"], { + windowsVerbatimArguments: true + }); + process.execSync("node", ["1.js"], { + stripEof: true + }); + process.execSync("node", ["1.js"], { + preferLocal: true + }); + process.execSync("node", ["1.js"], { + localDir: "a" + }); + process.execSync("node", ["1.js"], { + reject: false + }); + process.execSync("node", ["1.js"], { + cleanup: true + }); + process.execSync("node", ["1.js"], { + encoding: "utf8" + }); + process.execSync("node", ["1.js"], { + timeout: 100 + }); + process.execSync("node", ["1.js"], { + maxBuffer: 1010101 + }); + process.execSync("node", ["1.js"], { + killSignal: "SIGINT" + }); + { + process.execSync("node", ["1.js"], { + stdin: "pipe" + }); + process.execSync("node", ["1.js"], { + stdin: "ignore" + }); + process.execSync("node", ["1.js"], { + stdin: "ipc" + }); + process.execSync("node", ["1.js"], { + stdin: "ignore" + }); + process.execSync("node", ["1.js"], { + stdin: new adone.std.stream.Stream() + }); + process.execSync("node", ["1.js"], { + stdin: 0 + }); + process.execSync("node", ["1.js"], { + stdin: null + }); + process.execSync("node", ["1.js"], { + stdin: undefined + }); + } + { + process.execSync("node", ["1.js"], { + stdout: "pipe" + }); + process.execSync("node", ["1.js"], { + stdout: "ignore" + }); + process.execSync("node", ["1.js"], { + stdout: "ipc" + }); + process.execSync("node", ["1.js"], { + stdout: "ignore" + }); + process.execSync("node", ["1.js"], { + stdout: new adone.std.stream.Stream() + }); + process.execSync("node", ["1.js"], { + stdout: 0 + }); + process.execSync("node", ["1.js"], { + stdout: null + }); + process.execSync("node", ["1.js"], { + stdout: undefined + }); + } + { + process.execSync("node", ["1.js"], { + stderr: "pipe" + }); + process.execSync("node", ["1.js"], { + stderr: "ignore" + }); + process.execSync("node", ["1.js"], { + stderr: "ipc" + }); + process.execSync("node", ["1.js"], { + stderr: "ignore" + }); + process.execSync("node", ["1.js"], { + stderr: new adone.std.stream.Stream() + }); + process.execSync("node", ["1.js"], { + stderr: 0 + }); + process.execSync("node", ["1.js"], { + stderr: null + }); + process.execSync("node", ["1.js"], { + stderr: undefined + }); + } + { + process.execSync("node", ["1.js"], { + input: "a" + }); + process.execSync("node", ["1.js"], { + input: Buffer.from("a") + }); + } + { + const x = process.execSync("node", ["1.js"]); + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + } + } + + namespace shell { + process.shellSync("node 1.js"); + process.shellSync("node 1.js", {}); + process.shellSync("node 1.js", { + cwd: "hello" + }); + process.shellSync("node 1.js", { + env: { + a: "a" + } + }); + process.shellSync("node 1.js", { + extendEnv: true + }); + process.shellSync("node 1.js", { + argv0: "a" + }); + { + process.shellSync("node 1.js", { + stdio: "pipe" + }); + process.shellSync("node 1.js", { + stdio: "ignore" + }); + process.shellSync("node 1.js", { + stdio: "inherit" + }); + process.shellSync("node 1.js", { + stdio: ["pipe"] + }); + process.shellSync("node 1.js", { + stdio: ["ipc"] + }); + process.shellSync("node 1.js", { + stdio: ["ignore"] + }); + process.shellSync("node 1.js", { + stdio: [new adone.std.stream.Stream()] + }); + process.shellSync("node 1.js", { + stdio: [0] + }); + process.shellSync("node 1.js", { + stdio: [null] + }); + process.shellSync("node 1.js", { + stdio: [undefined] + }); + } + process.shellSync("node 1.js", { + detached: true + }); + process.shellSync("node 1.js", { + uid: 1000 + }); + process.shellSync("node 1.js", { + gid: 1000 + }); + process.shellSync("node 1.js", { + shell: true + }); + process.shellSync("node 1.js", { + windowsVerbatimArguments: true + }); + process.shellSync("node 1.js", { + stripEof: true + }); + process.shellSync("node 1.js", { + preferLocal: true + }); + process.shellSync("node 1.js", { + localDir: "a" + }); + process.shellSync("node 1.js", { + reject: false + }); + process.shellSync("node 1.js", { + cleanup: true + }); + process.shellSync("node 1.js", { + encoding: "utf8" + }); + process.shellSync("node 1.js", { + timeout: 100 + }); + process.shellSync("node 1.js", { + maxBuffer: 1010101 + }); + process.shellSync("node 1.js", { + killSignal: "SIGINT" + }); + { + process.shellSync("node 1.js", { + stdin: "pipe" + }); + process.shellSync("node 1.js", { + stdin: "ignore" + }); + process.shellSync("node 1.js", { + stdin: "ipc" + }); + process.shellSync("node 1.js", { + stdin: "ignore" + }); + process.shellSync("node 1.js", { + stdin: new adone.std.stream.Stream() + }); + process.shellSync("node 1.js", { + stdin: 0 + }); + process.shellSync("node 1.js", { + stdin: null + }); + process.shellSync("node 1.js", { + stdin: undefined + }); + } + { + process.shellSync("node 1.js", { + stdout: "pipe" + }); + process.shellSync("node 1.js", { + stdout: "ignore" + }); + process.shellSync("node 1.js", { + stdout: "ipc" + }); + process.shellSync("node 1.js", { + stdout: "ignore" + }); + process.shellSync("node 1.js", { + stdout: new adone.std.stream.Stream() + }); + process.shellSync("node 1.js", { + stdout: 0 + }); + process.shellSync("node 1.js", { + stdout: null + }); + process.shellSync("node 1.js", { + stdout: undefined + }); + } + { + process.shellSync("node 1.js", { + stderr: "pipe" + }); + process.shellSync("node 1.js", { + stderr: "ignore" + }); + process.shellSync("node 1.js", { + stderr: "ipc" + }); + process.shellSync("node 1.js", { + stderr: "ignore" + }); + process.shellSync("node 1.js", { + stderr: new adone.std.stream.Stream() + }); + process.shellSync("node 1.js", { + stderr: 0 + }); + process.shellSync("node 1.js", { + stderr: null + }); + process.shellSync("node 1.js", { + stderr: undefined + }); + } + { + process.shellSync("node 1.js", { + input: "a" + }); + process.shellSync("node 1.js", { + input: Buffer.from("a") + }); + } + { + const x = process.shellSync("node 1.js"); + str = x.cmd; + num = x.code; + bool = x.killed; + if (!adone.is.null(x.signal)) { + str = x.signal; + } + str = x.stderr; + str = x.stdout; + bool = x.timedOut; + } + } +} diff --git a/types/adone/test/glosses/system/user.ts b/types/adone/test/glosses/system/user.ts new file mode 100644 index 0000000000..3e1b643d7d --- /dev/null +++ b/types/adone/test/glosses/system/user.ts @@ -0,0 +1,22 @@ +namespace adoneTests.system.process.user { + const { + system: { + user + } + } = adone; + + let str: string; + let num: number; + + const a = user.uid("hello"); + num = a.uid; + num = a.gid; + + num = user.gid("hello"); + + num = user.gids("hello")[0]; + + str = user.username(1000); + + str = user.groupname(1000); +} diff --git a/types/adone/test/glosses/templating/dot.ts b/types/adone/test/glosses/templating/dot.ts new file mode 100644 index 0000000000..69cd15d500 --- /dev/null +++ b/types/adone/test/glosses/templating/dot.ts @@ -0,0 +1,70 @@ +namespace adoneTests.templating.dot { + const { + templating: { + dot + } + } = adone; + + let str: string; + let bool; + let regexp: RegExp; + + str = dot.version; + + bool = dot.templateSettings.append; + regexp = dot.templateSettings.conditional; + regexp = dot.templateSettings.define; + regexp = dot.templateSettings.defineParams; + regexp = dot.templateSettings.encode; + regexp = dot.templateSettings.evaluate; + regexp = dot.templateSettings.interpolate; + regexp = dot.templateSettings.iterate; + bool = dot.templateSettings.selfcontained; + bool = dot.templateSettings.strip; + regexp = dot.templateSettings.use; + regexp = dot.templateSettings.useParams; + str = dot.templateSettings.varname; + + const r = dot.template("asd", { + append: true, + define: /a/, + encode: /a/, + evaluate: /a/, + conditional: /a/, + defineParams: /a/, + interpolate: /a/, + iterate: /a/, + selfcontained: true, + strip: false, + use: /a/, + useParams: /a/, + varname: "a" + }); + str = r("a"); + + str = dot.compile("asd")(); + str = dot.compile("asd", {})(); + + const a = dot.process(); + str = a["hello"](); + + dot.process({ + destination: "a" + }); + dot.process({ + global: "a" + }); + dot.process({ + path: "a" + }); + dot.process({ + templateSettings: { + append: true + } + }); + dot.process({ + templateSettings: { + useParams: /a/ + } + }); +} diff --git a/types/adone/test/glosses/templating/nunjucks.ts b/types/adone/test/glosses/templating/nunjucks.ts new file mode 100644 index 0000000000..85bd2e49e5 --- /dev/null +++ b/types/adone/test/glosses/templating/nunjucks.ts @@ -0,0 +1,139 @@ +namespace adoneTests.templating.nunjucks { + const { + templating: { + nunjucks + } + } = adone; + + let str: string; + let bool: boolean; + let pstr: Promise; + + namespace Environment { + const { + Environment + } = nunjucks; + + new Environment(); + new Environment(new nunjucks.FileSystemLoader()); + new Environment(new nunjucks.FileSystemLoader(), { autoescape: true }); + new Environment(new nunjucks.FileSystemLoader(), { dev: true }); + new Environment(new nunjucks.FileSystemLoader(), { lstripBlocks: true }); + new Environment(new nunjucks.FileSystemLoader(), { throOnUndefined: true }); + new Environment(new nunjucks.FileSystemLoader(), { trimBlocks: true }); + + const e = new Environment(); + str = e.render("a"); + e.render("a", {}, (e, r: string) => {}); + str = e.renderString("a"); + str = e.renderString("a", {}); + e.renderString("a", {}, (e, r: string) => {}); + + e.addFilter("name", () => 2); + e.addFilter("name", () => 2, true); + e.getFilter("name")(); + + e.addExtension("name", { parse() { return "a"; }, tags: ["a"] }); + e.removeExtension("name"); + e.getExtension("name").parse({}, {}, {}); + str = e.getExtension("name").tags[0]; + bool = e.hasExtension("name"); + e.addGlobal("a", "b"); + str = e.getTemplate("name", true).render(); + str = e.getTemplate("name").render(); + } + + namespace Template { + const { + Template + } = nunjucks; + + new Template("asd"); + new Template("asd", new nunjucks.Environment()); + new Template("asd", new nunjucks.Environment(), true); + str = new Template("asd").render(); + new Template("asd").render({}, (e: any, res: string) => {}); + } + + namespace Loader { + const { + Loader + } = nunjucks; + + new Loader(); + new Loader().on("asd", () => {}); + new Loader().emit("asd", 1, 2, 3); + str = new Loader().resolve("asd", "asd"); + bool = new Loader().isRelative("asd"); + new Loader().extend({ + async: true, + getSource(name: string) { + return { src: "a", path: "b", noCache: true }; + }, + extend(extender) { + extender.async; + extender.extend; + extender.getSource("a"); + return extender; + } + }); + } + + namespace FileSystemLoader { + const { + FileSystemLoader + } = nunjucks; + + new FileSystemLoader(); + new FileSystemLoader(["a"]); + new FileSystemLoader(["a"], { noCache: true }); + new FileSystemLoader(["a"], { watch: true }); + bool = new FileSystemLoader(["a"], { watch: true }).getSource("name").noCache; + str = new FileSystemLoader(["a"], { watch: true }).getSource("name").path; + str = new FileSystemLoader(["a"], { watch: true }).getSource("name").src; + } + + namespace PrecompiledLoader { + const { + PrecompiledLoader + } = nunjucks; + + new PrecompiledLoader(); + bool = new PrecompiledLoader().getSource("name").noCache; + str = new PrecompiledLoader().getSource("name").path; + str = new PrecompiledLoader().getSource("name").src; + } + + pstr = nunjucks.render("he"); + pstr = nunjucks.render("he", {}); + + str = nunjucks.renderSync("he"); + str = nunjucks.renderSync("he", {}); + + pstr = nunjucks.renderString("he"); + pstr = nunjucks.renderString("he", {}); + + str = nunjucks.renderStringSync("he"); + str = nunjucks.renderStringSync("he", {}); + + let t = nunjucks.compile("he"); + t = nunjucks.compile("he", new nunjucks.Environment()); + t = nunjucks.compile("he", new nunjucks.Environment(), "asd"); + t = nunjucks.compile("he", new nunjucks.Environment(), "asd", true); + str = t.render(); + + let e = nunjucks.configure(); + e = nunjucks.configure({}); + e = nunjucks.configure({ autoescape: true }); + e = nunjucks.configure({ dev: true }); + e = nunjucks.configure({ lstripBlocks: true }); + e = nunjucks.configure({ noCache: true }); + e = nunjucks.configure({ tags: { blockEnd: "{" } }); + e = nunjucks.configure({ throOnUndefined: true }); + e = nunjucks.configure({ trimBlocks: true }); + e = nunjucks.configure({ watch: true }); + e = nunjucks.configure("a", { watch: true }); + e.addFilter("name", () => true); + + nunjucks.installJinjaCompat(); +} diff --git a/types/adone/test/glosses/text/index.ts b/types/adone/test/glosses/text/index.ts new file mode 100644 index 0000000000..7f5fc88692 --- /dev/null +++ b/types/adone/test/glosses/text/index.ts @@ -0,0 +1,58 @@ +namespace adoneTests.text { + const { + text + } = adone; + + let str: string; + let regExp: RegExp; + let bool: boolean; + let num: number; + + namespace escape { + const { + escape + } = text; + + str = escape.regExpPattern("asd"); + str = escape.regExpReplacement("asd"); + str = escape.format("asd"); + str = escape.shellArg("asd"); + str = escape.control("sad"); + str = escape.htmlSpecialChars("asd"); + } + + namespace regexp { + const { + regexp + } = text; + + str = regexp.array2alternatives(["a"]); + } + + str = text.escapeStringRegexp("asd"); + str = text.toCamelCase("asd"); + str = text.camelCaseToDashed("asd"); + regExp = text.endLineRegExp; + str = text.splitLines("a")[0]; + str = text.regExpIndexOf("a", /ads/); + str = text.regExpIndexOf("a", /ads/, 1); + str = text.stripAnsi("ad"); + bool = text.hasAnsi("asd"); + str = text.random(100); + str = text.detectNewLine("asd"); + str = text.wordwrap("ads", 10)[0]; + str = text.wordwrap("ads", 10, { join: true }); + str = text.wordwrap("ads", 10, { countAnsiEscapeCodes: true }); + str = text.wordwrap("ads", 10, { mode: "hard" }); + num = text.stringDistance("as", "ds"); + num = text.stringDistance("as", "ds", [[1]]); + num = text.stringDistanceCapped("a", "b", 10); + str = text.capitalize("asd"); + str = text.capitalizeWords("asd"); + num = text.width("asd"); + str = text.indent("asd", 10); + str = text.stripEof("asd"); + str = text.stripLastCRLF("asd"); + str = text.stripBOM("ads"); + num = text.toUTF8Array("asd")[0]; +} diff --git a/types/adone/test/glosses/text/pretties.ts b/types/adone/test/glosses/text/pretties.ts new file mode 100644 index 0000000000..3061275cdd --- /dev/null +++ b/types/adone/test/glosses/text/pretties.ts @@ -0,0 +1,203 @@ +namespace adoneTests.text.pretty { + const { + text: { + pretty + } + } = adone; + + let str: string; + + namespace json { + const { + json + } = pretty; + + str = json({}); + str = json({}, {}); + str = json({}, {}, 1); + str = json({}, { dashColor: "green" }); + str = json({}, { defaultIndentation: 10 }); + str = json({}, { emptyArrayMsg: "asdas" }); + str = json({}, { keysColor: "green" }); + str = json({}, { noAlign: true }); + str = json({}, { noColor: true }); + str = json({}, { numberColor: "green" }); + str = json({}, { stringColor: "green" }); + } + + namespace table { + const { + table + } = pretty; + + str = table([], { + model: [] + }); + str = table([], { + borderless: true, + model: [] + }); + str = table([], { + countAnsiEscapeCodes: true, + model: [] + }); + str = table([], { + noHeader: true, + model: [] + }); + str = table([], { + style: { + "padding-left": 1 + }, + model: [] + }); + str = table([], { + style: { + "padding-right": 1 + }, + model: [] + }); + str = table([], { + style: { + broder: ["a"] + }, + model: [] + }); + str = table([], { + style: { + compact: true + }, + model: [] + }); + str = table([], { + style: { + head: ["a"] + }, + model: [] + }); + str = table([], { + width: 100, + model: [] + }); + str = table([], { + width: "100%", + model: [] + }); + str = table([], { + model: [{ + id: "ads", + align: "center" + }] + }); + str = table([], { + model: [{ + id: "ads", + format: "%s" + }] + }); + str = table([], { + model: [{ + id: "ads", + format(val: any, item: object) { + return "2"; + } + }] + }); + str = table([], { + model: [{ + id: "ads", + handle(item: object) { + return "a"; + } + }] + }); + str = table([], { + model: [{ + id: "ads", + header: "he" + }] + }); + str = table([], { + model: [{ + id: "ads", + maxWidth: "100%" + }] + }); + str = table([], { + model: [{ + id: "ads", + maxWidth: 100 + }] + }); + str = table([], { + model: [{ + id: "ads", + style: "asd" + }] + }); + str = table([], { + model: [{ + id: "ads", + style(val: any, str: string) { + return "1"; + } + }] + }); + str = table([], { + model: [{ + id: "ads", + width: 100 + }] + }); + str = table([], { + model: [{ + id: "ads", + width: "100%" + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: "soft" + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: "hard" + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + countAnsiEscapeCodes: true + } + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + join: true + } + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + mode: "soft" + } + }] + }); + str = table([], { + model: [{ + id: "ads", + wordwrap: { + mode: "hard" + } + }] + }); + } +} diff --git a/types/adone/test/glosses/text/spinners.ts b/types/adone/test/glosses/text/spinners.ts new file mode 100644 index 0000000000..abd3627151 --- /dev/null +++ b/types/adone/test/glosses/text/spinners.ts @@ -0,0 +1,41 @@ +namespace adoneTests.text.spinners { + const { + text: { + spinner + } + } = adone; + + let sp: { + interval: number; + frames: string[] + }; + + sp = spinner.dots; + sp = spinner.dots2; + sp = spinner.dots3; + sp = spinner.dots4; + sp = spinner.dots5; + sp = spinner.dots6; + sp = spinner.dots7; + sp = spinner.dots8; + sp = spinner.dots9; + sp = spinner.dots10; + sp = spinner.dots11; + sp = spinner.dots12; + sp = spinner.line; + sp = spinner.pipe; + sp = spinner.simpleDots; + sp = spinner.flip; + sp = spinner.growVertical; + sp = spinner.growHorizontal; + sp = spinner.boxBounce; + sp = spinner.boxBounce2; + sp = spinner.triangle; + sp = spinner.squareCorners; + sp = spinner.circleQuarters; + sp = spinner.circleHalves; + sp = spinner.arrow; + sp = spinner.arrow3; + sp = spinner.bouncingBar; + sp = spinner.clock; +} diff --git a/types/adone/test/glosses/text/table.ts b/types/adone/test/glosses/text/table.ts new file mode 100644 index 0000000000..7670f6b1de --- /dev/null +++ b/types/adone/test/glosses/text/table.ts @@ -0,0 +1,65 @@ +namespace adoneTests.text.table { + const { + text: { + table + } + } = adone; + + let num: number; + let str: string; + + namespace Table { + const { + Table + } = table; + + new Table(); + new Table({ chars: {} }); + new Table({ chars: { "bottom-left": "a" } }); + new Table({ chars: { "bottom-mid": "a" } }); + new Table({ chars: { "bottom-right": "a" } }); + new Table({ chars: { "left-mid": "a" } }); + new Table({ chars: { "mid-mid": "a" } }); + new Table({ chars: { "right-mid": "a" } }); + new Table({ chars: { "top-left": "a" } }); + new Table({ chars: { "top-mid": "a" } }); + new Table({ chars: { "top-right": "a" } }); + new Table({ chars: { bottom: "a" } }); + new Table({ chars: { left: "a" } }); + new Table({ chars: { mid: "a" } }); + new Table({ chars: { middle: "a" } }); + new Table({ chars: { right: "a" } }); + new Table({ chars: { top: "a" } }); + new Table({ colAligns: ["left"] }); + new Table({ rowAligns: ["top"] }); + new Table({ head: ["a"] }); + new Table({ rowHeights: [10] }); + new Table({ style: { "padding-left": 1 } }); + new Table({ style: { "padding-right": 1 } }); + new Table({ style: { border: ["a"] } }); + new Table({ style: { compact: true } }); + new Table({ style: { head: ["a"] } }); + new Table({ truncate: "a" }); + new Table({ colWidths: [10] }); + + num = new Table().width; + str = new Table().toString(); + + const def = Table.defaultOptions; + str = def.chars["bottom-mid"]; + num = def.style["padding-right"]; + } + + namespace BorderlessTable { + const { + BorderlessTable + } = table; + + new BorderlessTable(); + new BorderlessTable({}); + new BorderlessTable({ colAligns: ["center"] }); + new BorderlessTable({ colWidths: [10] }); + new BorderlessTable({ head: ["a"] }); + new BorderlessTable({ style: { "padding-right": 1 } }); + } +} diff --git a/types/adone/test/glosses/text/unicode.ts b/types/adone/test/glosses/text/unicode.ts new file mode 100644 index 0000000000..9b331afa60 --- /dev/null +++ b/types/adone/test/glosses/text/unicode.ts @@ -0,0 +1,135 @@ +namespace adoneTests.text.unicode { + const { + text: { + unicode + } + } = adone; + + let str: string; + let num: number; + let bool: boolean; + + str = unicode.symbol.tick; + str = unicode.symbol.cross; + str = unicode.symbol.star; + str = unicode.symbol.square; + str = unicode.symbol.squareSmall; + str = unicode.symbol.squareSmallFilled; + str = unicode.symbol.play; + str = unicode.symbol.circle; + str = unicode.symbol.circleFilled; + str = unicode.symbol.circleDotted; + str = unicode.symbol.circleDouble; + str = unicode.symbol.circleCircle; + str = unicode.symbol.circleCross; + str = unicode.symbol.circlePipe; + str = unicode.symbol.circleQuestionMark; + str = unicode.symbol.bullet; + str = unicode.symbol.dot; + str = unicode.symbol.line; + str = unicode.symbol.ellipsis; + str = unicode.symbol.pointer; + str = unicode.symbol.pointerSmall; + str = unicode.symbol.info; + str = unicode.symbol.warning; + str = unicode.symbol.hamburger; + str = unicode.symbol.smiley; + str = unicode.symbol.mustache; + str = unicode.symbol.heart; + str = unicode.symbol.arrowUp; + str = unicode.symbol.arrowDown; + str = unicode.symbol.arrowLeft; + str = unicode.symbol.arrowRight; + str = unicode.symbol.radioOn; + str = unicode.symbol.radioOff; + str = unicode.symbol.checkboxOn; + str = unicode.symbol.checkboxOff; + str = unicode.symbol.checkboxCircleOn; + str = unicode.symbol.checkboxCircleOff; + str = unicode.symbol.questionMarkPrefix; + str = unicode.symbol.oneHalf; + str = unicode.symbol.oneThird; + str = unicode.symbol.oneQuarter; + str = unicode.symbol.oneFifth; + str = unicode.symbol.oneSixth; + str = unicode.symbol.oneSeventh; + str = unicode.symbol.oneEighth; + str = unicode.symbol.oneNinth; + str = unicode.symbol.oneTenth; + str = unicode.symbol.twoThirds; + str = unicode.symbol.twoFifths; + str = unicode.symbol.threeQuarters; + str = unicode.symbol.threeFifths; + str = unicode.symbol.threeEighths; + str = unicode.symbol.fourFifths; + str = unicode.symbol.fiveSixths; + str = unicode.symbol.fiveEighths; + str = unicode.symbol.sevenEighths; + str = unicode.symbol.minus; + + str = unicode.symbolFallback.tick; + str = unicode.symbolFallback.cross; + str = unicode.symbolFallback.star; + str = unicode.symbolFallback.square; + str = unicode.symbolFallback.squareSmall; + str = unicode.symbolFallback.squareSmallFilled; + str = unicode.symbolFallback.play; + str = unicode.symbolFallback.circle; + str = unicode.symbolFallback.circleFilled; + str = unicode.symbolFallback.circleDotted; + str = unicode.symbolFallback.circleDouble; + str = unicode.symbolFallback.circleCircle; + str = unicode.symbolFallback.circleCross; + str = unicode.symbolFallback.circlePipe; + str = unicode.symbolFallback.circleQuestionMark; + str = unicode.symbolFallback.bullet; + str = unicode.symbolFallback.dot; + str = unicode.symbolFallback.line; + str = unicode.symbolFallback.ellipsis; + str = unicode.symbolFallback.pointer; + str = unicode.symbolFallback.pointerSmall; + str = unicode.symbolFallback.info; + str = unicode.symbolFallback.warning; + str = unicode.symbolFallback.hamburger; + str = unicode.symbolFallback.smiley; + str = unicode.symbolFallback.mustache; + str = unicode.symbolFallback.heart; + str = unicode.symbolFallback.arrowUp; + str = unicode.symbolFallback.arrowDown; + str = unicode.symbolFallback.arrowLeft; + str = unicode.symbolFallback.arrowRight; + str = unicode.symbolFallback.radioOn; + str = unicode.symbolFallback.radioOff; + str = unicode.symbolFallback.checkboxOn; + str = unicode.symbolFallback.checkboxOff; + str = unicode.symbolFallback.checkboxCircleOn; + str = unicode.symbolFallback.checkboxCircleOff; + str = unicode.symbolFallback.questionMarkPrefix; + str = unicode.symbolFallback.oneHalf; + str = unicode.symbolFallback.oneThird; + str = unicode.symbolFallback.oneQuarter; + str = unicode.symbolFallback.oneFifth; + str = unicode.symbolFallback.oneSixth; + str = unicode.symbolFallback.oneSeventh; + str = unicode.symbolFallback.oneEighth; + str = unicode.symbolFallback.oneNinth; + str = unicode.symbolFallback.oneTenth; + str = unicode.symbolFallback.twoThirds; + str = unicode.symbolFallback.twoFifths; + str = unicode.symbolFallback.threeQuarters; + str = unicode.symbolFallback.threeFifths; + str = unicode.symbolFallback.threeEighths; + str = unicode.symbolFallback.fourFifths; + str = unicode.symbolFallback.fiveSixths; + str = unicode.symbolFallback.fiveEighths; + str = unicode.symbolFallback.sevenEighths; + str = unicode.symbolFallback.minus; + + str = unicode.approx("asd"); + num = unicode.length("ad"); + str = unicode.toArray("asd")[0]; + num = unicode.surrogatePair("a"); + bool = unicode.isFullWidthCodePoint(100); + bool = unicode.isFullWidth("a"); + str = unicode.toFullWidth("asd"); +} diff --git a/types/adone/test/glosses/utils.ts b/types/adone/test/glosses/utils.ts index 1ffabbd59b..656e000f8b 100644 --- a/types/adone/test/glosses/utils.ts +++ b/types/adone/test/glosses/utils.ts @@ -494,6 +494,33 @@ namespace utilTests { const k = util.throttle.create(() => { }, { dropLast: true }); const l: symbol = util.throttle.DROPPED; + + { + const t = util.throttle.create(); + t(() => 2).then((x: number) => {}); + t(() => Promise.resolve(2)).then((x: number) => {}); + + t(() => "2").then((x: string) => {}); + t(() => Promise.resolve("2")).then((x: string) => {}); + + t((a) => a, 2).then((x: number) => {}); + t((a) => Promise.resolve(a), 2).then((x: number) => {}); + + t((a, b) => String(a) + b, 2, "3").then((x: string) => {}); + t(async (a, b) => String(a) + b, 2, "3").then((x: string) => x); + + t((a, b, c) => String(a) + b + c, 2, "3", "4").then((x: string) => {}); + t(async (a, b, c) => String(a) + b + c, 2, "3", "4").then((x: string) => x); + + t((a, b, c, d) => String(a) + b + c + String(d), 2, "3", "4", 5).then((x: string) => {}); + t(async (a, b, c, d) => String(a) + b + c + String(d), 2, "3", "4", 5).then((x: string) => x); + + t((a, b, c, d, e) => String(a) + b + c + String(d) + e.join(","), 2, "3", "4", 5, [1, 2, 3]).then((x: string) => {}); + t(async (a, b, c, d, e) => String(a) + b + c + String(d) + e.join(","), 2, "3", "4", 5, [1, 2, 3]).then((x: string) => x); + + t((a, b, c, d, e, f) => String(a) + b + c + String(d) + e.join(",") + f, 2, "3", "4", 5, [1, 2, 3], 6).then((x: any) => {}); + t(async (a, b, c, d, e, f) => String(a) + b + c + String(d) + e.join(",") + f, 2, "3", "4", 5, [1, 2, 3], 6).then((x: any) => x); + } } namespace fakeClock { @@ -1354,4 +1381,22 @@ namespace utilTests { match.resizeCache(10050); { const a: object = match.getCache(); } } + + namespace iconv { + const { + iconv + } = util; + + let str: string; + let buf: Buffer; + let bool: boolean; + + str = iconv.decode(Buffer.from("hello"), "CP1251"); + str = iconv.decode(Buffer.from("hello"), "CP1251", {}); + + buf = iconv.encode("привет", "CP1251"); + buf = iconv.encode("привет", "CP1251", {}); + + bool = iconv.encodingExists("cp1251"); + } } diff --git a/types/adone/tsconfig.json b/types/adone/tsconfig.json index 8d1f4040d6..66671bc175 100644 --- a/types/adone/tsconfig.json +++ b/types/adone/tsconfig.json @@ -19,53 +19,129 @@ "experimentalDecorators": true }, "files": [ - "index.d.ts", + "adone-tests.ts", "adone.d.ts", + "glosses/archives.d.ts", + "glosses/assertion.d.ts", + "glosses/collections/array_set.d.ts", + "glosses/collections/async_queue.d.ts", + "glosses/collections/avl_tree.d.ts", + "glosses/collections/binary_search_tree.d.ts", + "glosses/collections/buffer_list.d.ts", + "glosses/collections/byte_array.d.ts", + "glosses/collections/default_map.d.ts", + "glosses/collections/fast_lru.d.ts", + "glosses/collections/index.d.ts", + "glosses/collections/linked_list.d.ts", + "glosses/collections/lru.d.ts", + "glosses/collections/map_cache.d.ts", + "glosses/collections/ns_cache.d.ts", + "glosses/collections/priority_queue.d.ts", + "glosses/collections/queue.d.ts", + "glosses/collections/rb_tree.d.ts", + "glosses/collections/refcounted_cache.d.ts", + "glosses/collections/set.d.ts", + "glosses/collections/stack.d.ts", + "glosses/collections/timedout_map.d.ts", + "glosses/compressors.d.ts", + "glosses/crypto/asn1.d.ts", + "glosses/crypto/ed25519.d.ts", + "glosses/crypto/index.d.ts", + "glosses/crypto/secp256k1.d.ts", + "glosses/data.d.ts", + "glosses/datetime.d.ts", + "glosses/events.d.ts", + "glosses/exceptions.d.ts", + "glosses/fake.d.ts", + "glosses/fast.d.ts", + "glosses/fs.d.ts", + "glosses/is.d.ts", "glosses/math/index.d.ts", "glosses/math/matrix.d.ts", "glosses/math/simd.d.ts", "glosses/meta.d.ts", - "glosses/std.d.ts", - "glosses/utils.d.ts", - "glosses/assertion.d.ts", + "glosses/net/http/client.d.ts", + "glosses/net/http/index.d.ts", + "glosses/net/index.d.ts", "glosses/promise.d.ts", - "glosses/shani.d.ts", + "glosses/regex.d.ts", + "glosses/semver.d.ts", "glosses/shani-global.d.ts", - "glosses/collections.d.ts", - "glosses/events.d.ts", - "glosses/fs.d.ts", - "glosses/is.d.ts", - "glosses/exceptions.d.ts", + "glosses/shani.d.ts", + "glosses/std.d.ts", "glosses/streams.d.ts", - "glosses/fast.d.ts", - "glosses/data.d.ts", - "glosses/datetime.d.ts", - "glosses/compressors.d.ts", - "glosses/archives.d.ts", - "adone-tests.ts", - "test/index.ts", - "test/index-import.ts", + "glosses/system/env.d.ts", + "glosses/system/index.d.ts", + "glosses/system/process.d.ts", + "glosses/system/user.d.ts", + "glosses/templating/dot.d.ts", + "glosses/templating/index.d.ts", + "glosses/templating/nunjucks.d.ts", + "glosses/text/index.d.ts", + "glosses/text/pretties.d.ts", + "glosses/text/spinners.d.ts", + "glosses/text/table.d.ts", + "glosses/text/unicode.d.ts", + "glosses/utils.d.ts", + "index.d.ts", "test/glosses/application.ts", + "test/glosses/archives.ts", + "test/glosses/assertion.ts", + "test/glosses/collections/array_set.ts", + "test/glosses/collections/async_queue.ts", + "test/glosses/collections/avl_tree.ts", + "test/glosses/collections/binary_search_tree.ts", + "test/glosses/collections/buffer_list.ts", + "test/glosses/collections/byte_array.ts", + "test/glosses/collections/default_map.ts", + "test/glosses/collections/fast_lru.ts", + "test/glosses/collections/linked_list.ts", + "test/glosses/collections/lru.ts", + "test/glosses/collections/map_cache.ts", + "test/glosses/collections/ns_cache.ts", + "test/glosses/collections/priority_queue.ts", + "test/glosses/collections/queue.ts", + "test/glosses/collections/rb_tree.ts", + "test/glosses/collections/refcounted_cache.ts", + "test/glosses/collections/set.ts", + "test/glosses/collections/stack.ts", + "test/glosses/collections/timedout_map.ts", + "test/glosses/compressors.ts", + "test/glosses/crypto/asn1.ts", + "test/glosses/crypto/ed25519.ts", + "test/glosses/crypto/secp256k1.ts", + "test/glosses/data.ts", + "test/glosses/datetime.ts", + "test/glosses/events.ts", + "test/glosses/exceptions.ts", + "test/glosses/fake.ts", + "test/glosses/fast.ts", + "test/glosses/fs.ts", + "test/glosses/is.ts", "test/glosses/math/index.ts", "test/glosses/math/matrix.ts", "test/glosses/math/simd.ts", "test/glosses/meta.ts", - "test/glosses/std.ts", - "test/glosses/utils.ts", - "test/glosses/assertion.ts", + "test/glosses/net/http/client.ts", "test/glosses/promise.ts", - "test/glosses/shani.ts", + "test/glosses/regex.ts", + "test/glosses/semver.ts", "test/glosses/shani-global.ts", - "test/glosses/collections.ts", - "test/glosses/events.ts", - "test/glosses/fs.ts", - "test/glosses/is.ts", - "test/glosses/exceptions.ts", + "test/glosses/shani.ts", + "test/glosses/std.ts", "test/glosses/streams.ts", - "test/glosses/fast.ts", - "test/glosses/data.ts", - "test/glosses/datetime.ts", - "test/glosses/compressors.ts", - "test/glosses/archives.ts" + "test/glosses/system/env.ts", + "test/glosses/system/process.ts", + "test/glosses/system/user.ts", + "test/glosses/templating/dot.ts", + "test/glosses/templating/nunjucks.ts", + "test/glosses/text/index.ts", + "test/glosses/text/pretties.ts", + "test/glosses/text/spinners.ts", + "test/glosses/text/table.ts", + "test/glosses/text/unicode.ts", + "test/glosses/utils.ts", + "test/index-import.ts", + "test/index.ts" ] } \ No newline at end of file diff --git a/types/agenda/agenda-tests.ts b/types/agenda/agenda-tests.ts index 964eb1b836..5cd18baf76 100644 --- a/types/agenda/agenda-tests.ts +++ b/types/agenda/agenda-tests.ts @@ -1,4 +1,4 @@ -import * as Agenda from "agenda"; +import Agenda = require("agenda"); var mongoConnectionString = "mongodb://127.0.0.1/agenda"; diff --git a/types/alexa-sdk/tsconfig.json b/types/alexa-sdk/tsconfig.json index d1932fa469..acc11c8263 100644 --- a/types/alexa-sdk/tsconfig.json +++ b/types/alexa-sdk/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "alexa-sdk-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/algoliasearch/tsconfig.json b/types/algoliasearch/tsconfig.json index 4d7e52dd8b..3358732ba3 100644 --- a/types/algoliasearch/tsconfig.json +++ b/types/algoliasearch/tsconfig.json @@ -1,16 +1,23 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": ["index.d.ts", "algoliasearch-tests.ts"] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "algoliasearch-tests.ts" + ] +} \ No newline at end of file diff --git a/types/alt/index.d.ts b/types/alt/index.d.ts index 2d4c6e259f..0c69e4020a 100644 --- a/types/alt/index.d.ts +++ b/types/alt/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/goatslacker/alt // Definitions by: Michael Shearer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/analytics-node/analytics-node-tests.ts b/types/analytics-node/analytics-node-tests.ts index 5207fe560b..5dfabb426c 100644 --- a/types/analytics-node/analytics-node-tests.ts +++ b/types/analytics-node/analytics-node-tests.ts @@ -18,6 +18,22 @@ function testIdentify(): void { friends: 42 } }); + + analytics.identify({ + userId: '019mr8mf4r', + traits: { + name: 'Michael Bolton', + email: 'mbolton@initech.com', + plan: 'Enterprise', + friends: 42 + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testTrack(): void { @@ -29,6 +45,21 @@ function testTrack(): void { shippingMethod: '2-day' } }); + + analytics.track({ + userId: '019mr8mf4r', + event: 'Purchased an Item', + properties: { + revenue: 39.95, + shippingMethod: '2-day' + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testPage(): void { @@ -43,6 +74,24 @@ function testPage(): void { referrer: 'https://github.com/segmentio/analytics-node' } }); + + analytics.page({ + userId: '019mr8mf4r', + category: 'Docs', + name: 'Node.js Library', + properties: { + url: 'https://segment.com/docs/libraries/node', + path: '/docs/libraries/node/', + title: 'Node.js Library - Segment', + referrer: 'https://github.com/segmentio/analytics-node' + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testAlias(): void { @@ -65,6 +114,21 @@ function testGroup(): void { description: 'Accounting Software' } }); + + analytics.group({ + userId: '019mr8mf4r', + groupId: '56', + traits: { + name: 'Initech', + description: 'Accounting Software' + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testIntegrations(): void { @@ -77,11 +141,27 @@ function testIntegrations(): void { 'Google Analytics': false } }); + + analytics.track({ + event: 'Upgraded Membershipt', + userId: '97234974', + integrations: { + 'All': false, + 'Vero': true, + 'Google Analytics': false + } + }, (err, data) => { + if (err) { + console.error(err); + } else { + data.batch.forEach((message) => console.log(`${data.sentAt} : ${message}`)) + } + }); } function testFlush(): void { analytics.flush(); - analytics.flush(function(err, batch) { + analytics.flush((err, batch) => { if (err) { alert("Oh nos!"); } else { console.log(batch.batch[0].type); } }); diff --git a/types/analytics-node/index.d.ts b/types/analytics-node/index.d.ts index fa0b8d6426..a1de134195 100644 --- a/types/analytics-node/index.d.ts +++ b/types/analytics-node/index.d.ts @@ -1,11 +1,36 @@ // Type definitions for Segment's analytics.js for Node.js // Project: https://segment.com/docs/libraries/node/ // Definitions by: Andrew Fong +// Thomas Thiebaud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = AnalyticsNode.Analytics; declare namespace AnalyticsNode { + interface Message { + type: string; + context: { + library: { + name: string; + version: string; + }, + [key: string]: any + }; + _metadata: { + nodeVersion: string; + [key: string]: any; + }, + timestamp?: Date; + messageId?: string; + anonymousId: string | number; + userId: string | number; + } + + interface Data { + batch: Message[], + timestamp: Date; + sentAt: Date; + } interface Integrations { [index: string]: boolean; @@ -25,7 +50,7 @@ declare namespace AnalyticsNode { timestamp?: Date; context?: Object; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* The track method lets you record the actions your users perform. */ track(message: { @@ -35,7 +60,7 @@ declare namespace AnalyticsNode { timestamp?: Date; context?: Object; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* The page method lets you record page views on your website, along with optional extra information about the page being viewed. */ @@ -47,14 +72,14 @@ declare namespace AnalyticsNode { timestamp?: Date; context?: Object; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* alias is how you associate one identity with another. */ alias(message: { previousId: string | number; userId: string | number; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* Group calls can be used to associate individual users with shared accounts or companies. */ @@ -66,16 +91,9 @@ declare namespace AnalyticsNode { timestamp?: Date; anonymous_id?: string | number; integrations?: Integrations; - }): Analytics; + }, callback?: (err: Error, data: Data) => void): Analytics; /* Flush batched calls to make sure nothing is left in the queue */ - flush(fn?: (err: Error, batch: { - batch: Array<{ - type: string; - }>; - messageId: string; - sentAt: Date; - timestamp: Date; - }) => void): Analytics; + flush(callback?: (err: Error, data: Data) => void): Analytics; } } diff --git a/types/angular-hotkeys/tsconfig.json b/types/angular-hotkeys/tsconfig.json index acb11ff247..81fdf31b45 100644 --- a/types/angular-hotkeys/tsconfig.json +++ b/types/angular-hotkeys/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "angular-hotkeys-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/angular-material/angular-material-tests.ts b/types/angular-material/angular-material-tests.ts index 8d6955c697..ad79cff2db 100644 --- a/types/angular-material/angular-material-tests.ts +++ b/types/angular-material/angular-material-tests.ts @@ -164,8 +164,7 @@ myApp.controller('DialogController', ($scope: TestScope, $mdDialog: ng.material. .controller(function TestController(param) { }) .controller(class { }) .controller(['fakeService', function TestController(fake) { }]) - .controller(['fakeService', class { }]) - ; + .controller(['fakeService', class { }]); const dialogOptions: ng.material.IDialogOptions = {}; @@ -389,3 +388,11 @@ myApp.controller('PanelController', ($scope: TestScope, $mdPanel: ng.material.IP $mdPanel.newPanelAnimation().openFrom({ top: 0, left: 0 }); }; }); + +myApp.controller('StickyController', ($scope: TestScope, $mdSticky: ng.material.IStickyService) => { + const stickyElement = angular.element(new Element()); + const cloneStickyElement = stickyElement.clone(); + + $mdSticky($scope, stickyElement); + $mdSticky($scope, stickyElement, cloneStickyElement); +}); diff --git a/types/angular-material/index.d.ts b/types/angular-material/index.d.ts index 92f6d46751..d77f5ae7ce 100644 --- a/types/angular-material/index.d.ts +++ b/types/angular-material/index.d.ts @@ -494,5 +494,7 @@ declare module 'angular' { interface IProgressCircularProvider { configure(options: IProgressCircularConfig): void; } + + type IStickyService = (scope: IScope, element: JQuery, elementClone?: JQuery) => void; } } diff --git a/types/angular-websocket/tsconfig.json b/types/angular-websocket/tsconfig.json index 89d5cb9dc3..e4d648dbda 100644 --- a/types/angular-websocket/tsconfig.json +++ b/types/angular-websocket/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "angular-websocket-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/angular/angular-tests.ts b/types/angular/angular-tests.ts index 0b05400f6d..ca9d2c7568 100644 --- a/types/angular/angular-tests.ts +++ b/types/angular/angular-tests.ts @@ -710,6 +710,24 @@ function test_angular_forEach() { this.push(`${key}: ${value}`); }, log); // expect(log).toEqual(['name: misko', 'gender: male']); + // $ExpectType NodeListOf + angular.forEach(document.getElementsByTagName('img'), (value, key, obj) => { + value; // $ExpectType HTMLImageElement + key; // $ExpectType number + obj; // $ExpectType NodeListOf + }); + // $ExpectType number[] + angular.forEach([1, 2, 3], (value, key, obj) => { + value; // $ExpectType number + key; // $ExpectType number + obj; // $ExpectType number[] + }); + // $ExpectType string + angular.forEach('123', (value, key, obj) => { + value; // $ExpectType string + key; // $ExpectType number + obj; // $ExpectType string + }); } // angular.element() tests diff --git a/types/angular/index.d.ts b/types/angular/index.d.ts index 32a5c74b52..4c896eb430 100644 --- a/types/angular/index.d.ts +++ b/types/angular/index.d.ts @@ -100,7 +100,11 @@ declare namespace angular { * @param iterator Iterator function. * @param context Object to become context (this) for the iterator function. */ - forEach(obj: T[], iterator: (value: T, key: number, obj: T[]) => void, context?: any): T[]; + forEach = T[]>( + obj: U, + iterator: (value: U[number], key: number, obj: U) => void, + context?: any + ): U; /** * Invokes the iterator function once for each item in obj collection, which can be either an object or an array. The iterator function is invoked with iterator(value, key), where value is the value of an object property or an array element and key is the object property key or array element index. Specifying a context for the function is optional. * diff --git a/types/angular/tsconfig.json b/types/angular/tsconfig.json index 5ce810f938..46eeb69c7a 100644 --- a/types/angular/tsconfig.json +++ b/types/angular/tsconfig.json @@ -25,4 +25,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/types/ansi-colors/tsconfig.json b/types/ansi-colors/tsconfig.json index 8a0f980cbc..ebd56021f9 100644 --- a/types/ansi-colors/tsconfig.json +++ b/types/ansi-colors/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "ansi-colors-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/ansi-regex/tsconfig.json b/types/ansi-regex/tsconfig.json index cf1ac84a5c..4d0c1ff787 100644 --- a/types/ansi-regex/tsconfig.json +++ b/types/ansi-regex/tsconfig.json @@ -7,7 +7,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, - "strictFunctionTypes": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -20,4 +20,4 @@ "index.d.ts", "ansi-regex-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/apex.js/apex.js-tests.ts b/types/apex.js/apex.js-tests.ts index 0595ef43ea..f5d96e2c54 100644 --- a/types/apex.js/apex.js-tests.ts +++ b/types/apex.js/apex.js-tests.ts @@ -1,4 +1,4 @@ -import * as λ from "apex.js"; +import λ = require("apex.js"); const handler = λ((event, context) => { console.log("Event: " + JSON.stringify(event)); diff --git a/types/apex.js/index.d.ts b/types/apex.js/index.d.ts index 0998ce794c..20e05d2a5e 100644 --- a/types/apex.js/index.d.ts +++ b/types/apex.js/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/apex/node-apex // Definitions by: Yoriki Yamaguchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 /// diff --git a/types/aphrodite/index.d.ts b/types/aphrodite/index.d.ts index 0e04b07af7..00d1908d9f 100644 --- a/types/aphrodite/index.d.ts +++ b/types/aphrodite/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Khan/aphrodite // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/api-error-handler/api-error-handler-tests.ts b/types/api-error-handler/api-error-handler-tests.ts index 67afbb0fce..aa72342d75 100644 --- a/types/api-error-handler/api-error-handler-tests.ts +++ b/types/api-error-handler/api-error-handler-tests.ts @@ -1,4 +1,4 @@ -import * as errorHandler from 'api-error-handler'; +import errorHandler = require('api-error-handler'); import * as express from 'express'; var api = express.Router(); diff --git a/types/appdmg/tsconfig.json b/types/appdmg/tsconfig.json index f4ca0f95c5..452b9a4af3 100644 --- a/types/appdmg/tsconfig.json +++ b/types/appdmg/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "appdmg-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/archiver/archiver-tests.ts b/types/archiver/archiver-tests.ts index fc2e481330..752d9cc944 100644 --- a/types/archiver/archiver-tests.ts +++ b/types/archiver/archiver-tests.ts @@ -1,4 +1,4 @@ -import * as Archiver from 'archiver'; +import Archiver = require('archiver'); import * as fs from 'fs'; const options: Archiver.ArchiverOptions = { diff --git a/types/argon2-browser/tsconfig.json b/types/argon2-browser/tsconfig.json index a380778b29..c3e9586f3c 100644 --- a/types/argon2-browser/tsconfig.json +++ b/types/argon2-browser/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "argon2-browser-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/arr-union/tsconfig.json b/types/arr-union/tsconfig.json index 64a3b1efed..de2c9671e9 100644 --- a/types/arr-union/tsconfig.json +++ b/types/arr-union/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "arr-union-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/artillery/tsconfig.json b/types/artillery/tsconfig.json index 0ad4bae0ee..02b327a508 100644 --- a/types/artillery/tsconfig.json +++ b/types/artillery/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "artillery-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/assert-equal-jsx/index.d.ts b/types/assert-equal-jsx/index.d.ts index f571020ef8..e017fcf57c 100644 --- a/types/assert-equal-jsx/index.d.ts +++ b/types/assert-equal-jsx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/thejameskyle/assert-equal-jsx // Definitions by: Josh Toft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts b/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts index 6851f853f2..b02c707d81 100644 --- a/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts +++ b/types/assets-webpack-plugin/assets-webpack-plugin-tests.ts @@ -1,5 +1,5 @@ import * as webpack from 'webpack'; -import * as AssetsPlugin from 'assets-webpack-plugin'; +import AssetsPlugin = require('assets-webpack-plugin'); const config: webpack.Configuration = { plugins: [ diff --git a/types/async-retry/tsconfig.json b/types/async-retry/tsconfig.json index 8bdf98656d..c010746fa3 100644 --- a/types/async-retry/tsconfig.json +++ b/types/async-retry/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "async-retry-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/asynciterator/tsconfig.json b/types/asynciterator/tsconfig.json index 8b8b919abc..c50f09f902 100644 --- a/types/asynciterator/tsconfig.json +++ b/types/asynciterator/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "asynciterator-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/atom-keymap/tsconfig.json b/types/atom-keymap/tsconfig.json index 8a17cc061c..14797a013b 100644 --- a/types/atom-keymap/tsconfig.json +++ b/types/atom-keymap/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "atom-keymap-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/atom-mocha-test-runner/tsconfig.json b/types/atom-mocha-test-runner/tsconfig.json index c6e9fb20c0..40639f83aa 100644 --- a/types/atom-mocha-test-runner/tsconfig.json +++ b/types/atom-mocha-test-runner/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "atom-mocha-test-runner-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/atom/atom-tests.ts b/types/atom/atom-tests.ts index fbd5f6d0d8..e53e29b176 100644 --- a/types/atom/atom-tests.ts +++ b/types/atom/atom-tests.ts @@ -2897,7 +2897,6 @@ function testTextEditor() { // Grammars grammar = editor.getGrammar(); - editor.setGrammar(grammar); // Managing Syntax Scopes scopeDescriptor = editor.getRootScopeDescriptor(); diff --git a/types/atom/index.d.ts b/types/atom/index.d.ts index f83f751657..9b0d194976 100644 --- a/types/atom/index.d.ts +++ b/types/atom/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Atom 1.23 +// Type definitions for Atom 1.24 // Project: https://github.com/atom/atom // Definitions by: GlenCFL // smhxx @@ -7,7 +7,7 @@ // TypeScript Version: 2.3 // NOTE: only those classes exported within this file should be retain that status below. -// https://github.com/atom/atom/blob/v1.23.0/exports/atom.js +// https://github.com/atom/atom/blob/v1.24.0/exports/atom.js /// /// @@ -1312,6 +1312,12 @@ export class TextEditor { /** Retrieves the current TextBuffer. */ getBuffer(): TextBuffer; + /** Sets the read-only state for the editor. */ + setReadOnly(readonly: boolean): void; + + /** Whether or not this editor is in read-only mode. */ + isReadOnly(): boolean; + /** * Calls your callback when a Gutter is added to the editor. Immediately calls * your callback for each existing gutter. @@ -1911,7 +1917,7 @@ export class TextEditor { getCursors(): Cursor[]; /** - * Get all Cursorss, ordered by their position in the buffer instead of the + * Get all Cursors, ordered by their position in the buffer instead of the * order in which they were added. */ getCursorsOrderedByBufferPosition(): Cursor[]; @@ -2260,12 +2266,6 @@ export class TextEditor { /** Get the current Grammar of this editor. */ getGrammar(): Grammar; - /** - * Set the current Grammar of this editor. - * Assigning a grammar will cause the editor to re-tokenize based on the new grammar. - */ - setGrammar(grammar: Grammar): void; - // Managing Syntax Scopes /** * Returns a ScopeDescriptor that includes this editor's language. @@ -3341,7 +3341,7 @@ export class Directory { getEntriesSync(): Array; /** Reads file entries in this directory from disk asynchronously. */ - getEntries(callback: (error: Error, entries: Array) => void): void; + getEntries(callback: (error: Error|null, entries: Array) => void): void; /** * Determines if the given path (real or symbolic) is inside this directory. This @@ -3847,6 +3847,51 @@ export interface GrammarRegistry { * @return An array of Token instances decoded from the given tags. */ decodeTokens(lineText: string, tags: Array): GrammarToken[]; + + /** + * Set a TextBuffer's language mode based on its path and content, and continue + * to update its language mode as grammars are added or updated, or the buffer's + * file path changes. + * @param buffer The buffer whose language mode will be maintained. + * @return A Disposable that can be used to stop updating the buffer's + * language mode. + */ + maintainLanguageMode(buffer: TextBuffer): Disposable; + + /** + * Force a TextBuffer to use a different grammar than the one that would otherwise + * be selected for it. + * @param buffer The buffer whose grammar will be set. + * @param languageId The identifier of the desired language. + * @return Returns a boolean that indicates whether the language was successfully + * found. + */ + assignLanguageMode(buffer: TextBuffer, languageId: string): boolean; + + /** + * Remove any language mode override that has been set for the given TextBuffer. + * This will assign to the buffer the best language mode available. + */ + autoAssignLanguageMode(buffer: TextBuffer): void; + + /** + * Select a grammar for the given file path and file contents. + * + * This picks the best match by checking the file path and contents against + * each grammar. + * @param filePath A string file path. + * @param fileContents A string of text for that file path. + */ + selectGrammar(filePath: string, fileContents: string): Grammar; + + /** + * Returns a number representing how well the grammar matches the + * `filePath` and `contents`. + * @param grammar The grammar to score. + * @param filePath A string file path. + * @param contents A string of text for that file path. + */ + getGrammarScore(grammar: Grammar, filePath: string, contents: string): number; } /** Represents a gutter within a TextEditor. */ @@ -4366,7 +4411,7 @@ export interface PathWatcher extends DisposableLike { /** * Unsubscribe all subscribers from filesystem events. Native resources will be - * release asynchronously, but this watcher will stop broadcasting events + * released asynchronously, but this watcher will stop broadcasting events * immediately. */ dispose(): void; @@ -4391,7 +4436,11 @@ export interface Project { onDidChangeFiles(callback: (events: FilesystemChangeEvent) => void): Disposable; // Accessing the Git Repository - /** Get an Array of GitRepositorys associated with the project's directories. */ + /** + * Get an Array of GitRepositorys associated with the project's directories. + * + * This method will be removed in 2.0 because it does synchronous I/O. + */ getRepositories(): GitRepository[]; /** Get the repository for a given directory asynchronously. */ @@ -5075,7 +5124,7 @@ export class TextBuffer { /** * Get a MarkerLayer by id. - * Returns a MarkerLayer or `` if no layer exists with the given id. + * Returns a MarkerLayer or undefined if no layer exists with the given id. */ getMarkerLayer(id: string): MarkerLayer|undefined; @@ -5313,7 +5362,7 @@ export interface ThemeManager { /** Returns an Array of all the loaded themes. */ getLoadedThemes(): Package[]|undefined; - // Accessing Active Themes + // Managing Enabled Themes /** Returns an Array of strings all the active theme names. */ getActiveThemeNames(): string[]|undefined; @@ -5695,7 +5744,7 @@ export interface TextEditorObservedEvent { // information under certain contexts. // NOTE: the config schema with these defaults can be found here: -// https://github.com/atom/atom/blob/v1.23.0/src/config-schema.js +// https://github.com/atom/atom/blob/v1.24.0/src/config-schema.js /** * Allows you to strongly type Atom configuration variables. Additional key:value * pairings merged into this interface will result in configuration values under diff --git a/types/atom/tsconfig.json b/types/atom/tsconfig.json index a58ec7b74c..35ece9c1dd 100644 --- a/types/atom/tsconfig.json +++ b/types/atom/tsconfig.json @@ -24,4 +24,4 @@ "linter/index.d.ts", "status-bar/index.d.ts" ] -} +} \ No newline at end of file diff --git a/types/auto-sni/auto-sni-tests.ts b/types/auto-sni/auto-sni-tests.ts index 6be54148fb..8cd17af850 100644 --- a/types/auto-sni/auto-sni-tests.ts +++ b/types/auto-sni/auto-sni-tests.ts @@ -1,4 +1,4 @@ -import * as autosni from "auto-sni"; +import autosni = require("auto-sni"); const a = autosni({ agreeTos: true, email: '', diff --git a/types/autosuggest-highlight/autosuggest-highlight-tests.ts b/types/autosuggest-highlight/autosuggest-highlight-tests.ts new file mode 100644 index 0000000000..50283a24bd --- /dev/null +++ b/types/autosuggest-highlight/autosuggest-highlight-tests.ts @@ -0,0 +1,11 @@ +import match = require('autosuggest-highlight/match'); +import parse = require('autosuggest-highlight/parse'); + +function matchTest() { + let matches = match('some text', 'te'); // $ExpectType number[] | number[][] + matches = match('some sweet text', 's s'); // $ExpectType number[] | number[][] +} + +function parseTest() { + const parts = parse('Pretty cool text', [[7, 9], [12, 13]]); // $ExpectType { text: string; highlight: boolean; }[] +} diff --git a/types/autosuggest-highlight/index.d.ts b/types/autosuggest-highlight/index.d.ts new file mode 100644 index 0000000000..e05c30d608 --- /dev/null +++ b/types/autosuggest-highlight/index.d.ts @@ -0,0 +1,5 @@ +// Type definitions for autosuggest-highlight 3.1 +// Project: https://github.com/moroshko/autosuggest-highlight#readme +// Definitions by: Artur Sianiuk +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 diff --git a/types/autosuggest-highlight/match/index.d.ts b/types/autosuggest-highlight/match/index.d.ts new file mode 100644 index 0000000000..19d18c48b3 --- /dev/null +++ b/types/autosuggest-highlight/match/index.d.ts @@ -0,0 +1,3 @@ +declare function match(text: string, query: string): number[] | number[][]; + +export = match; diff --git a/types/autosuggest-highlight/parse/index.d.ts b/types/autosuggest-highlight/parse/index.d.ts new file mode 100644 index 0000000000..01038cd116 --- /dev/null +++ b/types/autosuggest-highlight/parse/index.d.ts @@ -0,0 +1,3 @@ +declare function parse(text: string, matches: number[] | number[][]): Array<{ text: string; highlight: boolean; }>; + +export = parse; diff --git a/types/autosuggest-highlight/tsconfig.json b/types/autosuggest-highlight/tsconfig.json new file mode 100644 index 0000000000..8201d360ec --- /dev/null +++ b/types/autosuggest-highlight/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "autosuggest-highlight-tests.ts", + "match/index.d.ts", + "parse/index.d.ts" + ] +} diff --git a/types/autosuggest-highlight/tslint.json b/types/autosuggest-highlight/tslint.json new file mode 100644 index 0000000000..946997cb87 --- /dev/null +++ b/types/autosuggest-highlight/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-useless-files": false + } +} diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index 6d0d83b210..bd29160912 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -1,28 +1,34 @@ -let str: string; -let date: Date; -let anyObj: any; -let num: number; -let error: Error; -let b: boolean; -let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; -let apiGwEvt: AWSLambda.APIGatewayEvent; -let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; -let clientCtx: AWSLambda.ClientContext; -let clientContextEnv: AWSLambda.ClientContextEnv; -let clientContextClient: AWSLambda.ClientContextClient; -let context: AWSLambda.Context; -let identity: AWSLambda.CognitoIdentity; -let proxyResult: AWSLambda.ProxyResult; -let authResponse: AWSLambda.AuthResponse; -let policyDocument: AWSLambda.PolicyDocument; -let statement: AWSLambda.Statement; -let authResponseContext: AWSLambda.AuthResponseContext; -let snsEvt: AWSLambda.SNSEvent; -let snsEvtRecs: AWSLambda.SNSEventRecord[]; -let snsEvtRec: AWSLambda.SNSEventRecord; -let snsMsg: AWSLambda.SNSMessage; -let snsMsgAttr: AWSLambda.SNSMessageAttribute; -let snsMsgAttrs: AWSLambda.SNSMessageAttributes; +declare let str: string; +declare let strOrNull: string | null; +declare let strOrUndefined: string | undefined; +declare let date: Date; +declare let anyObj: any; +declare let num: number; +declare let error: Error; +declare let bool: boolean; +declare let boolOrUndefined: boolean | undefined; +declare let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; +declare let apiGwEvt: AWSLambda.APIGatewayEvent; +declare let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; +declare let clientCtx: AWSLambda.ClientContext; +declare let clientCtxOrUndefined: AWSLambda.ClientContext | undefined; +declare let clientContextEnv: AWSLambda.ClientContextEnv; +declare let clientContextClient: AWSLambda.ClientContextClient; +declare let context: AWSLambda.Context; +declare let identity: AWSLambda.CognitoIdentity; +declare let identityOrUndefined: AWSLambda.CognitoIdentity | undefined; +declare let proxyResult: AWSLambda.ProxyResult; +declare let authResponse: AWSLambda.AuthResponse; +declare let policyDocument: AWSLambda.PolicyDocument; +declare let statement: AWSLambda.Statement; +declare let authResponseContext: AWSLambda.AuthResponseContext; +declare let authResponseContextOpt: AWSLambda.AuthResponseContext | null | undefined; +declare let snsEvt: AWSLambda.SNSEvent; +declare let snsEvtRecs: AWSLambda.SNSEventRecord[]; +declare let snsEvtRec: AWSLambda.SNSEventRecord; +declare let snsMsg: AWSLambda.SNSMessage; +declare let snsMsgAttr: AWSLambda.SNSMessageAttribute; +declare let snsMsgAttrs: AWSLambda.SNSMessageAttributes; const S3EvtRec: AWSLambda.S3EventRecord = { eventVersion: '2.0', eventSource: 'aws:s3', @@ -72,44 +78,44 @@ declare const scheduledEvent: AWSLambda.ScheduledEvent; /* API Gateway Event request context */ str = apiGwEvtReqCtx.accountId; str = apiGwEvtReqCtx.apiId; -authResponseContext = apiGwEvtReqCtx.authorizer; +authResponseContextOpt = apiGwEvtReqCtx.authorizer; 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; +strOrNull = apiGwEvtReqCtx.identity.accessKey; +strOrNull = apiGwEvtReqCtx.identity.accountId; +strOrNull = apiGwEvtReqCtx.identity.apiKey; +strOrNull = apiGwEvtReqCtx.identity.caller; +strOrNull = apiGwEvtReqCtx.identity.cognitoAuthenticationProvider; +strOrNull = apiGwEvtReqCtx.identity.cognitoAuthenticationType; +strOrNull = apiGwEvtReqCtx.identity.cognitoIdentityId; +strOrNull = apiGwEvtReqCtx.identity.cognitoIdentityPoolId; str = apiGwEvtReqCtx.identity.sourceIp; -str = apiGwEvtReqCtx.identity.user; -str = apiGwEvtReqCtx.identity.userAgent; -str = apiGwEvtReqCtx.identity.userArn; +strOrNull = apiGwEvtReqCtx.identity.user; +strOrNull = apiGwEvtReqCtx.identity.userAgent; +strOrNull = apiGwEvtReqCtx.identity.userArn; str = apiGwEvtReqCtx.stage; str = apiGwEvtReqCtx.requestId; str = apiGwEvtReqCtx.resourceId; str = apiGwEvtReqCtx.resourcePath; /* API Gateway Event */ -str = apiGwEvt.body; +strOrNull = apiGwEvt.body; str = apiGwEvt.headers["example"]; str = apiGwEvt.httpMethod; -b = apiGwEvt.isBase64Encoded; +bool = apiGwEvt.isBase64Encoded; str = apiGwEvt.path; -str = apiGwEvt.pathParameters["example"]; -str = apiGwEvt.queryStringParameters["example"]; -str = apiGwEvt.stageVariables["example"]; +str = apiGwEvt.pathParameters!["example"]; +str = apiGwEvt.queryStringParameters!["example"]; +str = apiGwEvt.stageVariables!["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; str = apiGwEvt.resource; /* API Gateway CustomAuthorizer Event */ str = customAuthorizerEvt.type; str = customAuthorizerEvt.methodArn; -str = customAuthorizerEvt.authorizationToken; -str = apiGwEvt.pathParameters["example"]; -str = apiGwEvt.queryStringParameters["example"]; -str = apiGwEvt.stageVariables["example"]; +strOrUndefined = customAuthorizerEvt.authorizationToken; +str = apiGwEvt.pathParameters!["example"]; +str = apiGwEvt.queryStringParameters!["example"]; +str = apiGwEvt.stageVariables!["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; /* DynamoDB Stream Event */ @@ -234,17 +240,17 @@ str = snsMsgAttr.Value; /* Lambda Proxy Result */ num = proxyResult.statusCode; -proxyResult.headers["example"] = str; -proxyResult.headers["example"] = b; -proxyResult.headers["example"] = num; -b = proxyResult.isBase64Encoded; +proxyResult.headers!["example"] = str; +proxyResult.headers!["example"] = bool; +proxyResult.headers!["example"] = num; +boolOrUndefined = proxyResult.isBase64Encoded; str = proxyResult.body; /* API Gateway CustomAuthorizer AuthResponse */ authResponseContext = { stringKey: str, numberKey: num, - booleanKey: b + booleanKey: bool }; statement = { @@ -300,36 +306,36 @@ cognitoUserPoolEvent.triggerSource === "TokenGeneration_AuthenticateDevice"; cognitoUserPoolEvent.triggerSource === "TokenGeneration_RefreshTokens"; str = cognitoUserPoolEvent.region; str = cognitoUserPoolEvent.userPoolId; -str = cognitoUserPoolEvent.userName; +strOrUndefined = cognitoUserPoolEvent.userName; str = cognitoUserPoolEvent.callerContext.awsSdkVersion; str = cognitoUserPoolEvent.callerContext.clientId; str = cognitoUserPoolEvent.request.userAttributes["email"]; -str = cognitoUserPoolEvent.request.validationData["k1"]; -str = cognitoUserPoolEvent.request.codeParameter; -str = cognitoUserPoolEvent.request.usernameParameter; -b = cognitoUserPoolEvent.request.newDeviceUsed; -cognitoUserPoolEvent.request.session[0].challengeName === "CUSTOM_CHALLENGE"; -cognitoUserPoolEvent.request.session[0].challengeName === "PASSWORD_VERIFIER"; -cognitoUserPoolEvent.request.session[0].challengeName === "SMS_MFA"; -cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_SRP_AUTH"; -cognitoUserPoolEvent.request.session[0].challengeName === "DEVICE_PASSWORD_VERIFIER"; -cognitoUserPoolEvent.request.session[0].challengeName === "ADMIN_NO_SRP_AUTH"; -b = cognitoUserPoolEvent.request.session[0].challengeResult; -str = cognitoUserPoolEvent.request.session[0].challengeMetaData; -str = cognitoUserPoolEvent.request.challengeName; -str = cognitoUserPoolEvent.request.privateChallengeParameters["answer"]; -str = cognitoUserPoolEvent.request.challengeAnswer["answer"]; -b = cognitoUserPoolEvent.response.answerCorrect; -str = cognitoUserPoolEvent.response.smsMessage; -str = cognitoUserPoolEvent.response.emailMessage; -str = cognitoUserPoolEvent.response.emailSubject; -str = cognitoUserPoolEvent.response.challengeName; -b = cognitoUserPoolEvent.response.issueTokens; -b = cognitoUserPoolEvent.response.failAuthentication; -str = cognitoUserPoolEvent.response.publicChallengeParameters["captchaUrl"]; -str = cognitoUserPoolEvent.response.privateChallengeParameters["answer"]; -str = cognitoUserPoolEvent.response.challengeMetaData; -b = cognitoUserPoolEvent.response.answerCorrect; +str = cognitoUserPoolEvent.request.validationData!["k1"]; +strOrUndefined = cognitoUserPoolEvent.request.codeParameter; +strOrUndefined = cognitoUserPoolEvent.request.usernameParameter; +boolOrUndefined = cognitoUserPoolEvent.request.newDeviceUsed; +cognitoUserPoolEvent.request.session![0].challengeName === "CUSTOM_CHALLENGE"; +cognitoUserPoolEvent.request.session![0].challengeName === "PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session![0].challengeName === "SMS_MFA"; +cognitoUserPoolEvent.request.session![0].challengeName === "DEVICE_SRP_AUTH"; +cognitoUserPoolEvent.request.session![0].challengeName === "DEVICE_PASSWORD_VERIFIER"; +cognitoUserPoolEvent.request.session![0].challengeName === "ADMIN_NO_SRP_AUTH"; +bool = cognitoUserPoolEvent.request.session![0].challengeResult; +strOrUndefined = cognitoUserPoolEvent.request.session![0].challengeMetaData; +strOrUndefined = cognitoUserPoolEvent.request.challengeName; +str = cognitoUserPoolEvent.request.privateChallengeParameters!["answer"]; +str = cognitoUserPoolEvent.request.challengeAnswer!["answer"]; +boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect; +strOrUndefined = cognitoUserPoolEvent.response.smsMessage; +strOrUndefined = cognitoUserPoolEvent.response.emailMessage; +strOrUndefined = cognitoUserPoolEvent.response.emailSubject; +strOrUndefined = cognitoUserPoolEvent.response.challengeName; +boolOrUndefined = cognitoUserPoolEvent.response.issueTokens; +boolOrUndefined = cognitoUserPoolEvent.response.failAuthentication; +str = cognitoUserPoolEvent.response.publicChallengeParameters!["captchaUrl"]; +str = cognitoUserPoolEvent.response.privateChallengeParameters!["answer"]; +strOrUndefined = cognitoUserPoolEvent.response.challengeMetaData; +boolOrUndefined = cognitoUserPoolEvent.response.answerCorrect; // CloudFormation Custom Resource switch (cloudformationCustomResourceEvent.RequestType) { @@ -353,7 +359,7 @@ switch (cloudformationCustomResourceEvent.RequestType) { anyObj = cloudformationCustomResourceResponse.Data; str = cloudformationCustomResourceResponse.LogicalResourceId; str = cloudformationCustomResourceResponse.PhysicalResourceId; -str = cloudformationCustomResourceResponse.Reason; +strOrUndefined = cloudformationCustomResourceResponse.Reason; str = cloudformationCustomResourceResponse.RequestId; str = cloudformationCustomResourceResponse.StackId; str = cloudformationCustomResourceResponse.Status; @@ -368,7 +374,7 @@ str = scheduledEvent.source; str = scheduledEvent.time; /* Context */ -b = context.callbackWaitsForEmptyEventLoop; +bool = context.callbackWaitsForEmptyEventLoop; str = context.functionName; str = context.functionVersion; str = context.invokedFunctionArn; @@ -376,8 +382,8 @@ num = context.memoryLimitInMB; str = context.awsRequestId; str = context.logGroupName; str = context.logStreamName; -identity = context.identity; -clientCtx = context.clientContext; +identityOrUndefined = context.identity; +clientCtxOrUndefined = context.clientContext; /* CognitoIdentity */ str = identity.cognitoIdentityId; @@ -420,7 +426,7 @@ function callback(cb: AWSLambda.Callback) { cb(null); cb(error); cb(null, anyObj); - cb(null, b); + cb(null, bool); cb(null, str); cb(null, num); } @@ -578,8 +584,72 @@ context.fail(str); /* Handler */ let handler: AWSLambda.Handler = (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +// async methods return Promise, test assignability let asyncHandler: AWSLambda.Handler = async (event: any, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +let inferredHandler: AWSLambda.S3Handler = (event, context, cb) => { + // $ExpectType S3Event + event; + str = event.Records[0].eventName; + // $ExpectType Context + context; + str = context.functionName; + // $ExpectType Callback + cb; + cb(); + cb(null); + cb(new Error()); + // $ExpectError + cb(null, { }); +}; + +// Test using default Callback type still works. +let defaultCallbackHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; + +// Specific types +let s3Handler: AWSLambda.S3Handler = (event: AWSLambda.S3Event, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; +// Test old name +let s3CreateHandler: AWSLambda.S3Handler = (event: AWSLambda.S3CreateEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; +s3Handler = s3CreateHandler; + +let dynamoDBStreamHandler: AWSLambda.DynamoDBStreamHandler = (event: AWSLambda.DynamoDBStreamEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let snsHandler: AWSLambda.SNSHandler = (event: AWSLambda.SNSEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let cognitoUserPoolHandler: AWSLambda.CognitoUserPoolTriggerHandler = (event: AWSLambda.CognitoUserPoolEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let cloudFormationCustomResourceHandler: AWSLambda.CloudFormationCustomResourceHandler = + (event: AWSLambda.CloudFormationCustomResourceEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let cloudWatchLogsHandler: AWSLambda.CloudWatchLogsHandler = (event: AWSLambda.CloudWatchLogsEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let scheduledHandler: AWSLambda.ScheduledHandler = (event: AWSLambda.ScheduledEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; + +let apiGtwProxyHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayProxyEvent, context: AWSLambda.Context, cb: AWSLambda.APIGatewayProxyCallback) => { }; +// Test old names let proxyHandler: AWSLambda.ProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; -let asyncProxyHandler: AWSLambda.ProxyHandler = async (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.ProxyCallback) => { }; +apiGtwProxyHandler = proxyHandler; + +let cloudFrontRequestHandler: AWSLambda.CloudFrontRequestHandler = (event: AWSLambda.CloudFrontRequestEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontRequestCallback) => { }; + +let cloudFrontResponseHandler: AWSLambda.CloudFrontResponseHandler = (event: AWSLambda.CloudFrontResponseEvent, context: AWSLambda.Context, cb: AWSLambda.CloudFrontResponseCallback) => { }; + let customAuthorizerHandler: AWSLambda.CustomAuthorizerHandler = (event: AWSLambda.CustomAuthorizerEvent, context: AWSLambda.Context, cb: AWSLambda.CustomAuthorizerCallback) => { }; -let asyncCustomAuthorizerHandler: AWSLambda.CustomAuthorizerHandler = async (event: AWSLambda.CustomAuthorizerEvent, context: AWSLambda.Context, cb: AWSLambda.CustomAuthorizerCallback) => { }; + +interface CustomEvent { eventString: string; eventBool: boolean; } +interface CustomResult { resultString: string; resultBool?: boolean; } +type CustomCallback = AWSLambda.Callback; +let customHandler: AWSLambda.Handler = (event, context, cb) => { + // $ExpectType CustomEvent + event; + str = event.eventString; + bool = event.eventBool; + // $ExpectType Context + context; + // $ExpectType Callback + cb; + cb(null, { resultString: str, resultBool: bool }); + // $ExpectError + cb(null, { resultString: bool }); +}; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 09070fb13c..03910b108c 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -14,8 +14,9 @@ // Markus Tacker // Palmi Valgeirsson // Danilo Raisi +// Simon Buchan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 +// TypeScript Version: 2.3 // API Gateway "event" request context export interface APIGatewayEventRequestContext { @@ -45,7 +46,7 @@ export interface APIGatewayEventRequestContext { } // API Gateway "event" -export interface APIGatewayEvent { +export interface APIGatewayProxyEvent { body: string | null; headers: { [name: string]: string }; httpMethod: string; @@ -57,6 +58,7 @@ export interface APIGatewayEvent { requestContext: APIGatewayEventRequestContext; resource: string; } +export type APIGatewayEvent = APIGatewayProxyEvent; // Old name // API Gateway CustomAuthorizer "event" export interface CustomAuthorizerEvent { @@ -191,15 +193,16 @@ export interface S3EventRecord { }; } -export interface S3CreateEvent { +export interface S3Event { Records: S3EventRecord[]; } +export type S3CreateEvent = S3Event; // old name /** * Cognito User Pool event * http://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools-working-with-aws-lambda-triggers.html */ -export interface CognitoUserPoolEvent { +export interface CognitoUserPoolTriggerEvent { version: number; triggerSource: | "PreSignUp_SignUp" @@ -259,6 +262,7 @@ export interface CognitoUserPoolEvent { answerCorrect?: boolean; }; } +export type CognitoUserPoolEvent = CognitoUserPoolTriggerEvent; /** * CloudFormation Custom Resource event and response @@ -414,7 +418,7 @@ export interface ClientContextEnv { locale: string; } -export interface ProxyResult { +export interface APIGatewayProxyResult { statusCode: number; headers?: { [header: string]: boolean | number | string; @@ -422,16 +426,18 @@ export interface ProxyResult { body: string; isBase64Encoded?: boolean; } +export type ProxyResult = APIGatewayProxyResult; // Old name /** * API Gateway CustomAuthorizer AuthResponse. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output */ -export interface AuthResponse { +export interface CustomAuthorizerResult { principalId: string; policyDocument: PolicyDocument; context?: AuthResponseContext; } +export type AuthResponse = CustomAuthorizerResult; /** * API Gateway CustomAuthorizer AuthResponse.PolicyDocument. @@ -492,6 +498,15 @@ export interface CloudFrontEvent { }; } +// https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/lambda-generating-http-responses.html#lambda-generating-http-responses-object +export interface CloudFrontResultResponse { + status: string; + statusDescription?: string; + headers?: CloudFrontHeaders; + bodyEncoding?: 'text' | 'base64'; + body?: string; +} + export interface CloudFrontResponseEvent { Records: Array<{ cf: CloudFrontEvent & { @@ -501,6 +516,8 @@ export interface CloudFrontResponseEvent { }>; } +export type CloudFrontRequestResult = undefined | null | CloudFrontResultResponse; + export interface CloudFrontRequestEvent { Records: Array<{ cf: CloudFrontEvent & { @@ -509,6 +526,8 @@ export interface CloudFrontRequestEvent { }>; } +export type CloudFrontResponseResult = undefined | null | CloudFrontResultResponse; + /** * AWS Lambda handler function. * http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-handler.html @@ -517,9 +536,7 @@ export interface CloudFrontRequestEvent { * @param context – runtime information of the Lambda function that is executing. * @param callback – optional callback to return information to the caller, otherwise return value is null. */ -export type Handler = (event: any, context: Context, callback?: Callback) => Promise | void; -export type ProxyHandler = (event: APIGatewayEvent, context: Context, callback?: ProxyCallback) => Promise | void; -export type CustomAuthorizerHandler = (event: CustomAuthorizerEvent, context: Context, callback?: CustomAuthorizerCallback) => Promise | void; +export type Handler = (event: TEvent, context: Context, callback: Callback) => void; /** * Optional callback parameter. @@ -528,8 +545,58 @@ export type CustomAuthorizerHandler = (event: CustomAuthorizerEvent, context: Co * @param error – an optional parameter that you can use to provide results of the failed Lambda function execution. * @param result – an optional parameter that you can use to provide the result of a successful function execution. The result provided must be JSON.stringify compatible. */ -export type Callback = (error?: Error | null, result?: object | boolean | number | string) => void; -export type ProxyCallback = (error?: Error | null, result?: ProxyResult) => void; -export type CustomAuthorizerCallback = (error?: Error | null, result?: AuthResponse) => void; +export type Callback = (error?: Error | null, result?: TResult) => void; + +// Begin defining Handler and Callback types for each API trigger type. +// Ordered by https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html +// though that list is incomplete. + +export type S3Handler = Handler; + +export type DynamoDBStreamHandler = Handler; + +export type SNSHandler = Handler; + +// No SESHandler: SES event source is delivered as SNS notifications +// https://docs.aws.amazon.com/lambda/latest/dg/invoking-lambda-function.html#supported-event-source-ses + +// Result type is weird: docs and samples say to return the mutated event, but it only requires an object +// with a "response" field, the type of which is specific to the event.triggerType. Leave as any for now. +export type CognitoUserPoolTriggerHandler = Handler; +// TODO: Different event/handler types for each event trigger so we can type the result? + +// TODO: CognitoSync + +export type CloudFormationCustomResourceHandler = Handler; + +// TODO: CloudWatchEvents + +export type CloudWatchLogsHandler = Handler; + +// TODO: CodeCommit + +export type ScheduledHandler = Handler; + +// TODO: AWS Config + +// TODO: Alexa + +export type APIGatewayProxyHandler = Handler; +export type APIGatewayProxyCallback = Callback; +export type ProxyHandler = APIGatewayProxyHandler; // Old name +export type ProxyCallback = APIGatewayProxyCallback; // Old name + +// TODO: IoT + +export type CloudFrontRequestHandler = Handler; +export type CloudFrontRequestCallback = Callback; + +export type CloudFrontResponseHandler = Handler; +export type CloudFrontResponseCallback = Callback; + +// TODO: Kinesis (should be very close to DynamoDB stream?) + +export type CustomAuthorizerHandler = Handler; +export type CustomAuthorizerCallback = Callback; export as namespace AWSLambda; diff --git a/types/aws-lambda/tsconfig.json b/types/aws-lambda/tsconfig.json index f4f2cc28f6..79e058b7ab 100644 --- a/types/aws-lambda/tsconfig.json +++ b/types/aws-lambda/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/aws-serverless-express/aws-serverless-express-tests.ts b/types/aws-serverless-express/aws-serverless-express-tests.ts index 4770163b3b..9bfd1b0e99 100644 --- a/types/aws-serverless-express/aws-serverless-express-tests.ts +++ b/types/aws-serverless-express/aws-serverless-express-tests.ts @@ -1,5 +1,5 @@ import * as awsServerlessExpress from 'aws-serverless-express'; -import * as express from 'express'; +import express = require('express'); import { eventContext } from 'aws-serverless-express/middleware'; const app = express(); diff --git a/types/azure-sb/tsconfig.json b/types/azure-sb/tsconfig.json index 09c9a2a9e4..6e015480dc 100644 --- a/types/azure-sb/tsconfig.json +++ b/types/azure-sb/tsconfig.json @@ -38,5 +38,4 @@ "azure-sb-tests.ts", "index.d.ts" ] -} - +} \ No newline at end of file diff --git a/types/babel-webpack-plugin/tsconfig.json b/types/babel-webpack-plugin/tsconfig.json index 3e73343283..b7aadac43d 100644 --- a/types/babel-webpack-plugin/tsconfig.json +++ b/types/babel-webpack-plugin/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "babel-webpack-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bash-glob/tsconfig.json b/types/bash-glob/tsconfig.json index 6a45a2d74d..d62dc6e114 100644 --- a/types/bash-glob/tsconfig.json +++ b/types/bash-glob/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bash-glob-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/beats/tsconfig.json b/types/beats/tsconfig.json index 89bd0b5995..7b360083c1 100644 --- a/types/beats/tsconfig.json +++ b/types/beats/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "beats-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bech32/tsconfig.json b/types/bech32/tsconfig.json index 886ec79796..501b2438b2 100644 --- a/types/bech32/tsconfig.json +++ b/types/bech32/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bech32-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/better-sqlite3/better-sqlite3-tests.ts b/types/better-sqlite3/better-sqlite3-tests.ts index 43d78e1503..34ee6808c3 100644 --- a/types/better-sqlite3/better-sqlite3-tests.ts +++ b/types/better-sqlite3/better-sqlite3-tests.ts @@ -1,4 +1,4 @@ -import * as Database from 'better-sqlite3'; +import Database = require('better-sqlite3'); const integer = Database.Integer(1); const err = new Database.SqliteError('ok', 'ok'); diff --git a/types/better-sqlite3/index.d.ts b/types/better-sqlite3/index.d.ts index 530f5c3e53..899a85a2e2 100644 --- a/types/better-sqlite3/index.d.ts +++ b/types/better-sqlite3/index.d.ts @@ -4,9 +4,7 @@ // Mathew Rumsey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -/// - -import * as Integer from 'integer'; +import Integer = require('integer'); interface RunResult { changes: number; diff --git a/types/binary-parser/tsconfig.json b/types/binary-parser/tsconfig.json index cb361f52c5..5e720245df 100644 --- a/types/binary-parser/tsconfig.json +++ b/types/binary-parser/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "binary-parser-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bindings/tsconfig.json b/types/bindings/tsconfig.json index fb9350642a..787b28c3d0 100644 --- a/types/bindings/tsconfig.json +++ b/types/bindings/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bindings-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bip38/tsconfig.json b/types/bip38/tsconfig.json index 6ce875b1d1..74baba8f90 100644 --- a/types/bip38/tsconfig.json +++ b/types/bip38/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bip38-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bip39/tsconfig.json b/types/bip39/tsconfig.json index d44c1197ad..bb95bb90d0 100644 --- a/types/bip39/tsconfig.json +++ b/types/bip39/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "bip39-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bitcore-lib/bitcore-lib-tests.ts b/types/bitcore-lib/bitcore-lib-tests.ts new file mode 100644 index 0000000000..fb39c85fc1 --- /dev/null +++ b/types/bitcore-lib/bitcore-lib-tests.ts @@ -0,0 +1,27 @@ +import * as bitcore from 'bitcore-lib'; + +const transaction = new bitcore.Transaction({}); + +const output: bitcore.Output = transaction.outputs[0]; + +const privateKey: bitcore.PrivateKey = new bitcore.PrivateKey('privateKey'); +const publicKey: bitcore.PublicKey = privateKey.publicKey; +const publicKeyAsString: string = publicKey.toString(); + +const signature = bitcore.crypto.ECDSA.sign(Buffer.from('sign this message', 'hex'), new bitcore.PrivateKey('privateKey')); + +bitcore.crypto.ECDSA.verify( + Buffer.from('buffer', 'hex'), + bitcore.crypto.Signature.fromString('signature'), + new bitcore.PublicKey('publicKey') +); + +const utxo: bitcore.Transaction.UnspentOutput[] = [new bitcore.Transaction.UnspentOutput({})]; + +new bitcore.Block(Buffer.from('123', 'hex')); + +const tx = new bitcore.Transaction() + .from(utxo) + .change('bitcoinAddress') + .addData(Buffer.from('')) + .sign('bitcoinAddressPrivateKey'); diff --git a/types/bitcore-lib/index.d.ts b/types/bitcore-lib/index.d.ts new file mode 100644 index 0000000000..0846b85c0d --- /dev/null +++ b/types/bitcore-lib/index.d.ts @@ -0,0 +1,130 @@ +// Type definitions for bitcore-lib 0.15 +// Project: https://github.com/bitpay/bitcore-lib +// Definitions by: Lautaro Dragan +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.2 + +/// + +export namespace crypto { + class BN { } + namespace ECDSA { + function sign(message: Buffer, key: PrivateKey): Signature; + function verify(hashbuf: Buffer, sig: Signature, pubkey: PublicKey, endian?: 'little'): boolean; + } + namespace Hash { + function sha256(buffer: Buffer): Uint8Array; + } + namespace Random { + function getRandomBuffer(size: number): Buffer; + } + namespace Point {} + class Signature { + static fromDER(sig: Buffer): Signature; + static fromString(data: string): Signature; + SIGHASH_ALL: number; + toString(): string; + } +} + +export class Transaction { + inputs: Input[]; + outputs: Output[]; + readonly id: string; + readonly hash: string; + nid: string; + + constructor(serialized?: any); + + from(utxos: Transaction.UnspentOutput[]): Transaction; + to(address: Address | string, amount: number): Transaction; + change(address: Address | string): Transaction; + sign(privateKey: PrivateKey | string): Transaction; + applySignature(sig: crypto.Signature): Transaction; + addData(data: Buffer): this; + serialize(): string; +} + +export namespace Transaction { + class UnspentOutput { + static fromObject(o: object): UnspentOutput; + + readonly address: Address; + readonly txId: string; + readonly outputIndex: number; + readonly script: Script; + readonly satoshis: number; + + constructor(data: object); + + inspect(): string; + toObject(): this; + toString(): string; + } +} + +export class Block { + hash: string; + height: number; + transactions: Transaction[]; + header: { + time: number; + prevHash: string; + }; + + constructor(data: Buffer | object); +} + +export class PrivateKey { + readonly publicKey: PublicKey; + + constructor(key: string); +} + +export class PublicKey { + constructor(source: string); + + static fromPrivateKey(privateKey: PrivateKey): PublicKey; + + toBuffer(): Buffer; + toDER(): Buffer; +} + +export interface Output { + readonly script: any; +} + +export namespace Script { + const types: { + DATA_OUT: string; + }; + function buildPublicKeyHashOut(address: Address): Script; +} + +export class Script { } + +export interface Util { + readonly buffer: { + reverse(a: any): any; + }; +} + +export namespace Networks { + interface Network { + readonly name: string; + readonly alias: string; + } + + const livenet: Network; + const mainnet: Network; + const testnet: Network; + + function add(data: any): Network; + function remove(network: Network): void; + function get(args: string | number | Network, keys: string | string[]): Network; +} + +export class Address {} + +export class Input {} diff --git a/types/bitcore-lib/tsconfig.json b/types/bitcore-lib/tsconfig.json new file mode 100644 index 0000000000..30334d3846 --- /dev/null +++ b/types/bitcore-lib/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "target": "es6", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "bitcore-lib-tests.ts" + ] +} \ No newline at end of file diff --git a/types/bitcore-lib/tslint.json b/types/bitcore-lib/tslint.json new file mode 100644 index 0000000000..dae7fb7540 --- /dev/null +++ b/types/bitcore-lib/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": "dtslint/dt.json", + "rules": {} +} \ No newline at end of file diff --git a/types/bittorrent-protocol/bittorrent-protocol-tests.ts b/types/bittorrent-protocol/bittorrent-protocol-tests.ts index c32b2af368..2faca76a5e 100644 --- a/types/bittorrent-protocol/bittorrent-protocol-tests.ts +++ b/types/bittorrent-protocol/bittorrent-protocol-tests.ts @@ -1,4 +1,4 @@ -import * as Protocol from 'bittorrent-protocol'; +import Protocol = require('bittorrent-protocol'); import * as net from 'net'; class TestExtension implements Protocol.Extension { diff --git a/types/blob-to-buffer/tsconfig.json b/types/blob-to-buffer/tsconfig.json index 2421ce2493..37848b0516 100644 --- a/types/blob-to-buffer/tsconfig.json +++ b/types/blob-to-buffer/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "blob-to-buffer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/bluebird-global/index.d.ts b/types/bluebird-global/index.d.ts index c3f0fd9d43..6b22cb7114 100644 --- a/types/bluebird-global/index.d.ts +++ b/types/bluebird-global/index.d.ts @@ -31,6 +31,22 @@ * in the runtime. Do this by either importing bluebird.js via a ` header necessary for Browser Monitoring. + * + * This script must be manually injected into your templates, as high as possible + * in the header, but _after_ any X-UA-COMPATIBLE HTTP-EQUIV meta tags. + * Otherwise you may hurt IE! + * + * This method must be called _during_ a transaction, and must be called every + * time you want to generate the headers. + * + * Do *not* reuse the headers between users, or even between requests. + */ + getBrowserTimingHeader(): string; + + /** + * Instrument a particular callback to improve visibility into a transaction. + * + * Use this API call to improve instrumentation of a particular method, or to track work across asynchronous + * boundaries by calling createTracer() in both the target function and its parent asynchronous function. + * + * The name will be visible in transaction traces and as a new metric in the New Relic UI. + * + * The agent begins timing the segment when createTracer is called, and ends the segment when the callback + * defined by the callback argument finishes executing. + */ + createTracer any>(name: string, handle: T): T; + + /** + * Creates and starts a web transaction to record work done in the handle supplied. + * + * This transaction will run until the handle + * synchronously returns UNLESS: + * 1. The handle function returns a promise, where the end of the + * transaction will be tied to the end of the promise returned. + * 2. `getTransaction` is called in the handle, flagging the + * transaction as externally handled. In this case the transaction + * will be ended when `TransactionHandle#end` is called in the user's code. + * + * @example + * var newrelic = require('newrelic') + * newrelic.startWebTransaction('/some/url/path', function() { + * var transaction = newrelic.getTransaction() + * setTimeout(function() { + * // do some work + * transaction.end() + * }, 100) + * }) + * + * The `url` is used to name and group related transactions in APM, + * so it should be a generic name and not include any variable parameters. + */ + startWebTransaction(url: string, handle: (...args: any[]) => any): any; + + /** + * Creates and starts a background transaction to record work done in the handle supplied. + * + * This transaction will run until the handle + * synchronously returns UNLESS: + * 1. The handle function returns a promise, where the end of the + * transaction will be tied to the end of the promise returned. + * 2. `API#getTransaction` is called in the handle, flagging the + * transaction as externally handled. In this case the transaction + * will be ended when `TransactionHandle#end` is called in the user's code. + * + * @example + * var newrelic = require('newrelic') + * newrelic.startBackgroundTransaction('Red October', 'Subs', function() { + * var transaction = newrelic.getTransaction() + * setTimeout(function() { + * // do some work + * transaction.end() + * }, 100) + * }) + * + * The `url` is used to name and group related transactions in APM, + * so it should be a generic name and not include any variable parameters. + * + * The optional `group can be used for grouping background transactions in APM. + * For more information see: + * https://docs.newrelic.com/docs/apm/applications-menu/monitoring/transactions-page#txn-type-dropdown + */ + startBackgroundTransaction(name: string, handle: (...args: any[]) => any): any; + startBackgroundTransaction(name: string, group: string, handle: (...args: any[]) => any): any; + + /** + * End the current web or background custom transaction. + * + * This method requires being in the correct transaction context when called. + */ + endTransaction(): void; + + /** + * Record an event-based metric, usually associated with a particular duration. + * + * The `name` must be a string following standard metric naming rules. The `value` will + * usually be a number, but it can also be an object. + * * When `value` is a numeric value, it should represent the magnitude of a measurement + * associated with an event; for example, the duration for a particular method call. + * * When `value` is an object, it must contain count, total, min, max, and sumOfSquares + * keys, all with number values. This form is useful to aggregate metrics on your own + * and report them periodically; for example, from a setInterval. These values will + * be aggregated with any previously collected values for the same metric. The names + * of these keys match the names of the keys used by the platform API. + */ + recordMetric(name: string, value: number | Metric): void; + + /** + * Update a metric that acts as a simple counter. + * + * The count of the selected metric will be incremented by the specified amount, defaulting to 1. + */ + incrementMetric(name: string, value?: number): void; + + /** + * Record an event-based metric, usually associated with a particular duration. + * + * `eventType` must be an alphanumeric string less than 255 characters. + * The keys of `attributes` must be shorter than 255 characters. + */ + recordCustomEvent(eventType: string, attributes: { [keys: string]: boolean | number | string }): void; + + /** + * Registers an instrumentation function. + * + * The provided onRequire callback will be fired when the given module is loaded with require. + * The moduleName parameter should be the string that will be passed to require; + * for example, 'express' or 'amqplib/callback_api'. + * + * The optional onError callback is called if the onRequire parameters throws an error. + * This is useful for debugging your instrumentation. + * + * Use this method to: + * - Add instrumentation for modules not currently instrumented by New Relic. + * - Instrument your own code. + * - Replace the Node.js agent's built-in instrumentation with your own. + */ + instrument: Instrument; + + /** + * Sets an instrumentation callback for a datastore module. + * + * This method is just like `instrument`, except it provides a datastore-service-specialized shim. + */ + instrumentDatastore: Instrument; + + /** + * Sets an instrumentation callback for a web framework module. + * + * This method is just like `instrument`, except it provides a web-framework-specialized shim. + */ + instrumentWebframework: Instrument; + + /** + * Sets an instrumentation callback for a message service client module. + * + * This method is just like `instrument`, except it provides a message-service-specialized shim. + */ + instrumentMessages: Instrument; + + /** + * Gracefully shuts down the agent. + * + * If `collectPendingData` is true, the agent will send any pending data to the collector + * before shutting down. Defaults to `false`. + */ + shutdown(cb?: (error?: Error) => void): void; + shutdown(options?: { collectPendingData?: boolean, timeout?: number }, cb?: (error?: Error) => void): void; + } + + interface Instrument { + (opts: { moduleName: string, onRequire: () => void, onError?: (err: Error) => void }): void; + (moduleName: string, onRequire: () => void, onError?: (err: Error) => void): void; + } + + interface Metric { + count: number; + total: number; + min: number; + max: number; + sumOfSquares: number; + } + + interface TransactionHandle { + /** + * End the transaction. + */ + end(callback?: () => any): void; + + /** + * Mark the transaction to be ignored. + */ + ignore(): void; + } +} +declare const api: newrelic.NewRelicAPI; +export = api; diff --git a/types/newrelic/newrelic-tests.ts b/types/newrelic/newrelic-tests.ts new file mode 100644 index 0000000000..73cd53cc78 --- /dev/null +++ b/types/newrelic/newrelic-tests.ts @@ -0,0 +1,98 @@ +/// +import * as newrelic from "newrelic"; + +newrelic.setTransactionName("foo"); // $ExpectType void + +const trans = newrelic.getTransaction(); +trans.ignore(); // $ExpectType void +trans.end(); // $ExpectType void +trans.end(() => { }); // $ExpectType void + +newrelic.setDispatcher("foo"); // $ExpectType void +newrelic.setDispatcher("foo", "42"); // $ExpectType void + +newrelic.setControllerName("foo", "GET"); // $ExpectType void + +newrelic.addCustomAttribute("foo", "bar"); // $ExpectType void +newrelic.addCustomAttributes({ foo: "bar", baz: "bang" }); // $ExpectType void + +newrelic.setIgnoreTransaction(true); // $ExpectType void + +newrelic.noticeError(Error("Oh no!")); // $ExpectType void +newrelic.noticeError(Error("Oh no!"), { foo: "bar" }); // $ExpectType void + +newrelic.addNamingRule("/user/customers/all/.*", "/user/customers/all"); // $ExpectType void +newrelic.addNamingRule(/\/user\/customers\/.*/, "/user/customers/:customer"); // $ExpectType void + +newrelic.addIgnoringRule("^/items/[0-9]+$"); // $ExpectType void +newrelic.addIgnoringRule(/^[0-9]+$/); // $ExpectType void + +newrelic.getBrowserTimingHeader(); // $ExpectType string + +const wrappedFn = newrelic.createTracer("foo", (x: number) => { + return x * x; +}); +const wrappedResult: number = wrappedFn(42); + +newrelic.startWebTransaction('/some/url/path', () => { + const transaction = newrelic.getTransaction(); + Promise.all([]); + setTimeout(() => { + // do some work + transaction.end(); + }, 100); +}); + +newrelic.startBackgroundTransaction('Red October', (foo) => foo); // $ExpectType any +newrelic.startBackgroundTransaction('Red October', 'Subs', () => { + const transaction = newrelic.getTransaction(); + setTimeout(() => { + // do some work + transaction.end(); + }, 100); +}); + +newrelic.endTransaction(); // $ExpectType void + +newrelic.recordMetric("foo", 42); // $ExpectType void +newrelic.recordMetric("foo", { + count: 10, + total: 42, + min: 1, + max: 17, + sumOfSquares: 60, +}); + +newrelic.incrementMetric("foo"); // $ExpectType void +newrelic.incrementMetric("foo", 42); // $ExpectType void + +newrelic.recordCustomEvent("my_event", { + foo: true, + bar: 42, + baz: "don't panic", +}); + +newrelic.instrument("foo", () => { }); // $ExpectType void +newrelic.instrumentDatastore("foo", () => { }, (err: Error) => { }); +newrelic.instrumentWebframework({ + moduleName: "foo", + onRequire: () => { }, +}); +newrelic.instrumentMessages({ + moduleName: "foo", + onRequire: () => { }, + onError: (err) => { + const error: Error = err; + }, +}); + +newrelic.shutdown(); // $ExpectType void +newrelic.shutdown({ collectPendingData: true }); +newrelic.shutdown({ timeout: 3000 }); +newrelic.shutdown({ collectPendingData: true, timeout: 3000 }); +newrelic.shutdown({ collectPendingData: true, timeout: 3000 }, (err) => { + const error: Error | undefined = err; +}); +newrelic.shutdown((err) => { + const error: Error | undefined = err; +}); diff --git a/types/newrelic/tsconfig.json b/types/newrelic/tsconfig.json new file mode 100644 index 0000000000..479dde054f --- /dev/null +++ b/types/newrelic/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", + "newrelic-tests.ts" + ] +} \ No newline at end of file diff --git a/types/newrelic/tslint.json b/types/newrelic/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/newrelic/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/next-redux-wrapper/index.d.ts b/types/next-redux-wrapper/index.d.ts index a6b1da550e..38e20f608a 100644 --- a/types/next-redux-wrapper/index.d.ts +++ b/types/next-redux-wrapper/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kirill-konshin/next-redux-wrapper // Definitions by: Steve // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 /// /*~ Note that ES6 modules cannot directly export callable functions. diff --git a/types/next/index.d.ts b/types/next/index.d.ts index 70bc8ef049..036e9f58ce 100644 --- a/types/next/index.d.ts +++ b/types/next/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Drew Hays // Brice BERNARD // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/ngreact/index.d.ts b/types/ngreact/index.d.ts index cb39e45ee1..6db92506ce 100644 --- a/types/ngreact/index.d.ts +++ b/types/ngreact/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ngReact/ngReact // Definitions by: Vicky Lai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// /// diff --git a/types/nock/nock-tests.ts b/types/nock/nock-tests.ts index e81e3fd096..44397db941 100644 --- a/types/nock/nock-tests.ts +++ b/types/nock/nock-tests.ts @@ -1,6 +1,4 @@ - - -import * as nock from 'nock'; +import nock = require('nock'); import * as fs from 'fs'; var scope: nock.Scope; diff --git a/types/node-cron/tsconfig.json b/types/node-cron/tsconfig.json index e1ec63395b..9fb50ab907 100644 --- a/types/node-cron/tsconfig.json +++ b/types/node-cron/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "node-cron-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/node-geocoder/node-geocoder-tests.ts b/types/node-geocoder/node-geocoder-tests.ts index 33ed4b3036..bb554d03ba 100644 --- a/types/node-geocoder/node-geocoder-tests.ts +++ b/types/node-geocoder/node-geocoder-tests.ts @@ -1,4 +1,4 @@ -import * as NodeGeocoder from 'node-geocoder'; +import NodeGeocoder = require('node-geocoder'); const geocoder = NodeGeocoder({ provider: 'google', diff --git a/types/node-horseman/tsconfig.json b/types/node-horseman/tsconfig.json index 5490648512..8ac7d67c3e 100644 --- a/types/node-horseman/tsconfig.json +++ b/types/node-horseman/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "node-horseman-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/node-powershell/node-powershell-tests.ts b/types/node-powershell/node-powershell-tests.ts index a60f9db331..186d0bd68e 100644 --- a/types/node-powershell/node-powershell-tests.ts +++ b/types/node-powershell/node-powershell-tests.ts @@ -1,4 +1,4 @@ -import * as nodePowershell from 'node-powershell'; +import nodePowershell = require('node-powershell'); var options: nodePowershell.ShellOptions = { debugMsg: true diff --git a/types/node-rsa/node-rsa-tests.ts b/types/node-rsa/node-rsa-tests.ts index e210d5b68d..0f8defacbd 100644 --- a/types/node-rsa/node-rsa-tests.ts +++ b/types/node-rsa/node-rsa-tests.ts @@ -1,4 +1,4 @@ -import * as NodeRSA from 'node-rsa'; +import NodeRSA = require('node-rsa'); const key = new NodeRSA({ b: 512 }); diff --git a/types/node-sass-middleware/node-sass-middleware-tests.ts b/types/node-sass-middleware/node-sass-middleware-tests.ts index bfc755a424..34820155ed 100644 --- a/types/node-sass-middleware/node-sass-middleware-tests.ts +++ b/types/node-sass-middleware/node-sass-middleware-tests.ts @@ -1,6 +1,5 @@ - -import * as express from "express"; -import * as sassMiddleware from "node-sass-middleware"; +import express = require("express"); +import sassMiddleware = require("node-sass-middleware"); import * as path from "path"; var app = express(); app.use(sassMiddleware({ diff --git a/types/node-sprite-generator/node-sprite-generator-tests.ts b/types/node-sprite-generator/node-sprite-generator-tests.ts index 23309cea6d..7490d84865 100644 --- a/types/node-sprite-generator/node-sprite-generator-tests.ts +++ b/types/node-sprite-generator/node-sprite-generator-tests.ts @@ -1,5 +1,5 @@ -import * as nsg from 'node-sprite-generator'; -import * as express from 'express'; +import nsg = require('node-sprite-generator'); +import express = require('express'); const app = express(); app.use(nsg.middleware({ diff --git a/types/node-vault/node-vault-tests.ts b/types/node-vault/node-vault-tests.ts index d6d85980a1..6ce23bd4cd 100644 --- a/types/node-vault/node-vault-tests.ts +++ b/types/node-vault/node-vault-tests.ts @@ -1,4 +1,4 @@ -import * as nv from "node-vault"; +import nv = require("node-vault"); // Test code came from the sample code in README of the module. const options = { diff --git a/types/node/index.d.ts b/types/node/index.d.ts index 38f043554b..717b906b28 100644 --- a/types/node/index.d.ts +++ b/types/node/index.d.ts @@ -18,6 +18,7 @@ // Hannes Magnusson // Alberto Schiabel // Klaus Meinhardt +// Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /** inspector module types */ @@ -113,17 +114,22 @@ declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. interface NodeRequireFunction { -/* tslint:disable-next-line:callable-types */ + /* tslint:disable-next-line:callable-types */ (id: string): any; } interface NodeRequire extends NodeRequireFunction { - resolve(id: string): string; + resolve: RequireResolve; cache: any; extensions: NodeExtensions; main: NodeModule | undefined; } +interface RequireResolve { + (id: string, options?: { paths?: string[]; }): string; + paths(request: string): string[] | null; +} + interface NodeExtensions { '.js': (m: NodeModule, filename: string) => any; '.json': (m: NodeModule, filename: string) => any; @@ -1740,33 +1746,20 @@ declare module "https" { import * as http from "http"; import { URL } from "url"; - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error | null, ctx: tls.SecureContext) => void) => void; - secureProtocol?: string; - } + export type ServerOptions = tls.SecureContextOptions & tls.TlsOptions; - export interface RequestOptions extends http.RequestOptions { - pfx?: any; - key?: any; + export type RequestOptions = http.RequestOptions & { + rejectUnauthorized?: boolean; // Defaults to true + servername?: string; // SNI TLS Extension + pfx?: string | Buffer | Array; + key?: string | Buffer | Array; passphrase?: string; - cert?: any; - ca?: any; + cert?: string | Buffer | Array; + ca?: string | Buffer | Array; ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - servername?: string; - } + clientCertEngine?: string; + secureProtocol?: string; // SSL Method, e.g. SSLv23_method + }; export interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { rejectUnauthorized?: boolean; @@ -2621,9 +2614,9 @@ declare module "net" { destroy(err?: any): void; pause(): this; resume(): this; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -3716,7 +3709,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: Array) => void): void; + export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. @@ -3745,7 +3738,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise>; + export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; } /** @@ -3767,7 +3760,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): Array; + export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): string[] | Buffer[]; /** * Asynchronous close(2) - close a file descriptor. @@ -4839,7 +4832,7 @@ declare module "tls" { * An array of strings or a Buffer naming possible NPN protocols. * (Protocols should be ordered by their priority.) */ - NPNProtocols?: string[] | Buffer, + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * An array of strings or a Buffer naming possible ALPN protocols. * (Protocols should be ordered by their priority.) When the server @@ -4847,7 +4840,7 @@ declare module "tls" { * precedence over NPN and the server does not send an NPN extension * to the client. */ - ALPNProtocols?: string[] | Buffer, + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * SNICallback(servername, cb) A function that will be * called if the client supports SNI TLS extension. Two arguments @@ -4923,7 +4916,7 @@ declare module "tls" { * @param callback - callback(err) will be executed with null as err, once the renegotiation * is successfully completed. */ - renegotiate(options: TlsOptions, callback: (err: Error | null) => void): any; + renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any; /** * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by @@ -4966,30 +4959,16 @@ declare module "tls" { prependOnceListener(event: "secureConnect", listener: () => void): this; } - export interface TlsOptions { - host?: string; - port?: number; - pfx?: string | Buffer[]; - key?: string | string[] | Buffer | any[]; - passphrase?: string; - cert?: string | string[] | Buffer | Buffer[]; - ca?: string | string[] | Buffer | Buffer[]; - crl?: string | string[]; - ciphers?: string; - honorCipherOrder?: boolean; + export interface TlsOptions extends SecureContextOptions { + clientCertEngine?: string; + handshakeTimeout?: number; requestCert?: boolean; rejectUnauthorized?: boolean; - NPNProtocols?: string[] | Buffer; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - ecdhCurve?: string; - dhparam?: string | Buffer; - handshakeTimeout?: number; - ALPNProtocols?: string[] | Buffer; sessionTimeout?: number; ticketKeys?: Buffer; - sessionIdContext?: string; - secureProtocol?: string; - secureOptions?: number; } export interface ConnectionOptions extends SecureContextOptions { @@ -4998,8 +4977,8 @@ declare module "tls" { path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket rejectUnauthorized?: boolean; // Defaults to true - NPNProtocols?: Array; - ALPNProtocols?: Array; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; checkServerIdentity?: typeof checkServerIdentity; servername?: string; // SNI TLS Extension session?: Buffer; @@ -5097,6 +5076,7 @@ declare module "tls" { ciphers?: string; honorCipherOrder?: boolean; ecdhCurve?: string; + clientCertEngine?: string; crl?: string | Buffer | Array; dhparam?: string | Buffer; secureOptions?: number; // Value is a numeric bitmask of the `SSL_OP_*` options @@ -5335,7 +5315,6 @@ declare module "stream" { * 5. error */ addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -5401,7 +5380,7 @@ declare module "stream" { readonly writableLength: number; constructor(opts?: WritableOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5494,7 +5473,7 @@ declare module "stream" { readonly writableLength: number; constructor(opts?: DuplexOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5574,9 +5553,9 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; @@ -5650,12 +5629,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; @@ -6169,7 +6148,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptions { - statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void|boolean; + statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean; getTrailers?: (trailers: OutgoingHttpHeaders) => void; offset?: number; length?: number; @@ -6181,15 +6160,12 @@ declare module "http2" { export interface Http2Stream extends stream.Duplex { readonly aborted: boolean; + close(code: number, callback?: () => void): void; + readonly closed: boolean; readonly destroyed: boolean; + readonly pending: boolean; priority(options: StreamPriorityOptions): void; readonly rstCode: number; - rstStream(code: number): void; - rstWithNoError(): void; - rstWithProtocolError(): void; - rstWithCancel(): void; - rstWithRefuse(): void; - rstWithInternalError(): void; readonly session: Http2Session; setTimeout(msecs: number, callback?: () => void): void; readonly state: StreamState; @@ -6321,8 +6297,8 @@ declare module "http2" { additionalHeaders(headers: OutgoingHttpHeaders): void; readonly headersSent: boolean; readonly pushAllowed: boolean; - pushStream(headers: OutgoingHttpHeaders, callback?: (pushStream: ServerHttp2Stream) => void): void; - pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (pushStream: ServerHttp2Stream) => void): void; + pushStream(headers: OutgoingHttpHeaders, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; + pushStream(headers: OutgoingHttpHeaders, options?: StreamPriorityOptions, callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void): void; respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; respondWithFD(fd: number, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptions): void; respondWithFile(path: string, headers?: OutgoingHttpHeaders, options?: ServerStreamFileResponseOptionsWithError): void; @@ -6347,13 +6323,6 @@ declare module "http2" { getTrailers?: (trailers: OutgoingHttpHeaders, flags: number) => void; } - export interface SessionShutdownOptions { - graceful?: boolean; - errorCode?: number; - lastStreamID?: number; - opaqueData?: Buffer | Uint8Array; - } - export interface SessionState { effectiveLocalWindowSize?: number; effectiveRecvDataLength?: number; @@ -6367,20 +6336,26 @@ declare module "http2" { } export interface Http2Session extends events.EventEmitter { - destroy(): void; + readonly alpnProtocol?: string; + close(callback?: () => void): void; + readonly closed: boolean; + destroy(error?: Error, code?: number): void; readonly destroyed: boolean; + readonly encrypted?: boolean; + goaway(code?: number, lastStreamID?: number, opaqueData?: Buffer | DataView /*| TypedArray*/): void; readonly localSettings: Settings; + readonly originSet?: string[]; readonly pendingSettingsAck: boolean; + ref(): void; readonly remoteSettings: Settings; rstStream(stream: Http2Stream, code?: number): void; setTimeout(msecs: number, callback?: () => void): void; - shutdown(callback?: () => void): void; - shutdown(options: SessionShutdownOptions, callback?: () => void): void; readonly socket: net.Socket | tls.TLSSocket; readonly state: SessionState; priority(stream: Http2Stream, options: StreamPriorityOptions): void; settings(settings: Settings): void; readonly type: number; + unref(): void; addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; @@ -6389,7 +6364,6 @@ declare module "http2" { addListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; addListener(event: "localSettings", listener: (settings: Settings) => void): this; addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "socketError", listener: (err: Error) => void): this; addListener(event: "timeout", listener: () => void): this; emit(event: string | symbol, ...args: any[]): boolean; @@ -6399,7 +6373,6 @@ declare module "http2" { emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData: Buffer): boolean; emit(event: "localSettings", settings: Settings): boolean; emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "socketError", err: Error): boolean; emit(event: "timeout"): boolean; on(event: string, listener: (...args: any[]) => void): this; @@ -6409,7 +6382,6 @@ declare module "http2" { on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; on(event: "localSettings", listener: (settings: Settings) => void): this; on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "socketError", listener: (err: Error) => void): this; on(event: "timeout", listener: () => void): this; once(event: string, listener: (...args: any[]) => void): this; @@ -6419,7 +6391,6 @@ declare module "http2" { once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; once(event: "localSettings", listener: (settings: Settings) => void): this; once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "socketError", listener: (err: Error) => void): this; once(event: "timeout", listener: () => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; @@ -6429,7 +6400,6 @@ declare module "http2" { prependListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; prependListener(event: "localSettings", listener: (settings: Settings) => void): this; prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "socketError", listener: (err: Error) => void): this; prependListener(event: "timeout", listener: () => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; @@ -6439,7 +6409,6 @@ declare module "http2" { prependOnceListener(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData: Buffer) => void): this; prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "socketError", listener: (err: Error) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; } @@ -6447,31 +6416,42 @@ declare module "http2" { request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; addListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; addListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; emit(event: "stream", stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; on(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; once(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; once(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; prependListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; prependListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; prependOnceListener(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; prependOnceListener(event: "stream", listener: (stream: ClientHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; } + export interface AlternativeServiceOptions { + origin: number | string | url.URL; + } + export interface ServerHttp2Session extends Http2Session { + altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; readonly server: Http2Server | Http2SecureServer; addListener(event: string, listener: (...args: any[]) => void): this; @@ -6527,93 +6507,93 @@ declare module "http2" { export interface Http2Server extends net.Server { addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "socketError", listener: (err: Error) => void): this; addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; addListener(event: "timeout", listener: () => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "sessionError", err: Error): boolean; - emit(event: "socketError", err: Error): boolean; emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; emit(event: "timeout"): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "socketError", listener: (err: Error) => void): this; on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; on(event: "timeout", listener: () => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "socketError", listener: (err: Error) => void): this; once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; once(event: "timeout", listener: () => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "socketError", listener: (err: Error) => void): this; prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependListener(event: "timeout", listener: () => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "socketError", listener: (err: Error) => void): this; prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; } export interface Http2SecureServer extends tls.Server { addListener(event: string, listener: (...args: any[]) => void): this; + addListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener(event: "socketError", listener: (err: Error) => void): this; addListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; addListener(event: "timeout", listener: () => void): this; addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; emit(event: string | symbol, ...args: any[]): boolean; + emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; emit(event: "sessionError", err: Error): boolean; - emit(event: "socketError", err: Error): boolean; emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; emit(event: "timeout"): boolean; emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; on(event: string, listener: (...args: any[]) => void): this; + on(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; on(event: "sessionError", listener: (err: Error) => void): this; - on(event: "socketError", listener: (err: Error) => void): this; on(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; on(event: "timeout", listener: () => void): this; on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; once(event: string, listener: (...args: any[]) => void): this; + once(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; once(event: "sessionError", listener: (err: Error) => void): this; - once(event: "socketError", listener: (err: Error) => void): this; once(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; once(event: "timeout", listener: () => void): this; once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; prependListener(event: string, listener: (...args: any[]) => void): this; + prependListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener(event: "socketError", listener: (err: Error) => void): this; prependListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependListener(event: "timeout", listener: () => void): this; prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; prependOnceListener(event: string, listener: (...args: any[]) => void): this; + prependOnceListener(event: "checkContinue", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener(event: "socketError", listener: (err: Error) => void): this; prependOnceListener(event: "stream", listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void): this; prependOnceListener(event: "timeout", listener: () => void): this; prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; diff --git a/types/node/node-tests.ts b/types/node/node-tests.ts index dccde2db47..0572c58fea 100644 --- a/types/node/node-tests.ts +++ b/types/node/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); @@ -235,6 +235,25 @@ namespace fs_tests { }); } + { + let listS: string[]; + listS = fs.readdirSync('path'); + listS = fs.readdirSync('path', { encoding: 'utf8' }); + listS = fs.readdirSync('path', { encoding: null }); + listS = fs.readdirSync('path', { encoding: undefined }); + listS = fs.readdirSync('path', 'utf8'); + listS = fs.readdirSync('path', null); + listS = fs.readdirSync('path', undefined); + + let listB: Buffer[]; + listB = fs.readdirSync('path', { encoding: 'buffer' }); + listB = fs.readdirSync("path", 'buffer'); + + let enc = 'buffer'; + fs.readdirSync('path', { encoding: enc }); // $ExpectType string[] | Buffer[] + fs.readdirSync('path', { }); // $ExpectType string[] | Buffer[] + } + { fs.mkdtemp('/tmp/foo-', (err, folder) => { console.log(folder); @@ -3373,16 +3392,22 @@ namespace http2_tests { http2Session.on('localSettings', (settings: http2.Settings) => {}); http2Session.on('remoteSettings', (settings: http2.Settings) => {}); http2Session.on('stream', (stream: http2.Http2Stream, headers: http2.IncomingHttpHeaders, flags: number) => {}); - http2Session.on('socketError', (err: Error) => {}); http2Session.on('timeout', () => {}); http2Session.destroy(); + let alpnProtocol: string = http2Session.alpnProtocol; let destroyed: boolean = http2Session.destroyed; + let encrypted: boolean = http2Session.encrypted; + let originSet: string[] = http2Session.originSet; let pendingSettingsAck: boolean = http2Session.pendingSettingsAck; let settings: http2.Settings = http2Session.localSettings; + let closed: boolean = http2Session.closed; settings = http2Session.remoteSettings; + http2Session.ref(); + http2Session.unref(); + let headers: http2.OutgoingHttpHeaders; let options: http2.ClientSessionRequestOptions = { endStream: true, @@ -3400,16 +3425,7 @@ namespace http2_tests { http2Session.rstStream(stream, 0); http2Session.setTimeout(100, () => {}); - - let shutdownOptions: http2.SessionShutdownOptions = { - graceful: true, - errorCode: 0, - lastStreamID: 0, - opaqueData: Buffer.from([]) - }; - shutdownOptions.opaqueData = Uint8Array.from([]); - http2Session.shutdown(shutdownOptions); - http2Session.shutdown(shutdownOptions, () => {}); + http2Session.close(() => {}); let socket: net.Socket | tls.TLSSocket = http2Session.socket; let state: http2.SessionState = http2Session.state; @@ -3448,7 +3464,9 @@ namespace http2_tests { http2Stream.on('trailers', (trailers: http2.IncomingHttpHeaders, flags: number) => {}); let aborted: boolean = http2Stream.aborted; + let closed: boolean = http2Stream.closed; let destroyed: boolean = http2Stream.destroyed; + let pending: boolean = http2Stream.pending; http2Stream.priority({ exclusive: true, @@ -3457,14 +3475,6 @@ namespace http2_tests { silent: true }); - let rstCode: number = http2Stream.rstCode; - http2Stream.rstStream(rstCode); - http2Stream.rstWithNoError(); - http2Stream.rstWithProtocolError(); - http2Stream.rstWithCancel(); - http2Stream.rstWithRefuse(); - http2Stream.rstWithInternalError(); - let sesh: http2.Http2Session = http2Stream.session; http2Stream.setTimeout(100, () => {}); @@ -3492,7 +3502,7 @@ namespace http2_tests { serverHttp2Stream.additionalHeaders(headers); let headerSent: boolean = serverHttp2Stream.headersSent; let pushAllowed: boolean = serverHttp2Stream.pushAllowed; - serverHttp2Stream.pushStream(headers, (pushStream: http2.ServerHttp2Stream) => {}); + serverHttp2Stream.pushStream(headers, (err: Error | null, pushStream: http2.ServerHttp2Stream, headers: http2.OutgoingHttpHeaders) => {}); let options: http2.ServerStreamResponseOptions = { endStream: true, @@ -3533,7 +3543,7 @@ namespace http2_tests { let s2: tls.Server = http2SecureServer; [http2Server, http2SecureServer].forEach((server) => { server.on('sessionError', (err: Error) => {}); - server.on('socketError', (err: Error) => {}); + server.on('checkContinue', (stream: http2.ServerHttp2Stream, headers: http2.IncomingHttpHeaders, flags: number) => {}); server.on('stream', (stream: http2.ServerHttp2Stream, headers: http2.IncomingHttpHeaders, flags: number) => {}); server.on('request', (request: http2.Http2ServerRequest, response: http2.Http2ServerResponse) => {}); server.on('timeout', () => {}); @@ -3658,6 +3668,15 @@ namespace http2_tests { secureClientSessionOptions.ca = ''; let onConnectHandler = (session: http2.Http2Session, socket: net.Socket) => {}; + let serverHttp2Session: http2.ServerHttp2Session; + + serverHttp2Session.altsvc('', ''); + serverHttp2Session.altsvc('', 0); + serverHttp2Session.altsvc('', new url.URL('')); + serverHttp2Session.altsvc('', { origin: '' }); + serverHttp2Session.altsvc('', { origin: 0 }); + serverHttp2Session.altsvc('', { origin: new url.URL('') }); + let clientHttp2Session: http2.ClientHttp2Session; clientHttp2Session = http2.connect(''); @@ -3666,6 +3685,7 @@ namespace http2_tests { clientHttp2Session = http2.connect('', clientSessionOptions, onConnectHandler); clientHttp2Session = http2.connect('', secureClientSessionOptions); clientHttp2Session = http2.connect('', secureClientSessionOptions, onConnectHandler); + clientHttp2Session.on('altsvc', (alt: string, origin: string, number: number) => {}); settings = http2.getDefaultSettings(); settings = http2.getPackedSettings(settings); diff --git a/types/node/v0/index.d.ts b/types/node/v0/index.d.ts index 814bbe793e..800a909c49 100644 --- a/types/node/v0/index.d.ts +++ b/types/node/v0/index.d.ts @@ -1902,11 +1902,11 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; } diff --git a/types/node/v0/node-tests.ts b/types/node/v0/node-tests.ts index 8e2443b360..d8e0a40699 100644 --- a/types/node/v0/node-tests.ts +++ b/types/node/v0/node-tests.ts @@ -1,5 +1,4 @@ - -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import * as zlib from "zlib"; diff --git a/types/node/v4/index.d.ts b/types/node/v4/index.d.ts index b2db9f80ee..09cbd8bb43 100644 --- a/types/node/v4/index.d.ts +++ b/types/node/v4/index.d.ts @@ -1549,9 +1549,9 @@ declare module "net" { destroy(): void; pause(): void; resume(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -2477,12 +2477,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v4/node-tests.ts b/types/node/v4/node-tests.ts index 2bb28ce779..e60b578ccf 100644 --- a/types/node/v4/node-tests.ts +++ b/types/node/v4/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import * as zlib from "zlib"; diff --git a/types/node/v6/index.d.ts b/types/node/v6/index.d.ts index 5cbe7ab3dc..3c81e212b7 100644 --- a/types/node/v6/index.d.ts +++ b/types/node/v6/index.d.ts @@ -5,6 +5,7 @@ // Wilco Bakker // Thomas Bouldin // Sebastian Silbermann +// Alorel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /************************************************ @@ -2093,9 +2094,9 @@ declare module "net" { setEncoding(encoding?: string): void; write(data: any, encoding?: string, callback?: Function): void; destroy(): void; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -2595,8 +2596,51 @@ declare module "fs" { * @returns Returns the created folder path. */ export function mkdtempSync(prefix: string): string; - export function readdir(path: string | Buffer, callback?: (err: NodeJS.ErrnoException, files: string[]) => void): void; - export function readdirSync(path: string | Buffer): string[]; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir(path: string | Buffer, options: { encoding: BufferEncoding | null } | BufferEncoding | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir(path: string | Buffer, options: { encoding: "buffer" } | "buffer", callback: (err: NodeJS.ErrnoException, files: Buffer[]) => void): void; + + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdir(path: string | Buffer, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; + + /** + * Asynchronous readdir(3) - read a directory. + * @param path A path to a file. + */ + export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void; + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync(path: string | Buffer, options?: { encoding: BufferEncoding | null } | BufferEncoding | null): string[]; + + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync(path: string | Buffer, options: { encoding: "buffer" } | "buffer"): Buffer[]; + + /** + * Synchronous readdir(3) - read a directory. + * @param path A path to a file. + * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. + */ + export function readdirSync(path: string | Buffer, options?: { encoding?: string | null } | string | null): string[] | Buffer[]; export function close(fd: number, callback?: (err?: NodeJS.ErrnoException) => void): void; export function closeSync(fd: number): void; export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void; @@ -3605,7 +3649,6 @@ declare module "stream" { * 5. error **/ addListener(event: string, listener: Function): this; - addListener(event: string, listener: Function): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -3854,12 +3897,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v6/node-tests.ts b/types/node/v6/node-tests.ts index 34a62bf88d..cd363c708c 100644 --- a/types/node/v6/node-tests.ts +++ b/types/node/v6/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); @@ -218,6 +218,25 @@ namespace fs_tests { fs.readFile('testfile', { flag: 'r' }, (err, data) => buffer = data); } + { + fs.readdir('foo', (err: any, files: string[]) => {}) + fs.readdir('foo', 'utf8', (err: any, files: string[]) => {}); + fs.readdir('foo', {encoding: 'utf8'}, (err: any, files: string[]) => {}); + fs.readdir('foo', 'buffer', (err: any, files: Buffer[]) => {}); + fs.readdir('foo', {encoding: 'buffer'}, (err: any, files: Buffer[]) => {}); + + let fsStringOut: string[] = fs.readdirSync('utf8'); + fsStringOut = fs.readdirSync('foo', 'utf8'); + fsStringOut = fs.readdirSync('foo', {encoding: 'utf8'}); + + let fsBufferOut: Buffer[] = fs.readdirSync('utf8', 'buffer'); + fsBufferOut = fs.readdirSync('foo', {encoding: 'buffer'}); + + let enc = 'buffer'; + fs.readdirSync('path', { encoding: enc }); // $ExpectType string[] | Buffer[] + fs.readdirSync('path', { }); // $ExpectType string[] | Buffer[] + } + { var errno: number; fs.readFile('testfile', (err, data) => { diff --git a/types/node/v7/index.d.ts b/types/node/v7/index.d.ts index 038c4a6f58..de69dc94c3 100644 --- a/types/node/v7/index.d.ts +++ b/types/node/v7/index.d.ts @@ -2219,9 +2219,9 @@ declare module "net" { destroy(err?: any): void; pause(): this; resume(): this; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -3754,7 +3754,6 @@ declare module "stream" { * 5. error **/ addListener(event: string, listener: Function): this; - addListener(event: string, listener: Function): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -4003,12 +4002,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; diff --git a/types/node/v7/node-tests.ts b/types/node/v7/node-tests.ts index a2f25db8ec..0240dcc120 100644 --- a/types/node/v7/node-tests.ts +++ b/types/node/v7/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); diff --git a/types/node/v8/index.d.ts b/types/node/v8/index.d.ts index 18ba96575d..5d672296f2 100644 --- a/types/node/v8/index.d.ts +++ b/types/node/v8/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Node.js 8.5.x +// Type definitions for Node.js 8.9.x // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript // DefinitelyTyped @@ -17,7 +17,9 @@ // Sebastian Silbermann // Hannes Magnusson // Alberto Schiabel +// Huw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 /** inspector module types */ /// @@ -111,17 +113,22 @@ declare function clearImmediate(immediateId: any): void; // TODO: change to `type NodeRequireFunction = (id: string) => any;` in next mayor version. interface NodeRequireFunction { -/* tslint:disable-next-line:callable-types */ + /* tslint:disable-next-line:callable-types */ (id: string): any; } interface NodeRequire extends NodeRequireFunction { - resolve(id: string): string; + resolve: RequireResolve; cache: any; extensions: NodeExtensions; main: NodeModule | undefined; } +interface RequireResolve { + (id: string, options?: { paths?: string[]; }): string; + paths(request: string): string[] | null; +} + interface NodeExtensions { '.js': (m: NodeModule, filename: string) => any; '.json': (m: NodeModule, filename: string) => any; @@ -1728,33 +1735,20 @@ declare module "https" { import * as http from "http"; import { URL } from "url"; - export interface ServerOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - crl?: any; - ciphers?: string; - honorCipherOrder?: boolean; - requestCert?: boolean; - rejectUnauthorized?: boolean; - NPNProtocols?: any; - SNICallback?: (servername: string, cb: (err: Error | null, ctx: tls.SecureContext) => void) => void; - secureProtocol?: string; - } + export type ServerOptions = tls.SecureContextOptions & tls.TlsOptions; - export interface RequestOptions extends http.RequestOptions { - pfx?: any; - key?: any; - passphrase?: string; - cert?: any; - ca?: any; - ciphers?: string; - rejectUnauthorized?: boolean; - secureProtocol?: string; - servername?: string; - } + // see https://nodejs.org/docs/latest-v8.x/api/https.html#https_https_request_options_callback + type extendedRequestKeys = "pfx" | + "key" | + "passphrase" | + "cert" | + "ca" | + "ciphers" | + "rejectUnauthorized" | + "secureProtocol" | + "servername"; + + export type RequestOptions = http.RequestOptions & Pick; export interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { rejectUnauthorized?: boolean; @@ -2609,9 +2603,9 @@ declare module "net" { destroy(err?: any): void; pause(): this; resume(): this; - setTimeout(timeout: number, callback?: Function): void; - setNoDelay(noDelay?: boolean): void; - setKeepAlive(enable?: boolean, initialDelay?: number): void; + setTimeout(timeout: number, callback?: Function): this; + setNoDelay(noDelay?: boolean): this; + setKeepAlive(enable?: boolean, initialDelay?: number): this; address(): { port: number; family: string; address: string; }; unref(): void; ref(): void; @@ -3693,7 +3687,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: Array) => void): void; + export function readdir(path: PathLike, options: { encoding?: string | null } | string | undefined | null, callback: (err: NodeJS.ErrnoException, files: string[] | Buffer[]) => void): void; /** * Asynchronous readdir(3) - read a directory. @@ -3722,7 +3716,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise>; + export function __promisify__(path: PathLike, options?: { encoding?: string | null } | string | null): Promise; } /** @@ -3744,7 +3738,7 @@ declare module "fs" { * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. */ - export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): Array; + export function readdirSync(path: PathLike, options?: { encoding?: string | null } | string | null): string[] | Buffer[]; /** * Asynchronous close(2) - close a file descriptor. @@ -4816,7 +4810,7 @@ declare module "tls" { * An array of strings or a Buffer naming possible NPN protocols. * (Protocols should be ordered by their priority.) */ - NPNProtocols?: string[] | Buffer, + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * An array of strings or a Buffer naming possible ALPN protocols. * (Protocols should be ordered by their priority.) When the server @@ -4824,7 +4818,7 @@ declare module "tls" { * precedence over NPN and the server does not send an NPN extension * to the client. */ - ALPNProtocols?: string[] | Buffer, + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array, /** * SNICallback(servername, cb) A function that will be * called if the client supports SNI TLS extension. Two arguments @@ -4900,7 +4894,7 @@ declare module "tls" { * @param callback - callback(err) will be executed with null as err, once the renegotiation * is successfully completed. */ - renegotiate(options: TlsOptions, callback: (err: Error | null) => void): any; + renegotiate(options: { rejectUnauthorized?: boolean, requestCert?: boolean }, callback: (err: Error | null) => void): any; /** * Set maximum TLS fragment size (default and maximum value is: 16384, minimum is: 512). * Smaller fragment size decreases buffering latency on the client: large fragments are buffered by @@ -4943,30 +4937,15 @@ declare module "tls" { prependOnceListener(event: "secureConnect", listener: () => void): this; } - export interface TlsOptions { - host?: string; - port?: number; - pfx?: string | Buffer[]; - key?: string | string[] | Buffer | any[]; - passphrase?: string; - cert?: string | string[] | Buffer | Buffer[]; - ca?: string | string[] | Buffer | Buffer[]; - crl?: string | string[]; - ciphers?: string; - honorCipherOrder?: boolean; + export interface TlsOptions extends SecureContextOptions { + handshakeTimeout?: number; requestCert?: boolean; rejectUnauthorized?: boolean; - NPNProtocols?: string[] | Buffer; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; SNICallback?: (servername: string, cb: (err: Error | null, ctx: SecureContext) => void) => void; - ecdhCurve?: string; - dhparam?: string | Buffer; - handshakeTimeout?: number; - ALPNProtocols?: string[] | Buffer; sessionTimeout?: number; ticketKeys?: Buffer; - sessionIdContext?: string; - secureProtocol?: string; - secureOptions?: number; } export interface ConnectionOptions extends SecureContextOptions { @@ -4975,8 +4954,8 @@ declare module "tls" { path?: string; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. socket?: net.Socket; // Establish secure connection on a given socket rather than creating a new socket rejectUnauthorized?: boolean; // Defaults to true - NPNProtocols?: Array; - ALPNProtocols?: Array; + NPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; + ALPNProtocols?: string[] | Buffer[] | Uint8Array[] | Buffer | Uint8Array; checkServerIdentity?: typeof checkServerIdentity; servername?: string; // SNI TLS Extension session?: Buffer; @@ -5310,7 +5289,6 @@ declare module "stream" { * 5. error */ addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; addListener(event: "close", listener: () => void): this; addListener(event: "data", listener: (chunk: Buffer | string) => void): this; addListener(event: "end", listener: () => void): this; @@ -5374,7 +5352,7 @@ declare module "stream" { writable: boolean; constructor(opts?: WritableOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5465,7 +5443,7 @@ declare module "stream" { writable: boolean; constructor(opts?: DuplexOptions); _write(chunk: any, encoding: string, callback: (err?: Error) => void): void; - _writev?(chunks: Array<{chunk: any, encoding: string}>, callback: (err?: Error) => void): void; + _writev?(chunks: Array<{ chunk: any, encoding: string }>, callback: (err?: Error) => void): void; _destroy(err: Error, callback: Function): void; _final(callback: Function): void; write(chunk: any, cb?: Function): boolean; @@ -5545,9 +5523,9 @@ declare module "util" { export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2) => Promise): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3) => Promise): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; + export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; export function callbackify(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, callback: (err: NodeJS.ErrnoException) => void) => void; @@ -5621,12 +5599,12 @@ declare module "tty" { import * as net from "net"; export function isatty(fd: number): boolean; - export interface ReadStream extends net.Socket { + export class ReadStream extends net.Socket { isRaw: boolean; setRawMode(mode: boolean): void; isTTY: boolean; } - export interface WriteStream extends net.Socket { + export class WriteStream extends net.Socket { columns: number; rows: number; isTTY: boolean; @@ -6142,7 +6120,7 @@ declare module "http2" { } export interface ServerStreamFileResponseOptions { - statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void|boolean; + statCheck?: (stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions) => void | boolean; getTrailers?: (trailers: OutgoingHttpHeaders) => void; offset?: number; length?: number; diff --git a/types/node/v8/node-tests.ts b/types/node/v8/node-tests.ts index 8f4c7f9850..74d4c5c222 100644 --- a/types/node/v8/node-tests.ts +++ b/types/node/v8/node-tests.ts @@ -1,4 +1,4 @@ -import * as assert from "assert"; +import assert = require("assert"); import * as fs from "fs"; import * as events from "events"; import events2 = require("events"); @@ -235,6 +235,25 @@ namespace fs_tests { }); } + { + let listS: string[]; + listS = fs.readdirSync('path'); + listS = fs.readdirSync('path', { encoding: 'utf8' }); + listS = fs.readdirSync('path', { encoding: null }); + listS = fs.readdirSync('path', { encoding: undefined }); + listS = fs.readdirSync('path', 'utf8'); + listS = fs.readdirSync('path', null); + listS = fs.readdirSync('path', undefined); + + let listB: Buffer[]; + listB = fs.readdirSync('path', { encoding: 'buffer' }); + listB = fs.readdirSync("path", 'buffer'); + + let enc = 'buffer'; + fs.readdirSync('path', { encoding: enc }); // $ExpectType string[] | Buffer[] + fs.readdirSync('path', { }); // $ExpectType string[] | Buffer[] + } + { fs.mkdtemp('/tmp/foo-', (err, folder) => { console.log(folder); diff --git a/types/node/v8/tsconfig.json b/types/node/v8/tsconfig.json index 3f4614bef4..8deb391829 100644 --- a/types/node/v8/tsconfig.json +++ b/types/node/v8/tsconfig.json @@ -26,4 +26,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/types/nodegit/tsconfig.json b/types/nodegit/tsconfig.json index e097a77133..5d80518149 100644 --- a/types/nodegit/tsconfig.json +++ b/types/nodegit/tsconfig.json @@ -119,4 +119,4 @@ "tree-update.d.ts", "tree.d.ts" ] -} +} \ No newline at end of file diff --git a/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts b/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts index 393091816d..271dc6cf41 100644 --- a/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts +++ b/types/nodemailer-ses-transport/nodemailer-ses-transport-tests.ts @@ -1,6 +1,6 @@ import * as AWS from "aws-sdk"; import * as nodemailer from "nodemailer"; -import * as sesTransport from 'nodemailer-ses-transport'; +import sesTransport = require('nodemailer-ses-transport'); const opts: sesTransport.SesOptions = { SES: new AWS.SES(), diff --git a/types/normalize-package-data/tsconfig.json b/types/normalize-package-data/tsconfig.json index 0e79738d04..3105673d24 100644 --- a/types/normalize-package-data/tsconfig.json +++ b/types/normalize-package-data/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "normalize-package-data-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/notyf/tsconfig.json b/types/notyf/tsconfig.json index 9cf78d162a..18fb007211 100644 --- a/types/notyf/tsconfig.json +++ b/types/notyf/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "notyf-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/npm-package-arg/npm-package-arg-tests.ts b/types/npm-package-arg/npm-package-arg-tests.ts index ed95eb5243..d7f08c6c10 100644 --- a/types/npm-package-arg/npm-package-arg-tests.ts +++ b/types/npm-package-arg/npm-package-arg-tests.ts @@ -1,4 +1,4 @@ -import * as npa from "npm-package-arg"; +import npa = require("npm-package-arg"); const result1 = npa("npm-package-arg@5.1"); const result2 = npa("npm-package-arg@5.1", ".."); diff --git a/types/npm-packlist/index.d.ts b/types/npm-packlist/index.d.ts new file mode 100644 index 0000000000..934d2f8967 --- /dev/null +++ b/types/npm-packlist/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for npm-packlist 1.1 +// Project: https://github.com/npm/npm-packlist +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +declare function packlist(options?: packlist.Options): Promise; +declare function packlist(options: packlist.Options | undefined, callback: (result: string[]) => T): Promise; +declare namespace packlist { + interface Options { + /** Directory to walk recusively. Defaults to `process.cwd()`. */ + path?: string; + } + function sync(options?: Options): string[]; +} +export = packlist; diff --git a/types/npm-packlist/npm-packlist-tests.ts b/types/npm-packlist/npm-packlist-tests.ts new file mode 100644 index 0000000000..162a7d86f5 --- /dev/null +++ b/types/npm-packlist/npm-packlist-tests.ts @@ -0,0 +1,14 @@ +import packlist = require('npm-packlist'); + +let result: string[] = packlist.sync(); +result = packlist.sync({}); +result = packlist.sync({path: 'foo'}); + +(async () => { + result = await packlist(); + result = await packlist({}); + result = await packlist({path: 'foo'}); + + packlist(undefined, (r) => result = r); + packlist({path: 'foo'}, (r) => result = r); +})(); diff --git a/types/npm-packlist/tsconfig.json b/types/npm-packlist/tsconfig.json new file mode 100644 index 0000000000..2c60fe863a --- /dev/null +++ b/types/npm-packlist/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", + "npm-packlist-tests.ts" + ] +} \ No newline at end of file diff --git a/types/npm-packlist/tslint.json b/types/npm-packlist/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/npm-packlist/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/ns-api/ns-api-tests.ts b/types/ns-api/ns-api-tests.ts index 5063a97e48..ab8c7e343d 100644 --- a/types/ns-api/ns-api-tests.ts +++ b/types/ns-api/ns-api-tests.ts @@ -1,4 +1,4 @@ -import * as NsApi from "ns-api"; +import NsApi = require("ns-api"); declare var console: { log(msg: any): string }; diff --git a/types/nsqjs/tsconfig.json b/types/nsqjs/tsconfig.json index 6681afbdb9..2e65f5637c 100644 --- a/types/nsqjs/tsconfig.json +++ b/types/nsqjs/tsconfig.json @@ -14,11 +14,10 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames": true, - "strictFunctionTypes": true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", "nsqjs-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/nunjucks/tsconfig.json b/types/nunjucks/tsconfig.json index 5824ce2f1f..4324f01fa8 100644 --- a/types/nunjucks/tsconfig.json +++ b/types/nunjucks/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "nunjucks-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/o.js/o.js-tests.ts b/types/o.js/o.js-tests.ts index 26cc187723..be3e5c824a 100644 --- a/types/o.js/o.js-tests.ts +++ b/types/o.js/o.js-tests.ts @@ -1,4 +1,4 @@ -import * as o from 'o.js'; +import o = require('o.js'); import * as Q from "q"; interface Product { diff --git a/types/oauth2-server/oauth2-server-tests.ts b/types/oauth2-server/oauth2-server-tests.ts index be8fa83705..faf9976873 100644 --- a/types/oauth2-server/oauth2-server-tests.ts +++ b/types/oauth2-server/oauth2-server-tests.ts @@ -1,5 +1,5 @@ -import * as express from "express"; -import * as OAuth2Server from "oauth2-server"; +import express = require("express"); +import OAuth2Server = require("oauth2-server"); const oauth2Model: OAuth2Server.AuthorizationCodeModel = { getClient: async (clientId: string, clientSecret: string): Promise => { diff --git a/types/object-assign/object-assign-tests.ts b/types/object-assign/object-assign-tests.ts index e7c58cf5fb..dc8db6ba07 100644 --- a/types/object-assign/object-assign-tests.ts +++ b/types/object-assign/object-assign-tests.ts @@ -1,4 +1,4 @@ -import * as objectAssign from 'object-assign'; +import objectAssign = require('object-assign'); interface Target { hellow: string; @@ -9,7 +9,7 @@ interface Source1 { } interface Result extends Target, Source1 { - + } interface Source2 { @@ -17,7 +17,7 @@ interface Source2 { } interface Result2 extends Result, Source2 { - + } interface Source3 { @@ -25,7 +25,7 @@ interface Source3 { } interface Result3 extends Result2, Source3 { - + } interface Source4 { @@ -33,7 +33,7 @@ interface Source4 { } interface Result4 extends Result3, Source4 { - + } interface Source5 { @@ -41,7 +41,7 @@ interface Source5 { } interface Result5 extends Result4, Source5 { - + } function assign1(): Result { diff --git a/types/object-hash/index.d.ts b/types/object-hash/index.d.ts index c6b16df950..4da49c262c 100644 --- a/types/object-hash/index.d.ts +++ b/types/object-hash/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for object-hash v1.1.8 +// Type definitions for object-hash v1.2.0 // Project: https://github.com/puleos/object-hash // Definitions by: Michael Zabka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,7 @@ declare namespace ObjectHash { respectFunctionNames?: boolean; unorderedArrays?: boolean; unorderedSets?: boolean; + excludeKeys?: (key: string) => boolean; } interface HashTableItem { diff --git a/types/object-inspect/tsconfig.json b/types/object-inspect/tsconfig.json index 1f167ba039..295f490d24 100644 --- a/types/object-inspect/tsconfig.json +++ b/types/object-inspect/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "object-inspect-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/object-merge/index.d.ts b/types/object-merge/index.d.ts new file mode 100644 index 0000000000..bd9f0ce8ee --- /dev/null +++ b/types/object-merge/index.d.ts @@ -0,0 +1,164 @@ +// Type definitions for object-merge 2.5 +// Project: https://github.com/matthewkastor/object-merge +// Definitions by: OpenByteDev +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 2.2 + +interface ObjectMergeOptions { + depth: number|boolean; + throwOnCircularRef: boolean; +} + +interface ObjectMerge { + /** + * Merges JavaScript objects recursively without altering the objects merged. + * @author Matthew Kastor + * @param [opts] An options object created by + * objectMerge.createOptions. Options must be specified as the first argument + * and must be an object created with createOptions or else the object will + * not be recognized as an options object and will be merged instead. + * @param shadows [[shadows]...] One or more objects to merge. Each + * argument given will be treated as an object to merge. Each object + * overwrites the previous objects descendant properties if the property name + * matches. If objects properties are objects they will be merged recursively + * as well. + * @returns Returns a single merged object composed from clones of the + * input objects. + * @example + * var objectMerge = require('object-merge'); + * var x = { + * a : 'a', + * b : 'b', + * c : { + * d : 'd', + * e : 'e', + * f : { + * g : 'g' + * } + * } + * }; + * var y = { + * a : '`a', + * b : '`b', + * c : { + * d : '`d' + * } + * }; + * var z = { + * a : { + * b : '``b' + * }, + * fun : function foo () { + * return 'foo'; + * }, + * aps : Array.prototype.slice + * }; + * var out = objectMerge(x, y, z); + * // out.a will be { + * // b : '``b' + * // } + * // out.b will be '`b' + * // out.c will be { + * // d : '`d', + * // e : 'e', + * // f : { + * // g : 'g' + * // } + * // } + * // out.fun will be a clone of z.fun + * // out.aps will be equal to z.aps + */ + (opts: ObjectMergeOptions, ...shadows: object[]): object; + /** + * Merges JavaScript objects recursively without altering the objects merged. + * @author Matthew Kastor + * @param shadows [[shadows]...] One or more objects to merge. Each + * argument given will be treated as an object to merge. Each object + * overwrites the previous objects descendant properties if the property name + * matches. If objects properties are objects they will be merged recursively + * as well. + * @returns Returns a single merged object composed from clones of the + * input objects. + * @example + * var objectMerge = require('object-merge'); + * var x = { + * a : 'a', + * b : 'b', + * c : { + * d : 'd', + * e : 'e', + * f : { + * g : 'g' + * } + * } + * }; + * var y = { + * a : '`a', + * b : '`b', + * c : { + * d : '`d' + * } + * }; + * var z = { + * a : { + * b : '``b' + * }, + * fun : function foo () { + * return 'foo'; + * }, + * aps : Array.prototype.slice + * }; + * var out = objectMerge(x, y, z); + * // out.a will be { + * // b : '``b' + * // } + * // out.b will be '`b' + * // out.c will be { + * // d : '`d', + * // e : 'e', + * // f : { + * // g : 'g' + * // } + * // } + * // out.fun will be a clone of z.fun + * // out.aps will be equal to z.aps + */ + (...shadows: object[]): object; + /** + * Creates a new options object suitable for use with objectMerge. + * @param [opts] An object specifying the options. + * @param [opts.depth = false] Specifies the depth to traverse objects + * during merging. If this is set to false then there will be no depth limit. + * @param [opts.throwOnCircularRef = true] Set to false to suppress + * errors on circular references. + * @returns Returns an instance of ObjectMergeOptions + * to be used with objectMerge. + * @example + * var opts = objectMerge.createOptions({ + * depth : 2, + * throwOnCircularRef : false + * }); + * var obj1 = { + * a1 : { + * a2 : { + * a3 : {} + * } + * } + * }; + * var obj2 = { + * a1 : { + * a2 : { + * a3 : 'will not be in output' + * }, + * a22 : {} + * } + * }; + * objectMerge(opts, obj1, obj2); + */ + createOptions: (options: object) => ObjectMergeOptions; +} + +declare const objectMerge: ObjectMerge; + +export = objectMerge; diff --git a/types/object-merge/object-merge-tests.ts b/types/object-merge/object-merge-tests.ts new file mode 100644 index 0000000000..edaf9885ba --- /dev/null +++ b/types/object-merge/object-merge-tests.ts @@ -0,0 +1,47 @@ +import objectMerge = require('object-merge'); + +const x = { + a : 'a', + b : 'b', + c : { + d : 'd', + e : 'e', + f : { + g : 'g' + } + } +}; +const y = { + a : '`a', + b : '`b', + c : { + d : '`d' + } +}; +const z = { + a : { + b : '``b' + }, + fun : function foo() { + return 'foo'; + }, + aps : Array.prototype.slice +}; +const out = objectMerge(x, y, z); + +const a = { + a1 : { + a2 : { + a3 : {} + } + } +}; +const b = { + b1 : { + b2 : { + b3 : {} + } + } +}; +const opts = objectMerge.createOptions({depth : 2}); +const res = objectMerge(opts, a, b); diff --git a/types/object-merge/tsconfig.json b/types/object-merge/tsconfig.json new file mode 100644 index 0000000000..c098631639 --- /dev/null +++ b/types/object-merge/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "object-merge-tests.ts" + ] +} \ No newline at end of file diff --git a/types/object-merge/tslint.json b/types/object-merge/tslint.json new file mode 100644 index 0000000000..4e88071852 --- /dev/null +++ b/types/object-merge/tslint.json @@ -0,0 +1 @@ +{"extends": "dtslint/dt.json"} diff --git a/types/object-refs/object-refs-tests.ts b/types/object-refs/object-refs-tests.ts index 9b602aea0d..ba71756c3c 100644 --- a/types/object-refs/object-refs-tests.ts +++ b/types/object-refs/object-refs-tests.ts @@ -1,4 +1,4 @@ -import * as Refs from 'object-refs'; +import Refs = require('object-refs'); let refs = new Refs({ name: 'wheels', collection: true, enumerable: true }, { name: 'car' }); diff --git a/types/odata/odata-tests.ts b/types/odata/odata-tests.ts index 522dc3d529..58e1505f21 100644 --- a/types/odata/odata-tests.ts +++ b/types/odata/odata-tests.ts @@ -1,4 +1,4 @@ -import * as o from 'odata'; +import o = require('odata'); import * as Q from "q"; interface Product { diff --git a/types/ol/tsconfig.json b/types/ol/tsconfig.json index b307225e58..6402adb0f7 100644 --- a/types/ol/tsconfig.json +++ b/types/ol/tsconfig.json @@ -173,4 +173,4 @@ "vectortile/index.d.ts", "view/index.d.ts" ] -} +} \ No newline at end of file diff --git a/types/onesignal-cordova-plugin/tsconfig.json b/types/onesignal-cordova-plugin/tsconfig.json index bcee47426f..a256428f0e 100644 --- a/types/onesignal-cordova-plugin/tsconfig.json +++ b/types/onesignal-cordova-plugin/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "onesignal-cordova-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/openlayers/index.d.ts b/types/openlayers/index.d.ts index c217a6d873..f9593fcb09 100644 --- a/types/openlayers/index.d.ts +++ b/types/openlayers/index.d.ts @@ -12344,13 +12344,42 @@ declare module ol { */ constructor(opt_options?: olx.ViewOptions); + /** + * Animate the view. The view's center, zoom (or resolution), and + * rotation can be animated for smooth transitions between view states. + * @param {olx.AnimateOptions} var_args Animation options. + * @param {olx.AnimateOptions | (completed: boolean) => void } restArgs + * @api experimental + */ + animate(...var_args: Array): void; + + /** + * Determine if the view is being animated. + * @return {boolean} The view is being animated. + * @api + */ + getAnimating(): boolean; + + /** + * Determine if the user is interacting with the view, such as panning or zooming. + * @return {boolean} The view is being interacted with. + * @api + */ + getInteracting(): boolean; + + /** + * Cancel any ongoing animations. + * @api + */ + cancelAnimations(): void; + /** * Get the constrained center of this view. * @param {ol.Coordinate|undefined} center Center. * @return {ol.Coordinate|undefined} Constrained center. * @api */ - constrainCenter(center: (ol.Coordinate)): (ol.Coordinate); + constrainCenter(center?: ol.Coordinate): ol.Coordinate; /** * Get the constrained resolution of this view. @@ -12360,7 +12389,7 @@ declare module ol { * @return {number|undefined} Constrained resolution. * @api */ - constrainResolution(resolution: (number), opt_delta?: number, opt_direction?: number): (number); + constrainResolution(resolution?: number, opt_delta?: number, opt_direction?: number): number; /** * Get the constrained rotation of this view. @@ -12369,7 +12398,7 @@ declare module ol { * @return {number|undefined} Constrained rotation. * @api */ - constrainRotation(rotation: (number), opt_delta?: number): (number); + constrainRotation(rotation?: number, opt_delta?: number): number; /** * Get the view center. @@ -12377,7 +12406,7 @@ declare module ol { * @observable * @api stable */ - getCenter(): (ol.Coordinate); + getCenter(): ol.Coordinate; /** * Calculate the extent for the current view state and the passed size. @@ -12404,6 +12433,34 @@ declare module ol { */ getMinResolution(): number; + /** + * Get the maximum zoom level for the view. + * @return {number} The maximum zoom level. + * @api + */ + getMaxZoom(): number; + + /** + * Set a new maximum zoom level for the view. + * @param {number} zoom The maximum zoom level. + * @api stable + */ + setMaxZoom(zoom: number): void; + + /** + * Get the minimum zoom level for the view. + * @return {number} The minimum zoom level. + * @api + */ + getMinZoom(): number; + + /** + * Set a new minimum zoom level for the view. + * @param {number} zoom The minimum zoom level. + * @api stable + */ + setMinZoom(zoom: number): void; + /** * Get the view projection. * @return {ol.proj.Projection} The projection of the view. @@ -12417,7 +12474,7 @@ declare module ol { * @observable * @api stable */ - getResolution(): (number); + getResolution(): number; /** * Get the resolutions for the view. This returns the array of resolutions @@ -12425,7 +12482,17 @@ declare module ol { * @return {Array.|undefined} The resolutions of the view. * @api stable */ - getResolutions(): (number[]); + getResolutions(): number[]; + + /** + * Get the resolution for a provided extent (in map units) and size (in pixels). + * @param {ol.Extent} extent Extent. + * @param {ol.Size=} opt_size Box pixel size. + * @return {number} The resolution at which the provided extent will render at + * the given size. + * @api + */ + getResolutionForExtent(extent: ol.Extent, opt_size?: ol.Size): number; /** * Get the view rotation. @@ -12436,12 +12503,29 @@ declare module ol { getRotation(): number; /** - * Get the current zoom level. Return undefined if the current - * resolution is undefined or not within the "resolution constraints". + * Get the current zoom level. If you configured your view with a resolutions + * array (this is rare), this method may return non-integer zoom levels (so + * the zoom level is not safe to use as an index into a resolutions array). * @return {number|undefined} Zoom. - * @api stable + * @api */ - getZoom(): (number); + getZoom(): number; + + /** + * Get the zoom level for a resolution. + * @param {number} resolution The resolution. + * @return {number|undefined} The zoom level for the provided resolution. + * @api + */ + getZoomForResolution(resolution: number): number; + + /** + * Get the resolution for a zoom level. + * @param {number} zoom Zoom level. + * @return {number} The view resolution for the provided zoom level. + * @api + */ + getResolutionForZoom(zoom: number): number; /** * Fit the given geometry or extent based on the given map size and border. @@ -12452,7 +12536,7 @@ declare module ol { * @param {olx.view.FitOptions=} opt_options Options. * @api */ - fit(geometry: (ol.geom.SimpleGeometry | ol.Extent), opt_options?: olx.view.FitOptions): void; + fit(geometryOrExtent: (ol.geom.SimpleGeometry | ol.Extent), opt_options?: olx.view.FitOptions): void; /** * Center on coordinate and view position. @@ -12477,7 +12561,7 @@ declare module ol { * @observable * @api stable */ - setCenter(center: (ol.Coordinate)): void; + setCenter(center: ol.Coordinate): void; /** * Set the resolution for this view. @@ -12485,7 +12569,7 @@ declare module ol { * @observable * @api stable */ - setResolution(resolution: (number)): void; + setResolution(resolution?: number): void; /** * Set the rotation for this view. @@ -12495,20 +12579,6 @@ declare module ol { */ setRotation(rotation: number): void; - /** - * Set a new maximum zoom level for the view. - * @param {number} zoom The maximum zoom level. - * @api stable - */ - setMaxZoom(zoom: number): void; - - /** - * Set a new minimum zoom level for the view. - * @param {number} zoom The minimum zoom level. - * @api stable - */ - setMinZoom(zoom: number): void; - /** * Zoom to a specific zoom level. * @param {number} zoom Zoom level. @@ -12516,15 +12586,6 @@ declare module ol { */ setZoom(zoom: number): void; - /** - * Animate the view. The view's center, zoom (or resolution), and - * rotation can be animated for smooth transitions between view states. - * @param {olx.AnimateOptions} var_args Animation options. - * @param {olx.AnimateOptions | (completed: boolean) => void } restArgs - * @api experimental - */ - animate(...var_args: Array): void; - } } @@ -12607,7 +12668,7 @@ declare module olx { zoom?: number | undefined; resolution?: number | undefined; rotation?: number | undefined; - anchor?: number | undefined; + anchor?: ol.Coordinate | undefined; duration?: number | undefined; easing?: ((t: number) => number) | undefined; } diff --git a/types/openlayers/openlayers-tests.ts b/types/openlayers/openlayers-tests.ts index 4353f48960..1981e50847 100644 --- a/types/openlayers/openlayers-tests.ts +++ b/types/openlayers/openlayers-tests.ts @@ -55,6 +55,7 @@ let mapBrowserEvent: ol.MapBrowserEvent; let multiLineString: ol.geom.MultiLineString; let multiPoint: ol.geom.MultiPoint; let multiPolygon: ol.geom.MultiPolygon; +let pixel: ol.Pixel; let point: ol.geom.Point; let polygon: ol.geom.Polygon; let projection: ol.proj.Projection; @@ -392,17 +393,97 @@ voidValue = feature.setProperties(object); // ol.View // -let view: ol.View = new ol.View({ - center: [0, 0], +let view: ol.View; +view = new ol.View(); +view = new ol.View({}); +view = new ol.View({ + center: coordinate, + constrainRotation: numberValue, + enableRotation: booleanValue, + extent: extent, + maxResolution: numberValue, + minResolution: numberValue, + maxZoom: numberValue, + minZoom: numberValue, + projection: projectionLike, + resolution: numberValue, + resolutions: [numberValue, numberValue, numberValue, numberValue, numberValue], + rotation: numberValue, zoom: numberValue, + zoomFactor: numberValue, +}); +view = new ol.View({ + constrainRotation: booleanValue, }); -voidValue = view.setMaxZoom(numberValue); -voidValue = view.setMinZoom(numberValue); +voidValue = view.animate(); +voidValue = view.animate({}); +voidValue = view.animate({zoom: view.getZoom() + 1}); +voidValue = view.animate({zoom: 10}, {center: [0, 0]}); +voidValue = view.animate({ + center: coordinate, + zoom: numberValue, + resolution: numberValue, + rotation: numberValue, + anchor: coordinate, + duration: numberValue, + easing: easingFunction, +}); +extent = view.calculateExtent(); +extent = view.calculateExtent(size); +voidValue = view.cancelAnimations(); +voidValue = view.centerOn(coordinate, size, pixel); +coordinate = view.constrainCenter(); +coordinate = view.constrainCenter(coordinate); +numberValue = view.constrainResolution(); +numberValue = view.constrainResolution(numberValue); +numberValue = view.constrainResolution(numberValue, numberValue); +numberValue = view.constrainResolution(numberValue, numberValue, numberValue); +numberValue = view.constrainRotation(); +numberValue = view.constrainRotation(numberValue); +numberValue = view.constrainRotation(numberValue, numberValue); voidValue = view.fit(simpleGeometry); +voidValue = view.fit(simpleGeometry, {}); voidValue = view.fit(extent); +voidValue = view.fit(extent, {}); voidValue = view.fit(extent, {callback: () => {}}); voidValue = view.fit(extent, {callback: (animationCompleted: boolean) => {}}); +voidValue = view.fit(extent, { + size: size, + padding: [numberValue, numberValue, numberValue, numberValue], + constrainResolution: booleanValue, + nearest: booleanValue, + minResolution: numberValue, + maxZoom: numberValue, + duration: numberValue, + easing: easingFunction, + callback: (animationCompleted: boolean) => {} +}); +booleanValue = view.getAnimating(); +coordinate = view.getCenter(); +booleanValue = view.getInteracting(); +numberValue = view.getMaxResolution(); +numberValue = view.getMaxZoom(); +numberValue = view.getMinResolution(); +numberValue = view.getMinZoom(); +projection = view.getProjection(); +numberValue = view.getResolution(); +numberValue = view.getResolutionForExtent(extent); +numberValue = view.getResolutionForExtent(extent, size); +numberValue = view.getResolutionForZoom(numberValue); +[numberValue, numberValue, numberValue, numberValue, numberValue] = view.getResolutions(); +numberValue = view.getRotation(); +numberValue = view.getZoom(); +numberValue = view.getZoomForResolution(numberValue); +voidValue = view.rotate(numberValue); +voidValue = view.rotate(numberValue, coordinate); +voidValue = view.setCenter(coordinate); +voidValue = view.setMaxZoom(numberValue); +voidValue = view.setMinZoom(numberValue); +voidValue = view.setResolution(); +voidValue = view.setResolution(numberValue); +voidValue = view.setRotation(numberValue); +voidValue = view.setZoom(numberValue); // // ol.layer.Base @@ -468,6 +549,7 @@ let vectorTileLayer: ol.layer.VectorTile = new ol.layer.VectorTile({ zIndex: 2 }); + // // ol.Object // diff --git a/types/opentok/opentok-tests.ts b/types/opentok/opentok-tests.ts index c0f93f333f..28553463b4 100644 --- a/types/opentok/opentok-tests.ts +++ b/types/opentok/opentok-tests.ts @@ -1,4 +1,4 @@ -import * as OpenTok from 'opentok'; +import OpenTok = require('opentok'); const client = new OpenTok('API_KEY', 'API_SECRET'); diff --git a/types/opn/tsconfig.json b/types/opn/tsconfig.json index 2a51fff8ca..7551867ee1 100644 --- a/types/opn/tsconfig.json +++ b/types/opn/tsconfig.json @@ -1,16 +1,23 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "opn-tests.ts"] -} + "files": [ + "index.d.ts", + "opn-tests.ts" + ] +} \ No newline at end of file diff --git a/types/optics-agent/optics-agent-tests.ts b/types/optics-agent/optics-agent-tests.ts index 2135c810d4..22b9b479e9 100644 --- a/types/optics-agent/optics-agent-tests.ts +++ b/types/optics-agent/optics-agent-tests.ts @@ -9,9 +9,9 @@ import OpticsAgent, { Agent, } from 'optics-agent'; import { GraphQLSchema } from 'graphql'; -import * as express from 'express'; +import express = require('express'); import * as hapi from 'hapi'; -import * as KoaServer from 'koa'; +import KoaServer = require('koa'); const configOptions: Options = { apiKey: "", diff --git a/types/optics-agent/tsconfig.json b/types/optics-agent/tsconfig.json index e7dbc8958b..010406be2f 100644 --- a/types/optics-agent/tsconfig.json +++ b/types/optics-agent/tsconfig.json @@ -14,7 +14,9 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +25,4 @@ "index.d.ts", "optics-agent-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/optimize-css-assets-webpack-plugin/index.d.ts b/types/optimize-css-assets-webpack-plugin/index.d.ts index b16d384d72..788b2e6a1f 100644 --- a/types/optimize-css-assets-webpack-plugin/index.d.ts +++ b/types/optimize-css-assets-webpack-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/NMFR/optimize-css-assets-webpack-plugin // Definitions by: Armando Meziat // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts b/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts index 74cf685649..0dd1531313 100644 --- a/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts +++ b/types/optimize-css-assets-webpack-plugin/optimize-css-assets-webpack-plugin-tests.ts @@ -1,4 +1,4 @@ -import * as OptimizeCssAssets from 'optimize-css-assets-webpack-plugin'; +import OptimizeCssAssets = require('optimize-css-assets-webpack-plugin'); const ocap: OptimizeCssAssets = new OptimizeCssAssets({ assetNameRegExp: /\.min\.css$/, diff --git a/types/orientjs/orientjs-tests.ts b/types/orientjs/orientjs-tests.ts index ec083b84e3..9b11968058 100644 --- a/types/orientjs/orientjs-tests.ts +++ b/types/orientjs/orientjs-tests.ts @@ -1,4 +1,4 @@ -import * as orientjs from 'orientjs'; +import orientjs = require('orientjs'); const dbserver = orientjs({ host: 'localhost', diff --git a/types/osrm/osrm-tests.ts b/types/osrm/osrm-tests.ts index fd53363dd7..513e8c1fd2 100644 --- a/types/osrm/osrm-tests.ts +++ b/types/osrm/osrm-tests.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import * as OSRM from 'osrm'; +import OSRM = require('osrm'); // Access to Types from namespace const tile: OSRM.Tile = [0, 0, 0]; diff --git a/types/otplib/tsconfig.json b/types/otplib/tsconfig.json index cfb2b07081..4aa529c51c 100644 --- a/types/otplib/tsconfig.json +++ b/types/otplib/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "otplib-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/owasp-password-strength-test/tsconfig.json b/types/owasp-password-strength-test/tsconfig.json index 0206d30034..926835b3e5 100644 --- a/types/owasp-password-strength-test/tsconfig.json +++ b/types/owasp-password-strength-test/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "owasp-password-strength-test-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/p-loading/tsconfig.json b/types/p-loading/tsconfig.json index 3aeb261695..09fd52fdda 100644 --- a/types/p-loading/tsconfig.json +++ b/types/p-loading/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "p-loading-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/package-json/tsconfig.json b/types/package-json/tsconfig.json index 52c1adb7d3..7bca217f58 100644 --- a/types/package-json/tsconfig.json +++ b/types/package-json/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "package-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/page-icon/page-icon-tests.ts b/types/page-icon/page-icon-tests.ts index 4a6bc8c2b6..2b2873dae1 100644 --- a/types/page-icon/page-icon-tests.ts +++ b/types/page-icon/page-icon-tests.ts @@ -1,4 +1,4 @@ -import * as pageIcon from "page-icon"; +import pageIcon = require("page-icon"); const siteUrl = "https://www.facebook.com/"; pageIcon(siteUrl) diff --git a/types/pangu/tsconfig.json b/types/pangu/tsconfig.json index a1084b5b06..91b1b9f43a 100644 --- a/types/pangu/tsconfig.json +++ b/types/pangu/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pangu-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/parent-package-json/parent-package-json-tests.ts b/types/parent-package-json/parent-package-json-tests.ts index 41a5a7bdd0..50091ff376 100644 --- a/types/parent-package-json/parent-package-json-tests.ts +++ b/types/parent-package-json/parent-package-json-tests.ts @@ -1,4 +1,4 @@ -import * as parent from 'parent-package-json'; +import parent = require('parent-package-json'); const hasParent = parent('/optional/path/', 1); diff --git a/types/parent-package-json/tsconfig.json b/types/parent-package-json/tsconfig.json index 33d474c851..c3c9be507a 100644 --- a/types/parent-package-json/tsconfig.json +++ b/types/parent-package-json/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "parent-package-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/parse-json/tsconfig.json b/types/parse-json/tsconfig.json index 448f6787ba..d163b65cda 100644 --- a/types/parse-json/tsconfig.json +++ b/types/parse-json/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "parse-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/parse-link-header/parse-link-header-tests.ts b/types/parse-link-header/parse-link-header-tests.ts index 01a4de8a8f..ce32e1a1cd 100644 --- a/types/parse-link-header/parse-link-header-tests.ts +++ b/types/parse-link-header/parse-link-header-tests.ts @@ -1,4 +1,4 @@ -import * as parse from "parse-link-header"; +import parse = require("parse-link-header"); const linkHeader = '; rel="next", ' + diff --git a/types/parse-ms/tsconfig.json b/types/parse-ms/tsconfig.json index 3fecf7615f..a4d7591291 100644 --- a/types/parse-ms/tsconfig.json +++ b/types/parse-ms/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "parse-ms-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/parse-torrent-file/parse-torrent-file-tests.ts b/types/parse-torrent-file/parse-torrent-file-tests.ts index a981c0bc81..43b8c7d0fd 100644 --- a/types/parse-torrent-file/parse-torrent-file-tests.ts +++ b/types/parse-torrent-file/parse-torrent-file-tests.ts @@ -1,4 +1,4 @@ -import * as parseTorrentFile from 'parse-torrent-file'; +import parseTorrentFile = require('parse-torrent-file'); import * as fs from 'fs'; const torrent = fs.readFileSync(__filename); diff --git a/types/parse-torrent/parse-torrent-tests.ts b/types/parse-torrent/parse-torrent-tests.ts index 24d00dbe98..c2676ff080 100644 --- a/types/parse-torrent/parse-torrent-tests.ts +++ b/types/parse-torrent/parse-torrent-tests.ts @@ -1,4 +1,4 @@ -import * as parseTorrent from 'parse-torrent'; +import parseTorrent = require('parse-torrent'); import * as fs from 'fs'; // info hash (as a hex string) diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index 1973c8938b..d186211983 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -4,6 +4,7 @@ // David Poetzsch-Heffter // Cedric Kemp // Flavio Negrão +// Wes Grimes // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -644,6 +645,7 @@ declare namespace Parse { select(...keys: string[]): Query; skip(n: number): Query; startsWith(key: string, prefix: string): Query; + subscribe(): Events; withinGeoBox(key: string, southwest: GeoPoint, northeast: GeoPoint): Query; withinKilometers(key: string, point: GeoPoint, maxDistance: number): Query; withinMiles(key: string, point: GeoPoint, maxDistance: number): Query; diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index 87194ba02c..06ec062880 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -491,3 +491,16 @@ function test_batch_operations() { Parse.Object.fetchAllIfNeeded(games, { sessionToken: '' }) } +function test_query_subscribe() { + // create new query from Game object type + const query = new Parse.Query(Game); + + // create subscription to Game object + const subscription = query.subscribe(); + + // listen for new Game objects created on Parse server + subscription.on('create', (game: any) => { + console.log(game); + }); +} + diff --git a/types/parsimmon/tsconfig.json b/types/parsimmon/tsconfig.json index 676b349a37..7fec29b8cc 100644 --- a/types/parsimmon/tsconfig.json +++ b/types/parsimmon/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "parsimmon-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/passport-facebook-token/passport-facebook-token-tests.ts b/types/passport-facebook-token/passport-facebook-token-tests.ts index c926748286..1539118879 100644 --- a/types/passport-facebook-token/passport-facebook-token-tests.ts +++ b/types/passport-facebook-token/passport-facebook-token-tests.ts @@ -1,6 +1,6 @@ import * as express from 'express'; import * as passport from 'passport'; -import * as PassportFacebookToken from 'passport-facebook-token'; +import PassportFacebookToken = require('passport-facebook-token'); const User = { findOrCreate(id: string, provider: string, callback: (err: any, user: any) => void): void { diff --git a/types/passport-google-oauth/tsconfig.json b/types/passport-google-oauth/tsconfig.json index 7f3b315c07..adde576621 100644 --- a/types/passport-google-oauth/tsconfig.json +++ b/types/passport-google-oauth/tsconfig.json @@ -1,16 +1,23 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "passport-google-oauth-tests.ts"] -} + "files": [ + "index.d.ts", + "passport-google-oauth-tests.ts" + ] +} \ No newline at end of file diff --git a/types/passport-http/index.d.ts b/types/passport-http/index.d.ts index e9a66964ea..fa3f968e7e 100644 --- a/types/passport-http/index.d.ts +++ b/types/passport-http/index.d.ts @@ -1,60 +1,70 @@ -// Type definitions for passport-http 0.3.0 +// Type definitions for passport-http 0.3 // Project: https://github.com/jaredhanson/passport-http // Definitions by: Christophe Vidal +// Tomek Łaziuk +// Chris Barth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 import passport = require("passport"); import express = require("express"); -interface BasicStrategyOptions { +export interface BasicStrategyOptions { realm?: string; passReqToCallback?: boolean; } -interface DigestStrategyOptions { +export interface DigestStrategyOptions { realm?: string; - domain?: string | Array; + domain?: string | string[]; opaque?: string; algorithm?: string; - qop?: string | Array; + qop?: string | string[]; } -interface DigestValidateOptions { +export interface DigestValidateOptions { nonce: string; cnonce: string; nc: number; opaque: string; } -interface BasicVerifyFunction { - (username: string, password: string, done: (error: any, user?: any) => void): void; -} +export type BasicVerifyFunction = ( + username: string, + password: string, + done: (error: any, user?: any) => void, +) => any; -interface BasicVerifyFunctionWithRequest { - (req: express.Request, username: string, password: string, done: (error: any, user?: any) => void): void; -} +export type BasicVerifyFunctionWithRequest = ( + req: express.Request, + username: string, + password: string, + done: (error: any, user?: any) => void, +) => any; -interface DigestSecretFunction { - (username: string, done: (error: any, user?: any, password?: any) => void): void; -} +export type DigestSecretFunction = ( + username: string, + done: (error: any, user?: any, password?: any) => void, +) => any; -interface DigestValidateFunction { - (params: DigestValidateOptions, done: (error: any, valid: boolean) => void): void; -} +export type DigestValidateFunction = ( + params: DigestValidateOptions, + done: (error: any, valid: boolean) => void, +) => any; -declare class BasicStrategy implements passport.Strategy { +export class BasicStrategy implements passport.Strategy { constructor(verify: BasicVerifyFunction); - constructor(options: BasicStrategyOptions, verify: BasicVerifyFunction); + constructor(options: BasicStrategyOptions, verify: BasicVerifyFunction); + constructor(options: BasicStrategyOptions, verify: BasicVerifyFunctionWithRequest); name: string; - authenticate: (req: express.Request, options?: Object) => void; + authenticate: (req: express.Request, options?: object) => void; } -declare class DigestStrategy implements passport.Strategy { +export class DigestStrategy implements passport.Strategy { constructor(secret: DigestSecretFunction, validate?: DigestValidateFunction); constructor(options: DigestStrategyOptions, secret: DigestSecretFunction, validate?: DigestValidateFunction); name: string; - authenticate: (req: express.Request, options?: Object) => void; + authenticate: (req: express.Request, options?: object) => void; } diff --git a/types/passport-http/passport-http-tests.ts b/types/passport-http/passport-http-tests.ts index 4a70d30b89..ee728b2d47 100644 --- a/types/passport-http/passport-http-tests.ts +++ b/types/passport-http/passport-http-tests.ts @@ -4,16 +4,17 @@ import passport = require("passport"); import http = require("passport-http"); +import express = require("express"); -interface IUser { +interface UserInterface { username: string; password?: string; } class User { - public password: string; + password: string; - static findOne(user: IUser, callback: (error: Error, user: User) => void): void { + static findOne(user: UserInterface, callback: (error: Error, user: User) => void): void { callback(null, new User()); } } @@ -24,17 +25,19 @@ function validateNonce(nonce: string) { function validateParams(nonce: string, cnonce: string, nc: number, opaque: string) { } -passport.use(new http.BasicStrategy((username: string, password: string, done: any) => { +passport.use(new http.BasicStrategy((username, password, done) => { User.findOne({ - username: username, - password: password, + username, + password, }, (error, user) => { if (error) { - return done(error); + done(error); + return; } if (!user) { - return done(null, false); + done(null, false); + return; } done(null, user); @@ -44,25 +47,25 @@ passport.use(new http.BasicStrategy((username: string, password: string, done: a passport.use(new http.BasicStrategy({ realm: "User", passReqToCallback: true, -}, (username: string, password: string, done: any) => { - User.findOne({ - username: username, - password: password, - }, (error, user) => { - if (error) { - return done(error); - } +}, (req: express.Request, username: string, password: string, done: (error: any, user?: any) => void) => { + // with req when needed +})); - if (!user) { - return done(null, false); - } +passport.use(new http.BasicStrategy({ + realm: "User", +}, (username, password, done) => { + // without req by default +})); - done(null, user); - }); +passport.use(new http.BasicStrategy({ + realm: "User", + passReqToCallback: false, +}, (username, password, done) => { + // without req })); passport.use(new http.DigestStrategy((username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } @@ -76,7 +79,7 @@ passport.use(new http.DigestStrategy((username: string, done: any) => { })); passport.use(new http.DigestStrategy((username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } @@ -99,7 +102,7 @@ passport.use(new http.DigestStrategy({ algorithm: "MD5", qop: "auth", }, (username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } @@ -119,7 +122,7 @@ passport.use(new http.DigestStrategy({ algorithm: "MD5", qop: "auth", }, (username: string, done: any) => { - User.findOne({username: username}, (error, user) => { + User.findOne({ username }, (error, user) => { if (error) { return done(error); } diff --git a/types/passport-http/tslint.json b/types/passport-http/tslint.json index a41bf5d19a..f93cf8562a 100644 --- a/types/passport-http/tslint.json +++ b/types/passport-http/tslint.json @@ -1,79 +1,3 @@ { - "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 - } + "extends": "dtslint/dt.json" } diff --git a/types/passport-kakao/tsconfig.json b/types/passport-kakao/tsconfig.json index 784cbe32e8..6240d3f149 100644 --- a/types/passport-kakao/tsconfig.json +++ b/types/passport-kakao/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "passport-kakao-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/passport-local-mongoose/passport-local-mongoose-tests.ts b/types/passport-local-mongoose/passport-local-mongoose-tests.ts index 63c82a9913..5058cb88ef 100644 --- a/types/passport-local-mongoose/passport-local-mongoose-tests.ts +++ b/types/passport-local-mongoose/passport-local-mongoose-tests.ts @@ -1,5 +1,3 @@ -/// - /** * Created by Linus Brolin . */ @@ -14,7 +12,7 @@ import { PassportLocalOptions, PassportLocalErrorMessages } from 'mongoose'; -import * as passportLocalMongoose from 'passport-local-mongoose'; +import passportLocalMongoose = require('passport-local-mongoose'); import { Router, Request, Response } from 'express'; import * as passport from 'passport'; diff --git a/types/passport-naver/tsconfig.json b/types/passport-naver/tsconfig.json index 1a8826dcfd..3412d6be4a 100644 --- a/types/passport-naver/tsconfig.json +++ b/types/passport-naver/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "passport-naver-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/passport/passport-tests.ts b/types/passport/passport-tests.ts index b6c033b907..58c306964c 100644 --- a/types/passport/passport-tests.ts +++ b/types/passport/passport-tests.ts @@ -1,5 +1,5 @@ import * as passport from 'passport'; -import * as express from 'express'; +import express = require('express'); import 'express-session'; class TestStrategy implements passport.Strategy { diff --git a/types/password-hash-and-salt/password-hash-and-salt-tests.ts b/types/password-hash-and-salt/password-hash-and-salt-tests.ts index 4865cf0eed..f224074555 100644 --- a/types/password-hash-and-salt/password-hash-and-salt-tests.ts +++ b/types/password-hash-and-salt/password-hash-and-salt-tests.ts @@ -1,4 +1,4 @@ -import * as password from 'password-hash-and-salt'; +import password = require('password-hash-and-salt'); const myuser: { hash: string } = { hash: '' }; diff --git a/types/path-parse/path-parse-tests.ts b/types/path-parse/path-parse-tests.ts index da2b63f6b4..a632d768f1 100644 --- a/types/path-parse/path-parse-tests.ts +++ b/types/path-parse/path-parse-tests.ts @@ -1,4 +1,4 @@ -import * as parse from "path-parse"; +import parse = require("path-parse"); const parsed = parse("/foo/bar.img"); const { root, dir, base, ext, name } = parsed; diff --git a/types/pathwatcher/tsconfig.json b/types/pathwatcher/tsconfig.json index 41bb35a03c..f63edaf188 100644 --- a/types/pathwatcher/tsconfig.json +++ b/types/pathwatcher/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pathwatcher-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pdfjs-dist/index.d.ts b/types/pdfjs-dist/index.d.ts index f72d70f44e..81de4624f9 100644 --- a/types/pdfjs-dist/index.d.ts +++ b/types/pdfjs-dist/index.d.ts @@ -26,466 +26,462 @@ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -declare module "pdfjs-dist" { - export = PDF; + +interface PDFPromise { + isResolved(): boolean; + isRejected(): boolean; + resolve(value: T): void; + reject(reason: string): void; + then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; } -declare namespace PDF { - interface PDFPromise { - isResolved(): boolean; - isRejected(): boolean; - resolve(value: T): void; - reject(reason: string): void; - then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): PDFPromise; - } - - interface PDFTreeNode { - title: string; - bold: boolean; - italic: boolean; - color: number[]; // [r,g,b] - dest: any; - items: PDFTreeNode[]; - } - - interface PDFInfo { - PDFFormatVersion: string; - IsAcroFormPresent: boolean; - IsXFAPresent: boolean; - [key: string]: any; // return type is string, typescript chokes - } - - interface PDFMetadata { - parse(): void; - get(name: string): string; - has(name: string): boolean; - } - - interface PDFSource { - url?: string; - data?: Uint8Array; - httpHeaders?: any; - password?: string; - } - - interface PDFProgressData { - loaded: number; - total: number; - } - - interface PDFDocumentProxy { - - /** - * Total number of pages the PDF contains. - **/ - numPages: number; - - /** - * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] - **/ - fingerprint: string; - - /** - * True if embedded document fonts are in use. Will be set during rendering of the pages. - **/ - embeddedFontsUsed(): boolean; - - /** - * @param number The page number to get. The first page is 1. - * @return A promise that is resolved with a PDFPageProxy. - **/ - getPage(number: number): PDFPromise; - - /** - * TODO: return type of Promise - * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. - **/ - getDestinations(): PDFPromise; - - /** - * A promise that is resolved with an array of all the JavaScript strings in the name tree. - **/ - getJavaScript(): PDFPromise; - - /** - * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode - **/ - getOutline(): PDFPromise; - - /** - * A promise that is resolved with the info and metadata of the PDF. - **/ - getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; - - /** - * Is the PDF encrypted? - **/ - isEncrypted(): PDFPromise; - - /** - * A promise that is resolved with Uint8Array that has the raw PDF data. - **/ - getData(): PDFPromise; - - /** - * TODO: return type of Promise - * A promise that is resolved when the document's data is loaded. - **/ - dataLoaded(): PDFPromise; - - /** - * - **/ - destroy(): void; - } - - interface PDFRef { - num: number; - gen: any; // todo - } - - interface PDFPageViewportOptions { - viewBox: any; - scale: number; - rotation: number; - offsetX: number; - offsetY: number; - dontFlip: boolean; - } - - interface PDFPageViewport { - width: number; - height: number; - fontScale: number; - transforms: number[]; - - clone(options: PDFPageViewportOptions): PDFPageViewport; - convertToViewportPoint(x: number, y: number): number[]; // [x, y] - convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] - convertToPdfPoint(x: number, y: number): number[]; // [x, y] - } - - interface PDFAnnotationData { - subtype: string; - rect: number[]; // [x1, y1, x2, y2] - annotationFlags: any; // todo - color: number[]; // [r,g,b] - borderWidth: number; - hasAppearance: boolean; - } - - interface PDFAnnotations { - getData(): PDFAnnotationData; - hasHtml(): boolean; // always false - getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() - getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated - isViewable(): boolean; - loadResources(keys: any): PDFPromise; - getOperatorList(evaluator: any): PDFPromise; - // ... todo - } - - interface PDFRenderTextLayer { - beginLayout(): void; - endLayout(): void; - appendText(): void; - } - - interface PDFRenderImageLayer { - beginLayout(): void; - endLayout(): void; - appendImage(): void; - } - - interface PDFRenderParams { - canvasContext: CanvasRenderingContext2D; - viewport?: PDFPageViewport; - textLayer?: PDFRenderTextLayer; - imageLayer?: PDFRenderImageLayer; - continueCallback?: (_continue: () => void) => void; - } - - interface PDFViewerParams { - container: HTMLElement; - viewer?: HTMLElement; - } - - /** - * RenderTask is basically a promise but adds a cancel function to termiate it. +interface PDFTreeNode { + title: string; + bold: boolean; + italic: boolean; + color: number[]; // [r,g,b] + dest: any; + items: PDFTreeNode[]; +} + +interface PDFInfo { + PDFFormatVersion: string; + IsAcroFormPresent: boolean; + IsXFAPresent: boolean; + [key: string]: any; // return type is string, typescript chokes +} + +interface PDFMetadata { + parse(): void; + get(name: string): string; + has(name: string): boolean; +} + +interface PDFSource { + url?: string; + data?: Uint8Array; + httpHeaders?: any; + password?: string; +} + +interface PDFProgressData { + loaded: number; + total: number; +} + +interface PDFDocumentProxy { + + /** + * Total number of pages the PDF contains. + **/ + numPages: number; + + /** + * A unique ID to identify a PDF. Not guaranteed to be unique. [jbaldwin: haha what] + **/ + fingerprint: string; + + /** + * True if embedded document fonts are in use. Will be set during rendering of the pages. + **/ + embeddedFontsUsed(): boolean; + + /** + * @param number The page number to get. The first page is 1. + * @return A promise that is resolved with a PDFPageProxy. + **/ + getPage(number: number): PDFPromise; + + /** + * TODO: return type of Promise + * A promise that is resolved with a lookup table for mapping named destinations to reference numbers. + **/ + getDestinations(): PDFPromise; + + /** + * A promise that is resolved with an array of all the JavaScript strings in the name tree. + **/ + getJavaScript(): PDFPromise; + + /** + * A promise that is resolved with an array that is a tree outline (if it has one) of the PDF. @see PDFTreeNode + **/ + getOutline(): PDFPromise; + + /** + * A promise that is resolved with the info and metadata of the PDF. + **/ + getMetadata(): PDFPromise<{ info: PDFInfo; metadata: PDFMetadata }>; + + /** + * Is the PDF encrypted? + **/ + isEncrypted(): PDFPromise; + + /** + * A promise that is resolved with Uint8Array that has the raw PDF data. + **/ + getData(): PDFPromise; + + /** + * TODO: return type of Promise + * A promise that is resolved when the document's data is loaded. + **/ + dataLoaded(): PDFPromise; + + /** + * + **/ + destroy(): void; +} + +interface PDFRef { + num: number; + gen: any; // todo +} + +interface PDFPageViewportOptions { + viewBox: any; + scale: number; + rotation: number; + offsetX: number; + offsetY: number; + dontFlip: boolean; +} + +interface PDFPageViewport { + width: number; + height: number; + fontScale: number; + transforms: number[]; + + clone(options: PDFPageViewportOptions): PDFPageViewport; + convertToViewportPoint(x: number, y: number): number[]; // [x, y] + convertToViewportRectangle(rect: number[]): number[]; // [x1, y1, x2, y2] + convertToPdfPoint(x: number, y: number): number[]; // [x, y] +} + +interface PDFAnnotationData { + subtype: string; + rect: number[]; // [x1, y1, x2, y2] + annotationFlags: any; // todo + color: number[]; // [r,g,b] + borderWidth: number; + hasAppearance: boolean; +} + +interface PDFAnnotations { + getData(): PDFAnnotationData; + hasHtml(): boolean; // always false + getHtmlElement(commonOjbs: any): HTMLElement; // throw new NotImplementedException() + getEmptyContainer(tagName: string, rect: number[]): HTMLElement; // deprecated + isViewable(): boolean; + loadResources(keys: any): PDFPromise; + getOperatorList(evaluator: any): PDFPromise; + // ... todo +} + +interface PDFRenderTextLayer { + beginLayout(): void; + endLayout(): void; + appendText(): void; +} + +interface PDFRenderImageLayer { + beginLayout(): void; + endLayout(): void; + appendImage(): void; +} + +interface PDFRenderParams { + canvasContext: CanvasRenderingContext2D; + viewport?: PDFPageViewport; + textLayer?: PDFRenderTextLayer; + imageLayer?: PDFRenderImageLayer; + continueCallback?: (_continue: () => void) => void; +} + +interface PDFViewerParams { + container: HTMLElement; + viewer?: HTMLElement; +} + +/** + * RenderTask is basically a promise but adds a cancel function to termiate it. + **/ +interface PDFRenderTask extends PDFPromise { + + /** + * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. + **/ + cancel(): void; +} + +interface PDFPageProxy { + + /** + * Page number of the page. First page is 1. + **/ + pageNumber: number; + + /** + * The number of degrees the page is rotated clockwise. + **/ + rotate: number; + + /** + * The reference that points to this page. + **/ + ref: PDFRef; + + /** + * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. + **/ + view: number[]; + + /** + * @param scale The desired scale of the viewport. + * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. + * @return + **/ + getViewport(scale: number, rotate?: number): PDFPageViewport; + + /** + * A promise that is resolved with an array of the annotation objects. + **/ + getAnnotations(): PDFPromise; + + /** + * Begins the process of rendering a page to the desired context. + * @param params Rendering options. + * @return An extended promise that is resolved when the page finishes rendering. **/ - interface PDFRenderTask extends PDFPromise { - - /** - * Cancel the rendering task. If the task is currently rendering it will not be cancelled until graphics pauses with a timeout. The promise that this object extends will resolve when cancelled. - **/ - cancel(): void; - } - - interface PDFPageProxy { - - /** - * Page number of the page. First page is 1. - **/ - pageNumber: number; - - /** - * The number of degrees the page is rotated clockwise. - **/ - rotate: number; - - /** - * The reference that points to this page. - **/ - ref: PDFRef; - - /** - * @return An array of the visible portion of the PDF page in the user space units - [x1, y1, x2, y2]. - **/ - view: number[]; - - /** - * @param scale The desired scale of the viewport. - * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. - * @return - **/ - getViewport(scale: number, rotate?: number): PDFPageViewport; - - /** - * A promise that is resolved with an array of the annotation objects. - **/ - getAnnotations(): PDFPromise; - - /** - * Begins the process of rendering a page to the desired context. - * @param params Rendering options. - * @return An extended promise that is resolved when the page finishes rendering. - **/ - render(params: PDFRenderParams): PDFRenderTask; - - /** - * A promise that is resolved with the string that is the text content frm the page. - **/ - getTextContent(): PDFPromise; - - /** - * marked as future feature - **/ - //getOperationList(): PDFPromise<>; - - /** - * Destroyes resources allocated by the page. - **/ - destroy(): void; - } - - interface TextContentItem { - str: string; - transform: number[]; // [0..5] 4=x, 5=y - width: number; - height: number; - dir: string; // Left-to-right (ltr), etc - fontName: string; // A lookup into the styles map of the owning TextContent - } - - interface TextContent { - items: TextContentItem[]; - styles: any; - } - - /** - * A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. + render(params: PDFRenderParams): PDFRenderTask; + + /** + * A promise that is resolved with the string that is the text content frm the page. + **/ + getTextContent(): PDFPromise; + + /** + * marked as future feature + **/ + //getOperationList(): PDFPromise<>; + + /** + * Destroyes resources allocated by the page. + **/ + destroy(): void; +} + +interface TextContentItem { + str: string; + transform: number[]; // [0..5] 4=x, 5=y + width: number; + height: number; + dir: string; // Left-to-right (ltr), etc + fontName: string; // A lookup into the styles map of the owning TextContent +} + +interface TextContent { + items: TextContentItem[]; + styles: any; +} + +/** + * A PDF document and page is built of many objects. E.g. there are objects for fonts, images, rendering code and such. These objects might get processed inside of a worker. The `PDFObjects` implements some basic functions to manage these objects. + **/ +interface PDFObjects { + get(objId: number, callback?: any): any; + resolve(objId: number, data: any): any; + isResolved(objId: number): boolean; + hasData(objId: number): boolean; + getData(objId: number): any; + clear(): void; +} + +interface PDFJSUtilStatic { + /** + * Normalize rectangle so that (x1,y1) < (x2,y2) + * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] + * + * For coordinate systems whose origin lies in the bottom-left, this + * means normalization to (BL,TR) ordering. For systems with origin in the + * top-left, this means (TL,BR) ordering. + **/ + normalizeRect(rect:number[]): number[]; +} + +export const PDFJS: PDFJSStatic; + +interface PDFJSStatic { + /** + * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. + **/ + maxImageSize: number; + + /** + * The url of where the predefined Adobe CMaps are located. Include trailing + * slash. + */ + cMapUrl: string; + + /** + * Specifies if CMaps are binary packed. + */ + cMapPacked: boolean; + + /** + * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. + **/ + disableFontFace: boolean; + + /** + * Path for image resources, mainly for annotation icons. Include trailing + * slash. + */ + imageResourcesPath: string; + + /** + * Disable the web worker and run all code on the main thread. This will happen + * automatically if the browser doesn't support workers or sending typed arrays + * to workers. + */ + disableWorker: boolean; + + /** + * Path and filename of the worker file. Required when the worker is enabled in + * development mode. If unspecified in the production build, the worker will be + * loaded based on the location of the pdf.js file. + */ + workerSrc: string; + + /** + * Disable range request loading of PDF files. When enabled and if the server + * supports partial content requests then the PDF will be fetched in chunks. + * Enabled (false) by default. + */ + disableRange: boolean; + + /** + * Disable streaming of PDF file data. By default PDF.js attempts to load PDF + * in chunks. This default behavior can be disabled. + */ + disableStream: boolean; + + /** + * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js + * will automatically keep fetching more data even if it isn't needed to display + * the current page. This default behavior can be disabled. + * + * NOTE: It is also necessary to disable streaming, see above, + * in order for disabling of pre-fetching to work correctly. + */ + disableAutoFetch: boolean; + + /** + * Enables special hooks for debugging PDF.js. + */ + pdfBug: boolean; + + /** + * Enables transfer usage in postMessage for ArrayBuffers. + */ + postMessageTransfers: boolean; + + /** + * Disables URL.createObjectURL usage. + */ + disableCreateObjectURL: boolean; + + /** + * Disables WebGL usage. + */ + disableWebGL: boolean; + + /** + * Disables fullscreen support, and by extension Presentation Mode, + * in browsers which support the fullscreen API. + */ + disableFullscreen: boolean; + + /** + * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements + * + */ + disableTextLayer: boolean; + + /** + * Enables CSS only zooming. + */ + useOnlyCssZoom: boolean; + + /** + * Controls the logging level. + * The constants from PDFJS.VERBOSITY_LEVELS should be used: + * - errors + * - warnings [default] + * - infos + */ + verbosity: number; + + /** + * The maximum supported canvas size in total pixels e.g. width * height. + * The default value is 4096 * 4096. Use -1 for no limit. + */ + maxCanvasPixels: number; + + /** + * Opens external links in a new window if enabled. The default behavior opens + * external links in the PDF.js window. + */ + openExternalLinksInNewWindow: boolean; + + /** + * Determines if we can eval strings as JS. Primarily used to improve + * performance for font rendering. + */ + isEvalSupported: boolean; + + Util: PDFJSUtilStatic; + + /** + * This is the main entry point for loading a PDF and interacting with it. + * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) + * is used, which means it must follow the same origin rules that any XHR does + * e.g. No corss domain requests without CORS. + * @param source + * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. + * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. + * @param progressCallback Progress callback. + * @return A promise that is resolved with PDFDocumentProxy object. **/ - interface PDFObjects { - get(objId: number, callback?: any): any; - resolve(objId: number, data: any): any; - isResolved(objId: number): boolean; - hasData(objId: number): boolean; - getData(objId: number): any; - clear(): void; - } - - interface PDFJSUtilStatic { - /** - * Normalize rectangle so that (x1,y1) < (x2,y2) - * @param {number[]} rect - the rectangle with [x1,y1,x2,y2] - * - * For coordinate systems whose origin lies in the bottom-left, this - * means normalization to (BL,TR) ordering. For systems with origin in the - * top-left, this means (TL,BR) ordering. - **/ - normalizeRect(rect:number[]): number[]; - } - - interface PDFJSStatic { - - /** - * The maximum allowed image size in total pixels e.g. width * height. Images above this value will not be drawn. Use -1 for no limit. - **/ - maxImageSize: number; - - /** - * The url of where the predefined Adobe CMaps are located. Include trailing - * slash. - */ - cMapUrl: string; - - /** - * Specifies if CMaps are binary packed. - */ - cMapPacked: boolean; - - /** - * By default fonts are converted to OpenType fonts and loaded via font face rules. If disabled, the font will be rendered using a built in font renderer that constructs the glyphs with primitive path commands. - **/ - disableFontFace: boolean; - - /** - * Path for image resources, mainly for annotation icons. Include trailing - * slash. - */ - imageResourcesPath: string; - - /** - * Disable the web worker and run all code on the main thread. This will happen - * automatically if the browser doesn't support workers or sending typed arrays - * to workers. - */ - disableWorker: boolean; - - /** - * Path and filename of the worker file. Required when the worker is enabled in - * development mode. If unspecified in the production build, the worker will be - * loaded based on the location of the pdf.js file. - */ - workerSrc: string; - - /** - * Disable range request loading of PDF files. When enabled and if the server - * supports partial content requests then the PDF will be fetched in chunks. - * Enabled (false) by default. - */ - disableRange: boolean; - - /** - * Disable streaming of PDF file data. By default PDF.js attempts to load PDF - * in chunks. This default behavior can be disabled. - */ - disableStream: boolean; - - /** - * Disable pre-fetching of PDF file data. When range requests are enabled PDF.js - * will automatically keep fetching more data even if it isn't needed to display - * the current page. This default behavior can be disabled. - * - * NOTE: It is also necessary to disable streaming, see above, - * in order for disabling of pre-fetching to work correctly. - */ - disableAutoFetch: boolean; - - /** - * Enables special hooks for debugging PDF.js. - */ - pdfBug: boolean; - - /** - * Enables transfer usage in postMessage for ArrayBuffers. - */ - postMessageTransfers: boolean; - - /** - * Disables URL.createObjectURL usage. - */ - disableCreateObjectURL: boolean; - - /** - * Disables WebGL usage. - */ - disableWebGL: boolean; - - /** - * Disables fullscreen support, and by extension Presentation Mode, - * in browsers which support the fullscreen API. - */ - disableFullscreen: boolean; - - /** - * Disable the text layer of PDF when used PDF.js renders a canvas instead of div elements - * - */ - disableTextLayer: boolean; - - /** - * Enables CSS only zooming. - */ - useOnlyCssZoom: boolean; - - /** - * Controls the logging level. - * The constants from PDFJS.VERBOSITY_LEVELS should be used: - * - errors - * - warnings [default] - * - infos - */ - verbosity: number; - - /** - * The maximum supported canvas size in total pixels e.g. width * height. - * The default value is 4096 * 4096. Use -1 for no limit. - */ - maxCanvasPixels: number; - - /** - * Opens external links in a new window if enabled. The default behavior opens - * external links in the PDF.js window. - */ - openExternalLinksInNewWindow: boolean; - - /** - * Determines if we can eval strings as JS. Primarily used to improve - * performance for font rendering. - */ - isEvalSupported: boolean; - - Util: PDFJSUtilStatic; - - /** - * This is the main entry point for loading a PDF and interacting with it. - * NOTE: If a URL is used to fetch the PDF data a standard XMLHttpRequest(XHR) - * is used, which means it must follow the same origin rules that any XHR does - * e.g. No corss domain requests without CORS. - * @param source - * @param pdfDataRangeTransport Used if you want to manually server range requests for data in the PDF. @ee viewer.js for an example of pdfDataRangeTransport's interface. - * @param passwordCallback Used to request a password if wrong or no password was provided. The callback receives two parameters: function that needs to be called with new password and the reason. - * @param progressCallback Progress callback. - * @return A promise that is resolved with PDFDocumentProxy object. - **/ - getDocument( - source: string, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: Uint8Array, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - getDocument( - source: PDFSource, - pdfDataRangeTransport?: any, - passwordCallback?: (fn: (password: string) => void, reason: string) => string, - progressCallback?: (progressData: PDFProgressData) => void) - : PDFPromise; - - PDFViewer(params: PDFViewerParams): void; - /** - * yet another viewer, this will render only one page at the time, reducing rendering time - * very important for mobile development - * @params {PDFViewerParams} - */ - PDFSinglePageViewer(params: PDFViewerParams): void; - } + getDocument( + source: string, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; + + getDocument( + source: Uint8Array, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; + + getDocument( + source: PDFSource, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void) + : PDFPromise; + + PDFViewer(params: PDFViewerParams): void; + /** + * yet another viewer, this will render only one page at the time, reducing rendering time + * very important for mobile development + * @params {PDFViewerParams} + */ + PDFSinglePageViewer(params: PDFViewerParams): void; } diff --git a/types/pdfjs-dist/pdfjs-dist-tests.ts b/types/pdfjs-dist/pdfjs-dist-tests.ts index cd2325975a..ef569b2fda 100644 --- a/types/pdfjs-dist/pdfjs-dist-tests.ts +++ b/types/pdfjs-dist/pdfjs-dist-tests.ts @@ -1,11 +1,10 @@ -import { PDFJSStatic, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; +import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; // // Fetch the PDF document from the URL using promises // var pdfDoc: PDFDocumentProxy; var pageNum: number; -var PDFJS: PDFJSStatic; PDFJS.getDocument('helloworld.pdf').then(function (pdf) { // Using promise to fetch the page @@ -26,7 +25,7 @@ function renderPage(pageNum: number) { var context = canvas.getContext('2d'); canvas.height = viewport.height; canvas.width = viewport.width; - + // // test viewport conversion methods // convertToViewportRectangle and normalizeRect are used in the acroforms example: diff --git a/types/peer-dial/peer-dial-tests.ts b/types/peer-dial/peer-dial-tests.ts index cb4238da62..6cc4376458 100644 --- a/types/peer-dial/peer-dial-tests.ts +++ b/types/peer-dial/peer-dial-tests.ts @@ -1,5 +1,5 @@ import { Server, Client, App, AppInfo, CorsOptions, ServerOptions, Delegate, DialDevice, DeviceInfo } from 'peer-dial'; -import * as express from 'express'; +import express = require('express'); class AppImpl implements App { name: string; diff --git a/types/pg-escape/pg-escape-tests.ts b/types/pg-escape/pg-escape-tests.ts index 36636cf0c2..87d70dbd9f 100644 --- a/types/pg-escape/pg-escape-tests.ts +++ b/types/pg-escape/pg-escape-tests.ts @@ -1,4 +1,4 @@ -import * as escape from 'pg-escape'; +import escape = require('pg-escape'); escape('INSERT INTO %I VALUES(%L)', 'books', "O'Reilly"); escape.string("ab'cd"); diff --git a/types/pg-query-stream/pg-query-stream-tests.ts b/types/pg-query-stream/pg-query-stream-tests.ts index 1df78ea648..49a2f41b0b 100644 --- a/types/pg-query-stream/pg-query-stream-tests.ts +++ b/types/pg-query-stream/pg-query-stream-tests.ts @@ -1,4 +1,4 @@ -import * as QueryStream from 'pg-query-stream'; +import QueryStream = require('pg-query-stream'); import * as pg from 'pg'; const options: QueryStream.Options = { @@ -12,7 +12,7 @@ const pool = new pg.Pool(); pool.connect((err, client, done) => { const stream = client.query(query); stream.on('end', () => { - client.end(); + client.release(); }); stream.on('data', (data: any) => { console.log(data); diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 9f945082cd..b2b8af73e5 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -33,21 +33,24 @@ export interface ClientConfig extends ConnectionConfig { } export interface PoolConfig extends ClientConfig { - // properties from module 'node-pool' - max?: number; - min?: number; - connectionTimeoutMillis?: number; - idleTimeoutMillis?: number; + // properties from module 'node-pool' + max?: number; + min?: number; + connectionTimeoutMillis?: number; + idleTimeoutMillis?: number; - application_name?: string; - Promise?: PromiseConstructorLike; + application_name?: string; + Promise?: PromiseConstructorLike; } export interface QueryConfig { name?: string; text: string; values?: any[]; - rowMode?: string; +} + +export interface QueryArrayConfig extends QueryConfig { + rowMode: 'array'; } export interface QueryResult { @@ -57,6 +60,24 @@ export interface QueryResult { rows: any[]; } +export interface FieldDef { + name: string; + tableID: number; + columnID: number; + dataTypeID: number; + dataTypeSize: number; + dataTypeModifier: number; + format: string; +} + +export interface QueryArrayResult { + command: string; + rowCount: number; + oid: number; + rows: any[][]; + fields: FieldDef[]; +} + export interface Notification { processId: number; channel: string; @@ -77,36 +98,35 @@ export class Pool extends events.EventEmitter { readonly idleCount: number; readonly waitingCount: number; - connect(): Promise; - connect(callback: (err: Error, client: Client, done: () => void) => void): void; + connect(): Promise; + connect(callback: (err: Error, client: PoolClient, done: () => void) => void): void; end(): Promise; end(callback: () => void): void; query(queryStream: QueryConfig & stream.Readable): stream.Readable; + query(queryConfig: QueryArrayConfig): Promise; query(queryConfig: QueryConfig): Promise; query(queryText: string, values?: any[]): Promise; + query(queryConfig: QueryArrayConfig, callback: (err: Error, result: QueryArrayResult) => void): Query; query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; - on(event: "error", listener: (err: Error, client: Client) => void): this; - on(event: "connect" | "acquire", listener: (client: Client) => void): this; + on(event: "error", listener: (err: Error, client: PoolClient) => void): this; + on(event: "connect" | "acquire" | "remove", listener: (client: PoolClient) => void): this; } -export class Client extends events.EventEmitter { +export class ClientBase extends events.EventEmitter { constructor(config: string | ClientConfig); connect(): Promise; connect(callback: (err: Error) => void): void; - end(): Promise; - end(callback: (err: Error) => void): void; - - release(err?: Error): void; - query(queryStream: QueryConfig & stream.Readable): stream.Readable; + query(queryConfig: QueryArrayConfig): Promise; query(queryConfig: QueryConfig): Promise; query(queryText: string, values?: any[]): Promise; + query(queryConfig: QueryArrayConfig, callback: (err: Error, result: QueryArrayResult) => void): Query; query(queryTextOrConfig: string | QueryConfig, callback: (err: Error, result: QueryResult) => void): Query; query(queryText: string, values: any[], callback: (err: Error, result: QueryResult) => void): Query; @@ -126,6 +146,17 @@ export class Client extends events.EventEmitter { on(event: "end", listener: () => void): this; } +export class Client extends ClientBase { + constructor(config: string | ClientConfig); + + end(): Promise; + end(callback: (err: Error) => void): void; +} + +export interface PoolClient extends ClientBase { + release(err?: Error): void; +} + export class Query extends events.EventEmitter { on(event: "row", listener: (row: any, result?: ResultBuilder) => void): this; on(event: "error", listener: (err: Error) => void): this; diff --git a/types/pg/pg-tests.ts b/types/pg/pg-tests.ts index 1f1e312544..b9b3f80d4e 100644 --- a/types/pg/pg-tests.ts +++ b/types/pg/pg-tests.ts @@ -48,8 +48,7 @@ client.query('SELECT $1::text as name', ['brianc'], (err, res) => { const query = { name: 'get-name', text: 'SELECT $1::text', - values: ['brianc'], - rowMode: 'array' + values: ['brianc'] }; client.query(query, (err, res) => { if (err) { @@ -66,6 +65,33 @@ client.query(query) console.error(e.stack); }); +const queryArrMode: pg.QueryArrayConfig = { + name: 'get-name-array', + text: 'SELECT $1::text', + values: ['brianc'], + rowMode: 'array' +}; +client.query(queryArrMode, (err, res) => { + if (err) { + console.error(err.stack); + } else { + console.log(res.rows); + console.log(res.fields.map(f => f.name)); + } +}); +client.query(queryArrMode) + .then(res => { + console.log(res.rows); + console.log(res.fields.map(f => f.name)); + }) + .catch(e => { + console.error(e.stack); + }); +client.query({ + text: 'select 1', + rowMode: 'array', +}).then(res => console.log(res.fields[0])); + client.end((err) => { console.log('client has disconnected'); if (err) { @@ -107,6 +133,12 @@ pool.connect((err, client, done) => { }); }); +pool.connect().then(client => { + client.query({ text: 'SELECT $1::int AS number', values: ['1'], rowMode: 'array' }).then(result => { + console.log(result.rowCount, result.rows[0][0], result.fields[0].name); + }).then(() => client.release(), e => client.release(e)); +}); + pool.on('error', (err, client) => { console.error('idle client error', err.message, err.stack); }); diff --git a/types/pg/v6/index.d.ts b/types/pg/v6/index.d.ts index 5624989ac7..150dad74fa 100644 --- a/types/pg/v6/index.d.ts +++ b/types/pg/v6/index.d.ts @@ -36,15 +36,15 @@ export interface ClientConfig extends ConnectionConfig { } export interface PoolConfig extends ClientConfig { - // properties from module 'node-pool' - max?: number; - min?: number; - refreshIdle?: boolean; - idleTimeoutMillis?: number; - reapIntervalMillis?: number; - returnToHead?: boolean; - application_name?: string; - Promise?: PromiseConstructorLike; + // properties from module 'node-pool' + max?: number; + min?: number; + refreshIdle?: boolean; + idleTimeoutMillis?: number; + reapIntervalMillis?: number; + returnToHead?: boolean; + application_name?: string; + Promise?: PromiseConstructorLike; } export interface QueryConfig { diff --git a/types/photoswipe/photoswipe-tests.ts b/types/photoswipe/photoswipe-tests.ts index 05cdb5db53..48add333c5 100644 --- a/types/photoswipe/photoswipe-tests.ts +++ b/types/photoswipe/photoswipe-tests.ts @@ -1,5 +1,5 @@ -import * as PhotoSwipeUI_Default from './dist/photoswipe-ui-default/index'; -import * as PhotoSwipe from './index'; +import PhotoSwipeUI_Default = require('./dist/photoswipe-ui-default/index'); +import PhotoSwipe = require('./index'); function test_defaultUI() { var items: PhotoSwipeUI_Default.Item[] = [ diff --git a/types/pick-weight/pick-weight-tests.ts b/types/pick-weight/pick-weight-tests.ts index 5707b1c598..a7b35e7e37 100644 --- a/types/pick-weight/pick-weight-tests.ts +++ b/types/pick-weight/pick-weight-tests.ts @@ -1,4 +1,4 @@ -import * as weight from "pick-weight"; +import weight = require("pick-weight"); const x = weight(["a", "b", "c"], [1, 2, 3]); diff --git a/types/pify/pify-tests.ts b/types/pify/pify-tests.ts index f77eb9f10d..27022b7390 100644 --- a/types/pify/pify-tests.ts +++ b/types/pify/pify-tests.ts @@ -1,4 +1,4 @@ -import * as pify from 'pify'; +import pify = require('pify'); function assert(actual: string, expected: string): void { if (actual !== expected) { diff --git a/types/pikaday-time/pikaday-time-tests.ts b/types/pikaday-time/pikaday-time-tests.ts index fec72dc553..6ae7f82406 100644 --- a/types/pikaday-time/pikaday-time-tests.ts +++ b/types/pikaday-time/pikaday-time-tests.ts @@ -1,7 +1,7 @@ /// -import * as Pikaday from "pikaday-time"; -import * as moment from "moment"; +import Pikaday = require("pikaday-time"); +import moment = require("moment"); new Pikaday({field: document.getElementById('datepicker')}); new Pikaday({field: $('#datepicker')[0]}); diff --git a/types/pikaday/pikaday-tests.ts b/types/pikaday/pikaday-tests.ts index 9084455622..e61cb635e3 100644 --- a/types/pikaday/pikaday-tests.ts +++ b/types/pikaday/pikaday-tests.ts @@ -1,7 +1,7 @@ /// -import * as Pikaday from "pikaday"; -import * as moment from "moment"; +import Pikaday = require("pikaday"); +import moment = require("moment"); new Pikaday({field: document.getElementById('datepicker')}); new Pikaday({field: $('#datepicker')[0]}); diff --git a/types/pino-multi-stream/pino-multi-stream-tests.ts b/types/pino-multi-stream/pino-multi-stream-tests.ts index d9d0899256..dc48ed3bd4 100644 --- a/types/pino-multi-stream/pino-multi-stream-tests.ts +++ b/types/pino-multi-stream/pino-multi-stream-tests.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; -import * as pino from 'pino'; -import * as pinoms from 'pino-multi-stream'; +import pino = require('pino'); +import pinoms = require('pino-multi-stream'); const streams: pinoms.Streams = [ { stream: process.stdout }, // an "info" level destination stream diff --git a/types/pino-multi-stream/tsconfig.json b/types/pino-multi-stream/tsconfig.json index 7a060abb2e..df16842f19 100644 --- a/types/pino-multi-stream/tsconfig.json +++ b/types/pino-multi-stream/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pino-multi-stream-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pixelmatch/tsconfig.json b/types/pixelmatch/tsconfig.json index 02115e3fdc..ef11da582a 100644 --- a/types/pixelmatch/tsconfig.json +++ b/types/pixelmatch/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pixelmatch-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pixi.js/index.d.ts b/types/pixi.js/index.d.ts index 6d7dfaf351..f75bb4a1ca 100644 --- a/types/pixi.js/index.d.ts +++ b/types/pixi.js/index.d.ts @@ -329,7 +329,7 @@ declare namespace PIXI { renderable: boolean; parent: Container; worldAlpha: number; - filterArea: Rectangle; + filterArea: Rectangle | null; protected _filters: Array> | null; protected _enabledFilters: Array> | null; protected _bounds: Bounds; @@ -337,7 +337,7 @@ declare namespace PIXI { protected _lastBoundsID: number; protected _boundsRect: Rectangle; protected _localBoundsRect: Rectangle; - protected _mask: PIXI.Graphics | PIXI.Sprite; + protected _mask: PIXI.Graphics | PIXI.Sprite | null; protected readonly _destroyed: boolean; x: number; y: number; @@ -349,7 +349,7 @@ declare namespace PIXI { skew: ObservablePoint; rotation: number; worldVisible: boolean; - mask: PIXI.Graphics | PIXI.Sprite; + mask: PIXI.Graphics | PIXI.Sprite | null; filters: Array> | null; updateTransform(): void; @@ -509,8 +509,8 @@ declare namespace PIXI { updateLocalBounds(): void; drawShape(shape: Circle | Rectangle | Ellipse | Polygon | RoundedRectangle | any): GraphicsData; generateCanvasTexture(scaleMode?: number, resolution?: number): Texture; - protected closePath(): Graphics; - protected addHole(): Graphics; + closePath(): Graphics; + addHole(): Graphics; destroy(options?: DestroyOptions | boolean): void; } class CanvasGraphicsRenderer { diff --git a/types/pkg-dir/tsconfig.json b/types/pkg-dir/tsconfig.json index 2701860736..a5647ed0eb 100644 --- a/types/pkg-dir/tsconfig.json +++ b/types/pkg-dir/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pkg-dir-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/playcanvas/engine/asset/asset-registry.d.ts b/types/playcanvas/engine/asset/asset-registry.d.ts index 7e03744ef2..47dede11a3 100644 --- a/types/playcanvas/engine/asset/asset-registry.d.ts +++ b/types/playcanvas/engine/asset/asset-registry.d.ts @@ -11,6 +11,8 @@ declare namespace pc { class AssetRegistry { constructor(loader: pc.ResourceLoader) + prefix: string; + /** * @function * @name pc.AssetRegistry#list @@ -164,4 +166,4 @@ declare namespace pc { */ find(name: string, type?: string): pc.Asset; } -} \ No newline at end of file +} diff --git a/types/playcanvas/engine/framework/application.d.ts b/types/playcanvas/engine/framework/application.d.ts index ae52a6cea3..404ce2e71f 100644 --- a/types/playcanvas/engine/framework/application.d.ts +++ b/types/playcanvas/engine/framework/application.d.ts @@ -206,6 +206,25 @@ declare namespace pc { */ loadSceneSettings(url: string, callback: (...args: any[]) => {}): void; + /** + * @function + * @name pc.Application#loadScene + * @description Load a scene file. + * @param {String} url The URL of the scene file. Usually this will be "scene_id.json" + * @param {Function} callback The function to call after loading, passed (err, entity) where err is null if no errors occurred. + * @example + * + * app.loadScene("1000.json", function (err, entity) { + * if (!err) { + * var e = app.root.find("My New Entity"); + * } else { + * // error + * } + * } + * }); + */ + loadScene(url: string, callback: (...args: any[]) => {}): void; + /** * @function * @name pc.Application#start diff --git a/types/playcanvas/tsconfig.json b/types/playcanvas/tsconfig.json index a2a2c895a0..ef89113006 100644 --- a/types/playcanvas/tsconfig.json +++ b/types/playcanvas/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "playcanvas-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/plotly.js/index.d.ts b/types/plotly.js/index.d.ts index 81286fe0a4..6e7c9a67bc 100644 --- a/types/plotly.js/index.d.ts +++ b/types/plotly.js/index.d.ts @@ -4,6 +4,7 @@ // Martin Duparc // Frederik Aalund // taoqf +// Dadstart // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -22,40 +23,54 @@ export interface Point { z: number; } +export interface PlotScatterDataPoint { + pointNumber: number; + curveNumber: number; + data: ScatterData; +} + +export interface PlotMouseEvent { + points: PlotScatterDataPoint[]; + event: MouseEvent; +} + +export interface PlotCoordinate { + x: number; + y: number; + pointNumber: number; +} + +export interface PlotSelectionEvent { + points: PlotCoordinate[]; +} + +export type PlotRestyleEvent = [ + any, // update object -- attribute updated: new value + number[] // array of traces updated +]; + +export interface PlotAxis { + range: [number, number]; + autorange: boolean; +} + +export interface PlotScene { + center: Point; + eye: Point; + up: Point; +} + +export interface PlotRelayoutEvent { + xaxis: PlotAxis; + yaxis: PlotAxis; + scene: PlotScene; +} + export interface PlotlyHTMLElement extends HTMLElement { - on(event: 'plotly_click' | 'plotly_hover' | 'plotly_unhover', callback: (data: { - points: Array<{ - pointNumber: number; - curveNumber: number; - data: ScatterData; - }>; - }) => void): void; - on(event: 'plotly_selecting' | 'plotly_selected', callback: (data: { - points: Array<{ - x: number; - y: number; - pointNumber: number; - }>; - }) => void): void; - on(event: 'plotly_restyle', callback: (data: [ - any, // update object -- attribute updated: new value - number[] // array of traces updated - ]) => void): void; - on(event: 'plotly_relayout', callback: (data: { - xaxis: { - range: [number, number]; - autorange: boolean; - }; - yaxis: { - range: [number, number]; - autorange: boolean; - }; - scene: { - center: Point; - eye: Point; - up: Point; - }; - }) => void): void; + on(event: 'plotly_click' | 'plotly_hover' | 'plotly_unhover', callback: (event: PlotMouseEvent) => void): void; + on(event: 'plotly_selecting' | 'plotly_selected', callback: (event: PlotSelectionEvent) => void): void; + on(event: 'plotly_restyle', callback: (data: PlotRestyleEvent) => void): void; + on(event: 'plotly_relayout', callback: (event: PlotRelayoutEvent) => void): void; // on(event: 'plotly_event', callback: (data: any) => void): void; on(event: 'plotly_afterplot' | 'plotly_autosize' | 'plotly_deselect' | 'plotly_doubleclick' | 'plotly_redraw' | 'plotly_animated', callback: () => void): void; } diff --git a/types/plugin-error/tsconfig.json b/types/plugin-error/tsconfig.json index ee9cd8e61f..9c57996e49 100644 --- a/types/plugin-error/tsconfig.json +++ b/types/plugin-error/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "plugin-error-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts b/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts index bacd6c4b7a..a966a3edb8 100644 --- a/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts +++ b/types/pouch-redux-middleware/pouch-redux-middleware-tests.ts @@ -1,6 +1,6 @@ import * as redux from 'redux'; import makePouchMiddleware, { Document, Path } from 'pouch-redux-middleware'; -import * as PouchDB from 'pouchdb'; +import PouchDB = require('pouchdb'); const types = { DELETE_TODO: 'delete-todo', diff --git a/types/pouchdb-core/pouchdb-core-tests.ts b/types/pouchdb-core/pouchdb-core-tests.ts index d050b4c6a6..79a151aa3a 100644 --- a/types/pouchdb-core/pouchdb-core-tests.ts +++ b/types/pouchdb-core/pouchdb-core-tests.ts @@ -1,4 +1,4 @@ -import * as PouchDB from 'pouchdb-core'; +import PouchDB = require('pouchdb-core'); function isString(someString: string) { } diff --git a/types/pouchdb/pouchdb-tests.ts b/types/pouchdb/pouchdb-tests.ts index c4b3d6870b..e5b9c356d4 100644 --- a/types/pouchdb/pouchdb-tests.ts +++ b/types/pouchdb/pouchdb-tests.ts @@ -1,4 +1,4 @@ -import * as PouchDB from 'pouchdb'; +import PouchDB = require('pouchdb'); function isString(someString: string) { } diff --git a/types/priorityqueuejs/priorityqueuejs-tests.ts b/types/priorityqueuejs/priorityqueuejs-tests.ts index 15e9211ea8..711e1faedf 100644 --- a/types/priorityqueuejs/priorityqueuejs-tests.ts +++ b/types/priorityqueuejs/priorityqueuejs-tests.ts @@ -1,4 +1,4 @@ -import * as PriorityQueue from 'priorityqueuejs'; +import PriorityQueue = require('priorityqueuejs'); var queue = new PriorityQueue<{ cash: number, name: string }>(function(a, b) { return a.cash - b.cash; diff --git a/types/proj4/proj4-tests.ts b/types/proj4/proj4-tests.ts index c5d549efe7..3d1ab1ab9b 100644 --- a/types/proj4/proj4-tests.ts +++ b/types/proj4/proj4-tests.ts @@ -1,4 +1,4 @@ -import * as proj4 from 'proj4'; +import proj4 = require('proj4'); /////////////////////////////////////////// // Tests data initialisation diff --git a/types/promise-queue/promise-queue-tests.ts b/types/promise-queue/promise-queue-tests.ts index fb3764c98f..b221fddc38 100644 --- a/types/promise-queue/promise-queue-tests.ts +++ b/types/promise-queue/promise-queue-tests.ts @@ -1,4 +1,4 @@ -import * as PromiseQueue from 'promise-queue'; +import PromiseQueue = require('promise-queue'); PromiseQueue.configure(Promise); diff --git a/types/promise-queue/tsconfig.json b/types/promise-queue/tsconfig.json index 3487f5aa3e..e1f2e1fada 100644 --- a/types/promise-queue/tsconfig.json +++ b/types/promise-queue/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "promise-queue-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/promise-retry/tsconfig.json b/types/promise-retry/tsconfig.json index cd598fc1f4..660e112726 100644 --- a/types/promise-retry/tsconfig.json +++ b/types/promise-retry/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "promise-retry-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/promisify-supertest/promisify-supertest-tests.ts b/types/promisify-supertest/promisify-supertest-tests.ts index 7fa6de147d..84f4205534 100644 --- a/types/promisify-supertest/promisify-supertest-tests.ts +++ b/types/promisify-supertest/promisify-supertest-tests.ts @@ -1,6 +1,5 @@ - -import * as request from 'promisify-supertest'; -import * as express from 'express'; +import request = require('promisify-supertest'); +import express = require('express'); let app = express(); diff --git a/types/prompt-sync-history/prompt-sync-history-tests.ts b/types/prompt-sync-history/prompt-sync-history-tests.ts index 40b00f2270..427d42a465 100644 --- a/types/prompt-sync-history/prompt-sync-history-tests.ts +++ b/types/prompt-sync-history/prompt-sync-history-tests.ts @@ -1,4 +1,4 @@ -import * as promptHistory from 'prompt-sync-history'; +import promptHistory = require('prompt-sync-history'); import * as PromptSync from 'prompt-sync'; let history:PromptSync.History; diff --git a/types/prompt-sync/prompt-sync-tests.ts b/types/prompt-sync/prompt-sync-tests.ts index 2c803e0a49..0d1f4f18ed 100644 --- a/types/prompt-sync/prompt-sync-tests.ts +++ b/types/prompt-sync/prompt-sync-tests.ts @@ -1,4 +1,4 @@ -import * as promptSync from 'prompt-sync'; +import promptSync = require('prompt-sync'); declare const history: promptSync.History; diff --git a/types/provinces/tsconfig.json b/types/provinces/tsconfig.json index d08b599b71..20f56bbafd 100644 --- a/types/provinces/tsconfig.json +++ b/types/provinces/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "provinces-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pubnub/pubnub-tests.ts b/types/pubnub/pubnub-tests.ts index 63bd206cde..1d8b2bb1ca 100644 --- a/types/pubnub/pubnub-tests.ts +++ b/types/pubnub/pubnub-tests.ts @@ -1,4 +1,4 @@ -import * as Pubnub from 'pubnub'; +import Pubnub = require('pubnub'); const console = { log: (params: any) => {} diff --git a/types/pubnub/tsconfig.json b/types/pubnub/tsconfig.json index fab1a92335..17bf98f558 100644 --- a/types/pubnub/tsconfig.json +++ b/types/pubnub/tsconfig.json @@ -1,23 +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", - "pubnub-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pubnub-tests.ts" + ] +} \ No newline at end of file diff --git a/types/pulltorefreshjs/index.d.ts b/types/pulltorefreshjs/index.d.ts index 2eab5b6741..b28d840d7b 100644 --- a/types/pulltorefreshjs/index.d.ts +++ b/types/pulltorefreshjs/index.d.ts @@ -1,10 +1,15 @@ // Type definitions for pulltorefreshjs 0.1 // Project: https://github.com/BoxFactura/pulltorefresh.js // Definitions by: Daniel Rosenwasser +// Tamas Kinsztler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function init(options?: Options): void; +export function destroyAll(): void; + +export function setPassiveMode(isPassive: boolean): void; + export interface Options { /** * Minimum distance required to trigger the refresh. @@ -108,6 +113,21 @@ export interface Options { * Defaults to `t => Math.min(1, t / 2.5)` */ resistanceFunction?(input: number): number; + + /** + * Which condition should be met for pullToRefresh to trigger? + * + * Defaults to `!window.scrollY` + */ + shouldPullToRefresh?(): boolean; + + /** + * This value will be passed as `{ passive: true|false }` to `touchmove` + * listeners if passive-handlers are supported. + * + * Defaults to `false` + */ + passive?: boolean; } /** diff --git a/types/pulltorefreshjs/pulltorefreshjs-tests.ts b/types/pulltorefreshjs/pulltorefreshjs-tests.ts index 47ca43a2e9..aa95cc3380 100644 --- a/types/pulltorefreshjs/pulltorefreshjs-tests.ts +++ b/types/pulltorefreshjs/pulltorefreshjs-tests.ts @@ -17,3 +17,9 @@ PullToRefresh.init({ mainElement: "body", onRefresh: () => Promise.resolve(), }); + +PullToRefresh.destroyAll(); + +PullToRefresh.setPassiveMode(true); + +PullToRefresh.setPassiveMode(false); diff --git a/types/pump/pump-tests.ts b/types/pump/pump-tests.ts index 0c8e91b2c0..cf3393de21 100644 --- a/types/pump/pump-tests.ts +++ b/types/pump/pump-tests.ts @@ -1,4 +1,4 @@ -import * as pump from 'pump'; +import pump = require('pump'); import { createReadStream, createWriteStream } from 'fs'; import { Transform } from 'stream'; diff --git a/types/pupa/tsconfig.json b/types/pupa/tsconfig.json index 3800bab180..9f7e0652f6 100644 --- a/types/pupa/tsconfig.json +++ b/types/pupa/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "pupa-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/puppeteer/v0/tsconfig.json b/types/puppeteer/v0/tsconfig.json index 314d615a7e..ac0a6aa9bb 100644 --- a/types/puppeteer/v0/tsconfig.json +++ b/types/puppeteer/v0/tsconfig.json @@ -16,12 +16,12 @@ "../../" ], "paths": { - "puppeteer": [ - "puppeteer/v0" - ], - "puppeteer/*": [ - "puppeteer/v0/*" - ] + "puppeteer": [ + "puppeteer/v0" + ], + "puppeteer/*": [ + "puppeteer/v0/*" + ] }, "types": [], "noEmit": true, @@ -31,4 +31,4 @@ "index.d.ts", "puppeteer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/pure-render-decorator/pure-render-decorator-tests.ts b/types/pure-render-decorator/pure-render-decorator-tests.ts index 4598d60b41..66f95f15f6 100644 --- a/types/pure-render-decorator/pure-render-decorator-tests.ts +++ b/types/pure-render-decorator/pure-render-decorator-tests.ts @@ -1,4 +1,4 @@ -import * as PureRender from 'pure-render-decorator'; +import PureRender = require('pure-render-decorator'); @PureRender class TestClass {} diff --git a/types/qrcode.react/index.d.ts b/types/qrcode.react/index.d.ts index 7771e04293..f730ee7581 100644 --- a/types/qrcode.react/index.d.ts +++ b/types/qrcode.react/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/zpao/qrcode.react // Definitions by: Mleko // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/qrcode.react/qrcode.react-tests.tsx b/types/qrcode.react/qrcode.react-tests.tsx index ffae551b01..25136d1a97 100644 --- a/types/qrcode.react/qrcode.react-tests.tsx +++ b/types/qrcode.react/qrcode.react-tests.tsx @@ -1,4 +1,4 @@ -import * as QRCode from "qrcode.react"; +import QRCode = require("qrcode.react"); import * as React from "react"; const qrcodes = [ diff --git a/types/query-string/index.d.ts b/types/query-string/index.d.ts index e7f51453eb..db823e67d2 100644 --- a/types/query-string/index.d.ts +++ b/types/query-string/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for query-string 5.0 +// Type definitions for query-string 5.1 // Project: https://github.com/sindresorhus/query-string // Definitions by: Sam Verschueren // Tanguy Krotoff // HuHuanming +// Madara Uchiha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -16,6 +17,8 @@ export interface ParseOptions { */ export function parse(str: string, options?: ParseOptions): any; +export function parseUrl(str: string, options?: ParseOptions): {url: string, query: any}; + export interface StringifyOptions { strict?: boolean; encode?: boolean; diff --git a/types/quill/index.d.ts b/types/quill/index.d.ts index a996babf30..6cc5c824c5 100644 --- a/types/quill/index.d.ts +++ b/types/quill/index.d.ts @@ -84,9 +84,9 @@ export interface DeltaStatic { concat(other: DeltaStatic): DeltaStatic; diff(other: DeltaStatic, index?: number): DeltaStatic; eachLine(predicate: (line: DeltaStatic, attributes: StringMap, idx: number) => any, newline?: string): DeltaStatic; - transform(index: number): number; + transform(index: number, priority?: boolean): number; transform(other: DeltaStatic, priority: boolean): DeltaStatic; - transformPosition(index: number): number; + transformPosition(index: number, priority?: boolean): number; } export class Delta implements DeltaStatic { diff --git a/types/quill/quill-tests.ts b/types/quill/quill-tests.ts index f907092ed1..bda294251d 100644 --- a/types/quill/quill-tests.ts +++ b/types/quill/quill-tests.ts @@ -310,10 +310,14 @@ function test_DeltaTransform() { const d1: DeltaStatic = a.transform(b, true); // new Delta().retain(1).insert('b').retain(5).insert('c'); const d2: DeltaStatic = a.transform(b, false); // new Delta().insert('b').retain(6).insert('c'); const n1: number = a.transform(5); + const n2: number = a.transform(5, true); + const n3: number = a.transform(5, false); } function test_DeltatransformPosition() { const delta = new Delta().retain(5).insert('a'); const n1: number = delta.transformPosition(4); // 4 const n2: number = delta.transformPosition(5); // 6 + const n3: number = delta.transformPosition(5, true); + const n4: number = delta.transformPosition(5, false); } diff --git a/types/radium/index.d.ts b/types/radium/index.d.ts index 7dd1387d77..d861783e92 100644 --- a/types/radium/index.d.ts +++ b/types/radium/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/formidablelabs/radium // Definitions by: Alex Gorbatchev , Philipp Holzer , Alexey Svetliakov , Mikael Hermansson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/radium/radium-tests.tsx b/types/radium/radium-tests.tsx index 0b1b1408c2..6b7aaa1a46 100644 --- a/types/radium/radium-tests.tsx +++ b/types/radium/radium-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { StyleRoot, Style } from "radium"; -import * as Radium from 'radium'; +import Radium = require('radium'); @Radium class TestComponent extends React.Component<{ a: number }> { diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index 4ee63e0975..108a12bf0e 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -201,8 +201,8 @@ declare namespace R { * A function that returns the first argument if it's falsy otherwise the second argument. Note that this is * NOT short-circuited, meaning that if expressions are passed they are both evaluated. */ - and any); } | number | boolean | string>(fn1: T, val2: any): boolean; - and any); } | number | boolean | string>(fn1: T): (val2: any) => boolean; + and any); } | number | boolean | string | null>(fn1: T, val2: any): boolean; + and any); } | number | boolean | string | null>(fn1: T): (val2: any) => boolean; /** * Returns true if at least one of elements of the list match the predicate, false otherwise. @@ -474,8 +474,8 @@ declare namespace R { * Returns the second argument if it is not null or undefined. If it is null or undefined, the * first (default) argument is returned. */ - defaultTo(a: T, b: U): T | U; - defaultTo(a: T): (b: U) => T | U; + defaultTo(a: T, b: U | null | undefined): T | U; + defaultTo(a: T): (b: U | null | undefined) => T | U; /** * Makes a descending comparator function out of a function that returns a value that can be compared with < and >. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index e6433df004..eacb4558e3 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -415,7 +415,7 @@ R.times(i, 5); */ () => { function mergeThree(a: number, b: number, c: number): number[] { - return ([]).concat(a, b, c); + return (new Array()).concat(a, b, c); } mergeThree(1, 2, 3); // => [1, 2, 3] @@ -2249,6 +2249,12 @@ class Rectangle { defaultTo42(null); // => 42 defaultTo42(undefined); // => 42 defaultTo42("Ramda"); // => 'Ramda' + + const valueOrUndefined = 2 as number | undefined; + defaultTo42(valueOrUndefined) - 2; // => 0 + + const valueOrNull = 2 as number | null; + defaultTo42(valueOrNull) - 2; // => 0 }; () => { @@ -2314,7 +2320,7 @@ class Why { const x0: boolean = R.or(false, true); // => false const x1: number | any[] = R.or(0, []); // => [] const x2: number | any[] = R.or(0)([]); // => [] - const x3: string = R.or(null, ""); // => '' + const x3: string | null = R.or(null, ""); // => '' const why = new Why(true); why.or(true); diff --git a/types/ramda/tsconfig.json b/types/ramda/tsconfig.json index d29b3d9783..4de4f10d8f 100644 --- a/types/ramda/tsconfig.json +++ b/types/ramda/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": false, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ diff --git a/types/range-parser/range-parser-tests.ts b/types/range-parser/range-parser-tests.ts index 68581e82cb..ec1ffa6e4e 100644 --- a/types/range-parser/range-parser-tests.ts +++ b/types/range-parser/range-parser-tests.ts @@ -1,4 +1,4 @@ -import * as RangeParser from 'range-parser'; +import RangeParser = require('range-parser'); declare var console: { assert(b: boolean): void }; diff --git a/types/ratelimiter/ratelimiter-tests.ts b/types/ratelimiter/ratelimiter-tests.ts index 4face1baa9..f529ec2faf 100644 --- a/types/ratelimiter/ratelimiter-tests.ts +++ b/types/ratelimiter/ratelimiter-tests.ts @@ -1,6 +1,5 @@ - import * as redis from 'redis'; -import * as Limiter from 'ratelimiter'; +import Limiter = require('ratelimiter'); declare let id: string; declare let db: redis.RedisClient; diff --git a/types/raven-for-redux/raven-for-redux-tests.ts b/types/raven-for-redux/raven-for-redux-tests.ts index 957a2017c5..481fd5bd75 100644 --- a/types/raven-for-redux/raven-for-redux-tests.ts +++ b/types/raven-for-redux/raven-for-redux-tests.ts @@ -1,5 +1,5 @@ import * as Raven from "raven-js"; -import * as createRavenMiddleware from "raven-for-redux"; +import createRavenMiddleware = require("raven-for-redux"); import { applyMiddleware, createStore } from "redux"; const middleware = createRavenMiddleware(Raven); diff --git a/types/raven-for-redux/tsconfig.json b/types/raven-for-redux/tsconfig.json index b9ef813901..acd330dac5 100644 --- a/types/raven-for-redux/tsconfig.json +++ b/types/raven-for-redux/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "raven-for-redux-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/raven/index.d.ts b/types/raven/index.d.ts index eec1b00f2c..21aee49169 100644 --- a/types/raven/index.d.ts +++ b/types/raven/index.d.ts @@ -10,6 +10,7 @@ import { IncomingMessage, ServerResponse } from 'http'; import { EventEmitter } from 'events'; export const version: string; +export function config(options?: ConstructorOptions): Client; export function config(dsn?: string | false, options?: ConstructorOptions): Client; export function wrap(func: () => T): () => T; export function wrap(options: any, func: () => T): () => T; diff --git a/types/raven/raven-tests.ts b/types/raven/raven-tests.ts index 4d96e7eafa..71f9b54038 100644 --- a/types/raven/raven-tests.ts +++ b/types/raven/raven-tests.ts @@ -9,6 +9,10 @@ Raven.config(dsn, { autoBreadcrumbs: false, }); console.log(Raven.version); + +Raven.config({ + release: 'foobar' +}); Raven.config(dsn).install({ captureUnhandledRejections: true }); client.setContext({}); client.on('logged', () => { }); diff --git a/types/rbac-a/tsconfig.json b/types/rbac-a/tsconfig.json index be60bf248e..911e4f77e6 100644 --- a/types/rbac-a/tsconfig.json +++ b/types/rbac-a/tsconfig.json @@ -23,4 +23,4 @@ "lib/rbac.d.ts", "rbac-a-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/rbush/rbush-tests.ts b/types/rbush/rbush-tests.ts index 4a2de0ef14..07061ff562 100644 --- a/types/rbush/rbush-tests.ts +++ b/types/rbush/rbush-tests.ts @@ -1,4 +1,4 @@ -import * as rbush from 'rbush'; +import rbush = require('rbush'); interface IndexedRect extends rbush.BBox { index: number; diff --git a/types/rc-select/index.d.ts b/types/rc-select/index.d.ts index 18dfb46e67..5fdae43949 100644 --- a/types/rc-select/index.d.ts +++ b/types/rc-select/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/react-component/select // Definitions by: Denis Tirilis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/rc-slider/index.d.ts b/types/rc-slider/index.d.ts index f2010b3ec9..139f4e2ef0 100644 --- a/types/rc-slider/index.d.ts +++ b/types/rc-slider/index.d.ts @@ -5,7 +5,7 @@ // Austin Turner // Jacob Froman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/rc-tooltip/index.d.ts b/types/rc-tooltip/index.d.ts index be0246fc13..9222d9f149 100644 --- a/types/rc-tooltip/index.d.ts +++ b/types/rc-tooltip/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: rhysd // ahstro // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/rc-tree/index.d.ts b/types/rc-tree/index.d.ts index 4dc789824d..7cee0d8371 100644 --- a/types/rc-tree/index.d.ts +++ b/types/rc-tree/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/react-component/tree // Definitions by: John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, diff --git a/types/rdf-data-model/tsconfig.json b/types/rdf-data-model/tsconfig.json index e1099949e0..be6946484f 100644 --- a/types/rdf-data-model/tsconfig.json +++ b/types/rdf-data-model/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "rdf-data-model-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/rdf-js/tsconfig.json b/types/rdf-js/tsconfig.json index b9c788b408..d010928403 100644 --- a/types/rdf-js/tsconfig.json +++ b/types/rdf-js/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "rdf-js-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-addons-create-fragment/index.d.ts b/types/react-addons-create-fragment/index.d.ts index 6c998ebc12..1e46046ec4 100644 --- a/types/react-addons-create-fragment/index.d.ts +++ b/types/react-addons-create-fragment/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-addons-css-transition-group/index.d.ts b/types/react-addons-css-transition-group/index.d.ts index f4857926bd..33d43b4cd1 100644 --- a/types/react-addons-css-transition-group/index.d.ts +++ b/types/react-addons-css-transition-group/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import 'react-addons-transition-group'; import { ComponentClass, CSSTransitionGroupProps } from 'react'; diff --git a/types/react-addons-linked-state-mixin/index.d.ts b/types/react-addons-linked-state-mixin/index.d.ts index 50e4b3ec5a..6358dde535 100644 --- a/types/react-addons-linked-state-mixin/index.d.ts +++ b/types/react-addons-linked-state-mixin/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Mixin } from 'react'; diff --git a/types/react-addons-pure-render-mixin/index.d.ts b/types/react-addons-pure-render-mixin/index.d.ts index 3ffff6f17f..565a108721 100644 --- a/types/react-addons-pure-render-mixin/index.d.ts +++ b/types/react-addons-pure-render-mixin/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Mixin } from 'react'; diff --git a/types/react-addons-shallow-compare/index.d.ts b/types/react-addons-shallow-compare/index.d.ts index d640b68ac5..ff4e5dbdc9 100644 --- a/types/react-addons-shallow-compare/index.d.ts +++ b/types/react-addons-shallow-compare/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from 'react'; diff --git a/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx b/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx index c1c5d902cc..cd1a96a70e 100644 --- a/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx +++ b/types/react-addons-shallow-compare/react-addons-shallow-compare-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as shallowCompare from 'react-addons-shallow-compare'; +import shallowCompare = require('react-addons-shallow-compare'); export class MyComponent extends React.Component { shouldComponentUpdate(nextProps: any, nextState: any, nextContext: any): boolean { diff --git a/types/react-addons-test-utils/index.d.ts b/types/react-addons-test-utils/index.d.ts index b65262753a..9282f95f4e 100644 --- a/types/react-addons-test-utils/index.d.ts +++ b/types/react-addons-test-utils/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { AbstractView, Component, ComponentClass, ReactElement, ReactInstance, ClassType, diff --git a/types/react-addons-transition-group/index.d.ts b/types/react-addons-transition-group/index.d.ts index c3149f87e3..933533df28 100644 --- a/types/react-addons-transition-group/index.d.ts +++ b/types/react-addons-transition-group/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, TransitionGroupProps } from 'react'; diff --git a/types/react-addons-update/index.d.ts b/types/react-addons-update/index.d.ts index 3b9285a704..874549b7a1 100644 --- a/types/react-addons-update/index.d.ts +++ b/types/react-addons-update/index.d.ts @@ -2,7 +2,7 @@ // Project: http://facebook.github.io/react/ // Definitions by: Asana , AssureSign , Microsoft // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-alert/index.d.ts b/types/react-alert/index.d.ts index d402d24ad2..9150bf28b4 100644 --- a/types/react-alert/index.d.ts +++ b/types/react-alert/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/schiehll/react-alert // Definitions by: Steve Syrell // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-alert/tsconfig.json b/types/react-alert/tsconfig.json index 9332254f22..755c2cd68b 100644 --- a/types/react-alert/tsconfig.json +++ b/types/react-alert/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-alert-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-alice-carousel/index.d.ts b/types/react-alice-carousel/index.d.ts index 47d4fd95de..2d40293003 100644 --- a/types/react-alice-carousel/index.d.ts +++ b/types/react-alice-carousel/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/maxmarinich/react-alice-carousel // Definitions by: endigo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-alice-carousel/tsconfig.json b/types/react-alice-carousel/tsconfig.json index 4245303823..22f3238121 100644 --- a/types/react-alice-carousel/tsconfig.json +++ b/types/react-alice-carousel/tsconfig.json @@ -1,24 +1,24 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "jsx": "react" - }, - "files": [ - "index.d.ts", - "react-alice-carousel-tests.tsx" - ] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react" + }, + "files": [ + "index.d.ts", + "react-alice-carousel-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-app/index.d.ts b/types/react-app/index.d.ts index a126c914e2..7c5e00f57a 100644 --- a/types/react-app/index.d.ts +++ b/types/react-app/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kriasoft/react-app#readme // Definitions by: Prakarsh Pandey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-aria-menubutton/index.d.ts b/types/react-aria-menubutton/index.d.ts index cba4c81540..52a77e7435 100644 --- a/types/react-aria-menubutton/index.d.ts +++ b/types/react-aria-menubutton/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Muhammad Fawwaz Orabi // Chris Rohlfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-autosuggest/index.d.ts b/types/react-autosuggest/index.d.ts index 444753bd54..b78ee34ab8 100644 --- a/types/react-autosuggest/index.d.ts +++ b/types/react-autosuggest/index.d.ts @@ -7,7 +7,7 @@ // Christopher Deutsch // Kevin Ross // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-autosuggest/react-autosuggest-tests.tsx b/types/react-autosuggest/react-autosuggest-tests.tsx index 3747e8457b..7fea579987 100644 --- a/types/react-autosuggest/react-autosuggest-tests.tsx +++ b/types/react-autosuggest/react-autosuggest-tests.tsx @@ -1,7 +1,7 @@ // region Imports import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import * as Autosuggest from 'react-autosuggest'; +import Autosuggest = require('react-autosuggest'); // endregion interface Language { diff --git a/types/react-autosuggest/tsconfig.json b/types/react-autosuggest/tsconfig.json index fc78293096..b85bc369dc 100644 --- a/types/react-autosuggest/tsconfig.json +++ b/types/react-autosuggest/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-autosuggest-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts index 40f1377042..b405c481c4 100644 --- a/types/react-beautiful-dnd/index.d.ts +++ b/types/react-beautiful-dnd/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: varHarrie // Bradley Ayers // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-big-calendar/index.d.ts b/types/react-big-calendar/index.d.ts index 15b7ec2706..bcaee40549 100644 --- a/types/react-big-calendar/index.d.ts +++ b/types/react-big-calendar/index.d.ts @@ -1,193 +1,193 @@ -// Type definitions for react-big-calendar 0.17.0 +// Type definitions for react-big-calendar 0.18 // Project: https://github.com/intljusticemission/react-big-calendar -// Definitions by: Piotr Witek +// Definitions by: Piotr Witek // Austin Turner +// Krzysztof Bezrąk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 -declare module 'react-big-calendar' { - import * as React from 'react'; +import * as React from 'react'; - export type stringOrDate = string | Date; - export type View = 'month' | 'week' | 'work_week' | 'day' | 'agenda'; - export type Navigate = 'PREV' | 'NEXT' | 'TODAY' | 'DATE'; - export interface Format { - /** - * Format for the day of the month heading in the Month view. - * e.g. "01", "02", "03", etc - */ - dateFormat?: string, +export type stringOrDate = string | Date; +export type View = 'month' | 'week' | 'work_week' | 'day' | 'agenda'; +export type Navigate = 'PREV' | 'NEXT' | 'TODAY' | 'DATE'; +export interface Format { + /** + * Format for the day of the month heading in the Month view. + * e.g. "01", "02", "03", etc + */ + dateFormat?: string; - /** - * A day of the week format for Week and Day headings, - * e.g. "Wed 01/04" - * - */ - dayFormat?: string, + /** + * A day of the week format for Week and Day headings, + * e.g. "Wed 01/04" + * + */ + dayFormat?: string; - /** - * Week day name format for the Month week day headings, - * e.g: "Sun", "Mon", "Tue", etc - * - */ - weekdayFormat?: string, + /** + * Week day name format for the Month week day headings, + * e.g: "Sun", "Mon", "Tue", etc + * + */ + weekdayFormat?: string; - /** - * The timestamp cell formats in Week and Time views, e.g. "4:00 AM" - */ - timeGutterFormat?: string, + /** + * The timestamp cell formats in Week and Time views, e.g. "4:00 AM" + */ + timeGutterFormat?: string; - /** - * Toolbar header format for the Month view, e.g "2015 April" - * - */ - monthHeaderFormat?: string, + /** + * Toolbar header format for the Month view, e.g "2015 April" + * + */ + monthHeaderFormat?: string; - /** - * Toolbar header format for the Week views, e.g. "Mar 29 - Apr 04" - */ - dayRangeHeaderFormat?: string, + /** + * Toolbar header format for the Week views, e.g. "Mar 29 - Apr 04" + */ + dayRangeHeaderFormat?: string; - /** - * Toolbar header format for the Day view, e.g. "Wednesday Apr 01" - */ - dayHeaderFormat?: string, + /** + * Toolbar header format for the Day view, e.g. "Wednesday Apr 01" + */ + dayHeaderFormat?: string; - /** - * Toolbar header format for the Agenda view, e.g. "4/1/2015 — 5/1/2015" - */ - agendaHeaderFormat?: string, + /** + * Toolbar header format for the Agenda view, e.g. "4/1/2015 — 5/1/2015" + */ + agendaHeaderFormat?: string; - /** - * A time range format for selecting time slots, e.g "8:00am — 2:00pm" - */ - selectRangeFormat?: string, + /** + * A time range format for selecting time slots, e.g "8:00am — 2:00pm" + */ + selectRangeFormat?: string; - agendaDateFormat?: string, - agendaTimeFormat?: string, - agendaTimeRangeFormat?: string, + agendaDateFormat?: string; + agendaTimeFormat?: string; + agendaTimeRangeFormat?: string; - /** - * Time range displayed on events. - */ - eventTimeRangeFormat?: string, + /** + * Time range displayed on events. + */ + eventTimeRangeFormat?: string; - /** - * An optional event time range for events that continue onto another day - */ - eventTimeRangeStartFormat?: string, + /** + * An optional event time range for events that continue onto another day + */ + eventTimeRangeStartFormat?: string; - /** - * An optional event time range for events that continue from another day - */ - eventTimeRangeEndFormat?: string, - } + /** + * An optional event time range for events that continue from another day + */ + eventTimeRangeEndFormat?: string; +} - export interface Components { - event?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - eventWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - dayWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - dateCellWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - toolbar?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - agenda?: { - date?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - time?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - event?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - }, - day?: { - header?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - event?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - }, - week?: { - header?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - event?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - }, - month?: { - header?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - dateHeader?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - event?: React.SFC | React.Component | React.ComponentClass | JSX.Element, - }, - } +export interface Components { + event?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + eventWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + dayWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + dateCellWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + toolbar?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + agenda?: { + date?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + time?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + event?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + }; + day?: { + header?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + event?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + }; + week?: { + header?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + event?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + }; + month?: { + header?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + dateHeader?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + event?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + }; +} - export interface Messages { - allDay?: string; - previous?: string; - next?: string; - today?: string; - month?: string; - week?: string; - day?: string; - agenda?: string; - date?: string; - time?: string; - event?: string; - showMore?: string; - } +export interface Messages { + date?: string; + time?: string; + event?: string; + allDay?: string; + week?: string; + work_week?: string; + day?: string; + month?: string; + previous?: string; + next?: string; + yesterday?: string; + tomorrow?: string; + today?: string; + agenda?: string; + showMore?: (count: number) => string; +} - interface BigCalendarProps extends React.Props { - date?: stringOrDate; - now?: Date; - view?: View; - events?: Object[]; - onNavigate?: (action: Navigate, newDate: Date) => void; - onView?: (view: View) => void; - onDrillDown?: (date: Date, view: View) => void; - onSelectSlot?: (slotInfo: { start: stringOrDate, end: stringOrDate, slots: Date[] | string[], action: 'select' | 'click' | 'doubleClick' }) => void; - onDoubleClickEvent?: (event: Object, e: React.SyntheticEvent) => void; - onSelectEvent?: (event: Object, e: React.SyntheticEvent) => void; - onSelecting?: (range: { start: stringOrDate, end: stringOrDate }) => boolean | undefined | null; - selected?: any; - views?: View[] | { - month: boolean | React.SFC | React.Component, - week: boolean | React.SFC | React.Component, - myweek: boolean | React.SFC | React.Component, - }; - drilldownView?: View | null; - getDrilldownView?: ((targetDate: Date, currentViewName: View, configuredViewNames: View[]) => void) | null; - length?: number; - toolbar?: boolean; - popup?: boolean; - popupOffset?: number | { x: number, y: number }; - selectable?: boolean | 'ignoreEvents'; - longPressThreshold?: number; - step?: number; - timeslots?: number; - rtl?: boolean; - eventPropGetter?: (event: Object, start: stringOrDate, end: stringOrDate, isSelected: boolean) => { className?: string, style?: React.CSSProperties }; - slotPropGetter?: (date: Date) => { className?: string, style?: Object }; - dayPropGetter?: (date: Date) => { className?: string, style?: Object }; - showMultiDayTimes?: boolean; - min?: stringOrDate; - max?: stringOrDate; - scrollToTime?: Date; - culture?: string; - formats?: Format; - components?: Components; - messages?: Messages; - titleAccessor?: string | ((event: any) => string); - allDayAccessor?: string | ((event: any) => boolean); - startAccessor?: string | ((event: any) => Date); - endAccessor?: string | ((event: any) => Date); - resourceAccessor?: string | ((event: any) => any); - resources?: any[]; - resourceIdAccessor?: string | ((event: any) => any); - resourceTitleAccessor?: string | ((event: any) => string); - defaultView?: View; - defaultDate?: Date; - className?: string; - elementProps?: React.HTMLAttributes; - } +export interface BigCalendarProps extends React.Props { + date?: stringOrDate; + now?: Date; + view?: View; + events?: object[]; + onNavigate?: (newDate: Date, action: Navigate) => void; + onView?: (view: View) => void; + onDrillDown?: (date: Date, view: View) => void; + onSelectSlot?: (slotInfo: { start: stringOrDate, end: stringOrDate, slots: Date[] | string[], action: 'select' | 'click' | 'doubleClick' }) => void; + onDoubleClickEvent?: (event: object, e: React.SyntheticEvent) => void; + onSelectEvent?: (event: object, e: React.SyntheticEvent) => void; + onSelecting?: (range: { start: stringOrDate, end: stringOrDate }) => boolean | undefined | null; + selected?: any; + views?: View[] | { + month: boolean | React.SFC | React.Component, + week: boolean | React.SFC | React.Component, + myweek: boolean | React.SFC | React.Component, + }; + drilldownView?: View | null; + getDrilldownView?: ((targetDate: Date, currentViewName: View, configuredViewNames: View[]) => void) | null; + length?: number; + toolbar?: boolean; + popup?: boolean; + popupOffset?: number | { x: number, y: number }; + selectable?: boolean | 'ignoreEvents'; + longPressThreshold?: number; + step?: number; + timeslots?: number; + rtl?: boolean; + eventPropGetter?: (event: object, start: stringOrDate, end: stringOrDate, isSelected: boolean) => { className?: string, style?: React.CSSProperties }; + slotPropGetter?: (date: Date) => { className?: string, style?: object }; + dayPropGetter?: (date: Date) => { className?: string, style?: object }; + showMultiDayTimes?: boolean; + min?: stringOrDate; + max?: stringOrDate; + scrollToTime?: Date; + culture?: string; + formats?: Format; + components?: Components; + messages?: Messages; + titleAccessor?: string | ((event: any) => string); + allDayAccessor?: string | ((event: any) => boolean); + startAccessor?: string | ((event: any) => Date); + endAccessor?: string | ((event: any) => Date); + resourceAccessor?: string | ((event: any) => any); + resources?: any[]; + resourceIdAccessor?: string | ((event: any) => any); + resourceTitleAccessor?: string | ((event: any) => string); + defaultView?: View; + defaultDate?: Date; + className?: string; + elementProps?: React.HTMLAttributes; +} - class BigCalendar extends React.Component { - /** - * Setup the localizer by providing the moment Object - */ - static momentLocalizer(momentInstance: Object): void; - /** - * Setup the localizer by providing the globalize Object - */ - static globalizeLocalizer(globalizeInstance: Object): void; - } - - export default BigCalendar; +export default class BigCalendar extends React.Component { + /** + * Setup the localizer by providing the moment Object + */ + static momentLocalizer(momentInstance: object): void; + /** + * Setup the localizer by providing the globalize Object + */ + static globalizeLocalizer(globalizeInstance: object): void; } diff --git a/types/react-big-calendar/react-big-calendar-tests.tsx b/types/react-big-calendar/react-big-calendar-tests.tsx index 16ea44d859..dbb1753332 100644 --- a/types/react-big-calendar/react-big-calendar-tests.tsx +++ b/types/react-big-calendar/react-big-calendar-tests.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; import * as ReactDOMServer from "react-dom/server"; -import BigCalendar, { Navigate, View } from "react-big-calendar"; +import BigCalendar, { BigCalendarProps, Navigate, View } from "react-big-calendar"; // Don't want to add this as a dependency, because it is only used for tests. declare const moment: any; @@ -13,13 +13,13 @@ BigCalendar.momentLocalizer(moment); // http://intljusticemission.github.io/react-big-calendar/examples/index.html class CalendarEvent { - public title: string; - public allDay: boolean; - public start: Date; - public end: Date; - public desc: string; + title: string; + allDay: boolean; + start: Date; + end: Date; + desc: string; - public constructor(_title: string, _start: Date, _end: Date, _allDay?: boolean, _desc?: string) { + constructor(_title: string, _start: Date, _end: Date, _allDay?: boolean, _desc?: string) { this.title = _title; this.allDay = _allDay || false; this.start = _start; @@ -45,7 +45,7 @@ console.log('Test Results -> BasicExample', basicExampleHtml); // Full API Example Test - based on API Documentation // http://intljusticemission.github.io/react-big-calendar/examples/index.html#api -class FullAPIExample extends React.Component { +class FullAPIExample extends React.Component { render() { return ( { date={new Date()} view={'day'} events={getEvents()} - onNavigate={(action: Navigate, newDate: Date) => { } } - onView={(view: View) => { } } + onNavigate={(newDate: Date, action: Navigate) => { }} + onView={(view: View) => { }} onSelectSlot={(slotInfo) => { const start = slotInfo.start; const end = slotInfo.end; const slots = slotInfo.slots; - } } - onSelectEvent={(event) => { } } + }} + onSelectEvent={(event) => { }} onSelecting={(slotInfo) => { const start = slotInfo.start; const end = slotInfo.end; return true; - } } + }} views={['day']} toolbar={true} popup={true} @@ -73,7 +73,7 @@ class FullAPIExample extends React.Component { selectable={true} step={20} rtl={true} - eventPropGetter={(event, start, end, isSelected) => ({ className: 'some-class' }) } + eventPropGetter={(event, start, end, isSelected) => ({ className: 'some-class' })} titleAccessor={'title'} allDayAccessor={(event: any) => !!event.allDay} startAccessor={'start'} @@ -86,7 +86,7 @@ class FullAPIExample extends React.Component { timeslots={24} defaultView={'month'} className={'my-calendar'} - elementProps={{id: 'myCalendar'}} + elementProps={{ id: 'myCalendar' }} components={{ event: Event, agenda: { @@ -106,58 +106,58 @@ console.log('Test Results -> FullAPIExample', fullApiExampleHtml); // Test fixtures function getEvents(): CalendarEvent[] { - var events: CalendarEvent[] = [ + const events: CalendarEvent[] = [ new CalendarEvent('All Day Event', new Date(2015, 3, 0), new Date(2015, 3, 0), true), new CalendarEvent('Long Event', new Date(2015, 3, 7), new Date(2015, 3, 10)), new CalendarEvent('DTS STARTS', new Date(2016, 2, 13, 0, 0, 0), new Date(2016, 2, 20, 0, 0, 0)), new CalendarEvent('DTS ENDS', new Date(2016, 10, 6, 0, 0, 0), new Date(2016, 10, 13, 0, 0, 0)), new CalendarEvent('Some Event', new Date(2015, 3, 9, 0, 0, 0), new Date(2015, 3, 9, 0, 0, 0)), new CalendarEvent('Conference', new Date(2015, 3, 11), new Date(2015, 3, 13), undefined, 'Big conference for important people'), - new CalendarEvent('Meeting', new Date(2015, 3, 12, 10, 30, 0, 0),new Date(2015, 3, 12, 12, 30, 0, 0), undefined, 'Pre-meeting meeting, to prepare for the meeting'), - new CalendarEvent('Lunch', new Date(2015, 3, 12, 12, 0, 0, 0),new Date(2015, 3, 12, 13, 0, 0, 0), undefined, 'Power lunch'), - new CalendarEvent('Meeting', new Date(2015, 3, 12, 14, 0, 0, 0),new Date(2015, 3, 12, 15, 0, 0, 0)), - new CalendarEvent('Happy Hour', new Date(2015, 3, 12, 17, 0, 0, 0),new Date(2015, 3, 12, 17, 30, 0, 0),undefined,'Most important meal of the day'), - new CalendarEvent('Dinner', new Date(2015, 3, 12, 20, 0, 0, 0),new Date(2015, 3, 12, 21, 0, 0, 0)), - new CalendarEvent('Birthday Party', new Date(2015, 3, 13, 7, 0, 0),new Date(2015, 3, 13, 10, 30, 0)), + new CalendarEvent('Meeting', new Date(2015, 3, 12, 10, 30, 0, 0), new Date(2015, 3, 12, 12, 30, 0, 0), undefined, 'Pre-meeting meeting, to prepare for the meeting'), + new CalendarEvent('Lunch', new Date(2015, 3, 12, 12, 0, 0, 0), new Date(2015, 3, 12, 13, 0, 0, 0), undefined, 'Power lunch'), + new CalendarEvent('Meeting', new Date(2015, 3, 12, 14, 0, 0, 0), new Date(2015, 3, 12, 15, 0, 0, 0)), + new CalendarEvent('Happy Hour', new Date(2015, 3, 12, 17, 0, 0, 0), new Date(2015, 3, 12, 17, 30, 0, 0), undefined, 'Most important meal of the day'), + new CalendarEvent('Dinner', new Date(2015, 3, 12, 20, 0, 0, 0), new Date(2015, 3, 12, 21, 0, 0, 0)), + new CalendarEvent('Birthday Party', new Date(2015, 3, 13, 7, 0, 0), new Date(2015, 3, 13, 10, 30, 0)), ]; return events; +} + +class EventAgenda extends React.Component { + render() { + // const { label } = this.props; + return ( +
+
Calendar Events
+
+ ); + } +} + +const customDayPropGetter = (date: Date) => { + if (date.getDate() === 7 || date.getDate() === 15) + return { + className: 'special-day', + style: { + border: 'solid 3px ' + (date.getDate() === 7 ? '#faa' : '#afa'), + }, + }; + else return {}; }; - class EventAgenda extends React.Component { - render() { - // const { label } = this.props; - return ( -
-
Calendar Events
-
- ); - } - } - - const customDayPropGetter = (date: Date) => { +const customSlotPropGetter = (date: Date) => { if (date.getDate() === 7 || date.getDate() === 15) - return { - className: 'special-day', - style: { - border: 'solid 3px ' + (date.getDate() === 7 ? '#faa' : '#afa'), - }, - } - else return {} - } + return { + className: 'special-day', + }; + else return {}; +}; - const customSlotPropGetter = (date: Date) => { - if (date.getDate() === 7 || date.getDate() === 15) - return { - className: 'special-day', - } - else return {} - } - - function Event(event: any) { +function Event(event: any) { return ( - - {event.title} - {event.desc && ': ' + event.desc} - - ) - } + + {event.title} + {event.desc && ': ' + event.desc} + + ); +} diff --git a/types/react-big-calendar/tsconfig.json b/types/react-big-calendar/tsconfig.json index 1a28fe79ae..eddf55cc13 100644 --- a/types/react-big-calendar/tsconfig.json +++ b/types/react-big-calendar/tsconfig.json @@ -6,8 +6,8 @@ "dom" ], "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, + "noImplicitThis": true, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ diff --git a/types/react-big-calendar/tslint.json b/types/react-big-calendar/tslint.json index a41bf5d19a..e60c15844f 100644 --- a/types/react-big-calendar/tslint.json +++ b/types/react-big-calendar/tslint.json @@ -1,79 +1,3 @@ { - "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 - } -} + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/react-body-classname/index.d.ts b/types/react-body-classname/index.d.ts index 6088e99cb7..23aa8d6f78 100644 --- a/types/react-body-classname/index.d.ts +++ b/types/react-body-classname/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/PactCoffee/react-body-classname // Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-bootstrap-date-picker/index.d.ts b/types/react-bootstrap-date-picker/index.d.ts index 2cbedb674a..96971cc0bb 100644 --- a/types/react-bootstrap-date-picker/index.d.ts +++ b/types/react-bootstrap-date-picker/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/pushtell/react-bootstrap-date-picker#readme // Definitions by: Karol Janyst , Antal Bodnar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, StatelessComponent, ReactNode, FocusEventHandler, HTMLAttributes } from "react"; diff --git a/types/react-bootstrap-date-picker/react-bootstrap-date-picker-tests.tsx b/types/react-bootstrap-date-picker/react-bootstrap-date-picker-tests.tsx index 07928a09ea..23b6c75d63 100644 --- a/types/react-bootstrap-date-picker/react-bootstrap-date-picker-tests.tsx +++ b/types/react-bootstrap-date-picker/react-bootstrap-date-picker-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { DropdownMenu } from "react-bootstrap"; -import * as DatePicker from "react-bootstrap-date-picker"; +import DatePicker = require("react-bootstrap-date-picker"); const Custom: React.StatelessComponent = () => { return (
); diff --git a/types/react-bootstrap-daterangepicker/index.d.ts b/types/react-bootstrap-daterangepicker/index.d.ts index aaf6a5089e..1479b1e1c5 100644 --- a/types/react-bootstrap-daterangepicker/index.d.ts +++ b/types/react-bootstrap-daterangepicker/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/skratchdot/react-bootstrap-daterangepicker // Definitions by: Ian Ker-Seymer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// /// diff --git a/types/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.ts b/types/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.ts deleted file mode 100644 index 65e44c6086..0000000000 --- a/types/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import DateRangePicker = require("react-bootstrap-daterangepicker"); -import * as React from "react"; - -class IntegrationTest extends React.Component { - render() { - const props = { - onEvent: (ev: any, picker: any) => true, - singleDatePicker: true, - startDate: "1999-12-31", - endDate: "2000-12-31", - dateLimit: 3, - timePicker: true, - timePickerIncrement: 5, - buttonClasses: ["btn-sm"], - applyClass: "myclass", - cancelClass: "myclass", - autoApply: true, - linkedCalendars: true, - }; - - return React.createElement(DateRangePicker, props); - } -} diff --git a/types/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx b/types/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx index b34646031d..36484ba416 100644 --- a/types/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx +++ b/types/react-bootstrap-daterangepicker/react-bootstrap-daterangepicker-tests.tsx @@ -1,4 +1,25 @@ -import * as DateRangePicker from "react-bootstrap-daterangepicker"; +import DateRangePicker = require("react-bootstrap-daterangepicker"); import * as React from "react"; +class IntegrationTest extends React.Component { + render() { + const props = { + onEvent: (ev: any, picker: any) => true, + singleDatePicker: true, + startDate: "1999-12-31", + endDate: "2000-12-31", + dateLimit: 3, + timePicker: true, + timePickerIncrement: 5, + buttonClasses: ["btn-sm"], + applyClass: "myclass", + cancelClass: "myclass", + autoApply: true, + linkedCalendars: true, + }; + + return React.createElement(DateRangePicker, props); + } +} + let pickerCoponent = true} />; diff --git a/types/react-bootstrap-daterangepicker/tsconfig.json b/types/react-bootstrap-daterangepicker/tsconfig.json index bc9c951ccf..a8c612879c 100644 --- a/types/react-bootstrap-daterangepicker/tsconfig.json +++ b/types/react-bootstrap-daterangepicker/tsconfig.json @@ -20,7 +20,6 @@ }, "files": [ "index.d.ts", - "react-bootstrap-daterangepicker-tests.ts", "react-bootstrap-daterangepicker-tests.tsx" ] } \ No newline at end of file diff --git a/types/react-bootstrap-table/index.d.ts b/types/react-bootstrap-table/index.d.ts index d7618e4db0..c6f5b7654e 100644 --- a/types/react-bootstrap-table/index.d.ts +++ b/types/react-bootstrap-table/index.d.ts @@ -6,7 +6,7 @@ // Janeene Beeforth // Oscar Andersson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 // documentation taken from http://allenfang.github.io/react-bootstrap-table/docs.html diff --git a/types/react-bootstrap-table/v2/index.d.ts b/types/react-bootstrap-table/v2/index.d.ts index 11c0f7f943..5ac31a4a77 100644 --- a/types/react-bootstrap-table/v2/index.d.ts +++ b/types/react-bootstrap-table/v2/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/AllenFang/react-bootstrap-table // Definitions by: Frank Laub , Aleksander Lode , Josué Us // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-bootstrap-table/v2/tsconfig.json b/types/react-bootstrap-table/v2/tsconfig.json index eee5850865..b1391c9c05 100644 --- a/types/react-bootstrap-table/v2/tsconfig.json +++ b/types/react-bootstrap-table/v2/tsconfig.json @@ -27,4 +27,4 @@ "index.d.ts", "react-bootstrap-table-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index c31ddd63b5..659b2034fd 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -1,63 +1,170 @@ -// Type definitions for react-bootstrap-typeahead 2.0 +// Type definitions for react-bootstrap-typeahead 2.3 // Project: https://github.com/ericgio/react-bootstrap-typeahead // Definitions by: Guymestef +// Rajab Shakirov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 +// TODO: , , , components import * as React from 'react'; export interface TypeaheadProps { + /* For localized accessibility: Should return a string indicating the number of results for screen readers. Receives the current results. */ a11yNumResults?: () => void; + + /* For localized accessibility: Should return a string indicating the number of selections for screen readers. Receives the current selections. */ a11yNumSelected?: () => void; + + /* Specify menu alignment. The default value is justify, which makes the menu as wide as the input and truncates long values. + Specifying left or right will align the menu to that side and the width will be determined by the length of menu item values. */ align?: 'justify' | 'left' | 'right'; + + /* Allows the creation of new selections on the fly. Any new items will be added to the list of selections, + but not the list of original options unless handled as such by Typeahead's parent. + The newly added item will always be returned as an object even if the other options are simply strings, + so be sure your onChange callback can handle this. */ allowNew?: boolean; + + /* Autofocus the input when the component initially mounts. */ autoFocus?: boolean; + + /* Whether to render the menu inline or attach to document.body. */ bodyContainer?: boolean; + + /* Specify the size of the input. */ bsSize?: 'large' | 'lg' | 'small' | 'sm'; + + /* Whether or not filtering should be case-sensitive. */ caseSensitive?: boolean; + + /* Displays a button to clear the input when there are selections. */ clearButton?: boolean; + + /* The initial value displayed in the text input. */ + defaultInputValue?: string; + + /* Specify any pre-selected options. Use only if you want the component to be uncontrolled. */ defaultSelected?: T[]; + + /* Whether to disable the input. Will also disable selections when multiple={true}. */ disabled?: boolean; + + /* Specify whether the menu should appear above the input. */ dropup?: boolean; + + /* Message displayed in the menu when there are no valid results. + Passing a falsy value will hide the menu if no matches are found. */ emptyLabel?: string; + + /* Either an array of fields in option to search, or a custom filtering callback. */ filterBy?: (string[] | ((option: T | string, text: string) => boolean)); + + /* Highlights the menu item if there is only one result and allows selecting that item by hitting enter. + Does not work with allowNew. */ highlightOnlyResult?: boolean; + + /* Whether the filter should ignore accents and other diacritical marks. */ ignoreDiacritics?: boolean; + + /* Props to be applied directly to the input. onBlur, onChange, onFocus, and onKeyDown are ignored. */ inputProps?: object; + + /* Indicate whether an asynchronous data fetch is happening. */ + isLoading?: boolean; + + /* Specify which option key to use for display or a render function. By default, the selector will use the label key. */ labelKey?: string | ((option: T | string) => string); + + /* Maximum height of the dropdown menu, in px. */ maxHeight?: number; + + /* Maximum number of results to display by default. Mostly done for performance reasons + so as not to render too many DOM nodes in the case of large data sets. */ maxResults?: number; + + /* Number of input characters that must be entered before showing results. */ minLength?: number; + + /* Whether or not multiple selections are allowed. */ multiple?: boolean; + + /* Provides the ability to specify a prefix before the user-entered text to indicate that the selection will be new. No-op unless allowNew={true}. */ newSelectionPrefix?: string; + + /* Invoked when the input is blurred. Receives an event. */ onBlur?: (e: Event) => any; + + /* Invoked whenever items are added or removed. Receives an array of the selected options. */ onChange?: (selected: T[]) => any; + + /* Invoked when the input is focused. Receives an event. */ onFocus?: (e: Event) => any; + + /* Invoked when the input value changes. Receives the string value of the input. */ onInputChange?: (input: string) => any; + + /* Invoked when a key is pressed. Receives an event. */ onKeyDown?: (e: Event) => any; + + /* Invoked when the menu is hidden. */ onMenuHide?: (e: Event) => any; + + /* Invoked when the menu is shown. */ onMenuShow?: (e: Event) => any; + + /* Invoked when the pagination menu item is clicked. */ onPaginate?: (e: Event) => any; + + /* Full set of options, including any pre-selected options. */ options: T[]; + + /* Give user the ability to display additional results if the number of results exceeds maxResults. */ paginate?: boolean; + + /* Prompt displayed when large data sets are paginated. */ paginationText?: string; + + /* Placeholder text for the input. */ placeholder?: string; + + /* Callback for custom menu rendering. */ renderMenu?: (results: Array, menuProps: any) => any; + + /* Provides a hook for customized rendering of menu item contents. */ renderMenuItemChildren?: (option: T, props: TypeaheadProps, index: number) => any; + + /* Provides a hook for customized rendering of tokens when multiple selections are enabled. */ renderToken?: (selectedItem: T | string, onRemove: () => void) => any; + + /* The selected option(s) displayed in the input. Use this prop if you want to control the component via its parent. */ selected?: T[]; + + /* Allows selecting the hinted result by pressing enter. */ selectHintOnEnter?: boolean; + + /* Propagate event to parent form. */ submitFormOnEnter?: boolean; } export const Typeahead: React.ClassicComponentClass>; export interface AsyncTypeaheadProps extends TypeaheadProps { + /* Delay, in milliseconds, before performing search. */ delay?: number; + + /* Whether or not a request is currently pending. Necessary for the component to know when new results are available. */ isLoading: boolean; + + /* Callback to perform when the search is executed. */ onSearch: (query: string) => void; + + /* Message displayed in the menu when there is no user input. */ promptText?: string; + + /* Message to display in the menu while the request is pending. */ searchText?: string; + + /* Whether or not the component should cache query results. */ useCache?: boolean; } diff --git a/types/react-bootstrap-typeahead/tsconfig.json b/types/react-bootstrap-typeahead/tsconfig.json index c8b63ad42b..370b25f75d 100644 --- a/types/react-bootstrap-typeahead/tsconfig.json +++ b/types/react-bootstrap-typeahead/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-bootstrap-typeahead-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-bootstrap/index.d.ts b/types/react-bootstrap/index.d.ts index df9e371956..ccbc01d31a 100644 --- a/types/react-bootstrap/index.d.ts +++ b/types/react-bootstrap/index.d.ts @@ -12,7 +12,7 @@ // Karol Janyst // Aaron Beall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-bootstrap/lib/Carousel.d.ts b/types/react-bootstrap/lib/Carousel.d.ts index cef9214064..23ceeda466 100644 --- a/types/react-bootstrap/lib/Carousel.d.ts +++ b/types/react-bootstrap/lib/Carousel.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import { Omit, Sizes, SelectCallback } from 'react-bootstrap'; -import * as CarouselItem from './CarouselItem'; -import * as CarouselCaption from './CarouselCaption'; +import CarouselItem = require('./CarouselItem'); +import CarouselCaption = require('./CarouselCaption'); declare namespace Carousel { export type CarouselProps = Omit, 'wrap'> & { diff --git a/types/react-bootstrap/lib/FormControl.d.ts b/types/react-bootstrap/lib/FormControl.d.ts index 9f40f81774..dd7528e2d4 100644 --- a/types/react-bootstrap/lib/FormControl.d.ts +++ b/types/react-bootstrap/lib/FormControl.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import { Sizes } from 'react-bootstrap'; -import * as FormControlFeedback from './FormControlFeedback'; -import * as FormControlStatic from './FormControlStatic'; +import FormControlFeedback = require('./FormControlFeedback'); +import FormControlStatic = require('./FormControlStatic'); declare namespace FormControl { export interface FormControlProps extends React.HTMLProps { diff --git a/types/react-bootstrap/lib/InputGroup.d.ts b/types/react-bootstrap/lib/InputGroup.d.ts index 7c99727439..6903fac5cf 100644 --- a/types/react-bootstrap/lib/InputGroup.d.ts +++ b/types/react-bootstrap/lib/InputGroup.d.ts @@ -1,7 +1,7 @@ import * as React from 'react'; import { Sizes } from 'react-bootstrap'; -import * as InputGroupAddon from './InputGroupAddon'; -import * as InputGroupButton from './InputGroupButton'; +import InputGroupAddon = require('./InputGroupAddon'); +import InputGroupButton = require('./InputGroupButton'); declare namespace InputGroup { export interface InputGroupProps extends React.HTMLProps { diff --git a/types/react-bootstrap/lib/Media.d.ts b/types/react-bootstrap/lib/Media.d.ts index eac35a0db9..4e85e69a51 100644 --- a/types/react-bootstrap/lib/Media.d.ts +++ b/types/react-bootstrap/lib/Media.d.ts @@ -1,10 +1,10 @@ import * as React from 'react'; -import * as MediaBody from './MediaBody'; -import * as MediaHeading from './MediaHeading'; -import * as MediaLeft from './MediaLeft'; -import * as MediaList from './MediaList'; -import * as MediaListItem from './MediaListItem'; -import * as MediaRight from './MediaRight'; +import MediaBody = require('./MediaBody'); +import MediaHeading = require('./MediaHeading'); +import MediaLeft = require('./MediaLeft'); +import MediaList = require('./MediaList'); +import MediaListItem = require('./MediaListItem'); +import MediaRight = require('./MediaRight'); declare namespace Media { export interface MediaProps extends React.HTMLProps { diff --git a/types/react-bootstrap/lib/Modal.d.ts b/types/react-bootstrap/lib/Modal.d.ts index 357b7fc8a6..9b5ada2cdc 100644 --- a/types/react-bootstrap/lib/Modal.d.ts +++ b/types/react-bootstrap/lib/Modal.d.ts @@ -1,10 +1,10 @@ import * as React from 'react'; import { Sizes, TransitionCallbacks } from 'react-bootstrap'; -import * as ModalBody from './ModalBody'; -import * as ModalHeader from './ModalHeader'; -import * as ModalTitle from './ModalTitle'; -import * as ModalDialog from './ModalDialog'; -import * as ModalFooter from './ModalFooter'; +import ModalBody = require('./ModalBody'); +import ModalHeader = require('./ModalHeader'); +import ModalTitle = require('./ModalTitle'); +import ModalDialog = require('./ModalDialog'); +import ModalFooter = require('./ModalFooter'); declare namespace Modal { interface ModalProps extends TransitionCallbacks, React.HTMLProps { diff --git a/types/react-bootstrap/lib/Navbar.d.ts b/types/react-bootstrap/lib/Navbar.d.ts index 5231c74052..5849c0392e 100644 --- a/types/react-bootstrap/lib/Navbar.d.ts +++ b/types/react-bootstrap/lib/Navbar.d.ts @@ -1,9 +1,9 @@ import * as React from 'react'; import { Sizes } from 'react-bootstrap'; -import * as NavbarBrand from './NavbarBrand'; -import * as NavbarCollapse from './NavbarCollapse'; -import * as NavbarHeader from './NavbarHeader'; -import * as NavbarToggle from './NavbarToggle'; +import NavbarBrand = require('./NavbarBrand'); +import NavbarCollapse = require('./NavbarCollapse'); +import NavbarHeader = require('./NavbarHeader'); +import NavbarToggle = require('./NavbarToggle'); declare namespace Navbar { export interface NavbarProps extends React.HTMLProps { diff --git a/types/react-bootstrap/lib/Pager.d.ts b/types/react-bootstrap/lib/Pager.d.ts index 647fd416c9..076d30a0af 100644 --- a/types/react-bootstrap/lib/Pager.d.ts +++ b/types/react-bootstrap/lib/Pager.d.ts @@ -1,6 +1,6 @@ import * as React from 'react'; import { SelectCallback } from 'react-bootstrap'; -import * as PagerItem from './PagerItem'; +import PagerItem = require('./PagerItem'); declare namespace Pager { export interface PagerProps extends React.HTMLProps { diff --git a/types/react-bootstrap/lib/Pagination.d.ts b/types/react-bootstrap/lib/Pagination.d.ts index 7e14e823fb..ead70fe342 100644 --- a/types/react-bootstrap/lib/Pagination.d.ts +++ b/types/react-bootstrap/lib/Pagination.d.ts @@ -1,11 +1,11 @@ import * as React from 'react'; import { Sizes, SelectCallback } from 'react-bootstrap'; -import * as PaginationFirst from './PaginationFirst' -import * as PaginationPrev from './PaginationPrev' -import * as PaginationNext from './PaginationNext' -import * as PaginationLast from './PaginationLast' -import * as PaginationEllipsis from './PaginationEllipsis' -import * as PaginationItem from './PaginationItem' +import PaginationFirst = require('./PaginationFirst'); +import PaginationPrev = require('./PaginationPrev'); +import PaginationNext = require('./PaginationNext'); +import PaginationLast = require('./PaginationLast'); +import PaginationEllipsis = require('./PaginationEllipsis'); +import PaginationItem = require('./PaginationItem'); declare namespace Pagination { export interface PaginationProps extends React.HTMLProps { diff --git a/types/react-bootstrap/lib/Panel.d.ts b/types/react-bootstrap/lib/Panel.d.ts index 9957ee1339..1494d69041 100644 --- a/types/react-bootstrap/lib/Panel.d.ts +++ b/types/react-bootstrap/lib/Panel.d.ts @@ -1,11 +1,11 @@ import * as React from 'react'; import { TransitionCallbacks, Sizes, SelectCallback } from 'react-bootstrap'; -import * as PanelHeading from './PanelHeading' -import * as PanelTitle from './PanelTitle' -import * as PanelToggle from './PanelToggle' -import * as PanelCollapse from './PanelCollapse' -import * as PanelBody from './PanelBody' -import * as PanelFooter from './PanelFooter' +import PanelHeading = require('./PanelHeading'); +import PanelTitle = require('./PanelTitle'); +import PanelToggle = require('./PanelToggle'); +import PanelCollapse = require('./PanelCollapse'); +import PanelBody = require('./PanelBody'); +import PanelFooter = require('./PanelFooter'); declare namespace Panel { export interface PanelProps extends TransitionCallbacks, React.HTMLProps { @@ -17,7 +17,7 @@ declare namespace Panel { onToggle?: SelectCallback; } } -declare class Panel extends React.Component { +declare class Panel extends React.Component { static Heading: typeof PanelHeading; static Title: typeof PanelTitle; static Toggle: typeof PanelToggle; diff --git a/types/react-bootstrap/lib/Tab.d.ts b/types/react-bootstrap/lib/Tab.d.ts index 1c98d8c0a3..d3df9dcf8c 100644 --- a/types/react-bootstrap/lib/Tab.d.ts +++ b/types/react-bootstrap/lib/Tab.d.ts @@ -1,8 +1,8 @@ import * as React from 'react'; import { TransitionCallbacks, Omit } from 'react-bootstrap'; -import * as TabContainer from './TabContainer'; -import * as TabPane from './TabPane'; -import * as TabContent from './TabContent'; +import TabContainer = require('./TabContainer'); +import TabPane = require('./TabPane'); +import TabContent = require('./TabContent'); declare namespace Tab { export interface TabProps extends TransitionCallbacks, Omit, "title"> { diff --git a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts index bca9544d70..27be6b95a9 100644 --- a/types/react-bootstrap/lib/ToggleButtonGroup.d.ts +++ b/types/react-bootstrap/lib/ToggleButtonGroup.d.ts @@ -19,16 +19,19 @@ declare namespace ToggleButtonGroup { /** Required if `type` is set to "radio" */ name: string; type: "radio"; + onChange?(value: any): void; } interface CheckboxProps { name?: string; type: "checkbox"; + onChange?(values: any[]): void; } export type ToggleButtonGroupProps = BaseProps & (RadioProps | CheckboxProps) - & Omit, "defaultValue" | "type" | "value">; + & Omit, "defaultValue" | "type" | "value"> + & Omit, "defaultValue" | "type" | "value" | "onChange">; } declare class ToggleButtonGroup extends React.Component { } diff --git a/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx b/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx index 7e44d8c600..07d6a8a442 100644 --- a/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx +++ b/types/react-bootstrap/test/react-bootstrap-individual-components-tests.tsx @@ -1,103 +1,103 @@ import * as React from 'react'; -import * as Accordion from 'react-bootstrap/lib/Accordion'; -import * as Alert from 'react-bootstrap/lib/Alert'; -import * as Badge from 'react-bootstrap/lib/Badge'; -import * as Breadcrumb from 'react-bootstrap/lib/Breadcrumb'; -import * as BreadcrumbItem from 'react-bootstrap/lib/BreadcrumbItem'; -import * as Button from 'react-bootstrap/lib/Button'; -import * as ButtonGroup from 'react-bootstrap/lib/ButtonGroup'; -import * as ButtonToolbar from 'react-bootstrap/lib/ButtonToolbar'; -import * as Carousel from 'react-bootstrap/lib/Carousel'; -import * as CarouselCaption from 'react-bootstrap/lib/CarouselCaption'; -import * as CarouselItem from 'react-bootstrap/lib/CarouselItem'; -import * as Checkbox from 'react-bootstrap/lib/Checkbox'; -import * as Clearfix from 'react-bootstrap/lib/Clearfix'; -import * as Col from 'react-bootstrap/lib/Col'; -import * as Collapse from 'react-bootstrap/lib/Collapse'; -import * as ControlLabel from 'react-bootstrap/lib/ControlLabel'; -import * as Dropdown from 'react-bootstrap/lib/Dropdown'; -import * as DropdownButton from 'react-bootstrap/lib/DropdownButton'; -import * as DropdownMenu from 'react-bootstrap/lib/DropdownMenu'; -import * as DropdownToggle from 'react-bootstrap/lib/DropdownToggle'; -import * as Fade from 'react-bootstrap/lib/Fade'; -import * as Form from 'react-bootstrap/lib/Form'; -import * as FormControl from 'react-bootstrap/lib/FormControl'; -import * as FormControlFeedback from 'react-bootstrap/lib/FormControlFeedback'; -import * as FormControlStatic from 'react-bootstrap/lib/FormControlStatic'; -import * as FormGroup from 'react-bootstrap/lib/FormGroup'; -import * as Glyphicon from 'react-bootstrap/lib/Glyphicon'; -import * as Grid from 'react-bootstrap/lib/Grid'; -import * as HelpBlock from 'react-bootstrap/lib/HelpBlock'; -import * as Image from 'react-bootstrap/lib/Image'; -import * as InputGroup from 'react-bootstrap/lib/InputGroup'; -import * as InputGroupAddon from 'react-bootstrap/lib/InputGroupAddon'; -import * as InputGroupButton from 'react-bootstrap/lib/InputGroupButton'; -import * as Jumbotron from 'react-bootstrap/lib/Jumbotron'; -import * as Label from 'react-bootstrap/lib/Label'; -import * as ListGroup from 'react-bootstrap/lib/ListGroup'; -import * as ListGroupItem from 'react-bootstrap/lib/ListGroupItem'; -import * as Media from 'react-bootstrap/lib/Media'; -import * as MediaBody from 'react-bootstrap/lib/MediaBody'; -import * as MediaHeading from 'react-bootstrap/lib/MediaHeading'; -import * as MediaLeft from 'react-bootstrap/lib/MediaLeft'; -import * as MediaList from 'react-bootstrap/lib/MediaList'; -import * as MediaListItem from 'react-bootstrap/lib/MediaListItem'; -import * as MediaRight from 'react-bootstrap/lib/MediaRight'; -import * as MenuItem from 'react-bootstrap/lib/MenuItem'; -import * as Modal from 'react-bootstrap/lib/Modal'; -import * as ModalBody from 'react-bootstrap/lib/ModalBody'; -import * as ModalDialog from 'react-bootstrap/lib/ModalDialog'; -import * as ModalFooter from 'react-bootstrap/lib/ModalFooter'; -import * as ModalHeader from 'react-bootstrap/lib/ModalHeader'; -import * as ModalTitle from 'react-bootstrap/lib/ModalTitle'; -import * as Nav from 'react-bootstrap/lib/Nav'; -import * as NavDropdown from 'react-bootstrap/lib/NavDropdown'; -import * as NavItem from 'react-bootstrap/lib/NavItem'; -import * as Navbar from 'react-bootstrap/lib/Navbar'; -import * as NavbarBrand from 'react-bootstrap/lib/NavbarBrand'; -import * as NavbarCollapse from 'react-bootstrap/lib/NavbarCollapse'; -import * as NavbarHeader from 'react-bootstrap/lib/NavbarHeader'; -import * as NavbarToggle from 'react-bootstrap/lib/NavbarToggle'; -import * as Overlay from 'react-bootstrap/lib/Overlay'; -import * as OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger'; -import * as PageHeader from 'react-bootstrap/lib/PageHeader'; -import * as PageItem from 'react-bootstrap/lib/PageItem'; -import * as Pager from 'react-bootstrap/lib/Pager'; -import * as PagerItem from 'react-bootstrap/lib/PagerItem'; -import * as Pagination from 'react-bootstrap/lib/Pagination'; -import * as PaginationFirst from 'react-bootstrap/lib/PaginationFirst'; -import * as PaginationPrev from 'react-bootstrap/lib/PaginationPrev'; -import * as PaginationNext from 'react-bootstrap/lib/PaginationNext'; -import * as PaginationLast from 'react-bootstrap/lib/PaginationLast'; -import * as PaginationEllipsis from 'react-bootstrap/lib/PaginationEllipsis'; -import * as PaginationItem from 'react-bootstrap/lib/PaginationItem'; -import * as Panel from 'react-bootstrap/lib/Panel'; -import * as PanelHeading from 'react-bootstrap/lib/PanelHeading'; -import * as PanelTitle from 'react-bootstrap/lib/PanelTitle'; -import * as PanelToggle from 'react-bootstrap/lib/PanelToggle'; -import * as PanelCollapse from 'react-bootstrap/lib/PanelCollapse'; -import * as PanelBody from 'react-bootstrap/lib/PanelBody'; -import * as PanelFooter from 'react-bootstrap/lib/PanelFooter'; -import * as PanelGroup from 'react-bootstrap/lib/PanelGroup'; -import * as Popover from 'react-bootstrap/lib/Popover'; -import * as ProgressBar from 'react-bootstrap/lib/ProgressBar'; -import * as Radio from 'react-bootstrap/lib/Radio'; -import * as ResponsiveEmbed from 'react-bootstrap/lib/ResponsiveEmbed'; -import * as Row from 'react-bootstrap/lib/Row'; -import * as SafeAnchor from 'react-bootstrap/lib/SafeAnchor'; -import * as SplitButton from 'react-bootstrap/lib/SplitButton'; -import * as SplitToggle from 'react-bootstrap/lib/SplitToggle'; -import * as Tab from 'react-bootstrap/lib/Tab'; -import * as TabContainer from 'react-bootstrap/lib/TabContainer'; -import * as TabContent from 'react-bootstrap/lib/TabContent'; -import * as TabPane from 'react-bootstrap/lib/TabPane'; -import * as Table from 'react-bootstrap/lib/Table'; -import * as Tabs from 'react-bootstrap/lib/Tabs'; -import * as Thumbnail from 'react-bootstrap/lib/Thumbnail'; -import * as ToggleButton from 'react-bootstrap/lib/ToggleButton'; -import * as ToggleButtonGroup from 'react-bootstrap/lib/ToggleButtonGroup'; -import * as Tooltip from 'react-bootstrap/lib/Tooltip'; -import * as Well from 'react-bootstrap/lib/Well'; +import Accordion = require('react-bootstrap/lib/Accordion'); +import Alert = require('react-bootstrap/lib/Alert'); +import Badge = require('react-bootstrap/lib/Badge'); +import Breadcrumb = require('react-bootstrap/lib/Breadcrumb'); +import BreadcrumbItem = require('react-bootstrap/lib/BreadcrumbItem'); +import Button = require('react-bootstrap/lib/Button'); +import ButtonGroup = require('react-bootstrap/lib/ButtonGroup'); +import ButtonToolbar = require('react-bootstrap/lib/ButtonToolbar'); +import Carousel = require('react-bootstrap/lib/Carousel'); +import CarouselCaption = require('react-bootstrap/lib/CarouselCaption'); +import CarouselItem = require('react-bootstrap/lib/CarouselItem'); +import Checkbox = require('react-bootstrap/lib/Checkbox'); +import Clearfix = require('react-bootstrap/lib/Clearfix'); +import Col = require('react-bootstrap/lib/Col'); +import Collapse = require('react-bootstrap/lib/Collapse'); +import ControlLabel = require('react-bootstrap/lib/ControlLabel'); +import Dropdown = require('react-bootstrap/lib/Dropdown'); +import DropdownButton = require('react-bootstrap/lib/DropdownButton'); +import DropdownMenu = require('react-bootstrap/lib/DropdownMenu'); +import DropdownToggle = require('react-bootstrap/lib/DropdownToggle'); +import Fade = require('react-bootstrap/lib/Fade'); +import Form = require('react-bootstrap/lib/Form'); +import FormControl = require('react-bootstrap/lib/FormControl'); +import FormControlFeedback = require('react-bootstrap/lib/FormControlFeedback'); +import FormControlStatic = require('react-bootstrap/lib/FormControlStatic'); +import FormGroup = require('react-bootstrap/lib/FormGroup'); +import Glyphicon = require('react-bootstrap/lib/Glyphicon'); +import Grid = require('react-bootstrap/lib/Grid'); +import HelpBlock = require('react-bootstrap/lib/HelpBlock'); +import Image = require('react-bootstrap/lib/Image'); +import InputGroup = require('react-bootstrap/lib/InputGroup'); +import InputGroupAddon = require('react-bootstrap/lib/InputGroupAddon'); +import InputGroupButton = require('react-bootstrap/lib/InputGroupButton'); +import Jumbotron = require('react-bootstrap/lib/Jumbotron'); +import Label = require('react-bootstrap/lib/Label'); +import ListGroup = require('react-bootstrap/lib/ListGroup'); +import ListGroupItem = require('react-bootstrap/lib/ListGroupItem'); +import Media = require('react-bootstrap/lib/Media'); +import MediaBody = require('react-bootstrap/lib/MediaBody'); +import MediaHeading = require('react-bootstrap/lib/MediaHeading'); +import MediaLeft = require('react-bootstrap/lib/MediaLeft'); +import MediaList = require('react-bootstrap/lib/MediaList'); +import MediaListItem = require('react-bootstrap/lib/MediaListItem'); +import MediaRight = require('react-bootstrap/lib/MediaRight'); +import MenuItem = require('react-bootstrap/lib/MenuItem'); +import Modal = require('react-bootstrap/lib/Modal'); +import ModalBody = require('react-bootstrap/lib/ModalBody'); +import ModalDialog = require('react-bootstrap/lib/ModalDialog'); +import ModalFooter = require('react-bootstrap/lib/ModalFooter'); +import ModalHeader = require('react-bootstrap/lib/ModalHeader'); +import ModalTitle = require('react-bootstrap/lib/ModalTitle'); +import Nav = require('react-bootstrap/lib/Nav'); +import NavDropdown = require('react-bootstrap/lib/NavDropdown'); +import NavItem = require('react-bootstrap/lib/NavItem'); +import Navbar = require('react-bootstrap/lib/Navbar'); +import NavbarBrand = require('react-bootstrap/lib/NavbarBrand'); +import NavbarCollapse = require('react-bootstrap/lib/NavbarCollapse'); +import NavbarHeader = require('react-bootstrap/lib/NavbarHeader'); +import NavbarToggle = require('react-bootstrap/lib/NavbarToggle'); +import Overlay = require('react-bootstrap/lib/Overlay'); +import OverlayTrigger = require('react-bootstrap/lib/OverlayTrigger'); +import PageHeader = require('react-bootstrap/lib/PageHeader'); +import PageItem = require('react-bootstrap/lib/PageItem'); +import Pager = require('react-bootstrap/lib/Pager'); +import PagerItem = require('react-bootstrap/lib/PagerItem'); +import Pagination = require('react-bootstrap/lib/Pagination'); +import PaginationFirst = require('react-bootstrap/lib/PaginationFirst'); +import PaginationPrev = require('react-bootstrap/lib/PaginationPrev'); +import PaginationNext = require('react-bootstrap/lib/PaginationNext'); +import PaginationLast = require('react-bootstrap/lib/PaginationLast'); +import PaginationEllipsis = require('react-bootstrap/lib/PaginationEllipsis'); +import PaginationItem = require('react-bootstrap/lib/PaginationItem'); +import Panel = require('react-bootstrap/lib/Panel'); +import PanelHeading = require('react-bootstrap/lib/PanelHeading'); +import PanelTitle = require('react-bootstrap/lib/PanelTitle'); +import PanelToggle = require('react-bootstrap/lib/PanelToggle'); +import PanelCollapse = require('react-bootstrap/lib/PanelCollapse'); +import PanelBody = require('react-bootstrap/lib/PanelBody'); +import PanelFooter = require('react-bootstrap/lib/PanelFooter'); +import PanelGroup = require('react-bootstrap/lib/PanelGroup'); +import Popover = require('react-bootstrap/lib/Popover'); +import ProgressBar = require('react-bootstrap/lib/ProgressBar'); +import Radio = require('react-bootstrap/lib/Radio'); +import ResponsiveEmbed = require('react-bootstrap/lib/ResponsiveEmbed'); +import Row = require('react-bootstrap/lib/Row'); +import SafeAnchor = require('react-bootstrap/lib/SafeAnchor'); +import SplitButton = require('react-bootstrap/lib/SplitButton'); +import SplitToggle = require('react-bootstrap/lib/SplitToggle'); +import Tab = require('react-bootstrap/lib/Tab'); +import TabContainer = require('react-bootstrap/lib/TabContainer'); +import TabContent = require('react-bootstrap/lib/TabContent'); +import TabPane = require('react-bootstrap/lib/TabPane'); +import Table = require('react-bootstrap/lib/Table'); +import Tabs = require('react-bootstrap/lib/Tabs'); +import Thumbnail = require('react-bootstrap/lib/Thumbnail'); +import ToggleButton = require('react-bootstrap/lib/ToggleButton'); +import ToggleButtonGroup = require('react-bootstrap/lib/ToggleButtonGroup'); +import Tooltip = require('react-bootstrap/lib/Tooltip'); +import Well = require('react-bootstrap/lib/Well'); const noop = () => {}; diff --git a/types/react-breadcrumbs-dynamic/index.d.ts b/types/react-breadcrumbs-dynamic/index.d.ts index 21fb9f977a..ed0521ec28 100644 --- a/types/react-breadcrumbs-dynamic/index.d.ts +++ b/types/react-breadcrumbs-dynamic/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/oklas/react-breadcrumbs-dynamic // Definitions by: mitsuruog // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-breadcrumbs-dynamic/tsconfig.json b/types/react-breadcrumbs-dynamic/tsconfig.json index 8b058ae2d6..1bb8a2273c 100644 --- a/types/react-breadcrumbs-dynamic/tsconfig.json +++ b/types/react-breadcrumbs-dynamic/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-breadcrumbs-dynamic-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-breadcrumbs/index.d.ts b/types/react-breadcrumbs/index.d.ts index c004e4aba4..d43b5ba81c 100644 --- a/types/react-breadcrumbs/index.d.ts +++ b/types/react-breadcrumbs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/svenanders/react-breadcrumbs // Definitions by: Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from "react"; import * as ReactRouter from "react-router"; diff --git a/types/react-breadcrumbs/react-breadcrumbs-tests.tsx b/types/react-breadcrumbs/react-breadcrumbs-tests.tsx index b8a51bf36e..980b27fe41 100644 --- a/types/react-breadcrumbs/react-breadcrumbs-tests.tsx +++ b/types/react-breadcrumbs/react-breadcrumbs-tests.tsx @@ -1,12 +1,10 @@ import * as React from 'react'; import * as ReactRouter from "react-router"; -import * as Breadcrumbs from 'react-breadcrumbs'; - +import Breadcrumbs = require('react-breadcrumbs'); interface MyComponentProps extends ReactRouter.RouteComponentProps<{}, { id: number }> { } - class MyComponent extends React.Component { render() { return ( diff --git a/types/react-broadcast/tsconfig.json b/types/react-broadcast/tsconfig.json index 270151cc33..9cfb3a43b0 100644 --- a/types/react-broadcast/tsconfig.json +++ b/types/react-broadcast/tsconfig.json @@ -1,17 +1,25 @@ { - "compilerOptions": { - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "module": "commonjs", - "lib": ["es6", "dom"], - "jsx": "react", - "strictNullChecks": true, - "strictFunctionTypes": false, - "noImplicitAny": true, - "noImplicitThis": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true - }, - "files": ["index.d.ts", "react-broadcast-tests.tsx"] -} + "compilerOptions": { + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "jsx": "react", + "strictNullChecks": true, + "strictFunctionTypes": false, + "noImplicitAny": true, + "noImplicitThis": true, + "forceConsistentCasingInFileNames": true, + "noEmit": true + }, + "files": [ + "index.d.ts", + "react-broadcast-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-burger-menu/index.d.ts b/types/react-burger-menu/index.d.ts index 585026eeee..51aec4fcd1 100644 --- a/types/react-burger-menu/index.d.ts +++ b/types/react-burger-menu/index.d.ts @@ -1,29 +1,41 @@ -// Type definitions for react-burger-menu 2.1 +// Type definitions for react-burger-menu 2.2 // Project: https://github.com/negomi/react-burger-menu // Definitions by: Rajab Shakirov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; export interface State { - isOpen: boolean; + isOpen: boolean; +} + +export interface Styles { + bmBurgerBars: Partial; + bmBurgerButton: Partial; + bmCross: Partial; + bmCrossButton: Partial; + bmItemList: Partial; + bmMenu: Partial; + bmMorphShape: Partial; + bmOverlay: Partial; } export interface Props { + bodyClassName?: string; burgerBarClassName?: string; burgerButtonClassName?: string; crossButtonClassName?: string; crossClassName?: string; customBurgerIcon?: JSX.Element | false; customCrossIcon?: JSX.Element | false; + disableOverlayClick?: boolean; id?: string; isOpen?: boolean; itemListClassName?: string; menuClassName?: string; morphShapeClassName?: string; noOverlay?: boolean; - disableOverlayClick?: boolean; onStateChange?(state: State): void; // TODO (Rajab) This can be improved, though I do not know how. From PropTypes: // styles && styles.outerContainer ? PropTypes.string.isRequired : PropTypes.string @@ -33,16 +45,7 @@ export interface Props { // styles && styles.pageWrap ? PropTypes.string.isRequired : PropTypes.string, pageWrapId?: string; right?: boolean; - styles?: { - bmBurgerButton: CSSStyleDeclaration; - bmBurgerBars: CSSStyleDeclaration; - bmCrossButton: CSSStyleDeclaration; - bmCross: CSSStyleDeclaration; - bmMenu: CSSStyleDeclaration; - bmMorphShape: CSSStyleDeclaration; - bmItemList: CSSStyleDeclaration; - bmOverlay: CSSStyleDeclaration; - }; + styles?: Styles; width?: number | string; } @@ -57,3 +60,4 @@ export class pushRotate extends ReactBurgerMenu { } export class scaleDown extends ReactBurgerMenu { } export class scaleRotate extends ReactBurgerMenu { } export class fallDown extends ReactBurgerMenu { } +export class reveal extends ReactBurgerMenu { } diff --git a/types/react-bytesize-icons/index.d.ts b/types/react-bytesize-icons/index.d.ts index d1176b810b..d9dd1a50f7 100644 --- a/types/react-bytesize-icons/index.d.ts +++ b/types/react-bytesize-icons/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/abdelhai/react-bytesize-icons // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-calendar-heatmap/index.d.ts b/types/react-calendar-heatmap/index.d.ts index f15ff887ca..9f85b5bd2f 100644 --- a/types/react-calendar-heatmap/index.d.ts +++ b/types/react-calendar-heatmap/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/patientslikeme/react-calendar-heatmap // Definitions by: Keisuke Kan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-calendar-timeline/index.d.ts b/types/react-calendar-timeline/index.d.ts index a8f76daca1..69e5d037dc 100644 --- a/types/react-calendar-timeline/index.d.ts +++ b/types/react-calendar-timeline/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/namespace-ee/react-calendar-timeline // Definitions by: Rajab Shakirov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-click-outside/index.d.ts b/types/react-click-outside/index.d.ts index 4f5f7e96cb..5a1ce6d220 100644 --- a/types/react-click-outside/index.d.ts +++ b/types/react-click-outside/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kentor/react-click-outside // Definitions by: Christian Rackerseder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; declare function enhanceWithClickOutside

(wrappedComponent: React.ComponentClass

): React.ComponentClass

; diff --git a/types/react-click-outside/react-click-outside-tests.tsx b/types/react-click-outside/react-click-outside-tests.tsx index 6f215e39a8..6aa375b153 100644 --- a/types/react-click-outside/react-click-outside-tests.tsx +++ b/types/react-click-outside/react-click-outside-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import { render } from 'react-dom'; -import * as enhanceWithClickOutside from 'react-click-outside'; +import enhanceWithClickOutside = require('react-click-outside'); interface Props { text: string; diff --git a/types/react-click-outside/tsconfig.json b/types/react-click-outside/tsconfig.json index 57ca39a8f0..caf91fdc1d 100644 --- a/types/react-click-outside/tsconfig.json +++ b/types/react-click-outside/tsconfig.json @@ -1,25 +1,25 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "react-click-outside-tests.tsx" - ] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-click-outside-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-codemirror/index.d.ts b/types/react-codemirror/index.d.ts index afe3db2f75..607554b269 100644 --- a/types/react-codemirror/index.d.ts +++ b/types/react-codemirror/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Vicky Lai // Rudi Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 /// /// diff --git a/types/react-codemirror/react-codemirror-tests.tsx b/types/react-codemirror/react-codemirror-tests.tsx index f794e49d94..8673925d1c 100644 --- a/types/react-codemirror/react-codemirror-tests.tsx +++ b/types/react-codemirror/react-codemirror-tests.tsx @@ -1,7 +1,7 @@ -import * as CodeMirror from "codemirror"; +import CodeMirror = require("codemirror"); import * as React from "react"; import * as ReactDOM from "react-dom"; -import * as Codemirror from "react-codemirror"; +import Codemirror = require("react-codemirror"); class CodemirrorTest extends React.Component> { private editorRef: ReactCodeMirror.ReactCodeMirror; diff --git a/types/react-collapse/index.d.ts b/types/react-collapse/index.d.ts index ebb15e2dbb..a4061860ba 100644 --- a/types/react-collapse/index.d.ts +++ b/types/react-collapse/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/nkbt/react-collapse // Definitions by: Adam Binford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; export interface CollapseProps extends React.HTMLProps { diff --git a/types/react-collapse/tsconfig.json b/types/react-collapse/tsconfig.json index 291864c9d3..c3dbb022a3 100644 --- a/types/react-collapse/tsconfig.json +++ b/types/react-collapse/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-collapse-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-color/index.d.ts b/types/react-color/index.d.ts index b3cf15bc98..051d9d4b7f 100644 --- a/types/react-color/index.d.ts +++ b/types/react-color/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/casesandberg/react-color/ // Definitions by: Karol Janyst , Marks Polakovs , Matthieu Montaudouin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, ClassAttributes, StatelessComponent, ReactNode } from "react"; diff --git a/types/react-confirm/index.d.ts b/types/react-confirm/index.d.ts index 23b9f40772..d07a367eab 100644 --- a/types/react-confirm/index.d.ts +++ b/types/react-confirm/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/haradakunihiko/react-confirm // Definitions by: santiagodoldan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-confirm/tsconfig.json b/types/react-confirm/tsconfig.json index da3acdd363..10f1988053 100644 --- a/types/react-confirm/tsconfig.json +++ b/types/react-confirm/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-confirm-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-content-loader/index.d.ts b/types/react-content-loader/index.d.ts index a8f320eaa9..21f58664ca 100644 --- a/types/react-content-loader/index.d.ts +++ b/types/react-content-loader/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/danilowoz/react-content-loader // Definitions by: Alaa Masoud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-content-loader/tsconfig.json b/types/react-content-loader/tsconfig.json index 4385503dc9..6ec4332426 100644 --- a/types/react-content-loader/tsconfig.json +++ b/types/react-content-loader/tsconfig.json @@ -21,4 +21,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/types/react-copy-to-clipboard/index.d.ts b/types/react-copy-to-clipboard/index.d.ts index 1ee7dc0f9d..33e9549d30 100644 --- a/types/react-copy-to-clipboard/index.d.ts +++ b/types/react-copy-to-clipboard/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Meno Abels // Bernabe // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx b/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx index a3459a66a5..c411139501 100644 --- a/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx +++ b/types/react-copy-to-clipboard/react-copy-to-clipboard-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as CopyToClipboard from "react-copy-to-clipboard"; +import CopyToClipboard = require("react-copy-to-clipboard"); export class Test extends React.Component { render() { diff --git a/types/react-cropper/index.d.ts b/types/react-cropper/index.d.ts index 43f2cac063..3ab1106754 100644 --- a/types/react-cropper/index.d.ts +++ b/types/react-cropper/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/roadmanfong/react-cropper // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as cropperjs from 'cropperjs'; import * as React from 'react'; diff --git a/types/react-css-modules/index.d.ts b/types/react-css-modules/index.d.ts index 5ab7755478..955f76efa5 100644 --- a/types/react-css-modules/index.d.ts +++ b/types/react-css-modules/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gajus/react-css-modules // Definitions by: Kostya Esmukov , Tadas Dailyda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 interface TypeOptions { allowMultiple?: boolean; diff --git a/types/react-css-modules/react-css-modules-tests.tsx b/types/react-css-modules/react-css-modules-tests.tsx index da191799c7..967036a8d0 100644 --- a/types/react-css-modules/react-css-modules-tests.tsx +++ b/types/react-css-modules/react-css-modules-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as CSSModules from 'react-css-modules'; +import CSSModules= require('react-css-modules'); const styles = {}; diff --git a/types/react-css-transition-replace/index.d.ts b/types/react-css-transition-replace/index.d.ts index 96f0952391..f252707f42 100644 --- a/types/react-css-transition-replace/index.d.ts +++ b/types/react-css-transition-replace/index.d.ts @@ -2,7 +2,7 @@ // Project: http://marnusw.github.io/react-css-transition-replace/ // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; import * as CSSTransitionGroup from "react-addons-css-transition-group"; diff --git a/types/react-css-transition-replace/react-css-transition-replace-tests.tsx b/types/react-css-transition-replace/react-css-transition-replace-tests.tsx index 2da448d448..acbd376a1b 100644 --- a/types/react-css-transition-replace/react-css-transition-replace-tests.tsx +++ b/types/react-css-transition-replace/react-css-transition-replace-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react" import { render } from 'react-dom'; -import * as CSSTransitionReplace from "react-css-transition-replace" +import CSSTransitionReplace = require("react-css-transition-replace"); render( diff --git a/types/react-custom-scrollbars/index.d.ts b/types/react-custom-scrollbars/index.d.ts index 4af4d37d06..a55675ed8d 100644 --- a/types/react-custom-scrollbars/index.d.ts +++ b/types/react-custom-scrollbars/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: David-LeBlanc-git // kittimiyo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-custom-scrollbars/v3/index.d.ts b/types/react-custom-scrollbars/v3/index.d.ts index 6c408ec6f8..c0e7c1709e 100644 --- a/types/react-custom-scrollbars/v3/index.d.ts +++ b/types/react-custom-scrollbars/v3/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/malte-wessel/react-custom-scrollbars // Definitions by: David-LeBlanc-git // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-data-grid/index.d.ts b/types/react-data-grid/index.d.ts index f712b43e1b..27f12bccb6 100644 --- a/types/react-data-grid/index.d.ts +++ b/types/react-data-grid/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/adazzle/react-data-grid.git // Definitions by: Simon Gellis , Kieran Peat , Martin Novak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-data-grid/react-data-grid-tests.tsx b/types/react-data-grid/react-data-grid-tests.tsx index 1b42af7ae6..827e20c820 100644 --- a/types/react-data-grid/react-data-grid-tests.tsx +++ b/types/react-data-grid/react-data-grid-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as ReactDataGrid from 'react-data-grid'; +import ReactDataGrid = require('react-data-grid'); import * as ReactDataGridPlugins from 'react-data-grid-addons'; import faker = require('faker'); diff --git a/types/react-data-grid/v1/index.d.ts b/types/react-data-grid/v1/index.d.ts index 20ffef6c2b..81d7386dca 100644 --- a/types/react-data-grid/v1/index.d.ts +++ b/types/react-data-grid/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/adazzle/react-data-grid.git // Definitions by: Simon Gellis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-data-grid/v1/react-data-grid-tests.tsx b/types/react-data-grid/v1/react-data-grid-tests.tsx index bff860ee02..371831b43a 100644 --- a/types/react-data-grid/v1/react-data-grid-tests.tsx +++ b/types/react-data-grid/v1/react-data-grid-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as ReactDataGrid from 'react-data-grid'; +import ReactDataGrid = require('react-data-grid'); import * as ReactDataGridPlugins from 'react-data-grid/addons'; import faker = require('faker'); diff --git a/types/react-datagrid/index.d.ts b/types/react-datagrid/index.d.ts index e3c8d983ea..8b8d6e4848 100644 --- a/types/react-datagrid/index.d.ts +++ b/types/react-datagrid/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/zippyui/react-datagrid.git // Definitions by: Stephen Jelfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-date-range/index.d.ts b/types/react-date-range/index.d.ts index 68df9722bf..e5be9f751b 100644 --- a/types/react-date-range/index.d.ts +++ b/types/react-date-range/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Adphorus/react-date-range/ // Definitions by: Junbong Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import * as moment from "moment-timezone"; diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index 60309b7f20..368894c0ed 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -7,7 +7,7 @@ // Roy Xue // Koala Human // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from "react"; import * as moment from "moment"; @@ -59,6 +59,7 @@ export interface ReactDatePickerProps { peekNextMonth?: boolean; placeholderText?: string; popperClassName?: string; + popperContainer?(props: { children: React.ReactNode[] }): React.ReactNode; popperModifiers?: any; popperPlacement?: string; preventOpenOnFocus?: boolean; diff --git a/types/react-datepicker/react-datepicker-tests.tsx b/types/react-datepicker/react-datepicker-tests.tsx index 4d5edad58e..92cf23e38b 100644 --- a/types/react-datepicker/react-datepicker-tests.tsx +++ b/types/react-datepicker/react-datepicker-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as moment from 'moment'; +import moment = require('moment'); import DatePicker from 'react-datepicker'; class ReactDatePicker extends React.Component<{}, { startDate: moment.Moment; displayName: string; }> { diff --git a/types/react-daterange-picker/index.d.ts b/types/react-daterange-picker/index.d.ts index 55e33ff2bb..e6fac4c33d 100644 --- a/types/react-daterange-picker/index.d.ts +++ b/types/react-daterange-picker/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: UNCOVER TRUTH Inc. // MartynasZilinskas // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; import * as moment from "moment"; diff --git a/types/react-daterange-picker/react-daterange-picker-tests.tsx b/types/react-daterange-picker/react-daterange-picker-tests.tsx index e1259dd81e..11bc2a3852 100644 --- a/types/react-daterange-picker/react-daterange-picker-tests.tsx +++ b/types/react-daterange-picker/react-daterange-picker-tests.tsx @@ -5,7 +5,7 @@ import DateRangePicker from "react-daterange-picker"; import * as ReactDateRangePicker from "react-daterange-picker"; import * as MomentRange from "moment-range"; -import * as Moment from "moment"; +import Moment = require("moment"); const moment = MomentRange.extendMoment(Moment); diff --git a/types/react-dates/index.d.ts b/types/react-dates/index.d.ts index 2038b8a5d2..f9444c1b7c 100644 --- a/types/react-dates/index.d.ts +++ b/types/react-dates/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/airbnb/react-dates // Definitions by: Artur Ampilogov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; import * as moment from "moment"; @@ -72,8 +72,8 @@ declare namespace ReactDates { // navigation related props navPrev?: string | JSX.Element, navNext?: string | JSX.Element, - onPrevMonthClick?: (e: React.EventHandler>) => void, - onNextMonthClick?: (e: React.EventHandler>) => void, + onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, + onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void, transitionDuration?: number, @@ -146,6 +146,9 @@ declare namespace ReactDates { customInputIcon?: string | JSX.Element, noBorder?: boolean, block?: boolean, + small?: boolean, + regular?: boolean, + keepFocusOnInput?: boolean, // calendar presentation and interaction related props renderMonth?: (day: momentPropTypes.momentObj) => (string | JSX.Element), @@ -163,12 +166,14 @@ declare namespace ReactDates { hideKeyboardShortcutsPanel?: boolean, daySize?: number, isRTL?: boolean, + verticalSpacing?: number, + verticalHeight?: number| null, // navigation related props navPrev?: string | JSX.Element, navNext?: string | JSX.Element, - onPrevMonthClick?: (e: React.EventHandler>) => void, - onNextMonthClick?: (e: React.EventHandler>) => void, + onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, + onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, onClose?: (final: { startDate: momentPropTypes.momentObj, endDate: momentPropTypes.momentObj }) => void, transitionDuration?: number, @@ -244,8 +249,8 @@ declare namespace ReactDates { navPrev?: string | JSX.Element, navNext?: string | JSX.Element, hideKeyboardShortcutsPanel?: boolean; - onPrevMonthClick?: (e: React.EventHandler>) => void, - onNextMonthClick?: (e: React.EventHandler>) => void, + onPrevMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, + onNextMonthClick?: (newCurrentMonth: momentPropTypes.momentObj) => void, transitionDuration?: number, // day presentation and interaction related props diff --git a/types/react-dates/react-dates-tests.tsx b/types/react-dates/react-dates-tests.tsx index f9d3118a4f..6462a6ebd5 100644 --- a/types/react-dates/react-dates-tests.tsx +++ b/types/react-dates/react-dates-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as moment from "moment"; +import moment = require("moment"); import { SingleDatePicker, @@ -13,9 +13,6 @@ import { toLocalizedDateString, toMomentObject } from "react-dates"; - - - class SingleDatePickerMinimumTest extends React.Component { render() { return day.toString()} + verticalSpacing={4} + keepFocusOnInput={true} + verticalHeight={5} + regular={true} + small={true} /> } } diff --git a/types/react-daum-postcode/index.d.ts b/types/react-daum-postcode/index.d.ts index 058777bc29..b6d093db2d 100644 --- a/types/react-daum-postcode/index.d.ts +++ b/types/react-daum-postcode/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kimminsik-bernard/react-daum-postcode // Definitions by: Sa-ryong Kang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from 'react'; diff --git a/types/react-dnd-html5-backend/index.d.ts b/types/react-dnd-html5-backend/index.d.ts index 6789ab3a19..1cf8f78335 100644 --- a/types/react-dnd-html5-backend/index.d.ts +++ b/types/react-dnd-html5-backend/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/react-dnd // Definitions by: Pedro Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as ReactDnd from "react-dnd"; diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts index 25029631cb..7e8b3ff209 100644 --- a/types/react-dnd-multi-backend/index.d.ts +++ b/types/react-dnd-multi-backend/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/LouisBrunner/react-dnd-multi-backend // Definitions by: Janeene Beeforth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { CSSProperties, PureComponent } from "react"; import { Backend } from "react-dnd"; diff --git a/types/react-dnd-multi-backend/tsconfig.json b/types/react-dnd-multi-backend/tsconfig.json index e9857447ef..7ee0ca562c 100644 --- a/types/react-dnd-multi-backend/tsconfig.json +++ b/types/react-dnd-multi-backend/tsconfig.json @@ -23,4 +23,4 @@ "lib/HTML5toTouch.d.ts", "react-dnd-multi-backend-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-dnd-test-backend/tsconfig.json b/types/react-dnd-test-backend/tsconfig.json index aaf674e57e..b83ff74de3 100644 --- a/types/react-dnd-test-backend/tsconfig.json +++ b/types/react-dnd-test-backend/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-dnd-test-backend-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-dnd-touch-backend/index.d.ts b/types/react-dnd-touch-backend/index.d.ts index 6cf6037048..d8e1681f96 100644 --- a/types/react-dnd-touch-backend/index.d.ts +++ b/types/react-dnd-touch-backend/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/yahoo/react-dnd-touch-backend#readme // Definitions by: Daniel Król , Janeene Beeforth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as ReactDnd from "react-dnd"; diff --git a/types/react-dnd-touch-backend/tsconfig.json b/types/react-dnd-touch-backend/tsconfig.json index 926592e1c3..de3b6da377 100644 --- a/types/react-dnd-touch-backend/tsconfig.json +++ b/types/react-dnd-touch-backend/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-dnd-touch-backend-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-dnd/index.d.ts b/types/react-dnd/index.d.ts index fe7d3c18f8..6625903ad1 100644 --- a/types/react-dnd/index.d.ts +++ b/types/react-dnd/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/react-dnd // Definitions by: Asana // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// @@ -125,6 +125,8 @@ declare module __ReactDnd { captureDraggingState?: boolean; anchorX?: number; anchorY?: number; + offsetX?: number; + offsetY?: number; } type ConnectDragSource = DragElementWrapper; diff --git a/types/react-document-title/index.d.ts b/types/react-document-title/index.d.ts index fa22fe30dc..85e9f3eb48 100644 --- a/types/react-document-title/index.d.ts +++ b/types/react-document-title/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/react-document-title // Definitions by: Cleve Littlefield // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-dom-factories/index.d.ts b/types/react-dom-factories/index.d.ts index a0c63f0562..eaf04f766f 100644 --- a/types/react-dom-factories/index.d.ts +++ b/types/react-dom-factories/index.d.ts @@ -2,7 +2,7 @@ // Project: https://facebook.github.io/react/ // Definitions by: John Gozde // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export as namespace ReactDOMFactories; export = ReactDOMFactories; diff --git a/types/react-dom-factories/tsconfig.json b/types/react-dom-factories/tsconfig.json index 8cdf540399..fa72301516 100644 --- a/types/react-dom-factories/tsconfig.json +++ b/types/react-dom-factories/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "react-dom-factories-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-dom/index.d.ts b/types/react-dom/index.d.ts index 20b870a8b8..da494182d6 100644 --- a/types/react-dom/index.d.ts +++ b/types/react-dom/index.d.ts @@ -6,7 +6,7 @@ // MartynasZilinskas // Josh Rutherford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export as namespace ReactDOM; diff --git a/types/react-dom/v15/index.d.ts b/types/react-dom/v15/index.d.ts index 796314e19f..bd39e0a5e1 100644 --- a/types/react-dom/v15/index.d.ts +++ b/types/react-dom/v15/index.d.ts @@ -5,7 +5,7 @@ // Microsoft // MartynasZilinskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export as namespace ReactDOM; diff --git a/types/react-dropzone/v2/index.d.ts b/types/react-dropzone/v2/index.d.ts index 396fccc3b3..995e2cdb7d 100644 --- a/types/react-dropzone/v2/index.d.ts +++ b/types/react-dropzone/v2/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/okonet/react-dropzone // Definitions by: Mathieu Larouche Dube , Ivo Jesus , Luís Rodrigues , Ben Bayard // Definitions: https://github.com/Vooban/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-dropzone/v3/index.d.ts b/types/react-dropzone/v3/index.d.ts index c2ab8820de..55f485203f 100644 --- a/types/react-dropzone/v3/index.d.ts +++ b/types/react-dropzone/v3/index.d.ts @@ -6,7 +6,7 @@ // Ben Bayard , // Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { CSSProperties, Component, DragEvent, InputHTMLAttributes } from "react"; diff --git a/types/react-dynamic-number/tsconfig.json b/types/react-dynamic-number/tsconfig.json index ad1a3aee65..f0d426113b 100644 --- a/types/react-dynamic-number/tsconfig.json +++ b/types/react-dynamic-number/tsconfig.json @@ -1,17 +1,25 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, "jsx": "react", "strictFunctionTypes": true }, - "files": ["index.d.ts", "react-dynamic-number-tests.tsx"] -} + "files": [ + "index.d.ts", + "react-dynamic-number-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-easy-chart/index.d.ts b/types/react-easy-chart/index.d.ts index 9c254c6a28..fa3eb07b2c 100644 --- a/types/react-easy-chart/index.d.ts +++ b/types/react-easy-chart/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/rma-consulting/react-easy-chart // Definitions by: Dave Leaver // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-event-listener/index.d.ts b/types/react-event-listener/index.d.ts index abfee41683..4b343c67e4 100644 --- a/types/react-event-listener/index.d.ts +++ b/types/react-event-listener/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/oliviertassinari/react-event-listener // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-fa/index.d.ts b/types/react-fa/index.d.ts index 38d9e9e1f2..86480a197e 100644 --- a/types/react-fa/index.d.ts +++ b/types/react-fa/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/andreypopp/react-fa // Definitions by: Frank Laub , Pat Sissons , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, ComponentClass, HTMLProps, StatelessComponent, ReactElement } from "react"; diff --git a/types/react-facebook-login/index.d.ts b/types/react-facebook-login/index.d.ts index d8fd4a0c8b..3cb1c21605 100644 --- a/types/react-facebook-login/index.d.ts +++ b/types/react-facebook-login/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/keppelen/react-facebook-login // Definitions by: Alexandre Paré , Jan Karres // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-faux-dom/index.d.ts b/types/react-faux-dom/index.d.ts index 59c771527d..70257b5ce5 100644 --- a/types/react-faux-dom/index.d.ts +++ b/types/react-faux-dom/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Ali Taheri Moghaddar // Cleve Littlefield // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-file-input/index.d.ts b/types/react-file-input/index.d.ts index 48c9854e55..d2aa7c70cf 100644 --- a/types/react-file-input/index.d.ts +++ b/types/react-file-input/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/react-file-input // Definitions by: Dmitry Rogozhny // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-file-reader-input/index.d.ts b/types/react-file-reader-input/index.d.ts index af87636234..c198d2c5f1 100644 --- a/types/react-file-reader-input/index.d.ts +++ b/types/react-file-reader-input/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/react-file-reader-input // Definitions by: Dmitry Rogozhny , Ali Taheri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-file-reader-input/react-file-reader-input-tests.tsx b/types/react-file-reader-input/react-file-reader-input-tests.tsx index 5170780d8b..0367152f27 100644 --- a/types/react-file-reader-input/react-file-reader-input-tests.tsx +++ b/types/react-file-reader-input/react-file-reader-input-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as FileReaderInput from 'react-file-reader-input'; +import FileReaderInput = require('react-file-reader-input'); class MyComponent extends React.Component { handleChange = (event: React.SyntheticEvent, results: FileReaderInput.Result[]) => { diff --git a/types/react-flags-select/index.d.ts b/types/react-flags-select/index.d.ts index 6a2e1dc964..df01a33ae4 100644 --- a/types/react-flags-select/index.d.ts +++ b/types/react-flags-select/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ekwonye-richard/react-flags-select#readme // Definitions by: Artur Sianiuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from 'react'; diff --git a/types/react-flags-select/tsconfig.json b/types/react-flags-select/tsconfig.json index f42fa48c4a..f1b35fc914 100644 --- a/types/react-flags-select/tsconfig.json +++ b/types/react-flags-select/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-flags-select-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-flatpickr/index.d.ts b/types/react-flatpickr/index.d.ts index ebac89f48d..68d79a2b6c 100644 --- a/types/react-flatpickr/index.d.ts +++ b/types/react-flatpickr/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/coderhaoxin/react-flatpickr // Definitions by: begincalendar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from 'react'; import { Options } from 'flatpickr'; diff --git a/types/react-flex/index.d.ts b/types/react-flex/index.d.ts index 446445b2ba..50df2b6fb1 100644 --- a/types/react-flex/index.d.ts +++ b/types/react-flex/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/zippyui/react-flex // Definitions by: Jeffery Grajkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-flexr/index.d.ts b/types/react-flexr/index.d.ts index 4b610711f6..31be71a93e 100644 --- a/types/react-flexr/index.d.ts +++ b/types/react-flexr/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kodyl/react-flexr // Definitions by: Jeffery Grajkowski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-fontawesome/index.d.ts b/types/react-fontawesome/index.d.ts index 2e76b305b7..118f6fb4cd 100644 --- a/types/react-fontawesome/index.d.ts +++ b/types/react-fontawesome/index.d.ts @@ -5,7 +5,7 @@ // Vincas Stonys // Gavin Gregory // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-form/index.d.ts b/types/react-form/index.d.ts index 965f55e7e7..e2c2823d7f 100644 --- a/types/react-form/index.d.ts +++ b/types/react-form/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tannerlinsley/react-form#readme // Definitions by: Cameron McAteer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-form/v1/index.d.ts b/types/react-form/v1/index.d.ts index 4694efa926..41ca659a2d 100644 --- a/types/react-form/v1/index.d.ts +++ b/types/react-form/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tannerlinsley/react-form#readme // Definitions by: Cameron McAteer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-form/v1/tsconfig.json b/types/react-form/v1/tsconfig.json index c1691ba3b1..0823491b1a 100644 --- a/types/react-form/v1/tsconfig.json +++ b/types/react-form/v1/tsconfig.json @@ -1,30 +1,30 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "jsx": "react", - "typeRoots": [ - "../../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true, - "paths": { - "react-form": [ - "react-form/v1" - ] - } - }, - "files": [ - "index.d.ts", - "react-form-tests.tsx" - ] + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "jsx": "react", + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "paths": { + "react-form": [ + "react-form/v1" + ] + } + }, + "files": [ + "index.d.ts", + "react-form-tests.tsx" + ] } \ No newline at end of file diff --git a/types/react-foundation/index.d.ts b/types/react-foundation/index.d.ts index d50d73f556..9c88ff2f7e 100644 --- a/types/react-foundation/index.d.ts +++ b/types/react-foundation/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/digiaonline/react-foundation // Definitions by: Daniel Earwicker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export { Accordion, AccordionItem, AccordionTitle, AccordionContent } from './components/accordion'; export { Badge } from './components/badge'; diff --git a/types/react-geosuggest/index.d.ts b/types/react-geosuggest/index.d.ts index c0f2aa5ede..8a06859b53 100644 --- a/types/react-geosuggest/index.d.ts +++ b/types/react-geosuggest/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ubilabs/react-geosuggest // Definitions by: Brad Menchl // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 /// @@ -34,7 +34,7 @@ export interface GeosuggestProps extends InputHTMLAttributes { queryDelay?: number; minLength?: number; highlightMatch?: boolean; - onFocus?(): void; + onFocus?(value: any): void; onBlur?(value: any): void; onChange?(value: any): void; onKeyDown?(event: any): void; diff --git a/types/react-google-recaptcha/index.d.ts b/types/react-google-recaptcha/index.d.ts index fee09c3ec8..841b6440af 100644 --- a/types/react-google-recaptcha/index.d.ts +++ b/types/react-google-recaptcha/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/dozoisch/react-google-recaptcha // Definitions by: Koala Human // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-google-recaptcha/tsconfig.json b/types/react-google-recaptcha/tsconfig.json index bbd1cfd004..52df741020 100644 --- a/types/react-google-recaptcha/tsconfig.json +++ b/types/react-google-recaptcha/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-google-recaptcha-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-gravatar/index.d.ts b/types/react-gravatar/index.d.ts index d7941f9224..e2418c2cf6 100644 --- a/types/react-gravatar/index.d.ts +++ b/types/react-gravatar/index.d.ts @@ -2,7 +2,7 @@ // Project: http://kyleamathews.github.io/react-gravatar/ // Definitions by: invliD // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-gravatar/react-gravatar-tests.tsx b/types/react-gravatar/react-gravatar-tests.tsx index 1482af274d..f89881e930 100644 --- a/types/react-gravatar/react-gravatar-tests.tsx +++ b/types/react-gravatar/react-gravatar-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as Gravatar from "react-gravatar"; +import Gravatar = require("react-gravatar"); class GravatarEmailTest extends React.Component { render() { diff --git a/types/react-grid-layout/index.d.ts b/types/react-grid-layout/index.d.ts index 8dddb624d1..ff25317a96 100644 --- a/types/react-grid-layout/index.d.ts +++ b/types/react-grid-layout/index.d.ts @@ -5,7 +5,7 @@ // Zheyang Song , // Andrew Hathaway // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-grid-layout/react-grid-layout-tests.tsx b/types/react-grid-layout/react-grid-layout-tests.tsx index 6c47e42d95..78ecf594ef 100644 --- a/types/react-grid-layout/react-grid-layout-tests.tsx +++ b/types/react-grid-layout/react-grid-layout-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as ReactGridLayout from 'react-grid-layout'; +import ReactGridLayout = require('react-grid-layout'); import { Responsive, WidthProvider } from 'react-grid-layout'; const ResponsiveWidth = WidthProvider(Responsive); diff --git a/types/react-hamburger-menu/index.d.ts b/types/react-hamburger-menu/index.d.ts index 1f91e6e8f0..c187a7ace3 100644 --- a/types/react-hamburger-menu/index.d.ts +++ b/types/react-hamburger-menu/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/cameronbourke/react-hamburger-menu // Definitions by: Grzegorz Kielak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-helmet/index.d.ts b/types/react-helmet/index.d.ts index 359836bea8..4a2a9e46c8 100644 --- a/types/react-helmet/index.d.ts +++ b/types/react-helmet/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/nfl/react-helmet // Definitions by: Evan Bremer , Isman Usoh , François Nguyen , Kok Sam , Yui T. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-helmet/v4/index.d.ts b/types/react-helmet/v4/index.d.ts index ab5ea373df..b9a813b432 100644 --- a/types/react-helmet/v4/index.d.ts +++ b/types/react-helmet/v4/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/nfl/react-helmet // Definitions by: Evan Bremer , Isman Usoh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-helmet/v4/react-helmet-tests.tsx b/types/react-helmet/v4/react-helmet-tests.tsx index e6b78955b3..695751d381 100644 --- a/types/react-helmet/v4/react-helmet-tests.tsx +++ b/types/react-helmet/v4/react-helmet-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as Helmet from 'react-helmet'; +import Helmet = require('react-helmet'); diff --git a/types/react-highlight-words/index.d.ts b/types/react-highlight-words/index.d.ts index 3f37a70aaf..669a600dc9 100644 --- a/types/react-highlight-words/index.d.ts +++ b/types/react-highlight-words/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bvaughn/react-highlight-words#readme // Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-highlighter/index.d.ts b/types/react-highlighter/index.d.ts index 8e918d87b7..022cdc911a 100644 --- a/types/react-highlighter/index.d.ts +++ b/types/react-highlighter/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/helior/react-highlighter // Definitions by: Pedro Pereira // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-holder/index.d.ts b/types/react-holder/index.d.ts index a82731f8ba..3fa3541786 100644 --- a/types/react-holder/index.d.ts +++ b/types/react-holder/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Moeriki/react-holder // Definitions by: Isman Usoh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-hot-loader/index.d.ts b/types/react-hot-loader/index.d.ts index 6bd1234259..6443fd1f43 100644 --- a/types/react-hot-loader/index.d.ts +++ b/types/react-hot-loader/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/react-hot-loader // Definitions by: Jacek Jagiello // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react" diff --git a/types/react-hyperscript/index.d.ts b/types/react-hyperscript/index.d.ts index 207ffe18ce..09030de2a9 100644 --- a/types/react-hyperscript/index.d.ts +++ b/types/react-hyperscript/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mlmorg/react-hyperscript // Definitions by: tock203 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, StatelessComponent, ReactElement } from 'react'; diff --git a/types/react-hyperscript/react-hyperscript-tests.ts b/types/react-hyperscript/react-hyperscript-tests.ts index 4be72a9b6a..12303dfd2e 100644 --- a/types/react-hyperscript/react-hyperscript-tests.ts +++ b/types/react-hyperscript/react-hyperscript-tests.ts @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as h from 'react-hyperscript'; +import h = require('react-hyperscript'); interface PropTypes { foo: string; diff --git a/types/react-hyperscript/tsconfig.json b/types/react-hyperscript/tsconfig.json index 1ad5f62543..a16169c511 100644 --- a/types/react-hyperscript/tsconfig.json +++ b/types/react-hyperscript/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "react-hyperscript-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-i18next/index.d.ts b/types/react-i18next/index.d.ts index 9831c0b049..356418fe2e 100644 --- a/types/react-i18next/index.d.ts +++ b/types/react-i18next/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Giedrius Grabauskas // Simon Baumann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { TranslationFunction } from "i18next"; diff --git a/types/react-i18next/tsconfig.json b/types/react-i18next/tsconfig.json index e38c27a93e..f90b5c3ff0 100644 --- a/types/react-i18next/tsconfig.json +++ b/types/react-i18next/tsconfig.json @@ -16,7 +16,6 @@ "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, - "strictFunctionTypes": true, "jsx": "react", "experimentalDecorators": true }, @@ -31,4 +30,4 @@ "src/trans.d.ts", "src/translate.d.ts" ] -} +} \ No newline at end of file diff --git a/types/react-i18next/v1/index.d.ts b/types/react-i18next/v1/index.d.ts index cf56874445..451e18c34a 100644 --- a/types/react-i18next/v1/index.d.ts +++ b/types/react-i18next/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/i18next/react-i18next // Definitions by: Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as I18next from "i18next"; import * as React from "react"; diff --git a/types/react-i18next/v4/index.d.ts b/types/react-i18next/v4/index.d.ts index da6a12396d..6b87326975 100644 --- a/types/react-i18next/v4/index.d.ts +++ b/types/react-i18next/v4/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/i18next/react-i18next // Definitions by: Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { TranslationFunction } from "i18next"; diff --git a/types/react-i18next/v4/tsconfig.json b/types/react-i18next/v4/tsconfig.json index 1e7a8d9eea..b2c29f0bea 100644 --- a/types/react-i18next/v4/tsconfig.json +++ b/types/react-i18next/v4/tsconfig.json @@ -33,4 +33,4 @@ "trans.d.ts", "translate.d.ts" ] -} +} \ No newline at end of file diff --git a/types/react-icon-base/index.d.ts b/types/react-icon-base/index.d.ts index 0bd0005244..7459349b82 100644 --- a/types/react-icon-base/index.d.ts +++ b/types/react-icon-base/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gorangajic/react-icon-base#readme // Definitions by: Alexandre Paré , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-icons/index.d.ts b/types/react-icons/index.d.ts index fb0026ff40..93c531c3b4 100644 --- a/types/react-icons/index.d.ts +++ b/types/react-icons/index.d.ts @@ -4,4 +4,4 @@ // John Reilly // Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 diff --git a/types/react-image-gallery/index.d.ts b/types/react-image-gallery/index.d.ts index 479b743e21..5b10b5925b 100644 --- a/types/react-image-gallery/index.d.ts +++ b/types/react-image-gallery/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/xiaolin/react-image-gallery // Definitions by: Adam Webb // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-image-gallery/tsconfig.json b/types/react-image-gallery/tsconfig.json index 9970170355..d822cade87 100644 --- a/types/react-image-gallery/tsconfig.json +++ b/types/react-image-gallery/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-image-gallery-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-imageloader/index.d.ts b/types/react-imageloader/index.d.ts index 4038e90ae0..bab7a49a34 100644 --- a/types/react-imageloader/index.d.ts +++ b/types/react-imageloader/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/hzdg/react-imageloader // Definitions by: Stephen Jelfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-infinite-scroller/index.d.ts b/types/react-infinite-scroller/index.d.ts index a136ececa7..066714344c 100644 --- a/types/react-infinite-scroller/index.d.ts +++ b/types/react-infinite-scroller/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Lauri Lavanti , // Piotr Srebniak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-infinite/index.d.ts b/types/react-infinite/index.d.ts index 442764fe76..80a2594464 100644 --- a/types/react-infinite/index.d.ts +++ b/types/react-infinite/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/seatgeek/react-infinite // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-infinite/react-infinite-tests.tsx b/types/react-infinite/react-infinite-tests.tsx index 295be25528..478f436e66 100644 --- a/types/react-infinite/react-infinite-tests.tsx +++ b/types/react-infinite/react-infinite-tests.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import Infinite = require('react-infinite'); -import * as ReactInfinite from 'react-infinite'; class Test1 extends React.Component { render() { @@ -52,15 +51,15 @@ class Test4 extends React.Component { } } -class Test5 extends React.Component { +class Test5 extends React.Component { render() { return ( -

- + ); } } diff --git a/types/react-input-calendar/index.d.ts b/types/react-input-calendar/index.d.ts index daa97aed68..c0e33783b4 100644 --- a/types/react-input-calendar/index.d.ts +++ b/types/react-input-calendar/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Rudeg/react-input-calendar // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-input-calendar/react-input-calendar-tests.tsx b/types/react-input-calendar/react-input-calendar-tests.tsx index 4cd465d9c5..9589c51046 100644 --- a/types/react-input-calendar/react-input-calendar-tests.tsx +++ b/types/react-input-calendar/react-input-calendar-tests.tsx @@ -1,4 +1,4 @@ -import * as ReactInputCalendar from 'react-input-calendar'; +import ReactInputCalendar = require('react-input-calendar'); import * as React from 'react'; import * as ReactDOM from 'react-dom'; ReactDOM.render(, document.body); diff --git a/types/react-input-mask/index.d.ts b/types/react-input-mask/index.d.ts index a830650812..6ed7660196 100644 --- a/types/react-input-mask/index.d.ts +++ b/types/react-input-mask/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/sanniassin/react-input-mask // Definitions by: Alexandre Paré // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-intl-redux/index.d.ts b/types/react-intl-redux/index.d.ts index e47a48110c..300bd0542d 100644 --- a/types/react-intl-redux/index.d.ts +++ b/types/react-intl-redux/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ratson/react-intl-redux // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { Action } from "redux" import { Provider as ReduxProvider } from "react-redux" diff --git a/types/react-intl/index.d.ts b/types/react-intl/index.d.ts index 383fdef681..72d5d69f51 100644 --- a/types/react-intl/index.d.ts +++ b/types/react-intl/index.d.ts @@ -9,7 +9,7 @@ // Krister Kari // Martin Raedlinger // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 declare namespace ReactIntl { type DateSource = Date | string | number; diff --git a/types/react-intl/tsconfig.json b/types/react-intl/tsconfig.json index d44df31af7..30bb669631 100644 --- a/types/react-intl/tsconfig.json +++ b/types/react-intl/tsconfig.json @@ -22,4 +22,4 @@ "noEmit": true, "forceConsistentCasingInFileNames": true } -} +} \ No newline at end of file diff --git a/types/react-intl/v1/index.d.ts b/types/react-intl/v1/index.d.ts index fcbd8ccddf..a891167f91 100644 --- a/types/react-intl/v1/index.d.ts +++ b/types/react-intl/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: http://formatjs.io/react/ // Definitions by: Bruno Grieder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-is-deprecated/index.d.ts b/types/react-is-deprecated/index.d.ts index b493f793fe..791cb97862 100644 --- a/types/react-is-deprecated/index.d.ts +++ b/types/react-is-deprecated/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Aweary/react-is-deprecated // Definitions by: Sean Kelley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 declare module 'react-is-deprecated' { import { Validator, Requireable, ValidationMap, ReactPropTypes } from 'react'; diff --git a/types/react-joyride/index.d.ts b/types/react-joyride/index.d.ts index 757b538db1..4af8ab7d43 100644 --- a/types/react-joyride/index.d.ts +++ b/types/react-joyride/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gilbarbara/react-joyride // Definitions by: Daniel Rosenwasser , Ben Dixon // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-json-pretty/index.d.ts b/types/react-json-pretty/index.d.ts index 56ee3e50b8..4229ff7c3b 100644 --- a/types/react-json-pretty/index.d.ts +++ b/types/react-json-pretty/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/chenckang/react-json-pretty // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, HTMLProps } from "react"; diff --git a/types/react-json-pretty/react-json-pretty-tests.tsx b/types/react-json-pretty/react-json-pretty-tests.tsx index 95818442df..4821e195e9 100644 --- a/types/react-json-pretty/react-json-pretty-tests.tsx +++ b/types/react-json-pretty/react-json-pretty-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as JSONPretty from "react-json-pretty"; +import JSONPretty = require("react-json-pretty"); export class Test extends React.Component { render() { diff --git a/types/react-json-tree/index.d.ts b/types/react-json-tree/index.d.ts index e82be59e33..f275070a62 100644 --- a/types/react-json-tree/index.d.ts +++ b/types/react-json-tree/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/alexkuz/react-json-tree/ // Definitions by: Grant Nestor // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, diff --git a/types/react-json/index.d.ts b/types/react-json/index.d.ts index 58bfd488f8..fa7eadeccc 100644 --- a/types/react-json/index.d.ts +++ b/types/react-json/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/arqex/react-json // Definitions by: Christoph Spielmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-jsonschema-form/index.d.ts b/types/react-jsonschema-form/index.d.ts index 785ee072e9..0a43e0f0c8 100644 --- a/types/react-jsonschema-form/index.d.ts +++ b/types/react-jsonschema-form/index.d.ts @@ -5,7 +5,7 @@ // Ivan Jiang // Kurt Preston // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 declare module "react-jsonschema-form" { import * as React from "react"; diff --git a/types/react-lazyload/index.d.ts b/types/react-lazyload/index.d.ts index ed90c3f973..b739b7d8cc 100644 --- a/types/react-lazyload/index.d.ts +++ b/types/react-lazyload/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jasonslyvia/react-lazyload // Definitions by: m0a // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from 'react'; diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index 5fdc5831e9..48a98bfbca 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/PaulLeCam/react-leaflet // Definitions by: Dave Leaver , David Schneider , Yui T. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as Leaflet from 'leaflet'; import * as React from 'react'; diff --git a/types/react-list/index.d.ts b/types/react-list/index.d.ts index 30371fc35b..77559988da 100644 --- a/types/react-list/index.d.ts +++ b/types/react-list/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/orgsync/react-list // Definitions by: Yifei Yan , Tom Shen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, diff --git a/types/react-list/react-list-tests.tsx b/types/react-list/react-list-tests.tsx index f02b1643a5..83aba8f698 100644 --- a/types/react-list/react-list-tests.tsx +++ b/types/react-list/react-list-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as ReactList from "react-list"; +import ReactList = require("react-list"); const renderItem = (index: number, key: number) =>
diff --git a/types/react-loadable/index.d.ts b/types/react-loadable/index.d.ts index 08c5b52e39..d2229d4bf6 100644 --- a/types/react-loadable/index.d.ts +++ b/types/react-loadable/index.d.ts @@ -5,7 +5,7 @@ // Ian Ker-Seymer // Tomek Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 /// diff --git a/types/react-loadable/test/index.tsx b/types/react-loadable/test/index.tsx index 7d25d849a7..5045fdf125 100644 --- a/types/react-loadable/test/index.tsx +++ b/types/react-loadable/test/index.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as Loadable from 'react-loadable'; +import Loadable = require('react-loadable'); class LoadingComponent extends React.Component { render() { diff --git a/types/react-loader/index.d.ts b/types/react-loader/index.d.ts index 8734d1cfd9..2d8f7a99a0 100644 --- a/types/react-loader/index.d.ts +++ b/types/react-loader/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/quickleft/react-loader // Definitions by: Sudarsan Balaji // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from 'react'; diff --git a/types/react-loader/react-loader-tests.tsx b/types/react-loader/react-loader-tests.tsx index bc303f149a..92efaf9401 100644 --- a/types/react-loader/react-loader-tests.tsx +++ b/types/react-loader/react-loader-tests.tsx @@ -1,4 +1,4 @@ -import * as Loader from 'react-loader'; +import Loader = require('react-loader'); import * as React from 'react'; const options = { diff --git a/types/react-maskedinput/index.d.ts b/types/react-maskedinput/index.d.ts index 298f48ea30..3a1b4687eb 100644 --- a/types/react-maskedinput/index.d.ts +++ b/types/react-maskedinput/index.d.ts @@ -4,7 +4,7 @@ // Adam Lavin // Carlos Bonetti // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-mce/index.d.ts b/types/react-mce/index.d.ts index 861ce80e9e..6f1fb978db 100644 --- a/types/react-mce/index.d.ts +++ b/types/react-mce/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/janstuemmel/react-mce // Definitions by: Gavin Heise // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import * as ActualTinyMCE from 'tinymce'; diff --git a/types/react-mdl/index.d.ts b/types/react-mdl/index.d.ts index 8e70852190..caf910d421 100644 --- a/types/react-mdl/index.d.ts +++ b/types/react-mdl/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tleunen/react-mdl // Definitions by: Brad Zacher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-measure/index.d.ts b/types/react-measure/index.d.ts index 945a49213a..c61b22b187 100644 --- a/types/react-measure/index.d.ts +++ b/types/react-measure/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/souporserious/react-measure // Definitions by: Alexey Svetliakov , Marc Fallows // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-mixin/index.d.ts b/types/react-mixin/index.d.ts index 09f7eb8366..265794afe2 100644 --- a/types/react-mixin/index.d.ts +++ b/types/react-mixin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/brigand/react-mixin // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-modal/index.d.ts b/types/react-modal/index.d.ts index 16ee347cfd..9a0d534af2 100644 --- a/types/react-modal/index.d.ts +++ b/types/react-modal/index.d.ts @@ -7,7 +7,7 @@ // Uwe Wiemer , // Peter Blazejewicz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-monaco-editor/index.d.ts b/types/react-monaco-editor/index.d.ts index a493f3e194..f6245a82f4 100644 --- a/types/react-monaco-editor/index.d.ts +++ b/types/react-monaco-editor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/superRaytin/react-monaco-editor // Definitions by: Joshua Netterfield // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-motion-slider/index.d.ts b/types/react-motion-slider/index.d.ts index 3bc8f75400..2e7ea921ef 100644 --- a/types/react-motion-slider/index.d.ts +++ b/types/react-motion-slider/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/souporserious/react-motion-slider // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 declare module "react-motion-slider" { import * as React from "react"; diff --git a/types/react-motion/index.d.ts b/types/react-motion/index.d.ts index c33b6c8936..2c2958a62e 100644 --- a/types/react-motion/index.d.ts +++ b/types/react-motion/index.d.ts @@ -4,7 +4,7 @@ // Alexey Svetliakov // Dimitar Nestorov // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, ReactElement } from 'react'; diff --git a/types/react-native-collapsible/index.d.ts b/types/react-native-collapsible/index.d.ts index bdd8dd9ea5..bdfc7cde09 100644 --- a/types/react-native-collapsible/index.d.ts +++ b/types/react-native-collapsible/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/oblador/react-native-collapsible // Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-native-datepicker/index.d.ts b/types/react-native-datepicker/index.d.ts index 19b2f488ca..ceb0e612aa 100644 --- a/types/react-native-datepicker/index.d.ts +++ b/types/react-native-datepicker/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/xgfe/react-native-datepicker // Definitions by: Jacob Baskin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ImageURISource } from 'react-native'; diff --git a/types/react-native-doc-viewer/index.d.ts b/types/react-native-doc-viewer/index.d.ts index 118104f1ae..6d09e3966a 100644 --- a/types/react-native-doc-viewer/index.d.ts +++ b/types/react-native-doc-viewer/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/philipphecht/react-native-doc-viewer/blob/master/README.md // Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 export function openDoc( files: Array<{ url: string; fileName?: string }>, diff --git a/types/react-native-drawer-layout/index.d.ts b/types/react-native-drawer-layout/index.d.ts index f6cf7a0d4a..e77bcb268c 100644 --- a/types/react-native-drawer-layout/index.d.ts +++ b/types/react-native-drawer-layout/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/react-native-community/react-native-drawer-layout // Definitions by: Justin Firth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ViewProperties } from 'react-native'; @@ -94,12 +94,16 @@ export interface DrawerLayoutProperties extends ViewProperties { } export default class DrawerLayout extends React.Component { - /** - * Opens the drawer. - */ - openDrawer(): void; - /** - * Closes the drawer. - */ - closeDrawer(): void; + static positions: { + Left: "left"; + Right: "right"; + }; + /** + * Opens the drawer. + */ + openDrawer(): void; + /** + * Closes the drawer. + */ + closeDrawer(): void; } diff --git a/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx b/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx index c194756333..e0371643ee 100644 --- a/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx +++ b/types/react-native-drawer-layout/react-native-drawer-layout-tests.tsx @@ -32,6 +32,16 @@ class DrawerTest extends React.Component<{}, DrawerTestState> { > Screen content + + { + DrawerLayout.positions.Left + } + + + { + DrawerLayout.positions.Right + } + ); diff --git a/types/react-native-drawer/index.d.ts b/types/react-native-drawer/index.d.ts index c36b3614f7..ac64c55fd9 100644 --- a/types/react-native-drawer/index.d.ts +++ b/types/react-native-drawer/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/root-two/react-native-drawer // Definitions by: jnbt // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ViewStyle, ScaledSize } from 'react-native'; diff --git a/types/react-native-fabric/tsconfig.json b/types/react-native-fabric/tsconfig.json index 90e24b408e..f3dcb77b3d 100644 --- a/types/react-native-fabric/tsconfig.json +++ b/types/react-native-fabric/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-native-fabric-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-native-fbsdk/index.d.ts b/types/react-native-fbsdk/index.d.ts index 8a07d47e88..8b948d6b0d 100644 --- a/types/react-native-fbsdk/index.d.ts +++ b/types/react-native-fbsdk/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/facebook/react-native-fbsdk // Definitions by: Ifiok Jr. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, Component } from 'react'; import { ViewStyle } from 'react-native'; diff --git a/types/react-native-fs/index.d.ts b/types/react-native-fs/index.d.ts index 0e6fc8a3bf..17f26a5514 100644 --- a/types/react-native-fs/index.d.ts +++ b/types/react-native-fs/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Paulo Cesar // Joseph Roque // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-native-google-signin/index.d.ts b/types/react-native-google-signin/index.d.ts index 6166f99a98..c99a767b8a 100644 --- a/types/react-native-google-signin/index.d.ts +++ b/types/react-native-google-signin/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/devfd/react-native-google-signin // Definitions by: Jacob Froman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ViewProperties } from 'react-native'; diff --git a/types/react-native-google-signin/tsconfig.json b/types/react-native-google-signin/tsconfig.json index aaa8a4b253..3c99f9f985 100644 --- a/types/react-native-google-signin/tsconfig.json +++ b/types/react-native-google-signin/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-native-google-signin-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-native-keep-awake/index.d.ts b/types/react-native-keep-awake/index.d.ts index 21ca38b83f..f22d1342c6 100644 --- a/types/react-native-keep-awake/index.d.ts +++ b/types/react-native-keep-awake/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/corbt/react-native-keep-awake // Definitions by: huhuanming // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; declare class KeepAwake extends React.Component<{ children?: JSX.Element }> { diff --git a/types/react-native-linear-gradient/index.d.ts b/types/react-native-linear-gradient/index.d.ts index 9c7bfbc1fd..687bd4e432 100644 --- a/types/react-native-linear-gradient/index.d.ts +++ b/types/react-native-linear-gradient/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/brentvatne/react-native-linear-gradient#readme // Definitions by: Jacob Froman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ViewProperties } from 'react-native'; diff --git a/types/react-native-linear-gradient/tsconfig.json b/types/react-native-linear-gradient/tsconfig.json index 11c04115c3..60d93ae024 100644 --- a/types/react-native-linear-gradient/tsconfig.json +++ b/types/react-native-linear-gradient/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-native-linear-gradient-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-native-material-design-searchbar/index.d.ts b/types/react-native-material-design-searchbar/index.d.ts index b00f921dc4..3c2aad9c51 100644 --- a/types/react-native-material-design-searchbar/index.d.ts +++ b/types/react-native-material-design-searchbar/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ananddayalan/react-native-material-design-searchbar // Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { diff --git a/types/react-native-material-kit/index.d.ts b/types/react-native-material-kit/index.d.ts index 5dc9b63aff..79379e599a 100644 --- a/types/react-native-material-kit/index.d.ts +++ b/types/react-native-material-kit/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Kyle Roach // Tim Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import { diff --git a/types/react-native-material-ui/index.d.ts b/types/react-native-material-ui/index.d.ts index f3147eecf7..e643b4198f 100644 --- a/types/react-native-material-ui/index.d.ts +++ b/types/react-native-material-ui/index.d.ts @@ -1,8 +1,8 @@ -// Type definitions for react-native-material-ui 1.12 +// Type definitions for react-native-material-ui 1.19 // Project: https://github.com/xotahal/react-native-material-ui // Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from 'react'; import { ViewStyle, TextStyle, Image } from 'react-native'; @@ -18,6 +18,7 @@ export interface ActionButtonProps { style?: { container?: ViewStyle icon?: TextStyle + positionContainer?: ViewStyle }; transition?: 'toolbar' | 'speedDial'; onPress?(): void; diff --git a/types/react-native-material-ui/react-native-material-ui-tests.tsx b/types/react-native-material-ui/react-native-material-ui-tests.tsx index 4acb9db12e..b4380fc388 100644 --- a/types/react-native-material-ui/react-native-material-ui-tests.tsx +++ b/types/react-native-material-ui/react-native-material-ui-tests.tsx @@ -25,7 +25,7 @@ const theme = { const Example = () => - + diff --git a/types/react-native-mixpanel/tsconfig.json b/types/react-native-mixpanel/tsconfig.json index 489842ded8..e0eed7022f 100644 --- a/types/react-native-mixpanel/tsconfig.json +++ b/types/react-native-mixpanel/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "react-native-mixpanel-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-native-modalbox/index.d.ts b/types/react-native-modalbox/index.d.ts index 457872889b..683773e995 100644 --- a/types/react-native-modalbox/index.d.ts +++ b/types/react-native-modalbox/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/maxs15/react-native-modalbox#readme // Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ViewProperties } from 'react-native'; diff --git a/types/react-native-navigation/index.d.ts b/types/react-native-navigation/index.d.ts index 893a904f73..5b5344a4d5 100644 --- a/types/react-native-navigation/index.d.ts +++ b/types/react-native-navigation/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/wix/react-native-navigation // Definitions by: Egor Shulga // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; @@ -40,10 +40,18 @@ export interface TabBasedApp { animationType?: 'none' | 'slide-down' | 'fade'; } +export interface IconInsets { + top?: number; + left?: number; + bottom?: number; + right?: number; +} + export interface TabScreen { label?: string; screen: string; icon?: any; + iconInsets?: IconInsets; selectedIcon?: any; title?: string; navigatorStyle?: NavigatorStyle; @@ -102,7 +110,7 @@ export interface LightBox { adjustSoftInput?: 'nothing' | 'pan' | 'resize' | 'unspecified'; } -export interface Navigator { +export class Navigator { push(params: PushedScreen): void; pop(params?: { animated?: boolean; animationType?: 'fade' | 'slide-horizontal'; }): void; popToRoot(params?: { animated?: boolean; animationType?: 'fade' | 'slide-horizontal'; }): void; @@ -150,10 +158,9 @@ export interface ListenerParams { commandType: string; } -export type NavigationComponentProps

= - P & { - navigator: Navigator; - }; +export interface NavigationComponentProps { + navigator: Navigator; +} export interface NavigatorStyle { navBarTextColor?: string; @@ -224,6 +231,7 @@ export interface NavigatorStyle { export interface NavigatorButtons { leftButtons?: NavigatorButton[]; rightButtons?: NavigatorButton[]; + fab?: FABAndroid; } export type IdAndroid = 'back' | 'cancel' | 'accept' | 'sideMenu'; diff --git a/types/react-native-navigation/react-native-navigation-tests.tsx b/types/react-native-navigation/react-native-navigation-tests.tsx index 292b0fb375..b67aa3cfed 100644 --- a/types/react-native-navigation/react-native-navigation-tests.tsx +++ b/types/react-native-navigation/react-native-navigation-tests.tsx @@ -2,7 +2,7 @@ import * as React from 'react'; import { Text, View } from 'react-native'; import { Navigation, NavigationComponentProps, NavigatorStyle, NavigatorButtons } from 'react-native-navigation'; -class Screen1 extends React.Component> { +class Screen1 extends React.Component { static navigatorButtons: NavigatorButtons = { leftButtons: [{ id: 'sideMenu' diff --git a/types/react-native-navigation/tsconfig.json b/types/react-native-navigation/tsconfig.json index 715f1f9e62..a8e66bb44a 100644 --- a/types/react-native-navigation/tsconfig.json +++ b/types/react-native-navigation/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-native-navigation-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-native-popup-dialog/index.d.ts b/types/react-native-popup-dialog/index.d.ts index 73466d1b9d..c295a21ca2 100644 --- a/types/react-native-popup-dialog/index.d.ts +++ b/types/react-native-popup-dialog/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Paito Anderson // connectdotz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { GestureResponderEvent, StyleProp, ViewStyle, TextStyle } from 'react-native'; diff --git a/types/react-native-popup-dialog/tsconfig.json b/types/react-native-popup-dialog/tsconfig.json index ee710ade52..f870dbf139 100644 --- a/types/react-native-popup-dialog/tsconfig.json +++ b/types/react-native-popup-dialog/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-native-popup-dialog-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-native-push-notification/tsconfig.json b/types/react-native-push-notification/tsconfig.json index a030044ab2..55402caca2 100644 --- a/types/react-native-push-notification/tsconfig.json +++ b/types/react-native-push-notification/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-native-push-notification-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-native-qrcode/index.d.ts b/types/react-native-qrcode/index.d.ts index 11b54f3a95..7c745aa1b6 100644 --- a/types/react-native-qrcode/index.d.ts +++ b/types/react-native-qrcode/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/cssivision/react-native-qrcode // Definitions by: York Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-native-safari-view/index.d.ts b/types/react-native-safari-view/index.d.ts index 9a398fde28..658a6664ce 100644 --- a/types/react-native-safari-view/index.d.ts +++ b/types/react-native-safari-view/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/naoufal/react-native-safari-view // Definitions by: Michael Randolph // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { EmitterSubscription } from 'react-native'; diff --git a/types/react-native-scrollable-tab-view/index.d.ts b/types/react-native-scrollable-tab-view/index.d.ts index 2ee0982c86..b18ee374a9 100644 --- a/types/react-native-scrollable-tab-view/index.d.ts +++ b/types/react-native-scrollable-tab-view/index.d.ts @@ -1,107 +1,154 @@ -// Type definitions for react-native-scrollable-tab-view 0.7 -// Project: https://github.com/brentvatne/react-native-scrollable-tab-view#readme +// Type definitions for react-native-scrollable-tab-view 0.8 +// Project: https://github.com/skv-headless/react-native-scrollable-tab-view // Definitions by: CaiHuan +// Egor Shulga // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; -import { - Animated, - ViewStyle, - ScrollViewProperties -} from 'react-native'; - -export interface onChangeTabProperties { - // currentPage - i: number; - - // currentPage object - ref: JSX.Element; - - // previousPage - from: number; -} - -export interface renderTabBarProperties { - goToPage(pageNumber: number): void; - - tabs: JSX.Element; - - activeTab: number; - - scrollValue: Animated.Value; - - containerWidth: number; -} +import { Animated, ScrollViewProperties, ViewStyle, TextStyle } from 'react-native'; export interface ScrollableTabViewProperties extends React.Props { - /** - * tabBarPosition (String) Defaults to "top". - * "bottom" to position the tab bar below content. - * "overlayTop" or "overlayBottom" for a semitransparent tab bar that overlays content. Custom - * tab bars must consume a style prop on their outer element to support this feature: style={this.props.style}. - */ - tabBarPosition?: 'top' | 'bottom' | 'overlayTop' | 'overlayBottom'; + /** + * accept 1 argument props and should return a component + * to use as the tab bar. The component has goToPage, tabs, activeTab and ref added to the props, + * and should implement setAnimationValue to be able to animate itself along with the tab content. + * You can manually pass the props to the TabBar component. + */ + renderTabBar?: ((props: TabBarProps) => JSX.Element) | false; - /** - * (Integer) - the index of the initially selected tab, defaults to 0 === first tab - */ - initialPage?: number; + /** + * Defaults to "top". + * "bottom" to position the tab bar below content. + * "overlayTop" or "overlayBottom" for a semitransparent tab bar that overlays content. Custom + * tab bars must consume a style prop on their outer element to support this feature: style={this.props.style}. + */ + tabBarPosition?: 'top' | 'bottom' | 'overlayTop' | 'overlayBottom'; - /** - * (Integer) - set selected tab(can be buggy see - * https://github.com/skv-headless/react-native-scrollable-tab-view/issues/126 - */ - page?: number; + /** + * function to call when tab changes, should accept 1 argument which is + * an Object containing two keys: i: the index of the tab that is selected, ref: the ref of the + * tab that is selected + */ + onChangeTab?(value: ChangeTabProperties): void; - /** - * onChangeTab (Function) - function to call when tab changes, should accept 1 argument which is - * an Object containing two keys: i: the index of the tab that is selected, ref: the ref of the - * tab that is selected - */ - onChangeTab?(value: onChangeTabProperties): void; + /** + * function to call when the pages are sliding, + * should accept 1 argument which is an Float number representing the page position in the slide frame. + */ + onScroll?(value: number): void; - /** - * onScroll (Function) - function to call when the pages are sliding, - * should accept 1 argument which is an Float number representing the page position in the slide frame. - */ - onScroll?(value: number): void; + /** + * disables horizontal dragging to scroll between tabs, default is false. + */ + locked?: boolean; - /** - * renderTabBar (Function:ReactComponent) - accept 1 argument props and should return a component - * to use as the tab bar. The component has goToPage, tabs, activeTab and ref added to the props, - * and should implement setAnimationValue to be able to animate itself along with the tab content. - * You can manually pass the props to the TabBar component. - */ - renderTabBar?(value: JSX.Element): JSX.Element; + /** + * the index of the initially selected tab, defaults to 0 === first tab + */ + initialPage?: number; - /** - * style (View.propTypes.style) - */ - style?: ViewStyle; + /** + * set selected tab(can be buggy see + * https://github.com/skv-headless/react-native-scrollable-tab-view/issues/126 + */ + page?: number; - /** - * contentProps (Object) - props that are applied to root ScrollView/ViewPagerAndroid. - * Note that overriding defaults set by the library may break functionality; see the source for details. - */ - contentProps?: ScrollViewProperties; + /** + * style of the default tab bar's underline + */ + tabBarUnderlineStyle?: ViewStyle; - /** - * scrollWithoutAnimation (Bool) - on tab press change tab without animation. - */ - scrollWithoutAnimation?: boolean; + /** + * color of the default tab bar's background, defaults to white + */ + tabBarBackgroundColor?: string; - /** - * locked (Bool) - disables horizontal dragging to scroll between tabs, default is false. - */ - locked?: boolean; + /** + * color of the default tab bar's text when active, defaults to navy + */ + tabBarActiveTextColor?: string; - /** - * prerenderingSiblingsNumber (Integer) - pre-render nearby # sibling, Infinity === render all - * the siblings, default to 0 === render current page. - */ - prerenderingSiblingsNumber?: number; + /** + * color of the default tab bar's text when inactive, defaults to black + */ + tabBarInactiveTextColor?: string; + + /** + * additional styles to the tab bar's text + */ + tabBarTextStyle?: TextStyle; + + /** + * style (View.propTypes.style) + */ + style?: ViewStyle; + + /** + * props that are applied to root ScrollView/ViewPagerAndroid. + * Note that overriding defaults set by the library may break functionality; see the source for details. + */ + contentProps?: ScrollViewProperties; + + /** + * on tab press change tab without animation. + */ + scrollWithoutAnimation?: boolean; + + /** + * pre-render nearby # sibling, Infinity === render all + * the siblings, default to 0 === render current page. + */ + prerenderingSiblingsNumber?: number; +} + +export type TabBarProps = T & { + goToPage?: (pageNumber: number) => void; + tabs?: JSX.Element[]; + activeTab?: number; + scrollValue?: Animated.Value; + containerWidth?: number; +}; + +export interface ChangeTabProperties { + // currentPage + i: number; + // currentPage object + ref: JSX.Element; + // previousPage + from: number; } export default class ScrollableTabView extends React.Component { } + +// Each top-level child component should have a tabLabel prop +// that can be used by the tab bar component to render out the labels. +export type TabProps = T & { + tabLabel: React.ReactType; +}; + +export interface DefaultTabBarProps { + backgroundColor?: string; + activeTextColor?: string; + inactiveTextColor?: string; + textStyle?: TextStyle; + tabStyle?: ViewStyle; + renderTab?: RenderTabProperties; + underlineStyle?: ViewStyle; +} + +export type RenderTabProperties = + (name: string, pageIndex: number, isTabActive: boolean, goToPage: (pageNumber: number) => void) => JSX.Element; + +export class DefaultTabBar extends React.Component> { +} + +export interface ScrollableTabBarProps extends DefaultTabBarProps { + scrollOffset?: number; + style?: ViewStyle; + tabsContainerStyle?: ViewStyle; +} + +export class ScrollableTabBar extends React.Component> { +} diff --git a/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx b/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx index 8463a7849c..3c5aecc379 100644 --- a/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx +++ b/types/react-native-scrollable-tab-view/react-native-scrollable-tab-view-tests.tsx @@ -1,44 +1,37 @@ import * as React from 'react'; -import { - Text -} from 'react-native'; -import ScrollableTabView from 'react-native-scrollable-tab-view'; +import { Text, TextStyle, View, ViewStyle } from 'react-native'; +import ScrollableTabView, { ScrollableTabBar, TabProps } from 'react-native-scrollable-tab-view'; -interface MyTextProperties extends React.Props { - tabLabel: string; - - text: string; -} -class MyText extends React.Component { - constructor(props: MyTextProperties) { - super(props); - } - - render(): JSX.Element { - return( - this.props.text - ); - } +interface MyTextProps { + style?: TextStyle; } -class ScrollableTabViewDemo extends React.Component { - constructor(props: ScrollableTabViewDemo) { - super(props); - } +const MyText: React.SFC> = (props) => ( + {props.children} +); - render(): JSX.Element { - return ( - - - - - - ); - } - - componentWillMount?(): void { - } - - componentWillUnmount?(): void { - } +interface MyViewProps { + style?: ViewStyle; } + +class MyView extends React.Component> { + render() { + return ( + {this.props.children} + ); + } +} + +const TabView1 = () => ( + } + > + My + favorite + project + favorite + project + +); diff --git a/types/react-native-sensor-manager/index.d.ts b/types/react-native-sensor-manager/index.d.ts index 85e5870f0a..0b0f0bf67a 100644 --- a/types/react-native-sensor-manager/index.d.ts +++ b/types/react-native-sensor-manager/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/kprimice/react-native-sensor-manager // Definitions by: Sahin Vardar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-native-snap-carousel/index.d.ts b/types/react-native-snap-carousel/index.d.ts index 5bba10bafb..e62301d2fc 100644 --- a/types/react-native-snap-carousel/index.d.ts +++ b/types/react-native-snap-carousel/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: jnbt // Jacob Froman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { diff --git a/types/react-native-sortable-grid/index.d.ts b/types/react-native-sortable-grid/index.d.ts index bc4826dd05..392e9b1b01 100644 --- a/types/react-native-sortable-grid/index.d.ts +++ b/types/react-native-sortable-grid/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ollija/react-native-sortable-grid#readme // Definitions by: Jacob Froman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { StyleProp, ViewStyle, Animated } from 'react-native'; diff --git a/types/react-native-sortable-grid/tsconfig.json b/types/react-native-sortable-grid/tsconfig.json index d4391d4624..4a2ec708aa 100644 --- a/types/react-native-sortable-grid/tsconfig.json +++ b/types/react-native-sortable-grid/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-native-sortable-grid-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-native-sortable-list/index.d.ts b/types/react-native-sortable-list/index.d.ts index 3c1d1c967b..9b8e547b85 100644 --- a/types/react-native-sortable-list/index.d.ts +++ b/types/react-native-sortable-list/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gitim/react-native-sortable-list // Definitions by: Michael Sivolobov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ViewStyle } from 'react-native'; diff --git a/types/react-native-svg-uri/index.d.ts b/types/react-native-svg-uri/index.d.ts index ea2607aa19..4529c53d5e 100644 --- a/types/react-native-svg-uri/index.d.ts +++ b/types/react-native-svg-uri/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/matiascba/react-native-svg-uri#readme // Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ImageURISource } from 'react-native'; diff --git a/types/react-native-swiper/index.d.ts b/types/react-native-swiper/index.d.ts index 7007fa6f7f..c6616aea0c 100644 --- a/types/react-native-swiper/index.d.ts +++ b/types/react-native-swiper/index.d.ts @@ -4,7 +4,7 @@ // HuHuanming // mhcgrq // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { diff --git a/types/react-native-tab-navigator/index.d.ts b/types/react-native-tab-navigator/index.d.ts index 9c2beb5108..1f4e5e5437 100644 --- a/types/react-native-tab-navigator/index.d.ts +++ b/types/react-native-tab-navigator/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/exponentjs/react-native-tab-navigator#readme // Definitions by: My Self // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import { ViewStyle, TextStyle } from 'react-native'; diff --git a/types/react-native-tab-view/index.d.ts b/types/react-native-tab-view/index.d.ts index ca5a375e74..2c6546a628 100644 --- a/types/react-native-tab-view/index.d.ts +++ b/types/react-native-tab-view/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/react-native-community/react-native-tab-view // Definitions by: Kalle Ott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { PureComponent, ReactNode, ComponentType } from 'react' import { diff --git a/types/react-native-tab-view/tsconfig.json b/types/react-native-tab-view/tsconfig.json index 7449ff01dd..8841b6a2b4 100644 --- a/types/react-native-tab-view/tsconfig.json +++ b/types/react-native-tab-view/tsconfig.json @@ -1,17 +1,24 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": ["es6"], - "jsx": "preserve", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": ["../"], - "types": [], - "noEmit": true, - "strictFunctionTypes": true, - "forceConsistentCasingInFileNames": true - }, - "files": ["index.d.ts", "react-native-tab-view-tests.tsx"] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "preserve", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "strictFunctionTypes": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-native-tab-view-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-native-vector-icons/index.d.ts b/types/react-native-vector-icons/index.d.ts index 39bb2a6640..05a140e3bb 100644 --- a/types/react-native-vector-icons/index.d.ts +++ b/types/react-native-vector-icons/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Kyle Roach // Tim Wang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { Icon } from './Icon'; diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts index 4d9edaa364..5353ea6de7 100644 --- a/types/react-native-video/index.d.ts +++ b/types/react-native-video/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: HuHuanming // abrahambotros // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import { diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index c2ca58a5f3..656b1c2e0d 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -7,7 +7,7 @@ // Kamal Mahyuddin // Naoufal El Yousfi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // @@ -3643,11 +3643,11 @@ export interface FlatListStatic extends React.ComponentClass void; /** - * Scrolls to the item at a the specified index such that it is positioned in the viewable area - * such that `viewPosition` 0 places it at the top, 1 at the bottom, and 0.5 centered in the middle. - * May be janky without `getItemLayout` prop. + * Scrolls to the item at the specified index such that it is positioned in the viewable area + * such that viewPosition 0 places it at the top, 1 at the bottom, and 0.5 centered in the middle. + * Cannot scroll to locations outside the render window without specifying the getItemLayout prop. */ - scrollToIndex: (params: { animated?: boolean; index: number; viewPosition?: number }) => void; + scrollToIndex: (params: { animated?: boolean; index: number; viewOffset: number; viewPosition?: number }) => void; /** * Requires linear scan through data - use `scrollToIndex` instead if possible. @@ -5199,7 +5199,7 @@ export type PlatformOSType = "ios" | "android" | "macos" | "windows" | "web"; interface PlatformStatic { OS: PlatformOSType; - Version: number; + Version: number | string; /** * @see https://facebook.github.io/react-native/docs/platform-specific-code.html#content @@ -6211,7 +6211,16 @@ export interface ShareStatic { dismissedAction: string; } -type AccessibilityChangeEventName = "change" | "announcementFinished"; +type AccessibilityEventName = "change" | "announcementFinished"; + +type AccessibilityChangeEvent = boolean; + +type AccessibilityAnnoucementFinishedEvent = { + announcement: string; + success: boolean +}; + +type AccessibilityEvent = AccessibilityChangeEvent | AccessibilityAnnoucementFinishedEvent; /** * @see https://facebook.github.io/react-native/docs/accessibilityinfo.html @@ -6234,12 +6243,12 @@ export interface AccessibilityInfoStatic { * - announcement: The string announced by the screen reader. * - success: A boolean indicating whether the announcement was successfully made. */ - addEventListener: (eventName: AccessibilityChangeEventName, handler: () => void) => void; + addEventListener: (eventName: AccessibilityEventName, handler: (event: AccessibilityEvent) => void) => void; /** * Remove an event handler. */ - removeEventListener: (eventName: AccessibilityChangeEventName, handler: () => void) => void; + removeEventListener: (eventName: AccessibilityEventName, handler: (event: AccessibilityEvent) => void) => void; /** * Set acessibility focus to a react component. @@ -8625,6 +8634,7 @@ export namespace addons { export var ColorPropType: React.Requireable; export var EdgeInsetsPropType: React.Requireable; export var PointPropType: React.Requireable; +export var ViewPropTypes: React.Requireable; declare global { function require(name: string): any; diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index 1c6f6716a9..2c3c384ac6 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -12,7 +12,7 @@ // Qibang Sun // Sergei Butko: // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /** * BEGIN FLOW TYPEDEFINITION.JS PORT @@ -347,10 +347,10 @@ export interface NavigationTabScreenOptions extends NavigationScreenOptions { > | string | null)); tabBarVisible?: boolean; tabBarTestIDProps?: { testID?: string, accessibilityLabel?: string }; - tabBarOnPress?: ( + tabBarOnPress?: (options: { scene: TabScene, jumpToIndex: (index: number) => void - ) => void; + }) => void; } export interface NavigationDrawerScreenOptions extends NavigationScreenOptions { diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 9b61d11c2d..662cd0bb9d 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -140,7 +140,7 @@ const tabNavigatorScreenOptions: NavigationTabScreenOptions = { tabBarVisible: true, tabBarIcon: , tabBarLabel: 'label', - tabBarOnPress: (scene, index) => {} + tabBarOnPress: ({scene, jumpToIndex}) => {} }; const tabNavigatorConfig: TabNavigatorConfig = { @@ -154,6 +154,15 @@ const tabNavigatorConfigWithInitialLayout: TabNavigatorConfig = { initialLayout: { height: 0, width: 100 }, }; +const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = { + ...tabNavigatorConfig, + navigationOptions: { + tabBarOnPress: ({scene, jumpToIndex}) => { + jumpToIndex(scene.index); + } + }, +}; + const BasicTabNavigator = TabNavigator( routeConfigMap, tabNavigatorConfig, diff --git a/types/react-notification-system-redux/index.d.ts b/types/react-notification-system-redux/index.d.ts index 1e009a4f46..d74ea35871 100644 --- a/types/react-notification-system-redux/index.d.ts +++ b/types/react-notification-system-redux/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gor181/react-notification-system-redux // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from "react"; import { Action } from "redux"; diff --git a/types/react-notification-system-redux/react-notification-system-redux-tests.tsx b/types/react-notification-system-redux/react-notification-system-redux-tests.tsx index 631147976a..65f53a0b40 100644 --- a/types/react-notification-system-redux/react-notification-system-redux-tests.tsx +++ b/types/react-notification-system-redux/react-notification-system-redux-tests.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { createStore, Store } from "redux"; import { Notification } from "react-notification-system"; -import * as Notifications from "react-notification-system-redux"; +import Notifications = require("react-notification-system-redux"); import { reducer, removeAll, show, hide, info, error, warning, success, NotificationLevel } from "react-notification-system-redux"; class Test extends React.Component { diff --git a/types/react-notification-system/index.d.ts b/types/react-notification-system/index.d.ts index d321ee6a16..8176ad097c 100644 --- a/types/react-notification-system/index.d.ts +++ b/types/react-notification-system/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/react-notification-system // Definitions by: Giedrius Grabauskas , Deividas Bakanas , Karol Janyst , Bartosz Szewczyk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-notification-system/react-notification-system-tests.tsx b/types/react-notification-system/react-notification-system-tests.tsx index eb05663523..f46fd33aa2 100644 --- a/types/react-notification-system/react-notification-system-tests.tsx +++ b/types/react-notification-system/react-notification-system-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as NotificationSystem from 'react-notification-system'; +import NotificationSystem = require('react-notification-system'); class MyComponent extends React.Component { private notificationSystem: NotificationSystem.System = null; diff --git a/types/react-numeric-input/index.d.ts b/types/react-numeric-input/index.d.ts index e6121f45e7..b10a54cfe3 100644 --- a/types/react-numeric-input/index.d.ts +++ b/types/react-numeric-input/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/vlad-ignatov/react-numeric-input#readme // Definitions by: Heather Booker // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-numeric-input/react-numeric-input-tests.tsx b/types/react-numeric-input/react-numeric-input-tests.tsx index b3921c5e21..811b77a4c7 100644 --- a/types/react-numeric-input/react-numeric-input-tests.tsx +++ b/types/react-numeric-input/react-numeric-input-tests.tsx @@ -1,5 +1,5 @@ import { Component } from 'react'; -import * as NumericInput from 'react-numeric-input'; +import NumericInput = require('react-numeric-input'); export class NumericInputTest extends Component { render() { diff --git a/types/react-numeric-input/tsconfig.json b/types/react-numeric-input/tsconfig.json index 65c483475e..486a7bcd12 100644 --- a/types/react-numeric-input/tsconfig.json +++ b/types/react-numeric-input/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-numeric-input-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-onclickoutside/index.d.ts b/types/react-onclickoutside/index.d.ts index ad61a418a0..d97970642f 100644 --- a/types/react-onclickoutside/index.d.ts +++ b/types/react-onclickoutside/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Pomax/react-onclickoutside // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-onclickoutside/v5/index.d.ts b/types/react-onclickoutside/v5/index.d.ts index 8d9ed949a6..4228697e22 100644 --- a/types/react-onclickoutside/v5/index.d.ts +++ b/types/react-onclickoutside/v5/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/Pomax/react-onclickoutside // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-onsenui/index.d.ts b/types/react-onsenui/index.d.ts index 7407eea34a..1e413dc3ec 100644 --- a/types/react-onsenui/index.d.ts +++ b/types/react-onsenui/index.d.ts @@ -2,7 +2,7 @@ // Project: https://onsen.io/v2/docs/guide/react/ // Definitions by: Ozytis , Salim , Jemmyw // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import Component = React.Component; diff --git a/types/react-overlays/index.d.ts b/types/react-overlays/index.d.ts index 5d33d8da37..99df3b3cbd 100644 --- a/types/react-overlays/index.d.ts +++ b/types/react-overlays/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Aaron Beall // Vito Samson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-overlays/lib/index.d.ts b/types/react-overlays/lib/index.d.ts index 6ea153cd5a..ea95108f8f 100644 --- a/types/react-overlays/lib/index.d.ts +++ b/types/react-overlays/lib/index.d.ts @@ -1,11 +1,11 @@ -import * as Affix from './Affix'; -import * as AutoAffix from './AutoAffix'; -import * as Modal from './Modal'; -import * as ModalManager from './ModalManager'; -import * as Overlay from './Overlay'; -import * as Portal from './Portal'; -import * as Position from './Position'; -import * as RootCloseWrapper from './RootCloseWrapper'; +import Affix = require('./Affix'); +import AutoAffix = require('./AutoAffix'); +import Modal = require('./Modal'); +import ModalManager = require('./ModalManager'); +import Overlay = require('./Overlay'); +import Portal = require('./Portal'); +import Position = require('./Position'); +import RootCloseWrapper = require('./RootCloseWrapper'); export { Affix, diff --git a/types/react-overlays/test/react-overlays-tests-individual.tsx b/types/react-overlays/test/react-overlays-tests-individual.tsx index 95aa3618b3..b066a40ec3 100644 --- a/types/react-overlays/test/react-overlays-tests-individual.tsx +++ b/types/react-overlays/test/react-overlays-tests-individual.tsx @@ -3,10 +3,10 @@ import * as React from "react"; import * as Portal from 'react-overlays/lib/Portal'; import * as Modal from 'react-overlays/lib/Modal'; import * as Position from 'react-overlays/lib/Position'; -import * as Overlay from 'react-overlays/lib/Overlay'; +import Overlay = require('react-overlays/lib/Overlay'); import * as Affix from 'react-overlays/lib/Affix'; -import * as AutoAffix from 'react-overlays/lib/AutoAffix'; -import * as RootCloseWrapper from 'react-overlays/lib/RootCloseWrapper'; +import AutoAffix = require('react-overlays/lib/AutoAffix'); +import RootCloseWrapper = require('react-overlays/lib/RootCloseWrapper'); import { OverlayFade } from './react-overlays-tests-transition'; diff --git a/types/react-paginate/index.d.ts b/types/react-paginate/index.d.ts index a6c1c41d1b..0030028055 100644 --- a/types/react-paginate/index.d.ts +++ b/types/react-paginate/index.d.ts @@ -5,7 +5,7 @@ // pegel03 // Simon Archer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-pointable/index.d.ts b/types/react-pointable/index.d.ts index ac6eb2f2a2..c69d537d55 100644 --- a/types/react-pointable/index.d.ts +++ b/types/react-pointable/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Stefan Fochler // Dibyo Majumdar // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-portal/index.d.ts b/types/react-portal/index.d.ts index ee6a5c857f..7595c5e8ad 100644 --- a/types/react-portal/index.d.ts +++ b/types/react-portal/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tajo/react-portal#readme // Definitions by: Shun Takahashi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-portal/react-portal-tests.tsx b/types/react-portal/react-portal-tests.tsx index ca6c0289de..5313b101bd 100644 --- a/types/react-portal/react-portal-tests.tsx +++ b/types/react-portal/react-portal-tests.tsx @@ -1,7 +1,7 @@ // Example from https://github.com/tajo/react-portal import * as React from "react"; import * as ReactDOM from "react-dom"; -import * as Portal from "react-portal"; +import Portal = require("react-portal"); export default class App extends React.Component { render() { diff --git a/types/react-props-decorators/index.d.ts b/types/react-props-decorators/index.d.ts index 64f33a495c..8aa59e5194 100644 --- a/types/react-props-decorators/index.d.ts +++ b/types/react-props-decorators/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/popkirby/react-props-decorators // Definitions by: Qubo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-recaptcha/index.d.ts b/types/react-recaptcha/index.d.ts index 59d974a5cf..ecfd0db003 100644 --- a/types/react-recaptcha/index.d.ts +++ b/types/react-recaptcha/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Mohamed Hegazy // Zach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from "react"; diff --git a/types/react-recaptcha/react-recaptcha-tests.tsx b/types/react-recaptcha/react-recaptcha-tests.tsx index f049fe6698..2b225925d7 100644 --- a/types/react-recaptcha/react-recaptcha-tests.tsx +++ b/types/react-recaptcha/react-recaptcha-tests.tsx @@ -1,4 +1,4 @@ -import * as Recaptcha from "react-recaptcha"; +import Recaptcha = require("react-recaptcha"); import * as ReactDOM from "react-dom"; import * as React from "react"; diff --git a/types/react-redux-i18n/index.d.ts b/types/react-redux-i18n/index.d.ts index 2195dfaeaa..20cca729bf 100644 --- a/types/react-redux-i18n/index.d.ts +++ b/types/react-redux-i18n/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/zoover/react-redux-i18n // Definitions by: Clément Devos // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 declare module 'react-redux-i18n' { import * as react from "react" diff --git a/types/react-redux-toastr/index.d.ts b/types/react-redux-toastr/index.d.ts index 125e0f138e..bf50211775 100644 --- a/types/react-redux-toastr/index.d.ts +++ b/types/react-redux-toastr/index.d.ts @@ -4,7 +4,7 @@ // Artyom Stukans // Mika Kuitunen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { Component } from 'react'; import { Action, ActionCreator, Reducer } from 'redux'; diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 2a015389da..1528d58af5 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -9,7 +9,7 @@ // Dibyo Majumdar // Prashant Deva // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 // Known Issue: // There is a known issue in TypeScript, which doesn't allow decorators to change the signature of the classes diff --git a/types/react-relay/classic.d.ts b/types/react-relay/classic.d.ts index c600992669..e0042c3c9b 100644 --- a/types/react-relay/classic.d.ts +++ b/types/react-relay/classic.d.ts @@ -117,7 +117,7 @@ export class DefaultNetworkLayer implements RelayNetworkLayer { } export function createContainer( - component: React.ComponentClass | React.StatelessComponent, + component: React.ComponentType, params?: CreateContainerOpts ): RelayContainerClass; export function injectNetworkLayer(networkLayer: RelayNetworkLayer): any; diff --git a/types/react-relay/compat.d.ts b/types/react-relay/compat.d.ts index 22585d03d0..b74efc4ac2 100644 --- a/types/react-relay/compat.d.ts +++ b/types/react-relay/compat.d.ts @@ -1,21 +1,16 @@ -export { - QueryRenderer, - fetchQuery, - graphql, -} from "./index"; +export { QueryRenderer, fetchQuery, graphql } from "./index"; import { ConnectionConfig, RelayPaginationProp as RelayModernPaginationProp, - RelayRefetchProp as RelayModernRefetchProp + RelayRefetchProp as RelayModernRefetchProp, } from "./index"; +export { ConcreteFragment, ConcreteRequest, ConcreteBatchRequest } from "relay-runtime"; import * as RelayRuntimeTypes from "relay-runtime"; import { RelayEnvironmentInterface } from "./classic"; // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ -export type ConcreteFragment = any; -export type ConcreteBatch = any; export type ConcreteFragmentDefinition = object; export type ConcreteOperationDefinition = object; @@ -30,7 +25,6 @@ export interface StatelessWithFragment extends React.StatelessComponent { getFragment: typeof getFragment; } export type ReactFragmentComponent = ComponentWithFragment | StatelessWithFragment; -export type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; export type RelayClassicEnvironment = RelayEnvironmentInterface; // ~~~~~~~~~~~~~~~~~~~~~ @@ -68,18 +62,18 @@ export interface GeneratedNodeMap { } export function createFragmentContainer( - Component: ReactBaseComponent, + Component: React.ComponentType, fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap ): ReactFragmentComponent; export function createRefetchContainer( - Component: ReactBaseComponent, + Component: React.ComponentType, fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap, taggedNode: RelayRuntimeTypes.GraphQLTaggedNode ): ReactFragmentComponent; export function createPaginationContainer( - Component: ReactBaseComponent, + Component: React.ComponentType, fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap, connectionConfig: ConnectionConfig ): ReactFragmentComponent; diff --git a/types/react-relay/index.d.ts b/types/react-relay/index.d.ts index 0b7d87ce58..ae5d6e8f37 100644 --- a/types/react-relay/index.d.ts +++ b/types/react-relay/index.d.ts @@ -5,26 +5,42 @@ // Eloy Durán // Nicolas Pirotte // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 export { commitLocalUpdate, commitRelayModernMutation as commitMutation, fetchRelayModernQuery as fetchQuery, + GraphQLTaggedNode, requestRelaySubscription as requestSubscription, } from "relay-runtime"; import * as React from "react"; import * as RelayRuntimeTypes from "relay-runtime"; +// ~~~~~~~~~~~~~~~~~~~~~ +// Utility types +// ~~~~~~~~~~~~~~~~~~~~~ + +// Taken from https://github.com/pelotom/type-zoo +// tslint:disable-next-line:strict-export-declare-modifiers +type Diff = ({ [P in T]: P } & { [P in U]: never } & { [x: string]: never })[T]; +// tslint:disable-next-line:strict-export-declare-modifiers +type Omit = Pick>; + +export type RemoveRelayProp

= Omit

; + +export interface ComponentRef { + componentRef?: (ref: any) => void; +} + +export type RelayContainer = React.ComponentType & ComponentRef>; + // ~~~~~~~~~~~~~~~~~~~~~ // Maybe Fix // ~~~~~~~~~~~~~~~~~~~~~ -export type ConcreteFragment = any; -export type ConcreteBatch = any; export type ConcreteFragmentDefinition = object; export type ConcreteOperationDefinition = object; -export type ReactBaseComponent = React.ComponentClass | React.StatelessComponent; // ~~~~~~~~~~~~~~~~~~~~~ // RelayProp @@ -40,24 +56,19 @@ export interface RelayProp { export function RelayQL(strings: string[], ...substitutions: any[]): RelayRuntimeTypes.RelayConcreteNode; // ~~~~~~~~~~~~~~~~~~~~~ -// RelayModernGraphQLTag +// ReactRelayTypes // ~~~~~~~~~~~~~~~~~~~~~ export interface GeneratedNodeMap { - [key: string]: GraphQLTaggedNode; + [key: string]: RelayRuntimeTypes.GraphQLTaggedNode; } -export type GraphQLTaggedNode = - | (() => ConcreteFragment | ConcreteBatch) - | { - modern(): ConcreteFragment | ConcreteBatch; - classic(relayQL: typeof RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; - }; + /** * Runtime function to correspond to the `graphql` tagged template function. * All calls to this function should be transformed by the plugin. */ export interface GraphqlInterface { - (strings: string[] | TemplateStringsArray): GraphQLTaggedNode; - experimental(strings: string[] | TemplateStringsArray): GraphQLTaggedNode; + (strings: string[] | TemplateStringsArray): RelayRuntimeTypes.GraphQLTaggedNode; + experimental(strings: string[] | TemplateStringsArray): RelayRuntimeTypes.GraphQLTaggedNode; } export const graphql: GraphqlInterface; @@ -67,7 +78,7 @@ export const graphql: GraphqlInterface; export interface QueryRendererProps { cacheConfig?: RelayRuntimeTypes.CacheConfig; environment: RelayRuntimeTypes.Environment; - query: GraphQLTaggedNode; + query: RelayRuntimeTypes.GraphQLTaggedNode; render(readyState: ReadyState): React.ReactElement | undefined | null; variables: RelayRuntimeTypes.Variables; rerunParamExperimental?: RelayRuntimeTypes.RerunParam; @@ -87,9 +98,9 @@ export class QueryRenderer extends ReactRelayQueryRenderer {} // createFragmentContainer // ~~~~~~~~~~~~~~~~~~~~~ export function createFragmentContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap -): ReactBaseComponent; + Component: React.ComponentType, + fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap +): RelayContainer; // ~~~~~~~~~~~~~~~~~~~~~ // createPaginationContainer @@ -131,16 +142,16 @@ export interface ConnectionConfig { paginationInfo: { count: number; cursor?: string }, fragmentVariables: RelayRuntimeTypes.Variables ): RelayRuntimeTypes.Variables; - query: GraphQLTaggedNode; + query: RelayRuntimeTypes.GraphQLTaggedNode; } export function createPaginationContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, + Component: React.ComponentType, + fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap, connectionConfig: ConnectionConfig -): ReactBaseComponent; +): RelayContainer; // ~~~~~~~~~~~~~~~~~~~~~ -// createFragmentContainer +// createRefetchContainer // ~~~~~~~~~~~~~~~~~~~~~ export interface RefetchOptions { force?: boolean; @@ -157,7 +168,7 @@ export type RelayRefetchProp = RelayProp & { ): RelayRuntimeTypes.Disposable; }; export function createRefetchContainer( - Component: ReactBaseComponent, - fragmentSpec: GraphQLTaggedNode | GeneratedNodeMap, - taggedNode: GraphQLTaggedNode -): ReactBaseComponent; + Component: React.ComponentType, + fragmentSpec: RelayRuntimeTypes.GraphQLTaggedNode | GeneratedNodeMap, + taggedNode: RelayRuntimeTypes.GraphQLTaggedNode +): RelayContainer; diff --git a/types/react-relay/test/react-relay-classic-tests.tsx b/types/react-relay/test/react-relay-classic-tests.tsx index d8eaf005ca..a57cbc1b6f 100644 --- a/types/react-relay/test/react-relay-classic-tests.tsx +++ b/types/react-relay/test/react-relay-classic-tests.tsx @@ -1,15 +1,14 @@ import * as React from "react"; import * as Relay from "react-relay/classic"; +import { CompatContainer } from "./react-relay-compat-tests"; + interface Props { text: string; userId: string; } -// tslint:disable-next-line no-empty-interface -interface Response {} - -export default class AddTweetMutation extends Relay.Mutation { +export default class AddTweetMutation extends Relay.Mutation { getMutation() { return Relay.QL`mutation{addTweet}`; } @@ -64,6 +63,7 @@ const ArtworkContainer = Relay.createContainer(Artwork, { artwork: () => Relay.QL` fragment on Artwork { title + ${CompatContainer.getFragment("whatever")} } `, }, @@ -83,7 +83,7 @@ class StubbedArtwork extends React.Component { setVariables: () => {}, forceFetch: () => {}, hasOptimisticUpdate: () => false, - getPendingTransactions: (): Relay.RelayMutationTransaction[] => [], + getPendingTransactions: (): any => undefined, commitUpdate: () => {}, }, }; diff --git a/types/react-relay/test/react-relay-compat-tests.tsx b/types/react-relay/test/react-relay-compat-tests.tsx new file mode 100644 index 0000000000..e0ee5d3be2 --- /dev/null +++ b/types/react-relay/test/react-relay-compat-tests.tsx @@ -0,0 +1,53 @@ +import * as React from "react"; +import { + QueryRenderer as CompatQueryRenderer, + createFragmentContainer as createFragmentContainerCompat, + commitMutation as commitMutationCompat, + CompatEnvironment, + RelayPaginationProp as RelayPaginationPropCompat, +} from "react-relay/compat"; + +import { configs, mutation, optimisticResponse } from "./react-relay-tests"; + +// testting compat mutation with classic environment +function markNotificationAsReadCompat(environment: CompatEnvironment, source: string, storyID: string) { + const variables = { + input: { + source, + storyID, + }, + }; + + commitMutationCompat(environment, { + configs, + mutation, + optimisticResponse, + variables, + onCompleted: (response, errors) => { + console.log("Response received from server."); + }, + onError: err => console.error(err), + updater: (store, data) => { + const field = store.get(storyID); + if (field) { + field.setValue(data.story, "story"); + } + } + }); +} + +interface CompatProps { + relay: RelayPaginationPropCompat; +} + +class CompatComponent extends React.Component { + markNotificationAsRead(source: string, storyID: string) { + markNotificationAsReadCompat(this.props.relay.environment, source, storyID); + } + + render() { + return (

); + } +} + +export const CompatContainer = createFragmentContainerCompat(CompatComponent, {}); diff --git a/types/react-relay/test/react-relay-tests.tsx b/types/react-relay/test/react-relay-tests.tsx index 6fbd2dea3f..cc25f5f368 100644 --- a/types/react-relay/test/react-relay-tests.tsx +++ b/types/react-relay/test/react-relay-tests.tsx @@ -1,9 +1,6 @@ import * as React from "react"; -import { Environment, Network, RecordSource, Store, ConnectionHandler } from "relay-runtime"; +import { Environment, Network, RecordSource, Store, ConnectionHandler, FragmentReference } from "relay-runtime"; -//////////////////////////// -// RELAY MODERN TESTS -/////////////////////////// import { graphql, commitMutation, @@ -13,7 +10,8 @@ import { requestSubscription, QueryRenderer, RelayRefetchProp, - RelayPaginationProp + RelayPaginationProp, + RelayProp } from "react-relay"; // ~~~~~~~~~~~~~~~~~~~~~ @@ -54,63 +52,137 @@ const MyQueryRenderer = (props: { name: string }) => ( /> ); -// ~~~~~~~~~~~~~~~~~~~~~ -// Modern FragmentContainer -// ~~~~~~~~~~~~~~~~~~~~~ -const MyFragmentContainer = createFragmentContainer( - class TodoListView extends React.Component { - render() { - return
; - } - }, - { - item: graphql` - fragment TodoItem_item on Todo { - text - isComplete - } - `, - } -); - // ~~~~~~~~~~~~~~~~~~~~~ // Modern RefetchContainer // ~~~~~~~~~~~~~~~~~~~~~ -interface StoryInterface { - id: string; -} -interface FeedStoriesProps { - relay: RelayRefetchProp; - feed: { - stories: { edges: Array<{ node: StoryInterface }> }; - }; -} -class Story extends React.Component<{ story: StoryInterface }> {} -class FeedStories extends React.Component { - render() { - return ( -
- {this.props.feed.stories.edges.map(edge => )} -
- ); + +type StoryLike = (storyID: string) => void; + +// Artifact produced by relay-compiler-language-typescript +// tslint:disable-next-line:no-const-enum +const enum _Story_story$ref {} +type Story_story$ref = _Story_story$ref & FragmentReference; +// tslint:disable-next-line:interface-over-type-literal +type Story_story = { + readonly id: string; + readonly text: string; + readonly isPublished: boolean; + readonly " $refType": Story_story$ref; +}; + +const Story = (() => { + interface Props { + relay: RelayRefetchProp; + story: Story_story; + onLike: StoryLike; + ignoreMe?: {}; } - _loadMore() { - // Increments the number of stories being rendered by 10. - const refetchVariables = (fragmentVariables: { count: number }) => ({ - count: fragmentVariables.count + 10, + interface State { + isLoading: boolean; + } + + class Story extends React.Component { + state = { + isLoading: false + }; + + componentDidMount() { + setInterval(this.handleRefresh.bind(this), 1000); + } + + handleRefresh() { + this.setState({ isLoading: true }); + this.props.relay.refetch({ id: this.props.story.id }, {}, error => { + this.setState({ isLoading: false }); + }, { force: true }); + } + + render() { + return ( +
+ {this.props.story.isPublished ? "" : "Draft: "} + {this.props.story.text} + {this.state.isLoading && ♺} + +
+ ); + } + } + + const StoryRefetchContainer = createRefetchContainer( + Story, + { + story: graphql` + fragment Story_story on Todo { + id + text + isPublished + } + `, + }, + graphql.experimental` + query StoryRefetchQuery($id: ID!) { + story(id: $id) { + ...Story_story + } + } + ` + ); + + function doesNotRequireRelayPropToBeProvided() { + const onLike = (id: string) => console.log(`Liked story #${id}`); + const story: { " $fragmentRefs": Story_story$ref } = {} as any; + // TODO: Fix requirement to cast fragment reference as `any`. + ; + } + + return StoryRefetchContainer; +})(); + +// ~~~~~~~~~~~~~~~~~~~~~ +// Modern FragmentContainer +// ~~~~~~~~~~~~~~~~~~~~~ + +// Artifact produced by relay-compiler-language-typescript +// tslint:disable-next-line:no-const-enum +const enum _FeedStories_feed$ref {} +type FeedStories_feed$ref = _FeedStories_feed$ref & FragmentReference; +// tslint:disable-next-line:interface-over-type-literal +type FeedStories_feed = { + readonly edges: ReadonlyArray<{ + readonly node: { + readonly id: string; + readonly " $fragmentRefs": Story_story$ref; + }; + }>; + readonly " $refType": FeedStories_feed$ref; +}; + +const Feed = (() => { + interface Props { + relay: RelayProp; + feed: FeedStories_feed; + onStoryLike: StoryLike; + ignoreMe?: {}; + } + + const FeedStories: React.SFC = ({ feed, onStoryLike, relay }) => { + // TODO: Getting env here for no good reason other than needing to test it works. + // If you have a good relavant example, please update! + relay.environment; + const stories = feed.edges.map(edge => { + // TODO: Fix requirement to cast fragment reference as `any`. + return ; }); - this.props.relay.refetch(refetchVariables); - } -} + return
{stories}
; + }; -const FeedRefetchContainer = createRefetchContainer( - FeedStories, - { - feed: graphql.experimental` - fragment FeedStories_feed on Feed @argumentDefinitions(count: { type: "Int", defaultValue: 10 }) { - stories(first: $count) { + const FeedFragmentContainer = createFragmentContainer( + FeedStories, + { + feed: graphql` + fragment FeedStories_feed on Feed { edges { node { id @@ -118,104 +190,137 @@ const FeedRefetchContainer = createRefetchContainer( } } } - } - `, - }, - graphql.experimental` - query FeedStoriesRefetchQuery($count: Int) { - feed { - ...FeedStories_feed @arguments(count: $count) - } + `, } - ` -); + ); + + function doesNotRequireRelayPropToBeProvided() { + const onStoryLike = (id: string) => console.log(`Liked story #${id}`); + const feed: { " $fragmentRefs": FeedStories_feed$ref } = {} as any; + // TODO: Fix requirement to cast fragment reference as `any`. + ; + } + + return FeedFragmentContainer; +})(); // ~~~~~~~~~~~~~~~~~~~~~ // Modern PaginationContainer // ~~~~~~~~~~~~~~~~~~~~~ -interface FeedProps { - user: { feed: { edges: Array<{ node: StoryInterface }> } }; - relay: RelayPaginationProp; -} -class Feed extends React.Component { - render() { - return ( -
- {this.props.user.feed.edges.map(edge => )} -
- ); + +// Artifact produced by relay-compiler-language-typescript +// tslint:disable-next-line:no-const-enum +const enum _UserFeed_user$ref {} +type UserFeed_user$ref = _UserFeed_user$ref & FragmentReference; +// tslint:disable-next-line:interface-over-type-literal +type UserFeed_user = { + readonly feed: { + readonly pageInfo: { + readonly endCursor?: string | null; + readonly hasNextPage: boolean; + }; + readonly " $fragmentRefs": FeedStories_feed$ref; + }; + readonly " $refType": UserFeed_user$ref; +}; + +() => { + interface Props { + relay: RelayPaginationProp; + loadMoreTitle: string; + user: UserFeed_user; + ignoreMe?: {}; } - _loadMore() { - if (!this.props.relay.hasMore() || this.props.relay.isLoading()) { - return; + class UserFeed extends React.Component { + render() { + const onStoryLike = (id: string) => console.log(`Liked story #${id}`); + // TODO: Fix requirement to cast fragment reference as `any`. + const feed = this.props.user.feed as any; + return ( +
+ +
+ ); } - this.props.relay.loadMore( - 10, // Fetch the next 10 feed items - e => { - console.log(e); + _loadMore() { + if (!this.props.relay.hasMore() || this.props.relay.isLoading()) { + return; } - ); - } -} -const FeedPaginationContainer = createPaginationContainer( - Feed, - { - user: graphql` - fragment Feed_user on User { - feed( - first: $count - after: $cursor - orderby: $orderBy # other variables - ) @connection(key: "Feed_feed") { - edges { - node { - id - ...Story_story + this.props.relay.loadMore( + 10, // Fetch the next 10 feed items + e => { + console.log(e); + } + ); + } + } + + const UserFeedPaginationContainer = createPaginationContainer( + UserFeed, + { + user: graphql` + fragment UserFeed_user on User { + feed( + first: $count + after: $cursor + orderby: $orderBy # other variables + ) @connection(key: "Feed_feed") { + ...FeedStories_feed + pageInfo { + endCursor + hasNextPage } } } - } - `, - }, - { - direction: "forward", - getConnectionFromProps(props) { - return props.user && props.user.feed; + `, }, - getFragmentVariables(prevVars, totalCount) { - return { - ...prevVars, - count: totalCount, - }; - }, - getVariables(props, { count, cursor }, fragmentVariables) { - return { - count, - cursor, - // in most cases, for variables other than connection filters like - // `first`, `after`, etc. you may want to use the previous values. - orderBy: fragmentVariables.orderBy, - }; - }, - query: graphql` - query FeedPaginationQuery($count: Int!, $cursor: String, $orderby: String!) { - user { - # You could reference the fragment defined previously. - ...Feed_user + { + direction: "forward", + getConnectionFromProps(props) { + // TODO: Fix requirement to have `edges` and both `pageInfo` details for forward and backward pagination + return props.user && props.user.feed as any; + }, + getFragmentVariables(prevVars, totalCount) { + return { + ...prevVars, + count: totalCount, + }; + }, + getVariables(props, { count, cursor }, fragmentVariables) { + return { + count, + cursor, + // in most cases, for variables other than connection filters like + // `first`, `after`, etc. you may want to use the previous values. + orderBy: fragmentVariables.orderBy, + }; + }, + query: graphql` + query FeedPaginationQuery($count: Int!, $cursor: String, $orderby: String!) { + user { + # You could reference the fragment defined previously. + ...Feed_user + } } - } - `, + `, + } + ); + + function doesNotRequireRelayPropToBeProvided() { + const user: { " $fragmentRefs": UserFeed_user$ref } = {} as any; + // TODO: Fix requirement to cast fragment reference as `any`. + ; } -); +}; // ~~~~~~~~~~~~~~~~~~~~~ // Modern Mutations // ~~~~~~~~~~~~~~~~~~~~~ -const mutation = graphql` +export const mutation = graphql` mutation MarkReadNotificationMutation($input: MarkReadNotificationData!) { markReadNotification(data: $input) { notification { @@ -225,7 +330,7 @@ const mutation = graphql` } `; -const optimisticResponse = { +export const optimisticResponse = { markReadNotification: { notification: { seenState: "SEEN", @@ -233,7 +338,7 @@ const optimisticResponse = { }, }; -const configs = [ +export const configs = [ { type: "NODE_DELETE" as "NODE_DELETE", deletedIDFieldName: "destroyedShipId", @@ -325,150 +430,3 @@ requestSubscription( }, } ); - -//////////////////////////// -// RELAY COMPAT TESTS -/////////////////////////// -import { - QueryRenderer as CompatQueryRenderer, - createFragmentContainer as createFragmentContainerCompat, - commitMutation as commitMutationCompat, - CompatEnvironment, - RelayPaginationProp as RelayPaginationPropCompat, -} from "react-relay/compat"; - -// testting compat mutation with classic environment -function markNotificationAsReadCompat(environment: CompatEnvironment, source: string, storyID: string) { - const variables = { - input: { - source, - storyID, - }, - }; - - commitMutationCompat(environment, { - configs, - mutation, - optimisticResponse, - variables, - onCompleted: (response, errors) => { - console.log("Response received from server."); - }, - onError: err => console.error(err), - updater: (store, data) => { - const field = store.get(storyID); - if (field) { - field.setValue(data.story, "story"); - } - } - }); -} - -interface CompatProps { - relay: RelayPaginationPropCompat; -} - -export class CompatComponent extends React.Component { - markNotificationAsRead(source: string, storyID: string) { - markNotificationAsReadCompat(this.props.relay.environment, source, storyID); - } - - render() { - return (
); - } -} - -const CompatContainer = createFragmentContainerCompat(CompatComponent, {}); - -//////////////////////////// -// RELAY-CLASSIC TESTS -/////////////////////////// -import * as Relay from "react-relay/classic"; - -interface Props { - text: string; - userId: string; -} - -export default class AddTweetMutation extends Relay.Mutation { - getMutation() { - return Relay.QL`mutation{addTweet}`; - } - - getFatQuery() { - return Relay.QL` - fragment on AddTweetPayload { - tweetEdge - user - } - `; - } - - getConfigs() { - return [ - { - type: "RANGE_ADD", - parentName: "user", - parentID: this.props.userId, - connectionName: "tweets", - edgeName: "tweetEdge", - rangeBehaviors: { - "": "append", - }, - }, - ]; - } - - getVariables() { - return this.props; - } -} - -interface ArtwokRelayVariables { - artworkID: string; -} - -interface ArtworkProps extends Relay.RelayProps { - artwork: { - title: string; - }; -} - -class Artwork extends React.Component { - render() { - return {this.props.artwork.title}; - } -} - -const ArtworkContainer = Relay.createContainer(Artwork, { - fragments: { - artwork: () => Relay.QL` - fragment on Artwork { - title - ${ CompatContainer.getFragment('whatever') } - } - `, - }, -}); - -class StubbedArtwork extends React.Component { - render() { - const props = { - artwork: { title: "CHAMPAGNE FORMICA FLAG" }, - relay: { - route: { - name: "champagne", - }, - variables: { - artworkID: "champagne-formica-flag", - }, - setVariables: () => {}, - forceFetch: () => {}, - hasOptimisticUpdate: () => false, - getPendingTransactions: (): any => undefined, - commitUpdate: () => {}, - }, - }; - return ; - } -} diff --git a/types/react-relay/tsconfig.json b/types/react-relay/tsconfig.json index 3e471b36ad..642df480df 100644 --- a/types/react-relay/tsconfig.json +++ b/types/react-relay/tsconfig.json @@ -23,6 +23,7 @@ "classic.d.ts", "compat.d.ts", "test/react-relay-tests.tsx", + "test/react-relay-compat-tests.tsx", "test/react-relay-classic-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-resolver/index.d.ts b/types/react-resolver/index.d.ts index 2b27d26d6a..c871426401 100644 --- a/types/react-resolver/index.d.ts +++ b/types/react-resolver/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ericclemmons/react-resolver // Definitions by: forabi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentType, StatelessComponent, Factory } from 'react'; diff --git a/types/react-resolver/react-resolver-tests.tsx b/types/react-resolver/react-resolver-tests.tsx index ce41e6db4c..088f5e7573 100644 --- a/types/react-resolver/react-resolver-tests.tsx +++ b/types/react-resolver/react-resolver-tests.tsx @@ -1,6 +1,5 @@ import * as React from 'react'; import { Resolver, resolve, context } from 'react-resolver'; -import * as expect from 'expect'; interface OwnProps { thing: number; @@ -32,13 +31,13 @@ const ResolvedPageWithPropMap = resolve({ const PageWithContext = context('history')(Page); -expect().toExist(); -expect().toExist(); +; +; // Resolver.render(() => , document.getElementById('app')); Resolver.resolve(() => { return ; }).then(({ data, Resolved }) => { - expect(data).toBe('World'); + data === 'World'; }); diff --git a/types/react-resolver/tsconfig.json b/types/react-resolver/tsconfig.json index 94a604e352..fce9a29e5e 100644 --- a/types/react-resolver/tsconfig.json +++ b/types/react-resolver/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-resolver-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-responsive/index.d.ts b/types/react-responsive/index.d.ts index dde02d8dae..ad042a34c5 100644 --- a/types/react-responsive/index.d.ts +++ b/types/react-responsive/index.d.ts @@ -4,7 +4,7 @@ // Alec Hill // Javier Gonzalez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-responsive/tsconfig.json b/types/react-responsive/tsconfig.json index 294f0c8cde..6599624bbe 100644 --- a/types/react-responsive/tsconfig.json +++ b/types/react-responsive/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-responsive-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-responsive/v1/index.d.ts b/types/react-responsive/v1/index.d.ts index ea0b07aa30..f9c3bfcf83 100644 --- a/types/react-responsive/v1/index.d.ts +++ b/types/react-responsive/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/contra/react-responsive // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-responsive/v1/react-responsive-tests.tsx b/types/react-responsive/v1/react-responsive-tests.tsx index e3644771c4..adbedbae09 100644 --- a/types/react-responsive/v1/react-responsive-tests.tsx +++ b/types/react-responsive/v1/react-responsive-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as MediaQuery from "react-responsive"; +import MediaQuery = require("react-responsive"); class Test extends React.Component { render() { diff --git a/types/react-responsive/v1/tsconfig.json b/types/react-responsive/v1/tsconfig.json index 774fd47a00..a5f0d8891a 100644 --- a/types/react-responsive/v1/tsconfig.json +++ b/types/react-responsive/v1/tsconfig.json @@ -30,4 +30,4 @@ "index.d.ts", "react-responsive-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-router-bootstrap/index.d.ts b/types/react-router-bootstrap/index.d.ts index 19e1940836..db2b67d040 100644 --- a/types/react-router-bootstrap/index.d.ts +++ b/types/react-router-bootstrap/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/react-bootstrap/react-router-bootstrap // Definitions by: Vincent Lesierse , Karol Janyst , Olmo del Corral // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 export { default as LinkContainer } from "react-router-bootstrap/lib/LinkContainer" export { default as IndexLinkContainer } from "react-router-bootstrap/lib/IndexLinkContainer" diff --git a/types/react-router-config/index.d.ts b/types/react-router-config/index.d.ts index d33e385a53..deb9d8003d 100644 --- a/types/react-router-config/index.d.ts +++ b/types/react-router-config/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ReactTraining/react-router/tree/master/packages/react-router-config // Definitions by: François Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from "react"; import { RouteComponentProps, match } from "react-router"; diff --git a/types/react-router-dom/index.d.ts b/types/react-router-dom/index.d.ts index 88119a4858..8286745998 100644 --- a/types/react-router-dom/index.d.ts +++ b/types/react-router-dom/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Tanguy Krotoff // Huy Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { match } from "react-router"; import * as React from 'react'; diff --git a/types/react-router-native/index.d.ts b/types/react-router-native/index.d.ts index 88c0108212..4a14dce8dc 100644 --- a/types/react-router-native/index.d.ts +++ b/types/react-router-native/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ReactTraining/react-router-native // Definitions by: Eduard Zintz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 export { match, diff --git a/types/react-router-navigation-core/index.d.ts b/types/react-router-navigation-core/index.d.ts index a7ad09748c..8af7235a94 100644 --- a/types/react-router-navigation-core/index.d.ts +++ b/types/react-router-navigation-core/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/LeoLeBras/react-router-navigation#readme // Definitions by: Kalle Ott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 // High-level wrappers import { PureComponent, ReactNode, ComponentClass, ReactElement } from "react"; diff --git a/types/react-router-navigation-core/tsconfig.json b/types/react-router-navigation-core/tsconfig.json index b4572aa56c..b356b2d5c5 100644 --- a/types/react-router-navigation-core/tsconfig.json +++ b/types/react-router-navigation-core/tsconfig.json @@ -1,10 +1,15 @@ { "compilerOptions": { "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "module": "commonjs", - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "jsx": "react", "strictNullChecks": true, "strictFunctionTypes": true, @@ -13,5 +18,8 @@ "forceConsistentCasingInFileNames": true, "noEmit": true }, - "files": ["index.d.ts", "react-router-navigation-core-tests.tsx"] -} + "files": [ + "index.d.ts", + "react-router-navigation-core-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-router-navigation/index.d.ts b/types/react-router-navigation/index.d.ts index 863158cd3f..c69a172c43 100644 --- a/types/react-router-navigation/index.d.ts +++ b/types/react-router-navigation/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/LeoLeBras/react-router-navigation#readme // Definitions by: Kalle Ott // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { Component, ReactNode, ReactElement, ComponentClass } from "react"; import { StyleProp, ViewProperties, ViewStyle, TextStyle } from "react-native"; diff --git a/types/react-router-navigation/tsconfig.json b/types/react-router-navigation/tsconfig.json index d9909d32a6..e10c25a443 100644 --- a/types/react-router-navigation/tsconfig.json +++ b/types/react-router-navigation/tsconfig.json @@ -1,10 +1,15 @@ { "compilerOptions": { "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "module": "commonjs", - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "jsx": "react", "strictNullChecks": true, "strictFunctionTypes": true, @@ -13,5 +18,8 @@ "forceConsistentCasingInFileNames": true, "noEmit": true }, - "files": ["index.d.ts", "react-router-navigation-tests.tsx"] -} + "files": [ + "index.d.ts", + "react-router-navigation-tests.tsx" + ] +} \ No newline at end of file diff --git a/types/react-router-redux/index.d.ts b/types/react-router-redux/index.d.ts index 5f5d9b31ea..0ce965b397 100644 --- a/types/react-router-redux/index.d.ts +++ b/types/react-router-redux/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Huy Nguyen // Shoya Tanaka // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { Store, diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 1bebd855f1..47274d71e2 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -16,7 +16,7 @@ // Egor Shulga // Youen Toupin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import * as H from 'history'; diff --git a/types/react-router/test/examples-from-react-router-website/Animation.tsx b/types/react-router/test/examples-from-react-router-website/Animation.tsx index d303f29a97..c59d4f91c9 100644 --- a/types/react-router/test/examples-from-react-router-website/Animation.tsx +++ b/types/react-router/test/examples-from-react-router-website/Animation.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as ReactCSSTransitionGroup from 'react-addons-css-transition-group'; +import ReactCSSTransitionGroup = require('react-addons-css-transition-group'); import { BrowserRouter as Router, RouteComponentProps, diff --git a/types/react-router/tsconfig.json b/types/react-router/tsconfig.json index 95e3846a8c..d62619d931 100644 --- a/types/react-router/tsconfig.json +++ b/types/react-router/tsconfig.json @@ -41,4 +41,4 @@ "test/InheritingRoute.tsx", "test/WithRouter.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-router/v2/index.d.ts b/types/react-router/v2/index.d.ts index c2fd8e9b22..68f9c3f38f 100644 --- a/types/react-router/v2/index.d.ts +++ b/types/react-router/v2/index.d.ts @@ -7,7 +7,7 @@ // Alex Wendland // Kostya Esmukov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export as namespace ReactRouter; diff --git a/types/react-router/v3/index.d.ts b/types/react-router/v3/index.d.ts index 69f24bfc3b..9ca93b3a9b 100644 --- a/types/react-router/v3/index.d.ts +++ b/types/react-router/v3/index.d.ts @@ -11,7 +11,7 @@ // Dovydas Navickas // Ross Allen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export { ChangeHook, diff --git a/types/react-s-alert/index.d.ts b/types/react-s-alert/index.d.ts index 42a0557162..bd014abd0a 100644 --- a/types/react-s-alert/index.d.ts +++ b/types/react-s-alert/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/juliancwirko/react-s-alert // Definitions by: mitsuruog // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-s-alert/tsconfig.json b/types/react-s-alert/tsconfig.json index c029ed03aa..58dec67591 100644 --- a/types/react-s-alert/tsconfig.json +++ b/types/react-s-alert/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-s-alert-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-scroll/index.d.ts b/types/react-scroll/index.d.ts index 5c7c3cbced..f04e6d86ff 100644 --- a/types/react-scroll/index.d.ts +++ b/types/react-scroll/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Ioannis Kokkinidis // Giedrius Grabauskas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as ReactScroll from "./modules/index"; export = ReactScroll; diff --git a/types/react-scrollbar/index.d.ts b/types/react-scrollbar/index.d.ts index 9f73a0be51..f551d83ebd 100644 --- a/types/react-scrollbar/index.d.ts +++ b/types/react-scrollbar/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/souhe/reactScrollbar // Definitions by: Stephen Jelfs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-select/index.d.ts b/types/react-select/index.d.ts index 4487ea4093..084f878618 100644 --- a/types/react-select/index.d.ts +++ b/types/react-select/index.d.ts @@ -12,7 +12,7 @@ // Anton Novik // David Schkalee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; @@ -30,6 +30,7 @@ export type HandlerRendererResult = JSX.Element | null | false; export type FocusOptionHandler = (option: Option) => void; export type SelectValueHandler = (option: Option) => void; export type ArrowRendererHandler = (props: ArrowRendererProps) => HandlerRendererResult; +export type ClearRendererHandler = () => HandlerRendererResult; export type FilterOptionHandler = (option: Option, filter: string) => boolean; export type FilterOptionsHandler = (options: Options, filter: string, currentValues: Options) => Options; export type InputRendererHandler = (props: { [key: string]: any }) => HandlerRendererResult; @@ -187,6 +188,11 @@ export interface ReactSelectProps extends React.Props extends React.Props // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-side-effect/react-side-effect-tests.ts b/types/react-side-effect/react-side-effect-tests.ts index 60566eafa7..d568fed4cc 100644 --- a/types/react-side-effect/react-side-effect-tests.ts +++ b/types/react-side-effect/react-side-effect-tests.ts @@ -1,5 +1,5 @@ import * as React from "react"; -import * as withSideEffect from "react-side-effect"; +import withSideEffect = require("react-side-effect"); interface DocumentTitleProps { title: string diff --git a/types/react-sidebar/index.d.ts b/types/react-sidebar/index.d.ts index 9701c09d78..24684c4c76 100644 --- a/types/react-sidebar/index.d.ts +++ b/types/react-sidebar/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/balloob/react-sidebar#readme // Definitions by: Jeroen Vervaeke // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component } from "react"; diff --git a/types/react-sketchapp/index.d.ts b/types/react-sketchapp/index.d.ts index fafa693207..67ade07673 100644 --- a/types/react-sketchapp/index.d.ts +++ b/types/react-sketchapp/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Rico Kahler // DomiR // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-slick/index.d.ts b/types/react-slick/index.d.ts index 4447e9d50f..475b9afcfc 100644 --- a/types/react-slick/index.d.ts +++ b/types/react-slick/index.d.ts @@ -4,7 +4,7 @@ // Giedrius Grabauskas // Andrew Makarov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-smooth-scrollbar/index.d.ts b/types/react-smooth-scrollbar/index.d.ts index b8e4e7d149..c0aa21a0ff 100644 --- a/types/react-smooth-scrollbar/index.d.ts +++ b/types/react-smooth-scrollbar/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/idiotWu/react-smooth-scrollbar // Definitions by: Alexey Svetliakov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; import SmoothScrollbar from "smooth-scrollbar"; diff --git a/types/react-smooth-scrollbar/react-smooth-scrollbar-tests.tsx b/types/react-smooth-scrollbar/react-smooth-scrollbar-tests.tsx index b976624a4e..22fd0ae83c 100644 --- a/types/react-smooth-scrollbar/react-smooth-scrollbar-tests.tsx +++ b/types/react-smooth-scrollbar/react-smooth-scrollbar-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as SmoothScrollbar from 'react-smooth-scrollbar'; +import SmoothScrollbar = require('react-smooth-scrollbar'); { } } />; // ; TODO: These options don't seem to be documented diff --git a/types/react-sortable-hoc/index.d.ts b/types/react-sortable-hoc/index.d.ts index 199156100e..851170036d 100644 --- a/types/react-sortable-hoc/index.d.ts +++ b/types/react-sortable-hoc/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/clauderic/react-sortable-hoc // Definitions by: Ivo Stratev , Charles Rey // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-sortable-pane/index.d.ts b/types/react-sortable-pane/index.d.ts index 97b35f04bd..f8d3eba15f 100644 --- a/types/react-sortable-pane/index.d.ts +++ b/types/react-sortable-pane/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bokuweb/react-sortable-pane // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-sortable-pane/tsconfig.json b/types/react-sortable-pane/tsconfig.json index 2c919006c5..bc07e7267a 100644 --- a/types/react-sortable-pane/tsconfig.json +++ b/types/react-sortable-pane/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-sortable-pane-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-sortable-tree/index.d.ts b/types/react-sortable-tree/index.d.ts index 2b9d1d1a6c..441e0bb61b 100644 --- a/types/react-sortable-tree/index.d.ts +++ b/types/react-sortable-tree/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Wouter Hardeman // Jovica Zoric // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { ListProps, Index } from 'react-virtualized'; diff --git a/types/react-spinkit/index.d.ts b/types/react-spinkit/index.d.ts index da0ff35f91..9e4a5f0cff 100644 --- a/types/react-spinkit/index.d.ts +++ b/types/react-spinkit/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/KyleAMathews/react-spinkit // Definitions by: Qubo , Mleko , Tom Crockett , zzanol // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-spinkit/react-spinkit-tests.tsx b/types/react-spinkit/react-spinkit-tests.tsx index 27717503d6..ac952bc700 100644 --- a/types/react-spinkit/react-spinkit-tests.tsx +++ b/types/react-spinkit/react-spinkit-tests.tsx @@ -1,4 +1,4 @@ -import * as Spinner from 'react-spinkit'; +import Spinner = require('react-spinkit'); import * as React from 'react'; // Examples taken from http://kyleamathews.github.io/react-spinkit/ diff --git a/types/react-spinkit/v1/index.d.ts b/types/react-spinkit/v1/index.d.ts index d9a3609653..ec841afd4b 100644 --- a/types/react-spinkit/v1/index.d.ts +++ b/types/react-spinkit/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/KyleAMathews/react-spinkit // Definitions by: Qubo , Mleko , Tom Crockett // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-spinkit/v1/react-spinkit-tests.tsx b/types/react-spinkit/v1/react-spinkit-tests.tsx index 6742096ebe..463a689364 100644 --- a/types/react-spinkit/v1/react-spinkit-tests.tsx +++ b/types/react-spinkit/v1/react-spinkit-tests.tsx @@ -1,4 +1,4 @@ -import * as Spinner from 'react-spinkit'; +import Spinner = require('react-spinkit'); import * as React from 'react'; // Examples taken from http://kyleamathews.github.io/react-spinkit/ diff --git a/types/react-sticky/index.d.ts b/types/react-sticky/index.d.ts index 85743b9945..9350069bcd 100644 --- a/types/react-sticky/index.d.ts +++ b/types/react-sticky/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/captivationsoftware/react-sticky // Definitions by: Matej Lednicky , Curtis Warren // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-stripe-elements/index.d.ts b/types/react-stripe-elements/index.d.ts index 72dea90475..8713d5828a 100644 --- a/types/react-stripe-elements/index.d.ts +++ b/types/react-stripe-elements/index.d.ts @@ -4,7 +4,7 @@ // Santiago Doldan // sonnysangha // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// import * as React from 'react'; diff --git a/types/react-svg-pan-zoom/index.d.ts b/types/react-svg-pan-zoom/index.d.ts index 5cd5e7d2ff..f825694915 100644 --- a/types/react-svg-pan-zoom/index.d.ts +++ b/types/react-svg-pan-zoom/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/chrvadala/react-svg-pan-zoom#readme // Definitions by: Huy Nguyen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-swf/index.d.ts b/types/react-swf/index.d.ts index 715c62bb43..c37aff3d69 100644 --- a/types/react-swf/index.d.ts +++ b/types/react-swf/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/syranide/react-swf // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; export as namespace ReactSWF; diff --git a/types/react-swipe/index.d.ts b/types/react-swipe/index.d.ts index 3a11f905d1..fb7d02055f 100644 --- a/types/react-swipe/index.d.ts +++ b/types/react-swipe/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/voronianski/react-swipe // Definitions by: Deividas Bakanas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-swipe/react-swipe-tests.tsx b/types/react-swipe/react-swipe-tests.tsx index 2a2f0ffc90..2948141ee6 100644 --- a/types/react-swipe/react-swipe-tests.tsx +++ b/types/react-swipe/react-swipe-tests.tsx @@ -1,5 +1,5 @@ import * as React from "react"; -import * as ReactSwipe from "react-swipe"; +import ReactSwipe = require("react-swipe"); class ReactSwipeTest extends React.PureComponent { private swipeComponent: ReactSwipe | null = null; diff --git a/types/react-swipeable-views/index.d.ts b/types/react-swipeable-views/index.d.ts index fd4b322fd5..dedc165871 100644 --- a/types/react-swipeable-views/index.d.ts +++ b/types/react-swipeable-views/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Michael Ledin // Deividas Bakanas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-swipeable/index.d.ts b/types/react-swipeable/index.d.ts index 1608258c64..b39a7b29ea 100644 --- a/types/react-swipeable/index.d.ts +++ b/types/react-swipeable/index.d.ts @@ -4,7 +4,7 @@ // Konstantin Vasilev // Hiroki Horiuchi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index b31011d63d..b068683c33 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as Swipeable from 'react-swipeable'; +import Swipeable = require('react-swipeable'); class SampleComponent extends React.PureComponent { private readonly handleSwiped: Swipeable.OnSwipedCallback = () => {}; diff --git a/types/react-swipeable/tsconfig.json b/types/react-swipeable/tsconfig.json index a720949edf..f3f7bf5b1a 100644 --- a/types/react-swipeable/tsconfig.json +++ b/types/react-swipeable/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-swipeable-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-syntax-highlighter/index.d.ts b/types/react-syntax-highlighter/index.d.ts index eb0a5c21fa..9650d2ba20 100644 --- a/types/react-syntax-highlighter/index.d.ts +++ b/types/react-syntax-highlighter/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/conorhastings/react-syntax-highlighter // Definitions by: Ivo Stratev // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 declare module 'react-syntax-highlighter' { import SyntaxHighlighter from 'react-syntax-highlighter/dist/light'; diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 1800a9d745..2ab2d2a821 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/react-tools/react-table // Definitions by: Roy Xue , Pavel Sakalo , Krzysztof Porębski // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; export type ReactTableFunction = () => void; diff --git a/types/react-tabs/index.d.ts b/types/react-tabs/index.d.ts index a4a528046a..9c053d465e 100644 --- a/types/react-tabs/index.d.ts +++ b/types/react-tabs/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/reactjs/react-tabs/ // Definitions by: Yuu Igarashi , Daniel Tschinder // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-tag-input/index.d.ts b/types/react-tag-input/index.d.ts index c614e096ed..6dd269896e 100644 --- a/types/react-tag-input/index.d.ts +++ b/types/react-tag-input/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Ogglas // Jan Karres // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-tagcloud/index.d.ts b/types/react-tagcloud/index.d.ts index 4315e6eb5c..4f6987cb5f 100644 --- a/types/react-tagcloud/index.d.ts +++ b/types/react-tagcloud/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/madox2/react-tagcloud // Definitions by: wassname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-tagsinput/index.d.ts b/types/react-tagsinput/index.d.ts index 6b4d92b3b7..4de3a4b8ac 100644 --- a/types/react-tagsinput/index.d.ts +++ b/types/react-tagsinput/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/olahol/react-tagsinput // Definitions by: Michael Macnair // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-tagsinput/react-tagsinput-tests.tsx b/types/react-tagsinput/react-tagsinput-tests.tsx index 8a3a113227..cdcd882817 100644 --- a/types/react-tagsinput/react-tagsinput-tests.tsx +++ b/types/react-tagsinput/react-tagsinput-tests.tsx @@ -1,5 +1,5 @@ import * as React from 'react'; -import * as TagsInput from 'react-tagsinput'; +import TagsInput = require('react-tagsinput'); interface StateI { tags: string[]; diff --git a/types/react-tagsinput/tsconfig.json b/types/react-tagsinput/tsconfig.json index 1e9342e032..6c13888335 100644 --- a/types/react-tagsinput/tsconfig.json +++ b/types/react-tagsinput/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "react-tagsinput-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-test-renderer/index.d.ts b/types/react-test-renderer/index.d.ts index ed73041f18..d069686903 100644 --- a/types/react-test-renderer/index.d.ts +++ b/types/react-test-renderer/index.d.ts @@ -5,7 +5,7 @@ // John Reilly // John Gozde // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ReactElement, ReactType } from "react"; diff --git a/types/react-test-renderer/v15/index.d.ts b/types/react-test-renderer/v15/index.d.ts index ab6d51ceaa..753f4ef19d 100644 --- a/types/react-test-renderer/v15/index.d.ts +++ b/types/react-test-renderer/v15/index.d.ts @@ -2,7 +2,7 @@ // Project: https://facebook.github.io/react/ // Definitions by: Arvitaly , Lochbrunner , Lochbrunner , John Reilly // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ReactElement } from "react"; diff --git a/types/react-test-renderer/v15/tsconfig.json b/types/react-test-renderer/v15/tsconfig.json index 597591256e..4be2e2797f 100644 --- a/types/react-test-renderer/v15/tsconfig.json +++ b/types/react-test-renderer/v15/tsconfig.json @@ -30,4 +30,4 @@ "shallow/index.d.ts", "react-test-renderer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-tether/index.d.ts b/types/react-tether/index.d.ts index 1790b8abbc..1012c8254b 100644 --- a/types/react-tether/index.d.ts +++ b/types/react-tether/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/souporserious/react-tether // Definitions by: Ryan Price // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export default TetherComponent; export as namespace ReactTether; diff --git a/types/react-textarea-autosize/index.d.ts b/types/react-textarea-autosize/index.d.ts index 9629be7e37..de52335683 100644 --- a/types/react-textarea-autosize/index.d.ts +++ b/types/react-textarea-autosize/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/andreypopp/react-textarea-autosize // Definitions by: Alexey Svetliakov , Jerry Zou // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 declare module "react-textarea-autosize" { import * as React from "react"; diff --git a/types/react-toastr/index.d.ts b/types/react-toastr/index.d.ts index 2de77a6d7e..2ccc8452fe 100644 --- a/types/react-toastr/index.d.ts +++ b/types/react-toastr/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tomchentw/react-toastr // Definitions by: Josh Holmer // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, ReactHTML } from 'react'; diff --git a/types/react-toastr/tsconfig.json b/types/react-toastr/tsconfig.json index 1fbbfde4af..c29213d19e 100644 --- a/types/react-toastr/tsconfig.json +++ b/types/react-toastr/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-toastr-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-toggle/index.d.ts b/types/react-toggle/index.d.ts index f78bdd4a0e..015daff31e 100644 --- a/types/react-toggle/index.d.ts +++ b/types/react-toggle/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/aaronshaf/react-toggle // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, InputHTMLAttributes, ReactNode } from "react"; diff --git a/types/react-toggle/v2/index.d.ts b/types/react-toggle/v2/index.d.ts index 356f70ed1a..2b0774de2d 100644 --- a/types/react-toggle/v2/index.d.ts +++ b/types/react-toggle/v2/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/aaronshaf/react-toggle // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, HTMLAttributes, ReactNode } from "react"; diff --git a/types/react-tooltip/index.d.ts b/types/react-tooltip/index.d.ts index 433efee411..e9690b8f5c 100644 --- a/types/react-tooltip/index.d.ts +++ b/types/react-tooltip/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/wwayne/react-tooltip // Definitions by: Deividas Bakanas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-tooltip/react-tooltip-tests.tsx b/types/react-tooltip/react-tooltip-tests.tsx index 5da85d8c59..3fee5dba3e 100644 --- a/types/react-tooltip/react-tooltip-tests.tsx +++ b/types/react-tooltip/react-tooltip-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import { findDOMNode } from "react-dom"; -import * as ReactTooltip from "react-tooltip"; +import ReactTooltip = require("react-tooltip"); export class ReactTooltipTest extends React.PureComponent { componentDidMount() { diff --git a/types/react-touch/index.d.ts b/types/react-touch/index.d.ts index 01f5fcdb91..3e714b2b6c 100644 --- a/types/react-touch/index.d.ts +++ b/types/react-touch/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/leonaves/react-touch // Definitions by: Grzegorz Kielak // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-tracking/index.d.ts b/types/react-tracking/index.d.ts index b94e830559..8117fb3336 100644 --- a/types/react-tracking/index.d.ts +++ b/types/react-tracking/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/NYTimes/react-tracking // Definitions by: Eloy Durán // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; diff --git a/types/react-transition-group/index.d.ts b/types/react-transition-group/index.d.ts index b41d19c857..6a90201af5 100644 --- a/types/react-transition-group/index.d.ts +++ b/types/react-transition-group/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/reactjs/react-transition-group // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import CSSTransition = require("./CSSTransition"); import Transition from "./Transition"; diff --git a/types/react-transition-group/v1/index.d.ts b/types/react-transition-group/v1/index.d.ts index 3c82827b46..dd62c27e80 100644 --- a/types/react-transition-group/v1/index.d.ts +++ b/types/react-transition-group/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/reactjs/react-transition-group // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { HTMLAttributes, ReactElement, ReactType } from "react"; diff --git a/types/react-transition-group/v1/react-transition-group-tests.tsx b/types/react-transition-group/v1/react-transition-group-tests.tsx index 346fe9989a..2e16635a4b 100644 --- a/types/react-transition-group/v1/react-transition-group-tests.tsx +++ b/types/react-transition-group/v1/react-transition-group-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react"; -import * as TransitionGroup from "react-transition-group/TransitionGroup"; -import * as CSSTransitionGroup from "react-transition-group/CSSTransitionGroup"; +import TransitionGroup = require("react-transition-group/TransitionGroup"); +import CSSTransitionGroup = require("react-transition-group/CSSTransitionGroup"); import { CSSTransitionGroupProps, TransitionGroupProps, TransitionGroupChildLifecycle } from "react-transition-group"; class TestChild extends React.Component implements TransitionGroupChildLifecycle { diff --git a/types/react-treeview/index.d.ts b/types/react-treeview/index.d.ts index 64690dc361..2bfacc3eee 100644 --- a/types/react-treeview/index.d.ts +++ b/types/react-treeview/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/chenglou/react-treeview // Definitions by: Jay Anslow // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, HTMLAttributes } from 'react'; diff --git a/types/react-truncate/index.d.ts b/types/react-truncate/index.d.ts index 5200016dec..cb97ccafe7 100644 --- a/types/react-truncate/index.d.ts +++ b/types/react-truncate/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/One-com/react-truncate // Definitions by: Matt Perry // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-user-tour/index.d.ts b/types/react-user-tour/index.d.ts index 21a8be7a61..6fdbc2da13 100644 --- a/types/react-user-tour/index.d.ts +++ b/types/react-user-tour/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/socialtables/react-user-tour // Definitions by: Carlo Cancellieri // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/react-virtual-keyboard/index.d.ts b/types/react-virtual-keyboard/index.d.ts index 20e8669c6d..03597e82e6 100644 --- a/types/react-virtual-keyboard/index.d.ts +++ b/types/react-virtual-keyboard/index.d.ts @@ -2,7 +2,7 @@ // Project: https://www.npmjs.com/package/react-virtual-keyboard // Definitions by: Bogdan Surai // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { Component } from "react"; import { KeyboardOptions, NavigateOptions } from "virtual-keyboard"; diff --git a/types/react-virtualized-select/index.d.ts b/types/react-virtualized-select/index.d.ts index d3cec048cb..fca818802f 100644 --- a/types/react-virtualized-select/index.d.ts +++ b/types/react-virtualized-select/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/bvaughn/react-virtualized-select // Definitions by: Sean Kelley // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; import { ReactSelectProps } from "react-select"; diff --git a/types/react-virtualized/dist/es/Table.d.ts b/types/react-virtualized/dist/es/Table.d.ts index 97fe20b657..87f79de86d 100644 --- a/types/react-virtualized/dist/es/Table.d.ts +++ b/types/react-virtualized/dist/es/Table.d.ts @@ -74,6 +74,8 @@ export type ColumnProps = { columnData?: any; /** Uniquely identifies the row-data attribute correspnding to this cell */ dataKey: any; + /** Default sort order when clicked for the first time. Valid options include "ASC" and "DESC". Defaults to "ASC" */ + defaultSortDirection?: SortDirectionType; /** If sort is enabled for the table at large, disable it for this column */ disableSort?: boolean; /** Flex grow style; defaults to 0 */ @@ -87,6 +89,10 @@ export type ColumnProps = { * ({ columnData: object, dataKey: string, disableSort: boolean, label: string, sortBy: string, sortDirection: string }): PropTypes.node */ headerRenderer?: TableHeaderRenderer; + /** Optional inline style to apply to this column's header */ + headerStyle?: React.CSSProperties; + /** Optional id to set on the column header; used for aria-describedby */ + id?: string; /** Header label for this column */ label?: string; /** Maximum width of column; this property will only be used if :flexGrow is > 0. */ @@ -97,8 +103,6 @@ export type ColumnProps = { style?: React.CSSProperties; /** Flex basis (width) for this column; This value can grow or shrink based on :flexGrow and :flexShrink properties. */ width: number; - /** Optional id to set on the column header; used for aria-describedby */ - id?: string; } export class Column extends Component { static propTypes: { diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index 01292a0519..6293d20c9e 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -6,7 +6,7 @@ // Szőke Szabolcs // Kræn Hansen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export { ArrowKeyStepper, diff --git a/types/react-virtualized/react-virtualized-tests.tsx b/types/react-virtualized/react-virtualized-tests.tsx index c5958ab96c..d912c1f28f 100644 --- a/types/react-virtualized/react-virtualized-tests.tsx +++ b/types/react-virtualized/react-virtualized-tests.tsx @@ -1546,12 +1546,14 @@ export class TableExample extends PureComponent<{}, any> { } dataKey='index' disableSort={!this._isSortEnabled()} + defaultSortDirection={SortDirection.DESC} width={60} /> } diff --git a/types/react-widgets-moment/tsconfig.json b/types/react-widgets-moment/tsconfig.json index 332d436d22..647a13700c 100644 --- a/types/react-widgets-moment/tsconfig.json +++ b/types/react-widgets-moment/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "react-widgets-moment-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/react-widgets/index.d.ts b/types/react-widgets/index.d.ts index 883b94a897..f02d9f016d 100644 --- a/types/react-widgets/index.d.ts +++ b/types/react-widgets/index.d.ts @@ -5,7 +5,7 @@ // Frode Hansen // Andrew Makarov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/react-widgets/tsconfig.json b/types/react-widgets/tsconfig.json index 87d8f47b06..1acb188974 100644 --- a/types/react-widgets/tsconfig.json +++ b/types/react-widgets/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "react-widgets-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/react-youtube/index.d.ts b/types/react-youtube/index.d.ts index 14458c74d0..65b5858ae6 100644 --- a/types/react-youtube/index.d.ts +++ b/types/react-youtube/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/troybetz/react-youtube // Definitions by: kgtkr // Definitions: https://github.com/borisyankov/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react"; export default class YouTube extends React.Component<{ diff --git a/types/react/index.d.ts b/types/react/index.d.ts index c39e5eeb6c..93b143b7bf 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -15,7 +15,7 @@ // Rich Seviora // Josh Rutherford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /* Known Problems & Workarounds @@ -2863,6 +2863,10 @@ declare namespace React { dateTime?: string; } + interface DialogHTMLAttributes extends HTMLAttributes { + open?: boolean; + } + interface EmbedHTMLAttributes extends HTMLAttributes { height?: number | string; src?: string; @@ -2909,6 +2913,7 @@ declare namespace React { interface ImgHTMLAttributes extends HTMLAttributes { alt?: string; + crossOrigin?: "anonymous" | "use-credentials" | ""; height?: number | string; sizes?: string; src?: string; @@ -3500,7 +3505,7 @@ declare namespace React { del: DetailedHTMLFactory, HTMLElement>; details: DetailedHTMLFactory, HTMLElement>; dfn: DetailedHTMLFactory, HTMLElement>; - dialog: DetailedHTMLFactory, HTMLElement>; + dialog: DetailedHTMLFactory, HTMLDialogElement>; div: DetailedHTMLFactory, HTMLDivElement>; dl: DetailedHTMLFactory, HTMLDListElement>; dt: DetailedHTMLFactory, HTMLElement>; @@ -3774,7 +3779,7 @@ declare global { del: React.DetailedHTMLProps, HTMLElement>; details: React.DetailedHTMLProps, HTMLElement>; dfn: React.DetailedHTMLProps, HTMLElement>; - dialog: React.DetailedHTMLProps, HTMLElement>; + dialog: React.DetailedHTMLProps, HTMLDialogElement>; div: React.DetailedHTMLProps, HTMLDivElement>; dl: React.DetailedHTMLProps, HTMLDListElement>; dt: React.DetailedHTMLProps, HTMLElement>; diff --git a/types/react/test/index.ts b/types/react/test/index.ts index 3e2be1605f..757a1da669 100644 --- a/types/react/test/index.ts +++ b/types/react/test/index.ts @@ -2,15 +2,15 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; import * as ReactDOMServer from "react-dom/server"; import createFragment = require("react-addons-create-fragment"); -import * as CSSTransitionGroup from "react-addons-css-transition-group"; +import CSSTransitionGroup = require("react-addons-css-transition-group"); import * as LinkedStateMixin from "react-addons-linked-state-mixin"; import * as Perf from "react-addons-perf"; import * as PureRenderMixin from "react-addons-pure-render-mixin"; -import * as shallowCompare from "react-addons-shallow-compare"; +import shallowCompare = require("react-addons-shallow-compare"); import * as TestUtils from "react-addons-test-utils"; -import * as TransitionGroup from "react-addons-transition-group"; +import TransitionGroup = require("react-addons-transition-group"); import update = require("react-addons-update"); -import * as createReactClass from "create-react-class"; +import createReactClass = require("create-react-class"); import * as PropTypes from "prop-types"; import * as DOM from "react-dom-factories"; diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 96c0b3af7e..534d92de29 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -13,7 +13,7 @@ // Dovydas Navickas // Stéphane Goetz // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /* Known Problems & Workarounds @@ -2856,6 +2856,7 @@ declare namespace React { interface ImgHTMLAttributes extends HTMLAttributes { alt?: string; + crossOrigin?: "anonymous" | "use-credentials" | ""; height?: number | string; sizes?: string; src?: string; diff --git a/types/react/v15/test/index.ts b/types/react/v15/test/index.ts index b0c358b011..8cd6765f4c 100644 --- a/types/react/v15/test/index.ts +++ b/types/react/v15/test/index.ts @@ -2,13 +2,13 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; import * as ReactDOMServer from "react-dom/server"; import createFragment = require("react-addons-create-fragment"); -import * as CSSTransitionGroup from "react-addons-css-transition-group"; +import CSSTransitionGroup = require("react-addons-css-transition-group"); import * as LinkedStateMixin from "react-addons-linked-state-mixin"; import * as Perf from "react-addons-perf"; import * as PureRenderMixin from "react-addons-pure-render-mixin"; -import * as shallowCompare from "react-addons-shallow-compare"; +import shallowCompare = require("react-addons-shallow-compare"); import * as TestUtils from "react-addons-test-utils"; -import * as TransitionGroup from "react-addons-transition-group"; +import TransitionGroup = require("react-addons-transition-group"); import update = require("react-addons-update"); interface Props extends React.Attributes { diff --git a/types/reactable/index.d.ts b/types/reactable/index.d.ts index 5ec58cec2b..8e3cb8873c 100644 --- a/types/reactable/index.d.ts +++ b/types/reactable/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/glittershark/reactable // Definitions by: Christoph Spielmann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/reactcss/index.d.ts b/types/reactcss/index.d.ts index 68836afe93..c5fb14bd32 100644 --- a/types/reactcss/index.d.ts +++ b/types/reactcss/index.d.ts @@ -2,7 +2,7 @@ // Project: http://reactcss.com/ // Definitions by: Chris Gervang , Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from "react" diff --git a/types/reactstrap/index.d.ts b/types/reactstrap/index.d.ts index 38c55bc08a..32d2ab7c0d 100644 --- a/types/reactstrap/index.d.ts +++ b/types/reactstrap/index.d.ts @@ -7,89 +7,88 @@ // FaithForHumans // Kurt Preston // Kræn Hansen +// Tim Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export interface CSSModule { [className: string]: string; } -export { default as Alert, AlertProps } from './lib/Alert'; -export { default as Badge, BadgeProps } from './lib/Badge'; -export { default as Breadcrumb, BreadcrumbProps } from './lib/Breadcrumb'; -export { default as BreadcrumbItem, BreadcrumbItemProps } from './lib/BreadcrumbItem'; -export { default as Button, ButtonProps } from './lib/Button'; -export { default as ButtonDropdown, ButtonDropdownProps } from './lib/ButtonDropdown'; -export { default as ButtonGroup, ButtonGroupProps } from './lib/ButtonGroup'; -export { default as ButtonToolbar, ButtonToolbarProps } from './lib/ButtonToolbar'; -export { default as Card, CardProps } from './lib/Card'; -export { default as CardBody, CardBodyProps } from './lib/CardBody'; -export { default as CardBlock, CardBlockProps } from './lib/CardBlock'; -export { default as CardColumns, CardColumnsProps } from './lib/CardColumns'; -export { default as CardDeck, CardDeckProps } from './lib/CardDeck'; -export { default as CardFooter, CardFooterProps } from './lib/CardFooter'; -export { default as CardGroup, CardGroupProps } from './lib/CardGroup'; -export { default as CardHeader, CardHeaderProps } from './lib/CardHeader'; -export { default as CardImg, CardImgProps } from './lib/CardImg'; -export { default as CardImgOverlay, CardImgOverlayProps } from './lib/CardImgOverlay'; -export { default as CardLink, CardLinkProps } from './lib/CardLink'; -export { default as CardSubtitle, CardSubtitleProps } from './lib/CardSubtitle'; -export { default as CardText, CardTextProps } from './lib/CardText'; -export { default as CardTitle, CardTitleProps } from './lib/CardTitle'; -export { default as Carousel, CarouselProps } from './lib/Carousel'; -export { default as CarouselItem, CarouselItemProps } from './lib/CarouselItem'; -export { default as CarouselControl, CarouselControlProps } from './lib/CarouselControl'; -export { default as CarouselIndicators, CarouselIndicatorsProps } from './lib/CarouselIndicators'; -export { default as CarouselCaption, CarouselCaptionProps } from './lib/CarouselCaption'; -export { default as Col, ColProps } from './lib/Col'; -export { default as Collapse, CollapseProps } from './lib/Collapse'; -export { default as Container, ContainerProps } from './lib/Container'; -export { default as Dropdown, DropdownProps } from './lib/Dropdown'; -export { default as DropdownItem, DropdownItemProps } from './lib/DropdownItem'; -export { default as DropdownMenu, DropdownMenuProps } from './lib/DropdownMenu'; -export { default as DropdownToggle, DropdownToggleProps } from './lib/DropdownToggle'; -export { default as Fade, FadeProps } from './lib/Fade'; -export { default as Form, FormProps } from './lib/Form'; -export { default as FormFeedback, FormFeedbackProps } from './lib/FormFeedback'; -export { default as FormGroup, FormGroupProps } from './lib/FormGroup'; -export { default as FormText, FormTextProps } from './lib/FormText'; -export { default as Input, InputProps } from './lib/Input'; -export { default as InputGroup, InputGroupProps } from './lib/InputGroup'; -export { default as InputGroupAddon, InputGroupAddonProps } from './lib/InputGroupAddon'; -export { default as InputGroupButton, InputGroupButtonProps } from './lib/InputGroupButton'; -export { default as Jumbotron, JumbotronProps } from './lib/Jumbotron'; -export { default as Label, LabelProps } from './lib/Label'; -export { default as ListGroup, ListGroupProps } from './lib/ListGroup'; -export { default as ListGroupItem, ListGroupItemProps } from './lib/ListGroupItem'; -export { default as ListGroupItemHeading, ListGroupItemHeadingProps } from './lib/ListGroupItemHeading'; -export { default as ListGroupItemText, ListGroupItemTextProps } from './lib/ListGroupItemText'; -export { default as Media, MediaProps } from './lib/Media'; -export { default as Modal, ModalProps } from './lib/Modal'; -export { default as ModalBody, ModalBodyProps } from './lib/ModalBody'; -export { default as ModalFooter, ModalFooterProps } from './lib/ModalFooter'; -export { default as ModalHeader, ModalHeaderProps } from './lib/ModalHeader'; -export { default as Nav, NavProps } from './lib/Nav'; -export { default as Navbar, NavbarProps } from './lib/Navbar'; -export { default as NavbarBrand, NavbarBrandProps } from './lib/NavbarBrand'; -export { default as NavbarToggler, NavbarTogglerProps } from './lib/NavbarToggler'; -export { default as NavDropdown, NavDropdownProps } from './lib/NavDropdown'; -export { default as NavItem, NavItemProps } from './lib/NavItem'; -export { default as NavLink, NavLinkProps } from './lib/NavLink'; -export { default as Pagination, PaginationProps } from './lib/Pagination'; -export { default as PaginationItem, PaginationItemProps } from './lib/PaginationItem'; -export { default as PaginationLink, PaginationLinkProps } from './lib/PaginationLink'; -export { default as Popover, PopoverProps } from './lib/Popover'; -export { default as PopoverBody, PopoverBodyProps } from './lib/PopoverBody'; -export { default as PopoverHeader, PopoverHeaderProps } from './lib/PopoverHeader'; -export { default as Progress, ProgressProps } from './lib/Progress'; -export { default as Row, RowProps } from './lib/Row'; -export { default as TabContent, TabContentProps } from './lib/TabContent'; -export { default as Table, TableProps } from './lib/Table'; -export { default as TabPane, TabPaneProps } from './lib/TabPane'; -export { default as Tag, TagProps } from './lib/Tag'; -export { default as Tooltip, TooltipProps } from './lib/Tooltip'; -export { UncontrolledAlert, UncontrolledAlertProps } from './lib/Uncontrolled'; -export { UncontrolledButtonDropdown, UncontrolledButtonDropdownProps } from './lib/Uncontrolled'; -export { UncontrolledDropdown, UncontrolledDropdownProps } from './lib/Uncontrolled'; -export { UncontrolledNavDropdown, UncontrolledNavDropdownProps } from './lib/Uncontrolled'; -export { UncontrolledTooltip, UncontrolledTooltipProps } from './lib/Uncontrolled'; +export { default as Alert, AlertProps } from './lib/Alert'; +export { default as Badge, BadgeProps } from './lib/Badge'; +export { default as Breadcrumb, BreadcrumbProps } from './lib/Breadcrumb'; +export { default as BreadcrumbItem, BreadcrumbItemProps } from './lib/BreadcrumbItem'; +export { default as Button, ButtonProps } from './lib/Button'; +export { default as ButtonDropdown, ButtonDropdownProps } from './lib/ButtonDropdown'; +export { default as ButtonGroup, ButtonGroupProps } from './lib/ButtonGroup'; +export { default as ButtonToolbar, ButtonToolbarProps } from './lib/ButtonToolbar'; +export { default as Card, CardProps } from './lib/Card'; +export { default as CardBody, CardBodyProps } from './lib/CardBody'; +export { default as CardColumns, CardColumnsProps } from './lib/CardColumns'; +export { default as CardDeck, CardDeckProps } from './lib/CardDeck'; +export { default as CardFooter, CardFooterProps } from './lib/CardFooter'; +export { default as CardGroup, CardGroupProps } from './lib/CardGroup'; +export { default as CardHeader, CardHeaderProps } from './lib/CardHeader'; +export { default as CardImg, CardImgProps } from './lib/CardImg'; +export { default as CardImgOverlay, CardImgOverlayProps } from './lib/CardImgOverlay'; +export { default as CardLink, CardLinkProps } from './lib/CardLink'; +export { default as CardSubtitle, CardSubtitleProps } from './lib/CardSubtitle'; +export { default as CardText, CardTextProps } from './lib/CardText'; +export { default as CardTitle, CardTitleProps } from './lib/CardTitle'; +export { default as Carousel, CarouselProps } from './lib/Carousel'; +export { default as CarouselItem, CarouselItemProps } from './lib/CarouselItem'; +export { default as CarouselControl, CarouselControlProps } from './lib/CarouselControl'; +export { default as CarouselIndicators, CarouselIndicatorsProps } from './lib/CarouselIndicators'; +export { default as CarouselCaption, CarouselCaptionProps } from './lib/CarouselCaption'; +export { default as Col, ColProps } from './lib/Col'; +export { default as Collapse, CollapseProps } from './lib/Collapse'; +export { default as Container, ContainerProps } from './lib/Container'; +export { default as Dropdown, DropdownProps } from './lib/Dropdown'; +export { default as DropdownItem, DropdownItemProps } from './lib/DropdownItem'; +export { default as DropdownMenu, DropdownMenuProps } from './lib/DropdownMenu'; +export { default as DropdownToggle, DropdownToggleProps } from './lib/DropdownToggle'; +export { default as Fade, FadeProps } from './lib/Fade'; +export { default as Form, FormProps } from './lib/Form'; +export { default as FormFeedback, FormFeedbackProps } from './lib/FormFeedback'; +export { default as FormGroup, FormGroupProps } from './lib/FormGroup'; +export { default as FormText, FormTextProps } from './lib/FormText'; +export { default as Input, InputProps } from './lib/Input'; +export { default as InputGroup, InputGroupProps } from './lib/InputGroup'; +export { default as InputGroupAddon, InputGroupAddonProps } from './lib/InputGroupAddon'; +export { default as InputGroupButtonDropdown, InputGroupButtonDropdownProps } from './lib/InputGroupButtonDropdown'; +export { default as InputGroupText, InputGroupTextProps } from './lib/InputGroupText'; +export { default as Jumbotron, JumbotronProps } from './lib/Jumbotron'; +export { default as Label, LabelProps } from './lib/Label'; +export { default as ListGroup, ListGroupProps } from './lib/ListGroup'; +export { default as ListGroupItem, ListGroupItemProps } from './lib/ListGroupItem'; +export { default as ListGroupItemHeading, ListGroupItemHeadingProps } from './lib/ListGroupItemHeading'; +export { default as ListGroupItemText, ListGroupItemTextProps } from './lib/ListGroupItemText'; +export { default as Media, MediaProps } from './lib/Media'; +export { default as Modal, ModalProps } from './lib/Modal'; +export { default as ModalBody, ModalBodyProps } from './lib/ModalBody'; +export { default as ModalFooter, ModalFooterProps } from './lib/ModalFooter'; +export { default as ModalHeader, ModalHeaderProps } from './lib/ModalHeader'; +export { default as Nav, NavProps } from './lib/Nav'; +export { default as Navbar, NavbarProps } from './lib/Navbar'; +export { default as NavbarBrand, NavbarBrandProps } from './lib/NavbarBrand'; +export { default as NavbarToggler, NavbarTogglerProps } from './lib/NavbarToggler'; +export { default as NavItem, NavItemProps } from './lib/NavItem'; +export { default as NavLink, NavLinkProps } from './lib/NavLink'; +export { default as Pagination, PaginationProps } from './lib/Pagination'; +export { default as PaginationItem, PaginationItemProps } from './lib/PaginationItem'; +export { default as PaginationLink, PaginationLinkProps } from './lib/PaginationLink'; +export { default as Popover, PopoverProps } from './lib/Popover'; +export { default as PopoverBody, PopoverBodyProps } from './lib/PopoverBody'; +export { default as PopoverHeader, PopoverHeaderProps } from './lib/PopoverHeader'; +export { default as Progress, ProgressProps } from './lib/Progress'; +export { default as Row, RowProps } from './lib/Row'; +export { default as TabContent, TabContentProps } from './lib/TabContent'; +export { default as Table, TableProps } from './lib/Table'; +export { default as TabPane, TabPaneProps } from './lib/TabPane'; +export { default as Tag, TagProps } from './lib/Tag'; +export { default as Tooltip, TooltipProps } from './lib/Tooltip'; +export { UncontrolledAlert, UncontrolledAlertProps } from './lib/Uncontrolled'; +export { UncontrolledButtonDropdown, UncontrolledButtonDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledDropdown, UncontrolledDropdownProps } from './lib/Uncontrolled'; +export { UncontrolledTooltip, UncontrolledTooltipProps } from './lib/Uncontrolled'; diff --git a/types/reactstrap/lib/Alert.d.ts b/types/reactstrap/lib/Alert.d.ts index c52ff2c35b..2a5a0f8dde 100644 --- a/types/reactstrap/lib/Alert.d.ts +++ b/types/reactstrap/lib/Alert.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface UncontrolledProps { +export interface UncontrolledProps extends React.HTMLAttributes { className?: string; cssModule?: CSSModule; color?: string; diff --git a/types/reactstrap/lib/Badge.d.ts b/types/reactstrap/lib/Badge.d.ts index b58faeed8c..f45c418c52 100644 --- a/types/reactstrap/lib/Badge.d.ts +++ b/types/reactstrap/lib/Badge.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface BadgeProps { +export interface BadgeProps extends React.HTMLAttributes { color?: string; pill?: boolean; tag?: React.ReactType; diff --git a/types/reactstrap/lib/Breadcrumb.d.ts b/types/reactstrap/lib/Breadcrumb.d.ts index 4b5e2b85da..74e770de4f 100644 --- a/types/reactstrap/lib/Breadcrumb.d.ts +++ b/types/reactstrap/lib/Breadcrumb.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface BreadcrumbProps { +export interface BreadcrumbProps extends React.HTMLAttributes { tag?: string; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/BreadcrumbItem.d.ts b/types/reactstrap/lib/BreadcrumbItem.d.ts index 4cb8d77c75..ab2e9cbc4e 100644 --- a/types/reactstrap/lib/BreadcrumbItem.d.ts +++ b/types/reactstrap/lib/BreadcrumbItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface BreadcrumbItemProps { +export interface BreadcrumbItemProps extends React.HTMLAttributes { tag?: React.ReactType; active?: boolean; className?: string; diff --git a/types/reactstrap/lib/ButtonGroup.d.ts b/types/reactstrap/lib/ButtonGroup.d.ts index 29bbaac38b..10549f5347 100644 --- a/types/reactstrap/lib/ButtonGroup.d.ts +++ b/types/reactstrap/lib/ButtonGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ButtonGroupProps { +export interface ButtonGroupProps extends React.HTMLAttributes { tag?: React.ReactType; 'aria-label'?: string; className?: string; diff --git a/types/reactstrap/lib/ButtonToolbar.d.ts b/types/reactstrap/lib/ButtonToolbar.d.ts index 1c782c5745..ebd8733b28 100644 --- a/types/reactstrap/lib/ButtonToolbar.d.ts +++ b/types/reactstrap/lib/ButtonToolbar.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ButtonToolbarProps { +export interface ButtonToolbarProps extends React.HTMLAttributes { tag?: React.ReactType; 'aria-label'?: string; className?: string; diff --git a/types/reactstrap/lib/Card.d.ts b/types/reactstrap/lib/Card.d.ts index 8fd85c099b..0387ae3e94 100644 --- a/types/reactstrap/lib/Card.d.ts +++ b/types/reactstrap/lib/Card.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardProps { +export interface CardProps extends React.HTMLAttributes { tag?: React.ReactType; inverse?: boolean; color?: string; diff --git a/types/reactstrap/lib/CardBlock.d.ts b/types/reactstrap/lib/CardBlock.d.ts deleted file mode 100644 index 9830e15e6a..0000000000 --- a/types/reactstrap/lib/CardBlock.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -import { CSSModule } from '../index'; - -export interface CardBlockProps { - tag?: React.ReactType; - className?: string; - cssModule?: CSSModule; -} - -declare const CardBlock: React.StatelessComponent; -export default CardBlock; diff --git a/types/reactstrap/lib/CardBody.d.ts b/types/reactstrap/lib/CardBody.d.ts index 433a6a6ac0..d95ac0d31b 100644 --- a/types/reactstrap/lib/CardBody.d.ts +++ b/types/reactstrap/lib/CardBody.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardBodyProps { +export interface CardBodyProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardColumns.d.ts b/types/reactstrap/lib/CardColumns.d.ts index 92eb2019ec..19f53cc250 100644 --- a/types/reactstrap/lib/CardColumns.d.ts +++ b/types/reactstrap/lib/CardColumns.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardColumnsProps { +export interface CardColumnsProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardDeck.d.ts b/types/reactstrap/lib/CardDeck.d.ts index c14324df37..09b3d39c34 100644 --- a/types/reactstrap/lib/CardDeck.d.ts +++ b/types/reactstrap/lib/CardDeck.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardDeckProps { +export interface CardDeckProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardFooter.d.ts b/types/reactstrap/lib/CardFooter.d.ts index 6dba776a38..f1ee324f03 100644 --- a/types/reactstrap/lib/CardFooter.d.ts +++ b/types/reactstrap/lib/CardFooter.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardFooterProps { +export interface CardFooterProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardGroup.d.ts b/types/reactstrap/lib/CardGroup.d.ts index 695747eef4..5bf83900bf 100644 --- a/types/reactstrap/lib/CardGroup.d.ts +++ b/types/reactstrap/lib/CardGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardGroupProps { +export interface CardGroupProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardHeader.d.ts b/types/reactstrap/lib/CardHeader.d.ts index 306ff445e3..d630954e78 100644 --- a/types/reactstrap/lib/CardHeader.d.ts +++ b/types/reactstrap/lib/CardHeader.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardHeaderProps { +export interface CardHeaderProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardImg.d.ts b/types/reactstrap/lib/CardImg.d.ts index e65cba66e2..b4b7021232 100644 --- a/types/reactstrap/lib/CardImg.d.ts +++ b/types/reactstrap/lib/CardImg.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardImgProps { +export interface CardImgProps extends React.HTMLAttributes { tag?: React.ReactType; top?: boolean; bottom?: boolean; diff --git a/types/reactstrap/lib/CardImgOverlay.d.ts b/types/reactstrap/lib/CardImgOverlay.d.ts index d31e96d76f..ccc76fa9c9 100644 --- a/types/reactstrap/lib/CardImgOverlay.d.ts +++ b/types/reactstrap/lib/CardImgOverlay.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardImgOverlayProps { +export interface CardImgOverlayProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardLink.d.ts b/types/reactstrap/lib/CardLink.d.ts index 22c9d614b3..9425571de5 100644 --- a/types/reactstrap/lib/CardLink.d.ts +++ b/types/reactstrap/lib/CardLink.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardLinkProps { +export interface CardLinkProps extends React.HTMLAttributes { tag?: React.ReactType; innerRef?: string | ((instance: HTMLButtonElement) => any); className?: string; diff --git a/types/reactstrap/lib/CardSubtitle.d.ts b/types/reactstrap/lib/CardSubtitle.d.ts index 915c69c93f..a237c29119 100644 --- a/types/reactstrap/lib/CardSubtitle.d.ts +++ b/types/reactstrap/lib/CardSubtitle.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardSubtitleProps { +export interface CardSubtitleProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardText.d.ts b/types/reactstrap/lib/CardText.d.ts index 3782e962be..462c1abef3 100644 --- a/types/reactstrap/lib/CardText.d.ts +++ b/types/reactstrap/lib/CardText.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardTextProps { +export interface CardTextProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/CardTitle.d.ts b/types/reactstrap/lib/CardTitle.d.ts index f551d860ab..68c5c6120c 100644 --- a/types/reactstrap/lib/CardTitle.d.ts +++ b/types/reactstrap/lib/CardTitle.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface CardTitleProps { +export interface CardTitleProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/Container.d.ts b/types/reactstrap/lib/Container.d.ts index 4721cf68c1..df2114e773 100644 --- a/types/reactstrap/lib/Container.d.ts +++ b/types/reactstrap/lib/Container.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ContainerProps { +export interface ContainerProps extends React.HTMLAttributes { tag?: React.ReactType; fluid?: boolean; className?: string; diff --git a/types/reactstrap/lib/Dropdown.d.ts b/types/reactstrap/lib/Dropdown.d.ts index 9754af4fe2..17805d4908 100644 --- a/types/reactstrap/lib/Dropdown.d.ts +++ b/types/reactstrap/lib/Dropdown.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface UncontrolledProps { +export interface UncontrolledProps extends React.HTMLAttributes { isOpen?: boolean; toggle?: () => void; className?: string; @@ -18,6 +18,7 @@ export interface Props extends UncontrolledProps { group?: boolean; size?: string; tag?: React.ReactType; + addonType?: boolean | 'prepend' | 'append'; } export interface DropdownProps extends Props { /* intentionally blank */ diff --git a/types/reactstrap/lib/DropdownItem.d.ts b/types/reactstrap/lib/DropdownItem.d.ts index ce11638b83..598c2fbfc8 100644 --- a/types/reactstrap/lib/DropdownItem.d.ts +++ b/types/reactstrap/lib/DropdownItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface DropdownItemProps { +export interface DropdownItemProps extends React.HTMLAttributes { disabled?: boolean; divider?: boolean; tag?: React.ReactType; diff --git a/types/reactstrap/lib/DropdownMenu.d.ts b/types/reactstrap/lib/DropdownMenu.d.ts index 1fcbab6c2b..8d3cdb6acd 100644 --- a/types/reactstrap/lib/DropdownMenu.d.ts +++ b/types/reactstrap/lib/DropdownMenu.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface DropdownMenuProps { +export interface DropdownMenuProps extends React.HTMLAttributes { tag?: React.ReactType; right?: boolean; className?: string; diff --git a/types/reactstrap/lib/DropdownToggle.d.ts b/types/reactstrap/lib/DropdownToggle.d.ts index 51028815d4..5c27af11ad 100644 --- a/types/reactstrap/lib/DropdownToggle.d.ts +++ b/types/reactstrap/lib/DropdownToggle.d.ts @@ -1,11 +1,12 @@ import { CSSModule } from '../index'; -export interface DropdownToggleProps { +export interface DropdownToggleProps extends React.HTMLAttributes { caret?: boolean; className?: string; cssModule?: CSSModule; disabled?: boolean; onClick?: React.MouseEventHandler; + outline?: boolean; 'data-toggle'?: string; 'aria-haspopup'?: boolean; split?: boolean; diff --git a/types/reactstrap/lib/Fade.d.ts b/types/reactstrap/lib/Fade.d.ts index 6d67195821..05a13502e1 100644 --- a/types/reactstrap/lib/Fade.d.ts +++ b/types/reactstrap/lib/Fade.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface FadeProps { +export interface FadeProps extends React.HTMLAttributes { in?: boolean; baseClass?: string; baseClassIn?: string; diff --git a/types/reactstrap/lib/FormFeedback.d.ts b/types/reactstrap/lib/FormFeedback.d.ts index 20e9b27745..b5c8f04eae 100644 --- a/types/reactstrap/lib/FormFeedback.d.ts +++ b/types/reactstrap/lib/FormFeedback.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface FormFeedbackProps { +export interface FormFeedbackProps extends React.HTMLAttributes { tag?: string; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/FormText.d.ts b/types/reactstrap/lib/FormText.d.ts index a749d6fc30..99a3675d6b 100644 --- a/types/reactstrap/lib/FormText.d.ts +++ b/types/reactstrap/lib/FormText.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface FormTextProps { +export interface FormTextProps extends React.HTMLAttributes { inline?: boolean; tag?: React.ReactType; color?: string; diff --git a/types/reactstrap/lib/InputGroup.d.ts b/types/reactstrap/lib/InputGroup.d.ts index 22f3ba027c..468b46f1c5 100644 --- a/types/reactstrap/lib/InputGroup.d.ts +++ b/types/reactstrap/lib/InputGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface InputGroupProps { +export interface InputGroupProps extends React.HTMLAttributes { tag?: React.ReactType; size?: string; className?: string; diff --git a/types/reactstrap/lib/InputGroupAddon.d.ts b/types/reactstrap/lib/InputGroupAddon.d.ts index 31f5af505d..88b4f678c7 100644 --- a/types/reactstrap/lib/InputGroupAddon.d.ts +++ b/types/reactstrap/lib/InputGroupAddon.d.ts @@ -1,9 +1,10 @@ import { CSSModule } from '../index'; -export interface InputGroupAddonProps { +export interface InputGroupAddonProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; + addonType: 'prepend' | 'append'; } declare const InputGroupAddon: React.StatelessComponent; diff --git a/types/reactstrap/lib/InputGroupButton.d.ts b/types/reactstrap/lib/InputGroupButton.d.ts deleted file mode 100644 index 0d77701932..0000000000 --- a/types/reactstrap/lib/InputGroupButton.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -import { CSSModule } from '../index'; - -export interface InputGroupButtonProps { - tag?: React.ReactType; - groupClassName?: string; - groupAttributes?: any; - className?: string; - cssModule?: CSSModule; - color?: string; -} - -declare const InputGroupButton: React.StatelessComponent; -export default InputGroupButton; diff --git a/types/reactstrap/lib/InputGroupButtonDropdown.d.ts b/types/reactstrap/lib/InputGroupButtonDropdown.d.ts new file mode 100644 index 0000000000..32a129d43d --- /dev/null +++ b/types/reactstrap/lib/InputGroupButtonDropdown.d.ts @@ -0,0 +1,8 @@ +import { DropdownProps } from './Dropdown'; + +export interface InputGroupButtonDropdownProps extends DropdownProps { + addonType: 'prepend' | 'append'; +} + +declare const InputGroupButtonDropdown: React.StatelessComponent; +export default InputGroupButtonDropdown; diff --git a/types/reactstrap/lib/InputGroupText.d.ts b/types/reactstrap/lib/InputGroupText.d.ts new file mode 100644 index 0000000000..356babe8f4 --- /dev/null +++ b/types/reactstrap/lib/InputGroupText.d.ts @@ -0,0 +1,9 @@ +import { CSSModule } from '../index'; + +export interface InputGroupTextProps extends React.HTMLAttributes { + tag?: React.ReactType; + cssModule?: CSSModule; +} + +declare const InputGroupText: React.StatelessComponent; +export default InputGroupText; diff --git a/types/reactstrap/lib/Jumbotron.d.ts b/types/reactstrap/lib/Jumbotron.d.ts index 6cb94c04c1..9145e73223 100644 --- a/types/reactstrap/lib/Jumbotron.d.ts +++ b/types/reactstrap/lib/Jumbotron.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface JumbotronProps { +export interface JumbotronProps extends React.HTMLAttributes { tag?: React.ReactType; fluid?: boolean; className?: string; diff --git a/types/reactstrap/lib/ListGroup.d.ts b/types/reactstrap/lib/ListGroup.d.ts index a2a088935b..e9cb511cf0 100644 --- a/types/reactstrap/lib/ListGroup.d.ts +++ b/types/reactstrap/lib/ListGroup.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ListGroupProps { +export interface ListGroupProps extends React.HTMLAttributes { tag?: React.ReactType; flush?: boolean; className?: string; diff --git a/types/reactstrap/lib/ListGroupItem.d.ts b/types/reactstrap/lib/ListGroupItem.d.ts index d2cb1a9e67..045aa9539e 100644 --- a/types/reactstrap/lib/ListGroupItem.d.ts +++ b/types/reactstrap/lib/ListGroupItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ListGroupItemProps { +export interface ListGroupItemProps extends React.HTMLAttributes { tag?: React.ReactType; active?: boolean; disabled?: boolean; diff --git a/types/reactstrap/lib/ListGroupItemHeading.d.ts b/types/reactstrap/lib/ListGroupItemHeading.d.ts index 0f5bdfb457..09e29f9434 100644 --- a/types/reactstrap/lib/ListGroupItemHeading.d.ts +++ b/types/reactstrap/lib/ListGroupItemHeading.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ListGroupItemHeadingProps { +export interface ListGroupItemHeadingProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/ListGroupItemText.d.ts b/types/reactstrap/lib/ListGroupItemText.d.ts index 7010eb1289..947ee4cd7a 100644 --- a/types/reactstrap/lib/ListGroupItemText.d.ts +++ b/types/reactstrap/lib/ListGroupItemText.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ListGroupItemTextProps { +export interface ListGroupItemTextProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/Media.d.ts b/types/reactstrap/lib/Media.d.ts index daf4fadcc8..f7a9afb2c0 100644 --- a/types/reactstrap/lib/Media.d.ts +++ b/types/reactstrap/lib/Media.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface MediaProps { +export interface MediaProps extends React.HTMLAttributes { body?: boolean; bottom?: boolean; className?: string; diff --git a/types/reactstrap/lib/Modal.d.ts b/types/reactstrap/lib/Modal.d.ts index 5fc1ffc734..bfab2f56fd 100644 --- a/types/reactstrap/lib/Modal.d.ts +++ b/types/reactstrap/lib/Modal.d.ts @@ -1,6 +1,7 @@ import { CSSModule } from '../index'; +import { FadeProps } from './Fade'; -export interface ModalProps { +export interface ModalProps extends React.HTMLAttributes { isOpen?: boolean; autoFocus?: boolean; size?: string; @@ -9,6 +10,8 @@ export interface ModalProps { backdrop?: boolean | 'static'; onEnter?: () => void; onExit?: () => void; + onOpened?: () => void; + onClosed?: () => void; className?: string; cssModule?: CSSModule; wrapClassName?: string; @@ -17,6 +20,8 @@ export interface ModalProps { contentClassName?: string; zIndex?: number | string; fade?: boolean; + backdropTransition?: FadeProps; + modalTransition?: FadeProps; } declare const Modal: React.StatelessComponent; diff --git a/types/reactstrap/lib/ModalBody.d.ts b/types/reactstrap/lib/ModalBody.d.ts index 1467b5883a..083ac04186 100644 --- a/types/reactstrap/lib/ModalBody.d.ts +++ b/types/reactstrap/lib/ModalBody.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ModalBodyProps { +export interface ModalBodyProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/ModalFooter.d.ts b/types/reactstrap/lib/ModalFooter.d.ts index ae511eb7cc..40ed54f9ae 100644 --- a/types/reactstrap/lib/ModalFooter.d.ts +++ b/types/reactstrap/lib/ModalFooter.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ModalFooterProps { +export interface ModalFooterProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/ModalHeader.d.ts b/types/reactstrap/lib/ModalHeader.d.ts index 47632f59e3..c1a3e55b7a 100644 --- a/types/reactstrap/lib/ModalHeader.d.ts +++ b/types/reactstrap/lib/ModalHeader.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ModalHeaderProps { +export interface ModalHeaderProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/NavDropdown.d.ts b/types/reactstrap/lib/NavDropdown.d.ts deleted file mode 100644 index e40e60601c..0000000000 --- a/types/reactstrap/lib/NavDropdown.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { UncontrolledDropdownProps, DropdownProps } from './Dropdown'; - -export interface UncontrolledProps extends UncontrolledDropdownProps { - /* intentionally blank */ -} -export interface UncontrolledNavDropdownProps extends UncontrolledProps { - /* intentionally blank */ -} - -export interface NavDropdownProps extends DropdownProps { - /* intentionally blank */ -} - -declare const NavDropdown: React.StatelessComponent; -export default NavDropdown; diff --git a/types/reactstrap/lib/NavItem.d.ts b/types/reactstrap/lib/NavItem.d.ts index 0769347298..6d5e0dd9cb 100644 --- a/types/reactstrap/lib/NavItem.d.ts +++ b/types/reactstrap/lib/NavItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface NavItemProps { +export interface NavItemProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/Navbar.d.ts b/types/reactstrap/lib/Navbar.d.ts index ed3f28a02c..83e720731a 100644 --- a/types/reactstrap/lib/Navbar.d.ts +++ b/types/reactstrap/lib/Navbar.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface NavbarProps { +export interface NavbarProps extends React.HTMLAttributes { light?: boolean; dark?: boolean; inverse?: boolean; diff --git a/types/reactstrap/lib/Pagination.d.ts b/types/reactstrap/lib/Pagination.d.ts index 7657d90206..9dabaf8829 100644 --- a/types/reactstrap/lib/Pagination.d.ts +++ b/types/reactstrap/lib/Pagination.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface PaginationProps { +export interface PaginationProps extends React.HTMLAttributes { className?: string; cssModule?: CSSModule; size?: string; diff --git a/types/reactstrap/lib/PaginationItem.d.ts b/types/reactstrap/lib/PaginationItem.d.ts index c2eadfab97..a00fddc413 100644 --- a/types/reactstrap/lib/PaginationItem.d.ts +++ b/types/reactstrap/lib/PaginationItem.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface PaginationItemProps { +export interface PaginationItemProps extends React.HTMLAttributes { className?: string; cssModule?: CSSModule; active?: boolean; diff --git a/types/reactstrap/lib/PopoverBody.d.ts b/types/reactstrap/lib/PopoverBody.d.ts index 93512cacb1..bf67919e49 100644 --- a/types/reactstrap/lib/PopoverBody.d.ts +++ b/types/reactstrap/lib/PopoverBody.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface PopoverBodyProps { +export interface PopoverBodyProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/PopoverHeader.d.ts b/types/reactstrap/lib/PopoverHeader.d.ts index 2ad69c636c..caa0847233 100644 --- a/types/reactstrap/lib/PopoverHeader.d.ts +++ b/types/reactstrap/lib/PopoverHeader.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface PopoverHeaderProps { +export interface PopoverHeaderProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/Progress.d.ts b/types/reactstrap/lib/Progress.d.ts index 89e9df4be9..6f252622a1 100644 --- a/types/reactstrap/lib/Progress.d.ts +++ b/types/reactstrap/lib/Progress.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface ProgressProps { +export interface ProgressProps extends React.HTMLAttributes { bar?: boolean; multi?: boolean; tag?: string; diff --git a/types/reactstrap/lib/Row.d.ts b/types/reactstrap/lib/Row.d.ts index e5553ff81f..35284a9f70 100644 --- a/types/reactstrap/lib/Row.d.ts +++ b/types/reactstrap/lib/Row.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface RowProps extends React.HTMLProps< HTMLElement> { +export interface RowProps extends React.HTMLProps { className?: string; cssModule?: CSSModule; tag?: React.ReactType; diff --git a/types/reactstrap/lib/TabContent.d.ts b/types/reactstrap/lib/TabContent.d.ts index 2581ea7a93..0a180cf3c4 100644 --- a/types/reactstrap/lib/TabContent.d.ts +++ b/types/reactstrap/lib/TabContent.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface TabContentProps { +export interface TabContentProps extends React.HTMLAttributes { tag?: React.ReactType; activeTab?: number | string; className?: string; diff --git a/types/reactstrap/lib/TabPane.d.ts b/types/reactstrap/lib/TabPane.d.ts index a39398d59b..0bcbfd5d17 100644 --- a/types/reactstrap/lib/TabPane.d.ts +++ b/types/reactstrap/lib/TabPane.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface TabPaneProps { +export interface TabPaneProps extends React.HTMLAttributes { tag?: React.ReactType; className?: string; cssModule?: CSSModule; diff --git a/types/reactstrap/lib/Table.d.ts b/types/reactstrap/lib/Table.d.ts index c2d31d71e2..0374d7a0b5 100644 --- a/types/reactstrap/lib/Table.d.ts +++ b/types/reactstrap/lib/Table.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface TableProps { +export interface TableProps extends React.HTMLAttributes { className?: string; cssModule?: CSSModule; size?: string; diff --git a/types/reactstrap/lib/Tag.d.ts b/types/reactstrap/lib/Tag.d.ts index 153ff61177..49df70b240 100644 --- a/types/reactstrap/lib/Tag.d.ts +++ b/types/reactstrap/lib/Tag.d.ts @@ -1,6 +1,6 @@ import { CSSModule } from '../index'; -export interface TagProps { +export interface TagProps extends React.HTMLAttributes { color?: string; pill?: boolean; tag?: React.ReactType; diff --git a/types/reactstrap/lib/Uncontrolled.d.ts b/types/reactstrap/lib/Uncontrolled.d.ts index b3b292dd6b..d241477adb 100644 --- a/types/reactstrap/lib/Uncontrolled.d.ts +++ b/types/reactstrap/lib/Uncontrolled.d.ts @@ -1,17 +1,14 @@ import { UncontrolledAlertProps } from './Alert'; import { UncontrolledButtonDropdownProps } from './ButtonDropdown'; import { UncontrolledDropdownProps } from './Dropdown'; -import { UncontrolledNavDropdownProps } from './NavDropdown'; import { UncontrolledTooltipProps } from './Tooltip'; export const UncontrolledAlert: React.StatelessComponent; export const UncontrolledButtonDropdown: React.StatelessComponent; export const UncontrolledDropdown: React.StatelessComponent; -export const UncontrolledNavDropdown: React.StatelessComponent; export const UncontrolledTooltip: React.StatelessComponent; export { UncontrolledAlertProps } from './Alert'; export { UncontrolledButtonDropdownProps } from './ButtonDropdown'; export { UncontrolledDropdownProps } from './Dropdown'; -export { UncontrolledNavDropdownProps } from './NavDropdown'; export { UncontrolledTooltipProps } from './Tooltip'; diff --git a/types/reactstrap/reactstrap-tests.tsx b/types/reactstrap/reactstrap-tests.tsx index 0f0bf7b81d..756d3acbd0 100644 --- a/types/reactstrap/reactstrap-tests.tsx +++ b/types/reactstrap/reactstrap-tests.tsx @@ -15,7 +15,6 @@ import { DropdownToggle, Card, CardBody, - CardBlock, CardColumns, CardDeck, CardFooter, @@ -44,7 +43,8 @@ import { Input, InputGroup, InputGroupAddon, - InputGroupButton, + InputGroupButtonDropdown, + InputGroupText, Pagination, Label, ListGroup, @@ -61,7 +61,6 @@ import { Navbar, NavbarBrand, NavbarToggler, - NavDropdown, NavItem, NavLink, PaginationItem, @@ -73,7 +72,6 @@ import { TabPane, UncontrolledButtonDropdown, UncontrolledDropdown, - UncontrolledNavDropdown, UncontrolledTooltip, TabContent, Table, @@ -522,12 +520,12 @@ const Example25 = (props: any) => {
- + Card title Card subtitle Some quick example text to build on the card title and make up the bulk of the card's content. - +
); @@ -537,16 +535,16 @@ 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 - +
); @@ -600,21 +598,21 @@ const Example29 = (props: any) => {
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
@@ -626,22 +624,22 @@ const Example30 = (props: any) => {
- + 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 - +
@@ -744,25 +742,25 @@ const Example34 = (props: any) => { - + 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 @@ -770,7 +768,7 @@ const Example34 = (props: any) => { card has even longer content than the first to show that equal height action. - + ); @@ -781,25 +779,25 @@ const Example35 = (props: any) => { - + 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 @@ -807,7 +805,7 @@ const Example35 = (props: any) => { even longer content than the first to show that equal height action. - + ); @@ -818,23 +816,23 @@ const Example36 = (props: any) => { - + 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 @@ -845,7 +843,7 @@ const Example36 = (props: any) => { - + Card title Card subtitle @@ -853,7 +851,7 @@ const Example36 = (props: any) => { has even longer content than the first to show that equal height action. - + Special Title Treatment @@ -883,12 +881,12 @@ class Example37 extends React.Component { - + 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. - +
@@ -925,12 +923,12 @@ class Example38 extends React.Component {
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. - +
@@ -1422,12 +1420,12 @@ const Example52 = (props: any) => { return (
- @ + @
- + @@ -1435,21 +1433,25 @@ const Example52 = (props: any) => {
- @example.com + @example.com
- $ - $ + + $ + $ + - $ - $ + + $ + $ +
- $ + $ - .00 + .00
); @@ -1459,19 +1461,19 @@ const Example53 = (props: any) => { return (
- To the Left! + To the Left!
- To the Right! + To the Right!
- To the Left! + To the Left! - To the Right! + To the Right!
); @@ -1481,17 +1483,17 @@ const Example54 = (props: any) => { return (
- @lg + @lg
- @normal + @normal
- @sm + @sm
@@ -1502,19 +1504,19 @@ const Example55 = (props: any) => { return (
- +
- +
- + - +
); @@ -1524,17 +1526,17 @@ const Example56 = (props: any) => { return (
- @lg + @lg
- @normal + @normal
- @sm + @sm
@@ -1545,19 +1547,19 @@ const Example57 = (props: any) => { return (
- +
- +
- + - +
); @@ -1567,19 +1569,19 @@ const Example58 = (props: any) => { return (
- To the Left! + To the Left!
- To the Right! + To the Right!
- To the Left! + To the Left! - To the Right! + To the Right!
); @@ -2242,7 +2244,7 @@ class Example79 extends React.Component { Link - + Dropdown @@ -2253,7 +2255,7 @@ class Example79 extends React.Component { Another Action - + Link @@ -2292,7 +2294,7 @@ class Example80 extends React.Component { Link - + Dropdown @@ -2303,7 +2305,7 @@ class Example80 extends React.Component { Another Action - + Link @@ -3614,3 +3616,46 @@ class Example115 extends React.Component { ); } } + +const Example116 = (props: any) => { + return( +
+ + + + +
+ + + + + Button Dropdown + + + Header + Action + Another Action + + Another Action + + + +
+ + + + + + Header + Action + Another Action + + Another Action + + + + + +
+ ); +}; diff --git a/types/reactstrap/v4/index.d.ts b/types/reactstrap/v4/index.d.ts index 81d4cec5bd..93eeed908f 100644 --- a/types/reactstrap/v4/index.d.ts +++ b/types/reactstrap/v4/index.d.ts @@ -2,7 +2,7 @@ // 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 +// TypeScript Version: 2.6 export interface CSSModule { [className: string]: string; diff --git a/types/reactstrap/v4/tsconfig.json b/types/reactstrap/v4/tsconfig.json index 73578a9178..574c767ff5 100644 --- a/types/reactstrap/v4/tsconfig.json +++ b/types/reactstrap/v4/tsconfig.json @@ -15,7 +15,9 @@ "../../" ], "paths": { - "reactstrap": ["reactstrap/v4"] + "reactstrap": [ + "reactstrap/v4" + ] }, "types": [], "noEmit": true, diff --git a/types/read-package-tree/read-package-tree-tests.ts b/types/read-package-tree/read-package-tree-tests.ts index 0d3595a568..1dad1c1ab0 100644 --- a/types/read-package-tree/read-package-tree-tests.ts +++ b/types/read-package-tree/read-package-tree-tests.ts @@ -1,4 +1,4 @@ -import * as readPackageTree from "read-package-tree"; +import readPackageTree = require("read-package-tree"); readPackageTree("../", (error, data) => { // done diff --git a/types/read-pkg/tsconfig.json b/types/read-pkg/tsconfig.json index 95c3962946..47ef4e3ddc 100644 --- a/types/read-pkg/tsconfig.json +++ b/types/read-pkg/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "read-pkg-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/readdir-enhanced/tsconfig.json b/types/readdir-enhanced/tsconfig.json index a15bc6fd77..493568f9b0 100644 --- a/types/readdir-enhanced/tsconfig.json +++ b/types/readdir-enhanced/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "readdir-enhanced-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/readline-transform/index.d.ts b/types/readline-transform/index.d.ts new file mode 100644 index 0000000000..ec1ce8b56c --- /dev/null +++ b/types/readline-transform/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for readline-transform 0.9 +// Project: https://github.com/tilfin/readline-transform +// Definitions by: Piotr Roszatycki +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Transform, TransformOptions } from 'stream'; + +export interface ReadlineTransformOptions extends TransformOptions { + /** line break matcher for str.split() (default: /\r?\n/) */ + breakMatcher?: RegExp; + /** if content ends with line break, ignore last empty line (default: true) */ + ignoreEndOfBreak?: boolean; + /** if line is empty string, skip it (default: false) */ + skipEmpty?: boolean; +} + +export default class ReadlineTransform extends Transform { + constructor(options?: ReadlineTransformOptions); +} diff --git a/types/readline-transform/readline-transform-tests.ts b/types/readline-transform/readline-transform-tests.ts new file mode 100644 index 0000000000..9c343bd352 --- /dev/null +++ b/types/readline-transform/readline-transform-tests.ts @@ -0,0 +1,12 @@ +import { PassThrough } from 'stream'; +import ReadlineTransform from 'readline-transform'; + +const readStream = new PassThrough(); +const transform = new ReadlineTransform({ + breakMatcher: /\n/, + ignoreEndOfBreak: false, + skipEmpty: true +}); +const writeStream = new PassThrough({ objectMode: true }); + +readStream.pipe(transform).pipe(writeStream); diff --git a/types/readline-transform/tsconfig.json b/types/readline-transform/tsconfig.json new file mode 100644 index 0000000000..4bf70a9d30 --- /dev/null +++ b/types/readline-transform/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "readline-transform-tests.ts" + ] +} \ No newline at end of file diff --git a/types/readline-transform/tslint.json b/types/readline-transform/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/readline-transform/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/reapop/index.d.ts b/types/reapop/index.d.ts index 2a11cb6cc6..a0f446fa91 100644 --- a/types/reapop/index.d.ts +++ b/types/reapop/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/LouisBarranqueiro/reapop#readme // Definitions by: Barrokgl // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { Dispatch } from 'redux'; diff --git a/types/rebass/index.d.ts b/types/rebass/index.d.ts index fab1650108..9a4dbb34e5 100644 --- a/types/rebass/index.d.ts +++ b/types/rebass/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/jxnblk/rebass // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index c6207cd48e..207471eba3 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -6,7 +6,7 @@ // Zheyang Song // Rich Baird // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { CurveFactory } from 'd3-shape'; diff --git a/types/recompose/index.d.ts b/types/recompose/index.d.ts index a9d807360b..b6a9f21b14 100644 --- a/types/recompose/index.d.ts +++ b/types/recompose/index.d.ts @@ -4,7 +4,7 @@ // Samuel DeSota // Curtis Layne // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 /// diff --git a/types/recompose/tsconfig.json b/types/recompose/tsconfig.json index 4aae173e9b..4c56e4b125 100644 --- a/types/recompose/tsconfig.json +++ b/types/recompose/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "recompose-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/redis-errors/tsconfig.json b/types/redis-errors/tsconfig.json index cc922f5c1a..cef54ec9cc 100644 --- a/types/redis-errors/tsconfig.json +++ b/types/redis-errors/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "redis-errors-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/redis-rate-limiter/redis-rate-limiter-tests.ts b/types/redis-rate-limiter/redis-rate-limiter-tests.ts index 0ce00945ca..a121d28477 100644 --- a/types/redis-rate-limiter/redis-rate-limiter-tests.ts +++ b/types/redis-rate-limiter/redis-rate-limiter-tests.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; +import express = require('express'); import * as redis from 'redis'; -import * as rateLimiter from 'redis-rate-limiter'; +import rateLimiter = require('redis-rate-limiter'); var num: number; var str: string; diff --git a/types/redis-scripto/redis-scripto-tests.ts b/types/redis-scripto/redis-scripto-tests.ts index 39e51ddd63..ba59ee1935 100644 --- a/types/redis-scripto/redis-scripto-tests.ts +++ b/types/redis-scripto/redis-scripto-tests.ts @@ -1,5 +1,5 @@ import * as redis from 'redis'; -import * as Scripto from 'redis-scripto'; +import Scripto = require('redis-scripto'); var num: number; var str: string; diff --git a/types/redis/tsconfig.json b/types/redis/tsconfig.json index b99c599145..0dd504314b 100644 --- a/types/redis/tsconfig.json +++ b/types/redis/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "redis-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/redlock/v2/redlock-tests.ts b/types/redlock/v2/redlock-tests.ts index 3067ebda5e..c37f3f2980 100644 --- a/types/redlock/v2/redlock-tests.ts +++ b/types/redlock/v2/redlock-tests.ts @@ -1,4 +1,4 @@ -import * as Redlock from 'redlock'; +import Redlock = require('redlock'); import { Lock } from 'redlock'; import { RedisClient } from 'redis'; import { using } from 'bluebird'; diff --git a/types/redom/tsconfig.json b/types/redom/tsconfig.json index 65b279f902..16556c03b9 100644 --- a/types/redom/tsconfig.json +++ b/types/redom/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "redom-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/redux-actions/index.d.ts b/types/redux-actions/index.d.ts index 6051ab7afe..7247ed11d9 100644 --- a/types/redux-actions/index.d.ts +++ b/types/redux-actions/index.d.ts @@ -163,7 +163,7 @@ export interface ActionMap { } export function createActions( - actionMap: ActionMap, + actionMapOrIdentityAction: ActionMap | string, ...identityActions: string[] ): { [actionName: string]: ActionFunctionAny> diff --git a/types/redux-auth-wrapper/index.d.ts b/types/redux-auth-wrapper/index.d.ts index 8734efeb75..fc2543385a 100644 --- a/types/redux-auth-wrapper/index.d.ts +++ b/types/redux-auth-wrapper/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mjrussell/redux-auth-wrapper // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { ComponentClass, StatelessComponent, ComponentType, ReactType } from "react"; diff --git a/types/redux-auth-wrapper/v1/index.d.ts b/types/redux-auth-wrapper/v1/index.d.ts index 453a4e7e02..366ee7bfdb 100644 --- a/types/redux-auth-wrapper/v1/index.d.ts +++ b/types/redux-auth-wrapper/v1/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/mjrussell/redux-auth-wrapper // Definitions by: Karol Janyst // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, StatelessComponent, ReactType } from "react"; import { Action } from "redux"; diff --git a/types/redux-devtools-dock-monitor/index.d.ts b/types/redux-devtools-dock-monitor/index.d.ts index 66461cecf5..025b24625d 100644 --- a/types/redux-devtools-dock-monitor/index.d.ts +++ b/types/redux-devtools-dock-monitor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/redux-devtools-dock-monitor // Definitions by: Petryshyn Sergii // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/redux-devtools-log-monitor/index.d.ts b/types/redux-devtools-log-monitor/index.d.ts index b257adec0f..8bbaad7e1f 100644 --- a/types/redux-devtools-log-monitor/index.d.ts +++ b/types/redux-devtools-log-monitor/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/redux-devtools-log-monitor // Definitions by: Petryshyn Sergii // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react' import { ColorScheme } from 'base16' diff --git a/types/redux-devtools/index.d.ts b/types/redux-devtools/index.d.ts index ceb8abc246..6bc8c3a4f2 100644 --- a/types/redux-devtools/index.d.ts +++ b/types/redux-devtools/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/gaearon/redux-devtools // Definitions by: Petryshyn Sergii // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import { GenericStoreEnhancer } from 'redux'; diff --git a/types/redux-first-router-link/index.d.ts b/types/redux-first-router-link/index.d.ts index 1136751129..c99f5b6ac1 100644 --- a/types/redux-first-router-link/index.d.ts +++ b/types/redux-first-router-link/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/faceyspacey/redux-first-router-link#readme // Definitions by: janb87 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from "react"; import { Location } from 'redux-first-router'; diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 72352731fc..25d342c8c2 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -7,7 +7,7 @@ // Alex Young // Anton Novik // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { ComponentClass, diff --git a/types/redux-form/tsconfig.json b/types/redux-form/tsconfig.json index f106f20d16..ea57d2a38a 100644 --- a/types/redux-form/tsconfig.json +++ b/types/redux-form/tsconfig.json @@ -37,4 +37,4 @@ "lib/selectors.d.ts", "lib/SubmissionError.d.ts" ] -} +} \ No newline at end of file diff --git a/types/redux-form/v4/index.d.ts b/types/redux-form/v4/index.d.ts index 35444b198d..3ecd2d87cc 100644 --- a/types/redux-form/v4/index.d.ts +++ b/types/redux-form/v4/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/erikras/redux-form // Definitions by: Daniel Lytkin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { Dispatch, ActionCreator, Reducer } from 'redux'; diff --git a/types/redux-form/v6/index.d.ts b/types/redux-form/v6/index.d.ts index 4e8e57b3b3..ce34a772ed 100644 --- a/types/redux-form/v6/index.d.ts +++ b/types/redux-form/v6/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/erikras/redux-form // Definitions by: Carson Full , Daniel Lytkin , Karol Janyst , Luka Zakrajsek // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import { ComponentClass, diff --git a/types/redux-form/v6/tsconfig.json b/types/redux-form/v6/tsconfig.json index f6f22a352c..c4c9025157 100644 --- a/types/redux-form/v6/tsconfig.json +++ b/types/redux-form/v6/tsconfig.json @@ -31,4 +31,4 @@ "index.d.ts", "redux-form-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/redux-infinite-scroll/index.d.ts b/types/redux-infinite-scroll/index.d.ts index 64799ee71a..30fa435e2d 100644 --- a/types/redux-infinite-scroll/index.d.ts +++ b/types/redux-infinite-scroll/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/RealScout/redux-infinite-scroll // Definitions by: Tony Nikolov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import { Component, HTMLProps } from "react"; diff --git a/types/redux-injectable-store/tsconfig.json b/types/redux-injectable-store/tsconfig.json index 1fcc143ead..9a421d910e 100644 --- a/types/redux-injectable-store/tsconfig.json +++ b/types/redux-injectable-store/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "redux-injectable-store-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/redux-little-router/index.d.ts b/types/redux-little-router/index.d.ts index b7305e34f9..10aa3536f1 100644 --- a/types/redux-little-router/index.d.ts +++ b/types/redux-little-router/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/FormidableLabs/redux-little-router // Definitions by: priecint // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from "react"; import { Reducer, Middleware, StoreEnhancer } from "redux"; diff --git a/types/redux-little-router/tsconfig.json b/types/redux-little-router/tsconfig.json index 44577fc7a0..30884e8741 100644 --- a/types/redux-little-router/tsconfig.json +++ b/types/redux-little-router/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "redux-little-router-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/redux-localstorage-debounce/redux-localstorage-debounce-tests.ts b/types/redux-localstorage-debounce/redux-localstorage-debounce-tests.ts index 24b5a32528..db408c018c 100644 --- a/types/redux-localstorage-debounce/redux-localstorage-debounce-tests.ts +++ b/types/redux-localstorage-debounce/redux-localstorage-debounce-tests.ts @@ -2,7 +2,7 @@ import { compose } from "redux"; import { default as persistState } from "redux-localstorage"; -import * as adapter from "redux-localstorage/lib/adapters/localStorage"; +import adapter = require("redux-localstorage/lib/adapters/localStorage"); import { default as debounce } from "redux-localstorage-debounce"; const storageWait = compose( diff --git a/types/redux-localstorage-filter/redux-localstorage-filter-tests.ts b/types/redux-localstorage-filter/redux-localstorage-filter-tests.ts index 5569b22345..f45ee7157e 100644 --- a/types/redux-localstorage-filter/redux-localstorage-filter-tests.ts +++ b/types/redux-localstorage-filter/redux-localstorage-filter-tests.ts @@ -2,7 +2,7 @@ import { compose } from "redux"; import { default as persistState } from "redux-localstorage"; -import * as adapter from "redux-localstorage/lib/adapters/localStorage"; +import adapter = require("redux-localstorage/lib/adapters/localStorage"); import { default as filter } from "redux-localstorage-filter"; const storageSingle = compose( diff --git a/types/redux-localstorage/redux-localstorage-tests.ts b/types/redux-localstorage/redux-localstorage-tests.ts index 17f453423a..bfa76f1ea3 100644 --- a/types/redux-localstorage/redux-localstorage-tests.ts +++ b/types/redux-localstorage/redux-localstorage-tests.ts @@ -5,9 +5,9 @@ import { transformState, actionTypes } from "redux-localstorage"; -import * as adapterAsyncStorage from "redux-localstorage/lib/adapters/AsyncStorage"; -import * as adapterLocalStorage from "redux-localstorage/lib/adapters/localStorage"; -import * as adapterSessionStorage from "redux-localstorage/lib/adapters/sessionStorage"; +import adapterAsyncStorage = require("redux-localstorage/lib/adapters/AsyncStorage"); +import adapterLocalStorage = require("redux-localstorage/lib/adapters/localStorage"); +import adapterSessionStorage = require("redux-localstorage/lib/adapters/sessionStorage"); const AsyncStorage: any = {}; diff --git a/types/redux-logger/tsconfig.json b/types/redux-logger/tsconfig.json index 1789641398..7441f646d7 100644 --- a/types/redux-logger/tsconfig.json +++ b/types/redux-logger/tsconfig.json @@ -1,16 +1,24 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": false, "strictNullChecks": false, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "redux-logger-tests.ts"] -} + "files": [ + "index.d.ts", + "redux-logger-tests.ts" + ] +} \ No newline at end of file diff --git a/types/redux-router/index.d.ts b/types/redux-router/index.d.ts index 17c8db889f..bb9764ed61 100644 --- a/types/redux-router/index.d.ts +++ b/types/redux-router/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/rackt/redux-router // Definitions by: Stepan Mikhaylyuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import * as ReactRouter from 'react-router'; diff --git a/types/redux-socket.io/redux-socket.io-tests.ts b/types/redux-socket.io/redux-socket.io-tests.ts index f67a86393a..6c5a64e5a5 100644 --- a/types/redux-socket.io/redux-socket.io-tests.ts +++ b/types/redux-socket.io/redux-socket.io-tests.ts @@ -1,4 +1,4 @@ -import * as ioclient from 'socket.io-client'; +import ioclient = require('socket.io-client'); import createSocketIoMiddleware from 'redux-socket.io'; import { Action } from 'redux'; diff --git a/types/redux-socket.io/tsconfig.json b/types/redux-socket.io/tsconfig.json index 8636bd654d..25afcc62af 100644 --- a/types/redux-socket.io/tsconfig.json +++ b/types/redux-socket.io/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "redux-socket.io-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/redux-storage-engine-localstorage/tsconfig.json b/types/redux-storage-engine-localstorage/tsconfig.json index 671323d17f..985659f008 100644 --- a/types/redux-storage-engine-localstorage/tsconfig.json +++ b/types/redux-storage-engine-localstorage/tsconfig.json @@ -1,23 +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", - "redux-storage-engine-localstorage-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redux-storage-engine-localstorage-tests.ts" + ] +} \ No newline at end of file diff --git a/types/redux-ui/index.d.ts b/types/redux-ui/index.d.ts index b745ee2186..52cfb24b1d 100644 --- a/types/redux-ui/index.d.ts +++ b/types/redux-ui/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/tonyhb/redux-ui // Definitions by: Andy Shu Xin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// import * as Redux from 'redux'; diff --git a/types/relateurl/relateurl-tests.ts b/types/relateurl/relateurl-tests.ts index 7285dca153..03a184ec38 100644 --- a/types/relateurl/relateurl-tests.ts +++ b/types/relateurl/relateurl-tests.ts @@ -1,5 +1,4 @@ - -import * as RelateUrl from 'relateurl'; +import RelateUrl = require('relateurl'); var from = "http://www.domain.com/asdf/"; var to = "http://www.domain.com/asdf/asdf"; diff --git a/types/relay-runtime/index.d.ts b/types/relay-runtime/index.d.ts index 74b24ca1b8..2348a4d06b 100644 --- a/types/relay-runtime/index.d.ts +++ b/types/relay-runtime/index.d.ts @@ -17,8 +17,6 @@ export type RelayConcreteNode = any; export type RelayMutationTransaction = any; export type RelayMutationRequest = any; export type RelayQueryRequest = any; -export type ConcreteFragment = any; -export type ConcreteBatch = any; export type ConcreteFragmentDefinition = object; export type ConcreteOperationDefinition = object; @@ -32,6 +30,23 @@ export type ConcreteOperationDefinition = object; */ export type RelayContainer = any; +// ~~~~~~~~~~~~~~~~~~~~~ +// Used in artifacts +// emitted by +// relay-compiler +// ~~~~~~~~~~~~~~~~~~~~~ + +// File: https://github.com/facebook/relay/blob/fe0e70f10bbcba1fff89911313ea69f24569464b/packages/relay-runtime/util/RelayConcreteNode.js +export type ConcreteFragment = any; +export type ConcreteRequest = any; +export type ConcreteBatchRequest = any; + +export type RequestNode = ConcreteRequest | ConcreteBatchRequest; + +// Using `enum` here to create a distinct type and `const` to ensure it doesn’t leave any generated code. +// tslint:disable-next-line:no-const-enum +export const enum FragmentReference {} + // ~~~~~~~~~~~~~~~~~~~~~ // RelayQL // ~~~~~~~~~~~~~~~~~~~~~ @@ -44,9 +59,9 @@ export interface GeneratedNodeMap { [key: string]: GraphQLTaggedNode; } export type GraphQLTaggedNode = - | (() => ConcreteFragment | ConcreteBatch) + | (() => ConcreteFragment | RequestNode) | { - modern(): ConcreteFragment | ConcreteBatch; + modern(): ConcreteFragment | RequestNode; classic(relayQL: RelayQL): ConcreteFragmentDefinition | ConcreteOperationDefinition; }; // ~~~~~~~~~~~~~~~~~~~~~ @@ -85,7 +100,7 @@ export interface PayloadError { * May return an Observable or Promise of a raw server response. */ export function FetchFunction( - operation: ConcreteBatch, + operation: RequestNode, variables: Variables, cacheConfig: CacheConfig, uploadables?: UploadableMap @@ -99,7 +114,7 @@ export function FetchFunction( * fourth parameter. */ export type SubscribeFunction = ( - operation: ConcreteBatch, + operation: RequestNode, variables: Variables, cacheConfig: CacheConfig, observer: LegacyObserver diff --git a/types/relay-runtime/relay-runtime-tests.tsx b/types/relay-runtime/relay-runtime-tests.tsx index b39a117e61..4cbbacf680 100644 --- a/types/relay-runtime/relay-runtime-tests.tsx +++ b/types/relay-runtime/relay-runtime-tests.tsx @@ -1,4 +1,12 @@ -import { Environment, Network, RecordSource, Store, ConnectionHandler, ViewerHandler, RecordSourceInspector } from "relay-runtime"; +import { + Environment, + Network, + RecordSource, + Store, + ConnectionHandler, + ViewerHandler, + RecordSourceInspector, +} from "relay-runtime"; const source = new RecordSource(); const store = new Store(source); diff --git a/types/relay-runtime/tsconfig.json b/types/relay-runtime/tsconfig.json index 8aed884320..799a0e3263 100644 --- a/types/relay-runtime/tsconfig.json +++ b/types/relay-runtime/tsconfig.json @@ -23,4 +23,4 @@ "index.d.ts", "relay-runtime-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/remarkable/index.d.ts b/types/remarkable/index.d.ts new file mode 100644 index 0000000000..31a5e7d44b --- /dev/null +++ b/types/remarkable/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for remarkable 1.7 +// Project: https://github.com/jonschlinkert/remarkable +// Definitions by: makepost +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import Remarkable = require("./lib"); + +export = Remarkable; diff --git a/types/remarkable/lib/common/utils.d.ts b/types/remarkable/lib/common/utils.d.ts new file mode 100644 index 0000000000..0feaaac0ce --- /dev/null +++ b/types/remarkable/lib/common/utils.d.ts @@ -0,0 +1,15 @@ +export function isString(obj?: any): boolean; + +export function has(object: any, key: string): boolean; + +export function assign(target: any, ...sources: any[]): any; + +export function unescapeMd(str: string): string; + +export function isValidEntityCode(c: number): boolean; + +export function fromCodePoint(c: number): string; + +export function replaceEntities(str: string): string; + +export function escapeHtml(str: string): string; diff --git a/types/remarkable/lib/index.d.ts b/types/remarkable/lib/index.d.ts new file mode 100644 index 0000000000..ba29c7cf5c --- /dev/null +++ b/types/remarkable/lib/index.d.ts @@ -0,0 +1,347 @@ +import * as Utils from "./common/utils"; +import Renderer = require("./renderer"); +import Ruler = require("./ruler"); + +export = Remarkable; + +declare class Remarkable { + /** + * Useful helper functions for custom rendering. + */ + static utils: typeof Utils; + + inline: { ruler: Ruler }; + + block: { ruler: Ruler }; + + core: { ruler: Ruler }; + + renderer: Renderer; + + /** + * Markdown parser, done right. + */ + constructor(options?: Remarkable.Options); + + /** + * Remarkable offers some "presets" as a convenience to quickly enable/disable + * active syntax rules and options for common use cases. + */ + constructor(preset: "commonmark" | "full" | "remarkable", options?: Remarkable.Options); + + /** + * `"# Remarkable rulezz!"` => `"

Remarkable rulezz!

"` + */ + render(markdown: string, env?: Remarkable.Env): string; + + /** + * Define options. + * + * Note: To achieve the best possible performance, don't modify a Remarkable instance + * on the fly. If you need multiple configurations, create multiple instances and + * initialize each with a configuration that is ideal for that instance. + */ + set(options: Remarkable.Options): void; + + /** + * Use a plugin. + */ + use(plugin: Remarkable.Plugin, options?: any): Remarkable; + + /** + * Batch loader for components rules states, and options. + */ + configure(presets: Remarkable.Presets): void; + + /** + * Parse the input `string` and return a tokens array. + * Modifies `env` with definitions data. + */ + parse(str: string, env: Remarkable.Env): Remarkable.Token[]; + + /** + * Parse the given content `string` as a single string. + */ + parseInline(str: string, env: Remarkable.Env): Remarkable.Token[]; + + /** + * Render a single content `string`, without wrapping it + * to paragraphs. + */ + renderInline(str: string, env?: Remarkable.Env): string; +} + +declare namespace Remarkable { + interface Env { + [key: string]: any; + } + + type GetBreak = (tokens: Token[], idx: number) => "" | "\n"; + + interface Options { + /** + * Enable HTML tags in source. + */ + html?: boolean; + + /** + * Use "/" to close single tags (
). + */ + xhtmlOut?: boolean; + + /** + * Convert "\n" in paragraphs into
. + */ + breaks?: boolean; + + /** + * CSS language prefix for fenced blocks. + */ + langPrefix?: string; + + /** + * Autoconvert URL-like text to links. + */ + linkify?: boolean; + + /** + * Enable some language-neutral replacement + quotes beautification. + */ + typographer?: boolean; + + /** + * Double + single quotes replacement pairs, when typographer enabled, + * and smartquotes on. Set doubles to "«»" for Russian, "„“" for German. + */ + quotes?: string; + + /** + * Highlighter function. Should return escaped HTML, or "" if the source + * string is not changed. + */ + highlight?(str: string, lang: string): string; + } + + type Plugin = (md: Remarkable, options?: any) => void; + + interface Presets { + components: { + [name: string]: { + rules: Rules, + }, + }; + + options: Options; + } + + type Rule = ( + /** + * The list of tokens currently being processed. + */ + tokens: Token[], + + /** + * The index of the token currently being processed. + */ + idx: number, + + /** + * The options given to remarkable. + */ + options: Options, + + /** + * The key-value store created by the parsing rules. + */ + env: Env, + ) => string; + + interface Rules { + [name: string]: Rule; + "blockquote_open": Rule; + "blockquote_close": Rule; + "code": Rule; + "fence": Rule; + "fence_custom": Rule; + "heading_open": Rule; + "heading_close": Rule; + "hr": Rule; + "bullet_list_open": Rule; + "bullet_list_close": Rule; + "list_item_open": Rule; + "list_item_close": Rule; + "ordered_list_open": Rule; + "ordered_list_close": Rule; + "paragraph_open": Rule; + "paragraph_close": Rule; + "link_open": Rule; + "link_close": Rule; + "image": Rule; + "table_open": Rule; + "table_close": Rule; + "thead_open": Rule; + "thead_close": Rule; + "tbody_open": Rule; + "tbody_close": Rule; + "tr_open": Rule; + "tr_close": Rule; + "th_open": Rule; + "th_close": Rule; + "td_open": Rule; + "td_close": Rule; + "strong_open": Rule; + "strong_close": Rule; + "em_open": Rule; + "em_close": Rule; + "del_open": Rule; + "del_close": Rule; + "ins_open": Rule; + "ins_close": Rule; + "mark_open": Rule; + "mark_close": Rule; + "sub": Rule; + "sup": Rule; + "hardbreak": Rule; + "softbreak": Rule; + "text": Rule; + "htmlblock": Rule; + "htmltag": Rule; + "abbr_open": Rule; + "abbr_close": Rule; + "footnote_ref": Rule; + "footnote_block_open": Rule; + "footnote_block_close": Rule; + "footnote_open": Rule; + "footnote_close": Rule; + "footnote_anchor": Rule; + "dl_open": Rule; + "dt_open": Rule; + "dd_open": Rule; + "dl_close": Rule; + "dt_close": Rule; + "dd_close": Rule; + + /** + * Check to see if `\n` is needed before the next token. + */ + getBreak: GetBreak; + } + + interface BaseToken { + /** + * The nesting level of the associated markdown structure in the source. + */ + level: number; + + /** + * Tokens generated by block parsing rules also include a `lines` + * property which is a 2 elements array marking the first and last line of the + * `src` used to generate the token. + */ + lines?: [number, number]; + } + + interface TagToken extends BaseToken { + /** + * Tag tokens have a variety of types and each is a name of a + * rendering rule. + */ + type: string; + } + + interface ContentToken extends BaseToken { + /** + * A text token has a `content` property containing the text it represents. + */ + content: string; + + /** + * The type of the token. + */ + type: "text"; + } + + interface BlockContentToken extends BaseToken { + /** + * The content of the block. This might include inline mardown syntax + * which may need further processing by the inline rules. + */ + content: string; + + /** + * This is initialized with an empty array (`[]`) and will be filled + * with the inline parser tokens as the inline parsing rules are applied. + */ + children: Token[]; + + /** + * The type of the token. + */ + type: "inline"; + } + + interface MiscTokenProps { + /** + * Image alt. + */ + alt?: string; + + /** + * Code: `true` if block, `false` if inline. + */ + block?: boolean; + + /** + * Footnote label. + */ + label?: any; + + /** + * Heading level. + */ + hLevel?: number; + + /** + * Link url. + */ + href?: string; + + /** + * Footnote id. + */ + id?: number; + + /** + * Ordered list marker value. + */ + order?: number; + + /** + * Fenced block params. + */ + params?: any[]; + + /** + * Image url. + */ + src?: string; + + /** + * Footnote sub id. + */ + subId?: number; + + /** + * Absence of empty line before current tag: `true` if absent, `false` + * if present. List is tight if any list item is tight. + */ + tight?: boolean; + + /** + * Abbreviation title. + */ + title?: string; + } + + type Token = (TagToken | ContentToken | BlockContentToken) & MiscTokenProps; +} diff --git a/types/remarkable/lib/renderer.d.ts b/types/remarkable/lib/renderer.d.ts new file mode 100644 index 0000000000..f90e4187cf --- /dev/null +++ b/types/remarkable/lib/renderer.d.ts @@ -0,0 +1,28 @@ +import Remarkable = require("."); + +export = Renderer; + +/** + * Renderer class. Renders HTML and exposes `rules` to allow + * local modifications. + */ +declare class Renderer { + rules: Remarkable.Rules; + + /** + * Exported helper, for custom rules only. + */ + getBreak: Remarkable.GetBreak; + + /** + * Render a string of inline HTML with the given `tokens` and + * `options`. + */ + renderInline(tokens: Remarkable.Token[], options: Remarkable.Options, env: Remarkable.Env): string; + + /** + * Render a string of HTML with the given `tokens` and + * `options`. + */ + render(tokens: Remarkable.Token[], options: Remarkable.Options, env: Remarkable.Env): string; +} diff --git a/types/remarkable/lib/ruler.d.ts b/types/remarkable/lib/ruler.d.ts new file mode 100644 index 0000000000..20c781f9b0 --- /dev/null +++ b/types/remarkable/lib/ruler.d.ts @@ -0,0 +1,52 @@ +import Remarkable = require("."); + +export = Ruler; + +/** + * Ruler is a helper class for building responsibility chains from + * parse rules. It allows: + * + * - easy stack rules chains + * - getting main chain and named chains content (as arrays of functions) + */ +declare class Ruler { + /** + * Replace the rule `ruleName` with a new rule. + */ + at(ruleName: string, fn: Remarkable.Rule, options: Remarkable.Options): void; + + /** + * Add a rule to the chain before given the `ruleName`. + */ + before(beforeName: string, ruleName: string, fn: Remarkable.Rule, options: Remarkable.Options): void; + + /** + * Add a rule to the chain after the given `ruleName`. + */ + after(afterName: string, ruleName: string, fn: Remarkable.Rule, options: Remarkable.Options): void; + + /** + * Add a rule to the end of chain. + */ + push(ruleName: string, fn: Remarkable.Rule, options: Remarkable.Options): void; + + /** + * Enable a rule or list of rules. + * + * @param list Name or array of rule names to enable. + * @param strict If `true`, all non listed rules will be disabled. + */ + enable(list: string | string[], strict?: boolean): void; + + /** + * Disable a rule or list of rules. + * + * @param list Name or array of rule names to disable. + */ + disable(list: string | string[]): void; + + /** + * Get a rules list as an array of functions. + */ + getRules(chainName: string): Remarkable.Rule[]; +} diff --git a/types/remarkable/remarkable-tests.ts b/types/remarkable/remarkable-tests.ts new file mode 100644 index 0000000000..9c12632e69 --- /dev/null +++ b/types/remarkable/remarkable-tests.ts @@ -0,0 +1,355 @@ +// This code does not run, but it is type-checked. + +import hljs = require("highlight.js"); +import Remarkable = require("remarkable"); + +/** + * Examples from README. + */ +export class RemarkableTest { + usage() { + const md = new Remarkable(); + md.render("# Remarkable rulezz!"); + } + + defineOptionsInContructor() { + const md = new Remarkable({ + html: false, + xhtmlOut: false, + breaks: false, + langPrefix: "language-", + linkify: false, + typographer: false, + quotes: "“”‘’", + highlight(/*str, lang*/) { return ""; }, + }); + + md.render("# Remarkable rulezz!"); + } + + defineOptions() { + const md = new Remarkable(); + + md.set({ + html: true, + breaks: true, + }); + } + + enableStrict() { + const md = new Remarkable("commonmark"); + + md.render("# Remarkable rulezz!"); + } + + enableAllRules() { + let md = new Remarkable("full"); + + // Or with options: + md = new Remarkable("full", { + html: true, + linkify: true, + typographer: true, + }); + + md.render("# Remarkable rulezz!"); + } + + highlightFencedCodeBlocks() { + const md = new Remarkable({ + highlight(str, lang) { + if (lang && hljs.getLanguage(lang)) { + try { + return hljs.highlight(lang, str).value; + } catch (err) { } + } + + try { + return hljs.highlightAuto(str).value; + } catch (err) { } + + return ""; + }, + }); + + md.render("# Remarkable rulezz!"); + } + + manageRules() { + let md = new Remarkable(); + md.inline.ruler.enable(["ins", "mark"]); + md.block.ruler.disable(["table", "footnote"]); + + // Enable everything + md = new Remarkable("full", { + html: true, + linkify: true, + typographer: true, + }); + } + + enableRulesManually() { + const md = new Remarkable(); + md.core.ruler.enable([ + "abbr", + ]); + md.block.ruler.enable([ + "footnote", + "deflist", + ]); + md.inline.ruler.enable([ + "footnote_inline", + "ins", + "mark", + "sub", + "sup", + ]); + } + + typographer() { + const md = new Remarkable({ + typographer: true, + quotes: "“”‘’", + }); + + // Disable rules at all: + md.core.ruler.disable(["replacements", "smartquotes"]); + } + + loadPlugins() { + const md = new Remarkable(); + const noop = () => { }; + const plugin1: Remarkable.Plugin = noop as (md: Remarkable) => void; + const plugin2: Remarkable.Plugin = noop as (md: Remarkable, options: {}) => void; + const plugin3: Remarkable.Plugin = noop as (md: Remarkable) => void; + const opts: any = undefined; + + md.use(plugin1) + .use(plugin2, opts) + .use(plugin3); + } + + touchParserAndRenderer() { + const md = new Remarkable(); + md.core; + md.core.ruler; + md.block; + md.block.ruler; + md.inline; + md.inline.ruler; + md.renderer; + md.renderer.rules; + } +} + +/** + * Various tokens copied from source. + */ +export class TokenTest { + blockRules() { + const tokens: Remarkable.Token[] = []; + const state = { + level: 0, + line: 0, + tokens, + }; + + const lines: [number, number] = [0, 0]; + const startLine = 0; + + state.tokens.push({ + type: "blockquote_open", + lines, + level: state.level++, + }); + + state.tokens.push({ + type: "blockquote_close", + level: --state.level, + }); + + state.tokens.push({ + type: "code", + content: "", + block: true, + lines, + level: state.level, + }); + + state.tokens.push({ + type: "inline", + content: "", + level: state.level + 1, + lines, + children: [], + }); + + state.tokens.push({ + type: "fence", + params: [], + content: "", + lines: [startLine, state.line], + level: state.level, + }); + + state.tokens.push({ + type: "footnote_reference_open", + label: "", + level: state.level++, + }); + + state.tokens.push({ type: "heading_close", hLevel: 1, level: state.level }); + + state.tokens.push({ + type: "ordered_list_open", + order: 0, + lines: [startLine, 0], + level: state.level++, + }); + + state.tokens.push({ + type: "paragraph_open", + tight: false, + lines: [startLine, state.line], + level: state.level, + }); + } + + coreRules() { + const env: Remarkable.Env = {}; + const nodes: Remarkable.Token[] = []; + const tokens = nodes; + const state = { env, src: "", tokens }; + const m = ["", "", ""]; + let level = 0; + + nodes.push({ + type: "text", + content: "", + level, + }); + + nodes.push({ + type: "abbr_open", + title: state.env["abbreviations"][":" + m[2]], + level: level++, + }); + + nodes.push({ + type: "text", + content: m[2], + level, + }); + + nodes.push({ + type: "abbr_close", + level: --level, + }); + + state.tokens.push({ + type: "inline", + content: state.src.replace(/\n/g, " ").trim(), + level: 0, + lines: [0, 1], + children: [], + }); + + tokens.push({ + type: "inline", + content: "", + level, + children: [], + }); + } + + inlineRules() { + const state: Remarkable.Token[] = []; + let level = 0; + + state.push({ + type: "link_open", + href: "", + level, + }); + + state.push({ + type: "code", + content: "", + block: false, + level, + }); + + state.push({ + type: "footnote_ref", + id: 1, + level, + }); + + state.push({ + type: "footnote_ref", + id: 1, + subId: 1, + level, + }); + + state.push({ + type: "image", + src: "", + title: "", + alt: "", + level, + }); + + state.push({ + type: "link_open", + href: "", + title: "", + level: level++, + }); + } +} + +/** + * Helper function usage. + */ +export class UtilsTest { + isString() { + Remarkable.utils.isString("foo"); + Remarkable.utils.isString(1); + Remarkable.utils.isString({}); + Remarkable.utils.isString(); + } + + has() { + Remarkable.utils.has({ foo: "bar" }, "foo"); + Remarkable.utils.has({}, "foo"); + } + + assign() { + Remarkable.utils.assign({}, { foo: "bar" }, { baz: "qux" }); + } + + unescapeMd() { + Remarkable.utils.unescapeMd("\\"); + } + + isValidEntityCode() { + Remarkable.utils.isValidEntityCode(0xD800); + Remarkable.utils.isValidEntityCode(0xD7FF); + Remarkable.utils.isValidEntityCode(1000); + } + + fromCodePoint() { + Remarkable.utils.fromCodePoint(0xffff + 1); + Remarkable.utils.fromCodePoint(0xffff); + } + + replaceEntities() { + Remarkable.utils.replaceEntities(""); + Remarkable.utils.replaceEntities(" "); + } + + escapeHtml() { + Remarkable.utils.replaceEntities(''); + } +} diff --git a/types/remarkable/tsconfig.json b/types/remarkable/tsconfig.json new file mode 100644 index 0000000000..33af23cbf9 --- /dev/null +++ b/types/remarkable/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "lib/common/utils.d.ts", + "lib/index.d.ts", + "lib/renderer.d.ts", + "lib/ruler.d.ts", + "index.d.ts", + "remarkable-tests.ts" + ] +} \ No newline at end of file diff --git a/types/remarkable/tslint.json b/types/remarkable/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/remarkable/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/request-promise-native/request-promise-native-tests.ts b/types/request-promise-native/request-promise-native-tests.ts index 9a0cfa40fa..e65f802e05 100644 --- a/types/request-promise-native/request-promise-native-tests.ts +++ b/types/request-promise-native/request-promise-native-tests.ts @@ -1,4 +1,4 @@ -import * as rpn from 'request-promise-native'; +import rpn = require('request-promise-native'); import * as errors from 'request-promise-native/errors'; import * as path from 'path'; diff --git a/types/request/tsconfig.json b/types/request/tsconfig.json index adf81123e6..4f51c5bc65 100644 --- a/types/request/tsconfig.json +++ b/types/request/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "request-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/require-dir/tsconfig.json b/types/require-dir/tsconfig.json index b853b18ff5..685e728b99 100644 --- a/types/require-dir/tsconfig.json +++ b/types/require-dir/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "require-dir-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/require-directory/require-directory-tests.ts b/types/require-directory/require-directory-tests.ts index 2852addd91..c8b8043210 100644 --- a/types/require-directory/require-directory-tests.ts +++ b/types/require-directory/require-directory-tests.ts @@ -1,4 +1,4 @@ -import * as requireDirectory from "require-directory"; +import requireDirectory = require("require-directory"); import { defaults } from "require-directory"; import { CheckPathFn, RequireDirectoryOptions, RequireDirectoryResult } from "require-directory"; diff --git a/types/require-relative/tsconfig.json b/types/require-relative/tsconfig.json index 6888973fd6..9e74b82aa0 100644 --- a/types/require-relative/tsconfig.json +++ b/types/require-relative/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "require-relative-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/reservoir/index.d.ts b/types/reservoir/index.d.ts new file mode 100644 index 0000000000..b08e8aebfa --- /dev/null +++ b/types/reservoir/index.d.ts @@ -0,0 +1,35 @@ +// Type definitions for reservoir 0.1 +// Project: https://github.com/imbcmdth/reservoir +// Definitions by: Dan Vanderkam +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace Reservoir; +export = Reservoir; + +/** + * Create a new reservoir sampler. + * + * @param reservoirSize is the maximum size of the reservoir. This is the number of elements + * to be randomly chosen from the input provided to it using pushSome. Default is 1. + * @param randomNumberGenerator is an optional random number generating function to use in + * place of the default Math.random. + */ +declare function Reservoir( + reservoirSize?: number, + randomNumberGenerator?: () => number +): Reservoir.ReservoirArray; // tslint:disable-line:no-unnecessary-generics + +/*~ If you want to expose types from your module as well, you can + *~ place them in this block. Often you will want to describe the + *~ shape of the return type of the function; that type should + *~ be declared in here, as this example shows. + */ +declare namespace Reservoir { + interface ReservoirArray extends Array { + /** + * datum: one or more elements to consider for inclusion into the reservoir. + * Returns the current length of the reservoir. + */ + pushSome(...datum: T[]): number; + } +} diff --git a/types/reservoir/reservoir-tests.ts b/types/reservoir/reservoir-tests.ts new file mode 100644 index 0000000000..f7775bd1bb --- /dev/null +++ b/types/reservoir/reservoir-tests.ts @@ -0,0 +1,13 @@ +import Reservoir = require('reservoir'); + +// $ExpectType ReservoirArray +const x = Reservoir(1); + +// $ExpectType number +x.pushSome(10, 20, 30, 40); + +// $ExpectType number +x[0]; + +// $ExpectType number +x.length; diff --git a/types/reservoir/tsconfig.json b/types/reservoir/tsconfig.json new file mode 100644 index 0000000000..92409b4c16 --- /dev/null +++ b/types/reservoir/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "reservoir-tests.ts" + ] +} \ No newline at end of file diff --git a/types/reservoir/tslint.json b/types/reservoir/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/reservoir/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/resolve-from/resolve-from-tests.ts b/types/resolve-from/resolve-from-tests.ts index d4de48146a..ddbc5bdbea 100644 --- a/types/resolve-from/resolve-from-tests.ts +++ b/types/resolve-from/resolve-from-tests.ts @@ -1,11 +1,7 @@ import resolveFrom = require("resolve-from"); -import resolveFrom1 = require('resolve-from'); -import * as resolveFrom2 from 'resolve-from'; - let from: string; let moduleId: string; let result: string; -result = resolveFrom1(from, moduleId); -result = resolveFrom2(from, moduleId); +result = resolveFrom(from, moduleId); diff --git a/types/resolve/resolve-tests.ts b/types/resolve/resolve-tests.ts index 28dae63c82..1ebaa5bfb4 100644 --- a/types/resolve/resolve-tests.ts +++ b/types/resolve/resolve-tests.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import * as resolve from 'resolve'; +import resolve = require('resolve'); function test_basic_async() { resolve('typescript', function(error, resolved, pkg) { diff --git a/types/resourcejs/tsconfig.json b/types/resourcejs/tsconfig.json index ca71c00a1a..73568df473 100644 --- a/types/resourcejs/tsconfig.json +++ b/types/resourcejs/tsconfig.json @@ -16,8 +16,8 @@ "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", + "files": [ + "index.d.ts", "resourcejs-tests.ts" - ] -} + ] +} \ No newline at end of file diff --git a/types/restify-cookies/tsconfig.json b/types/restify-cookies/tsconfig.json index b86ecbf07e..387ea2e99b 100644 --- a/types/restify-cookies/tsconfig.json +++ b/types/restify-cookies/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "restify-cookies-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/retry-as-promised/index.d.ts b/types/retry-as-promised/index.d.ts new file mode 100644 index 0000000000..429e0bb6d1 --- /dev/null +++ b/types/retry-as-promised/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for retry-as-promised 2.3 +// Project: https://github.com/mickhansen/retry-as-promised +// Definitions by: Florian Oellerich +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import Promise = require('bluebird'); + +declare namespace retryAsPromised { + type MatchOption = string | RegExp | Error; + interface Options { + $current?: number; + max?: number; + timeout?: number; + match?: MatchOption[] | MatchOption; + backoffBase?: number; + backoffExponent?: number; + report?: (message: string, obj: Options, err?: any) => void; + name?: string; + } + + type RetryCallback = ({ current }: { current: Options['$current'] }) => Promise.Thenable; + type RetryAsPromisedStatic = (callback: RetryCallback, options: Options | number) => Promise; +} + +declare const retryAsPromised: retryAsPromised.RetryAsPromisedStatic; +export = retryAsPromised; diff --git a/types/retry-as-promised/retry-as-promised-tests.ts b/types/retry-as-promised/retry-as-promised-tests.ts new file mode 100644 index 0000000000..43a08b7b9f --- /dev/null +++ b/types/retry-as-promised/retry-as-promised-tests.ts @@ -0,0 +1,27 @@ +import retry = require('retry-as-promised'); + +interface Product { + name: string; +} + +const log = (...args: any[]): void => {}; + +retry(() => Promise.resolve(), {}); +retry(() => Promise.reject('Error matching values'), {}); +retry(() => Promise.reject(new Error('No matching values')), {}); +retry(() => Promise.resolve(), { + max: 100, + timeout: 60000, + match: ['Error matching values', new Error('No matching values'), new RegExp(/Deadlock/, 'i')], + backoffBase: 100, + backoffExponent: 1.1, + name: 'Source', + report: (message, options) => { + if (options.name === 'Source') { + log(options.name); + log('iteration', options.$current); + } + } +}); +retry(() => Promise.resolve({ name: 'test' }) , {}); +retry(() => Promise.reject(new Error('No matching product')), {}); diff --git a/types/retry-as-promised/tsconfig.json b/types/retry-as-promised/tsconfig.json new file mode 100644 index 0000000000..2c136c68e2 --- /dev/null +++ b/types/retry-as-promised/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "retry-as-promised-tests.ts" + ] +} diff --git a/types/retry-as-promised/tslint.json b/types/retry-as-promised/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/retry-as-promised/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/rgrove__parse-xml/index.d.ts b/types/rgrove__parse-xml/index.d.ts new file mode 100644 index 0000000000..f8e9944047 --- /dev/null +++ b/types/rgrove__parse-xml/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for @rgrove/parse-xml 1.1 +// Project: https://github.com/rgrove/parse-xml +// Definitions by: Pete Johanson +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +declare function parseXml(name: string, options?: parseXml.ParseOptions): parseXml.Document; + +declare namespace parseXml { + interface NodeBase { + parent?: NodeBase; + type: string; + } + + interface Document extends NodeBase { + type: "document"; + children: NodeBase[]; + } + + interface CData extends NodeBase { + type: "cdata"; + text: string; + } + + interface Comment extends NodeBase { + type: "comment"; + content: string; + } + + interface Text extends NodeBase { + type: "text"; + text: string; + } + + interface Element extends NodeBase { + type: "element"; + attributes: { [key: string]: string }; + children: NodeBase[]; + name: string; + preserveWhitespace?: string; + } + + type Node = CData | Comment | Element | Text; + + interface ParseOptions { + ignoreUndefinedEntities?: boolean; + preserveCdata?: boolean; + preserveComments?: boolean; + resolveUndefinedEntity?: (ref: string) => string; + } +} + +export = parseXml; diff --git a/types/rgrove__parse-xml/rgrove__parse-xml-tests.ts b/types/rgrove__parse-xml/rgrove__parse-xml-tests.ts new file mode 100644 index 0000000000..797465da3c --- /dev/null +++ b/types/rgrove__parse-xml/rgrove__parse-xml-tests.ts @@ -0,0 +1,8 @@ +/// +import assert = require('assert'); +import parseXml = require('@rgrove/parse-xml'); + +const doc = parseXml(''); +doc.type === "document"; +assert.equal(doc.children[0].type, "element"); +assert.equal((doc.children[0] as parseXml.Element).name, "party"); diff --git a/types/rgrove__parse-xml/tsconfig.json b/types/rgrove__parse-xml/tsconfig.json new file mode 100644 index 0000000000..b939e6d003 --- /dev/null +++ b/types/rgrove__parse-xml/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "paths": { + "@rgrove/parse-xml": ["rgrove__parse-xml"] + }, + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "rgrove__parse-xml-tests.ts" + ] +} diff --git a/types/rgrove__parse-xml/tslint.json b/types/rgrove__parse-xml/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/rgrove__parse-xml/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/rheostat/index.d.ts b/types/rheostat/index.d.ts index 2943ecccc5..be173bf31a 100644 --- a/types/rheostat/index.d.ts +++ b/types/rheostat/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/airbnb/rheostat // Definitions by: Sasha Bayan , Wil Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/rollup-plugin-json/tsconfig.json b/types/rollup-plugin-json/tsconfig.json index 92ef3a1a1f..3900abdb18 100644 --- a/types/rollup-plugin-json/tsconfig.json +++ b/types/rollup-plugin-json/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "rollup-plugin-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/roslib/index.d.ts b/types/roslib/index.d.ts index fb5e886c66..6e479d0ff2 100644 --- a/types/roslib/index.d.ts +++ b/types/roslib/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for roslib.js 0.18.2 // Project: http://wiki.ros.org/roslibjs -// Definitions by: Stefan Profanter , Cooper Benson +// Definitions by: Stefan Profanter , +// Cooper Benson , +// David Gonzalez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -370,6 +372,201 @@ declare namespace ROSLIB { publish(message:Message):void; } + export class TFClient { + /** + * A TF Client that listens to TFs from tf2_web_republisher. + * + * @constructor + * @param options - object with following keys: + * * ros - the ROSLIB.Ros connection handle + * * fixedFrame - the fixed frame, like /base_link + * * angularThres - the angular threshold for the TF republisher + * * transThres - the translation threshold for the TF republisher + * * rate - the rate for the TF republisher + * * updateDelay - the time (in ms) to wait after a new subscription to update the TF republisher's list of TFs + * * topicTimeout - the timeout parameter for the TF republisher + * * serverName (optional) - the name of the tf2_web_republisher server + * * repubServiceName (optional) - the name of the republish_tfs service (non groovy compatibility mode only) default: '/republish_tfs' + */ + constructor(options: { + ros: Ros, + fixedFrame?: string; + angularThres?: number, + transThres?: number, + rate?: number, + updateDelay?: number, + topicTimeout?: number, + serverName?: string, + repubServiceName?: string + }); + + /** + * Unsubscribe and unadvertise all topics associated with this TFClient. + */ + dispose(): void; + + /** + * Process the service response and subscribe to the tf republisher topic. + * + * @param response - the service response containing the topic name + */ + processResponse(response: any): void; + + /** + * Process the incoming TF message and send them out using the callback functions + * @param tf - the TF message from the server + */ + processTfArray(tf: any): void; + + /** + * Subscribe to the given TF frame. + * @param frameId - the TF frame to subscribe to + * @param callback - function with params: + * * transform - the transform data + */ + subscribe(frameId: string, callback:(transform:Transform) => void): void; + + /** + * Unsubscribe from the given TF frame. + * + * @param frameId - the TF frame to unsubscribe from + * @param callback - the callback function to remove + */ + unsubscribe(frameId: string, callback?:(transform:Transform) => void): void; + + /** + * Create and send a new goal (or service request) to the tf2_web_republisher based on the current list of TFs. + */ + updateGoal(): void; + } + + export class Transform { + /** + * A Transform in 3-space. Values are copied into this object. + * + * @constructor + * @param options - object with following keys: + * * translation - the Vector3 describing the translation + * * rotation - the ROSLIB.Quaternion describing the rotation + */ + constructor(options: { + translation: Vector3, + rotation: Quaternion + }); + + // getters + public translation: Vector3; + public rotation: Quaternion; + /** + * Clone a copy of this transform. + * + */ + clone(): Transform; + } + + export class Vector3 { + /** + * A 3D vector. + * + * @constructor + * @param options - object with following keys: + * * x - the x value + * * y - the y value + * * z - the z value + */ + constructor(options: { + x: number, + y: number, + z: number + }); + + // getters + public x: number; + public y: number; + public z: number; + + /** + * Set the values of this vector to the sum of itself and the given vector. + * + * @param v - the vector to add with + */ + add(v: Vector3): void; + + /** + * Clone a copy of this vector. + */ + clone(): Vector3; + + /** + * Multiply the given Quaternion with this vector. + * @param q - the quaternion to multiply with + */ + multiplyQuaternion(q: Quaternion): void; + + /** + * Set the values of this vector to the difference of itself and the given vector. + * + * @param v - the vector to subtract with + */ + subtract(v: Vector3): void; + } + + export class Quaternion { + /** + * A Quaternion. + * + * @constructor + * @param options - object with following keys: + * * x - the x value + * * y - the y value + * * z - the z value + * * w - the w value + */ + constructor(options?: { + x: number, + y: number, + z: number, + w: number + }); + + // getters + public x: number; + public y: number; + public z: number; + public w: number; + + /** + * Clone a copy of this quaternion. + */ + clone(): Quaternion; + + /** + * Perform a conjugation on this quaternion. + */ + conjugate(): void; + + /** + * Convert this quaternion into its inverse. + */ + invert(): void; + + /** + * Set the values of this quaternion to the product of itself and the given quaternion. + * @param q - the quaternion to multiply with + */ + multiply(q: Quaternion): void; + + /** + * Return the norm of this quaternion. + */ + norm(): number; + + /** + * Perform a normalization on this quaternion. + */ + normalize(): void; + } + class ActionClient { /** * An actionlib action client. @@ -419,12 +616,12 @@ declare namespace ROSLIB { /** * Connect callback functions to goal based events - * + * * @param eventName Name of event ('timeout', 'status', 'feedback', 'result') * @param callback Callback function executed on connected event */ on(eventName:string, callback:(event:any) => void):void; - + /** * Send the goal to the action server. * diff --git a/types/roslib/roslib-tests.ts b/types/roslib/roslib-tests.ts index 36b505ea12..d86ce250eb 100644 --- a/types/roslib/roslib-tests.ts +++ b/types/roslib/roslib-tests.ts @@ -107,3 +107,17 @@ maxVelX.set(0.8); maxVelX.get(function (value) { console.log('MAX VAL: ' + value); }); + +// Creating a TF Client +// -------------------- +const tfClient = new ROSLIB.TFClient({ + ros: ros, + fixedFrame: '/world' +}) +const tfclient_callback = function (transform: ROSLIB.Transform) { + console.log('Received transform: ' + transform); + tfClient.unsubscribe('/transform'); +} + +tfClient.subscribe('/transform', tfclient_callback); +tfClient.unsubscribe('/transform', tfclient_callback); diff --git a/types/route-parser/route-parser-tests.ts b/types/route-parser/route-parser-tests.ts index e521008291..66be438592 100644 --- a/types/route-parser/route-parser-tests.ts +++ b/types/route-parser/route-parser-tests.ts @@ -1,4 +1,4 @@ -import * as Route from 'route-parser'; +import Route = require('route-parser'); const route = new Route('/users/:id'); const matched = route.match('/users/42'); // => { id: '42' } diff --git a/types/rrc/index.d.ts b/types/rrc/index.d.ts index 24b20a6376..3bb04b4ec8 100644 --- a/types/rrc/index.d.ts +++ b/types/rrc/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/pshrmn/rrc#readme // Definitions by: Deividas Bakanas // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from "react"; import * as H from "history"; diff --git a/types/rss/rss-tests.ts b/types/rss/rss-tests.ts index e73f786a18..3dc5574c1c 100644 --- a/types/rss/rss-tests.ts +++ b/types/rss/rss-tests.ts @@ -1,5 +1,3 @@ - - // this test is copied from https://github.com/dylang/node-rss // it basically: // @@ -7,7 +5,7 @@ // * add an item to it // * then generates XML string -import * as RSS from 'rss'; +import RSS = require('rss'); var feed = new RSS({ title: 'title', diff --git a/types/rsvp/tsconfig.json b/types/rsvp/tsconfig.json index ebfd4bc00d..404ac62bf7 100755 --- a/types/rsvp/tsconfig.json +++ b/types/rsvp/tsconfig.json @@ -2,16 +2,24 @@ "compilerOptions": { "module": "commonjs", "target": "es5", - "lib": ["es6", "dom"], + "lib": [ + "es6", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": false, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "rsvp-tests.ts"] -} + "files": [ + "index.d.ts", + "rsvp-tests.ts" + ] +} \ No newline at end of file diff --git a/types/rsync/rsync-tests.ts b/types/rsync/rsync-tests.ts index cfc9956dc2..41ec4dd9b1 100644 --- a/types/rsync/rsync-tests.ts +++ b/types/rsync/rsync-tests.ts @@ -1,4 +1,4 @@ -import * as Rsync from 'rsync'; +import Rsync = require('rsync'); // -------------------------- // simple usage diff --git a/types/rwlock/rwlock-tests.ts b/types/rwlock/rwlock-tests.ts index 8e2f210164..ee869d0ec6 100644 --- a/types/rwlock/rwlock-tests.ts +++ b/types/rwlock/rwlock-tests.ts @@ -1,5 +1,5 @@ // Original test file https://github.com/71104/rwlock/blob/master/test/all.js -import * as ReadWriteLock from 'rwlock'; +import ReadWriteLock = require('rwlock'); const lock = new ReadWriteLock(); lock.readLock((release) => { diff --git a/types/s3-download-stream/index.d.ts b/types/s3-download-stream/index.d.ts new file mode 100644 index 0000000000..defd116e7c --- /dev/null +++ b/types/s3-download-stream/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for s3-download-stream 0.1 +// Project: https://github.com/jb55/s3-download-stream +// Definitions by: Caleb Everett +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import { Readable } from "stream"; +import { S3 } from "aws-sdk"; + +declare namespace s3Stream { + interface S3StreamDownloaderOptions { + client: S3; + concurrency?: number; + chunkSize?: string; + params: S3.GetObjectRequest; + } +} + +declare function s3Stream(options: s3Stream.S3StreamDownloaderOptions): Readable; +export = s3Stream; diff --git a/types/s3-download-stream/package.json b/types/s3-download-stream/package.json new file mode 100644 index 0000000000..3711406140 --- /dev/null +++ b/types/s3-download-stream/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "aws-sdk": "^2.37.0" + } +} diff --git a/types/s3-download-stream/s3-download-stream-tests.ts b/types/s3-download-stream/s3-download-stream-tests.ts new file mode 100644 index 0000000000..cf1176203d --- /dev/null +++ b/types/s3-download-stream/s3-download-stream-tests.ts @@ -0,0 +1,17 @@ +import * as S3Stream from "s3-download-stream"; +import * as AWS from "aws-sdk"; +import * as fs from "fs"; + +// Documentation for "params": +// http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getObject-property +const config = { + client: new AWS.S3({}), + concurrency: 6, + chunkSize: '512KB', + params: { + Key: 'key-name', + Bucket: 'bucket-name' + } +}; + +S3Stream(config).pipe(fs.createWriteStream('/path/to/a/file')); diff --git a/types/s3-download-stream/tsconfig.json b/types/s3-download-stream/tsconfig.json new file mode 100644 index 0000000000..d970729d35 --- /dev/null +++ b/types/s3-download-stream/tsconfig.json @@ -0,0 +1,24 @@ +{ + "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", + "s3-download-stream-tests.ts" + ] +} \ No newline at end of file diff --git a/types/s3-download-stream/tslint.json b/types/s3-download-stream/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/s3-download-stream/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/s3-upload-stream/s3-upload-stream-tests.ts b/types/s3-upload-stream/s3-upload-stream-tests.ts index 54f51231b7..bc814dc9e9 100644 --- a/types/s3-upload-stream/s3-upload-stream-tests.ts +++ b/types/s3-upload-stream/s3-upload-stream-tests.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import * as S3Stream from 's3-upload-stream'; +import S3Stream = require('s3-upload-stream'); import * as AWS from 'aws-sdk'; const s3Stream = S3Stream(new AWS.S3()); diff --git a/types/safe-compare/tsconfig.json b/types/safe-compare/tsconfig.json index 0aade26241..3aca8432c4 100644 --- a/types/safe-compare/tsconfig.json +++ b/types/safe-compare/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "safe-compare-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/saml2-js/saml2-js-tests.ts b/types/saml2-js/saml2-js-tests.ts index ca05489dd7..4fd1867b67 100644 --- a/types/saml2-js/saml2-js-tests.ts +++ b/types/saml2-js/saml2-js-tests.ts @@ -1,5 +1,5 @@ import * as fs from 'fs'; -import * as express from 'express'; +import express = require('express'); import * as saml2 from 'saml2-js'; diff --git a/types/samlp/samlp-tests.ts b/types/samlp/samlp-tests.ts index 8bb3399062..7418f6cc32 100644 --- a/types/samlp/samlp-tests.ts +++ b/types/samlp/samlp-tests.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as express from 'express'; +import express = require('express'); import * as samlp from 'samlp'; diff --git a/types/sanctuary/sanctuary-tests.ts b/types/sanctuary/sanctuary-tests.ts index 663811935c..a38f9d6384 100644 --- a/types/sanctuary/sanctuary-tests.ts +++ b/types/sanctuary/sanctuary-tests.ts @@ -1,4 +1,4 @@ -/// ; +/// import * as assert from "assert"; import { create, env } from "sanctuary"; diff --git a/types/sanctuary/tsconfig.json b/types/sanctuary/tsconfig.json index 653d340820..82b1098c6d 100644 --- a/types/sanctuary/tsconfig.json +++ b/types/sanctuary/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "sanctuary-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/sanitize-html/sanitize-html-tests.ts b/types/sanitize-html/sanitize-html-tests.ts index 31efb0395f..cc43d64fcb 100644 --- a/types/sanitize-html/sanitize-html-tests.ts +++ b/types/sanitize-html/sanitize-html-tests.ts @@ -1,5 +1,4 @@ - -import * as sanitize from 'sanitize-html'; +import sanitize = require('sanitize-html'); let options: sanitize.IOptions = { allowedTags: sanitize.defaults.allowedTags.concat('h1', 'h2', 'img'), @@ -7,7 +6,7 @@ let options: sanitize.IOptions = { 'a': sanitize.defaults.allowedAttributes['a'].concat('rel'), 'img': ['src', 'height', 'width', 'alt'] }, - transformTags: { + transformTags: { 'a': sanitize.simpleTransform('a', { 'rel': 'nofollow' }), 'img': (tagName: string, attribs: sanitize.Attributes) => { let img = { tagName, attribs }; diff --git a/types/sat/tsconfig.json b/types/sat/tsconfig.json index 75c7dbc256..7405ee4abf 100644 --- a/types/sat/tsconfig.json +++ b/types/sat/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "sat-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/saywhen/saywhen-tests.ts b/types/saywhen/saywhen-tests.ts index a1a02d6178..a253308156 100644 --- a/types/saywhen/saywhen-tests.ts +++ b/types/saywhen/saywhen-tests.ts @@ -1,4 +1,4 @@ -import * as when from 'saywhen'; +import when = require('saywhen'); when(jasmine.createSpy('test')); // $ExpectType CallHandler when(jasmine.createSpy('test')).isCalled; // $ExpectType Proxy diff --git a/types/screeps/tsconfig.json b/types/screeps/tsconfig.json index 8dcc302c5c..110537a00d 100644 --- a/types/screeps/tsconfig.json +++ b/types/screeps/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "screeps-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/scriptjs/scriptjs-tests.ts b/types/scriptjs/scriptjs-tests.ts index c82464f172..a73e40314a 100644 --- a/types/scriptjs/scriptjs-tests.ts +++ b/types/scriptjs/scriptjs-tests.ts @@ -1,4 +1,4 @@ -import * as $script from 'scriptjs'; +import $script = require('scriptjs'); const callback = (): void => console.log('done'); diff --git a/types/scroll-into-view/scroll-into-view-tests.ts b/types/scroll-into-view/scroll-into-view-tests.ts index 5cb274bc15..bd50abb011 100644 --- a/types/scroll-into-view/scroll-into-view-tests.ts +++ b/types/scroll-into-view/scroll-into-view-tests.ts @@ -1,4 +1,4 @@ -import * as scrollIntoView from "scroll-into-view" +import scrollIntoView = require("scroll-into-view"); var someElement: HTMLElement scrollIntoView(someElement); diff --git a/types/scryptsy/tsconfig.json b/types/scryptsy/tsconfig.json index ae751a1eb0..fecf5b2016 100644 --- a/types/scryptsy/tsconfig.json +++ b/types/scryptsy/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "scryptsy-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/seamless-immutable/seamless-immutable-tests.ts b/types/seamless-immutable/seamless-immutable-tests.ts index 528cd6cce2..ddec87e81d 100644 --- a/types/seamless-immutable/seamless-immutable-tests.ts +++ b/types/seamless-immutable/seamless-immutable-tests.ts @@ -1,4 +1,4 @@ -import * as Immutable from 'seamless-immutable'; +import Immutable = require('seamless-immutable'); // Test types diff --git a/types/selectables/selectables-tests.ts b/types/selectables/selectables-tests.ts index 595f2ca738..960573033b 100644 --- a/types/selectables/selectables-tests.ts +++ b/types/selectables/selectables-tests.ts @@ -1,4 +1,4 @@ -import * as Selectables from "selectables"; +import Selectables = require("selectables"); const dr = new Selectables({ zone: '#div', diff --git a/types/selectables/tsconfig.json b/types/selectables/tsconfig.json index e34d4a6078..8ff709ea04 100644 --- a/types/selectables/tsconfig.json +++ b/types/selectables/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "selectables-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/send/send-tests.ts b/types/send/send-tests.ts index da41697e96..f6c21b3aa3 100644 --- a/types/send/send-tests.ts +++ b/types/send/send-tests.ts @@ -1,7 +1,5 @@ -/// - -import * as express from 'express'; -import * as send from 'send'; +import express = require('express'); +import send = require('send'); var app = express(); diff --git a/types/seneca/seneca-tests.ts b/types/seneca/seneca-tests.ts index ea10180074..6ff0331ff6 100644 --- a/types/seneca/seneca-tests.ts +++ b/types/seneca/seneca-tests.ts @@ -2,7 +2,7 @@ * This file contains all of the example code that was on http://senecajs.org as of Mon June 16, 2016. */ -import * as SENECA from 'seneca' +import SENECA = require('seneca'); var seneca: SENECA.Instance = SENECA() seneca.add({ cmd: 'salestax' }, function (args, callback) { diff --git a/types/sequelize/index.d.ts b/types/sequelize/index.d.ts index d88754480f..4de155e6ee 100644 --- a/types/sequelize/index.d.ts +++ b/types/sequelize/index.d.ts @@ -10,6 +10,7 @@ // Philippe D'Alva // Carven Zhang // Nikola Vidic +// Florian Oellerich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -19,7 +20,7 @@ import * as _ from "lodash"; -import * as Promise from "bluebird"; +import Promise = require("bluebird"); import * as cls from "continuation-local-storage" declare namespace sequelize { @@ -3363,7 +3364,7 @@ declare namespace sequelize { * Apply column on which COUNT() should be applied */ col?: string; - + /** * Apply COUNT(DISTINCT(col)) */ @@ -5313,7 +5314,7 @@ declare namespace sequelize { /** * Only retry a query if the error matches one of these strings. */ - match?: string[]; + match?: (string|RegExp|Error)[]; /** * How many times a failing query is automatically retried. Set to 0 to disable retrying on SQL_BUSY error. diff --git a/types/sequelize/sequelize-tests.ts b/types/sequelize/sequelize-tests.ts index b1ee85d2fc..eea19959bd 100644 --- a/types/sequelize/sequelize-tests.ts +++ b/types/sequelize/sequelize-tests.ts @@ -1235,7 +1235,7 @@ new Sequelize( { username: 'user', password: 'pass', retry: { - match: ['failed'], + match: ['failed', /failed/i, Sequelize.ForeignKeyConstraintError], max: 3 }, typeValidation: true diff --git a/types/serialize-javascript/serialize-javascript-tests.ts b/types/serialize-javascript/serialize-javascript-tests.ts index b4c79f6a7c..357607daba 100644 --- a/types/serialize-javascript/serialize-javascript-tests.ts +++ b/types/serialize-javascript/serialize-javascript-tests.ts @@ -1,4 +1,4 @@ -import * as serialize from "serialize-javascript"; +import serialize = require("serialize-javascript"); const obj: any = { str: "string", diff --git a/types/serialport/serialport-tests.ts b/types/serialport/serialport-tests.ts index 70dff8bdbd..9ff1daa26e 100644 --- a/types/serialport/serialport-tests.ts +++ b/types/serialport/serialport-tests.ts @@ -1,6 +1,6 @@ // Tests taken from documentation samples. -import * as SerialPort from 'serialport'; +import SerialPort = require('serialport'); function test_basic_connect() { const port = new SerialPort(''); diff --git a/types/serialport/v4/serialport-tests.ts b/types/serialport/v4/serialport-tests.ts index c0bd59b274..7965811a68 100644 --- a/types/serialport/v4/serialport-tests.ts +++ b/types/serialport/v4/serialport-tests.ts @@ -1,6 +1,6 @@ // Tests taken from documentation samples. -import * as SerialPort from 'serialport'; +import SerialPort = require('serialport'); function test_basic_connect() { const port = new SerialPort(''); diff --git a/types/serialport/v4/tsconfig.json b/types/serialport/v4/tsconfig.json index 8c1a36c640..b6a10bc8fd 100644 --- a/types/serialport/v4/tsconfig.json +++ b/types/serialport/v4/tsconfig.json @@ -13,7 +13,9 @@ "../../" ], "paths": { - "serialport": ["serialport/v4"] + "serialport": [ + "serialport/v4" + ] }, "types": [], "noEmit": true, diff --git a/types/serve-index/serve-index-tests.ts b/types/serve-index/serve-index-tests.ts index 038fc3c533..5d54e9f768 100644 --- a/types/serve-index/serve-index-tests.ts +++ b/types/serve-index/serve-index-tests.ts @@ -1,6 +1,5 @@ - -import * as express from 'express'; -import * as serveIndex from 'serve-index'; +import express = require('express'); +import serveIndex = require('serve-index'); import * as fs from 'fs'; const app = express(); diff --git a/types/serve-static/serve-static-tests.ts b/types/serve-static/serve-static-tests.ts index 65671e8521..abceefd197 100644 --- a/types/serve-static/serve-static-tests.ts +++ b/types/serve-static/serve-static-tests.ts @@ -1,5 +1,5 @@ -import * as express from 'express'; -import * as serveStatic from 'serve-static'; +import express = require('express'); +import serveStatic = require('serve-static'); var app = express(); app.use(serveStatic('/1')); diff --git a/types/set-cookie-parser/set-cookie-parser-tests.ts b/types/set-cookie-parser/set-cookie-parser-tests.ts index 91238ff929..020d40f59c 100644 --- a/types/set-cookie-parser/set-cookie-parser-tests.ts +++ b/types/set-cookie-parser/set-cookie-parser-tests.ts @@ -1,6 +1,6 @@ import * as assert from "assert"; import * as http from "http"; -import * as setCookie from "set-cookie-parser"; +import setCookie = require("set-cookie-parser"); // Call parse function on imported object var input = "foo=bar;"; diff --git a/types/sharp/sharp-tests.ts b/types/sharp/sharp-tests.ts index d7f0282c24..f1010c533c 100644 --- a/types/sharp/sharp-tests.ts +++ b/types/sharp/sharp-tests.ts @@ -1,4 +1,4 @@ -import * as sharp from "sharp"; +import sharp = require("sharp"); import { createReadStream, createWriteStream } from "fs"; // Test samples taken from the official documentation diff --git a/types/sheetify/sheetify-tests.ts b/types/sheetify/sheetify-tests.ts index eba3a63336..b6704ed2e7 100644 --- a/types/sheetify/sheetify-tests.ts +++ b/types/sheetify/sheetify-tests.ts @@ -1,4 +1,4 @@ -import * as sheetify from 'sheetify'; +import sheetify = require('sheetify'); function done1(err: Error, css: string, prefix: string) {} function done2(err: Error, css: string) {} diff --git a/types/shell-escape/shell-escape-tests.ts b/types/shell-escape/shell-escape-tests.ts index ac3906be19..3cac57b81a 100644 --- a/types/shell-escape/shell-escape-tests.ts +++ b/types/shell-escape/shell-escape-tests.ts @@ -1,4 +1,4 @@ -import * as shellEscape from 'shell-escape'; +import shellEscape = require('shell-escape'); () => { const stringRes = shellEscape(['cp', '-r', 'src/', 'dest/']); diff --git a/types/should-sinon/index.d.ts b/types/should-sinon/index.d.ts new file mode 100644 index 0000000000..25233c1c61 --- /dev/null +++ b/types/should-sinon/index.d.ts @@ -0,0 +1,91 @@ +// Type definitions for should-sinon 0.0 +// Project: https://github.com/shouldjs/sinon +// Definitions by: AryloYeung +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import * as s from "sinon"; +import should = require("should"); + +declare module "sinon" { + interface SinonSpy { + should: ShouldSinonAssertion; + } + interface ShouldSinonAssertion extends should.Assertion { + /** + * Assert stub was called with given object as this always. So if you call stub several times + * all should be with the same object + */ + alwaysCalledOn(obj: any): void; + alwaysCalledWith(...args: any[]): void; + /** + * Passes if the spy was always called with the provided arguments and no others. + */ + alwaysCalledWithExactly(...args: any[]): void; + /** + * Returns true if spy was always called with matching arguments (and possibly others). + */ + alwaysCalledWithMatch(...args: any[]): void; + alwaysCalledWithNew(): void; + /** + * Passes if the spy always threw the given exception. The exception can be a + * string denoting its type, or an actual object. If no argument is + * provided, the assertion passes if the spy ever threw any exception. + */ + alwaysThrew(ex: string | Error): void; + /** + * Assert stub was called at exact number of times + */ + callCount(count: number): void; + /** + * Assert stub was called at least once + */ + called(): void; + /** + * Assert stub was called with given object as this + */ + calledOn(obj: any): void; + /** + * Assert stub was called at exactly once + */ + calledOnce(): void; + /** + * Assert stub was called at exactly thrice + */ + calledThrice(): void; + /** + * Assert stub was called at exactly twice + */ + calledTwice(): void; + /** + * Asserts that stub was called with given arguments + */ + calledWith(...args: any[]): void; + /** + * Returns true if call received provided arguments and no others. + */ + calledWithExactly(...args: any[]): void; + /** + * Returns true if spy was called with matching arguments (and possibly others). + */ + calledWithMatch(...args: any[]): void; + /** + * Asserts that stub was called with new + */ + calledWithNew(): void; + /** + * Returns true if the spy/stub was never called with the provided arguments. + */ + neverCalledWith(...args: any[]): void; + /** + * Returns true if the spy/stub was never called with matching arguments. + */ + neverCalledWithMatch(...args: any[]): void; + /** + * Passes if the spy threw the given exception. The exception can be a + * string denoting its type, or an actual object. If no argument is + * provided, the assertion passes if the spy ever threw any exception. + */ + threw(ex: string | Error): void; + } +} diff --git a/types/should-sinon/package.json b/types/should-sinon/package.json new file mode 100644 index 0000000000..5ee99bf166 --- /dev/null +++ b/types/should-sinon/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "should": "^13.2.1" + } +} diff --git a/types/should-sinon/should-sinon-tests.ts b/types/should-sinon/should-sinon-tests.ts new file mode 100644 index 0000000000..7c0946fc1d --- /dev/null +++ b/types/should-sinon/should-sinon-tests.ts @@ -0,0 +1,13 @@ +const callback = sinon.spy(); +const obj = { }; + +callback.should.be.alwaysCalledOn(obj); +callback.should.be.alwaysCalledWith(1, 2, 3); +callback.should.have.callCount(0); +callback.should.be.called(); +callback.should.be.calledOn(obj); +callback.should.be.calledOnce(); +callback.should.be.calledThrice(); +callback.should.be.calledTwice(); +callback.should.be.calledWith(1, 2, 3); +callback.should.be.neverCalledWith(1, 2, 3); diff --git a/types/should-sinon/tsconfig.json b/types/should-sinon/tsconfig.json new file mode 100644 index 0000000000..33eb26e8c4 --- /dev/null +++ b/types/should-sinon/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", + "should-sinon-tests.ts" + ] +} \ No newline at end of file diff --git a/types/should-sinon/tslint.json b/types/should-sinon/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/should-sinon/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/shrink-ray/shrink-ray-tests.ts b/types/shrink-ray/shrink-ray-tests.ts index e221806b88..b558c5540f 100644 --- a/types/shrink-ray/shrink-ray-tests.ts +++ b/types/shrink-ray/shrink-ray-tests.ts @@ -1,5 +1,5 @@ -import * as express from 'express'; -import * as shrinkRay from 'shrink-ray'; +import express = require('express'); +import shrinkRay = require('shrink-ray'); const app = express(); diff --git a/types/shrink-ray/tsconfig.json b/types/shrink-ray/tsconfig.json index 84b143dd64..d964de9f10 100644 --- a/types/shrink-ray/tsconfig.json +++ b/types/shrink-ray/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "shrink-ray-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/siema/tsconfig.json b/types/siema/tsconfig.json index 035dfc51d0..f07f878c5d 100644 --- a/types/siema/tsconfig.json +++ b/types/siema/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "siema-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/simple-peer/simple-peer-tests.ts b/types/simple-peer/simple-peer-tests.ts index 97fa2e9e8e..666816e388 100644 --- a/types/simple-peer/simple-peer-tests.ts +++ b/types/simple-peer/simple-peer-tests.ts @@ -1,4 +1,4 @@ -import * as SimplePeer from 'simple-peer'; +import SimplePeer = require('simple-peer'); const peer = new SimplePeer(); peer.write(new Buffer('hey')); diff --git a/types/skatejs/tsconfig.json b/types/skatejs/tsconfig.json index 1cbab67082..9f4db47554 100644 --- a/types/skatejs/tsconfig.json +++ b/types/skatejs/tsconfig.json @@ -39,4 +39,4 @@ "test/utils/name.ts", "test/utils/shadow.ts" ] -} +} \ No newline at end of file diff --git a/types/slack-node/slack-node-tests.ts b/types/slack-node/slack-node-tests.ts index b14029af19..d2dfc0541d 100644 --- a/types/slack-node/slack-node-tests.ts +++ b/types/slack-node/slack-node-tests.ts @@ -1,4 +1,4 @@ -import * as Slack from "slack-node"; +import Slack = require("slack-node"); let webhookUri = "__uri___"; diff --git a/types/slate-irc/slate-irc-tests.ts b/types/slate-irc/slate-irc-tests.ts index 3b1dd6bd3f..ce344ffa75 100644 --- a/types/slate-irc/slate-irc-tests.ts +++ b/types/slate-irc/slate-irc-tests.ts @@ -1,6 +1,5 @@ - import * as net from "net"; -import * as SlateIRC from "slate-irc"; +import SlateIRC = require("slate-irc"); let socket: net.Socket; const client = SlateIRC(socket); diff --git a/types/smtp-server/smtp-server-tests.ts b/types/smtp-server/smtp-server-tests.ts index 29c05c942e..5be0634ebb 100644 --- a/types/smtp-server/smtp-server-tests.ts +++ b/types/smtp-server/smtp-server-tests.ts @@ -8,9 +8,10 @@ const options: SMTPServerOptions = { onRcptTo, onData, onClose, - port: 2525 }; +const port = 2525; + function onConnect(session: SMTPServerSession, callback: (err?: Error) => void): void { console.log(`[${session.id}] onConnect`); callback(); @@ -69,7 +70,7 @@ server.on('close', () => { console.log('Server closed'); }); -server.listen(options.port, () => { +server.listen(port, () => { const address = server.server.address(); console.log(`Listening on [${address.address}]:${address.port}`); }); diff --git a/types/snekfetch/snekfetch-tests.ts b/types/snekfetch/snekfetch-tests.ts index 69e9743f83..211ef5bd80 100644 --- a/types/snekfetch/snekfetch-tests.ts +++ b/types/snekfetch/snekfetch-tests.ts @@ -1,6 +1,6 @@ import * as fs from 'fs'; import * as util from 'util'; -import * as snekfetch from 'snekfetch'; +import snekfetch = require('snekfetch'); const writeFile = util.promisify(fs.writeFile); diff --git a/types/snoowrap/snoowrap-tests.ts b/types/snoowrap/snoowrap-tests.ts index dfea881a8b..afa9a46fa2 100644 --- a/types/snoowrap/snoowrap-tests.ts +++ b/types/snoowrap/snoowrap-tests.ts @@ -1,4 +1,4 @@ -import * as Snoowrap from 'snoowrap'; +import Snoowrap = require('snoowrap'); import { Comment, Listing, diff --git a/types/socketio-jwt-auth/tsconfig.json b/types/socketio-jwt-auth/tsconfig.json index eb874d1a8e..d9d832b68e 100644 --- a/types/socketio-jwt-auth/tsconfig.json +++ b/types/socketio-jwt-auth/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "socketio-jwt-auth-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/sort-array/tsconfig.json b/types/sort-array/tsconfig.json index 935747c5e6..dcd496828f 100644 --- a/types/sort-array/tsconfig.json +++ b/types/sort-array/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "sort-array-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/spark-md5/spark-md5-tests.ts b/types/spark-md5/spark-md5-tests.ts index bc81f715f1..0a6c929a29 100644 --- a/types/spark-md5/spark-md5-tests.ts +++ b/types/spark-md5/spark-md5-tests.ts @@ -1,4 +1,4 @@ -import * as SparkMD5 from "spark-md5"; +import SparkMD5 = require("spark-md5"); SparkMD5.hash('Hi there'); SparkMD5.hash('Hi there', true); diff --git a/types/sparkpost/sparkpost-tests.ts b/types/sparkpost/sparkpost-tests.ts index d15208bcb5..26a2ebda3a 100644 --- a/types/sparkpost/sparkpost-tests.ts +++ b/types/sparkpost/sparkpost-tests.ts @@ -1,4 +1,4 @@ -import * as SparkPost from "sparkpost"; +import SparkPost = require("sparkpost"); const key = "YOURAPIKEY"; const client = new SparkPost(key); diff --git a/types/sparkpost/v1/sparkpost-tests.ts b/types/sparkpost/v1/sparkpost-tests.ts index 0b8a41ab0a..6a2ac71acc 100644 --- a/types/sparkpost/v1/sparkpost-tests.ts +++ b/types/sparkpost/v1/sparkpost-tests.ts @@ -1,4 +1,4 @@ -import * as SparkPost from "sparkpost"; +import SparkPost = require("sparkpost"); let key = "YOURAPIKEY"; let client = new SparkPost(key); diff --git a/types/spdx-correct/tsconfig.json b/types/spdx-correct/tsconfig.json index a7c8604db7..4daa583e23 100644 --- a/types/spdx-correct/tsconfig.json +++ b/types/spdx-correct/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "spdx-correct-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/spdx-satisfies/tsconfig.json b/types/spdx-satisfies/tsconfig.json index 7aff811650..d1d82811e2 100644 --- a/types/spdx-satisfies/tsconfig.json +++ b/types/spdx-satisfies/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "spdx-satisfies-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/spectacle/index.d.ts b/types/spectacle/index.d.ts index 41f0d1df79..cabd6cf5a1 100644 --- a/types/spectacle/index.d.ts +++ b/types/spectacle/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/FormidableLabs/victory // Definitions by: Zachary Maybury // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/split2/split2-tests.ts b/types/split2/split2-tests.ts index 35d0b58684..0d4052742b 100644 --- a/types/split2/split2-tests.ts +++ b/types/split2/split2-tests.ts @@ -1,4 +1,4 @@ -import * as split from 'split2'; +import split = require('split2'); import * as fs from 'fs'; import { Transform, TransformOptions } from 'stream'; diff --git a/types/spotify-web-playback-sdk/tsconfig.json b/types/spotify-web-playback-sdk/tsconfig.json index c6b3dd1448..b742fcb876 100644 --- a/types/spotify-web-playback-sdk/tsconfig.json +++ b/types/spotify-web-playback-sdk/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "spotify-web-playback-sdk-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/sqs-consumer/index.d.ts b/types/sqs-consumer/index.d.ts index 73da1ff980..d333ed5fca 100644 --- a/types/sqs-consumer/index.d.ts +++ b/types/sqs-consumer/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for sqs-consumer 3.7 +// Type definitions for sqs-consumer 3.8 // Project: https://github.com/BBC/sqs-consumer // Definitions by: Daniel Chao // Eric Byers @@ -19,6 +19,7 @@ declare namespace Consumer { messageAttributeNames?: string[]; batchSize?: number; visibilityTimeout?: number; + terminateVisibilityTimeout?: boolean; waitTimeSeconds?: number; authenticationErrorTimeout?: number; sqs?: SQS; diff --git a/types/sqs-consumer/sqs-consumer-tests.ts b/types/sqs-consumer/sqs-consumer-tests.ts index f22e75b523..c097ce5644 100644 --- a/types/sqs-consumer/sqs-consumer-tests.ts +++ b/types/sqs-consumer/sqs-consumer-tests.ts @@ -17,7 +17,8 @@ const app2 = Consumer.create({ region: "us-west-1", batchSize: 15, visibilityTimeout: 50, - waitTimeSeconds: 50 + waitTimeSeconds: 50, + terminateVisibilityTimeout: true }); // Test message handler. diff --git a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts index ec64afe698..a8c774c5d3 100644 --- a/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts +++ b/types/ssh2-sftp-client/ssh2-sftp-client-tests.ts @@ -1,4 +1,4 @@ -import * as Client from 'ssh2-sftp-client'; +import Client = require('ssh2-sftp-client'); import * as fs from 'fs'; const client = new Client(); diff --git a/types/stale-lru-cache/stale-lru-cache-tests.ts b/types/stale-lru-cache/stale-lru-cache-tests.ts index 8d3c47562f..4b597f545d 100644 --- a/types/stale-lru-cache/stale-lru-cache-tests.ts +++ b/types/stale-lru-cache/stale-lru-cache-tests.ts @@ -1,4 +1,4 @@ -import * as Cache from 'stale-lru-cache'; +import Cache = require('stale-lru-cache'); const cache = new Cache({ maxSize: 100, diff --git a/types/std-mocks/tsconfig.json b/types/std-mocks/tsconfig.json index 2ee05a022d..73ed32806c 100644 --- a/types/std-mocks/tsconfig.json +++ b/types/std-mocks/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "std-mocks-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/stemmer/stemmer-tests.ts b/types/stemmer/stemmer-tests.ts index b5ed8daec4..db9f19d996 100644 --- a/types/stemmer/stemmer-tests.ts +++ b/types/stemmer/stemmer-tests.ts @@ -1,3 +1,3 @@ -import * as stemmer from 'stemmer'; +import stemmer = require('stemmer'); stemmer('Working'); // $ExpectType string diff --git a/types/stemmer/tsconfig.json b/types/stemmer/tsconfig.json index 7224a39eb8..f6a1494f12 100644 --- a/types/stemmer/tsconfig.json +++ b/types/stemmer/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "stemmer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/sticky-cluster/sticky-cluster-tests.ts b/types/sticky-cluster/sticky-cluster-tests.ts index e730275d78..720e8d001a 100644 --- a/types/sticky-cluster/sticky-cluster-tests.ts +++ b/types/sticky-cluster/sticky-cluster-tests.ts @@ -1,5 +1,5 @@ import stickyCluster = require('sticky-cluster'); -import * as express from 'express'; +import express = require('express'); import * as http from 'http'; /** test with all params */ diff --git a/types/sticky-cluster/tsconfig.json b/types/sticky-cluster/tsconfig.json index dcfc338f93..189e887431 100644 --- a/types/sticky-cluster/tsconfig.json +++ b/types/sticky-cluster/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "sticky-cluster-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/stompjs/index.d.ts b/types/stompjs/index.d.ts index 008b99b511..91d5277fba 100644 --- a/types/stompjs/index.d.ts +++ b/types/stompjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for stompjs 2.3 // Project: https://github.com/jmesnil/stomp-websocket -// Definitions by: Jimi Charalampidis +// Definitions by: Jimi Charalampidis , Stefan Erichsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -13,7 +13,6 @@ export const VERSIONS: { }; export class Client { - connected: boolean; counter: number; heartbeat: { @@ -27,6 +26,7 @@ export class Client { debug(...args: string[]): any; connect(headers: { login: string, passcode: string, host?: string }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; + connect(headers: { }, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any): any; connect(login: string, passcode: string, connectCallback: (frame?: Frame) => any, errorCallback?: (error: string) => any, host?: string): any; disconnect(disconnectCallback: () => any, headers?: {}): any; @@ -51,13 +51,18 @@ export interface Message { nack(headers?: {}): any; } -export class Frame { +export class Frame implements Message { + command: string; + headers: {}; + body: string; constructor(command: string, headers?: {}, body?: string); + ack(headers?: {}): any; + nack(headers?: {}): any; toString(): string; - sizeOfUTF8(s: string): number; - unmarshall(datas: any): any; - marshall(command: string, headers?: {}, body?: string): any; + static sizeOfUTF8(s: string): number; + static unmarshall(datas: any): any; + static marshall(command: string, headers?: {}, body?: string): any; } export function client(url: string, protocols?: string | Array): Client; diff --git a/types/stompjs/stompjs-tests.ts b/types/stompjs/stompjs-tests.ts index 15331fc81f..fcc0c46ff5 100644 --- a/types/stompjs/stompjs-tests.ts +++ b/types/stompjs/stompjs-tests.ts @@ -43,6 +43,16 @@ client.connect('user', 'pass', () => { }, (error) => { }); client.connect('user', 'pass', () => { }, (error) => { }, 'host'); client.connect('user', 'pass', (frame) => { }, (error) => { }); client.connect('user', 'pass', (frame) => { }, (error) => { }, 'host'); +client.connect('user', 'pass', (frame) => { + if (!!frame) { + frame.command; + } + }, (error) => { }, 'host'); + +client.connect({}, () => { }); +client.connect({}, () => { }, () => { }); +client.connect({}, () => { }, (error) => { }); +client.connect({}, (frame) => { }, (error) => { }); client.disconnect(() => { }); client.disconnect(() => { }, {}); @@ -88,13 +98,13 @@ frame = new Stomp.Frame('command', {}, 'body'); frame.toString(); -frame.sizeOfUTF8('abc'); +Stomp.Frame.sizeOfUTF8('abc'); -frame.unmarshall(0); -frame.unmarshall('data'); -frame.unmarshall({}); -frame.unmarshall([{}, {}]); +Stomp.Frame.unmarshall(0); +Stomp.Frame.unmarshall('data'); +Stomp.Frame.unmarshall({}); +Stomp.Frame.unmarshall([{}, {}]); -frame.marshall('command'); -frame.marshall('command', {}); -frame.marshall('command', {}, 'body'); +Stomp.Frame.marshall('command'); +Stomp.Frame.marshall('command', {}); +Stomp.Frame.marshall('command', {}, 'body'); diff --git a/types/storybook__addon-a11y/tsconfig.json b/types/storybook__addon-a11y/tsconfig.json index 4f04f36d5a..c37bd5436c 100644 --- a/types/storybook__addon-a11y/tsconfig.json +++ b/types/storybook__addon-a11y/tsconfig.json @@ -1,32 +1,32 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "jsx": "react", - "typeRoots": [ - "../" - ], - "paths": { - "@storybook/addon-a11y": [ - "storybook__addon-a11y" - ], - "@storybook/react": [ - "storybook__react" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "storybook__addon-a11y-tests.tsx" - ] + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "paths": { + "@storybook/addon-a11y": [ + "storybook__addon-a11y" + ], + "@storybook/react": [ + "storybook__react" + ] + }, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "storybook__addon-a11y-tests.tsx" + ] } \ No newline at end of file diff --git a/types/storybook__addon-actions/index.d.ts b/types/storybook__addon-actions/index.d.ts index 01c3b4837d..9b7009fbad 100644 --- a/types/storybook__addon-actions/index.d.ts +++ b/types/storybook__addon-actions/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 export type HandlerFunction = (...args: any[]) => undefined; export type DecoratorFunction = (args: any[]) => any[]; diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index c42c8d359a..f694ad3eb4 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Mark Kornblum // Mattias Wikstrom // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 +// TypeScript Version: 2.6 import * as React from 'react'; import { RenderFunction } from '@storybook/react'; diff --git a/types/storybook__addon-info/tsconfig.json b/types/storybook__addon-info/tsconfig.json index 87d702ce2b..ad08c9163b 100644 --- a/types/storybook__addon-info/tsconfig.json +++ b/types/storybook__addon-info/tsconfig.json @@ -29,4 +29,4 @@ "index.d.ts", "storybook__addon-info-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/storybook__addon-knobs/index.d.ts b/types/storybook__addon-knobs/index.d.ts index f725abb47c..4125f10b84 100644 --- a/types/storybook__addon-knobs/index.d.ts +++ b/types/storybook__addon-knobs/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Joscha Feth // Martynas Kadisa // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { RenderFunction } from '@storybook/react'; diff --git a/types/storybook__addon-links/index.d.ts b/types/storybook__addon-links/index.d.ts index 08f3648855..141072aa2a 100644 --- a/types/storybook__addon-links/index.d.ts +++ b/types/storybook__addon-links/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; diff --git a/types/storybook__addon-notes/index.d.ts b/types/storybook__addon-notes/index.d.ts index 7e9e94746e..e8b6f5934a 100644 --- a/types/storybook__addon-notes/index.d.ts +++ b/types/storybook__addon-notes/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/storybooks/storybook // Definitions by: Joscha Feth // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import * as React from 'react'; import { RenderFunction } from '@storybook/react'; diff --git a/types/storybook__react/index.d.ts b/types/storybook__react/index.d.ts index dd93b9459b..d31ea08af2 100644 --- a/types/storybook__react/index.d.ts +++ b/types/storybook__react/index.d.ts @@ -3,7 +3,7 @@ // Definitions by: Joscha Feth // Anton Izmailov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/stream-meter/stream-meter-tests.ts b/types/stream-meter/stream-meter-tests.ts index 396f8aa6b1..d7adf74ce8 100644 --- a/types/stream-meter/stream-meter-tests.ts +++ b/types/stream-meter/stream-meter-tests.ts @@ -1,5 +1,4 @@ - -import * as meter from 'stream-meter'; +import meter = require('stream-meter'); var m:meter.StreamMeter = meter(); process.stdin.pipe(m).pipe(process.stdout); diff --git a/types/strftime/strftime-tests.ts b/types/strftime/strftime-tests.ts index 2c07e8ad5f..7ecbfaf2fe 100644 --- a/types/strftime/strftime-tests.ts +++ b/types/strftime/strftime-tests.ts @@ -1,4 +1,4 @@ -import * as strftime from "strftime"; +import strftime = require("strftime"); strftime('%B %d, %Y %H:%M:%S'); strftime('%F %T', new Date(1307472705067)); diff --git a/types/string-template/string-template-tests.ts b/types/string-template/string-template-tests.ts index 8ac76014c1..226f042287 100644 --- a/types/string-template/string-template-tests.ts +++ b/types/string-template/string-template-tests.ts @@ -1,5 +1,5 @@ -import * as format from "string-template"; -import * as compile from "string-template/compile"; +import format = require("string-template"); +import compile = require("string-template/compile"); // Format tests { diff --git a/types/stringify-object/index.d.ts b/types/stringify-object/index.d.ts index 3380fc3672..575e650064 100644 --- a/types/stringify-object/index.d.ts +++ b/types/stringify-object/index.d.ts @@ -1,15 +1,17 @@ -// Type definitions for stringify-object 3.1 +// Type definitions for stringify-object 3.2 // Project: https://github.com/yeoman/stringify-object // Definitions by: Chris Khoo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 declare namespace stringifyObject { } declare function stringifyObject(o: any, options?: { - indent?: string, - singleQuotes?: boolean, - filter?(o: any, prop: string): boolean, - inlineCharacterLimit?: number + indent?: string, + singleQuotes?: boolean, + filter?(o: any, prop: string | symbol): boolean, + inlineCharacterLimit?: number, + transform?: (val: any[] | object, i: number | string | symbol, value: string) => string, }): string; export = stringifyObject; diff --git a/types/stringify-object/stringify-object-tests.ts b/types/stringify-object/stringify-object-tests.ts index a00be6f1c0..f011930fda 100644 --- a/types/stringify-object/stringify-object-tests.ts +++ b/types/stringify-object/stringify-object-tests.ts @@ -1,4 +1,4 @@ -import * as stringifyObject from 'stringify-object'; +import stringifyObject = require('stringify-object'); stringifyObject({ a: 1, b: 2, c: 3 }); @@ -22,5 +22,9 @@ stringifyObject([1, 2, 3], { }); stringifyObject([1, 2, 3], { - filter: (o, prop) => prop !== '_hidden_' + filter: (o, prop) => prop !== '_hidden_' +}); + +stringifyObject([1, 2, 3], { + transform: (val, key, value) => value }); diff --git a/types/strip-json-comments/strip-json-comments-tests.ts b/types/strip-json-comments/strip-json-comments-tests.ts index f71f62cf0f..188248a285 100644 --- a/types/strip-json-comments/strip-json-comments-tests.ts +++ b/types/strip-json-comments/strip-json-comments-tests.ts @@ -1,9 +1,4 @@ -// Type definitions for strip-json-comments -// Project: https://github.com/sindresorhus/strip-json-comments -// Definitions by: Dylan R. E. Moonfire -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import * as stripJsonComments from "strip-json-comments"; +import stripJsonComments = require("strip-json-comments"); const json = '{/*rainbows*/"unicorn":"cake"}'; diff --git a/types/stripe/index.d.ts b/types/stripe/index.d.ts index c3fd4853b7..12f2b4abea 100644 --- a/types/stripe/index.d.ts +++ b/types/stripe/index.d.ts @@ -4051,7 +4051,7 @@ declare namespace Stripe { /** * The card number */ - number: number; + number: string; /** * Card brand. Can be Visa, American Express, MasterCard, Discover, JCB, Diners Club, or Unknown. @@ -4167,7 +4167,7 @@ declare namespace Stripe { /** * The card number, as a string without any separators. */ - number: number; + number: string; /** * Card security code. Required unless your account is registered in diff --git a/types/stripe/stripe-tests.ts b/types/stripe/stripe-tests.ts index 99cf3795db..b887ae6228 100644 --- a/types/stripe/stripe-tests.ts +++ b/types/stripe/stripe-tests.ts @@ -243,7 +243,7 @@ stripe.customers.create({ }).then( function (customer) { // asynchronously called customer.cards.create({ card: "tok_17wV94BoqMA9o2xkhlAd3ALf"}).then(function (customer) {}); - customer.cards.retrieve("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (card) { + customer.cards.retrieve("card_17xMvXBoqMA9o2xkq6W5gamx").then(function (card) { let strCustomer: string = card.customer; let objCustomer: customers.ICustomer = card.customer; }); @@ -394,7 +394,7 @@ stripe.customers.createSource( object: "card", exp_month: 1, exp_year: 16, - number: 4242424242424242 + number: '4242424242424242' } }, function (err, card) { @@ -409,7 +409,7 @@ stripe.customers.createSource( object: "card", exp_month: 1, exp_year: 16, - number: 4242424242424242 + number: '4242424242424242' } }).then( function (card) { diff --git a/types/styled-jsx/index.d.ts b/types/styled-jsx/index.d.ts index 5072cdc7b9..5e15388837 100644 --- a/types/styled-jsx/index.d.ts +++ b/types/styled-jsx/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/zeit/styled-jsx // Definitions by: R1ZZU // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 import "react"; diff --git a/types/styled-jsx/tsconfig.json b/types/styled-jsx/tsconfig.json index 494ed25a0a..6e599795bf 100644 --- a/types/styled-jsx/tsconfig.json +++ b/types/styled-jsx/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "styled-jsx-tests.tsx" ] -} +} \ No newline at end of file diff --git a/types/stylelint-webpack-plugin/index.d.ts b/types/stylelint-webpack-plugin/index.d.ts index 580fc4325f..dfaf0a4f05 100644 --- a/types/stylelint-webpack-plugin/index.d.ts +++ b/types/stylelint-webpack-plugin/index.d.ts @@ -2,8 +2,9 @@ // Project: https://github.com/JaKXz/stylelint-webpack-plugin // Definitions by: Arne Bahlo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import { Plugin } from "webpack"; +import { Plugin } from 'webpack'; export = StylelintWebpackPlugin; diff --git a/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts b/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts index 924a41ee6d..ee9002ec40 100644 --- a/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts +++ b/types/stylelint-webpack-plugin/stylelint-webpack-plugin-tests.ts @@ -1,5 +1,5 @@ -import * as webpack from "webpack"; -import * as StylelintWebpackPlugin from "stylelint-webpack-plugin"; +import webpack = require("webpack"); +import StylelintWebpackPlugin = require("stylelint-webpack-plugin"); const compiler = webpack({ plugins: [ diff --git a/types/sumo-logger/sumo-logger-tests.ts b/types/sumo-logger/sumo-logger-tests.ts index 03efdfc95d..2a0066a4e4 100644 --- a/types/sumo-logger/sumo-logger-tests.ts +++ b/types/sumo-logger/sumo-logger-tests.ts @@ -1,5 +1,5 @@ -import * as SumoLogger from 'sumo-logger'; -import * as expect from 'expect'; +import SumoLogger = require('sumo-logger'); +import expect = require('expect'); const onErrorSpy = expect.createSpy(); const onSuccessSpy = expect.createSpy(); diff --git a/types/superagent-no-cache/superagent-no-cache-tests.ts b/types/superagent-no-cache/superagent-no-cache-tests.ts index 68e4e961a2..717fee80e3 100644 --- a/types/superagent-no-cache/superagent-no-cache-tests.ts +++ b/types/superagent-no-cache/superagent-no-cache-tests.ts @@ -1,5 +1,5 @@ import * as request from 'superagent'; -import * as plugin from 'superagent-no-cache'; +import plugin = require('superagent-no-cache'); request .get('/some-url') diff --git a/types/superagent-prefix/superagent-prefix-tests.ts b/types/superagent-prefix/superagent-prefix-tests.ts index 01e4b52905..6b0bbf0820 100644 --- a/types/superagent-prefix/superagent-prefix-tests.ts +++ b/types/superagent-prefix/superagent-prefix-tests.ts @@ -1,5 +1,5 @@ import * as request from 'superagent'; -import * as plugin from 'superagent-prefix'; +import plugin = require('superagent-prefix'); request .get('/some-url') diff --git a/types/superagent/superagent-tests.ts b/types/superagent/superagent-tests.ts index 5978b37206..bbea2d617c 100644 --- a/types/superagent/superagent-tests.ts +++ b/types/superagent/superagent-tests.ts @@ -1,8 +1,7 @@ // via: http://visionmedia.github.io/superagent/ - -import * as request from 'superagent'; +import request = require('superagent'); import * as fs from 'fs'; -import * as assert from 'assert'; +import assert = require('assert'); import { Agent } from 'https'; // Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md diff --git a/types/superagent/v2/superagent-tests.ts b/types/superagent/v2/superagent-tests.ts index 02074043fc..e0f0fcc592 100644 --- a/types/superagent/v2/superagent-tests.ts +++ b/types/superagent/v2/superagent-tests.ts @@ -1,8 +1,8 @@ // via: http://visionmedia.github.io/superagent/ -import * as request from 'superagent'; +import request = require('superagent'); import * as fs from 'fs'; -import * as assert from 'assert'; +import assert = require('assert'); import { Agent } from 'https'; // Examples taken from https://github.com/visionmedia/superagent/blob/gh-pages/docs/index.md diff --git a/types/supertest-as-promised/supertest-as-promised-tests.ts b/types/supertest-as-promised/supertest-as-promised-tests.ts index b86bdafbc9..fbf8be995b 100644 --- a/types/supertest-as-promised/supertest-as-promised-tests.ts +++ b/types/supertest-as-promised/supertest-as-promised-tests.ts @@ -1,5 +1,5 @@ -import * as request from 'supertest-as-promised'; -import * as express from 'express'; +import request = require('supertest-as-promised'); +import express = require('express'); declare function describe(desc: string, f: () => void): void; declare function it(desc: string, f: () => void): void; diff --git a/types/supertest/supertest-tests.ts b/types/supertest/supertest-tests.ts index 868aa8fdce..24bbd4bd56 100644 --- a/types/supertest/supertest-tests.ts +++ b/types/supertest/supertest-tests.ts @@ -1,6 +1,5 @@ - -import * as supertest from 'supertest'; -import * as express from 'express'; +import supertest = require('supertest'); +import express = require('express'); const app = express(); const request: supertest.SuperTest = supertest(app); diff --git a/types/svg-parser/tsconfig.json b/types/svg-parser/tsconfig.json index c24afbd999..c5497750f7 100644 --- a/types/svg-parser/tsconfig.json +++ b/types/svg-parser/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "svg-parser-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/svgo/tsconfig.json b/types/svgo/tsconfig.json index e2cdf41913..ec4687a1d9 100644 --- a/types/svgo/tsconfig.json +++ b/types/svgo/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "svgo-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swagger-express-middleware/swagger-express-middleware-tests.ts b/types/swagger-express-middleware/swagger-express-middleware-tests.ts index 6ba847fe3f..1a01d8475d 100644 --- a/types/swagger-express-middleware/swagger-express-middleware-tests.ts +++ b/types/swagger-express-middleware/swagger-express-middleware-tests.ts @@ -1,5 +1,5 @@ -import * as express from "express"; -import * as SwaggerExpressMiddleware from "swagger-express-middleware"; +import express = require("express"); +import SwaggerExpressMiddleware = require("swagger-express-middleware"); let app = express(); let router = express.Router(); diff --git a/types/swagger-express-mw/swagger-express-mw-tests.ts b/types/swagger-express-mw/swagger-express-mw-tests.ts index 617e331e1c..9f81cf8a2d 100644 --- a/types/swagger-express-mw/swagger-express-mw-tests.ts +++ b/types/swagger-express-mw/swagger-express-mw-tests.ts @@ -1,5 +1,5 @@ import * as SwaggerExpress from "swagger-express-mw"; -import * as express from "express"; +import express = require("express"); const app = express(); const config: SwaggerExpress.Config = { diff --git a/types/swagger-express-mw/tsconfig.json b/types/swagger-express-mw/tsconfig.json index c529b14c27..1d597728f7 100644 --- a/types/swagger-express-mw/tsconfig.json +++ b/types/swagger-express-mw/tsconfig.json @@ -14,7 +14,12 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "hapi": [ + "hapi/v16" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +28,4 @@ "index.d.ts", "swagger-express-mw-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swagger-hapi/tsconfig.json b/types/swagger-hapi/tsconfig.json index ea5343eb59..410688bcf1 100644 --- a/types/swagger-hapi/tsconfig.json +++ b/types/swagger-hapi/tsconfig.json @@ -14,7 +14,12 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "hapi": [ + "hapi/v16" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +28,4 @@ "index.d.ts", "swagger-hapi-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swagger-jsdoc/swagger-jsdoc-tests.ts b/types/swagger-jsdoc/swagger-jsdoc-tests.ts index 2a87ae2dab..4cf386e48a 100644 --- a/types/swagger-jsdoc/swagger-jsdoc-tests.ts +++ b/types/swagger-jsdoc/swagger-jsdoc-tests.ts @@ -1,6 +1,4 @@ -/// - -import * as express from 'express'; +import express = require('express'); import swaggerJSDoc = require('swagger-jsdoc'); const app = express(); diff --git a/types/swagger-node-runner/swagger-node-runner-tests.ts b/types/swagger-node-runner/swagger-node-runner-tests.ts index 9890bed290..1deae28f23 100644 --- a/types/swagger-node-runner/swagger-node-runner-tests.ts +++ b/types/swagger-node-runner/swagger-node-runner-tests.ts @@ -1,6 +1,6 @@ import * as SwaggerNodeRunner from "swagger-node-runner"; -import * as express from "express"; -import * as connect from "connect"; +import express = require("express"); +import connect = require("connect"); import * as Hapi from "hapi"; import * as restify from "restify"; import * as sails from "sails.io.js"; diff --git a/types/swagger-node-runner/tsconfig.json b/types/swagger-node-runner/tsconfig.json index 1d3ae44a1a..e559433107 100644 --- a/types/swagger-node-runner/tsconfig.json +++ b/types/swagger-node-runner/tsconfig.json @@ -14,7 +14,12 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "hapi": [ + "hapi/v16" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +28,4 @@ "index.d.ts", "swagger-node-runner-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swagger-restify-mw/tsconfig.json b/types/swagger-restify-mw/tsconfig.json index a9dcb8c0da..8c5f09a930 100644 --- a/types/swagger-restify-mw/tsconfig.json +++ b/types/swagger-restify-mw/tsconfig.json @@ -14,7 +14,12 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "hapi": [ + "hapi/v16" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +28,4 @@ "index.d.ts", "swagger-restify-mw-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swagger-sails-hook/tsconfig.json b/types/swagger-sails-hook/tsconfig.json index 44a316b98b..508453b078 100644 --- a/types/swagger-sails-hook/tsconfig.json +++ b/types/swagger-sails-hook/tsconfig.json @@ -14,7 +14,12 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "hapi": [ + "hapi/v16" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +28,4 @@ "index.d.ts", "swagger-sails-hook-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/swagger-schema-official/index.d.ts b/types/swagger-schema-official/index.d.ts index 48173c0883..dc184d3e91 100644 --- a/types/swagger-schema-official/index.d.ts +++ b/types/swagger-schema-official/index.d.ts @@ -87,7 +87,7 @@ export interface Path { options?: Operation; head?: Operation; patch?: Operation; - parameters?: [Parameter]; + parameters?: Parameter[]; } // ----------------------------- Operation ----------------------------------- diff --git a/types/swagger-tools/swagger-tools-tests.ts b/types/swagger-tools/swagger-tools-tests.ts index 7b05595269..58e978a0e4 100644 --- a/types/swagger-tools/swagger-tools-tests.ts +++ b/types/swagger-tools/swagger-tools-tests.ts @@ -1,6 +1,6 @@ // 2.0 examples from https://github.com/apigee-127/swagger-tools/blob/master/examples/2.0/index.js -import * as connect from 'connect'; +import connect = require('connect'); import { createServer } from 'http'; import * as swaggerTools from 'swagger-tools'; diff --git a/types/swig-email-templates/tsconfig.json b/types/swig-email-templates/tsconfig.json index 987a6f629a..b25f125136 100644 --- a/types/swig-email-templates/tsconfig.json +++ b/types/swig-email-templates/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "swig-email-templates-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/tabris-plugin-firebase/tsconfig.json b/types/tabris-plugin-firebase/tsconfig.json index 118339f812..cac6477844 100644 --- a/types/tabris-plugin-firebase/tsconfig.json +++ b/types/tabris-plugin-firebase/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "tabris-plugin-firebase-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/tar-fs/index.d.ts b/types/tar-fs/index.d.ts new file mode 100644 index 0000000000..07c02bab4b --- /dev/null +++ b/types/tar-fs/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for tar-fs 1.16 +// Project: https://github.com/mafintosh/tar-fs +// Definitions by: Umoxfo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.6 + +// Imported from: https://github.com/soywiz/typescript-node-definitions/d.ts + +/// + +import fs = require("fs"); + +export function pack(cwd: string, opts?: PackOptions): any; +export function extract(cwd: string, opts?: ExtractOptions): any; + +export interface Options { + ignore?: (name: string) => boolean; + filter?: (name: string) => boolean; + map?: (header: Headers) => Headers; + mapStream?: (fileStream: fs.ReadStream, header: Headers) => fs.ReadStream; + strict?: boolean; +} + +export interface PackOptions extends Options { + entries?: string[]; + dereference?: boolean; + finalize?: boolean; + finish?: (pack: any) => void; +} + +export interface ExtractOptions extends Options { + ignore?: (name: string, header?: Headers) => boolean; + filter?: (name: string, header?: Headers) => boolean; + dmode?: number; + fmode?: number; + readable?: boolean; + writable?: boolean; +} + +export interface Headers { + name: string; + mode: number; + mtime: Date; + size: number; + type: "file" | "directory" | "symlink"; + uid: number; + gid: number; +} diff --git a/types/tar-fs/tar-fs-tests.ts b/types/tar-fs/tar-fs-tests.ts new file mode 100644 index 0000000000..a419f907cb --- /dev/null +++ b/types/tar-fs/tar-fs-tests.ts @@ -0,0 +1,98 @@ +import tar = require("tar-fs"); +import fs = require("fs"); +import path = require("path"); +import stream = require("stream"); + +/* + * Default test + */ +// packing a directory +tar.pack('./my-directory').pipe(fs.createWriteStream('my-tarball.tar')); + +// extracting a directory +fs.createReadStream('my-other-tarball.tar').pipe(tar.extract('./my-other-directory')); + +/* + * Ignore various files + */ +tar.pack('./my-directory', { + ignore: (name) => { + return path.extname(name) === '.bin'; // ignore .bin files when packing + } +}); + +tar.extract('./my-other-directory', { + ignore: (name) => { + return path.extname(name) === '.bin'; // ignore .bin files inside the tarball when extracing + } +}); + +tar.extract('./my-other-other-directory', { + ignore: (_, header) => { + // pass files & directories, ignore e.g. symlinks + return header.type !== 'file' && header.type !== 'directory'; + } +}); + +/* + * Specify which entries to pack + */ +tar.pack('./my-directory', { + entries: ['file1', 'subdir/file2'], // only the specific entries will be packed +}); + +/* + * Modify the headers by map + */ +tar.pack('./my-directory', { + map: (header) => { + header.name = 'prefixed/' + header.name; + return header; + } +}); + +tar.extract('./my-directory', { + map: (header) => { + header.name = 'another-prefix/' + header.name; + return header; + } +}); + +/* + * Modify the headers by mapStream + */ +tar.pack('./my-directory', { + mapStream: (fileStream, header) => { + if (path.extname(header.name) === '.js') { + return fileStream; + } + return fileStream; + } +}); + +tar.extract('./my-directory', { + mapStream: (fileStream, header) => { + if (path.extname(header.name) === '.js') { + return fileStream; + } + return fileStream; + } +}); + +/* + * The corresponding modes + */ +tar.extract('./my-directory', { + dmode: parseInt("555", 8), + fmode: parseInt("444", 8), + readable: true, + writable: true, +}); + +/* + * The other options + */ +tar.pack('./my-directory', { + strict: false, + dereference: true, +}); diff --git a/types/fuse/tsconfig.json b/types/tar-fs/tsconfig.json similarity index 94% rename from types/fuse/tsconfig.json rename to types/tar-fs/tsconfig.json index 8f6b34f5d3..83965ab819 100644 --- a/types/fuse/tsconfig.json +++ b/types/tar-fs/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "fuse-tests.ts" + "tar-fs-tests.ts" ] } \ No newline at end of file diff --git a/types/tar-fs/tslint.json b/types/tar-fs/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/tar-fs/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/tcp-ping/tsconfig.json b/types/tcp-ping/tsconfig.json index 20d82ad303..f070f6f798 100644 --- a/types/tcp-ping/tsconfig.json +++ b/types/tcp-ping/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "tcp-ping-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/tedious/index.d.ts b/types/tedious/index.d.ts index 2f3fe528d7..409ff67878 100644 --- a/types/tedious/index.d.ts +++ b/types/tedious/index.d.ts @@ -481,7 +481,7 @@ export declare class Connection extends events.EventEmitter { * @param name A string representing a name to associate with the transaction. Optional, and defaults to an empty string. In case of a nested transaction, naming the transaction name has no effect. * @param isolationLevel The isolation level that the transaction is to be run with. */ - transaction(callback: (error: Error, done: (error?: Error) => void) => void, name?: string, isolationLevel?: ISOLATION_LEVEL): void; + transaction(callback: (error: Error, done: (error?: Error, doneCallback?: (error?: Error, ...args: any[]) => void, ...args: any[]) => void) => void, name?: string, isolationLevel?: ISOLATION_LEVEL): void; /** * Prepare the SQL represented by the request. The request can then be used in subsequent calls to execute and unprepare diff --git a/types/telebot/telebot-tests.ts b/types/telebot/telebot-tests.ts index 3bb9677b5d..ea4851c27b 100644 --- a/types/telebot/telebot-tests.ts +++ b/types/telebot/telebot-tests.ts @@ -1,4 +1,4 @@ -import * as TeleBot from "telebot"; +import TeleBot = require("telebot"); let bot = new TeleBot('token'); bot = new TeleBot({ diff --git a/types/testingbot-api/testingbot-api-tests.ts b/types/testingbot-api/testingbot-api-tests.ts index 2b8cd1f655..39ac0d8f81 100644 --- a/types/testingbot-api/testingbot-api-tests.ts +++ b/types/testingbot-api/testingbot-api-tests.ts @@ -1,4 +1,4 @@ -import * as TestingBot from 'testingbot-api'; +import TestingBot = require('testingbot-api'); const sessionId = '123'; diff --git a/types/text-buffer/tsconfig.json b/types/text-buffer/tsconfig.json index dd4d1eeb3e..c11c286ff7 100644 --- a/types/text-buffer/tsconfig.json +++ b/types/text-buffer/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "text-buffer-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/three/test/webgl/webgl_geometries.ts b/types/three/test/webgl/webgl_geometries.ts index 32ab4270b4..d09b865c6d 100644 --- a/types/three/test/webgl/webgl_geometries.ts +++ b/types/three/test/webgl/webgl_geometries.ts @@ -20,7 +20,7 @@ scene = new THREE.Scene(); - var light: THREE.DirectionalLight, object: THREE.Mesh | THREE.AxisHelper | THREE.ArrowHelper; + var light: THREE.DirectionalLight, object: THREE.Mesh | THREE.AxesHelper | THREE.ArrowHelper; scene.add(new THREE.AmbientLight(0x404040)); @@ -96,7 +96,7 @@ object.position.set(0, 0, -200); scene.add(object); - object = new THREE.AxisHelper(50); + object = new THREE.AxesHelper(50); object.position.set(200, 0, -200); scene.add(object); diff --git a/types/three/three-core.d.ts b/types/three/three-core.d.ts index 40a9d4daa0..3ba0be89e8 100644 --- a/types/three/three-core.d.ts +++ b/types/three/three-core.d.ts @@ -457,6 +457,9 @@ export class CubeCamera extends Object3D { renderTarget: WebGLRenderTargetCube; + /** + * @deprecated Use {@link CubeCamera#update .update()} instead + */ updateCubeMap(renderer: Renderer, scene: Scene): void; update(renderer: Renderer, scene: Scene): void; @@ -635,7 +638,7 @@ export class PerspectiveCamera extends Camera { toJSON(meta?: any): any; /** - * @deprecated + * @deprecated Use {@link PerspectiveCamera#setFocalLength .setFocalLength()} and {@link PerspectiveCamera#filmGauge .filmGauge} instead. */ setLens(focalLength: number, frameHeight?: number): void; } @@ -701,7 +704,7 @@ export class BufferAttribute { setXYZ(index: number, x: number, y: number, z: number): BufferAttribute; setXYZW(index: number, x: number, y: number, z: number, w: number): BufferAttribute; /** - * @deprecated Use count instead. + * @deprecated Use {@link BufferAttribute#count .count} instead. */ length: number; } @@ -806,7 +809,7 @@ export class Float64BufferAttribute extends BufferAttribute { } /** - * @deprecated, use new THREE.BufferAttribute().setDynamic( true ). + * @deprecated Use {@link BufferAttribute#setDynamic THREE.BufferAttribute().setDynamic( true )} instead. */ export class DynamicBufferAttribute extends BufferAttribute {} @@ -908,14 +911,30 @@ export class BufferGeometry extends EventDispatcher { dispose(): void; /** - * @deprecated + * @deprecated Use {@link BufferGeometry#groups .groups} instead. */ drawcalls: any; + + /** + * @deprecated Use {@link BufferGeometry#groups .groups} instead. + */ offsets: any; + /** + * @deprecated Use {@link BufferGeometry#setIndex .setIndex()} instead. + */ addIndex(index: any): void; + + /** + * @deprecated Use {@link BufferGeometry#addGroup .addGroup()} instead. + */ addDrawCall(start: any, count: any, indexOffset?: any): void; + + /** + * @deprecated Use {@link BufferGeometry#clearGroups .clearGroups()} instead. + */ clearDrawCalls(): void; + addAttribute(name: any, array: any, itemSize: any): any; } @@ -1154,7 +1173,7 @@ export class Face3 { } /** - * @deprecated Use Face3 instead. + * @deprecated Use {@link Face3} instead. */ export class Face4 extends Face3 {} @@ -1409,11 +1428,11 @@ export class Geometry extends EventDispatcher { */ export namespace GeometryUtils { /** - * @deprecated Use geometry.merge( geometry2, matrix, materialIndexOffset ). + * @deprecated Use {@link Geometry#merge geometry.merge( geometry2, matrix, materialIndexOffset )} instead. */ export function merge(geometry1: any, geometry2: any, materialIndexOffset?: any): any; /** - * @deprecated Use geometry.center(). + * @deprecated Use {@link Geometry#center geometry.center()} instead. */ export function center(geometry: any): any; } @@ -1498,7 +1517,7 @@ export class InterleavedBufferAttribute { setXYZ(index: number, x: number, y: number, z: number): InterleavedBufferAttribute; setXYZW(index: number, x: number, y: number, z: number, w: number): InterleavedBufferAttribute; /** - * @deprecated Use count instead. + * @deprecated Use {@link InterleavedBufferAttribute#count .count} instead. */ length: number; } @@ -2056,6 +2075,7 @@ export class SpotLight extends Light { } export class SpotLightShadow extends LightShadow { + camera: PerspectiveCamera; update(light: Light): void; } @@ -2101,6 +2121,9 @@ export class Loader { */ crossOrigin: string; + /** + * @deprecated Use THREE.LoaderUtils.extractUrlBase() instead. + */ extractUrlBase(url: string): string; initMaterials(materials: Material[], texturePath: string): Material[]; createMaterial(m: Material, texturePath: string, crossOrigin?: string): boolean; @@ -2301,7 +2324,7 @@ export class DataTextureLoader { } /** - * @deprecated since 0.84.0. Use DataTextureLoader (renamed) + * @deprecated since 0.84.0. Use {@link DataTextureLoader} (renamed) */ export class BinaryTextureLoader extends DataTextureLoader {} @@ -2910,7 +2933,7 @@ export class MeshPhongMaterial extends Material { morphTargets: boolean; morphNormals: boolean; /** - * @deprecated + * @deprecated Use {@link MeshStandardMaterial THREE.MeshStandardMaterial} instead. */ metal: boolean; @@ -2934,6 +2957,9 @@ export class MeshPhysicalMaterial extends MeshStandardMaterial { // MultiMaterial does not inherit the Material class in the original code. However, it should treat as Material class. // See tests/canvas/canvas_materials.ts. +/** + * @deprecated Use an Array instead. + */ export class MultiMaterial extends Material { constructor(materials?: Material[]); @@ -2946,7 +2972,7 @@ export class MultiMaterial extends Material { } /** - * @deprecated Use MultiMaterial instead. + * @deprecated Use {@link MultiMaterial} instead. */ export class MeshFaceMaterial extends MultiMaterial {} @@ -2969,15 +2995,15 @@ export class PointsMaterial extends Material { } /** - * @deprecated + * @deprecated Use {@link PointsMaterial THREE.PointsMaterial} instead */ export class PointCloudMaterial extends PointsMaterial {} /** - * @deprecated + * @deprecated Use {@link PointsMaterial THREE.PointsMaterial} instead */ export class ParticleBasicMaterial extends PointsMaterial {} /** - * @deprecated + * @deprecated Use {@link PointsMaterial THREE.PointsMaterial} instead */ export class ParticleSystemMaterial extends PointsMaterial {} @@ -3012,7 +3038,7 @@ export class ShaderMaterial extends Material { morphTargets: boolean; morphNormals: boolean; /** - * @deprecated Use extensions.derivatives instead. + * @deprecated Use {@link ShaderMaterial#extensions.derivatives extensions.derivatives} instead. */ derivatives: any; extensions: { derivatives: boolean; fragDepth: boolean; drawBuffers: boolean; shaderTextureLOD: boolean }; @@ -3078,11 +3104,11 @@ export class Box2 { translate(offset: Vector2): Box2; equals(box: Box2): boolean; /** - * @deprecated Use isEmpty() instead. + * @deprecated Use {@link Box2#isEmpty .isEmpty()} instead. */ empty(): any; /** - * @deprecated Use intersectsBox() instead. + * @deprecated Use {@link Box2#intersectsBox .intersectsBox()} instead. */ isIntersectionBox(b: any): any; } @@ -3123,15 +3149,15 @@ export class Box3 { translate(offset: Vector3): Box3; equals(box: Box3): boolean; /** - * @deprecated Use isEmpty() instead. + * @deprecated Use {@link Box3#isEmpty .isEmpty()} instead. */ empty(): any; /** - * @deprecated Use intersectsBox() instead. + * @deprecated Use {@link Box3#intersectsBox .intersectsBox()} instead. */ isIntersectionBox(b: any): any; /** - * @deprecated Use intersectsSphere() instead. + * @deprecated Use {@link Box3#intersectsSphere .intersectsSphere()} instead. */ isIntersectionSphere(s: any): any; } @@ -3522,7 +3548,8 @@ export namespace Math { /** * Random float from 0 to 1 with 16 bits of randomness. * Standard Math.random() creates repetitive patterns when applied over larger space. - * @deprecated Use Math.random() + * + * @deprecated Use {@link Math#random Math.random()} */ export function random16(): number; @@ -3547,9 +3574,20 @@ export namespace Math { export function isPowerOfTwo(value: number): boolean; + /** + * @deprecated Use {@link Math#floorPowerOfTwo .floorPowerOfTwo()} + */ export function nearestPowerOfTwo(value: number): number; + /** + * @deprecated Use {@link Math#ceilPowerOfTwo .ceilPowerOfTwo()} + */ export function nextPowerOfTwo(value: number): number; + + export function floorPowerOfTwo(value: number): number; + + export function ceilPowerOfTwo(value: number): number; + } /** @@ -3613,7 +3651,14 @@ export class Matrix3 implements Matrix { clone(): this; copy(m: this): this; setFromMatrix4(m: Matrix4): Matrix3; + + /** + * @deprecated Use {@link Matrix3#applyToBufferAttribute matrix3.applyToBufferAttribute( attribute )} instead. + */ applyToBuffer(buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; + + applyToBufferAttribute(attribute: BufferAttribute): BufferAttribute; + multiplyScalar(s: number): Matrix3; determinant(): number; getInverse(matrix: Matrix3, throwOnDegenerate?: boolean): Matrix3; @@ -3644,11 +3689,19 @@ export class Matrix3 implements Matrix { multiplyMatrices(a: Matrix3, b: Matrix3): Matrix3; /** - * @deprecated + * @deprecated Use {@link Vector3.applyMatrix3 vector.applyMatrix3( matrix )} instead. */ multiplyVector3(vector: Vector3): any; + + /** + * @deprecated This method has been removed completely. + */ multiplyVector3Array(a: any): any; getInverse(matrix: Matrix4, throwOnDegenerate?: boolean): Matrix3; + + /** + * @deprecated Use {@link Matrix3#toArray .toArray()} instead. + */ flattenToArrayOffset(array: number[], offset: number): number[]; } @@ -3719,6 +3772,8 @@ export class Matrix4 implements Matrix { /** * Sets this matrix to a x b and stores the result into the flat array r. * r can be either a regular Array or a TypedArray. + * + * @deprecated This method has been removed completely. */ multiplyToArray(a: Matrix4, b: Matrix4, r: number[]): Matrix4; @@ -3726,7 +3781,14 @@ export class Matrix4 implements Matrix { * Multiplies this matrix by s. */ multiplyScalar(s: number): Matrix4; + + /** + * @deprecated Use {@link Matrix4#applyToBufferAttribute matrix4.applyToBufferAttribute( attribute )} instead. + */ applyToBuffer( buffer: BufferAttribute, offset?: number, length?: number): BufferAttribute; + + applyToBufferAttribute(attribute: BufferAttribute): BufferAttribute; + /** * Computes determinant of this matrix. * Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm @@ -3738,14 +3800,11 @@ export class Matrix4 implements Matrix { */ transpose(): Matrix4; - - /** * Sets the position component for this matrix from vector v. */ setPosition(v: Vector3): Matrix4; - /** * Sets this matrix to the inverse of matrix m. * Based on http://www.euclideanspace.com/maths/algebra/matrix/functions/inverse/fourD/index.htm. @@ -3828,15 +3887,43 @@ export class Matrix4 implements Matrix { toArray(): number[]; /** - * @deprecated + * @deprecated Use {@link Matrix4#copyPosition .copyPosition()} instead. */ extractPosition(m: Matrix4): Matrix4; + + /** + * @deprecated Use {@link Matrix4#makeRotationFromQuaternion .makeRotationFromQuaternion()} instead. + */ setRotationFromQuaternion(q: Quaternion): Matrix4; + + /** + * @deprecated Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead. + */ multiplyVector3(v: any): any; + + /** + * @deprecated Use {@link Vector4#applyMatrix4 vector.applyMatrix4( matrix )} instead. + */ multiplyVector4(v: any): any; + + /** + * @deprecated This method has been removed completely. + */ multiplyVector3Array(array: number[]): number[]; + + /** + * @deprecated Use {@link Vector3#transformDirection Vector3.transformDirection( matrix )} instead. + */ rotateAxis(v: any): void; + + /** + * @deprecated Use {@link Vector3#applyMatrix4 vector.applyMatrix4( matrix )} instead. + */ crossVector(v: any): void; + + /** + * @deprecated Use {@link Matrix4#toArray .toArray()} instead. + */ flattenToArrayOffset(array: number[], offset: number): number[]; } @@ -3867,7 +3954,7 @@ export class Plane { equals(plane: Plane): boolean; /** - * @deprecated + * @deprecated Use {@link Plane#intersectsLine .intersectsLine()} instead. */ isIntersectionLine(l: any): any; } @@ -4005,7 +4092,7 @@ export class Quaternion { static slerpFlat(dst: number[], dstOffset: number, src0: number[], srcOffset: number, src1: number[], stcOffset1: number, t: number): Quaternion; /** - * @deprecated + * @deprecated Use {@link Vector#applyQuaternion vector.applyQuaternion( quaternion )} instead. */ multiplyVector3(v: any): any; } @@ -4038,10 +4125,18 @@ export class Ray { equals(ray: Ray): boolean; /** - * @deprecated + * @deprecated Use {@link Ray#intersectsBox .intersectsBox()} instead. */ isIntersectionBox(b: any): any; + + /** + * @deprecated Use {@link Ray#intersectsPlane .intersectsPlane()} instead. + */ isIntersectionPlane(p: any): any; + + /** + * @deprecated Use {@link Ray#intersectsSphere .intersectsSphere()} instead. + */ isIntersectionSphere(s: any): any; } @@ -4322,6 +4417,10 @@ export class Vector2 implements Vector { * Computes length of this vector. */ length(): number; + + /** + * @deprecated Use {@link Vector2#manhattanLength .manhattanLength()} instead. + */ lengthManhattan(): number; /** @@ -4343,6 +4442,10 @@ export class Vector2 implements Vector { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector2): number; + + /** + * @deprecated Use {@link Vector2#manhattanDistanceTo .manhattanDistanceTo()} instead. + */ distanceToManhattan(v: Vector2): number; /** @@ -4366,6 +4469,26 @@ export class Vector2 implements Vector { fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector2; rotateAround( center: Vector2, angle: number ): Vector2; + + /** + * Computes the Manhattan length of this vector. + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanLength(): number; + + /** + * Computes the Manhattan length (distance) from this vector to the given vector v + * + * @param {Vector2} v + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanDistanceTo(v: Vector2): number; } /** @@ -4502,9 +4625,30 @@ export class Vector3 implements Vector { /** * Computes Manhattan length of this vector. * http://en.wikipedia.org/wiki/Taxicab_geometry + * + * @deprecated Use {@link Vector3#manhattanLength .manhattanLength()} instead. */ lengthManhattan(): number; - manhattanDistanceTo(v:Vector3):number; + + /** + * Computes the Manhattan length of this vector. + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanLength(): number; + + /** + * Computes the Manhattan length (distance) from this vector to the given vector v + * + * @param {Vector3} v + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanDistanceTo(v: Vector3): number; /** * Normalizes this vector. @@ -4542,6 +4686,10 @@ export class Vector3 implements Vector { * Computes squared distance of this vector to v. */ distanceToSquared(v: Vector3): number; + + /** + * @deprecated Use {@link Vector3#manhattanDistanceTo .manhattanDistanceTo()} instead. + */ distanceToManhattan(v: Vector3): number; setFromSpherical(s: Spherical): Vector3; @@ -4559,15 +4707,23 @@ export class Vector3 implements Vector { fromBufferAttribute( attribute: BufferAttribute, index: number, offset?: number): Vector3; /** - * @deprecated + * @deprecated Use {@link Vector3#setFromMatrixPosition .setFromMatrixPosition()} instead. */ getPositionFromMatrix(m: Matrix4): Vector3; + + /** + * @deprecated Use {@link Vector3#setFromMatrixScale .setFromMatrixScale()} instead. + */ getScaleFromMatrix(m: Matrix4): Vector3; + + /** + * @deprecated Use {@link Vector3#setFromMatrixColumn .setFromMatrixColumn()} instead. + */ getColumnFromMatrix(index: number, matrix: Matrix4): Vector3; } /** - * @deprecated use THREE.Vector3 instead. + * @deprecated use {@link Vector3 THREE.Vector3} instead. */ export class Vertex extends Vector3 {} @@ -4700,8 +4856,21 @@ export class Vector4 implements Vector { * Computes length of this vector. */ length(): number; + + /** + * @deprecated Use {@link Vector4#manhattanLength .manhattanLength()} instead. + */ lengthManhattan(): number; + /** + * Computes the Manhattan length of this vector. + * + * @return {number} + * + * @see {@link http://en.wikipedia.org/wiki/Taxicab_geometry|Wikipedia: Taxicab Geometry} + */ + manhattanLength(): number; + /** * Normalizes this vector. */ @@ -4789,7 +4958,7 @@ export class LOD extends Object3D { toJSON(meta: any): any; /** - * @deprecated + * @deprecated Use {@link LOD#levels .levels} instead. */ objects: any[]; } @@ -4851,10 +5020,10 @@ export class LineSegments extends Line { } export class Mesh extends Object3D { - constructor(geometry?: Geometry | BufferGeometry, material?: Material | Material []); + constructor(geometry?: Geometry | BufferGeometry, material?: Material); geometry: Geometry|BufferGeometry; - material: Material | Material[]; + material: Material; drawMode: TrianglesDrawModes; morphTargetInfluences?: number[]; morphTargetDictionary?: { [key: string]: number; }; @@ -4895,17 +5064,20 @@ export class Points extends Object3D { } /** - * @deprecated + * @deprecated Use {@link Points THREE.Points} instead. */ export class PointCloud extends Points {} /** - * @deprecated + * @deprecated Use {@link Points THREE.Points} instead. */ export class ParticleSystem extends Points {} export class Skeleton { - constructor(bones: Bone[], boneInverses?: Matrix4[], useVertexTexture?: boolean); + constructor(bones: Bone[], boneInverses?: Matrix4[]); + /** + * @deprecated This property has been removed completely. + */ useVertexTexture: boolean; identityMatrix: Matrix4; bones: Bone[]; @@ -4951,7 +5123,7 @@ export class Sprite extends Object3D { } /** - * @deprecated Use Sprite instead. + * @deprecated Use {@link Sprite Sprite} instead. */ export class Particle extends Sprite {} @@ -5139,8 +5311,16 @@ export class WebGLRenderer implements Renderer { getContextAttributes(): any; forceContextLoss(): void; + /** + * @deprecated Use {@link WebGLCapabilities#getMaxAnisotropy .capabilities.getMaxAnisotropy()} instead. + */ getMaxAnisotropy(): number; + + /** + * @deprecated Use {@link WebGLCapabilities#precision .capabilities.precision} instead. + */ getPrecision(): string; + getPixelRatio(): number; setPixelRatio(value: number): void; @@ -5195,6 +5375,10 @@ export class WebGLRenderer implements Renderer { clearDepth(): void; clearStencil(): void; clearTarget(renderTarget: WebGLRenderTarget, color: boolean, depth: boolean, stencil: boolean): void; + + /** + * @deprecated Use {@link WebGLState#reset .state.reset()} instead. + */ resetGLState(): void; dispose(): void; @@ -5230,7 +5414,7 @@ export class WebGLRenderer implements Renderer { setTextureCube(texture: Texture, slot: number): void; getRenderTarget(): RenderTarget; /** - * @deprecated Use getRenderTarget instead. + * @deprecated Use {@link WebGLRenderer#getRenderTarget .getRenderTarget()} instead. */ getCurrentRenderTarget(): RenderTarget; setRenderTarget(renderTarget: RenderTarget): void; @@ -5240,18 +5424,65 @@ export class WebGLRenderer implements Renderer { * @deprecated */ gammaFactor: number; + + /** + * @deprecated Use {@link WebGLShadowMap#enabled .shadowMap.enabled} instead. + */ shadowMapEnabled: boolean; + + /** + * @deprecated Use {@link WebGLShadowMap#type .shadowMap.type} instead. + */ shadowMapType: ShadowMapType; + + /** + * @deprecated Use {@link WebGLShadowMap#cullFace .shadowMap.cullFace} instead. + */ shadowMapCullFace: CullFace; + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'OES_texture_float' )} instead. + */ supportsFloatTextures(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'OES_texture_half_float' )} instead. + */ supportsHalfFloatTextures(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'OES_standard_derivatives' )} instead. + */ supportsStandardDerivatives(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'WEBGL_compressed_texture_s3tc' )} instead. + */ supportsCompressedTextureS3TC(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'WEBGL_compressed_texture_pvrtc' )} instead. + */ supportsCompressedTexturePVRTC(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'EXT_blend_minmax' )} instead. + */ supportsBlendMinMax(): any; + + /** + * @deprecated Use {@link WebGLCapabilities#vertexTextures .capabilities.vertexTextures} instead. + */ supportsVertexTextures(): any; + + /** + * @deprecated Use {@link WebGLExtensions#get .extensions.get( 'ANGLE_instanced_arrays' )} instead. + */ supportsInstancedArrays(): any; + + /** + * @deprecated Use {@link WebGLRenderer#setScissorTest .setScissorTest()} instead. + */ enableScissorTest(boolean: any): any; } @@ -5315,43 +5546,43 @@ export class WebGLRenderTarget extends EventDispatcher { stencilBuffer: boolean; depthTexture: Texture; /** - * @deprecated Use texture.wrapS instead. + * @deprecated Use {@link Texture#wrapS texture.wrapS} instead. */ wrapS: any; /** - * @deprecated Use texture.wrapT instead. + * @deprecated Use {@link Texture#wrapT texture.wrapT} instead. */ wrapT: any; /** - * @deprecated Use texture.magFilter instead. + * @deprecated Use {@link Texture#magFilter texture.magFilter} instead. */ magFilter: any; /** - * @deprecated Use texture.minFilter instead. + * @deprecated Use {@link Texture#minFilter texture.minFilter} instead. */ minFilter: any; /** - * @deprecated Use texture.anisotropy instead. + * @deprecated Use {@link Texture#anisotropy texture.anisotropy} instead. */ anisotropy: any; /** - * @deprecated Use texture.offset instead. + * @deprecated Use {@link Texture#offset texture.offset} instead. */ offset: any; /** - * @deprecated Use texture.repeat instead. + * @deprecated Use {@link Texture#repeat texture.repeat} instead. */ repeat: any; /** - * @deprecated Use texture.format instead. + * @deprecated Use {@link Texture#format texture.format} instead. */ format: any; /** - * @deprecated Use texture.type instead. + * @deprecated Use {@link Texture#type texture.type} instead. */ type: any; /** - * @deprecated Use texture.generateMipmaps instead. + * @deprecated Use {@link Texture#generateMipmaps texture.generateMipmaps} instead. */ generateMipmaps: any; @@ -5625,17 +5856,23 @@ export namespace UniformsUtils { export class Uniform { constructor(value: any); /** - * @deprecated + * @deprecated */ constructor(type: string, value: any); /** - * @deprecated + * @deprecated */ type: string; value: any; + /** + * @deprecated Use {@link Object3D#onBeforeRender object.onBeforeRender()} instead. + */ dynamic: boolean; onUpdateCallback: Function; + /** + * @deprecated Use {@link Object3D#onBeforeRender object.onBeforeRender()} instead. + */ onUpdate(callback: Function): Uniform; } @@ -5729,11 +5966,11 @@ export class WebGLProgram { vertexShader: WebGLShader; fragmentShader: WebGLShader; /** - * @deprecated Use getUniforms() instead. + * @deprecated Use {@link WebGLProgram#getUniforms getUniforms()} instead. */ uniforms: any; /** - * @deprecated Use getAttributes() instead. + * @deprecated Use {@link WebGLProgram#getAttributes getAttributes()} instead. */ attributes: any; @@ -5803,7 +6040,7 @@ export class WebGLShadowMap { render(scene: Scene, camera: Camera): void; /** - * @deprecated + * @deprecated Use {@link WebGLShadowMap#renderReverseSided .shadowMap.renderReverseSided} instead. */ cullFace: any; } @@ -6129,12 +6366,22 @@ export class VideoTexture extends Texture { // Extras ///////////////////////////////////////////////////////////////////// /** - * @deprecated Use TextureLoader instead. + * @deprecated Use {@link TextureLoader} instead. */ export namespace ImageUtils { + /** + * @deprecated + */ export let crossOrigin: string; + /** + * @deprecated Use {@link TextureLoader THREE.TextureLoader()} instead. + */ export function loadTexture(url: string, mapping?: Mapping, onLoad?: (texture: Texture) => void, onError?: (message: string) => void): Texture; + + /** + * @deprecated Use {@link CubeTextureLoader THREE.CubeTextureLoader()} instead. + */ export function loadTextureCube(array: string[], mapping?: Mapping, onLoad?: (texture: Texture) => void , onError?: (message: string) => void ): Texture; } @@ -6188,7 +6435,7 @@ export class Audio extends Object3D { getVolume(): number; setVolume(value: number): Audio; /** - * @deprecated Use AudioLoader instead. + * @deprecated Use {@link AudioLoader} instead. */ load(file: string): Audio; } @@ -6203,7 +6450,7 @@ export class AudioAnalyser { getAverageFrequency(): number; /** - * @deprecated + * @deprecated Use {@link AudioAnalyser#getFrequencyData .getFrequencyData()} instead. */ getData(file: any): any; } @@ -6335,8 +6582,18 @@ export class CurvePath extends Curve { getCurveLengths(): number[]; getSpacedPoints(divisions?: number): T[]; getPoints(divisions?: number): T[]; + + /** + * @deprecated Use {@link Geometry#setFromPoints new THREE.Geometry().setFromPoints( points )} instead. + */ createPointsGeometry(divisions: number): Geometry; + /** + * @deprecated Use {@link Geometry#setFromPoints new THREE.Geometry().setFromPoints( points )} instead. + */ createSpacedPointsGeometry(divisions: number): Geometry; + /** + * @deprecated Use {@link Geometry#setFromPoints new THREE.Geometry().setFromPoints( points )} instead. + */ createGeometry(points: T[]): Geometry; } @@ -6363,7 +6620,11 @@ export class Path extends CurvePath { currentPoint: Vector2; + /** + * @deprecated Use {@link Path#setFromPoints .setFromPoints()} instead. + */ fromPoints(vectors: Vector2[]): void; + setFromPoints(vectors: Vector2[]): void; moveTo(x: number, y: number): void; lineTo(x: number, y: number): void; quadraticCurveTo(aCPx: number, aCPy: number, aX: number, aY: number): void; @@ -6397,9 +6658,20 @@ export class Shape extends Path { holes: Path[]; + /** + * @deprecated Use {@link ExtrudeGeometry ExtrudeGeometry()} instead. + */ extrude(options?: any): ExtrudeGeometry; + + /** + * @deprecated Use {@link ShapeGeometry ShapeGeometry()} instead. + */ makeGeometry(options?: any): ShapeGeometry; getPointsHoles(divisions: number): Vector2[][]; + + /** + * @deprecated Use {@link Shape#extractPoints .extractPoints()} instead. + */ extractAllPoints(divisions: number): { shape: Vector2[]; holes: Vector2[][]; @@ -6539,7 +6811,7 @@ export class BoxGeometry extends Geometry { } /** - * @deprecated Use BoxGeometry instead. + * @deprecated Use {@link BoxGeometry} instead. */ export class CubeGeometry extends BoxGeometry {} @@ -6951,10 +7223,13 @@ export class ArrowHelper extends Object3D { setColor(hex: number): void; } -export class AxisHelper extends LineSegments { +export class AxesHelper extends LineSegments { constructor(size?: number); } +/** + * @deprecated Use {@link BoxHelper THREE.BoxHelper} instead. + */ export class BoundingBoxHelper extends Mesh { constructor(object?: Object3D, hex?: number); @@ -6989,6 +7264,9 @@ export class DirectionalLightHelper extends Object3D { update(): void; } +/** + * @deprecated Use {@link EdgesGeometry THREE.EdgesGeometry} + */ export class EdgesHelper extends LineSegments { constructor(object: Object3D, hex?: number, thresholdAngle?: number); } @@ -7005,7 +7283,7 @@ export class FaceNormalsHelper extends LineSegments { export class GridHelper extends LineSegments { constructor(size: number, divisions: number, color1?: Color|number, color2?: Color|number); /** - * @deprecated + * @deprecated Colors should be specified in the constructor. */ setColors(color1?: Color|number, color2?: Color|number): void; } @@ -7058,6 +7336,9 @@ export class VertexNormalsHelper extends LineSegments { update(object?: Object3D): void; } +/** + * @deprecated Use {@link WireframeGeometry THREE.WireframeGeometry} instead. + */ export class WireframeHelper extends LineSegments { constructor(object: Object3D, hex?: number); } diff --git a/types/three/tsconfig.json b/types/three/tsconfig.json index 4faf2d0b0c..2c62dbad6b 100644 --- a/types/three/tsconfig.json +++ b/types/three/tsconfig.json @@ -57,4 +57,4 @@ "test/examples/loaders/webgl_loader_obj_mtl.ts", "test/webvr/webvr.ts" ] -} +} \ No newline at end of file diff --git a/types/thrift/index.d.ts b/types/thrift/index.d.ts index c5cb6f20a3..e4f0e3c1f9 100644 --- a/types/thrift/index.d.ts +++ b/types/thrift/index.d.ts @@ -227,7 +227,7 @@ export interface ServiceMap { export interface ServiceOptions { transport?: TTransportConstructor; protocol?: TProtocolConstructor; - processor?: { new (handler: THandler): TProcessor }; + processor?: { new(handler: THandler): TProcessor }; handler?: THandler; } @@ -263,12 +263,12 @@ export interface WSConnectOptions { } export type TClientConstructor = - { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } | - { Client: { new (output: TTransport, pClass: { new (trans: TTransport): TProtocol }): TClient; } }; + { new(output: TTransport, pClass: { new(trans: TTransport): TProtocol }): TClient; } | + { Client: { new(output: TTransport, pClass: { new(trans: TTransport): TProtocol }): TClient; } }; export type TProcessorConstructor = - { new (handler: THandler): TProcessor } | - { Processor: { new (handler: THandler): TProcessor }}; + { new(handler: THandler): TProcessor } | + { Processor: { new(handler: THandler): TProcessor } }; export interface WebServerOptions { services: { @@ -361,7 +361,7 @@ export class TFramedTransport implements TTransport { } export interface TTransportConstructor { - new (buffer?: Buffer, callback?: TTransportCallback): TTransport; + new(buffer?: Buffer, callback?: TTransportCallback): TTransport; } export class TBinaryProtocol implements TProtocol { @@ -509,7 +509,7 @@ export class TCompactProtocol implements TProtocol { } export interface TProtocolConstructor { - new (trans: TTransport, strictRead?: boolean, strictWrite?: boolean): TProtocol; + new(trans: TTransport, strictRead?: boolean, strictWrite?: boolean): TProtocol; } // thrift.js diff --git a/types/tile-reduce/tile-reduce-tests.ts b/types/tile-reduce/tile-reduce-tests.ts index f8f22adfac..38e6cfcf17 100644 --- a/types/tile-reduce/tile-reduce-tests.ts +++ b/types/tile-reduce/tile-reduce-tests.ts @@ -1,4 +1,4 @@ -import * as tilereduce from 'tile-reduce' +import tilereduce = require('tile-reduce'); import { BBox, Tile, Source, Types } from 'tile-reduce' global.mapOptions diff --git a/types/timer-machine/timer-machine-tests.ts b/types/timer-machine/timer-machine-tests.ts index 5163fd9af8..e062634367 100644 --- a/types/timer-machine/timer-machine-tests.ts +++ b/types/timer-machine/timer-machine-tests.ts @@ -1,4 +1,4 @@ -import * as Timer from "timer-machine"; +import Timer = require("timer-machine"); let myTimer = new Timer(); diff --git a/types/tinymce/index.d.ts b/types/tinymce/index.d.ts index 3719b35784..d342e13647 100644 --- a/types/tinymce/index.d.ts +++ b/types/tinymce/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for TinyMCE 4.5 // Project: https://github.com/tinymce/tinymce -// Definitions by: Martin Duparc , Poul Poulsen +// Definitions by: Martin Duparc +// Poul Poulsen +// Nico Hartto // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -53,7 +55,31 @@ export function walk(o: {}, f: () => void, n?: string, s?: string): void; export function init(settings: Settings): void; export interface Settings { - table_toolbar?: boolean; + table_toolbar?: string; + + table_appearance_options?: boolean; + + table_clone_elements?: string; + + table_grid?: boolean; + + table_tab_navigation?: boolean; + + table_default_attributes?: object | string; + + table_default_styles?: object | string; + + table_class_list?: object[]; + + table_cell_class_list?: object[]; + + table_row_class_list?: object[]; + + table_advtab?: boolean; + + table_cell_advtab?: boolean; + + table_row_advtab?: boolean; auto_focus?: string; diff --git a/types/tinymce/tinymce-tests.ts b/types/tinymce/tinymce-tests.ts index 2b32824349..d6bda504cd 100644 --- a/types/tinymce/tinymce-tests.ts +++ b/types/tinymce/tinymce-tests.ts @@ -1,14 +1,14 @@ import * as tinymce from 'tinymce'; -tinymce.init({ +const settings: tinymce.Settings = { selector: 'textarea', height: 500, menubar: false, plugins: [ - 'advlist autolink lists link image charmap print preview anchor', - 'searchreplace visualblocks code fullscreen', - 'insertdatetime media table contextmenu paste code', - 'autosave imagetools' + 'advlist autolink lists link image charmap print preview anchor', + 'searchreplace visualblocks code fullscreen', + 'insertdatetime media table contextmenu paste code', + 'autosave imagetools' ], autosave_ask_before_unload: false, autosave_interval: "20s", @@ -18,7 +18,38 @@ tinymce.init({ toolbar: 'undo redo | insert | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image', content_css: '//www.tinymce.com/css/codepen.min.css', imagetools_cors_hosts: ['mydomain.com', 'otherdomain.com'], - imagetools_proxy: "proxy.php" -}); + imagetools_proxy: "proxy.php", + table_toolbar: "tableprops tabledelete | tableinsertrowbefore tableinsertrowafter tabledeleterow | tableinsertcolbefore tableinsertcolafter tabledeletecol", + table_appearance_options: false, + table_clone_elements: "strong em a", + table_grid: false, + table_tab_navigation: false, + table_default_attributes: { + title: 'My table' + }, + table_default_styles: { + fontWeight: 'bold' + }, + table_class_list: [ + {title: 'None', value: ''}, + {title: 'Dog', value: 'dog'}, + {title: 'Cat', value: 'cat'} + ], + table_cell_class_list: [ + {title: 'None', value: ''}, + {title: 'Dog', value: 'dog'}, + {title: 'Cat', value: 'cat'} + ], + table_row_class_list: [ + {title: 'None', value: ''}, + {title: 'Dog', value: 'dog'}, + {title: 'Cat', value: 'cat'} + ], + table_advtab: false, + table_cell_advtab: false, + table_row_advtab: false, +}; + +tinymce.init(settings); const t = new tinymce.util.Color('#FFFFFF'); diff --git a/types/to-absolute-glob/tsconfig.json b/types/to-absolute-glob/tsconfig.json index a143fec271..52294f500d 100644 --- a/types/to-absolute-glob/tsconfig.json +++ b/types/to-absolute-glob/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "to-absolute-glob-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/to-markdown/to-markdown-tests.ts b/types/to-markdown/to-markdown-tests.ts index 6c21bf1740..f50f348bc8 100644 --- a/types/to-markdown/to-markdown-tests.ts +++ b/types/to-markdown/to-markdown-tests.ts @@ -1,4 +1,4 @@ -import * as toMarkdown from 'to-markdown'; +import toMarkdown = require('to-markdown'); // toMarkdown() toMarkdown(` diff --git a/types/tocktimer/tocktimer-tests.ts b/types/tocktimer/tocktimer-tests.ts index 85f911b8a9..e2d7cb0bf5 100644 --- a/types/tocktimer/tocktimer-tests.ts +++ b/types/tocktimer/tocktimer-tests.ts @@ -1,4 +1,4 @@ -import * as tock from 'tocktimer'; +import tock = require('tocktimer'); let timer: tock.Tock; diff --git a/types/torrent-stream/torrent-stream-tests.ts b/types/torrent-stream/torrent-stream-tests.ts index 2b41b2e744..a8286da683 100644 --- a/types/torrent-stream/torrent-stream-tests.ts +++ b/types/torrent-stream/torrent-stream-tests.ts @@ -1,4 +1,4 @@ -import * as torrentStream from "torrent-stream"; +import torrentStream = require("torrent-stream"); let engine: TorrentStream.TorrentEngine = torrentStream("magnet"); console.log(engine.swarm.downloaded) diff --git a/types/touch/touch-tests.ts b/types/touch/touch-tests.ts index d41ad7b6b9..f843b4c465 100644 --- a/types/touch/touch-tests.ts +++ b/types/touch/touch-tests.ts @@ -1,4 +1,4 @@ -import * as touch from 'touch'; +import touch = require('touch'); // type value definitions const boolVal = true; diff --git a/types/trash/tsconfig.json b/types/trash/tsconfig.json index 92b58c4679..98e9a458d1 100644 --- a/types/trash/tsconfig.json +++ b/types/trash/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "trash-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/twilio/twilio-tests.ts b/types/twilio/twilio-tests.ts index 2a653af584..33a691eac0 100644 --- a/types/twilio/twilio-tests.ts +++ b/types/twilio/twilio-tests.ts @@ -1,4 +1,4 @@ -import * as twilio from 'twilio'; +import twilio = require('twilio'); import * as Express from "express"; // Examples taken from https://twilio.github.io/twilio-node/ (v2.1.0) diff --git a/types/twit/twit-tests.ts b/types/twit/twit-tests.ts index c74f5d6855..1029bda13c 100644 --- a/types/twit/twit-tests.ts +++ b/types/twit/twit-tests.ts @@ -1,4 +1,4 @@ -import * as Twit from 'twit'; +import Twit = require('twit'); const t = new Twit( { consumer_key: '', diff --git a/types/twitter-stream-channels/twitter-stream-channels-tests.ts b/types/twitter-stream-channels/twitter-stream-channels-tests.ts index 6943356cf7..88810aa0cc 100644 --- a/types/twitter-stream-channels/twitter-stream-channels-tests.ts +++ b/types/twitter-stream-channels/twitter-stream-channels-tests.ts @@ -1,4 +1,4 @@ -import * as TwitterStreamChannels from "twitter-stream-channels"; +import TwitterStreamChannels = require("twitter-stream-channels"); const tsc = new TwitterStreamChannels({ consumer_key: '', diff --git a/types/twix/twix-tests.ts b/types/twix/twix-tests.ts index e45d706635..dc4ba2c878 100644 --- a/types/twix/twix-tests.ts +++ b/types/twix/twix-tests.ts @@ -1,6 +1,4 @@ - - -import * as moment from 'moment'; +import moment = require('moment'); var someMoment = moment("20111031", "YYYYMMDD"); var otherMoment = moment("20120620", "YYYYMMDD"); diff --git a/types/type-detect/v0/tsconfig.json b/types/type-detect/v0/tsconfig.json index 7c02f53075..bae202904b 100644 --- a/types/type-detect/v0/tsconfig.json +++ b/types/type-detect/v0/tsconfig.json @@ -13,7 +13,9 @@ "../../" ], "paths": { - "type-detect": [ "type-detect/v0" ] + "type-detect": [ + "type-detect/v0" + ] }, "types": [], "noEmit": true, diff --git a/types/typedarray-pool/typedarray-pool-tests.ts b/types/typedarray-pool/typedarray-pool-tests.ts index de33cacb75..871bfdc72e 100644 --- a/types/typedarray-pool/typedarray-pool-tests.ts +++ b/types/typedarray-pool/typedarray-pool-tests.ts @@ -1,5 +1,5 @@ import * as pool from 'typedarray-pool'; -import * as tape from 'tape'; +import tape = require('tape'); tape("typedarray-pool", function(t) { diff --git a/types/tz-format/tz-format-tests.ts b/types/tz-format/tz-format-tests.ts index 729505ab57..7049fbd7f6 100644 --- a/types/tz-format/tz-format-tests.ts +++ b/types/tz-format/tz-format-tests.ts @@ -1,4 +1,4 @@ -import * as format from 'tz-format'; +import format = require('tz-format'); format(); format(1); diff --git a/types/uid-safe/uid-safe-tests.ts b/types/uid-safe/uid-safe-tests.ts index 6af969ce60..6eb4bc274a 100644 --- a/types/uid-safe/uid-safe-tests.ts +++ b/types/uid-safe/uid-safe-tests.ts @@ -1,12 +1,12 @@ -import * as uid from 'uid-safe'; +import uid = require('uid-safe'); uid(18, function (err, string) { if (err) throw err - // do something with the string + // do something with the string }); uid(18).then(function (string) { - // do something with the string + // do something with the string }) var string = uid.sync(18); diff --git a/types/uinput/tsconfig.json b/types/uinput/tsconfig.json index 3114301619..8caa0180e4 100644 --- a/types/uinput/tsconfig.json +++ b/types/uinput/tsconfig.json @@ -1,23 +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", - "uinput-tests.ts" - ] -} + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "uinput-tests.ts" + ] +} \ No newline at end of file diff --git a/types/ultra-strftime/ultra-strftime-tests.ts b/types/ultra-strftime/ultra-strftime-tests.ts index 4439425663..b45cfb7fd8 100644 --- a/types/ultra-strftime/ultra-strftime-tests.ts +++ b/types/ultra-strftime/ultra-strftime-tests.ts @@ -1,4 +1,4 @@ -import * as strftime from "ultra-strftime"; +import strftime = require("ultra-strftime"); const it_IT = { days: ['domenica', 'lunedi', 'martedi', 'mercoledi', 'giovedi', 'venerdi', 'sabato'], diff --git a/types/umzug/umzug-tests.ts b/types/umzug/umzug-tests.ts index fad7b11427..95ccf15665 100644 --- a/types/umzug/umzug-tests.ts +++ b/types/umzug/umzug-tests.ts @@ -1,5 +1,5 @@ -import * as Umzug from 'umzug'; -import * as Sequelize from 'sequelize'; +import Umzug = require('umzug'); +import Sequelize = require('sequelize'); let someVar: Umzug.Umzug; const umzug = new Umzug({}); diff --git a/types/underscore/tsconfig.json b/types/underscore/tsconfig.json index 806e81d1ad..4bbbc86417 100644 --- a/types/underscore/tsconfig.json +++ b/types/underscore/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "underscore-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/undertaker-registry/undertaker-registry-tests.ts b/types/undertaker-registry/undertaker-registry-tests.ts index 4a6201c14f..6c1e58948a 100644 --- a/types/undertaker-registry/undertaker-registry-tests.ts +++ b/types/undertaker-registry/undertaker-registry-tests.ts @@ -1,4 +1,4 @@ -import * as UndertakerRegistry from "undertaker-registry"; +import UndertakerRegistry = require("undertaker-registry"); const ArgTask = (firstArg: string, secondArg: number) => { // Task diff --git a/types/undertaker/undertaker-tests.ts b/types/undertaker/undertaker-tests.ts index d9ec56255e..d4db785245 100644 --- a/types/undertaker/undertaker-tests.ts +++ b/types/undertaker/undertaker-tests.ts @@ -1,7 +1,7 @@ /// import * as fs from "fs"; -import * as Undertaker from "undertaker"; -import * as Registry from "undertaker-registry"; +import Undertaker = require("undertaker"); +import Registry = require("undertaker-registry"); const taker = new Undertaker(); diff --git a/types/uniqid/uniqid-tests.ts b/types/uniqid/uniqid-tests.ts index f0f56aa2fd..b2a195ea79 100644 --- a/types/uniqid/uniqid-tests.ts +++ b/types/uniqid/uniqid-tests.ts @@ -1,4 +1,4 @@ -import * as uniqid from "uniqid"; +import uniqid = require("uniqid"); const uniqueID = uniqid("123"); const processString = uniqid.process("123"); diff --git a/types/universal-analytics/universal-analytics-tests.ts b/types/universal-analytics/universal-analytics-tests.ts index a81f728179..1d2e2426c6 100644 --- a/types/universal-analytics/universal-analytics-tests.ts +++ b/types/universal-analytics/universal-analytics-tests.ts @@ -1,6 +1,5 @@ -import * as ua from 'universal-analytics'; - -import * as express from 'express'; +import ua = require('universal-analytics'); +import express = require('express'); const app = express(); let visitor = ua('UA-XXXX-XX'); diff --git a/types/unzipper/tsconfig.json b/types/unzipper/tsconfig.json index d117b8eb1f..a41980ad8f 100644 --- a/types/unzipper/tsconfig.json +++ b/types/unzipper/tsconfig.json @@ -1,23 +1,23 @@ { - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "unzipper-tests.ts" - ] -} + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "unzipper-tests.ts" + ] +} \ No newline at end of file diff --git a/types/update-notifier/v1/tsconfig.json b/types/update-notifier/v1/tsconfig.json index d932c9656f..9f2a8e1504 100644 --- a/types/update-notifier/v1/tsconfig.json +++ b/types/update-notifier/v1/tsconfig.json @@ -17,11 +17,13 @@ "noEmit": true, "forceConsistentCasingInFileNames": true, "paths": { - "update-notifier": ["update-notifier/v1"] + "update-notifier": [ + "update-notifier/v1" + ] } }, "files": [ "index.d.ts", "update-notifier-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/upng-js/tsconfig.json b/types/upng-js/tsconfig.json index e6499c55f2..d038a0bfc4 100644 --- a/types/upng-js/tsconfig.json +++ b/types/upng-js/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "upng-js-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/uppercamelcase/uppercamelcase-tests.ts b/types/uppercamelcase/uppercamelcase-tests.ts index fbb178c2fa..9af952ccda 100644 --- a/types/uppercamelcase/uppercamelcase-tests.ts +++ b/types/uppercamelcase/uppercamelcase-tests.ts @@ -1,4 +1,4 @@ -import * as upperCamelCase from 'uppercamelcase'; +import upperCamelCase = require('uppercamelcase'); upperCamelCase('foo-bar'); upperCamelCase('foo_bar'); diff --git a/types/urijs/index.d.ts b/types/urijs/index.d.ts index 64d048a6a7..61f1887948 100644 --- a/types/urijs/index.d.ts +++ b/types/urijs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for URI.js 1.15.1 // Project: https://github.com/medialize/URI.js -// Definitions by: RodneyJT , Brian Surowiec +// Definitions by: RodneyJT , Brian Surowiec , Pete Johanson // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -234,6 +234,19 @@ declare namespace uri { withinString(source: string, func: (url: string) => string): string; } + type URITemplateValue = string | ReadonlyArray | { [key: string] : string } | undefined | null; + type URITemplateCallback = (keyName: string) => URITemplateValue; + type URITemplateInput = { [key: string]: URITemplateValue | URITemplateCallback } | URITemplateCallback; + + interface URITemplate { + expand(data: URITemplateInput, opts?: Object) : URI; + } + + interface URITemplateStatic { + (template: string) : URITemplate; + + new (template: string) : URITemplate; + } } interface JQuery { @@ -241,6 +254,7 @@ interface JQuery { } declare var URI: uri.URIStatic; +declare var URITemplate : uri.URITemplateStatic; declare module 'URI' { export = URI; @@ -251,5 +265,5 @@ declare module 'urijs' { } declare module 'urijs/src/URITemplate' { - export = URI; + export = URITemplate; } diff --git a/types/urijs/urijs-tests.ts b/types/urijs/urijs-tests.ts index f520f0eaca..231879b94d 100644 --- a/types/urijs/urijs-tests.ts +++ b/types/urijs/urijs-tests.ts @@ -65,6 +65,44 @@ URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( }) ); +// Basic URITemplate type usage +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand({ + p: ["foo", "bar.html"], + q: {foo: "bar", bar: "baz"}, + h: "frag" + }) +); + +// Using a callback for a specific key value. +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand({ + p: (key) => ["foo", "bar.html"], + q: {foo: "bar", bar: "baz"}, + h: "frag" + }) +); + +// Using a callback for entire data parameter. +URI('http://user:pass@example.org:80/foo/bar.html?foo=bar&bar=baz#frag').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand((key) => { + switch(key) { + case 'p': return ["foo", "bar.html"]; + case '1': return {foo: "bar", bar: "baz"}; + case 'h': return "frag"; + } + }) +); + +// Supports null/undefined values for certain keys +URI('http://user:pass@example.org:80/foo/bar.html').equals( + URITemplate('http://user:pass@example.org:80{/p*}{?q*}{#h}').expand({ + p: ["foo", "bar.html"], + q: null, + h: undefined + }) +); + /* Tests for hasSearch(), hasQuery() From: http://medialize.github.io/URI.js/docs.html#search-has diff --git a/types/url-join/url-join-tests.ts b/types/url-join/url-join-tests.ts index 2b512bc6d4..5a4afd6b80 100644 --- a/types/url-join/url-join-tests.ts +++ b/types/url-join/url-join-tests.ts @@ -1,5 +1,5 @@ import urljoin = require("url-join"); -import * as urljoin2 from "url-join"; +import urljoin2 = require("url-join"); const s: string = urljoin("foo", "bar", "baz"); const s2: string = urljoin2("foo", "bar", "baz"); diff --git a/types/url-metadata/tsconfig.json b/types/url-metadata/tsconfig.json index e12ebe2932..60f06925f1 100644 --- a/types/url-metadata/tsconfig.json +++ b/types/url-metadata/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "url-metadata-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/url-metadata/url-metadata-tests.ts b/types/url-metadata/url-metadata-tests.ts index ab45090783..6024c5a0e7 100644 --- a/types/url-metadata/url-metadata-tests.ts +++ b/types/url-metadata/url-metadata-tests.ts @@ -1,4 +1,4 @@ -import * as urlMetadata from "url-metadata"; +import urlMetadata = require("url-metadata"); const opts: urlMetadata.Options = { userAgent: "url-metadata-test", diff --git a/types/urllib/README.md b/types/urllib/README.md new file mode 100644 index 0000000000..36acda5c50 --- /dev/null +++ b/types/urllib/README.md @@ -0,0 +1,29 @@ +# DefinitelyTyped for Urllib + +## Current Urllib Version +`v2.25.4` +## Usage + +```bash +npm install --save-dev @types/urllib +``` + +example: +```ts +import * as urllib from "."; + +urllib.curl('https://example.test.com', { + method: "GET", + data: { + test: 'test', + } +}) +``` +## License +MIT + +## dependencies +`@types/node` + +## Author +[SoraYama](https://github.com/sorayama) diff --git a/types/urllib/index.d.ts b/types/urllib/index.d.ts new file mode 100644 index 0000000000..c6a6f6a46e --- /dev/null +++ b/types/urllib/index.d.ts @@ -0,0 +1,236 @@ +// Type definitions for urllib 2.25 +// Project: http://github.com/node-modules/urllib +// Definitions by: SoraYama +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import 'node'; +import * as https from 'https'; +import * as http from 'http'; +import * as url from 'url'; +import { Readable, Writable } from 'stream'; +import { EventEmitter } from 'events'; + +export as namespace urllib; +export interface RequestOptions { + /** Request method, defaults to GET. Could be GET, POST, DELETE or PUT. Alias 'type'. */ + method?: "GET" | "POST" | "DELETE" | "PUT"; + /** Data to be sent. Will be stringify automatically. */ + data?: any; + /** Force convert data to query string. */ + dataAsQueryString?: boolean; + /** Manually set the content of payload. If set, data will be ignored. */ + content?: string | Buffer; + /** Stream to be pipe to the remote.If set, data and content will be ignored. */ + stream?: Readable; + /** + * A writable stream to be piped by the response stream. + * Responding data will be write to this stream and callback + * will be called with data set null after finished writing. + */ + writeStream?: Writable; + /** consume the writeStream, invoke the callback after writeStream close. */ + consumeWriteStream?: boolean; + /** Type of request data.Could be json.If it's json, will auto set Content-Type: application/json header. */ + contentType?: string; + /** + * urllib default use querystring to stringify form data which don't support nested object, + * will use qs instead of querystring to support nested object by set this option to true. + */ + nestedQuerystring?: boolean; + /** + * Type of response data. Could be text or json. + * If it's text, the callbacked data would be a String. + * If it's json, the data of callback would be a parsed JSON Object + * and will auto set Accept: application/json header. Default callbacked data would be a Buffer. + */ + dataType?: string; + /** Fix the control characters (U+0000 through U+001F) before JSON parse response. Default is false. */ + fixJSONCtlChars?: boolean; + /** Request headers. */ + headers?: { [key: string]: any }; + /** + * Request timeout in milliseconds for connecting phase and response receiving phase. + * Defaults to exports. + * TIMEOUT, both are 5s.You can use timeout: 5000 to tell urllib use same timeout on two phase or set them seperately such as + * timeout: [3000, 5000], which will set connecting timeout to 3s and response 5s. + */ + timeout?: number | number[]; + /** username:password used in HTTP Basic Authorization. */ + auth?: string; + /** username:password used in HTTP Digest Authorization. */ + digestAuth?: string; + /** HTTP Agent object.Set false if you does not use agent. */ + agent?: http.Agent; + /** HTTPS Agent object. Set false if you does not use agent. */ + httpsAgent?: https.Agent; + /** + * An array of strings or Buffers of trusted certificates. + * If this is omitted several well known "root" CAs will be used, like VeriSign. + * These are used to authorize connections. + * Notes: This is necessary only if the server uses the self - signed certificate + */ + ca?: string | Buffer | string[] | Buffer[]; + /** + * If true, the server certificate is verified against the list of supplied CAs. + * An 'error' event is emitted if verification fails.Default: true. + */ + rejectUnauthorized?: boolean; + /** A string or Buffer containing the private key, certificate and CA certs of the server in PFX or PKCS12 format. */ + pfx?: string | Buffer; + /** + * A string or Buffer containing the private key of the client in PEM format. + * Notes: This is necessary only if using the client certificate authentication + */ + key?: string | Buffer; + /** + * A string or Buffer containing the certificate key of the client in PEM format. + * Notes: This is necessary only if using the client certificate authentication + */ + cert?: string | Buffer; + /** A string of passphrase for the private key or pfx. */ + passphrase?: string; + /** A string describing the ciphers to use or exclude. */ + ciphers?: string; + /** The SSL method to use, e.g.SSLv3_method to force SSL version 3. */ + secureProtocol?: string; + /** follow HTTP 3xx responses as redirects. defaults to false. */ + followRedirect?: boolean; + /** The maximum number of redirects to follow, defaults to 10. */ + maxRedirects?: number; + /** Format the redirect url by your self. Default is url.resolve(from, to). */ + formatRedirectUrl?: (a: any, b: any) => void; + /** Before request hook, you can change every thing here. */ + beforeRequest?: (...args: any[]) => void; + /** let you get the res object when request connected, default false. alias customResponse */ + streaming?: boolean; + /** Accept gzip response content and auto decode it, default is false. */ + gzip?: boolean; + /** Enable timing or not, default is false. */ + timing?: boolean; + /** Enable proxy request, default is false. */ + enableProxy?: boolean; + /** proxy agent uri or options, default is null. */ + proxy?: string | { [key: string]: any }; +} + +/** + * @param data Outgoing message + * @param res http response + */ +export type Callback = (err: Error, data: any, res: http.IncomingMessage) => void; + +/** + * Handle all http request, both http and https support well. + * + * @example + * // GET http://httptest.cnodejs.net + * urllib.request('http://httptest.cnodejs.net/test/get', function(err, data, res) {}); + * // POST http://httptest.cnodejs.net + * var args = { type: 'post', data: { foo: 'bar' } }; + * urllib.request('http://httptest.cnodejs.net/test/post', args, function(err, data, res) {}); + * + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function request(url: string | url.URL, options?: RequestOptions): Promise; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function request(url: string | url.URL, callback: Callback): void; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function request(url: string | url.URL, options: RequestOptions, callback: Callback): void; + +/** + * Handle request with a callback. + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function requestWithCallback(url: string | url.URL, callback: Callback): void; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function requestWithCallback(url: string | url.URL, options: RequestOptions, callback: Callback): void; + +/** + * yield urllib.requestThunk(url, args) + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function requestThunk(url: string | url.URL, options?: RequestOptions): (callback: (...args: any[]) => void) => void; + +/** + * alias to request. + * Handle all http request, both http and https support well. + * + * @example + * // GET http://httptest.cnodejs.net + * urllib.request('http://httptest.cnodejs.net/test/get', function(err, data, res) {}); + * // POST http://httptest.cnodejs.net + * var args = { type: 'post', data: { foo: 'bar' } }; + * urllib.request('http://httptest.cnodejs.net/test/post', args, function(err, data, res) {}); + * + * @param url The URL to request, either a String or a Object that return by url.parse. + * @param options Optional, @see RequestOptions. + */ +export function curl(url: string | url.URL, options?: RequestOptions): Promise; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function curl(url: string | url.URL, callback: Callback): void; +/** + * @param url The URL to request, either a String or a Object that return by url.parse. + */ +export function curl(url: string | url.URL, options: RequestOptions, callback: Callback): void; +/** + * The default request timeout(in milliseconds). + */ +export const TIMEOUT: number; +/** + * The default request & response timeout(in milliseconds). + */ +export const TIMEOUTS: [number, number]; + +/** + * Request user agent. + */ +export const USER_AGENT: string; + +/** + * Request http agent. + */ +export const agent: http.Agent; + +/** + * Request https agent. + */ +export const httpsAgent: https.Agent; + +export class HttpClient extends EventEmitter { + constructor(options?: RequestOptions); + + request(url: string | url.URL, callback: Callback): void; + request(url: string | url.URL, options: RequestOptions, callback: Callback): void; + + curl(url: string | url.URL, callback: Callback): void; + curl(url: string | url.URL, options: RequestOptions, callback: Callback): void; + + requestThunk(url: string | url.URL, options?: RequestOptions): (callback: (...args: any[]) => void) => void; +} + +/** + * request method only return a promise, + * compatible with async/await and generator in co. + */ +export class HttpClient2 extends EventEmitter { + constructor(options?: RequestOptions); + + request(url: string | url.URL, options?: RequestOptions): Promise; + + curl(url: string | url.URL, options?: RequestOptions): Promise; + + requestThunk(url: string | url.URL, options?: RequestOptions): (callback: (...args: any[]) => void) => void; +} + +/** + * Create a HttpClient instance. + */ +export function create(options?: RequestOptions): HttpClient; diff --git a/types/urllib/tsconfig.json b/types/urllib/tsconfig.json new file mode 100644 index 0000000000..2787b1459e --- /dev/null +++ b/types/urllib/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "esModuleInterop": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "urllib-tests.ts" + ] +} diff --git a/types/urllib/tslint.json b/types/urllib/tslint.json new file mode 100644 index 0000000000..d88586e5bd --- /dev/null +++ b/types/urllib/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/urllib/urllib-tests.ts b/types/urllib/urllib-tests.ts new file mode 100644 index 0000000000..cd15b42c8f --- /dev/null +++ b/types/urllib/urllib-tests.ts @@ -0,0 +1,8 @@ +import * as urllib from "urllib"; + +urllib.curl('https://example.test.com', { + method: "GET", + data: { + test: 'test', + } +}); diff --git a/types/vali-date/tsconfig.json b/types/vali-date/tsconfig.json index 8e27969380..b3097ec0ab 100644 --- a/types/vali-date/tsconfig.json +++ b/types/vali-date/tsconfig.json @@ -22,4 +22,4 @@ "index.d.ts", "vali-date-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/vali-date/vali-date-tests.ts b/types/vali-date/vali-date-tests.ts index 85a3e39bc5..53fd102a15 100644 --- a/types/vali-date/vali-date-tests.ts +++ b/types/vali-date/vali-date-tests.ts @@ -1,4 +1,4 @@ -import * as valiDate from 'vali-date'; +import valiDate = require('vali-date'); valiDate('foo'); valiDate('bar'); diff --git a/types/validatorjs/validatorjs-tests.ts b/types/validatorjs/validatorjs-tests.ts index c8094936b7..4eb24ed6bd 100644 --- a/types/validatorjs/validatorjs-tests.ts +++ b/types/validatorjs/validatorjs-tests.ts @@ -1,4 +1,4 @@ -import * as Validator from "validatorjs" +import Validator = require("validatorjs"); var rules: any = { foo: "required" diff --git a/types/vanilla-modal/tsconfig.json b/types/vanilla-modal/tsconfig.json index f6d7663c4f..72925ecc29 100644 --- a/types/vanilla-modal/tsconfig.json +++ b/types/vanilla-modal/tsconfig.json @@ -15,10 +15,10 @@ ], "types": [], "noEmit": true, - "forceConsistentCasingInFileNames" : true + "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", "vanilla-modal-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/vanilla-tilt/index.d.ts b/types/vanilla-tilt/index.d.ts index e24208f563..5f4c80a783 100644 --- a/types/vanilla-tilt/index.d.ts +++ b/types/vanilla-tilt/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for vanilla-tilt 1.3 +// Type definitions for vanilla-tilt 1.4 // Project: https://github.com/micku7zu/vanilla-tilt.js // Definitions by: Livio Brunner // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -47,6 +47,19 @@ export namespace VanillaTilt { * Easing on enter/exit. */ easing?: string; + /** + * if it should have a "glare" effect + */ + glare?: boolean; + /** + * the maximum "glare" opacity + */ + "max-glare"?: number; + /** + * false = VanillaTilt creates the glare elements for you, otherwise + * you need to add .js-tilt-glare>.js-tilt-glare-inner by yourself + */ + "glare-prerender"?: boolean; } interface TiltValues { diff --git a/types/vanilla-tilt/vanilla-tilt-tests.ts b/types/vanilla-tilt/vanilla-tilt-tests.ts index c40bd56f75..52520dcfcc 100644 --- a/types/vanilla-tilt/vanilla-tilt-tests.ts +++ b/types/vanilla-tilt/vanilla-tilt-tests.ts @@ -8,7 +8,10 @@ const element: VanillaTilt = new VanillaTilt(document.createElement('a'), { reset: true, reverse: true, scale: 2, - speed: 200 + speed: 200, + glare: true, + "max-glare": 1, + "glare-prerender": true, }); VanillaTilt.init(document.createElement('a'), { diff --git a/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts b/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts index e4b7ed7e67..377c075879 100644 --- a/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts +++ b/types/vertx3-eventbus-client/vertx3-eventbus-client-tests.ts @@ -1,3 +1,3 @@ -import * as EventBus from "vertx3-eventbus-client"; +import EventBus = require("vertx3-eventbus-client"); const eb = new EventBus("http://localhost:9999"); diff --git a/types/vfile-location/tsconfig.json b/types/vfile-location/tsconfig.json index 92cec7ddc0..4b6325d09e 100644 --- a/types/vfile-location/tsconfig.json +++ b/types/vfile-location/tsconfig.json @@ -1,16 +1,23 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": ["index.d.ts", "vfile-location-tests.ts"] -} + "files": [ + "index.d.ts", + "vfile-location-tests.ts" + ] +} \ No newline at end of file diff --git a/types/victory/index.d.ts b/types/victory/index.d.ts index b41fb96068..0c7f756b26 100644 --- a/types/victory/index.d.ts +++ b/types/victory/index.d.ts @@ -4,7 +4,7 @@ // snerks // Krzysztof Cebula // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/video.js/video.js-tests.ts b/types/video.js/video.js-tests.ts index 145be6c711..287b804e14 100644 --- a/types/video.js/video.js-tests.ts +++ b/types/video.js/video.js-tests.ts @@ -1,6 +1,4 @@ -// Tests for Video.js API - -import * as videojs from 'video.js'; +import videojs = require('video.js'); videojs("example_video_1").ready(function() { // EXAMPLE: Start playing the video. diff --git a/types/vimeo__player/index.d.ts b/types/vimeo__player/index.d.ts index 3712e20cf7..c2699d15d2 100755 --- a/types/vimeo__player/index.d.ts +++ b/types/vimeo__player/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for @vimeo/player 2.0 // Project: https://github.com/vimeo/player.js -// Definitions by: Denis Yılmaz , Felix Albert +// Definitions by: Denis Yılmaz +// Felix Albert +// Tim Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export function myMethod(a: string): string; @@ -23,7 +25,7 @@ export interface TypeError extends Error {name: "TypeError"; message: string; me export type EventName = "play" | "pause" | "ended" | "timeupdate" | "progress" | "seeked" | "texttrackchange" | "cuechange" | "cuepoint" | "volumechange" | "error" | "loaded" | string; export type EventCallback = (data: any) => any; -export class Player { +export default class Player { constructor(element: HTMLIFrameElement|HTMLElement|string, options: Options); on(event: EventName, callback: EventCallback): void; diff --git a/types/vimeo__player/vimeo__player-tests.ts b/types/vimeo__player/vimeo__player-tests.ts index 622d5ca339..bf5a637762 100644 --- a/types/vimeo__player/vimeo__player-tests.ts +++ b/types/vimeo__player/vimeo__player-tests.ts @@ -1,4 +1,4 @@ -import { Player } from '@vimeo/player'; +import Player from '@vimeo/player'; // based on README.md of @vimeo/player >> https://github.com/vimeo/player.js diff --git a/types/vinyl/vinyl-tests.ts b/types/vinyl/vinyl-tests.ts index 3a73249b60..77ef5d6d1b 100644 --- a/types/vinyl/vinyl-tests.ts +++ b/types/vinyl/vinyl-tests.ts @@ -2,7 +2,7 @@ import * as fs from 'fs'; import * as path from 'path'; -import * as expect from 'expect'; +import expect = require('expect'); const miss = require('mississippi'); const cloneable = require('cloneable-readable'); diff --git a/types/virtual-keyboard/virtual-keyboard-tests.ts b/types/virtual-keyboard/virtual-keyboard-tests.ts index 84e3c9ed3c..91deb9a7c9 100644 --- a/types/virtual-keyboard/virtual-keyboard-tests.ts +++ b/types/virtual-keyboard/virtual-keyboard-tests.ts @@ -1,4 +1,4 @@ -import * as jQuery from "jquery"; +import jQuery = require("jquery"); import { KeyboardOptions, NavigateOptions } from "virtual-keyboard"; const kbOptions: KeyboardOptions = { diff --git a/types/vis/index.d.ts b/types/vis/index.d.ts index 9c0adb0a97..e7ca718dab 100644 --- a/types/vis/index.d.ts +++ b/types/vis/index.d.ts @@ -290,7 +290,7 @@ export interface TimelineEventPropertiesResult { /** * The id of the clicked item. */ - item?: number | null; + item?: IdType | null; /** * Absolute horizontal position of the click event. diff --git a/types/vision/tsconfig.json b/types/vision/tsconfig.json index d00003dd52..594ecb91ae 100644 --- a/types/vision/tsconfig.json +++ b/types/vision/tsconfig.json @@ -14,7 +14,12 @@ ], "types": [], "paths": { - "boom": ["boom/v4"] + "boom": [ + "boom/v4" + ], + "hapi": [ + "hapi/v16" + ] }, "noEmit": true, "forceConsistentCasingInFileNames": true @@ -23,4 +28,4 @@ "index.d.ts", "vision-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/vitalsigns/vitalsigns-tests.ts b/types/vitalsigns/vitalsigns-tests.ts index 62cc2e5676..757b7099c5 100644 --- a/types/vitalsigns/vitalsigns-tests.ts +++ b/types/vitalsigns/vitalsigns-tests.ts @@ -1,4 +1,4 @@ -import * as express from "express"; +import express = require("express"); import VitalSigns = require("vitalsigns"); var vitals = new VitalSigns(); diff --git a/types/void-elements/index.d.ts b/types/void-elements/index.d.ts new file mode 100644 index 0000000000..855ac9d093 --- /dev/null +++ b/types/void-elements/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for void-elements 3.1 +// Project: https://github.com/jadejs/void-elements +// Definitions by: Klaus Meinhardt +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +declare const voidElements: Partial>; +export = voidElements; diff --git a/types/void-elements/tsconfig.json b/types/void-elements/tsconfig.json new file mode 100644 index 0000000000..469052dfe7 --- /dev/null +++ b/types/void-elements/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", + "void-elements-tests.ts" + ] +} \ No newline at end of file diff --git a/types/void-elements/tslint.json b/types/void-elements/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/void-elements/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } diff --git a/types/void-elements/void-elements-tests.ts b/types/void-elements/void-elements-tests.ts new file mode 100644 index 0000000000..74a462ada5 --- /dev/null +++ b/types/void-elements/void-elements-tests.ts @@ -0,0 +1,4 @@ +import * as voidElements from 'void-elements'; + +let isVoid: boolean | undefined = voidElements.span; +isVoid = voidElements.input; diff --git a/types/vue-scrollto/tsconfig.json b/types/vue-scrollto/tsconfig.json index fd030de5e6..720520bdac 100644 --- a/types/vue-scrollto/tsconfig.json +++ b/types/vue-scrollto/tsconfig.json @@ -3,7 +3,7 @@ "module": "commonjs", "lib": [ "es6", - "dom" + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -21,4 +21,4 @@ "index.d.ts", "vue-scrollto-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/w3c-image-capture/tsconfig.json b/types/w3c-image-capture/tsconfig.json index 1dc1d0ce51..d9d2c4b574 100644 --- a/types/w3c-image-capture/tsconfig.json +++ b/types/w3c-image-capture/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "w3c-image-capture-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/wampy/wampy-tests.ts b/types/wampy/wampy-tests.ts index 27dd90ed73..1d999fc7c6 100644 --- a/types/wampy/wampy-tests.ts +++ b/types/wampy/wampy-tests.ts @@ -1,4 +1,4 @@ -import * as Wampy from 'wampy'; +import Wampy = require('wampy'); declare var console: { log(...args: any[]): void }; let ws = new Wampy('http://wamp.router.url', {realm: 'WAMPRealm'}); diff --git a/types/warning/warning-tests.ts b/types/warning/warning-tests.ts index 7079e127f2..f85e3159c5 100644 --- a/types/warning/warning-tests.ts +++ b/types/warning/warning-tests.ts @@ -1,4 +1,4 @@ -import * as warning from "warning"; +import warning = require("warning"); // this will pass without warning. warning(true, 'Warning, read all about it'); diff --git a/types/weak/tsconfig.json b/types/weak/tsconfig.json index 33d1a4cdf3..1e75cff1e1 100644 --- a/types/weak/tsconfig.json +++ b/types/weak/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "weak-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/webpack-bundle-analyzer/index.d.ts b/types/webpack-bundle-analyzer/index.d.ts index c563a9e3cf..3f856a7328 100644 --- a/types/webpack-bundle-analyzer/index.d.ts +++ b/types/webpack-bundle-analyzer/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/th0r/webpack-bundle-analyzer // Definitions by: Michael Strobel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; diff --git a/types/webpack-chain/index.d.ts b/types/webpack-chain/index.d.ts index 6f6c46daa8..05aa4e5845 100644 --- a/types/webpack-chain/index.d.ts +++ b/types/webpack-chain/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mozilla-neutrino/webpack-chain // Definitions by: Eirikur Nilsson , Paul Sachs // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; import * as https from 'https'; diff --git a/types/webpack-chain/webpack-chain-tests.ts b/types/webpack-chain/webpack-chain-tests.ts index 07593687cf..bd83dfbccb 100644 --- a/types/webpack-chain/webpack-chain-tests.ts +++ b/types/webpack-chain/webpack-chain-tests.ts @@ -1,4 +1,4 @@ -import * as Config from 'webpack-chain'; +import Config = require('webpack-chain'); import * as webpack from 'webpack'; const config = new Config(); diff --git a/types/webpack-chunk-hash/index.d.ts b/types/webpack-chunk-hash/index.d.ts index dc8f697a44..f499a00dc9 100644 --- a/types/webpack-chunk-hash/index.d.ts +++ b/types/webpack-chunk-hash/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/alexindigo/webpack-chunk-hash#readme // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Plugin } from 'webpack'; export = WebpackChunkHash; -declare class WebpackChunkHash extends webpack.Plugin { +declare class WebpackChunkHash extends Plugin { constructor(options?: WebpackChunkHash.Options); } diff --git a/types/webpack-cleanup-plugin/index.d.ts b/types/webpack-cleanup-plugin/index.d.ts index f5fa620413..a6efd31af7 100644 --- a/types/webpack-cleanup-plugin/index.d.ts +++ b/types/webpack-cleanup-plugin/index.d.ts @@ -2,12 +2,12 @@ // Project: https://github.com/gpbl/webpack-cleanup-plugin#readme // Definitions by: Luka Maljic // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); - +import { Plugin } from 'webpack'; export = WebpackCleanupPlugin; -declare class WebpackCleanupPlugin extends webpack.Plugin { +declare class WebpackCleanupPlugin extends Plugin { constructor(options?: WebpackCleanupPlugin.Options); } diff --git a/types/webpack-cleanup-plugin/tsconfig.json b/types/webpack-cleanup-plugin/tsconfig.json index f2712d3d73..3e45140ded 100644 --- a/types/webpack-cleanup-plugin/tsconfig.json +++ b/types/webpack-cleanup-plugin/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "webpack-cleanup-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts b/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts index 8df4675595..179924ef66 100644 --- a/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts +++ b/types/webpack-dev-middleware/v1/webpack-dev-middleware-tests.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; -import * as webpack from 'webpack'; -import * as webpackDevMiddleware from 'webpack-dev-middleware'; +import express = require('express'); +import webpack = require('webpack'); +import webpackDevMiddleware = require('webpack-dev-middleware'); const compiler = webpack({}); diff --git a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts index 2ccfb90a0c..beb3c1abe6 100644 --- a/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts +++ b/types/webpack-dev-middleware/webpack-dev-middleware-tests.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; -import * as webpack from 'webpack'; -import * as webpackDevMiddleware from 'webpack-dev-middleware'; +import express = require('express'); +import webpack = require('webpack'); +import webpackDevMiddleware = require('webpack-dev-middleware'); const compiler = webpack({}); diff --git a/types/webpack-dev-server/webpack-dev-server-tests.ts b/types/webpack-dev-server/webpack-dev-server-tests.ts index e13babe83c..a288ea51be 100644 --- a/types/webpack-dev-server/webpack-dev-server-tests.ts +++ b/types/webpack-dev-server/webpack-dev-server-tests.ts @@ -1,5 +1,5 @@ -import * as webpack from 'webpack'; -import * as WebpackDevServer from 'webpack-dev-server'; +import webpack = require('webpack'); +import WebpackDevServer = require('webpack-dev-server'); import * as core from 'express-serve-static-core'; const compiler = webpack({}); const multipleCompiler = webpack([]); diff --git a/types/webpack-dotenv-plugin/index.d.ts b/types/webpack-dotenv-plugin/index.d.ts index 4200c3b15e..b8cfb33ef8 100644 --- a/types/webpack-dotenv-plugin/index.d.ts +++ b/types/webpack-dotenv-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/nwinch/webpack-dotenv-plugin#readme // Definitions by: Michael Strobel // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import * as webpack from 'webpack'; diff --git a/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts b/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts index 8ea3993d39..a757b7d718 100644 --- a/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts +++ b/types/webpack-dotenv-plugin/webpack-dotenv-plugin-tests.ts @@ -1,5 +1,5 @@ import * as webpack from 'webpack'; -import * as DotenvPlugin from 'webpack-dotenv-plugin'; +import DotenvPlugin = require('webpack-dotenv-plugin'); const config: webpack.Configuration = { plugins: [ diff --git a/types/webpack-fail-plugin/index.d.ts b/types/webpack-fail-plugin/index.d.ts index 04f037e084..2db28733c2 100644 --- a/types/webpack-fail-plugin/index.d.ts +++ b/types/webpack-fail-plugin/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/TiddoLangerak/webpack-fail-plugin // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts b/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts index e654d012d0..b87b379379 100644 --- a/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts +++ b/types/webpack-hot-middleware/webpack-hot-middleware-tests.ts @@ -1,6 +1,6 @@ -import * as express from 'express'; -import * as webpack from 'webpack'; -import * as webpackHotMiddleware from 'webpack-hot-middleware'; +import express = require('express'); +import webpack = require('webpack'); +import webpackHotMiddleware = require('webpack-hot-middleware'); const compiler = webpack({}); diff --git a/types/webpack-manifest-plugin/tsconfig.json b/types/webpack-manifest-plugin/tsconfig.json index 9ff3d85f05..bc7e4e0c08 100644 --- a/types/webpack-manifest-plugin/tsconfig.json +++ b/types/webpack-manifest-plugin/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "webpack-manifest-plugin-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/webpack-merge/index.d.ts b/types/webpack-merge/index.d.ts index 54c94a738e..23caff9575 100644 --- a/types/webpack-merge/index.d.ts +++ b/types/webpack-merge/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -import webpack = require('webpack'); +import { Configuration } from 'webpack'; export = webpackMerge; @@ -18,18 +18,18 @@ declare namespace webpackMerge { customizeArray?: CustomizeArrayFunction | UniqueFunction; customizeObject?: CustomizeObjectFunction; } - type ConfigurationMergeFunction = (...configs: webpack.Configuration[]) => webpack.Configuration; + type ConfigurationMergeFunction = (...configs: Configuration[]) => Configuration; type ConfigurationMergeConfigFunction = (customizeOptions: CustomizeOptions) => ConfigurationMergeFunction; type MergeFunction = ConfigurationMergeFunction | ConfigurationMergeConfigFunction; type MergeStrategy = 'prepend' | 'append' | 'replace'; interface WebpackMerge { - (...configs: webpack.Configuration[]): webpack.Configuration; + (...configs: Configuration[]): Configuration; (customizeOptions: CustomizeOptions): ConfigurationMergeFunction; unique: UniqueFunction; smart: ConfigurationMergeFunction; multiple: ConfigurationMergeFunction; - strategy(options: {[field: string]: MergeStrategy}): ConfigurationMergeFunction; - smartStrategy(options: {[key: string]: MergeStrategy}): ConfigurationMergeFunction; + strategy(options: { [field: string]: MergeStrategy }): ConfigurationMergeFunction; + smartStrategy(options: { [key: string]: MergeStrategy }): ConfigurationMergeFunction; } } diff --git a/types/webpack-merge/v0/index.d.ts b/types/webpack-merge/v0/index.d.ts index a939a2ed53..4cf82afd88 100644 --- a/types/webpack-merge/v0/index.d.ts +++ b/types/webpack-merge/v0/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/survivejs/webpack-merge // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-node-externals/index.d.ts b/types/webpack-node-externals/index.d.ts index 80dc73b27b..c93d3edecf 100644 --- a/types/webpack-node-externals/index.d.ts +++ b/types/webpack-node-externals/index.d.ts @@ -2,12 +2,13 @@ // Project: https://github.com/liady/webpack-node-externals // Definitions by: Matt Traynham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 -import webpack = require('webpack'); +import { ExternalsFunctionElement } from 'webpack'; export = webpackNodeExternals; -declare function webpackNodeExternals(options?: webpackNodeExternals.Options): webpack.ExternalsFunctionElement; +declare function webpackNodeExternals(options?: webpackNodeExternals.Options): ExternalsFunctionElement; declare namespace webpackNodeExternals { type WhitelistOption = string | RegExp; diff --git a/types/webpack-notifier/index.d.ts b/types/webpack-notifier/index.d.ts index 1b8e92651f..372b4f2b1c 100644 --- a/types/webpack-notifier/index.d.ts +++ b/types/webpack-notifier/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/Turbo87/webpack-notifier#readme // Definitions by: Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 import { Plugin } from 'webpack'; diff --git a/types/webpack-notifier/webpack-notifier-tests.ts b/types/webpack-notifier/webpack-notifier-tests.ts index f71fe5800f..ad73a10764 100644 --- a/types/webpack-notifier/webpack-notifier-tests.ts +++ b/types/webpack-notifier/webpack-notifier-tests.ts @@ -1,5 +1,5 @@ import { Plugin } from 'webpack'; -import * as WebpackNotifierPlugin from 'webpack-notifier'; +import WebpackNotifierPlugin = require('webpack-notifier'); const optionsArray: WebpackNotifierPlugin.Options[] = [ { diff --git a/types/webpack-stream/index.d.ts b/types/webpack-stream/index.d.ts index 41fbb3592b..19159f402d 100644 --- a/types/webpack-stream/index.d.ts +++ b/types/webpack-stream/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/shama/webpack-stream // Definitions by: Ian Clanton-Thuon , Benjamin Lim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack-stream/webpack-stream-tests.ts b/types/webpack-stream/webpack-stream-tests.ts index b6e4cce807..15ec19c7bd 100644 --- a/types/webpack-stream/webpack-stream-tests.ts +++ b/types/webpack-stream/webpack-stream-tests.ts @@ -1,5 +1,5 @@ import * as webpack from 'webpack'; -import * as webpackStream from 'webpack-stream'; +import webpackStream = require('webpack-stream'); let output: NodeJS.ReadWriteStream; diff --git a/types/webpack-validator/index.d.ts b/types/webpack-validator/index.d.ts index 4b6b260877..242a71e6f4 100644 --- a/types/webpack-validator/index.d.ts +++ b/types/webpack-validator/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/js-dxtools/webpack-validator // Definitions by: Simon Hartcher // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// diff --git a/types/webpack/index.d.ts b/types/webpack/index.d.ts index f8aa375210..d6102808b6 100644 --- a/types/webpack/index.d.ts +++ b/types/webpack/index.d.ts @@ -9,12 +9,15 @@ // Ahmed T. Ali // Alan Agius // Spencer Elliott +// Jason Cheatham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 /// import Tapable = require('tapable'); import * as UglifyJS from 'uglify-js'; +import { RawSourceMap } from 'source-map'; export = webpack; @@ -76,7 +79,7 @@ declare namespace webpack { /** Capture timing information for each module. */ profile?: boolean; /** Cache generated modules and chunks to improve performance for multiple incremental builds. */ - cache?: boolean | any; + cache?: boolean | object; /** Enter watch mode, which rebuilds on file change. */ watch?: boolean; watchOptions?: Options.WatchOptions; @@ -491,7 +494,7 @@ declare namespace webpack { */ maxEntrypointSize?: number; } - type Stats = webpack.Stats.ToStringOptions; + type Stats = Stats.ToStringOptions; type WatchOptions = ICompiler.WatchOptions; } @@ -541,7 +544,7 @@ declare namespace webpack { type Handler = ICompiler.Handler; type WatchOptions = ICompiler.WatchOptions; - class Watching implements webpack.Watching { + class Watching implements Watching { constructor(compiler: Compiler, watchOptions: Watching.WatchOptions, handler: Watching.Handler); close(callback: () => void): void; @@ -1020,7 +1023,7 @@ declare namespace webpack { namespace loader { interface Loader extends Function { - (this: LoaderContext, source: string | Buffer, sourceMap: string | Buffer): string | Buffer | void | undefined; + (this: LoaderContext, source: string | Buffer, sourceMap?: RawSourceMap): string | Buffer | void | undefined; /** * The order of chained loaders are always called from right to left. @@ -1029,7 +1032,7 @@ declare namespace webpack { * If a loader delivers a result in the pitch method the process turns around and skips the remaining loaders, * continuing with the calls to the more left loaders. data can be passed between pitch and normal call. */ - pitch?(remainingRequest: string, precedingRequest: string, data: any): any | undefined; + pitch?(remainingRequest: string, precedingRequest: string, data: any): any; /** * By default, the resource file is treated as utf-8 string and passed as String to the loader. @@ -1040,7 +1043,7 @@ declare namespace webpack { raw?: boolean; } - type loaderCallback = (err: Error | undefined | null, content?: string | Buffer, sourceMap?: string | Buffer) => void; + type loaderCallback = (err: Error | undefined | null, content?: string | Buffer, sourceMap?: RawSourceMap) => void; interface LoaderContext { /** @@ -1259,37 +1262,40 @@ declare namespace webpack { /** @deprecated */ namespace compiler { /** @deprecated use webpack.Compiler */ + // tslint:disable-next-line:no-unnecessary-qualifier type Compiler = webpack.Compiler; /** @deprecated use webpack.Compiler.Watching */ - type Watching = webpack.Compiler.Watching; + type Watching = Compiler.Watching; /** @deprecated use webpack.Compiler.WatchOptions */ - type WatchOptions = webpack.Compiler.WatchOptions; + + type WatchOptions = Compiler.WatchOptions; /** @deprecated use webpack.Stats */ + // tslint:disable-next-line:no-unnecessary-qualifier type Stats = webpack.Stats; /** @deprecated use webpack.Stats.ToJsonOptions */ - type StatsOptions = webpack.Stats.ToJsonOptions; + type StatsOptions = Stats.ToJsonOptions; /** @deprecated use webpack.Stats.ToStringOptions */ - type StatsToStringOptions = webpack.Stats.ToStringOptions; + type StatsToStringOptions = Stats.ToStringOptions; /** @deprecated use webpack.Compiler.Handler */ - type CompilerCallback = webpack.Compiler.Handler; + type CompilerCallback = Compiler.Handler; } /** @deprecated use webpack.Options.Performance */ - type PerformanceOptions = webpack.Options.Performance; + type PerformanceOptions = Options.Performance; /** @deprecated use webpack.Options.WatchOptions */ - type WatchOptions = webpack.Options.WatchOptions; + type WatchOptions = Options.WatchOptions; /** @deprecated use webpack.EvalSourceMapDevToolPlugin.Options */ - type EvalSourceMapDevToolPluginOptions = webpack.EvalSourceMapDevToolPlugin.Options; + type EvalSourceMapDevToolPluginOptions = EvalSourceMapDevToolPlugin.Options; /** @deprecated use webpack.SourceMapDevToolPlugin.Options */ - type SourceMapDevToolPluginOptions = webpack.SourceMapDevToolPlugin.Options; + type SourceMapDevToolPluginOptions = SourceMapDevToolPlugin.Options; /** @deprecated use webpack.optimize.UglifyJsPlugin.CommentFilter */ - type UglifyCommentFunction = webpack.optimize.UglifyJsPlugin.CommentFilter; + type UglifyCommentFunction = optimize.UglifyJsPlugin.CommentFilter; /** @deprecated use webpack.optimize.UglifyJsPlugin.Options */ - type UglifyPluginOptions = webpack.optimize.UglifyJsPlugin.Options; + type UglifyPluginOptions = optimize.UglifyJsPlugin.Options; } diff --git a/types/webpack/package.json b/types/webpack/package.json new file mode 100644 index 0000000000..59c231c54c --- /dev/null +++ b/types/webpack/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "source-map": "^0.6.0" + } +} diff --git a/types/webpack/tslint.json b/types/webpack/tslint.json index 590af11d7e..b4b47a0378 100644 --- a/types/webpack/tslint.json +++ b/types/webpack/tslint.json @@ -1,10 +1,3 @@ { - "extends": "dtslint/dt.json", - "rules": { - // TODO - "no-any-union": false, - "no-unnecessary-qualifier": false, - "no-void-expression": false, - "space-within-parens": false - } + "extends": "dtslint/dt.json" } diff --git a/types/webpack/webpack-tests.ts b/types/webpack/webpack-tests.ts index becaa20dd6..f56dbb84b6 100644 --- a/types/webpack/webpack-tests.ts +++ b/types/webpack/webpack-tests.ts @@ -1,4 +1,5 @@ -import * as webpack from 'webpack'; +import webpack = require('webpack'); +import { RawSourceMap } from 'source-map'; const { optimize, @@ -509,8 +510,10 @@ declare function successfullyCompiled(): void; webpack({ // configuration }, (err, stats) => { - if (err) - return handleFatalError(err); + if (err) { + handleFatalError(err); + return; + } const jsonStats = stats.toJson(); const jsonStatsWithAllOptions = stats.toJson({ assets: true, @@ -537,10 +540,13 @@ webpack({ excludeAssets: ["filter", "excluded"] }); - if (jsonStats.errors.length > 0) - return handleSoftErrors(jsonStats.errors); - if (jsonStats.warnings.length > 0) + if (jsonStats.errors.length > 0) { + handleSoftErrors(jsonStats.errors); + return; + } + if (jsonStats.warnings.length > 0) { handleWarnings(jsonStats.warnings); + } successfullyCompiled(); }); @@ -637,7 +643,7 @@ configuration = { performance, }; -function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sourcemap: string | Buffer): void { +function loader(this: webpack.loader.LoaderContext, source: string | Buffer, sourcemap?: RawSourceMap): void { this.cacheable(); this.async(); diff --git a/types/webrtc/RTCPeerConnection.d.ts b/types/webrtc/RTCPeerConnection.d.ts index 472f2b0318..210ab66ddd 100644 --- a/types/webrtc/RTCPeerConnection.d.ts +++ b/types/webrtc/RTCPeerConnection.d.ts @@ -314,6 +314,7 @@ interface RTCPeerConnection extends EventTarget { addIceCandidate(candidate?: RTCIceCandidateInit | RTCIceCandidate): Promise; readonly signalingState: RTCSignalingState; + readonly connectionState: RTCPeerConnectionState; getConfiguration(): RTCConfiguration; setConfiguration(configuration: RTCConfiguration): void; diff --git a/types/webrtc/test/RTCPeerConnection.ts b/types/webrtc/test/RTCPeerConnection.ts index 95a6d45694..f99ed1c05b 100644 --- a/types/webrtc/test/RTCPeerConnection.ts +++ b/types/webrtc/test/RTCPeerConnection.ts @@ -56,6 +56,12 @@ pc.onconnectionstatechange = ev => console.log(ev.type); pc.ontrack = ev => console.log(ev.receiver); pc.ondatachannel = ev => console.log(ev.channel); +// State properties +console.log(pc.signalingState); +console.log(pc.iceGatheringState); +console.log(pc.iceConnectionState); +console.log(pc.connectionState); + // Legacy interface extensions pc.createOffer( (sdp: RTCSessionDescription) => console.log(sdp.sdp), diff --git a/types/website-scraper/website-scraper-tests.ts b/types/website-scraper/website-scraper-tests.ts index dc479d5c76..bbcb1fda9d 100644 --- a/types/website-scraper/website-scraper-tests.ts +++ b/types/website-scraper/website-scraper-tests.ts @@ -1,4 +1,4 @@ -import * as scraper from "website-scraper"; +import scraper = require("website-scraper"); scraper({ urls: [ diff --git a/types/websocket/index.d.ts b/types/websocket/index.d.ts index 006d94800f..f67a5da142 100644 --- a/types/websocket/index.d.ts +++ b/types/websocket/index.d.ts @@ -571,6 +571,12 @@ declare class client extends events.EventEmitter { connect(requestUrl: url.Url, protocols?: string, origin?: string, headers?: object, extraRequestOptions?: http.RequestOptions): void; connect(requestUrl: string, protocols?: string, origin?: string, headers?: object, extraRequestOptions?: http.RequestOptions): void; + /** + * Will cancel an in-progress connection request before either the `connect` event or the `connectFailed` event has been emitted. + * If the `connect` or `connectFailed` event has already been emitted, calling `abort()` will do nothing. + */ + abort(): void; + // Events on(event: string, listener: () => void): this; on(event: 'connect', cb: (connection: connection) => void): this; diff --git a/types/websocket/websocket-tests.ts b/types/websocket/websocket-tests.ts index 3044f9bf7d..94f8a11e16 100644 --- a/types/websocket/websocket-tests.ts +++ b/types/websocket/websocket-tests.ts @@ -180,8 +180,18 @@ function clientTest2() { } +function testClientAbortApi() { + var ipArray = getLocalIpArray(); + var client = new websocket.client(); + client.connect(`ws://${ipArray[0]}:8888`, undefined, undefined, undefined, { + localAddress: ipArray[0] + }); + client.abort(); +} + { console.log(`websocket test start.`); serverTest2(); clientTest2(); + testClientAbortApi(); } diff --git a/types/webtorrent/webtorrent-tests.ts b/types/webtorrent/webtorrent-tests.ts index 06d8f853f3..63a9647902 100644 --- a/types/webtorrent/webtorrent-tests.ts +++ b/types/webtorrent/webtorrent-tests.ts @@ -1,4 +1,4 @@ -import * as WebTorrent from 'webtorrent'; +import WebTorrent = require('webtorrent'); import * as fs from 'fs'; const client = new WebTorrent(); diff --git a/types/wheel/tsconfig.json b/types/wheel/tsconfig.json index 2857ce81c3..2e0f811c37 100644 --- a/types/wheel/tsconfig.json +++ b/types/wheel/tsconfig.json @@ -1,13 +1,18 @@ { "compilerOptions": { "module": "commonjs", - "lib": ["es5", "dom"], + "lib": [ + "es5", + "dom" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", - "typeRoots": ["../"], + "typeRoots": [ + "../" + ], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true @@ -16,4 +21,4 @@ "index.d.ts", "wheel-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/why-did-you-update/index.d.ts b/types/why-did-you-update/index.d.ts index 593cf6791d..f7f4fb820a 100644 --- a/types/why-did-you-update/index.d.ts +++ b/types/why-did-you-update/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/garbles/why-did-you-update // Definitions by: rhysd // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 2.6 /// diff --git a/types/winston/index.d.ts b/types/winston/index.d.ts index 3de43e4349..df360f1e01 100644 --- a/types/winston/index.d.ts +++ b/types/winston/index.d.ts @@ -223,7 +223,7 @@ declare namespace winston { unhandleExceptions(...transports: TransportInstance[]): void; add(transport: TransportInstance, options?: TransportOptions, created?: boolean): LoggerInstance; clear(): void; - remove(transport: TransportInstance): LoggerInstance; + remove(transport: string | TransportInstance): LoggerInstance; startTimer(): ProfileHandler; profile(id: string, msg?: string, meta?: any, callback?: (err: Error, level: string, msg: string, meta: any) => void): LoggerInstance; configure(options: LoggerOptions): void; diff --git a/types/winston/winston-tests.ts b/types/winston/winston-tests.ts index a0620c94e0..c9c8fcd0da 100644 --- a/types/winston/winston-tests.ts +++ b/types/winston/winston-tests.ts @@ -260,6 +260,9 @@ logger = new (winston.Logger)({ ] }); +/* Remove transport by name */ +logger = logger.remove('nooo'); + /* Reconfigure logger */ logger.configure({ level: 'silly' }); diff --git a/types/word-list-json/tsconfig.json b/types/word-list-json/tsconfig.json index 8f34d90409..3bbe8a5d08 100644 --- a/types/word-list-json/tsconfig.json +++ b/types/word-list-json/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "word-list-json-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/write-json-file/write-json-file-tests.ts b/types/write-json-file/write-json-file-tests.ts index 7354dfc17f..bad3b1a5a1 100644 --- a/types/write-json-file/write-json-file-tests.ts +++ b/types/write-json-file/write-json-file-tests.ts @@ -1,4 +1,4 @@ -import * as write from 'write-json-file'; +import write = require('write-json-file'); // Basic write('foo.json', {foo: true}).then(() => { }); diff --git a/types/ws/index.d.ts b/types/ws/index.d.ts index 2a52883365..303dcc3875 100644 --- a/types/ws/index.d.ts +++ b/types/ws/index.d.ts @@ -68,7 +68,7 @@ declare class WebSocket extends events.EventEmitter { // Events on(event: 'close', listener: (code: number, reason: string) => void): this; - on(event: 'error', listener: (event: {error: any, message: any, type: string, target: WebSocket }) => void): this; + on(event: 'error', listener: (err: Error) => void): this; on(event: 'upgrade', listener: (request: http.IncomingMessage) => void): this; on(event: 'message', listener: (data: WebSocket.Data) => void): this; on(event: 'open' , listener: () => void): this; diff --git a/types/ws/ws-tests.ts b/types/ws/ws-tests.ts index 29334a647f..51d37bea9c 100644 --- a/types/ws/ws-tests.ts +++ b/types/ws/ws-tests.ts @@ -1,4 +1,4 @@ -import * as WebSocket from 'ws'; +import WebSocket = require('ws'); import * as http from 'http'; import * as https from 'https'; diff --git a/types/wtfnode/tsconfig.json b/types/wtfnode/tsconfig.json index 429ee54cb7..aebc38afe0 100644 --- a/types/wtfnode/tsconfig.json +++ b/types/wtfnode/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "wtfnode-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/x-ray-crawler/tsconfig.json b/types/x-ray-crawler/tsconfig.json index 3b3a573f0a..26247c6108 100644 --- a/types/x-ray-crawler/tsconfig.json +++ b/types/x-ray-crawler/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "x-ray-crawler-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/x-ray/tsconfig.json b/types/x-ray/tsconfig.json index 7dc474842a..d7865de910 100644 --- a/types/x-ray/tsconfig.json +++ b/types/x-ray/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "x-ray-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/xml/xml-tests.ts b/types/xml/xml-tests.ts index 3493a464fd..b26ffd054a 100644 --- a/types/xml/xml-tests.ts +++ b/types/xml/xml-tests.ts @@ -1,6 +1,6 @@ // Code get from the test file of https://github.com/dylang/node-xml -import * as xml from "xml"; +import xml = require("xml"); interface Tester { is(a: any, b: any): void; diff --git a/types/xmlpoke/xmlpoke-tests.ts b/types/xmlpoke/xmlpoke-tests.ts index aba04c0962..1079d19756 100644 --- a/types/xmlpoke/xmlpoke-tests.ts +++ b/types/xmlpoke/xmlpoke-tests.ts @@ -1,5 +1,5 @@ -import * as xmlpoke from 'xmlpoke'; -import * as assert from 'assert'; +import xmlpoke = require('xmlpoke'); +import assert = require('assert'); let result: string; diff --git a/types/xtend/xtend-tests.ts b/types/xtend/xtend-tests.ts index 12ad82a1b0..5f72688fdb 100644 --- a/types/xtend/xtend-tests.ts +++ b/types/xtend/xtend-tests.ts @@ -1,4 +1,4 @@ -import * as xtend from "xtend"; +import xtend = require("xtend"); interface Target { hellow: string; diff --git a/types/yargs/index.d.ts b/types/yargs/index.d.ts index d4a47c84e7..882e8e9999 100644 --- a/types/yargs/index.d.ts +++ b/types/yargs/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for yargs 10.0 +// Type definitions for yargs 11.0 // Project: https://github.com/chevex/yargs // Definitions by: Martin Poelstra // Mizunashi Mana @@ -262,9 +262,17 @@ declare namespace yargs { nargs?: number; normalize?: boolean; number?: boolean; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ require?: boolean | string; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ required?: boolean | string; - requiresArg?: boolean | string; + requiresArg?: boolean; skipValidation?: boolean; string?: boolean; type?: "array" | "count" | PositionalOptionsType; diff --git a/types/yargs/tsconfig.json b/types/yargs/tsconfig.json index f0fcef8f10..003b792854 100644 --- a/types/yargs/tsconfig.json +++ b/types/yargs/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "yargs-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/yargs/v10/.editorconfig b/types/yargs/v10/.editorconfig new file mode 100644 index 0000000000..db9b917e06 --- /dev/null +++ b/types/yargs/v10/.editorconfig @@ -0,0 +1,5 @@ +[*.ts] +indent_style = space +indent_size = 4 +end_of_line = lf +charset = utf-8 diff --git a/types/yargs/v10/index.d.ts b/types/yargs/v10/index.d.ts new file mode 100644 index 0000000000..d4a47c84e7 --- /dev/null +++ b/types/yargs/v10/index.d.ts @@ -0,0 +1,304 @@ +// Type definitions for yargs 10.0 +// Project: https://github.com/chevex/yargs +// Definitions by: Martin Poelstra +// Mizunashi Mana +// Jeffery Grajkowski +// Jeff Kenney +// Jimi (Dimitris) Charalampidis +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +// The following TSLint rules have been disabled: +// unified-signatures: Because there is useful information in the argument names of the overloaded signatures + +// Convention: +// Use 'union types' when: +// - parameter types have similar signature type (i.e. 'string | string[]') +// - parameter names have the same semantic meaning (i.e. ['command', 'commands'] , ['key', 'keys']) +// An example for not using 'union types' is the declaration of 'env' where `prefix` and `enable` parameters +// have different semantics. On the other hand, in the declaration of 'usage', a `command: string` parameter +// has the same semantic meaning with declaring an overload method by using `commands: string[]`, thus +// it's prefered to use `command: string | string[]` +// Use parameterless declaration instead of declaring all parameters optional, +// when all parameters are optional and more than one + +declare namespace yargs { + interface Argv { + (): Arguments; + (args: string[], cwd?: string): Arguments; + + alias(shortName: string | string[], longName: string | string[]): Argv; + alias(aliases: { [shortName: string]: string | string[] }): Argv; + + argv: Arguments; + + array(key: string | string[]): Argv; + + boolean(key: string | string[]): Argv; + + check(func: (argv: Arguments, aliases: { [alias: string]: string }) => any, global?: boolean): Argv; + + choices(key: string, values: Choices): Argv; + choices(choices: { [argName: string]: Choices }): Argv; + + coerce(key: string | string[], func: (arg: any) => any): Argv; + coerce(opts: { [key: string]: (arg: any) => any; }): Argv; + + command(command: string | string[], description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; + command(command: string | string[], description: string, builder?: { [key: string]: Options }, handler?: (args: Arguments) => void): Argv; + command(command: string | string[], description: string, module: CommandModule): Argv; + command(command: string | string[], showInHelp: false, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; + command(command: string | string[], showInHelp: false, builder?: { [key: string]: Options }, handler?: (args: Arguments) => void): Argv; + command(command: string | string[], showInHelp: false, module: CommandModule): Argv; + command(module: CommandModule): Argv; + + // Advanced API + commandDir(dir: string, opts?: RequireDirectoryOptions): Argv; + + completion(): Argv; + completion(cmd: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, func?: SyncCompletionFunction): Argv; + completion(cmd: string, description?: string, func?: AsyncCompletionFunction): Argv; + completion(cmd: string, description?: string, func?: SyncCompletionFunction): Argv; + + config(): Argv; + config(key: string | string[], description?: string, parseFn?: (configPath: string) => object): Argv; + config(key: string | string[], parseFn: (configPath: string) => object): Argv; + config(explicitConfigurationObject: object): Argv; + + conflicts(key: string, value: string | string[]): Argv; + conflicts(conflicts: { [key: string]: string | string[] }): Argv; + + count(key: string | string[]): Argv; + + default(key: string, value: any, description?: string): Argv; + default(defaults: { [key: string]: any }, description?: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + demand(key: string | string[], msg: string): Argv; + demand(key: string | string[], required?: boolean): Argv; + demand(positionals: number, msg: string): Argv; + demand(positionals: number, required?: boolean): Argv; + demand(positionals: number, max: number, msg?: string): Argv; + + demandOption(key: string | string[], msg?: string): Argv; + demandOption(key: string | string[], demand?: boolean): Argv; + + demandCommand(): Argv; + demandCommand(min: number, minMsg?: string): Argv; + demandCommand(min: number, max?: number, minMsg?: string, maxMsg?: string): Argv; + + describe(key: string | string[], description: string): Argv; + describe(descriptions: { [key: string]: string }): Argv; + + detectLocale(detect: boolean): Argv; + + env(): Argv; + env(prefix: string): Argv; + env(enable: boolean): Argv; + + epilog(msg: string): Argv; + + epilogue(msg: string): Argv; + + example(command: string, description: string): Argv; + + exitProcess(enabled: boolean): Argv; + + fail(func: (msg: string, err: Error) => any): Argv; + + getCompletion(args: string[], done: (completions: string[]) => void): Argv; + + global(key: string | string[]): Argv; + + group(key: string | string[], groupName: string): Argv; + + help(): Argv; + help(enableExplicit: boolean): Argv; + help(option: string, enableExplicit: boolean): Argv; + help(option: string, description?: string, enableExplicit?: boolean): Argv; + + implies(key: string, value: string | string[]): Argv; + implies(implies: { [key: string]: string | string[] }): Argv; + + locale(): string; + locale(loc: string): Argv; + + nargs(key: string, count: number): Argv; + nargs(nargs: { [key: string]: number }): Argv; + + normalize(key: string | string[]): Argv; + + number(key: string | string[]): Argv; + + option(key: string, options: Options): Argv; + option(options: { [key: string]: Options }): Argv; + + options(key: string, options: Options): Argv; + options(options: { [key: string]: Options }): Argv; + + parse(): Arguments; + parse(arg: string | string[], context?: object, parseCallback?: ParseCallback): Arguments; + + pkgConf(key: string | string[], cwd?: string): Argv; + + /** + * 'positional' should be called in a command's builder function, and is not + * available on the top-level yargs instance. If so, it will throw an error. + */ + positional(key: string, opt: PositionalOptions): Argv; + + recommendCommands(): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + require(key: string, msg: string): Argv; + require(key: string, required: boolean): Argv; + require(keys: number[], msg: string): Argv; + require(keys: number[], required: boolean): Argv; + require(positionals: number, required: boolean): Argv; + require(positionals: number, msg: string): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.demandCommand()' or '.demandOption()' instead + */ + required(key: string, msg: string): Argv; + required(key: string, required: boolean): Argv; + required(keys: number[], msg: string): Argv; + required(keys: number[], required: boolean): Argv; + required(positionals: number, required: boolean): Argv; + required(positionals: number, msg: string): Argv; + + requiresArg(key: string | string[]): Argv; + + /** + * @deprecated since version 6.6.0 + * Use '.global()' instead + */ + reset(): Argv; + + showCompletionScript(): Argv; + + showHelp(consoleLevel?: string): Argv; + + showHelpOnFail(enable: boolean, message?: string): Argv; + + skipValidation(key: string | string[]): Argv; + + strict(): Argv; + + string(key: string | string[]): Argv; + + // Intended to be used with '.wrap()' + terminalWidth(): number; + + updateLocale(obj: { [key: string]: string }): Argv; + + updateStrings(obj: { [key: string]: string }): Argv; + + usage(message: string): Argv; + usage(command: string | string[], description: string, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; + usage(command: string | string[], showInHelp: boolean, builder?: (args: Argv) => Argv, handler?: (args: Arguments) => void): Argv; + usage(command: string | string[], description: string, builder?: { [key: string]: Options }, handler?: (args: Arguments) => void): Argv; + usage(commands: string | string[], showInHelp: boolean, builder?: { [key: string]: Options }, handler?: (args: Arguments) => void): Argv; + + version(): Argv; + version(version: string): Argv; + version(enable: boolean): Argv; + version(optionKey: string, version: string): Argv; + version(optionKey: string, description: string, version: string): Argv; + + wrap(columns: number | null): Argv; + } + + interface Arguments { + /** Non-option arguments */ + _: string[]; + /** The script name or node command */ + $0: string; + /** All remaining options */ + [argName: string]: any; + } + + interface RequireDirectoryOptions { + recurse?: boolean; + extensions?: string[]; + visit?: (commandObject: any, pathToFile?: string, filename?: string) => any; + include?: RegExp | ((pathToFile: string) => boolean); + exclude?: RegExp | ((pathToFile: string) => boolean); + } + + interface Options { + alias?: string | string[]; + array?: boolean; + boolean?: boolean; + choices?: Choices; + coerce?: (arg: any) => any; + config?: boolean; + configParser?: (configPath: string) => object; + conflicts?: string | string[] | { [key: string]: string | string[] }; + count?: boolean; + default?: any; + defaultDescription?: string; + /** + * @deprecated since version 6.6.0 + * Use 'demandOption' instead + */ + demand?: boolean | string; + demandOption?: boolean | string; + desc?: string; + describe?: string; + description?: string; + global?: boolean; + group?: string; + hidden?: boolean; + implies?: string | string[] | { [key: string]: string | string[] }; + nargs?: number; + normalize?: boolean; + number?: boolean; + require?: boolean | string; + required?: boolean | string; + requiresArg?: boolean | string; + skipValidation?: boolean; + string?: boolean; + type?: "array" | "count" | PositionalOptionsType; + } + + interface PositionalOptions { + alias?: string | string[]; + choices?: Choices; + coerce?: (arg: any) => any; + conflicts?: string | string[] | { [key: string]: string | string[] }; + default?: any; + desc?: string; + describe?: string; + description?: string; + implies?: string | string[] | { [key: string]: string | string[] }; + normalize?: boolean; + type?: PositionalOptionsType; + } + + interface CommandModule { + aliases?: string[] | string; + builder?: CommandBuilder; + command?: string[] | string; + describe?: string | false; + handler: (args: any) => void; + } + + type ParseCallback = (err: Error | undefined, argv: Arguments, output: string) => void; + type CommandBuilder = { [key: string]: Options } | ((args: Argv) => Argv); + type SyncCompletionFunction = (current: string, argv: any) => string[]; + type AsyncCompletionFunction = (current: string, argv: any, done: (completion: string[]) => void) => void; + type Choices = Array; + type PositionalOptionsType = "boolean" | "number" | "string"; +} + +declare var yargs: yargs.Argv; +export = yargs; diff --git a/types/yargs/v10/tsconfig.json b/types/yargs/v10/tsconfig.json new file mode 100644 index 0000000000..b615180ff7 --- /dev/null +++ b/types/yargs/v10/tsconfig.json @@ -0,0 +1,28 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": false, + "strictFunctionTypes": true, + "baseUrl": "../../", + "paths": { + "yargs": [ + "yargs/v10" + ] + }, + "typeRoots": [ + "../../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "yargs-tests.ts" + ] +} \ No newline at end of file diff --git a/types/yargs/v10/tslint.json b/types/yargs/v10/tslint.json new file mode 100644 index 0000000000..08b1465cd6 --- /dev/null +++ b/types/yargs/v10/tslint.json @@ -0,0 +1,6 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "unified-signatures": false + } +} diff --git a/types/yargs/v10/yargs-tests.ts b/types/yargs/v10/yargs-tests.ts new file mode 100644 index 0000000000..43779309bf --- /dev/null +++ b/types/yargs/v10/yargs-tests.ts @@ -0,0 +1,650 @@ +/// + +import yargs = require('yargs'); + +import * as fs from 'fs'; +import * as path from 'path'; + +const stringVal = 'string'; + +// Examples taken from yargs website +// https://github.com/chevex/yargs + +// With yargs, the options be just a hash! +function xup() { + const argv = yargs.argv; + + if (argv.rif - 5 * argv.xup > 7.138) { + console.log('Plunder more riffiwobbles!'); + } else { + console.log('Drop the xupptumblers!'); + } +} + +// And non-hyphenated options too! Just use argv._! +function nonopt() { + const argv = yargs.argv; + console.log('(%d,%d)', argv.x, argv.y); + console.log(argv._); +} + +// Yargs even counts your booleans! +function count() { + const argv = yargs + .count('verbose') + .alias('v', 'verbose') + .argv; + + const VERBOSE_LEVEL: number = argv.verbose; + + function WARN() { VERBOSE_LEVEL >= 0 && console.log.apply(console, arguments); } + function INFO() { VERBOSE_LEVEL >= 1 && console.log.apply(console, arguments); } + function DEBUG() { VERBOSE_LEVEL >= 2 && console.log.apply(console, arguments); } +} + +// Tell users how to use yer options and make demands. +function divide() { + const argv = yargs + .usage('Usage: $0 -x [num] -y [num]') + .demand(['x', 'y']) + .argv; + + console.log(argv.x / argv.y); +} + +// After yer demands have been met, demand more! Ask for non-hypenated arguments! +function demand_count() { + const argv = yargs + .demand(2) + .demand(2, false) + .demand(2, 2) + .demand(2, 2, "message") + .argv; + console.dir(argv); +} + +// EVEN MORE SHIVER ME TIMBERS! +function default_singles() { + const argv = yargs + .default('x', 10) + .default('y', 10) + .argv + ; + console.log(argv.x + argv.y); +} +function default_hash() { + const argv = yargs + .default({ x: 10, y: 10 }) + .argv + ; + console.log(argv.x + argv.y); +} + +// And if you really want to get all descriptive about it... +function boolean_single() { + const argv = yargs + .boolean('v') + .argv + ; + console.dir(argv.v); + console.dir(argv._); +} +function boolean_double() { + const argv = yargs + .boolean(['x', 'y', 'z']) + .argv + ; + console.dir([argv.x, argv.y, argv.z]); + console.dir(argv._); +} + +// Yargs is here to help you... +function line_count() { + const argv = yargs + .usage('Count the lines in a file.\nUsage: $0') + .example('$0 -f', 'count the lines in the given file') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .argv + ; +} + +// Below are tests for individual methods. +// Not all methods are covered yet, and neither are all possible invocations of methods. + +function Argv$argv() { + const argv = yargs.argv; + console.log("command name: " + argv.$0); + console.log("command: " + argv._[1]); +} + +function Argv_parsing() { + const argv1 = yargs.parse(); + const argv2 = yargs(['-x', '1', '-y', '2']).argv; + const argv3 = yargs.parse(['-x', '1', '-y', '2']); + console.log(argv1.x, argv2.x, argv3.x); +} + +function Argv$options() { + const argv1 = yargs + .options('f', { + alias: 'file', + default: '/etc/passwd', + defaultDescription: 'The /etc/passwd file', + group: 'files', + normalize: true, + global: false, + array: true, + nargs: 3, + implies: 'other-arg', + conflicts: 'conflicting-arg', + }) + .argv + ; + + const argv2 = yargs + .alias('f', 'file') + .default('f', '/etc/passwd') + .argv + ; +} + +function Argv$global() { + const argv = yargs + .global('foo') + .global(['bar', 'baz', 'fizz', 'buzz']); +} + +function Argv$group() { + const argv = yargs + .group('foo', 'foogroup') + .group(['bing', 'bang', 'buzz'], 'onomatopoeia'); +} + +function Argv$env() { + const argv = yargs + .env('YARGS_PREFIX_') + .env() + .env(true); +} + +function Argv$array() { + const argv = yargs + .array('foo') + .array(['bar', 'baz']); +} + +function Argv$nargs() { + const argv = yargs + .nargs('foo', 12) + .nargs({ bing: 3, bang: 2, buzz: 4 }); +} + +function Argv$choices() { + // example from documentation + const argv = yargs + .alias('i', 'ingredient') + .describe('i', 'choose your sandwich ingredients') + .choices('i', ['peanut-butter', 'jelly', 'banana', 'pickles']) + .help('help') + .argv; + + yargs + .choices('i', [undefined, true, 'asdf', 'test']) + .choices({ + test: [undefined, true, 'test-value'] + }); +} + +function Argv$usage_as_default_command() { + const argv = yargs + .usage( + "$0 get", + 'make a get HTTP request', + (yargs) => { + return yargs.option('u', { + alias: 'url', + describe: 'the URL to make an HTTP request to' + }); + }, + (argv) => { + console.dir(argv.url); + } + ) + .argv; +} + +function Argv$command() { + const argv = yargs + .usage('npm ') + .command('install', 'tis a mighty fine package to install') + .command('publish', 'shiver me timbers, should you be sharing all that', yargs => + yargs.option('f', { + alias: 'force', + description: 'yar, it usually be a bad idea' + }) + .help('help') + ) + .command("build", "arghh, build it mate", { + tag: { + default: true, + demand: true, + description: "Tag the build, mate!" + }, + publish: { + default: false, + description: "Should i publish?" + } + }) + .command({ + command: "test", + describe: "test package", + builder: { + mateys: { + demand: false + } + }, + handler: (args: any) => { + /* handle me mateys! */ + } + }) + .command("test", "test mateys", { + handler: (args: any) => { + /* handle me mateys! */ + } + }) + .help('help') + .argv; + + yargs + .command('get', 'make a get HTTP request', (yargs) => { + return yargs.option('url', { + alias: 'u', + default: 'http://yargs.js.org/' + }); + }) + .help() + .argv; + + yargs + .command( + 'get', + 'make a get HTTP request', + (yargs) => { + return yargs.option('u', { + alias: 'url', + describe: 'the URL to make an HTTP request to' + }); + }, + (argv) => { + console.dir(argv.url); + } + ) + .help() + .argv; +} + +function Argv$completion_sync() { + const argv = yargs + .completion('completion', (current, argv) => { + // 'current' is the current command being completed. + // 'argv' is the parsed arguments so far. + // simply return an array of completions. + return [ + 'foo', + 'bar' + ]; + }) + .argv; +} + +function Argv$completion_async() { + const argv = yargs + .completion('completion', (current: string, argv: any, done: (completion: string[]) => void) => { + setTimeout(() => { + done([ + 'apple', + 'banana' + ]); + }, 500); + }) + .argv; +} + +function Argv$help() { + const argv = yargs + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]") + .help() + .argv; +} + +function Argv$showHelpOnFail() { + const argv = yargs + .usage('Count the lines in a file.\nUsage: $0') + .demand('f') + .alias('f', 'file') + .describe('f', 'Load a file') + .showHelpOnFail(false, "Specify --help for available options") + .argv; +} + +function Argv$showHelp() { + const yargs1 = yargs + .usage("$0 -operand1 number -operand2 number -operation [add|subtract]"); + yargs1.showHelp(); +} + +function Argv$version() { + const argv1 = yargs + .version(); + + const argv2 = yargs + .version('1.0.0'); + + const argv3 = yargs + .version('--version', '1.0.0'); + + const argv4 = yargs + .version('--version', 'Show version', '1.0.0'); + + const argv5 = yargs + .version(false); +} + +function Argv$wrap() { + const argv1 = yargs + .wrap(null); + + const argv2 = yargs + .wrap(yargs.terminalWidth()); +} + +function Argv$locale() { + const argv = yargs + .usage('./$0 - follow ye instructions true') + .option('option', { + alias: 'o', + describe: "'tis a mighty fine option", + demand: true + }) + .command('run', "Arrr, ya best be knowin' what yer doin'") + .example('$0 run foo', "shiver me timbers, here's an example for ye") + .help('help') + .wrap(70) + .locale('pirate') + .argv; +} + +function Argv$epilogue() { + const argv = yargs + .epilogue('for more information, find our manual at http://example.com'); +} + +function Argv$reset() { + const ya = yargs + .usage('$0 command') + .command('hello', 'hello command') + .command('world', 'world command') + .demand(1, 'must provide a valid command'); + const argv = yargs.argv; + const command = argv._[0]; + + if (command === 'hello') { + ya.reset() + .usage('$0 hello') + .help('h') + .example('$0 hello', 'print the hello message!') + .argv; + + console.log('hello!'); + } else if (command === 'world') { + ya.reset() + .usage('$0 world') + .help('h') + .example('$0 world', 'print the world message!') + .argv; + + console.log('world!'); + } else { + ya.showHelp(); + } +} + +// http://yargs.js.org/docs/#methods-commanddirdirectory-opts +function Argv$commandDir() { + const ya = yargs + .commandDir('.') + .argv; +} + +// http://yargs.js.org/docs/#methods-commanddirdirectory-opts +function Argv$commandDirWithOptions() { + const ya = yargs + .commandDir('.', { + recurse: false, + extensions: ['js'], + visit: (commandObject: any, pathToFile: string, filename: string) => void 0, + include: /.*\.js$/, + exclude: /.*\.spec.js$/, + }) + .argv; +} + +function Argv$normalize() { + const ya = yargs + .normalize('path') + .normalize(['user', 'group']) + .argv; +} + +// From http://yargs.js.org/docs/#methods-coercekey-fn +function Argv$coerce() { + const ya = yargs + .coerce('file', (arg: string) => { + return fs.readFileSync(arg, 'utf8'); + }) + .argv; +} +function Argv$coerces() { + const ya = yargs + .coerce({ + date: Date.parse, + json: JSON.parse + }) + .argv; +} +function Argv$coerceWithKeys() { + const ya = yargs + .coerce(['src', 'dest'], path.resolve) + .argv; +} + +// From http://yargs.js.org/docs/#methods-failfn +function Argv$fail() { + const ya = yargs + .fail((msg, err) => { + if (err) throw err; // preserve stack + console.error('You broke it!'); + console.error(msg); + process.exit(1); + }) + .argv; +} + +function Argv$implies() { + const ya = yargs + .implies('foo', 'snuh') + .implies({ + x: 'y' + }) + .argv; +} + +function Argv$count() { + const ya = yargs + .count('size') + .count(['w', 'h']) + .argv; +} + +function Argv$number() { + const ya = yargs + .number('n') + .number(['width', 'height']) + .argv; +} + +function Argv$updateStrings() { + const ya = yargs + .command('run', 'the run command') + .help('help') + .updateStrings({ + 'Commands:': 'My Commands -->\n' + }) + .wrap(null) + .argv; +} + +function Argv$default() { + const ya = yargs + .default('random', function randomValue() { + return Math.random() * 256; + }) + .argv; +} + +function Argv$configObject() { + const ya = yargs + .config({ foo: 1, bar: 2 }) + .argv; +} + +function Argv$configParseFunction() { + const ya = yargs + .config('settings', (configPath) => { + return JSON.parse(fs.readFileSync(configPath, 'utf-8')); + }) + .config('settings', 'description', (configPath) => { + return JSON.parse(fs.readFileSync(configPath, 'utf-8')); + }) + .argv; +} + +function Argv$helpDescriptionExplicit() { + const ya = yargs + .help('help', 'description', true) + .argv; +} + +function Argv$showHelpConsoleLevel() { + yargs.showHelp("log"); // prints to stdout using console.log() +} + +function Argv$getCompletion() { + const ya = yargs + .option('foobar', {}) + .option('foobaz', {}) + .completion() + .getCompletion(['./test.js', '--foo'], (completions) => { + console.log(completions); + }) + .argv; +} + +function Argv$pkgConf() { + const ya = yargs + .pkgConf(['key1', 'key2'], 'configFile.json') + .argv; +} + +function Argv$recommendCommands() { + const ya = yargs + .recommendCommands() + .argv; +} + +function Argv$showCompletionScript() { + const ya = yargs + .showCompletionScript() + .argv; +} + +function Argv$skipValidation() { + const ya = yargs + .skipValidation('arg1') + .skipValidation(['arg2', 'arg3']) + .argv; +} + +function Argv$commandObject() { + const options: yargs.Options = { + alias: "string", + array: true, + boolean: true, + choices: [undefined, true, "a", "b", "c"], + coerce: f => JSON.stringify(f), + config: true, + configParser: t => JSON.parse(fs.readFileSync(t, "utf8")), + count: true, + default: "myvalue", + defaultDescription: "description", + demand: true, + demandOption: true, + desc: "desc", + describe: "describe", + description: "description", + global: false, + group: "group", + nargs: 1, + normalize: false, + number: true, + requiresArg: true, + skipValidation: false, + string: true, + type: "string" + }; + const ya = yargs.command("commandname", "description", { arg: options }); +} + +function Argv$demandCommand() { + const ya = yargs + .demandCommand(1) + .demandCommand(1, 'at least 1 command required') + .demandCommand(1, 2) + .demandCommand(1, 2, 'at least 1 command required') + .demandCommand(1, 2, 'at least 1 command required', 'at most 2 commands required') + .argv; +} + +function Argv$demandOption() { + const ya = yargs + .demandOption('a') + .demandOption('a', 'a is required') + .demandOption('a', true) + .demandOption(['a', 'b']) + .demandOption(['a', 'b'], 'a and b are required') + .demandOption(['a', 'b'], true) + .argv; +} + +function Argv$conflicts() { + const ya = yargs + .conflicts('a', 'b') + .conflicts({ + a: 'b' + }) + .argv; +} + +function Argv$commandArray() { + const ya = yargs + .command(['commandName', 'commandAlias'], 'command description') + .argv; +} + +function Argv$check() { + const ya = yargs + .check((argv, aliases) => void 0) + .check((argv, aliases) => void 0, false); +} diff --git a/types/yargs/v8/tsconfig.json b/types/yargs/v8/tsconfig.json index 191904df93..744f9ddc55 100644 --- a/types/yargs/v8/tsconfig.json +++ b/types/yargs/v8/tsconfig.json @@ -25,4 +25,4 @@ "index.d.ts", "yargs-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/yargs/v8/yargs-tests.ts b/types/yargs/v8/yargs-tests.ts index 3f5b8829aa..5e95564faf 100644 --- a/types/yargs/v8/yargs-tests.ts +++ b/types/yargs/v8/yargs-tests.ts @@ -1,6 +1,6 @@ /// -import * as yargs from 'yargs'; +import yargs = require('yargs'); import * as fs from 'fs'; import * as path from 'path'; diff --git a/types/yargs/yargs-tests.ts b/types/yargs/yargs-tests.ts index aa0ff28235..43779309bf 100644 --- a/types/yargs/yargs-tests.ts +++ b/types/yargs/yargs-tests.ts @@ -1,6 +1,6 @@ /// -import * as yargs from 'yargs'; +import yargs = require('yargs'); import * as fs from 'fs'; import * as path from 'path'; diff --git a/types/yayson/yayson-tests.ts b/types/yayson/yayson-tests.ts index 4e8b9c7d36..4945c03737 100644 --- a/types/yayson/yayson-tests.ts +++ b/types/yayson/yayson-tests.ts @@ -1,4 +1,4 @@ -import * as Yayson from "yayson"; +import Yayson = require("yayson"); const yayson = Yayson({ adapter: 'default' }) || Yayson({ adapter: 'sequelize' }) || Yayson(); const Adapter = yayson.Adapter; diff --git a/types/youtube-dl/tsconfig.json b/types/youtube-dl/tsconfig.json index 2634bd2234..e4e1a8f527 100644 --- a/types/youtube-dl/tsconfig.json +++ b/types/youtube-dl/tsconfig.json @@ -5,7 +5,9 @@ ], "compilerOptions": { "module": "commonjs", - "lib": ["es6"], + "lib": [ + "es6" + ], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, diff --git a/types/yup/index.d.ts b/types/yup/index.d.ts index 99e67121d8..e6dc35c1ea 100644 --- a/types/yup/index.d.ts +++ b/types/yup/index.d.ts @@ -1,13 +1,13 @@ // Type definitions for yup 0.24 // Project: https://github.com/jquense/yup -// Definitions by: Dominik Hardtke , Vladyslav Tserman +// Definitions by: Dominik Hardtke , Vladyslav Tserman , Moreton Bay Regional Council // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export function reach(schema: Schema, path: string, value?: any, context?: any): Schema; -export function addMethod(schemaCtor: AnySchemaConstructor, name: string, method: (this: T, ...args: any[]) => T): void; +export function reach(schema: Schema, path: string, value?: any, context?: any): Schema; +export function addMethod>(schemaCtor: AnySchemaConstructor, name: string, method: (this: T, ...args: any[]) => T): void; export function ref(path: string, options?: { contextPrefix: string }): Ref; -export function lazy(fn: (value: any) => Schema): Lazy; +export function lazy(fn: (value: T) => Schema): Lazy; export function ValidationError(errors: string | string[], value: any, path: string, type?: any): ValidationError; export const mixed: MixedSchemaConstructor; @@ -27,19 +27,19 @@ export type AnySchemaConstructor = MixedSchemaConstructor | ArraySchemaConstructor | ObjectSchemaConstructor; -export interface Schema { +export interface Schema { clone(): this; label(label: string): this; meta(metadata: any): this; meta(): any; describe(): SchemaDescription; concat(schema: this): this; - validate(value: U, options?: ValidateOptions): Promise; - validateSync(value: U, options?: ValidateOptions): ValidationError|U; - isValid(value: any, options?: any): Promise; - isValidSync(value: any, options?: any): boolean; - cast(value: any, options?: any): any; - isType(value: any): boolean; + validate(value: T, options?: ValidateOptions): Promise; + validateSync(value: T, options?: ValidateOptions): ValidationError|T; + isValid(value: T, options?: any): Promise; + isValidSync(value: T, options?: any): boolean; + cast(value: any, options?: any): T; + isType(value: any): value is T; strict(isStrict: boolean): this; strip(strip: boolean): this; withMutation(fn: (current: this) => void): void; @@ -61,7 +61,7 @@ export interface MixedSchemaConstructor { } // tslint:disable-next-line:no-empty-interface -export interface MixedSchema extends Schema { +export interface MixedSchema extends Schema { } export interface StringSchemaConstructor { @@ -69,7 +69,7 @@ export interface StringSchemaConstructor { new(): StringSchema; } -export interface StringSchema extends Schema { +export interface StringSchema extends Schema { min(limit: number | Ref, message?: string): StringSchema; max(limit: number | Ref, message?: string): StringSchema; matches(regex: RegExp, message?: string): StringSchema; @@ -86,7 +86,7 @@ export interface NumberSchemaConstructor { new(): NumberSchema; } -export interface NumberSchema extends Schema { +export interface NumberSchema extends Schema { min(limit: number | Ref, message?: string): NumberSchema; max(limit: number | Ref, message?: string): NumberSchema; lessThan(limit: number | Ref, message?: string): NumberSchema; @@ -104,7 +104,7 @@ export interface BooleanSchemaConstructor { } // tslint:disable-next-line:no-empty-interface -export interface BooleanSchema extends Schema { +export interface BooleanSchema extends Schema { } export interface DateSchemaConstructor { @@ -112,36 +112,36 @@ export interface DateSchemaConstructor { new(): DateSchema; } -export interface DateSchema extends Schema { +export interface DateSchema extends Schema { min(limit: Date | string | Ref, message?: string): DateSchema; max(limit: Date | string | Ref, message?: string): DateSchema; } export interface ArraySchemaConstructor { - (): ArraySchema; - new(): ArraySchema; + (schema?: Schema): ArraySchema; + new(): ArraySchema<{}>; } -export interface ArraySchema extends Schema { - of(type: Schema): ArraySchema; - min(limit: number | Ref, message?: string): ArraySchema; - max(limit: number | Ref, message?: string): ArraySchema; - ensure(): ArraySchema; - compact(rejector: (value: any) => boolean): ArraySchema; +export interface ArraySchema extends Schema { + of(type: Schema): ArraySchema; + min(limit: number | Ref, message?: string): ArraySchema; + max(limit: number | Ref, message?: string): ArraySchema; + ensure(): ArraySchema; + compact(rejector: (value: any) => boolean): ArraySchema; } export interface ObjectSchemaConstructor { - (fields?: any): ObjectSchema; - new(): ObjectSchema; + (fields?: { [field in keyof T]: Schema }): ObjectSchema; + new (): ObjectSchema<{}>; } -export interface ObjectSchema extends Schema { - shape(fields: any, noSortEdges?: Array<[string, string]>): ObjectSchema; - from(fromKey: string, toKey: string, alias?: boolean): ObjectSchema; - noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema; +export interface ObjectSchema extends Schema { + shape(fields: { [field in keyof T]: Schema }, noSortEdges?: Array<[string, string]>): ObjectSchema; + from(fromKey: string, toKey: string, alias?: boolean): ObjectSchema; + noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema; transformKeys(callback: (key: any) => any): void; - camelCase(): ObjectSchema; - constantCase(): ObjectSchema; + camelCase(): ObjectSchema; + constantCase(): ObjectSchema; } export type TransformFunction = ((this: T, value: any, originalValue: any) => any); @@ -240,7 +240,7 @@ export interface Ref { } // tslint:disable-next-line:no-empty-interface -export interface Lazy extends Schema { +export interface Lazy extends Schema { } export interface LocaleObject { @@ -250,6 +250,6 @@ export interface LocaleObject { boolean?: { [key in keyof BooleanSchema]?: string }; bool?: { [key in keyof BooleanSchema]?: string }; date?: { [key in keyof DateSchema]?: string }; - array?: { [key in keyof ArraySchema]?: string }; - object?: { [key in keyof ObjectSchema]?: string }; + array?: { [key in keyof ArraySchema]?: string }; + object?: { [key in keyof ObjectSchema]?: string }; } diff --git a/types/yup/tsconfig.json b/types/yup/tsconfig.json index c0aa18bfc2..2f701d2d03 100644 --- a/types/yup/tsconfig.json +++ b/types/yup/tsconfig.json @@ -21,4 +21,4 @@ "lib/customLocale.d.ts", "yup-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/yup/yup-tests.ts b/types/yup/yup-tests.ts index 8d84bbf42d..9dd02ced73 100644 --- a/types/yup/yup-tests.ts +++ b/types/yup/yup-tests.ts @@ -35,7 +35,7 @@ schema = yup.object().shape({ schema.cast({ foo: { bar: 'boom' } }, { context: { x: 5 } }); // lazy function -const node: ObjectSchema = yup.object().shape({ +const node: ObjectSchema = yup.object().shape({ id: yup.number(), child: yup.lazy(() => node.default(undefined) @@ -158,7 +158,7 @@ yup.object().shape({ }); // String schema -const strSchema = yup.string(); +const strSchema = yup.string(); // $ExpectType StringSchema strSchema.isValid('hello'); // => true strSchema.required(); strSchema.min(5, 'message'); @@ -172,7 +172,7 @@ strSchema.lowercase(); strSchema.uppercase(); // Number schema -const numSchema = yup.number(); +const numSchema = yup.number(); // $ExpectType NumberSchema numSchema.isValid(10); // => true numSchema.min(5, 'message'); numSchema.max(5, 'message'); @@ -209,6 +209,10 @@ arrSchema.required(); arrSchema.ensure(); arrSchema.compact(value => value === null); +yup.array(); // $ExpectType ArraySchema<{}> +yup.array(yup.string()); // $ExpectType ArraySchema +yup.array().of(yup.string()); // $ExpectType ArraySchema + // Object Schema const objSchema = yup.object().shape({ name: yup.string().required(), @@ -261,3 +265,71 @@ setLocale({ number: { max: "Max message", min: "Min message" }, string: { email: "String message"} }); + +interface MyInterface { + stringField: string; + numberField: number; + subFields: SubInterface; + arrayField: string[]; +} + +interface SubInterface { + testField: string; +} + +// $ExpectType ObjectSchema +const typedSchema = yup.object({ + stringField: yup.string().required(), // $ExpectType StringSchema + numberField: yup.number().required(), // $ExpectType NumberSchema + subFields: yup.object({ + testField: yup.string().required(), + }).required(), + arrayField: yup.array(yup.string()).required(), // $ExpectType ArraySchema +}); + +const testObject: MyInterface = { + stringField: "test1", + numberField: 123, + subFields: { + testField: "test2" + }, + arrayField: ["hi"], +}; + +typedSchema.validateSync(testObject); // $ExpectType ValidationError | MyInterface + +// $ExpectError +yup.object({ + stringField: yup.string().required(), + subFields: yup.object({ + testField: yup.string().required(), + }).required(), + arrayField: yup.array(yup.string()).required(), +}); + +// $ExpectError +yup.object({ + stringField: yup.number().required(), + numberField: yup.number().required(), + subFields: yup.object({ + testField: yup.string().required(), + }).required(), + arrayField: yup.array(yup.string()).required(), +}); + +// $ExpectError +yup.object({ + stringField: yup.string().required(), + numberField: yup.number().required(), + arrayField: yup.array(yup.string()).required(), +}); + +// $ExpectError +yup.object({ + stringField: yup.string().required(), + numberField: yup.number().required(), + subFields: yup.object({ + testField: yup.number().required(), + }).required(), + arrayField: yup.array(yup.string()).required(), +}); diff --git a/types/zen-observable/zen-observable-tests.ts b/types/zen-observable/zen-observable-tests.ts index b4da077311..b06e7cb512 100644 --- a/types/zen-observable/zen-observable-tests.ts +++ b/types/zen-observable/zen-observable-tests.ts @@ -1,4 +1,4 @@ -import * as Observable from 'zen-observable'; +import Observable = require('zen-observable'); function assert(val: boolean) { if (!val) { diff --git a/types/zen-push/tsconfig.json b/types/zen-push/tsconfig.json index d3e8efb833..7f5c9dded5 100644 --- a/types/zen-push/tsconfig.json +++ b/types/zen-push/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "zen-push-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/zen-push/zen-push-tests.ts b/types/zen-push/zen-push-tests.ts index 79abc517e8..70feab99f6 100644 --- a/types/zen-push/zen-push-tests.ts +++ b/types/zen-push/zen-push-tests.ts @@ -1,5 +1,5 @@ import PushStream from 'zen-push'; -import * as Observable from 'zen-observable'; +import Observable = require('zen-observable'); function assert(val: boolean) { if (!val) { diff --git a/types/zenscroll/tsconfig.json b/types/zenscroll/tsconfig.json index 89fc59c020..4d5538d022 100644 --- a/types/zenscroll/tsconfig.json +++ b/types/zenscroll/tsconfig.json @@ -8,7 +8,7 @@ "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, - "strictFunctionTypes": true, + "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -19,6 +19,6 @@ }, "files": [ "index.d.ts", - "zenscroll-tests.ts" + "zenscroll-tests.ts" ] } \ No newline at end of file diff --git a/types/zeromq/index.d.ts b/types/zeromq/index.d.ts index 189d60fc29..d1088aba8f 100644 --- a/types/zeromq/index.d.ts +++ b/types/zeromq/index.d.ts @@ -240,3 +240,14 @@ export function createSocket(type: string, options?: any): Socket; * @return The public and secret portions of the key. */ export function curveKeypair(): CurveKeyPair; + +/** + * Connects a frontend socket to a backend socket. + * @param frontend The frontend socket to connect with the backend socket. + * Frontend socket should be a 'push', 'pull', 'xpub', 'router' or 'xrep' socket. + * @param backend The backend socket to connect with the frontend socket. + * Backend socket should be a 'pull', 'push', 'xsub', 'dealer' or 'xreq' socket. + * @param capture If defined, this socket will receive all messages from frontend and backend socket + * Capture socket should be a 'pub', 'dealer', 'push' or 'pair' socket. + */ +export function proxy(frontend: Socket, backend: Socket, capture ?: Socket): void; diff --git a/types/zeromq/zeromq-tests.ts b/types/zeromq/zeromq-tests.ts index a1230957a7..466deaf4b7 100644 --- a/types/zeromq/zeromq-tests.ts +++ b/types/zeromq/zeromq-tests.ts @@ -48,3 +48,13 @@ function test6() { sock.pause(); sock.resume(); } + +function test7() { + const xPubSocket = zeromq.socket('xpub'); + const xPSubSocket = zeromq.socket('xsub'); + + xPubSocket.bindSync(`tcp://127.0.0.1:3000`); + xPSubSocket.bindSync('tcp://127.0.0.1:3001'); + + zeromq.proxy(xPubSocket, xPSubSocket); +} diff --git a/types/zipcodes/tsconfig.json b/types/zipcodes/tsconfig.json index ff98ed05f8..5958e9b659 100644 --- a/types/zipcodes/tsconfig.json +++ b/types/zipcodes/tsconfig.json @@ -1,23 +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", - "zipcodes-tests.ts" - ] + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "zipcodes-tests.ts" + ] } \ No newline at end of file diff --git a/types/zipkin-context-cls/tsconfig.json b/types/zipkin-context-cls/tsconfig.json index 6cd3375b4f..57430d50b2 100644 --- a/types/zipkin-context-cls/tsconfig.json +++ b/types/zipkin-context-cls/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "zipkin-context-cls-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/zipkin-instrumentation-express/tsconfig.json b/types/zipkin-instrumentation-express/tsconfig.json index 8038e5a2cd..fe28fc0e75 100644 --- a/types/zipkin-instrumentation-express/tsconfig.json +++ b/types/zipkin-instrumentation-express/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "zipkin-instrumentation-express-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/zipkin-instrumentation-fetch/tsconfig.json b/types/zipkin-instrumentation-fetch/tsconfig.json index 1cf310ea24..56ca69ea74 100644 --- a/types/zipkin-instrumentation-fetch/tsconfig.json +++ b/types/zipkin-instrumentation-fetch/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "zipkin-instrumentation-fetch-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/zipkin-transport-http/tsconfig.json b/types/zipkin-transport-http/tsconfig.json index 4f892dbef3..7ed663b14b 100644 --- a/types/zipkin-transport-http/tsconfig.json +++ b/types/zipkin-transport-http/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "zipkin-transport-http-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/zookeeper/tsconfig.json b/types/zookeeper/tsconfig.json index 281f393e23..8a2da6e565 100644 --- a/types/zookeeper/tsconfig.json +++ b/types/zookeeper/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "zookeeper-tests.ts" ] -} +} \ No newline at end of file diff --git a/types/zxcvbn/tsconfig.json b/types/zxcvbn/tsconfig.json index 72bae94375..c31dddc18b 100644 --- a/types/zxcvbn/tsconfig.json +++ b/types/zxcvbn/tsconfig.json @@ -20,4 +20,4 @@ "index.d.ts", "zxcvbn-tests.ts" ] -} +} \ No newline at end of file