diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 6477b03f07..81913375f9 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -49,7 +49,7 @@ /types/adal-angular/ @unindented @aciccarello /types/add-zero/ @Roaders /types/adlib/ @Esri @MikeTschudi -/types/adm-zip/ @jvilk @abner +/types/adm-zip/ @jvilk @abner @BendingBender /types/adone/ @s0m3on3 @maxveres /types/aes-js/ @federicobond /types/aframe/ @devpaul @bertoritger @twastvedt @@ -59,12 +59,14 @@ /types/agora-rtc-sdk/ @menthays /types/airbnb-prop-types/ @milesj /types/ajv-errors/ @afshawnlotfi +/types/ajv-merge-patch/ @littlepiggy03 /types/ale-url-parser/ @msn0 /types/alertify/ @jjeffery /types/alexa-sdk/ @petebeegle @hoo29 @pascalwhoop @blforce @rk-7 @alexmalcoci /types/alexa-voice-service/ @dolanmiu /types/algebra.js/ @CaselIT -/types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss @keichinger +/types/algoliasearch/ @cbaptiste @haroenv @aherve @samouss @keichinger @neryortez @antoinerousseau +/types/algoliasearch-helper/ @gburgett @haroenv @samouss /types/ali-app/ @taoqf /types/ali-oss/ @ptrdu /types/all-keys/ @BendingBender @@ -72,6 +74,7 @@ /types/allure-js-commons/ @zaqqaz /types/almost-equal/ @cmaddalozzo /types/alt/ @Shearerbeard +/types/amap-js-api/ @breeze9527 /types/amap-js-sdk/ @agasbzj /types/amazon-cognito-auth-js/ @scottescue /types/amazon-product-api/ @MattiLehtinen @alien35 @@ -160,7 +163,7 @@ /types/angularlocalstorage/ @horiuchi /types/angulartics/ @bateast2 /types/animation-frame/ @qinfchen -/types/animejs/ @A-Babin +/types/animejs/ @A-Babin @supaiku0 /types/annyang/ @hisham @theluk /types/ansi/ @Gustavo6046 /types/ansi-colors/ @rogierschouten @BendingBender @@ -204,7 +207,7 @@ /types/archy/ @vvakame /types/are-we-there-yet/ @brianloveswords /types/argon2-browser/ @ivangabriele -/types/argparse/ @arcticwaters @tlaziuk @eps1lon +/types/argparse/ @arcticwaters @tlaziuk @eps1lon @cakoose /types/args/ @Slessi /types/argv/ @hookclaw /types/arr-diff/ @BendingBender @@ -273,7 +276,8 @@ /types/await-timeout/ @szhu /types/awesomplete/ @webbiesdk @bmdixon @tbekolay @chrislopresto /types/aws-iot-device-sdk/ @niik @mlamp -/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory @dalen +/types/aws-lambda/ @skarum @tobyhede @buggy @y13i @wwwy3y3 @OrthoDex @MichaelMarner @daniel-cottone @kostya-misura @coderbyheart @palmithor @daniloraisi @simonbuchan @Haydabase @repl-chris @aneilbaboo @jeznag @louislarry @dpapukchiev @ohookins @trevor-leach @jagregory @dalen @loikg @skyzenr @richardcornelissen @redlickigrzegorz +/types/aws-param-store/ @jasonthomasgray /types/aws-serverless-express/ @threesquared @jcaffey @mattmeye @albertovasquez /types/aws4/ @ajcrites /types/axe-webdriverjs/ @JoshuaKGoldberg @@ -295,7 +299,7 @@ /types/babel-types/ @yortus @baxtersa @marvinhagemeister @bcherny /types/babel-webpack-plugin/ @j-f1 /types/babel__code-frame/ @mohsen1 @ForbesLindesay -/types/babel__core/ @yortus @marvinhagemeister @mgroenhoff +/types/babel__core/ @yortus @marvinhagemeister @mgroenhoff @Jessidhia /types/babel__generator/ @yortus @johnnyestilles @mgroenhoff /types/babel__template/ @yortus @marvinhagemeister @mgroenhoff /types/babel__traverse/ @yortus @marvinhagemeister @rpetrich @mgroenhoff @@ -303,15 +307,15 @@ /types/babylon/ @yortus @marvinhagemeister /types/babylon-walk/ @czbuchi /types/babyparse/ @cdiddy77 -/types/backbone/ @borisyankov @nvivo @kenjiru @jjoekoullas +/types/backbone/ @borisyankov @nvivo @kenjiru @jjoekoullas @jgonggrijp /types/backbone-associations/ @craigbrett17 /types/backbone-fetch-cache/ @delphinus35 -/types/backbone-relational/ @eirikhm +/types/backbone-relational/ @eirikhm @jgonggrijp /types/backbone.layoutmanager/ @hejiang2000 /types/backbone.localstorage/ @lgrignon -/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs @jjoekoullas +/types/backbone.marionette/ @zhamid @nvivo @sventschui @razorness @confususs @jjoekoullas @jgonggrijp /types/backbone.paginator/ @Nyamazing -/types/backbone.radio/ @alphaleonis +/types/backbone.radio/ @alphaleonis @jgonggrijp /types/backgrid/ @jlujan /types/backlog-js/ @vvatanabe /types/backo2/ @Retsam @@ -371,10 +375,11 @@ /types/bindings/ @unindented /types/bintrees/ @CjS77 /types/bip21/ @stefanhuber -/types/bip32/ @me +/types/bip32/ @eduhenke /types/bip38/ @micksatana /types/bip39/ @micksatana /types/bit-array/ @mudkipme +/types/bit-twiddle/ @adamzerella /types/bitcoinjs-lib/ @mhegazy @dlebrecht @rbuckton @micksatana @youssefgh @kento1218 /types/bitcore-lib/ @lautarodragan /types/bittorrent-protocol/ @feross @tlaziuk @@ -414,6 +419,7 @@ /types/bootstrap/ @denisname /types/bootstrap/v3/ @borisyankov @denisname /types/bootstrap-3-typeahead/ @AndersonFriaca +/types/bootstrap-colorpicker/ @aleksandar-manukov /types/bootstrap-datepicker/ @borisyankov /types/bootstrap-fileinput/ @CheCoxshall /types/bootstrap-growl-ifightcrime/ @AndersonFriaca @@ -434,11 +440,10 @@ /types/bootstrap3-dialog/ @nakupanda @cnboland /types/bounce.js/ @cherrry /types/box2d/ @jbaldwin -/types/boxen/ @BendingBender /types/bpmn-moddle/ @haydos89 /types/brace-expansion/ @BendingBender /types/braces/ @vemoo -/types/braft-editor/ @me +/types/braft-editor/ @petitspois /types/braintree-web/ @chlela /types/breeze/ @borisyankov /types/bricks.js/ @kondi @@ -453,11 +458,11 @@ /types/browser-resolve/ @marionebl /types/browser-sync/ @joeskeen @aznnomness /types/browserify/ @AndrewGaspar @jvilk @leonard-thieu @LinusU -/types/browserslist/ @davecardwell +/types/browserslist/ @davecardwell @AndrewLeedham /types/browserslist-useragent/ @nju33 /types/bs58/ @chrootsu @BendingBender /types/bs58/v3/ @chrootsu -/types/bson/ @horiuchi @CaselIT +/types/bson/ @horiuchi @CaselIT @justingrant /types/btoa/ @johngeorgewright @bricka /types/buble/ @Kocal /types/bucks/ @zaneli @@ -469,6 +474,7 @@ /types/buffer-xor/ @danwbyrne /types/buffers/ @rhencke /types/bufferstream/ @Bartvds +/types/build-output-script/ @BendingBender /types/builtin-modules/ @ajafff /types/bull/ @bgrieder @JProgrammer @marshall007 @weeco @blaugold @iamolegga @koblas @bondz @wuha-team @aleccool213 @danmana @kjellmorten @pc-jedi /types/bull/v2/ @bgrieder @JProgrammer @@ -480,11 +486,13 @@ /types/bunyan-config/ @cyrilschumacher /types/bunyan-format/ @dex4er /types/bunyan-prettystream/ @jasonswearingen @enlight +/types/bunyan-seq/ @raybooysen /types/bunyan-winston-adapter/ @stevehipwell /types/busboy/ @jacobbaskin /types/business-rules-engine/ @rsamec /types/bwip-js/ @MugeSo /types/byline/ @reppners +/types/byte-range/ @BendingBender /types/bytebuffer/ @cappellin /types/bytes/ @danny8002 @believer /types/bytewise/ @danwbyrne @@ -499,8 +507,8 @@ /types/callsites/ @BendingBender /types/calq/ @eirikhm /types/camaro/ @tuananh -/types/camelcase/ @samverschueren /types/camelcase-keys/ @mhegazy +/types/camljs/ @andrei-markeev /types/camo/ @lucasmciruzzi /types/cancan/ @Vincent-Pang /types/caniuse-api/ @davecardwell @@ -511,18 +519,27 @@ /types/canvasjs/ @brutalimp /types/capitalize/ @frederickfogerty /types/capture-console/ @AustonZ +/types/carbon__colors/ @vpicone +/types/carbon__layout/ @vpicone +/types/carbon__motion/ @vpicone +/types/carbon__themes/ @vpicone +/types/carbon__type/ @vpicone /types/card-validator/ @ChanceM +/types/carlo/ @adierkens /types/case-sensitive-paths-webpack-plugin/ @r3nya -/types/caseless/ @downace @mastermatt +/types/caseless/ @downace @mastermatt @forivall /types/cash/ @akvlko /types/casperjs/ @jedmao @urielch -/types/cassandra-driver/ @Svjard @pc-jedi +/types/cassandra-driver/ @Svjard @pc-jedi @michal-b-kaminski +/types/cassanknex/ @bioball /types/catbox/ @jasonswearingen @AJamesPhillips @saboya /types/catbox/v7/ @jasonswearingen @AJamesPhillips /types/catbox-memory/ @SimonSchick /types/catbox-redis/ @SimonSchick +/types/cavy/ @tyler-hoffman /types/cbor/ @pushplay /types/ccap/ @taoqf +/types/centra/ @twooster /types/cesium/ @Zuzon @hnipps @szechyjs @golyalpha /types/cfn-response/ @ivoisbelongtous /types/chai/ @jedmao @Bartvds @AGBrown @olivr70 @mwistrand @joshuakgoldberg @shaunluttin @Naktibalda @micksatana @ErikSchierboom @@ -535,10 +552,10 @@ /types/chai-enzyme/ @asvetliakov /types/chai-fs/ @dimitardanailov /types/chai-fuzzy/ @Bartvds -/types/chai-http/ @Nemo157 @G1itcher @CaselIT @bas-l /types/chai-jest-snapshot/ @mattvperry /types/chai-jquery/ @kazimanzurrashid /types/chai-json-schema/ @ulrichheiniger +/types/chai-moment/ @chrisgodsey /types/chai-oequal/ @mizunashi-mana /types/chai-roughly/ @swist /types/chai-spies/ @kuzn-ilya @harm-less @jounisuo @@ -561,11 +578,10 @@ /types/check-types/ @idchlife /types/checkstyle-formatter/ @mhegazy /types/checksum/ @rogierschouten -/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz +/types/cheerio/ @blittle @wmaurer @umarniz @LiJinyao @chennakrishna8 @AzSiAz @nwtgck /types/chess.js/ @JacobFischer /types/chessboardjs/ @sliverb @davidmpaz /types/chmodr/ @BendingBender -/types/chokidar/ @reppners @felixfbecker @bayssmekanique /types/chordsheetjs/ @adamsbloom /types/chosen-js/ @borisyankov @denisname /types/chownr/ @BendingBender @@ -576,6 +592,7 @@ /types/chromecast-caf-receiver/ @craigrbruce /types/chromecast-caf-sender/ @samuelmaddock /types/chromedriver/ @pe8ter +/types/cipher-base/ @adamzerella /types/circuit-breaker-js/ @DeTeam /types/circular-json/ @jpevarnek /types/ckeditor/ @wittwert @stuartlong @viktorpegy @@ -591,7 +608,6 @@ /types/clean-css/v3/ @tkrotoff /types/clean-regexp/ @BendingBender /types/clean-stack/ @BendingBender -/types/clean-webpack-plugin/ @j-f1 /types/clear-require/ @dan-j /types/clearbladejs-client/ @ClearBlade /types/clearbladejs-node/ @ClearBlade @@ -618,6 +634,7 @@ /types/clmtrackr/ @hellochar /types/clndr/ @jasperjn /types/clockpicker/ @jfcere +/types/clone-deep/ @tanfonto /types/cloneable-readable/ @qlonik /types/cloner/ @matrumz /types/closure-compiler/ @mprobst @@ -627,6 +644,7 @@ /types/cls-hooked/ @aleung /types/clusterize.js/ @Pr1st0n /types/cmd-shim/ @cspotcode +/types/co/ @doniyor2109 /types/co-body/ @geoffreak /types/co-views/ @devlee @geoffreak /types/code/ @prashaantt @@ -637,6 +655,7 @@ /types/coinlist/ @BendingBender /types/coinstring/ @mhegazy /types/collections/ @scarabedore +/types/collectionsjs/ @jaymeh /types/color/ @Airlun @jameswlane /types/color/v2/ @Airlun /types/color/v1/ @LKay @@ -646,6 +665,7 @@ /types/color-name/ @Ailrun /types/color-namer/ @in19farkt /types/color-string/ @BendingBender @danmarshall +/types/color-support/ @Yavanosta /types/colorbrewer/ @mtraynham /types/colornames/ @manuth /types/colresizable/ @gilleswaeber @@ -654,7 +674,7 @@ /types/combine-source-map/ @TeamworkGuy2 /types/combined-stream/ @felixge @tlaziuk @konpikwastaken /types/combokeys/ @iclanton -/types/cometd/ @derekcicerone @unindented @alxHenry +/types/cometd/ @derekcicerone @unindented @alxHenry @hagl /types/command-exists/ @BendingBender /types/command-line-args/ @75lb /types/command-line-args/v4/ @CzBuCHi @75lb @@ -672,6 +692,7 @@ /types/compare-version/ @jpevarnek /types/compare-versions/ @LogvinovLeon /types/complex/ @AyaMorisawa @pavasich +/types/complex.js/ @adamzerella /types/component-emitter/ @psnider /types/compose-function/ @denis-sokolov /types/compressible/ @BendingBender @@ -681,27 +702,26 @@ /types/compute-stdev/ @mrmlnc /types/concat-stream/ @jmarianer /types/concaveman/ @DenisCarriere -/types/conf/ @SamVerschueren @BendingBender -/types/conf/v1/ @SamVerschueren @BendingBender -/types/conf/v0/ @SamVerschueren +/types/condense-whitespace/ @djcsdy /types/confidence/ @jppellerin /types/config/ @RWander @forrestbice @jndonald3 @albertovasquez -/types/config-yaml/ @me +/types/config-yaml/ @Arylo /types/configstore/ @ArcticLight /types/configurable/ @jewbre /types/confit/ @ethanresnick /types/connect/ @SomaticIT @EvanHahn /types/connect-busboy/ @pinguet62 -/types/connect-datadog/ @moshegood +/types/connect-datadog/ @moshegood @xzyfer /types/connect-ensure-login/ @0x6368656174 /types/connect-flash/ @AndreasGassmann /types/connect-history-api-fallback/ @douglasduteil +/types/connect-history-api-fallback-exclusions/ @tonystonee /types/connect-livereload/ @SomaticIT /types/connect-modrewrite/ @tinganho /types/connect-mongo/ @Syati /types/connect-mongodb-session/ @NattapongSiri /types/connect-pg-simple/ @pasieronen -/types/connect-redis/ @xstoudi +/types/connect-redis/ @xstoudi @sbutler2901 /types/connect-slashes/ @samherrmann /types/connect-timeout/ @cyrilschumacher /types/consola/ @Jungwoo-An @@ -730,7 +750,6 @@ /types/cookies/ @WangZishi @jkeylu @BendingBender /types/copy/ @ffflorian /types/copy-paste/ @SrTobi -/types/copy-text-to-clipboard/ @BendingBender /types/copy-webpack-plugin/ @flying-sheep /types/copyfiles/ @ffflorian /types/cordova-ionic/ @hendrikmaus @@ -773,9 +792,7 @@ /types/country-select-js/ @humrochagf /types/countup.js/ @shermendev /types/coverup/ @bevalorous -/types/cp-file/ @BendingBender /types/cpx/ @alan-agius4 -/types/cpy/ @mhegazy @BendingBender /types/cqrs-domain/ @blissi /types/cradle/ @panuhorsmalahti /types/crc/ @YuJianrong @@ -785,6 +802,7 @@ /types/create-html-element/ @BendingBender /types/create-react-class/ @jgoz /types/create-subscription/ @Asana @vsiao +/types/create-xpub/ @BendingBender /types/createjs/ @evilangelist @gyohk /types/createjs-lib/ @evilangelist @gyohk /types/credential/ @phuvo @@ -811,9 +829,11 @@ /types/css/ @ilich /types/css-font-loading-module/ @slikts /types/css-modules/ @NeekSandhu +/types/css-modules-loader-core/ @skovy /types/css-to-style/ @bengry /types/css-tree/ @erik-kallen /types/cssbeautify/ @rictic +/types/cssesc/ @djcsdy /types/cssnano/ @odnamrataizem /types/csso/ @screendriver @erik-kallen /types/csurf/ @horiuchi @@ -845,7 +865,7 @@ /types/d3-box/ @lk-chen /types/d3-brush/ @tomwanzek @gustavderdrache @borisyankov /types/d3-chord/ @tomwanzek @gustavderdrache @borisyankov -/types/d3-cloud/ @hansrwindhoff +/types/d3-cloud/ @hansrwindhoff @locknono /types/d3-collection/ @tomwanzek @gustavderdrache @borisyankov /types/d3-color/ @tomwanzek @gustavderdrache @borisyankov @denisname @ledragon /types/d3-contour/ @tomwanzek @Ledragon @@ -855,7 +875,7 @@ /types/d3-dsv/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-ease/ @tomwanzek @gustavderdrache @borisyankov /types/d3-fetch/ @ledragon @denisname -/types/d3-force/ @tomwanzek @gustavderdrache @borisyankov +/types/d3-force/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-format/ @tomwanzek @gustavderdrache @borisyankov @denisname /types/d3-geo/ @ledragon @tomwanzek @gustavderdrache @borisyankov /types/d3-graphviz/ @DomParfitt @@ -894,6 +914,7 @@ /types/dat.gui/ @gyohk @sonic3d @rroylance @singuerinc /types/data-driven/ @mrhen /types/datadog-metrics/ @pushplay +/types/datadog-statsd-metrics-collector/ @xzyfer /types/datadog-tracer/ @dineshsaravanan /types/datatables.net/ @Silver-Connection @omidkrad @pragmatrix @CNBoland /types/datatables.net-autofill/ @andy-maca @@ -904,7 +925,9 @@ /types/datatables.net-rowreorder/ @baywet /types/datatables.net-scroller/ @RohdeK /types/datatables.net-select/ @szechyjs +/types/date-and-time/ @danplisetsky /types/date-arithmetic/ @HeeL +/types/date-now/ @adamzerella /types/date.format.js/ @balrob /types/dateformat/ @aicest @BendingBender /types/dateformat/v1/ @aicest @@ -916,14 +939,12 @@ /types/db-migrate-pg/ @nickiannone /types/db.js/ @cgwrench /types/dc/ @hansrwindhoff @mtraynham @MatthiasJobst -/types/dd-trace/ @ColinBradley @alloy /types/deasync/ @Sicilica /types/debessmann/ @vkorehov /types/debounce/ @denis-sokolov @joshuakgoldberg @wcarson /types/debounce-fn/ @BendingBender /types/debounce-promise/ @whtsky -/types/debug/ @swook @galtalmor @zamb3zi @brasten -/types/decamelize/ @samverschueren +/types/debug/ @swook @galtalmor @zamb3zi @brasten @npenin /types/decay/ @enaeseth /types/decode-entities/ @waspothegreat /types/decode-uri-component/ @BendingBender @@ -934,6 +955,7 @@ /types/deep-assign/ @souldreamer /types/deep-diff/ @ZauberNerd /types/deep-equal/ @remojansen @janslow +/types/deep-equal-in-any-order/ @bcaudan /types/deep-extend/ @rhysd /types/deep-freeze/ @Bartvds @aluanhaddad /types/deep-freeze-es6/ @mattbishop @@ -946,8 +968,6 @@ /types/defined/ @BendingBender /types/deglob/ @saadq /types/deku/ @pocka -/types/del/ @AyaMorisawa @BendingBender @bitjson -/types/del/v2/ @AyaMorisawa /types/delaunator/ @DenisCarriere @BTOdell /types/delete-empty/ @Alorel /types/deline/ @iarroyo5 @@ -963,7 +983,6 @@ /types/derhuerst__cli-on-key/ @jacobbubu /types/destroy/ @BendingBender /types/destroy-on-hwm/ @BendingBender -/types/detect-browser/ @rogierschouten @carusology /types/detect-character-encoding/ @BendingBender /types/detect-hover/ @thomastilkema /types/detect-indent/ @Bartvds @BendingBender @@ -993,11 +1012,12 @@ /types/diffie-hellman/ @BendingBender /types/digibyte/ @lautarodragan @werewolfe /types/dinero.js/ @BendingBender +/types/dingtalk-robot-sender/ @bangbang93 /types/dir-glob/ @BendingBender /types/dir-resolve/ @andy-ms /types/dirname-regex/ @BendingBender /types/discontinuous-range/ @OiCMudkips -/types/discord-rpc/ @jasonhaxstuff +/types/discord-rpc/ @jasonhaxstuff @lolPants /types/discourse-sso/ @championswimmer /types/dispatchr/ @Ragg- /types/disposable-email-domains/ @geoffreak @@ -1022,9 +1042,12 @@ /types/dom-mediacapture-record/ @eliasmeire /types/dom-to-image/ @JipSterk /types/dom4/ @adidahiya @giladgray +/types/domelementtype/ @johandavidson +/types/domhandler/ @johandavidson /types/domo/ @Steve-Fenton /types/dompurify/ @bazuzi @FlowCrypt /types/domready/ @dotnetnerd +/types/domutils/ @johandavidson /types/donna/ @vvakame /types/dookie/ @swanest /types/dot/ @ZombieHunter @@ -1049,8 +1072,10 @@ /types/draft-js/ @dmitryrogozhny @eelco @ghotiphud @schwers @michael-yx-wu @willisplummer @smvilar @sulf @pablopunk @claudiopro /types/drag-timetable/ @chinkan /types/draggabilly/ @jaydubu +/types/dragscroll/ @spkellydev /types/dragster/ @zskovacs /types/dragula/ @pwelter34 @abruzzihraig +/types/driftless/ @dandelany /types/drivelist/ @WholeMilk /types/dropbox-chooser/ @quas94 /types/dropboxjs/ @Steve-Fenton @xperiments @@ -1064,6 +1089,7 @@ /types/duplicate-package-checker-webpack-plugin/ @mtraynham /types/durandal/ @BlueSpire /types/dustjs-linkedin/ @mdezem +/types/dv/ @taoqf /types/dvtng-jss/ @Ptival /types/dw-bxslider-4/ @namerci /types/dwt/ @yushulx @jbh @lincoln2018 @Tom-Dynamsoft @@ -1082,8 +1108,9 @@ /types/easy-table/ @nikeee /types/easy-xapi/ @DeadAlready /types/easy-xapi-utils/ @DeadAlready +/types/easydate/ @satyarohith /types/ebongarde-root/ @Ebongarde -/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 +/types/echarts/ @xieisabug @AntiMoron @liveangela @Ovilia @iRON5 @bilalucar @tmtron @dwhitney /types/ecma-proposal-math-extensions/ @ksm2 /types/ecurve/ @mhegazy /types/ed25519/ @erikma @@ -1151,7 +1178,7 @@ /types/ember__object/ @mike-north /types/ember__polyfills/ @mike-north /types/ember__routing/ @mike-north -/types/ember__runloop/ @mike-north +/types/ember__runloop/ @mike-north @scalvert /types/ember__service/ @mike-north /types/ember__string/ @mike-north /types/ember__test/ @mike-north @@ -1179,10 +1206,9 @@ /types/entities/ @aliceklipper /types/env-ci/ @BendingBender /types/env-editor/ @BendingBender -/types/env-paths/ @danwbyrne /types/env-to-object/ @MugeSo /types/envify/ @tkQubo -/types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden @hotell +/types/enzyme/ @MarianPalkus @NoHomey @jwbay @huhuanming @MartynasZilinskas @thovden @hotell @screendriver /types/enzyme-adapter-react-15/ @tkrotoff /types/enzyme-adapter-react-15.4/ @nali /types/enzyme-adapter-react-16/ @tkrotoff @@ -1221,12 +1247,13 @@ /types/estree/ @RReverser /types/etag/ @BendingBender /types/eth-lightwallet/ @LogvinovLeon +/types/eth-sig-util/ @quezak /types/ethereum-protocol/ @LogvinovLeon -/types/ethereumjs-abi/ @LogvinovLeon +/types/ethereumjs-abi/ @LogvinovLeon @quezak /types/ethereumjs-tx/ @LogvinovLeon @dmihal /types/ethereumjs-util/ @cortopy /types/ethjs-signer/ @doppio -/types/eureka-js-client/ @Schnillz @karl-run @tombarton +/types/eureka-js-client/ @Schnillz @karl-run @tombarton @jpsullivan /types/evaporate/ @kookster @chrisrhoden @ailrun /types/event-emitter/ @LKay /types/event-emitter-es6/ @ahstro @@ -1253,16 +1280,19 @@ /types/expect-puppeteer/ @JoshuaKGoldberg @tkrotoff /types/expect.js/ @teppeis /types/expectations/ @vvakame +/types/expired/ @BendingBender /types/expired-storage/ @intolerance /types/expirymanager/ @DanielRose -/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian -/types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo +/types/expo/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 @vinitsood @mattiassamskar @jaulz +/types/expo/v31/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @levansuper @ihmpavel @burtek @jkillian @satya164 @mattiassamskar +/types/expo/v30/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo @mattiassamskar /types/expo/v27/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @moshfeu @prokopcm @tinaroh @binki @mo /types/expo/v26/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov @tinaroh /types/expo/v25/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger @umidbekkarimov /types/expo/v24/ @KonstantinKai @martynaskadisa @janaagaard75 @ssanchezmarc @fhelwanger /types/expo/v23/ @KonstantinKai /types/expo-localization/ @burtek +/types/expo-mixpanel-analytics/ @martintreurnicht /types/expo__status-bar-height/ @dawnmist /types/expo__vector-icons/ @incleaf @robertying /types/express/ @borisyankov @@ -1313,7 +1343,8 @@ /types/express-slow-down/ @jdforsythe /types/express-socket.io-session/ @AylaJK /types/express-to-koa/ @xiaohanzhang -/types/express-unless/ @wokim +/types/express-unless/ @wokim @joaovieira @michal-b-kaminski +/types/express-urlrewrite/ @mgroenhoff /types/express-version-request/ @weffe /types/express-version-route/ @weffe /types/express-wechat-access/ @simmons8616 @@ -1332,13 +1363,14 @@ /types/eyes/ @brynbellomy /types/ez-plus/ @AndersonFriaca /types/f1/ @neolwc -/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods @bmartinson @RogerioTeixeira @BradleyHill +/types/fabric/ @oklemencic @joewashear007 @mrand01 @NotWoods @bmartinson @RogerioTeixeira @BradleyHill @bmkrol823 @glenngartner /types/facebook-instant-games/ @menushka @oyvindjam /types/facebook-js-sdk/ @amritk @mahmoudzohdi @fluidsonic /types/facebook-pixel/ @noctishsu /types/factory-girl/ @stackbuilders @sestrella @elcuy /types/faker/ @bensw @basp @Kuniwak @mattbishop /types/faker/v3/ @Kuniwak +/types/falafel/ @delprzemo /types/falcor/ @Quramy /types/falcor-express/ @Quramy /types/falcor-http-datasource/ @Quramy @@ -1346,7 +1378,7 @@ /types/falcor-router/ @Quramy @cdhgee /types/famous/ @borisvasilenko /types/fancy-log/ @pine -/types/fancybox/ @borisyankov +/types/fancybox/ @borisyankov @SPWizard01 /types/farbtastic/ @EnableSoftware /types/fast-json-stable-stringify/ @BendingBender /types/fast-levenshtein/ @mizunashi-mana @@ -1355,12 +1387,8 @@ /types/fast64/ @rarmatei /types/fastclick/ @shinnn /types/fastify-accepts/ @leomelzer -/types/fastify-cors/ @jannikkeye /types/fastify-favicon/ @tuelsch -/types/fastify-jwt/ @jannikkeye -/types/fastify-multipart/ @jannikkeye /types/fastify-rate-limit/ @pc-jedi -/types/fastify-static/ @leomelzer /types/favico.js/ @drowse314-dev-ymat /types/favicons/ @mohsen1 @metsawyr /types/fb/ @JoshStrobl @@ -1375,7 +1403,7 @@ /types/feathersjs__authentication-oauth1/ @j2L4e /types/feathersjs__authentication-oauth2/ @j2L4e @NickBolles /types/feathersjs__configuration/ @j2L4e -/types/feathersjs__errors/ @j2L4e +/types/feathersjs__errors/ @j2L4e @RazzM13 /types/feathersjs__express/ @j2L4e @DadUndead /types/feathersjs__feathers/ @j2L4e @AbraaoAlves @TimMensch /types/feathersjs__primus/ @j2L4e @@ -1401,11 +1429,10 @@ /types/figures/ @BendingBender /types/file-exists/ @BendingBender /types/file-saver/ @cyrilschumacher @DaIgeb @chrismbarr -/types/file-type/ @tcaesvk @BendingBender /types/file-url/ @coderslagoon /types/filenamify/ @rokt33r /types/filenamify-url/ @cprecioso -/types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk +/types/filesize/ @GiedriusGrabauskas @renchap @Ky6uk @ffxsam /types/fill-pdf/ @westy92 /types/filter-console/ @BendingBender /types/filter-invalid-dom-props/ @icopp @@ -1467,11 +1494,12 @@ /types/focus-within/ @eramdam /types/fontfaceobserver/ @RandScullard /types/fontoxml/ @rolandzwaga +/types/force-graph/ @p-kimberley /types/forever-agent/ @yavanosta /types/forever-monitor/ @shuntksh @wrboyce /types/forge-apis/ @Autodesk-Forge /types/forge-di/ @adamcarr -/types/forge-viewer/ @Autodesk-Forge +/types/forge-viewer/ @Autodesk-Forge @alansmithnbs /types/form-data/ @soywiz @leonyu @BendingBender /types/form-serialize/ @tyler-johnson /types/form-serializer/ @flqw @@ -1685,7 +1713,7 @@ /types/geolite2/ @ffflorian /types/geometry-dom/ @nakakura /types/geopattern/ @Gaelan -/types/gestalt/ @serranoarevalo +/types/gestalt/ @serranoarevalo @joshgachnang /types/get-caller-file/ @ajafff /types/get-certain/ @BendingBender /types/get-emails/ @BendingBender @@ -1695,6 +1723,7 @@ /types/get-node-dimensions/ @vincekovacs /types/get-port/ @plantain-00 @BendingBender /types/get-range/ @BendingBender +/types/get-res/ @satyarohith /types/get-stdin/ @DanielRosenwasser /types/get-stream/ @douglasduteil @BendingBender /types/get-urls/ @BendingBender @@ -1708,7 +1737,8 @@ /types/ghauth/ @Leko /types/gifffer/ @gatimus /types/gijgo/ @atatanasov -/types/giraffe/ @darthapo +/types/giphy-api/ @screendriver +/types/giraffe/ @darthapo @jgonggrijp /types/git/ @vvakame /types/git-add-remote/ @BendingBender /types/git-branch/ @rynclark @@ -1735,6 +1765,9 @@ /types/gl-react-native/ @jussikinnula /types/gl-shader/ @MathiasPaumgarten /types/gl-texture2d/ @MathiasPaumgarten +/types/gl-vec2/ @adamzerella +/types/gl-vec3/ @adamzerella +/types/gl-vec4/ @adamzerella /types/gldatepicker/ @qcz /types/glidejs/ @milanjaros /types/glob/ @vvakame @voy @ajafff @@ -1751,7 +1784,6 @@ /types/global-tunnel-ng/ @BendingBender /types/globalize/ @gcastre @afromogli @bryanforbes /types/globalize-compiler/ @iclanton -/types/globby/ @douglasduteil @ikatyang /types/globule/ @durad /types/glue/ @garfty /types/glue/v4/ @gjednaszewski @@ -1780,7 +1812,7 @@ /types/google.script.client-side/ @clomie /types/google.visualization/ @danludwig @gmoore-sjcorg @danmana @mlcheng @IvanBisultanov @glebm @shrujalshah28 /types/google__maps/ @indrimuska -/types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm +/types/googlemaps/ @cgwrench @nertzy @xaolas @mrmcnerd @martincostello @svenkreiss @bolatovumar @gauthierm @captain-igloo /types/googlemaps.infobubble/ @Dashue /types/googlepay/ @Fluccioni @Radu-Raicea @fstanis /types/got/ @BendingBender @LinusU @ikokostya @stijnvn @@ -1792,7 +1824,7 @@ /types/gramps__rest-helpers/ @claude /types/graphite-udp/ @EricByers /types/graphlib-dot/ @DomParfitt -/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel +/types/graphql/ @TonyPythoneer @calebmer @intellix @firede @kepennar @freiksenet @IvanGoncharov @DxCx @rportugal @tgriesser @dyst5422 @adnsio @divyenduz @bradzacher @clayne11 @JCMais @langpavel @mc0 /types/graphql-date/ @enaeseth /types/graphql-deduplicator/ @lfades /types/graphql-depth-limit/ @eritikass @@ -1809,7 +1841,8 @@ /types/grasp/ @agnoster /types/gravatar/ @denis-sokolov /types/gravatar-url/ @ivangabriele -/types/greasemonkey/ @kotas +/types/greasemonkey/ @kotas @nikolay-borzov +/types/greasemonkey/v3/ @kotas /types/grecaptcha/ @DethAriel @rafaeltavares /types/grecaptcha/v0/ @brentj73 /types/gregorian-calendar/ @cwalv @@ -1817,7 +1850,7 @@ /types/gridstack/ @PascalSenn @ZoolWay @Sl1MBoy /types/grpc-error/ @danwbyrne /types/grunt/ @jeffmay @basarat -/types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp +/types/gsap/ @codebelt @ProbablePrime @philipbulley @leomeloxp @AdemHodzic /types/gtin/ @RafaelKr /types/guardian__prosemirror-invisibles/ @dddotsev /types/guid/ @maroy1986 @@ -1845,6 +1878,7 @@ /types/gulp-file-include/ @DanielRosenwasser /types/gulp-filter/ @tkrotoff /types/gulp-flatten/ @k-kagurazaka +/types/gulp-gh-pages/ @ntnyq /types/gulp-gzip/ @tkQubo /types/gulp-help/ @tkQubo /types/gulp-help-doc/ @Mikhus @@ -1898,6 +1932,8 @@ /types/gulp-util/ @jedmao /types/gulp-watch/ @tkrotoff /types/gulp-zip/ @dudeofawesome +/types/gun/ @Jack-Works +/types/gyronorm/ @evanshortiss /types/gzip-js/ @rhysd /types/gzip-size/ @plantain-00 @jimivdw @andrewiggins /types/gzip-size/v3/ @plantain-00 @@ -1905,7 +1941,6 @@ /types/halfred/ @dherges /types/halogen/ @steller /types/hammerjs/ @milkisevil @codler -/types/handlebars/ @borisyankov @evil-shrike /types/handlebars-helpers/ @Toilal /types/hapi/ @rafaelsouzaf @jhsimms @SimonSchick @saboya /types/hapi/v17/ @rafaelsouzaf @jhsimms @SimonSchick @saboya @@ -1948,17 +1983,18 @@ /types/hedron/ @dborysov /types/hellojs/ @PavelPZ @vuorinem @baywet /types/hellosign-embedded/ @xt0rted -/types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit +/types/helmet/ @cyrilschumacher @EvanHahn @bluehatbrit @chdanielmueller /types/heredatalens/ @denyo /types/heremaps/ @Josh-ES @denyo @fx88 /types/heroku-logger/ @kylevogt /types/hex-rgb/ @BendingBender /types/hex-rgba/ @r3nya +/types/hexo/ @kentarouTakeda /types/hexo-bunyan/ @segayuu /types/hexo-fs/ @segayuu /types/hexo-log/ @segayuu /types/hexo-util/ @segayuu -/types/highcharts/ @damianog @baltie @AlbertOzimek @hanssens +/types/highcharts/ @damianog @baltie @AlbertOzimek @hanssens @jgresham /types/highcharts-ng/ @scatcher /types/highland/ @Bartvds @hgwood @iwllyu @alvis @notbobthebuilder /types/highlight.js/ @nikeee @sourrust @joshuakgoldberg @@ -1969,15 +2005,15 @@ /types/history.js/ @borisyankov @gjunge /types/historykana/ @h-shiratsuki /types/hjson/ @crunchie84 -/types/hls.js/ @jgainfort @brookback @adripanico +/types/hls.js/ @jgainfort @brookback @adripanico @beraliv /types/hoek/ @prashaantt -/types/hoist-non-react-statics/ @JounQin +/types/hoist-non-react-statics/ @JounQin @jamesreggio /types/holderjs/ @renjfk /types/hooker/ @misak113 /types/hopscotch/ @pimterry @Aurimas1 /types/host-validation/ @dintopple /types/hosted-git-info/ @OiyouYeahYou -/types/howler/ @xperiments @tdukart @alien35 @nicholashza +/types/howler/ @xperiments @alien35 @nicholashza @cjurango /types/hpp/ @kryops /types/html-entities/ @xstoudi /types/html-minifier/ @tkrotoff @rikuayanokozy @@ -1986,10 +2022,13 @@ /types/html-tag-names/ @sandersn /types/html-tags/ @BendingBender /types/html-to-text/ @erykwarren +/types/html-truncate/ @adamzerella /types/html-void-elements/ @rhysd /types/html-webpack-plugin/ @deevus @bumbleblym @tlaziuk /types/html-webpack-template/ @bumbleblym /types/html2canvas/ @rwhepburn @tan9 @sschocke @Ristaaf +/types/html5-history/ @akashishu777 +/types/html5plus/ @dcloudio /types/htmlbars-inline-precompile/ @chriskrycho /types/htmlparser2/ @staticfunction @LinusU /types/htmltojsx/ @basarat @@ -2001,7 +2040,7 @@ /types/http-errors/ @tkrotoff @BendingBender /types/http-graceful-shutdown/ @dlee-nvisia /types/http-link-header/ @screendriver -/types/http-proxy/ @SomaticIT @Raigen @DanielMSchmidt +/types/http-proxy/ @SomaticIT @Raigen @DanielMSchmidt @jabreu610 /types/http-proxy-agent/ @mrmlnc @steprescott /types/http-proxy-middleware/ @zebMcCorkle @BendingBender /types/http-rx/ @L2jLiga @@ -2009,11 +2048,11 @@ /types/http-status/ @misak113 /types/http-string-parser/ @pine613 /types/httperr/ @yortus -/types/hubot/ @dirk @KeesCBakker +/types/hubot/ @dirk @KeesCBakker @eeemil /types/hubspot-pace/ @borislavjivkov /types/humane/ @jmvrbanac +/types/humanize-ms/ @adamzerella /types/humanize-plus/ @DenisCarriere -/types/humanize-string/ @ragnarok56 /types/humanize-url/ @BendingBender /types/humanparser/ @MichalPodeszwa /types/humps/ @nikeee @@ -2028,13 +2067,10 @@ /types/i18next/ @mxl @deerawan @GiedriusGrabauskas @lenovouser @qqilihq @butchyyyy /types/i18next/v8/ @mxl @deerawan @GiedriusGrabauskas /types/i18next/v2/ @mxl @deerawan @GiedriusGrabauskas -/types/i18next-browser-languagedetector/ @cyrilschumacher @GiedriusGrabauskas -/types/i18next-browser-languagedetector/v0/ @cyrilschumacher @GiedriusGrabauskas /types/i18next-express-middleware/ @cyrilschumacher /types/i18next-ko/ @dwaxweiler /types/i18next-node-fs-backend/ @cyrilschumacher @lenovouser /types/i18next-sprintf-postprocessor/ @cyrilschumacher -/types/i18next-xhr-backend/ @jamuhl @GiedriusGrabauskas /types/i2c-bus/ @101100 /types/iarna__toml/ @ajafff /types/iban/ @cyrilschumacher @@ -2054,7 +2090,6 @@ /types/ignore-styles/ @tai2 /types/iltorb/ @Alorel @reconbot /types/image-size/ @elisee -/types/image-type/ @ffflorian /types/imagemagick/ @soywiz /types/imagemagick-native/ @horiuchi /types/imagemapster/ @delphinus35 @@ -2075,6 +2110,7 @@ /types/in-range/ @DanielRosenwasser /types/inboxsdk/ @rdoursenaud @amiram /types/incremental-dom/ @basarat @lanthaler @vvakame +/types/indefinite/ @omaishr /types/indent-string/ @mhegazy @BendingBender /types/inert/ @nycdotnet @AJamesPhillips @lenovouser /types/inert/v4/ @nycdotnet @AJamesPhillips @@ -2085,8 +2121,13 @@ /types/iniparser/ @chrootsu /types/init-package-json/ @kfarnung /types/ink/ @cprecioso +/types/ink-spinner/ @lukostry +/types/ink-table/ @lukostry +/types/ink-testing-library/ @MancunianSam +/types/ink-text-input/ @lukostry /types/inline-css/ @philipisapain /types/inline-style-prefixer/ @ahz @dpetrezselyova @franklixuefei +/types/inputmask/ @dmester /types/inquirer/ @tkQubo @ppathan @jouderianjr @bang88 @bitjson @synarque @jrockwood @kwkelly @Ailrun /types/inquirer-npm-name/ @manuth /types/insert-css/ @hvoecking @@ -2097,8 +2138,6 @@ /types/intercom-client/ @jineshshah36 @peping /types/intercom-web/ @fongandrew @salbahra @onatm /types/intercomjs/ @spencerwi -/types/internal-ip/ @BendingBender -/types/internal-ip/v2/ @BendingBender /types/interpret/ @BendingBender /types/intl/ @RagibHasin /types/intl-locales-supported/ @Slessi @@ -2135,6 +2174,7 @@ /types/is-array/ @pine /types/is-array-sorted/ @BendingBender /types/is-binary-path/ @DanielRosenwasser +/types/is-blank/ @heygambo /types/is-buffer/ @rokt33r /types/is-callable/ @nieltg /types/is-charging/ @BendingBender @@ -2153,14 +2193,16 @@ /types/is-glob/ @mrmlnc /types/is-hotkey/ @petester42 @kalley /types/is-installed-globally/ @BendingBender +/types/is-integer/ @djcsdy /types/is-ip/ @coderslagoon /types/is-mobile/ @LogvinovLeon /types/is-my-json-valid/ @kruncher +/types/is-natural-number/ @adamzerella /types/is-negated-glob/ @ajafff /types/is-number/ @harryshipton /types/is-obj/ @forivall /types/is-object/ @wbhob -/types/is-online/ @BendingBender +/types/is-odd/ @adamzerella /types/is-path-cwd/ @DanielRosenwasser /types/is-path-in-cwd/ @mhegazy /types/is-plain-obj/ @BendingBender @@ -2176,7 +2218,6 @@ /types/is-running/ @danwbyrne /types/is-scoped/ @postcrafter /types/is-stream/ @me -/types/is-svg/ @BendingBender /types/is-text-path/ @mhegazy /types/is-touch-device/ @screendriver /types/is-trademarked/ @BendingBender @@ -2196,11 +2237,11 @@ /types/iso-3166-2/ @sicilica /types/iso8601-localizer/ @avielfedida /types/isomorphic-fetch/ @toddlucas -/types/isotope-layout/ @avidenic @malinushj +/types/isotope-layout/ @avidenic @malinushj @SPWizard01 /types/issue-parser/ @Leko /types/issue-regex/ @BendingBender /types/istanbul/ @tkrotoff -/types/istanbul-lib-coverage/ @jason0x43 +/types/istanbul-lib-coverage/ @jason0x43 @loryman /types/istanbul-lib-hook/ @jason0x43 /types/istanbul-lib-instrument/ @jason0x43 /types/istanbul-lib-report/ @jason0x43 @@ -2240,14 +2281,14 @@ /types/jcanvas/ @rogierschouten /types/jdataview/ @RReverser /types/jdenticon/ @mtr -/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald @andys8 +/types/jest/ @NoHomey @jwbay @asvetliakov @alexjoverm @epicallan @ikatyang @wsmd @JamieMason @douglasduteil @ahnpnl @joshuakgoldberg @UselessPickles @r3nya @hotell @sebald @andys8 @antoinebrault /types/jest/v16/ @NoHomey @jwbay /types/jest-axe/ @JoshuaKGoldberg /types/jest-cli/ @lifeiscontent /types/jest-diff/ @myabc /types/jest-docblock/ @ikatyang /types/jest-each/ @theutz @nickmccurdy -/types/jest-environment-puppeteer/ @joshuakgoldberg +/types/jest-environment-puppeteer/ @joshuakgoldberg @ifiokjr /types/jest-get-type/ @myabc /types/jest-image-snapshot/ @dawnmist /types/jest-in-case/ @geovanisouza92 @@ -2267,7 +2308,7 @@ /types/jjve/ @Nemo157 /types/jmespath/ @pushplay /types/johnny-five/ @nakakura @ujvzolee @workshop2 @xtrimsystems @marcinobiedz -/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick +/types/joi/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick @afharo /types/joi/v13/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @dankraus @wanganjun @rafaelkallis @aconanlai @zaphoyd @thewillg @SimonSchick /types/joi/v10/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @GaelMagnan @ralekna @schfkt @rokoroku @aconanlai /types/joi/v6/ @Bartvds @laurence-myers @cglantschnig @DavidBR-SW @@ -2423,8 +2464,10 @@ /types/js.spec/ @mattbishop /types/jsbn/ @Evgenus @al2xed /types/jschannel/ @yitzchok @McFlat +/types/jscodeshift/ @brieb /types/jscrollpane/ @qcz /types/jsdeferred/ @minodisk +/types/jsdoc-to-markdown/ @adamzerella /types/jsdom/ @leonard-thieu @palmfjord /types/jsen/ @vladeck /types/jsend/ @CaselIT @@ -2452,13 +2495,14 @@ /types/json-stringify-safe/ @BendingBender /types/json2csv/ @juanjoDiaz /types/json2md/ @MartynasZilinskas +/types/json2mq/ @ZhangYiJiang /types/json3/ @NN--- /types/json5/ @Esemesek /types/json_ml/ @pluma /types/jsonabc/ @ffflorian /types/jsonapi-serializer/ @chiangf /types/jsonata/ @nick121212 -/types/jsoneditor/ @alejo90 @errietta +/types/jsoneditor/ @alejo90 @errietta @adamvig /types/jsoneditor-for-react/ @joshuakgoldberg /types/jsoneditoronline/ @vbortone /types/jsonfile/ @dbowring @BendingBender @@ -2472,7 +2516,7 @@ /types/jsonrpc-serializer/ @Akim95 @many20 /types/jsonstream/ @Bartvds /types/jsontoxml/ @benstevens48 -/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod +/types/jsonwebtoken/ @SomaticIT @danielheim @brikou @vpk @rlgod @kettil /types/jsonwebtoken-promisified/ @SomaticIT @danielheim @brikou @aneilbaboo /types/jspath/ @dex4er /types/jspdf/ @amberjs @lleios @jemerald @@ -2480,8 +2524,8 @@ /types/jsrender/ @zakki /types/jsreport-core/ @taoqf /types/jsreport-html-embedded-in-docx/ @taoqf -/types/jsreport-html-to-xlsx/ @me -/types/jsreport-html-to-xlsx/v1/ @me +/types/jsreport-html-to-xlsx/ @taoqf +/types/jsreport-html-to-xlsx/v1/ @taoqf /types/jsreport-jsrender/ @taoqf /types/jsreport-phantom-pdf/ @taoqf /types/jsreport-xlsx/ @taoqf @@ -2515,7 +2559,8 @@ /types/jwt-simple/ @kenfdev @GaelMagnan /types/jwt-then/ @phenomax /types/k6/ @MajorBreakfast -/types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram +/types/kafka-node/ @dansitu @bkim54 @sfrooster @amiram @insanehong +/types/kafkajs/ @michal-b-kaminski /types/karma/ @tkrotoff @43081j @devoto13 /types/karma/v1/ @tkrotoff @43081j /types/karma-chai/ @JayAndCatchFire @@ -2525,7 +2570,7 @@ /types/karma-jasmine/ @michelsalib /types/karma-viewport/ @karak /types/karma-webpack/ @mtraynham -/types/katex/ @mrand01 @knguyen0125 +/types/katex/ @mrand01 @knguyen0125 @dreamerblue /types/kcors/ @Xstoudi @izayoiko /types/kdbush/ @DenisCarriere @chrfrasco /types/kdbxweb/ @Roang-zero1 @@ -2540,7 +2585,7 @@ /types/keymirror/ @jfahrenkrug /types/keypress.js/ @rcchen /types/keysym/ @harryshipton -/types/keytar/ @miniak @shiftkey @juturu +/types/keytar/ @miniak @shiftkey @juturu @queeniema /types/keyv/ @Arylo @BendingBender /types/keyv__mongo/ @BendingBender /types/keyv__mysql/ @BendingBender @@ -2548,7 +2593,8 @@ /types/keyv__redis/ @BendingBender /types/keyv__sqlite/ @BendingBender /types/kik-browser/ @joelday -/types/klaw/ @mceachen +/types/kissfft-js/ @racerhere +/types/klaw/ @mceachen @p4sca1 /types/klaw/v1/ @mceachen /types/klaw-sync/ @shiftkey /types/kms-json/ @sunnyone @@ -2579,7 +2625,7 @@ /types/koa-better-body/ @danwbyrne /types/koa-bodyparser/ @hellopao @anup-2s @hirochachacha /types/koa-bouncer/ @maruware -/types/koa-bunyan-logger/ @sjmcdowall +/types/koa-bunyan-logger/ @sjmcdowall @jankdc /types/koa-cache-control/ @pe8ter /types/koa-compose/ @jkeylu /types/koa-compress/ @hellopao @@ -2593,10 +2639,11 @@ /types/koa-hbs/ @jcbmln @mudkipme /types/koa-helmet/ @me /types/koa-html-minifier/ @romain-faust -/types/koa-joi-router/ @wingsbob @move-zig @hirochachacha +/types/koa-joi-router/ @wingsbob @move-zig @hirochachacha @NotWoods /types/koa-json/ @brooklyndev /types/koa-json-error/ @mudkipme /types/koa-log/ @havenchyk +/types/koa-log4/ @a631807682 /types/koa-logger/ @geoffreak @tlaziuk /types/koa-logger-winston/ @stevehipwell /types/koa-morgan/ @vesse @@ -2618,7 +2665,7 @@ /types/koa-send/ @pe8ter @tlaziuk /types/koa-session/ @kerol2r20 @tlaziuk @hirochachacha /types/koa-session-minimal/ @longztian -/types/koa-sslify/ @wingsbob +/types/koa-sslify/ @wingsbob @msokk /types/koa-static/ @hellopao @tlaziuk /types/koa-static-cache/ @JounQin /types/koa-static-server/ @wulunyi @@ -2657,7 +2704,7 @@ /types/ldap-filters/ @pluma /types/ldapjs/ @cvillemure @peterkooijmans /types/leadfoot/ @theintern -/types/leaflet/ @alejo90 @atd-schubert @mcauer +/types/leaflet/ @alejo90 @atd-schubert @mcauer @ronikar /types/leaflet/v0/ @rgripper /types/leaflet-areaselect/ @awallat /types/leaflet-curve/ @onikiienko @@ -2711,6 +2758,7 @@ /types/libxslt/ @alejo90 /types/license-checker/ @rogierschouten @unindented /types/liftoff/ @BendingBender +/types/lil-uri/ @wcarson /types/lil-uuid/ @Pr1st0n /types/lime-js/ @arthur-xavier /types/line-by-line/ @etomsen @@ -2721,11 +2769,12 @@ /types/lingui__macro/ @huan086 /types/lingui__react/ @huan086 /types/linkify-issues/ @BendingBender -/types/linkify-it/ @praxxis +/types/linkify-it/ @praxxis @alexplumb /types/linkify-urls/ @BendingBender /types/linkifyjs/ @szhu @ovidiubute /types/list-git-remotes/ @BendingBender /types/list-stream/ @IanStorm +/types/list.js/ @jeffreymeng /types/listr/ @durad /types/lls/ @borislavjivkov /types/load-google-maps-api/ @oBusk @@ -3037,7 +3086,6 @@ /types/lodash.zipobjectdeep/ @bczengel @chrootsu @stepancar /types/lodash.zipwith/ @bczengel @chrootsu @stepancar /types/log-symbols/ @BendingBender -/types/log-update/ @BendingBender /types/logat/ @krvikash35 /types/logform/ @DABH /types/logg/ @blittle @@ -3045,7 +3093,7 @@ /types/loglevel/ @Pro @szmeti @screendriver /types/logrotate-stream/ @rogierschouten /types/lokijs/ @TeamworkGuy2 @thomasconner -/types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten +/types/lolex/ @Nemo157 @joshuakgoldberg @rogierschouten @zyishai /types/long/ @peterkooijmans /types/looks-same/ @xcatliu /types/loopback/ @kattsushi @enko @sequoia @drmikecrowe @karimsa @@ -3059,6 +3107,7 @@ /types/lowlight/ @NoHomey /types/lozad/ @plantain-00 /types/lru-cache/ @Bartvds @BendingBender +/types/lru-cache/v4/ @Bartvds @BendingBender /types/lscache/ @Chris-Martinezz /types/ltx/ @PJakcson @BendingBender /types/luaparse/ @stpettersens @@ -3077,9 +3126,8 @@ /types/maildev/ @cyrilschumacher @zbarbuto /types/mailgen/ @vothanhkiet @jordanfarrer /types/mailgun-js/ @sampsonjoliver @andipaetzold -/types/mailparser/ @psnider +/types/mailparser/ @psnider @Avol-V /types/main-bower-files/ @k-kagurazaka -/types/make-dir/ @ikatyang @BendingBender /types/maker.js/ @danmarshall /types/makeup-expander/ @darkwebdev /types/makeup-floating-label/ @darkwebdev @@ -3092,13 +3140,14 @@ /types/mangopay2-nodejs-sdk/ @ifiokjr /types/map-obj/ @BendingBender /types/mapbox/ @anahkiasen @Fluccioni -/types/mapbox-gl/ @dobrud @patrickr +/types/mapbox-gl/ @dobrud @patrickr @macobo /types/mapbox-gl-leaflet/ @agorshkov23 /types/mapbox__geo-viewport/ @fnberta /types/mapbox__geojson-area/ @n0nick /types/mapbox__polyline/ @Kern0 @mklopets /types/mapbox__s3urls/ @sebastianvera /types/mapbox__shelf-pack/ @Perlmint +/types/mapbox__sphericalmercator/ @nhusher /types/mapnik/ @ipv4sec /types/mapsjs/ @davismj /types/mariasql/ @bennett000 @@ -3109,7 +3158,7 @@ /types/markdown-it-lazy-headers/ @knom /types/markdown-pdf/ @MonsieurMan /types/markdownlint/ @ark120202 -/types/marked/ @worr @BendingBender @CrossR @mwickett +/types/marked/ @worr @BendingBender @CrossR @mwickett @htkzhtm /types/marked-terminal/ @bkendall /types/marker-animate-unobtrusive/ @viskin /types/markerclustererplus/ @enanox @mxl @@ -3177,7 +3226,7 @@ /types/mem-fs-editor/ @MyFoodBag /types/memcached/ @KentarouTakeda /types/memdown/ @MeirionHughes @danwbyrne -/types/memjs/ @leizongmin +/types/memjs/ @leizongmin @BendingBender /types/memoize-one/ @karol-majewski @franklixuefei /types/memoize-one/v3/ @karol-majewski @franklixuefei /types/memoizee/ @juanpicado @@ -3217,6 +3266,7 @@ /types/micro-events/ @AlexanderSychev /types/micromatch/ @glen-84 @vemoo /types/micromatch/v2/ @glen-84 +/types/micromodal/ @wcarson /types/microrouter/ @mathieudutour /types/microservice-utilities/ @runebaas /types/microsoft-ajax/ @pjmagee @@ -3248,6 +3298,7 @@ /types/mixto/ @vvakame /types/mjml/ @aahoughton @marpstar /types/mjml-react/ @henrinormak +/types/mkcert/ @asachin96 /types/mkdirp/ @Bartvds @mrmlnc /types/mkdirp-promise/ @pluma /types/mkpath/ @optical @@ -3279,19 +3330,20 @@ /types/moment-duration-format/ @SwintDC @TwoStone @leonard-thieu @bendykowski /types/moment-holiday/ @rwdalpe /types/moment-jalaali/ @alitaheri +/types/moment-precise-range-plugin/ @gricey432 /types/moment-range/ @Burgov @wilgert @franjuan @MartynasZilinskas @chemass /types/moment-round/ @jacobbaskin /types/moment-shortformat/ @whatasoda /types/moment-strftime2/ @dex4er -/types/moment-timezone/ @michelsalib @alanblins @asermax +/types/moment-timezone/ @michelsalib @alanblins @asermax @borys-kupar /types/money-math/ @taoqf -/types/mongo-sanitize/ @CedricCazin -/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric @erikc5000 +/types/mongo-sanitize/ @CedricCazin @penumbra1 +/types/mongodb/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi @EnricoPicci @AJCStriker @julien-c @daprahamian @denys-bushulyak @BastienAr @sindbach @geraldinelemeur @jishi @various89 @angela-1 @lirbank @hector7 @floric @erikc5000 @Manc /types/mongodb/v2/ @CaselIT @alanmarcell @bitjson @dante-101 @mcortesi /types/mongodb-memory-server/ @dmitryrogozhny /types/mongodb-uri/ @mernxl -/types/mongoose/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier @frontendmonster @mingchen -/types/mongoose/v4/ @simonxca @horiuchi @lukasz-zak +/types/mongoose/ @horiuchi @lukasz-zak @Alorel @jendrikw @ethanresnick @vologab @jussikinnula @ondratra @alfirin @idandrd @various89 @Fazendaaa @NormanPerrin @danmana @stablio @emmanuelgautier @frontendmonster @mingchen @penumbra1 @orblazer +/types/mongoose/v4/ @simonxca @horiuchi @lukasz-zak @murbanowicz /types/mongoose-auto-increment/ @AyaMorisawa /types/mongoose-deep-populate/ @AyaMorisawa /types/mongoose-geojson-schema/ @bondz @@ -3315,8 +3367,7 @@ /types/motor-hat/ @muntyan /types/mousetrap/ @qcz @alanhchoi /types/move-concurrently/ @mgroenhoff -/types/move-file/ @BendingBender -/types/moveto/ @shermendev +/types/moveto/ @shermendev @pea3nut /types/moviedb/ @basarat @0x6368656174 /types/moxios/ @itoasuka /types/mozilla-readability/ @charlesvdv @@ -3330,7 +3381,7 @@ /types/msportalfx-test/ @julioct /types/mssql/ @jaminfarr @buzinas @mrrichar @elhaard @pkeuter @mcdado /types/mu2/ @jedigo -/types/mui-datatables/ @favna +/types/mui-datatables/ @favna @ankithkonda /types/muicss/ @samuelneff /types/multer/ @jt000 @DavidBR-SW @mxl @hyunseob /types/multer-gridfs-storage/ @devconcept @@ -3344,6 +3395,7 @@ /types/multiplexjs/ @KamyarNazeri /types/multisort/ @CzBuCHi /types/multistream/ @mrmlnc @kenzierocks +/types/mumath/ @adamzerella /types/muri/ @jloveridge /types/murmurhash/ @atd-schubert /types/murmurhash-js/ @cvle @@ -3369,6 +3421,8 @@ /types/nats-hemera/ @vforv /types/natsort/ @mgroenhoff /types/natural/ @dmoonfire +/types/natural-compare/ @doniyor2109 +/types/natural-compare-lite/ @doniyor2109 /types/natural-sort/ @a-morales @fluggo /types/navermaps/ @ckboyjiy /types/navigation/ @grahammendick @@ -3437,14 +3491,16 @@ /types/nightwatch/ @rkavalap @schlesiger @ClaytonAstrom /types/nise/ @a-tarasyuk /types/nivo-slider/ @AndersonFriaca -/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko +/types/no-scroll/ @ZhangYiJiang +/types/noble/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko @claytonkucera /types/noble-mac/ @swook @shantanubhadoria @lukel99 @bioball @keton @thegecko /types/nock/ @bonnici @horiuchi @afharo @mastermatt @damour @paambaati /types/nodal/ @charrondev -/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @brunoscheufler @smac89 @tellnes @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela @kuehlein -/types/node/v9/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @eyqs -/types/node/v8/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @brunoscheufler @KSXGitHub @islishude @r3nya -/types/node/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry +/types/node/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @btoueg @brunoscheufler @smac89 @tellnes @touffy @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela @kuehlein @j-oliveras @bhongy +/types/node/v10/ @Microsoft @DefinitelyTyped @jkomyno @a-tarasyuk @alvis @r3nya @brunoscheufler @smac89 @tellnes @DeividasBakanas @eyqs @Flarna @Hannes-Magnusson-CK @KSXGitHub @hoo29 @kjin @ajafff @islishude @mwiktorczyk @matthieusieben @mohsen1 @n-e @octo-sniffle @parambirs @eps1lon @SimonSchick @ThomasdenH @WilcoBakker @wwwy3y3 @ZaneHannanAU @jeremiergz @samuela @kuehlein @j-oliveras @bhongy +/types/node/v9/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @ajafff @hoo29 @n-e @brunoscheufler @mohsen1 @KSXGitHub @a-tarasyuk @islishude @r3nya @eyqs @j-oliveras @bhongy +/types/node/v8/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @octo-sniffle @smac89 @Flarna @mwiktorczyk @wwwy3y3 @DeividasBakanas @kjin @alvis @eps1lon @Hannes-Magnusson-CK @jkomyno @hoo29 @n-e @brunoscheufler @KSXGitHub @islishude @r3nya @j-oliveras @bhongy +/types/node/v7/ @Microsoft @DefinitelyTyped @parambirs @tellnes @WilcoBakker @eps1lon @KSXGitHub @Archcry @j-oliveras /types/node/v6/ @Microsoft @DefinitelyTyped @WilcoBakker @inlined @eps1lon @Alorel @KSXGitHub @Archcry /types/node/v4/ @Microsoft @DefinitelyTyped @eps1lon @Archcry /types/node/v0/ @Microsoft @DefinitelyTyped @@ -3457,9 +3513,9 @@ /types/node-cron/ @maximelkin @burtek /types/node-dijkstra/ @nokutu /types/node-dir/ @panuhorsmalahti -/types/node-dogstatsd/ @chrisbobo +/types/node-dogstatsd/ @chrisbobo @xzyfer /types/node-emoji/ @jonestristand @styu @rimiti -/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre +/types/node-fetch/ @torstenwerner @nikcorg @vinaybedre @kyranet /types/node-fibers/ @caryhaynie /types/node-forge/ @westy92 @flynetworks @a-k-g @rafal2228 @beenotung @joeflateau @Apologiz @timhwang21 @supaiku0 @andersk /types/node-gcm/ @horiuchi @@ -3471,12 +3527,13 @@ /types/node-hue-api/ @fjmorel /types/node-int64/ @x3cion @kevin-greene-ck /types/node-ipc/ @arvitaly @gjurgens +/types/node-jose/ @nadunindunil /types/node-jsfl-runner/ @mrand01 /types/node-json-db/ @kuzn-ilya /types/node-localstorage/ @intolerance /types/node-memwatch/ @Kroisse /types/node-mysql-wrapper/ @kataras -/types/node-notifier/ @tkQubo +/types/node-notifier/ @tkQubo @loryman /types/node-polyglot/ @timjk @liamross /types/node-powershell/ @rodrigoff /types/node-pushnotifications/ @menushka @@ -3485,6 +3542,7 @@ /types/node-redis-pubsub/ @renekeijzer /types/node-resque/ @gordey4doronin /types/node-rsa/ @alitaheri @xm @ffflorian +/types/node-sass/ @pspeter3 @chriseppstein /types/node-schedule/ @cyrilschumacher @flowpl /types/node-slack/ @tkQubo /types/node-snap7/ @heilingbrunner @@ -3506,7 +3564,7 @@ /types/node-zopfli-es/ @Alorel /types/node_redis/ @borisyankov /types/nodecredstash/ @migstopheles -/types/nodegit/ @dolanmiu @tniessen +/types/nodegit/ @dolanmiu @tniessen @pvigier /types/nodemailer/ @rogierschouten @dex4er @bioball /types/nodemailer/v3/ @rogierschouten /types/nodemailer-direct-transport/ @rogierschouten @@ -3523,7 +3581,6 @@ /types/nopt/ @jbondc /types/normalize-package-data/ @jdxcode /types/normalize-path/ @BendingBender -/types/normalize-url/ @odin3 @BendingBender @mathieumg /types/notie/ @mateusdemboski /types/notify/ @hellochar /types/notifyjs/ @soundTricker @NateScarlet @@ -3537,17 +3594,18 @@ /types/npm-email/ @BendingBender /types/npm-keyword/ @BendingBender /types/npm-license-crawler/ @ffflorian -/types/npm-name/ @BendingBender +/types/npm-list-author-packages/ @ffflorian /types/npm-package-arg/ @mgroenhoff @OiYouYeahYou /types/npm-packlist/ @ajafff /types/npm-paths/ @BendingBender -/types/npm-run-path/ @BendingBender +/types/npm-registry-package-info/ @ffflorian /types/npm-user/ @BendingBender /types/npm-user-packages/ @BendingBender /types/npmlog/ @DanielMSchmidt @littlepiggy03 /types/ns-api/ @Archcry /types/nslog/ @unindented /types/nsqjs/ @cezaryrk +/types/nssm/ @hongaar /types/number-is-nan/ @mhegazy /types/number-to-words/ @frederickfogerty /types/numeral/ @vbortone @BehindTheMath @klujanrosas @@ -3560,6 +3618,7 @@ /types/nw.js/ @alirdn /types/nwmatcher/ @woutervh- /types/o.js/ @IceOnFire @bradzacher @janhommes @jcchalte +/types/oakdex-pokedex/ @jalyna /types/oauth/ @nonAlgebraic @EduardoAC /types/oauth-shim/ @BendingBender /types/oauth.js/ @nobuoka @@ -3590,13 +3649,13 @@ /types/office-js-preview/ @OfficeDev @Zlatkovsky @kbrandl @Rick-Kirkham @AlexJerabek @ElizabethSamuel-MSFT /types/office-runtime/ @Zlatkovsky @mscharlock /types/offline-js/ @cgwrench +/types/offscreencanvas/ @kayahr /types/oibackoff/ @geoffreak /types/oidc-token-manager/ @rosieks /types/oja/ @buffcode /types/okta__okta-vue/ @innovation-team /types/ol/ @yairtawil /types/omggif/ @ffflorian -/types/on-change/ @BendingBender /types/on-finished/ @czechboy0 @BendingBender /types/on-headers/ @jjeffery @BendingBender /types/on-wake-up/ @ajafff @@ -3604,14 +3663,18 @@ /types/one-time/ @BendingBender /types/onesignal-cordova-plugin/ @broder /types/onetime/ @BendingBender +/types/onetime/v2/ @BendingBender /types/oniguruma/ @smhxx +/types/onionoo/ @BendingBender /types/onoff/ @marcel-ernst @Kallu609 /types/ontime/ @Hirse /types/open/ @Bartvds /types/open-editor/ @BendingBender +/types/open-graph/ @ffflorian /types/openapi-factory/ @runebaas /types/opener/ @tikurahul /types/openfin/ @chrisbarker @rdepena @whyn07m3 @licui3936 +/types/openfin/v37/ @chrisbarker @rdepena @whyn07m3 @licui3936 /types/openfin/v34/ @chrisbarker @rdepena @whyn07m3 /types/openfin/v29/ @chrisbarker @rdepena /types/openfin/v17/ @chrisbarker @@ -3619,7 +3682,7 @@ /types/openlayers/ @osechet @wb14123 @ailrun @mylen @iamthechad @danmana @yairtawil @pierremarc @hauke96 @gberaudo /types/openlayers/v3/ @osechet @matthiasdailey-ccri /types/openlayers/v2/ @bolhovsky -/types/openpgp/ @errietta @damonpam @po5i @ecamellini +/types/openpgp/ @errietta @damonpam @po5i @ecamellini @SardineFish /types/openstack-wrapper/ @sanjaymadane /types/opentok/ @westy92 @CatGuardian /types/opentype.js/ @danmarshall @edzis @@ -3628,9 +3691,6 @@ /types/optics-agent/ @crevil /types/optimist/ @soywiz @chbrown /types/optimize-css-assets-webpack-plugin/ @odnamrataizem -/types/ora/ @basarat @screendriver @BendingBender @azasypkin -/types/ora/v1/ @basarat @screendriver @BendingBender @azasypkin -/types/ora/v0/ @basarat @screendriver /types/oracle__oraclejet/ @nolakara @jingxwu /types/oracledb/ @Bigous /types/orchestrator/ @tkQubo @TeamworkGuy2 @@ -3659,33 +3719,25 @@ /types/p-defer/ @SamVerschueren @BendingBender /types/p-do-whilst/ @BendingBender /types/p-each-series/ @BendingBender -/types/p-event/ @BendingBender /types/p-every/ @BendingBender /types/p-forever/ @BendingBender /types/p-is-promise/ @BendingBender /types/p-lazy/ @BendingBender -/types/p-limit/ @BendingBender @LinusU /types/p-loading/ @renjfk /types/p-locate/ @BendingBender /types/p-log/ @BendingBender -/types/p-map/ @BendingBender /types/p-map-series/ @BendingBender /types/p-memoize/ @forabi /types/p-min-delay/ @BendingBender /types/p-one/ @BendingBender -/types/p-pipe/ @BendingBender /types/p-progress/ @icopp /types/p-props/ @BendingBender -/types/p-queue/ @BendingBender @evanshortiss -/types/p-queue/v2/ @BendingBender @evanshortiss /types/p-reduce/ @BendingBender /types/p-reflect/ @BendingBender /types/p-retry/ @BendingBender /types/p-series/ @BendingBender /types/p-settle/ @natesilva -/types/p-some/ @BendingBender /types/p-tap/ @BendingBender -/types/p-throttle/ @BendingBender /types/p-time/ @BendingBender /types/p-timeout/ @BendingBender /types/p-times/ @BendingBender @@ -3694,7 +3746,7 @@ /types/p-wait-for/v1/ @BendingBender /types/p-waterfall/ @BendingBender /types/p-whilst/ @BendingBender -/types/p2/ @clark-stevenson +/types/p2/ @clark-stevenson @jramstedt /types/p5/ @p5-types /types/package-json/ @jinwoo @BendingBender /types/packery/ @piraveen @hanssens @@ -3716,7 +3768,7 @@ /types/parity-pmr/ @leovujanic /types/parity-poe/ @leovujanic /types/park-miller/ @BendingBender -/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis +/types/parse/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas @agoldis @AlexandreHetu /types/parse/v1/ @dpoetzsch @jaeggerr @flavionegrao @wesleygrimes @owsas /types/parse-columns/ @BendingBender /types/parse-filepath/ @BendingBender @@ -3782,7 +3834,6 @@ /types/path-exists/v1/ @shiwano /types/path-is-absolute/ @mhegazy /types/path-is-inside/ @aomarks -/types/path-key/ @BendingBender /types/path-regex/ @BendingBender /types/path-type/ @BendingBender /types/pathfinding/ @BNedry @@ -3795,7 +3846,7 @@ /types/pbf/ @cschwarz /types/pbkdf2/ @timonegk /types/pdf2image/ @taoqf -/types/pdfjs-dist/ @jbaldwin +/types/pdfjs-dist/ @jbaldwin @1999 /types/pdfkit/ @erichillah /types/pdfmake/ @m1llen1um @radziksh @evolkmann /types/pdfobject/ @nielsboogaard @@ -3805,12 +3856,14 @@ /types/pegjs/ @vvakame @SrTobi @siegebell /types/pem/ @tony19 @DethAriel /types/pem-jwk/ @alessiopcc +/types/pendo-io-browser/ @aaronbeall /types/permit/ @jannikkeye /types/persona/ @Nycto -/types/pet-finder-api/ @me +/types/pet-finder-api/ @ncipollina /types/petit-dom/ @JamesMessinger /types/pg/ @pspeter3 /types/pg/v6/ @pspeter3 +/types/pg-copy-streams/ @fluggo /types/pg-ears/ @bradleyayers /types/pg-escape/ @khell /types/pg-format/ @zopf @@ -3822,7 +3875,8 @@ /types/phantom/ @horiuchi @llRandom /types/phantomcss/ @abauzac /types/phantomjs/ @jedhunsaker @keesey -/types/phoenix/ @mciastek +/types/phin/ @twooster +/types/phoenix/ @mciastek @John-Goff @princemaple /types/phone/ @DxCx /types/phone-formatter/ @westy92 /types/phonegap/ @borisyankov @DickvdBrink @@ -3839,7 +3893,7 @@ /types/pid-from-port/ @BendingBender /types/pidusage/ @cyrilschumacher @mx601595686 /types/pify/ @samverschueren @mad-mike @c7hm4r -/types/pigpio/ @manerfan @erikma +/types/pigpio/ @manerfan @erikma @park012241 /types/pigpio-dht/ @erikma /types/pikaday/ @MidnightDesign @wake42 @mezoistvan /types/pikaday-time/ @Sayan751 @@ -3853,10 +3907,10 @@ /types/piwik-tracker/ @lbguilherme /types/pixelmatch/ @iamolegga /types/pixi.js/ @clark-stevenson -/types/pkg-conf/ @jorgegonzalez /types/pkg-dir/ @NK-WEB-Git /types/pkg-up/ @forivall /types/pkg-versions/ @BendingBender +/types/pkgcloud/ @dantman /types/pkijs/ @microshine /types/platform/ @JakeH /types/playcanvas/ @Neoflash1979 @@ -3864,13 +3918,13 @@ /types/playmusic/ @nickp10 /types/pleasejs/ @nakakura /types/plist/ @higuri -/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart @szechyjs @MercifulCode @soorajpudiyadath @jonfreedman @meganrm +/types/plotly.js/ @chrisgervang @martinduparc @frederikaalund @taoqf @Dadstart @szechyjs @MercifulCode @soorajpudiyadath @jonfreedman @meganrm @zeroyoichihachi /types/plugapi/ @BNedry /types/plugin-error/ @rogierschouten /types/plupload/ @patrickbussmann /types/plur/ @iRoachie /types/pluralize/ @ukyo @karol-majewski -/types/png-async/ @kanreisa +/types/plurals-cldr/ @ChaosinaCan /types/png.js/ @ffflorian /types/pngjs/ @jason0x43 /types/pngquant-bin/ @hikoma @@ -3899,9 +3953,11 @@ /types/postcss-modules-local-by-default/ @huan086 /types/postcss-modules-resolve-imports/ @huan086 /types/postcss-modules-scope/ @huan086 +/types/postcss-nested/ @VorontsovMaxim /types/postcss-url/ @lenovouser /types/postman-collection/ @kbuzby /types/postmark/ @benbayard @jineshshah36 +/types/postmate/ @wcarson /types/pouch-redux-middleware/ @charrondev /types/pouchdb/ @AGBrown @geppy @fredgalvao /types/pouchdb-adapter-fruitdown/ @spaulg @geppy @fredgalvao @@ -3923,17 +3979,20 @@ /types/power-assert/ @vvakame /types/power-assert-formatter/ @vvakame /types/powerbi-visuals-tools/ @zBritva @Microsoft +/types/preact-i18n/ @ltetzlaff /types/precise/ @codeanimal /types/precond/ @olsio /types/preloadjs/ @endel /types/prelude-ls/ @AyaMorisawa /types/prettier/ @ikatyang +/types/pretty/ @adamzerella /types/pretty-bytes/ @plantain-00 @danielasy /types/pretty-bytes/v4/ @plantain-00 /types/pretty-format/ @ikatyang /types/pretty-hrtime/ @BendingBender /types/pretty-ms/ @BendingBender @ocboogie @silh /types/pretty-ms/v3/ @BendingBender @ocboogie +/types/pretty-time/ @adamzerella /types/preval.macro/ @huan086 /types/printf/ @AluisioASG /types/priorityqueuejs/ @geoffreak @@ -3942,6 +4001,7 @@ /types/private-ip/ @coderslagoon /types/procfs-stats/ @cyrilschumacher /types/progress/ @sebastian-lenz +/types/progress-stream/ @mickdekkers /types/progressbar/ @atd-schubert /types/progressjs/ @zaneli /types/proj4/ @DenisCarriere @BendingBender @@ -3969,8 +4029,8 @@ /types/prompt-sync-history/ @MugeSo /types/promptly/ @danrspencer /types/prompts/ @Berkays @danielpa9708 @kamontat -/types/prop-types/ @DovydasNavickas @ferdaber -/types/proper-lockfile/ @qlonik +/types/prop-types/ @DovydasNavickas @ferdaber @eps1lon +/types/proper-lockfile/ @qlonik @LinusU /types/properties-reader/ @Goldsmith42 /types/prosemirror-collab/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-commands/ @bradleyayers @davidka @timjb @patsimm @@ -3986,8 +4046,11 @@ /types/prosemirror-schema-list/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-state/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-tables/ @superchu @eshvedai @patsimm +/types/prosemirror-test-builder/ @ifiokjr /types/prosemirror-transform/ @bradleyayers @davidka @timjb @patsimm /types/prosemirror-view/ @bradleyayers @davidka @timjb @patsimm +/types/protoc-plugin/ @jonnyreeves +/types/protocol-buffers-schema/ @claasahl /types/proton-native/ @khanhas @ltetzlaff /types/protractor-browser-logs/ @rokadias /types/protractor-helpers/ @johncant @@ -3997,14 +4060,13 @@ /types/proxy-lists/ @BehindTheMath /types/proxy-verifier/ @BehindTheMath /types/proxyquire/ @jt000 -/types/ps-list/ @BendingBender /types/ps-tree/ @alessiopcc /types/pseudo-audio-param/ @kirbysayshi /types/psl/ @BendingBender /types/ptomasroos__react-native-multi-slider/ @Slessi /types/pty.js/ @enlight /types/public-ip/ @BendingBender -/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr @danduh +/types/pubnub/ @bitbankinc @rollymaduk @vitosamson @FlorianDr @danduh @ChristianBoehlke /types/pubsub-js/ @borisyankov /types/pug/ @TonyPythoneer @19majkel94 /types/pulltorefreshjs/ @DanielRosenwasser @humpedli @@ -4012,7 +4074,7 @@ /types/pumpify/ @JustinBeckwith @aoberoi /types/punycode/ @yavanosta /types/pupa/ @nju33 -/types/puppeteer/ @marvinhagemeister @cdeutsch @ksm2 @SimonSchick +/types/puppeteer/ @marvinhagemeister @cdeutsch @ksm2 @SimonSchick @SerbanGhita /types/puppeteer/v0/ @marvinhagemeister @cdeutsch /types/puppeteer-core/ @mtsmfm /types/pure-render-decorator/ @seansfkelley @@ -4035,10 +4097,7 @@ /types/qs/ @RWander @leonyu @tehbelinda @zyml @artursvonda @CarlosBonetti /types/qs-middleware/ @davecardwell /types/qtip2/ @Seltzer @leonard-thieu -/types/query-string/ @SamVerschueren @tkrotoff @huhuanming @MadaraUchiha @shssoichiro @jarrku /types/querystringify/ @ilich -/types/quick-lru/ @BendingBender -/types/quick-lru/v1/ @BendingBender /types/quill/ @sumitkm @guillaume-ro-fr @43081j @AnielloFalcone @mhamri /types/quixote/ @greybax /types/qunit/ @waratuman @mike-north @@ -4053,7 +4112,7 @@ /types/radius/ @codeanimal /types/radix64/ @huan086 /types/raf/ @BenLorantfy -/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt @jottenlips @minitesh +/types/ramda/ @donnut @tycho01 @mdekrey @mrdziuban @sbking @afharo @teves-castro @1M0reBug @hojberg @samsonkeung @angeloocana @raynerd @googol @moshensky @ethanresnick @leighman @CaptJakk @deftomat @deptno @blimusiek @biern @rayhaneh @rgm @drewwyatt @jottenlips @minitesh @krantisinh @pirix-gh /types/random-boolean/ @BendingBender /types/random-float/ @BendingBender /types/random-int/ @BendingBender @@ -4091,7 +4150,7 @@ /types/rc/ @DanielRosenwasser @BendingBender /types/rc-progress/ @jussikinnula /types/rc-select/ @DenisTirilis -/types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 +/types/rc-slider/ @mantasmarcinkus @mattoni @paustint @j-fro @Deanna2 @nicholasmaddren @nulladdict /types/rc-switch/ @karol-majewski /types/rc-time-picker/ @Hoff97 /types/rc-tooltip/ @rhysd @ahstro @vsaarinen @@ -4102,7 +4161,7 @@ /types/rdflib/ @cenotelie /types/re-base/ @jordandrako /types/reach__router/ @kingdaro -/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Jessidhia @pshrmn @threepointone +/types/react/ @johnnyreilly @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz @theruther4d @guilhermehubner @ferdaber @jrakotoharisoa @pascaloliv @hotell @franklixuefei @Jessidhia @pshrmn @saranshkataria /types/react/v15/ @bbenezech @pzavolinsky @digiguru @ericanderson @tkrotoff @DovydasNavickas @onigoetz /types/react-adal/ @dkorolev1 /types/react-albus/ @sseppola @conradreuter @kuirak @@ -4116,18 +4175,18 @@ /types/react-aria-modal/ @forabi /types/react-autocomplete/ @lstanden /types/react-autosuggest/ @nicolas-schmitt @pjo256 @robessog @tbayne @cdeutsch @rosskevin -/types/react-avatar-editor/ @diogocorrea @gabsprates -/types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen @enricoboccadifuoco @lonyele +/types/react-avatar-editor/ @diogocorrea @gabsprates @lsenta @davidspiess +/types/react-beautiful-dnd/ @varHarrie @bradleyayers @paustint @marknelissen @enricoboccadifuoco @lonyele @lukyth /types/react-better-password/ @mhuynh1 -/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 -/types/react-blessed/ @me +/types/react-big-calendar/ @piotrwitek @paustint @pikpok @eps1lon @strongpauly @janb87 @ldthorne @siavelis +/types/react-blessed/ @guoshencheng /types/react-body-classname/ @mhegazy /types/react-bootstrap/ @walkerburgin @vsiao @danilojrr @Batbold-Gansukh @octatone @chengsieuly @mretolaza @katbusch @vitosamson @LKay @aaronbeall @jrakotoharisoa @r3nya @t49tran @bes /types/react-bootstrap-date-picker/ @LKay @ssi-hu-antal-bodnar /types/react-bootstrap-daterangepicker/ @ianks /types/react-bootstrap-table/ @flaub @alelode @UJosue10 @dawnmist @Ogglas /types/react-bootstrap-table/v2/ @flaub @alelode @UJosue10 -/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson @arichter83 @dalevfenton +/types/react-bootstrap-typeahead/ @Guymestef @radziksh @PaitoAnderson @arichter83 @dalevfenton @KngHawkon /types/react-breadcrumbs/ @guoyunhe /types/react-breadcrumbs-dynamic/ @mitsuruog /types/react-broadcast/ @kandros @@ -4137,23 +4196,24 @@ /types/react-calendar-timeline/ @radziksh @acemac /types/react-cartographer/ @trevonmckay /types/react-circular-progressbar/ @lstanden -/types/react-click-outside/ @screendriver +/types/react-click-outside/ @screendriver @Ky6uk /types/react-close-on-escape/ @JamesAlias /types/react-codemirror/ @velveret @rudi-c /types/react-coinhive/ @sktbcbbs /types/react-collapse/ @Kimahriman /types/react-collapsible/ @knegusen -/types/react-color/ @LKay @markspolakovs @mntdn @nkgrnkgr +/types/react-color/ @LKay @markspolakovs @mntdn @nkgrnkgr @0815Strohhut /types/react-confirm/ @santiagodoldan @marknelissen /types/react-content-loader/ @alaatm @samwalshnz /types/react-copy-to-clipboard/ @mabels @BernabeFelix /types/react-copy-write/ @samhh @davej /types/react-countup/ @danielbrodin -/types/react-credit-cards/ @vstrimaitis @olefrank +/types/react-credit-cards/ @vstrimaitis @olefrank @zzanol /types/react-cropper/ @stepancar /types/react-css-collapse/ @dford07 /types/react-css-modules/ @KostyaEsmukov @skirsdeda /types/react-css-transition-replace/ @LKay +/types/react-csv/ @vincentjames501 /types/react-currency-formatter/ @pastushenkoy @Jeka-Vasiliev /types/react-custom-scrollbars/ @David-LeBlanc-git @kittimiyo /types/react-custom-scrollbars/v3/ @David-LeBlanc-git @@ -4162,19 +4222,20 @@ /types/react-data-grid/v1/ @SupernaviX /types/react-datagrid/ @stephenjelfs /types/react-date-range/ @Junbong -/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue @KoalaHuman @seansfkelley @justingrant @jakeboone02 +/types/react-datepicker/ @radziksh @andrewBalekha @smrq @Rogach @royxue @KoalaHuman @seansfkelley @justingrant @jakeboone02 @Ky6uk @aviklai /types/react-daterange-picker/ @uncovertruth @MartynasZilinskas @donaldtf @vladflorescu94 /types/react-dates/ @ArturAmpilogov @NathanNZ /types/react-daum-postcode/ @Sa-ryong -/types/react-dnd-multi-backend/ @dawnmist @beeequeue +/types/react-dev-utils/ @ark120202 +/types/react-dnd-multi-backend/ @dawnmist @beeequeue @robcodemonkey /types/react-dnd-touch-backend/ @mleko @dawnmist @beeequeue /types/react-document-meta/ @ulrichb /types/react-document-title/ @cleverguy25 -/types/react-dom/ @MartynasZilinskas @theruther4d +/types/react-dom/ @MartynasZilinskas @theruther4d @Jessidhia /types/react-dom/v15/ @MartynasZilinskas /types/react-dom-factories/ @jgoz /types/react-dotdotdot/ @jczyzewski -/types/react-draft-wysiwyg/ @imechZhangLY @brunoMaurice +/types/react-draft-wysiwyg/ @imechZhangLY @brunoMaurice @ldanet /types/react-dragtastic/ @nscarcella /types/react-dropzone/ @matdube @LynxEyes @goblindegook @benbayard @LKay @codeaid @jurosh @ekilah /types/react-dropzone/v3/ @matdube @LynxEyes @goblindegook @benbayard @LKay @@ -4205,7 +4266,8 @@ /types/react-google-login-component/ @koss-lebedev /types/react-google-maps-loader/ @vasilysn /types/react-google-places-suggest/ @vasilysn -/types/react-google-recaptcha/ @KoalaHuman @tomsturge +/types/react-google-recaptcha/ @KoalaHuman @tomsturge @MaxwellBo +/types/react-google-recaptcha/v0/ @KoalaHuman @tomsturge /types/react-gravatar/ @invliD /types/react-grid-layout/ @abirkholz @alitaheri @ZheyangSong @andrewhathaway @manav-m /types/react-hamburger-menu/ @grzesie2k @@ -4224,7 +4286,6 @@ /types/react-howler/ @maksimovicdanijel /types/react-hyperscript/ @tock203 /types/react-icon-base/ @apare @LKay -/types/react-icons/ @apare @johnnyreilly @LKay /types/react-image-crop/ @danielasy @chaaya /types/react-image-fallback/ @8enSmith /types/react-image-gallery/ @adamwpc @@ -4240,11 +4301,11 @@ /types/react-input-calendar/ @stepancar /types/react-input-mask/ @apare @dima7a14 /types/react-input-mask/v1/ @apare -/types/react-instantsearch/ @gburgett @jpowell -/types/react-instantsearch-core/ @gburgett @jpowell @davidfurlong -/types/react-instantsearch-dom/ @gburgett @jpowell -/types/react-instantsearch-native/ @gburgett @jpowell -/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 +/types/react-instantsearch/ @gburgett @jpowell @haroenv @samouss +/types/react-instantsearch-core/ @gburgett @jpowell @davidfurlong @haroenv @samouss +/types/react-instantsearch-dom/ @gburgett @jpowell @haroenv @samouss +/types/react-instantsearch-native/ @gburgett @jpowell @haroenv @samouss +/types/react-intl/ @bgrieder @cdroulers @gyzerok @tillwolff @LKay @bhouser @kristerkari @formatlos @lukyth @obedm503 @anion155 /types/react-intl/v1/ @bgrieder /types/react-intl-redux/ @LKay /types/react-is/ @AviVahl @christianchown @eps1lon @@ -4254,11 +4315,13 @@ /types/react-json/ @spielc /types/react-json-pretty/ @LKay /types/react-json-tree/ @gnestor @zainafzal08 -/types/react-jsonschema-form/ @iamdanfox @iplus26 @phbou72 @LucianBuzzo @sthenault @sbusch +/types/react-jsonschema-form/ @iamdanfox @iplus26 @phbou72 @LucianBuzzo @sthenault @sbusch @medfreeman /types/react-jss/ @eps1lon @jlaw90 +/types/react-kawaii/ @ZhangYiJiang /types/react-lazyload/ @m0a /types/react-lazylog/ @benjaminRomano /types/react-leaflet/ @danzel @davschne @yuit +/types/react-leaflet/v1/ @danzel @davschne @yuit /types/react-leaflet-markercluster/ @Kimahriman /types/react-lifecycle-component/ @pixelshaded /types/react-lifecycles-compat/ @bySabi @@ -4269,16 +4332,19 @@ /types/react-mailchimp-subscribe/ @osdiab /types/react-map-gl/ @rimig @fnberta /types/react-maskedinput/ @LKay @lavoaster @CarlosBonetti +/types/react-material-ui-form-validator/ @FrankBrullo /types/react-mce/ @morphologue /types/react-mdl/ @bradzacher /types/react-measure/ @asvetliakov @marcfallows +/types/react-medium-image-zoom/ @james-ff /types/react-mentions/ @activescott @efedorenko /types/react-mixin/ @tkqubo /types/react-modal/ @radziksh @drewnoakes @homburg @ttamminen @hallowatcher @peterblazejewicz @jpowell /types/react-motion/ @stepancar @asvetliakov @dimitarnestorov +/types/react-motion-loop/ @j-em /types/react-motion-slider/ @asvetliakov /types/react-motion-ui-pack/ @jsonunger -/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel @souvik-ghosh +/types/react-native/ @alloy @huhuanming @iRoachie @skn0tt @timwangdev @kamal @nelyousfi @alexdunne @swissmanu @bm-software @tkrotoff @a-tarasyuk @mvdam @esemesek @mrnickel @souvik-ghosh @nossbigg @saranshkataria /types/react-native-android-taskdescription/ @christianchown /types/react-native-auth0/ @ascariandrea @marknelissen /types/react-native-autocomplete-input/ @ifiokjr @@ -4318,10 +4384,12 @@ /types/react-native-mauron85-background-geolocation/ @djereg /types/react-native-mixpanel/ @r3nya /types/react-native-modal-dropdown/ @echoulen +/types/react-native-modal-filter-picker/ @ywchang @nossbigg /types/react-native-modalbox/ @iRoachie /types/react-native-multi-slider/ @Slessi /types/react-native-navbar/ @ryokik /types/react-native-orientation/ @MoLow +/types/react-native-percentage-circle/ @hmajid2301 /types/react-native-permissions/ @vincentlanglet /types/react-native-photo-view/ @christianchown /types/react-native-platform-touchable/ @tngranados @@ -4338,6 +4406,7 @@ /types/react-native-sensor-manager/ @SahinVardar /types/react-native-settings-list/ @MrLuje /types/react-native-share/ @marknelissen +/types/react-native-snackbar-component/ @hmajid2301 /types/react-native-snap-carousel/ @jnbt @j-fro @gazaret @GuillaumeAmat @VitorLuizC /types/react-native-sortable-grid/ @j-fro /types/react-native-sortable-list/ @sivolobov @RookY2K @@ -4348,7 +4417,7 @@ /types/react-native-svg-uri/ @iRoachie /types/react-native-swiper/ @CaiHuan @huhuanming @mhcgrq /types/react-native-tab-navigator/ @iRoachie -/types/react-native-tab-view/ @kaoDev @iRoachie @timwangdev +/types/react-native-tab-view/ @kaoDev @iRoachie @timwangdev @geriux /types/react-native-text-input-mask/ @RodrigoAWeber /types/react-native-toast-native/ @bm-software /types/react-native-touch-id/ @huhuanming @gazaret @jinshin1013 @@ -4357,7 +4426,7 @@ /types/react-native-version-number/ @VincentLanglet /types/react-native-video/ @huhuanming /types/react-native-zeroconf/ @mattapet -/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway @denissb @skovhus +/types/react-navigation/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway @denissb @skovhus @azrosen92 @hmajid2301 /types/react-navigation/v2/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @magrinj @TizioFittizio @stigi @LinusU @jshosomichi @jakebooyah @brunoro @DenisFrezzato @mickaelw @maxdavidson @alechill @builtbyproxy @jkillian @jeroenvervaeke @chagasaway /types/react-navigation/v1/ @huhuanming @mhcgrq @fangpenlin @petejkim @iRoachie @phanalpha @charlesfamu @timwangdev @bang88 @svbutko @levito @YourGamesBeOver @ArmandoAssuncao @cliedeman @Slessi /types/react-navigation-material-bottom-tabs/ @iRoachie @@ -4366,14 +4435,14 @@ /types/react-notification-system-redux/ @LKay /types/react-notify-toast/ @klaascuvelier /types/react-numeric-input/ @heatherbooker @akx -/types/react-onclickoutside/ @LKay @surgeboris +/types/react-onclickoutside/ @LKay @surgeboris @NilSet /types/react-onclickoutside/v5/ @LKay /types/react-onsenui/ @salim7 @jemmyw @lirbank /types/react-outside-click-handler/ @zubivan /types/react-overlays/ @aaronbeall @vitosamson @aarondancer /types/react-owl-carousel/ @tbounsiar @igorissen @KennethanCeyer -/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin @SPWizard01 -/types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke +/types/react-paginate/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @sugarshin @SPWizard01 @kevinrambaud +/types/react-paginate/v5/ @deevus @wouterhardeman @pegel03 @archy-bold @yasupeke @kevinrambaud /types/react-paginate/v4/ @deevus @wouterhardeman @pegel03 @archy-bold /types/react-panelgroup/ @qgolsteyn /types/react-places-autocomplete/ @guilhermehubner @r3nya @ApeNox @azizhk @@ -4391,7 +4460,7 @@ /types/react-rangeslider/ @RichieRock /types/react-recaptcha/ @mhegazy @zzanol /types/react-reconciler/ @Methuselah96 -/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris @soerenbf +/types/react-redux/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris @soerenbf /types/react-redux/v6/ @tkqubo @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva @kallikrein @val1984 @jrakotoharisoa @apapirovski @surgeboris /types/react-redux/v5/ @tkqubo @thasner @kenzierocks @clayne11 @tansongyang @nicholasboll @mdibyo @pdeva /types/react-redux-epic/ @forabi @@ -4399,12 +4468,13 @@ /types/react-redux-toastr/ @Smiche @artyomsv @kulmajaba /types/react-relay/ @graphcool @voxmatt @alloy @npirotte @ckknight @kastermester @mattkrick /types/react-request/ @dannycochran +/types/react-resizable/ @airhorns /types/react-resize-detector/ @matthew-matvei @aMoniker @rdrgn /types/react-resolver/ @forabi /types/react-responsive/ @asvetliakov @alechill @xaviergonz /types/react-responsive/v1/ @asvetliakov /types/react-rnd/ @Ragg- @fsubal @zyh825 -/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith +/types/react-router/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @tkrotoff @huy-nguyen @grmiade @DaIgeb @egorshulga @neuoy @rraina @pret-a-porter @t49tran @8enSmith @wezleytsai @eps1lon /types/react-router/v3/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov @johnnyreilly @LKay @DovydasNavickas @ssorallen @gillchristian @nulladdict /types/react-router/v2/ @sergey-buturlakin @mrk21 @vasek17 @ngbrown @awendland @KostyaEsmukov /types/react-router-bootstrap/ @vlesierse @LKay @olmobrutall @@ -4421,7 +4491,9 @@ /types/react-rte/ @jclyons52 /types/react-s-alert/ @mitsuruog /types/react-scroll/ @sudoplz @GiedriusGrabauskas +/types/react-scroll-into-view-if-needed/ @angusfretwell @allanpope @jonathanly /types/react-scrollbar/ @stephenjelfs +/types/react-scrollspy/ @ZhangYiJiang /types/react-select/ @claasahl @jonfreedman /types/react-select/v1/ @Hesquibet @giladgray @iebaker @skirsdeda @vujevits @devrelm @MartynasZilinskas @onatm @ninjaferret @tehbi4 @misantronic @darkartur @eps1lon @endurance @RCGuillaume /types/react-share/ @icopp @@ -4451,19 +4523,19 @@ /types/react-svg-inline/ @kiyopikko /types/react-svg-pan-zoom/ @huy-nguyen /types/react-swf/ @stepancar -/types/react-swipe/ @DeividasBakanas +/types/react-swipe/ @DeividasBakanas @AAlakkad /types/react-swipeable/ @GiedriusGrabauskas @mctep @horiuchi /types/react-swipeable-views/ @mxl @DeividasBakanas /types/react-syntax-highlighter/ @NoHomey @ajgamble-milner /types/react-table/ @royxue @psakalo @Havret @andys8 @Gelio /types/react-table-filter/ @gjsln -/types/react-tabs/ @danez @Equationist +/types/react-tabs/ @yu-i9 @danez @Equationist /types/react-tag-autocomplete/ @jlismore /types/react-tag-input/ @Ogglas @jankarres @matthewberryman /types/react-tagcloud/ @wassname /types/react-tagsinput/ @mykter /types/react-tap-event-plugin/ @mxl -/types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz +/types/react-test-renderer/ @arvitaly @lochbrunner @johnnyreilly @jgoz @Jessidhia /types/react-test-renderer/v15/ @arvitaly @lochbrunner @lochbrunner @johnnyreilly /types/react-tether/ @ryprice /types/react-text-mask/ @guilhermehubner @cavarzan @needpower @@ -4491,19 +4563,18 @@ /types/react-visibility-sensor/ @JRasmusBm @gcangussu /types/react-webcam/ @squat /types/react-weui/ @tairan -/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger +/types/react-widgets/ @rogierschouten @sanyatuning @frodehansen2 @r3nya @MBillemaz @georg94 @tzarger @vegtelenseg /types/react-widgets-moment/ @dawnmist -/types/react-window/ @martynaskadisa +/types/react-window/ @martynaskadisa @heyimalex /types/react-window-size/ @jakejrichards /types/react-wow/ @mikepthomas /types/react-youtube/ @kgtkr @salguerooo /types/react-youtube-embed/ @charles-salmon -/types/reactable/ @spielc +/types/reactable/ @spielc @priscila-moneo /types/reactcss/ @chrisgervang @LKay /types/reactstrap/ @alihammad @mfal @danilobjr @FaithForHumans @timc13 @patrickrgaffney @prabodht @georg94 /types/reactstrap/v4/ @alihammad @mfal @danilobjr @fabiopaiva /types/read/ @timjk -/types/read-chunk/ @crispybee /types/read-package-tree/ @mgroenhoff /types/read-pkg/ @jdxcode /types/read-pkg-up/ @dudeofawesome @jdxcode @@ -4513,11 +4584,11 @@ /types/readline-sync/ @jonestristand /types/readline-transform/ @dex4er /types/reapop/ @Barrokgl -/types/rebass/ @rhysd @ryee-dev @jamesmckenzie +/types/rebass/ @rhysd @ryee-dev @jamesmckenzie @gretzky @angusfretwell /types/rebass__grid/ @antonvasin @vittorio @lhache @lavoaster /types/recaptcha2/ @l-jonas /types/recase/ @18steps -/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok @RobertStigsson @kousaku-maron +/types/recharts/ @mthmulders @rapmue @royxue @ZheyangSong @richbai90 @caspeco-dan @pkeuter @jrsaunde @paulmelnikow @crusectrl @apalugniok @RobertStigsson @kousaku-maron @iflp /types/recharts-scale/ @johnnyreilly /types/rechoir/ @BendingBender /types/recluster/ @dex4er @@ -4528,7 +4599,7 @@ /types/recursive-readdir/ @elisee @MicahZoltu /types/recursive-readdir/v1/ @elisee /types/redent/ @BendingBender -/types/redis/ @soywiz @CodeAnimal @MugeSo @UppaJung @Rokt33r @43081j @barnski @1pete @blablapolicja @ferrantejake +/types/redis/ @soywiz @CodeAnimal @MugeSo @UppaJung @Rokt33r @43081j @barnski @1pete @blablapolicja @ferrantejake @OpesanyaAdebayo /types/redis-errors/ @43081j /types/redis-mock/ @BendingBender /types/redis-rate-limiter/ @westy92 @nodify-at @@ -4553,7 +4624,8 @@ /types/redux-first-router-link/ @janb87 /types/redux-first-router-restore-scroll/ @icopp /types/redux-first-routing/ @tlaziuk -/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 +/types/redux-form/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik @bwlt +/types/redux-form/v7/ @carsonf @aikoven @LKay @bancek @alsiola @tehbi4 @huwmartin @ethanresnick @reggino @maddijoyce @smifun @mshaaban088 @esetnik /types/redux-form/v6/ @carsonf @aikoven @LKay @bancek @mshaaban088 /types/redux-form/v4/ @aikoven /types/redux-immutable/ @oizie @sebald @gavingregory @lukyth @@ -4608,6 +4680,8 @@ /types/remote-redux-devtools/ @ColinEberhardt @unindented @mamodom @colindekker /types/remove-markdown/ @RagibHasin /types/rename/ @Aankhen +/types/repeat-element/ @adamzerella +/types/repeat-string/ @adamzerella /types/replace-ext/ @DeividasBakanas /types/replace-string/ @BendingBender /types/replacestream/ @dex4er @@ -4628,8 +4702,10 @@ /types/requirejs-domready/ @lefb766 /types/requires-port/ @BendingBender /types/resemblejs/ @pimterry +/types/reserved-words/ @skovy /types/reservoir/ @danvk /types/resize-img/ @higuri +/types/resize-observer-browser/ @chivesrs /types/resolve/ @marionebl @ajafff /types/resolve-cwd/ @BendingBender /types/resolve-from/ @unional @BendingBender @@ -4652,8 +4728,9 @@ /types/restler/ @cyrilschumacher /types/restling/ @loghorn /types/restore-cursor/ @BendingBender -/types/resumablejs/ @DanielMcAssey +/types/resumablejs/ @DanielMcAssey @Johns3n /types/rethinkdb/ @alexgorbatchev @AdrianFarmadin @kondi @hoishin +/types/retinajs/ @senjyouhara /types/retry/ @krenor @BendingBender /types/retry-as-promised/ @Raigen /types/rev-hash/ @ikatyang @@ -4681,9 +4758,11 @@ /types/rn-fetch-blob/ @pengcao1 /types/roads/ @dancespiele /types/roads-server/ @dancespiele +/types/roarr/ @psaxton /types/rocksdb/ @MeirionHughes @danwbyrne /types/roll/ @icopp /types/rolling-rate-limiter/ @l-jonas +/types/rollup-plugin-buble/ @Kocal /types/rollup-plugin-commonjs/ @eoin-obrien /types/rollup-plugin-delete/ @vladshcherbin /types/rollup-plugin-json/ @asmockler @hotell @@ -4699,6 +4778,7 @@ /types/round-to/ @seangenabe /types/route-parser/ @ianks @bobbuehler /types/routie/ @Adilson +/types/rox-react-native/ @ahanriat /types/royalslider/ @csrakowski @sKopheK /types/rpio/ @DominikPalo @Pencl /types/rrc/ @DeividasBakanas @@ -4707,6 +4787,7 @@ /types/rss/ @secondwtq /types/rsvp/ @chriskrycho /types/rsync/ @philippstucki +/types/rtlcss/ @adamzerella /types/rtree/ @oefirouz /types/run-parallel/ @mrmlnc /types/run-parallel-limit/ @mrmlnc @@ -4776,13 +4857,15 @@ /types/schema-registry/ @bonzzy /types/schwifty/ @ozum /types/scoped-http-client/ @mattvperry @rianadon -/types/screenfull/ @icholy @lionelb @joelshepherd +/types/screenfull/ @icholy @lionelb @joelshepherd @BendingBender +/types/screenfull/v3/ @icholy @lionelb @joelshepherd /types/screeps/ @MarkoSulamagi @NhanHo @bryanbecker @resir014 @Arcath @dmarcuse /types/screeps-profiler/ @ramblurr /types/script-ext-html-webpack-plugin/ @davecardwell /types/scriptjs/ @ssttevee /types/scroll-into-view/ @zivni /types/scroller/ @haskellcamargo +/types/scrollparent/ @Sintifo /types/scrollreveal/ @Davidblkx /types/scrolltofixed/ @bmdixon /types/scrypt/ @WhiteAbeLincoln @@ -4798,6 +4881,7 @@ /types/seed-random/ @l-jonas /types/seededshuffle/ @urish /types/seedrandom/ @kernhanda +/types/seen/ @admvx /types/segment-analytics/ @fongandrew /types/select2/ @borisyankov @denisname /types/select2/v3/ @borisyankov @@ -4837,6 +4921,7 @@ /types/semver-truncate/ @BendingBender /types/sencha_touch/ @brian428 /types/send/ @MikeJerred +/types/sendmail/ @saostad /types/seneca/ @psnider @kevynb /types/sequelize/ @samuelneff @codeanimal @drinchev @babolivier @kukoo1 @oktapodia @morpheusxaut @TitaneBoy @zjy01 @nidzov @Raigen @todd @nrschultz @thomas-b @Antoine38660 @smff /types/sequelize/v3/ @samuelneff @codeanimal @drinchev @morpheusxaut @torhal @@ -4846,7 +4931,7 @@ /types/sequester/ @Strate /types/serialize-error/ @thomasthiebaud /types/serialize-javascript/ @lith-light-g @Pochodaydayup -/types/serialport/ @codefoster @apearson +/types/serialport/ @codefoster @apearson @cinderblock /types/serialport/v6/ @codefoster @apearson /types/serialport/v4/ @codefoster /types/serve-favicon/ @urossmolnik @@ -4854,7 +4939,7 @@ /types/serve-static/ @urossmolnik @LinusU /types/server/ @sant123 @iddan /types/server-destroy/ @gyszalai -/types/serverless/ @hassankhan +/types/serverless/ @hassankhan @JonathanWilbur /types/servicenow/ @bryceg /types/session-file-store/ @blendsdk @rokt33r /types/set-cookie-parser/ @nickp10 @ilyaztsv @@ -4866,7 +4951,7 @@ /types/sha1/ @arcdev1 /types/sha256/ @nhardy /types/shallow-equals/ @rsolomon -/types/shallowequal/ @seansfkelley @BendingBender +/types/shallowequal/ @seansfkelley @BendingBender @arndissler /types/shallowequal/v0/ @seansfkelley /types/shapefile/ @DenisCarriere @Thw0rted /types/sharedb/ @soney @@ -4882,7 +4967,7 @@ /types/shelljs/ @nikeee @voy @gkalpak @pheromonez @aldafu /types/shelljs-exec-proxy/ @qlonik /types/shimmer/ @kjin -/types/shipit/ @cyrilschumacher +/types/shipit-cli/ @cyrilschumacher /types/shipit-utils/ @cyrilschumacher /types/shopify-buy/ @openminder @straiforos @totemika /types/shorten-repo-url/ @BendingBender @@ -4924,12 +5009,11 @@ /types/sindresorhus__df/ @whatknight /types/sindresorhus__djb2a/ @BendingBender /types/sindresorhus__fnv1a/ @BendingBender -/types/sindresorhus__slugify/ @cprecioso /types/sindresorhus__string-hash/ @BendingBender /types/sindresorhus__to-milliseconds/ @BendingBender /types/single-line-log/ @ffflorian /types/single-spa-react/ @Garrett-Smith-iq @chrisdopuch -/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg @gjednaszewski @johnjesse @alecf @SimonSchick +/types/sinon/ @mrbigdog2u @rationull @lumaxis @nicojs @43081j @joshuakgoldberg @gjednaszewski @johnjesse @alecf @SimonSchick @bergundy /types/sinon-as-promised/ @igrayson /types/sinon-chai/ @kazimanzurrashid @jedmao @elpdpt /types/sinon-chai/v2/ @kazimanzurrashid @jedmao @@ -4944,7 +5028,7 @@ /types/sizzle/ @leonard-thieu /types/sjcl/ @Evgenus /types/skatejs/ @Hotell -/types/sketchapp/ @manekinekko +/types/sketchapp/ @manekinekko @shikanime /types/ski/ @AyaMorisawa /types/skin-tone/ @BendingBender /types/skyway/ @nakakura @izmhr @@ -4954,18 +5038,19 @@ /types/slackdown/ @nju33 /types/slackify-html/ @hypexr /types/slash/ @BendingBender -/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav +/types/slate/ @andykent @majelbstoat @JanLoebel @YangusKhan @kalley @Kornil @isubasti @sgreav @jackall3n /types/slate-base64-serializer/ @YangusKhan /types/slate-html-serializer/ @YangusKhan /types/slate-irc/ @elisee /types/slate-plain-serializer/ @YangusKhan @mkiefel -/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil +/types/slate-react/ @andykent @majelbstoat @JanLoebel @PatrickSachs @YangusKhan @isubasti @sgreav @Kornil @jackall3n /types/sleep/ @rajarz /types/slice-ansi/ @dwieeb /types/slickgrid/ @jbaldwin /types/slideout/ @ToastHawaii /types/slimerjs/ @alexwall /types/slocket/ @BendingBender +/types/slonik/ @sebald /types/slug/ @mhegazy /types/smart-fox-server/ @ChanceM /types/smart-truncate/ @oyalhi @@ -4982,6 +5067,8 @@ /types/snoowrap/ @vitosamson @TheAppleFreak @willwull /types/snowball-stemmers/ @ryanvolum /types/snowboy/ @dolanmiu +/types/sns-validator/ @kevin68 +/types/sntp/ @adamzerella /types/socket.io/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io/v1/ @progre @divillysausages @florentpoujol @KentarouTakeda @gigi @BrainMaestro /types/socket.io-client/ @progre @divillysausages @florentpoujol @@ -4998,7 +5085,7 @@ /types/socketty/ @Nax /types/sockjs/ @pmccloghrylaing /types/sockjs-client/ @vladev @arusakov @BendingBender @renjfk -/types/solidity-parser-antlr/ @LogvinovLeon @albrow +/types/solidity-parser-antlr/ @LogvinovLeon @albrow @yxliang01 /types/solr-client/ @liul85 /types/solution-center-communicator/ @dami-gg /types/sonic-boom/ @alferpal @@ -5008,7 +5095,7 @@ /types/soundmanager2/ @elton2048 /types/soupbintcp/ @jewbre /types/source-list-map/ @e-cloud -/types/source-map-support/ @Bartvds @jason0x43 +/types/source-map-support/ @Bartvds @jason0x43 @natealcedo /types/space-pen/ @vvakame /types/spark-md5/ @bastienmoulia /types/sparkly/ @BendingBender @@ -5024,13 +5111,14 @@ /types/speakingurl/ @Goldsmith42 /types/spected/ @benneq /types/spectrum/ @M-Zuber @Ailrun +/types/spellchecker/ @dalevfenton /types/split/ @marcinporebski /types/split.js/ @icholy /types/split2/ @mugeso /types/splunk-bunyan-logger/ @bricka /types/splunk-logging/ @bricka /types/spotify-api/ @skovmand -/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends +/types/spotify-web-playback-sdk/ @Festify @mraerino @NeoLegends @deini /types/sprintf/ @soywiz @BendingBender /types/sprintf-js/ @jasonswearingen @BendingBender @cdagli /types/sql-bricks/ @adn05 @paleo @@ -5047,6 +5135,7 @@ /types/ssh2-sftp-client/ @igrayson @ascariandrea @kartik2406 @viamuli /types/ssh2-streams/ @rbuckton /types/sshpk/ @mabels +/types/ssri/ @huan086 /types/stack-mapper/ @rogierschouten /types/stack-trace/ @exceptionless /types/stack-utils/ @BendingBender @@ -5084,17 +5173,19 @@ /types/storybook__addon-actions/ @joscha @jicjjang /types/storybook__addon-backgrounds/ @hyunseob @adhrinae /types/storybook__addon-centered/ @kiyopikko -/types/storybook__addon-info/ @mkornblum @fyrkant +/types/storybook__addon-info/ @mkornblum @fyrkant @RunningCoderLee /types/storybook__addon-jest/ @halfmatthalfcat -/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay @MLoughry +/types/storybook__addon-knobs/ @joscha @martynaskadisa @amacleay @MLoughry @alanhchoi /types/storybook__addon-links/ @joscha @jessepinho /types/storybook__addon-notes/ @joscha @amacleay @MLoughry /types/storybook__addon-options/ @joscha @simonhn @amacleay @gaetanmaisse @adam187 /types/storybook__addon-storyshots/ @bradleyayers /types/storybook__addon-viewport/ @Vinnl +/types/storybook__addons/ @bmatcuk +/types/storybook__channels/ @bmatcuk /types/storybook__react/ @joscha @wapgear @dandean /types/storybook__react-native/ @joscha @wapgear @alechill @iRoachie @ceyhuno -/types/storybook__vue/ @pntgupta +/types/storybook__vue/ @pntgupta @jurgisrudaks /types/strange/ @wanganjun /types/stream-array/ @Tyler-Murphy /types/stream-buffers/ @Jason3S @@ -5133,7 +5224,7 @@ /types/strip-color/ @BendingBender /types/strip-indent/ @BendingBender /types/strip-json-comments/ @dmoonfire -/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos +/types/stripe/ @wjohnsto @codeanimal @sampsonjoliver @LinusU @brannon @kkamperschroer @starhoshi @bruun @galtalmor @htunnicliff @squirly @tzarger @ifiokjr @SimonSchick @yultyyev @cpsoinos @adamduren @saranshkataria @0xJoKe @delianides /types/stripe-checkout/ @cgwrench /types/stripe-v2/ @ejsmith @amritk @adamcmiel @jleider @galuszkak /types/stripe-v3/ @ejsmith @amritk @adamcmiel @jleider @galuszkak @slangeder @@ -5144,11 +5235,11 @@ /types/strophe/ @DavidKDeutsch /types/strophe.js/ @DavidKDeutsch /types/structured-source/ @azu -/types/styled-components/ @Igorbek @Igmat @lavoaster @Jessidhia +/types/styled-components/ @Igorbek @Igmat @lavoaster @Jessidhia @jkillian @eps1lon @flavordaaave /types/styled-components/v3/ @Igorbek @Igmat /types/styled-jsx/ @R1ZZU /types/styled-react-modal/ @Lavoaster -/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 @gretzky +/types/styled-system/ @maxdeviant @phobon @zephraph @damassi @alloy @maoueh @lavoaster @jschuler @adam187 @gretzky @chrislopresto /types/styled-theming/ @ArjanJ /types/stylelint/ @alan-agius4 @filipsalpe /types/stylelint/v7/ @alan-agius4 @@ -5165,12 +5256,13 @@ /types/summernote/ @wstaelens @nusantara-cloud /types/sumo-logger/ @forabi @clementallen /types/suncalc/ @horiuchi -/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer +/types/sunrise-sunset-js/ @hmajid2301 +/types/superagent/ @NicoZelaya @mxl @paplorinc @shreyjain1994 @zopf @beeequeue @lukaselmer @theQuazz /types/superagent/v2/ @varju @NicoZelaya @mxl /types/superagent-bunyan/ @bricka /types/superagent-no-cache/ @mxl /types/superagent-prefix/ @mxl -/types/supercluster/ @DenisCarriere +/types/supercluster/ @DenisCarriere @Manc /types/superstruct/ @edwardsnare /types/supertest/ @varju @pietu /types/supertest-as-promised/ @tkrotoff @@ -5225,16 +5317,19 @@ /types/table/ @evanshortiss @mrmlnc /types/tableau/ @protip /types/tableify/ @forivall -/types/tabris-plugin-firebase/ @eclipsesource /types/tabtab/ @vojtechhabarta @kamontat /types/tabulator/ @euginio +/types/tabulator-tables/ @jojoshua /types/tail/ @spacejack +/types/tampermonkey/ @silverwzw @nikolay-borzov /types/tapable/ @e-cloud @johnnyreilly /types/tapable/v0/ @e-cloud /types/tape/ @Bartvds @sodatea @DennisSchwartz @mikehenrty @rostrowski +/types/tape-async/ @ExE-Boss /types/tar/ @SomaticIT @connor4312 /types/tar-fs/ @Umoxfo /types/tar-stream/ @glicht +/types/tarantool-driver/ @zharkov-eu /types/task-graph-runner/ @mgroenhoff /types/task-worklet/ @karol-majewski /types/tcp-ping/ @stegano @@ -5254,7 +5349,6 @@ /types/terminal-link/ @BendingBender /types/terminal-menu/ @aravindarun /types/tern/ @nkappler -/types/terser/ @JordiAnderl /types/terser-webpack-plugin/ @Danscho /types/test-console/ @roberto @guidoux @gbmoretti /types/test-listen/ @stephenmathieson @@ -5274,14 +5368,14 @@ /types/texzilla/ @m93a /types/tgfancy/ @Dabolus /types/theming/ @eps1lon -/types/theo/ @petekp +/types/theo/ @petekp @laitine /types/thepiratebay/ @jsorrell -/types/three/ @gyohk @florentpoujol @SereznoKot @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @s093294 @Pro @efokschaner @PsychoSTS @dhritzkiv @apurvaojas @NotWoods @sethk @elk941 @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim +/types/three/ @gyohk @florentpoujol @omni360 @ivoisbelongtous @piranha771 @qszhusightp @nakakura @Pro @efokschaner @PsychoSTS @apurvaojas @NotWoods @Methuselah96 @Dukuo @JulianSSS @devilsparta @KonstantinLukaschenko @danyim @saranshkataria @psuter /types/three-tds-loader/ @KonstantinLukaschenko @sschoensee /types/thrift/ @kamek-pf @kevin-greene-ck @jessezhang91 /types/throng/ @cyrilschumacher @tatethurston /types/throttle/ @BendingBender -/types/throttle-debounce/ @czbuchi @franklixuefei +/types/throttle-debounce/ @czbuchi @franklixuefei @oddsund /types/through/ @AndrewGaspar /types/through2/ @Bartvds @jedmao @valotas @TeamworkGuy2 @Alorel /types/through2/v0/ @Bartvds @jedmao @@ -5290,7 +5384,6 @@ /types/tildify/ @BendingBender /types/tile-reduce/ @DenisCarriere /types/tilebelt/ @DenisCarriere -/types/time-span/ @BendingBender @mdvorscak /types/timelinejs/ @rolandzwaga /types/timelinejs3/ @MikeMatusz /types/timer-machine/ @dolanmiu @@ -5305,13 +5398,14 @@ /types/tiny-secp256k1/ @eduhenke /types/tiny-slider-react/ @screendriver /types/tinycolor2/ @M-Zuber @geertjansen @nvh @Ailrun -/types/tinycon/ @dwaxweiler +/types/tinycon/ @dwaxweiler @jaulz /types/tinycopy/ @vvatanabe /types/tinymce/ @martinduparc @ipoul @nicohartto /types/titanium/ @appcelerator @janvennemann /types/title/ @fa7ad /types/tldjs/ @geoffreak /types/tlds/ @ajshres +/types/tmi.js/ @wpapsco /types/tmp/ @optical @Perlmint /types/to-absolute-glob/ @ajafff /types/to-camel-case/ @j-f1 @@ -5321,6 +5415,7 @@ /types/to-title-case-gouch/ @stpettersens /types/toastr/ @borisyankov /types/tocktimer/ @evanshortiss +/types/tokenizr/ @aNickzz /types/tokgen/ @l-jonas /types/toobusy-js/ @atd-schubert @BendingBender /types/tooltipster/ @stephenlautier @pjmagee @VorobeY1326 @leonard-thieu @janhi @joeskeen @@ -5341,7 +5436,6 @@ /types/transducers-js/ @colinkahn @dphilipson @NaridaL /types/transducers.js/ @dphilipson /types/transliteration/ @tony19 -/types/trash/ @matthew-matvei @hoishin @BendingBender /types/traverse/ @newclear /types/traverson/ @marcinporebski /types/travis-fold/ @andy-ms @@ -5352,8 +5446,10 @@ /types/trianglify/ @unindented /types/trie-prefix-tree/ @jlismore /types/trim/ @skysteve +/types/trim-newlines/ @djcsdy /types/triple-beam/ @danwbyrne /types/triplesec/ @threesquared +/types/trouter/ @stahlstift /types/trunk8/ @niemyjski /types/trusted-types/ @vrana /types/tryer/ @bengry @@ -5361,6 +5457,8 @@ /types/tspromise/ @soywiz /types/ttf2woff2/ @ThomasdenH /types/tunnel/ @BendingBender +/types/turbolinks/ @evankim390 +/types/turndown/ @sergey-zhidkov /types/tus-js-client/ @kevhiggins @Acconut /types/tv4/ @Bartvds @psnider /types/tween.js/ @Amos47 @sunetos @jzarnikov @alexburner @@ -5370,8 +5468,8 @@ /types/twilio/ @nickiannone @ashleybrener /types/twilio-common/ @gatimus /types/twilio-video/ @minddocdev @darioblanco -/types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery -/types/twitch-ext/ @beheh +/types/twit/ @Volox @sapphiredev @abraham @siwalikm @plhery @justgoscha +/types/twitch-ext/ @beheh @FedeDR /types/twitter/ @BendingBender /types/twitter-for-web/ @chitoku-k /types/twitter-stream-channels/ @adrianbardan @@ -5427,6 +5525,7 @@ /types/universal-analytics/ @Bartvds @DarkerTV /types/universal-cookie/ @tomi /types/unorm/ @chbrown +/types/unsplash-js/ @markupcode /types/untildify/ @BendingBender /types/unused-filename/ @BendingBender /types/unzip/ @coding2012 @@ -5458,11 +5557,15 @@ /types/urlsafe-base64/ @tkrotoff /types/usage/ @pvomhoff /types/usb/ @underscorebrody @thegecko +/types/use-persisted-state/ @karol-majewski +/types/use-set-interval/ @screendriver +/types/use-set-timeout/ @screendriver /types/user-event/ @whtsky /types/user-home/ @mhegazy /types/useragent/ @geoffreak /types/username/ @kayahr @krivachy /types/utf8/ @zelein +/types/utif/ @smajl @nkprince007 @massic80 /types/util-deprecate/ @BendingBender /types/util.promisify/ @adamvoss /types/utils-merge/ @chrootsu @@ -5496,14 +5599,15 @@ /types/vertx3-eventbus-client/ @oddeirik /types/vex-js/ @gdcohan /types/vexdb/ @MayorMonty -/types/vexflow/ @rquiring @sebastianhaas @bohoffi @sschmidTU +/types/vexflow/ @rquiring @sebastianhaas @bohoffi @sschmidTU @bneumann /types/vfile/ @bizen241 @rokt33r /types/vfile-location/ @ikatyang @rokt33r /types/vfile-message/ @rokt33r -/types/victory/ @asvetliakov @snerks @Havret @alredyExist @jlismore +/types/victory/ @asvetliakov @snerks @Havret @allreadyExisted @jlismore @stackbuilders @ibarrae /types/video.js/ @vbortone @scleriot @SWBennett06 @IgelCampus @giofreitas @gjanblaszczyk @sroucheray @AkxeOne @meikidd /types/viewability-helper/ @lironzluf /types/viewerjs/ @lrh3321 +/types/viewport-list/ @satyarohith /types/viewport-mercator-project/ @fnberta /types/viewporter/ @borisyankov /types/vimeo/ @DazWilkin @@ -5529,8 +5633,11 @@ /types/voronoi-diagram/ @michaelneu /types/vorpal/ @danwbyrne /types/vortex-web-client/ @Pro +/types/voucher-code-generator/ @JWebCoder /types/voximplant-websdk/ @aylarov -/types/vue-color/ @me +/types/vscode/ @Microsoft +/types/vue-chartkick/ @cnsmedia +/types/vue-color/ @mildful /types/vue-markdown/ @neodon /types/vue-resource/ @kaorun343 /types/vue-scrollto/ @vincekovacs @@ -5544,8 +5651,8 @@ /types/w3c-image-capture/ @cosium /types/w3c-permissions/ @jberube /types/w3c-screen-orientation/ @kenchris -/types/w3c-web-usb/ @larsgk -/types/wait-for-localhost/ @BendingBender +/types/w3c-web-usb/ @larsgk @thegecko +/types/wait-on/ @ifiokjr /types/waitme/ @totpero /types/wake_on_lan/ @SrTobi /types/walk/ @poppa @@ -5572,7 +5679,7 @@ /types/web3/ @simon-jentzsch @nitzantomer @zurbo @yxliang01 @phra @naddison36 @icaroharry @linusnorton @jpeletier @anneau @matrushka @andrevmatos @levino @zlumer @archangel-irk @sogasg @donamk @dkent600 @nerddan @alexkvak /types/web3-eth-abi/ @LogvinovLeon /types/web3-provider-engine/ @LogvinovLeon -/types/webappsec-credential-management/ @iainmcgin +/types/webappsec-credential-management/ @iainmcgin @Hartimer /types/webassembly-js-api/ @periklis @chicoxyzzy /types/webassembly-web-api/ @jhenninger /types/webcl/ @NCARalph @@ -5593,7 +5700,7 @@ /types/webpack-config-utils/ @hotell /types/webpack-dev-middleware/ @bumbleblym @reduckted @chrisabrams /types/webpack-dev-middleware/v1/ @bumbleblym @reduckted -/types/webpack-dev-server/ @maestroh @daveparslow @ZheyangSong @alan-agius4 @arturovt +/types/webpack-dev-server/ @maestroh @daveparslow @ZheyangSong @alan-agius4 @arturovt @davecardwell /types/webpack-dotenv-plugin/ @kryops /types/webpack-env/ @use-strict @rhonsby /types/webpack-fail-plugin/ @deevus @@ -5610,6 +5717,7 @@ /types/webpack-stream/ @iclanton @bumbleblym /types/webpack-subresource-integrity/ @huan086 /types/webpack-validator/ @deevus +/types/webpack-watched-glob-entries-plugin/ @ChaosinaCan /types/webpackbar/ @rynclark /types/webpagetest/ @ksm2 /types/webprogbase-console-view/ @veetaha @@ -5660,10 +5768,12 @@ /types/wiring-pi/ @NoHomey /types/wnumb/ @acoreyj /types/wonder.js/ @yyc-git +/types/word-extractor/ @saboya /types/word-list-json/ @dovidm /types/word2vector/ @renekeijzer /types/wordcloud/ @joeskeen /types/words-to-numbers/ @James-Frowen +/types/wordwrap/ @ark120202 /types/workbox-sw/ @wessberg /types/workbox-webpack-plugin/ @kgroat /types/worker-threads-pool/ @BendingBender @@ -5724,7 +5834,7 @@ /types/ydn-db/ @yathit @gabrielmaldi /types/year-days/ @BendingBender /types/yeoman-assert/ @Toilal -/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 +/types/yeoman-generator/ @armorik83 @janslow @ikatyang @tasadar2 @haggen /types/yeoman-test/ @ikatyang /types/yesql/ @Sumolari /types/yn/ @BendingBender @@ -5736,10 +5846,10 @@ /types/yosay/ @armorik83 /types/youtube/ @DazWilkin @JoshuaKGoldberg @eliotfallon213 @terrymun @paulhobbel /types/youtube-dl/ @bsurai @moshfeu +/types/youtube-player/ @jurca /types/yui/ @giabao /types/yup/ @dhardtke @vtserman @MoretonBayRC @sseppola @YashdalfTheGray @vincentjames501 @robertbullen @sat0yu @dancrumb /types/z-schema/ @pgonzal -/types/zapier-platform-core/ @bradleyayers /types/zeit__next-typescript/ @icopp /types/zen-observable/ @aicest @JounQin @itomtom /types/zen-push/ @daprahamian diff --git a/.travis.yml b/.travis.yml index 9bd31bda14..6ea69355da 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,9 @@ language: node_js node_js: - 8 -sudo: false - notifications: email: false + +script: + - npm run test + - if [[ $TRAVIS_EVENT_TYPE == "cron" ]]; then npm run update-codeowners || travis_terminate 1; fi \ No newline at end of file diff --git a/README.md b/README.md index 746d9d9f3e..b50272dbf4 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ You may need to add manual [references](http://www.typescriptlang.org/docs/handb ## How can I contribute? -DefinitelyTyped only works because of contributions by users like you! +Definitely Typed only works because of contributions by users like you! ### Test @@ -89,7 +89,7 @@ then follow the instructions to [edit an existing package](#edit-an-existing-pac ### Make a pull request -Once you've tested your package, you can share it on DefinitelyTyped. +Once you've tested your package, you can share it on Definitely Typed. First, [fork](https://guides.github.com/activities/forking/) this repository, install [node](https://nodejs.org/), and run `npm install`. @@ -117,7 +117,7 @@ If it doesn't, you can do so yourself in the comment associated with the PR. #### Create a new package -If you are the library author and your package is written in TypeScript, [bundle the autogenerated declaration files](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) in your package instead of publishing to DefinitelyTyped. +If you are the library author and your package is written in TypeScript, [bundle the autogenerated declaration files](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) in your package instead of publishing to Definitely Typed. If you are adding typings for an NPM package, create a directory with the same name. If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM. @@ -137,7 +137,7 @@ See all options at [dts-gen](https://github.com/Microsoft/dts-gen). You may edit the `tsconfig.json` to add new files, to add `"target": "es6"` (needed for async functions), to add to `"lib"`, or to add the `"jsx"` compiler option. -DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down. +Definitely Typed members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down. For a good example package, see [base64-js](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/base64-js). @@ -165,18 +165,31 @@ For a good example package, see [base64-js](https://github.com/DefinitelyTyped/D #### Removing a package -When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion. +When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from Definitely Typed to avoid confusion. You can remove it by running `npm run not-needed -- typingsPackageName asOfVersion sourceRepoURL [libraryName]`. - `typingsPackageName`: This is the name of the directory to delete. - `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version. - `sourceRepoURL`: This should point to the repository that contains the typings. -- `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (If ommitted, will be identical to "typingsPackageName".) +- `libraryName`: Name of npm package that replaces the Definitely Typed types. Usually this is identical to "typingsPackageName", in which case you can omit it. -Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types. To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`. +Any other packages in Definitely Typed that referenced the deleted package should be updated to reference the bundled types. +You can get this list by looking at the errors from `npm run test`. +To fix the errors, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`. +For example: -If a package was never on DefinitelyTyped, it does not need to be added to `notNeededPackages.json`. +```json +{ + "private": true, + "dependencies": { + "foo": "^2.6.0" + } +} +``` +When you add a `package.json` to dependents of `foo`, you will also need to open a PR to add `foo` [to dependenciesWhitelist.txt in types-publisher](https://github.com/Microsoft/types-publisher/blob/master/dependenciesWhitelist.txt). + +If a package was never on Definitely Typed, it does not need to be added to `notNeededPackages.json`. #### Lint @@ -225,11 +238,11 @@ The `master` branch is automatically published to the `@types` scope on NPM than #### I've submitted a pull request. How long until it is merged? -It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or DefinitelyTyped team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs. +It depends, but most pull requests will be merged within a week. PRs that have been approved by an author listed in the definition's header are usually merged more quickly; PRs for new definitions will take more time as they require more review from maintainers. Each PR is reviewed by a TypeScript or Definitely Typed team member before being merged, so please be patient as human factors may cause delays. Check the [PR Burndown Board](https://github.com/DefinitelyTyped/DefinitelyTyped/projects/3?card_filter_query=is%3Aopen) to see progress as maintainers work through the open PRs. #### My PR is merged; when will the `@types` NPM package be updated? -NPM packages should update within a few minutes. If it's been more than an hour, mention the PR number on [the DefinitelyTyped Gitter channel](https://gitter.im/DefinitelyTyped/DefinitelyTyped) and the current maintainer will get the correct team member to investigate. +NPM packages should update within a few minutes. If it's been more than an hour, mention the PR number on [the Definitely Typed Gitter channel](https://gitter.im/DefinitelyTyped/DefinitelyTyped) and the current maintainer will get the correct team member to investigate. #### I'm writing a definition that depends on another definition. Should I use `` or an import? @@ -325,13 +338,13 @@ You can look [here](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/mast This may belong in [TSJS-Lib-Generator](https://github.com/Microsoft/TSJS-lib-generator#readme). See the guidelines there. If the standard is still a draft, it belongs here. Use a name beginning with `dom-` and include a link to the standard as the "Project" link in the header. -When it graduates draft mode, we may remove it from DefinitelyTyped and deprecate the associated `@types` package. +When it graduates draft mode, we may remove it from Definitely Typed and deprecate the associated `@types` package. -#### How do DefinitelyTyped package versions relate to versions of the corresponding library? +#### How do Definitely Typed package versions relate to versions of the corresponding library? _NOTE: The discussion in this section assumes familiarity with [Semantic versioning](https://semver.org/)_ -Each DefinitelyTyped package is versioned when published to NPM. +Each Definitely Typed package is versioned when published to NPM. The [types-publisher](https://github.com/Microsoft/types-publisher) (the tool that publishes `@types` packages to npm) will set the declaration package's version by using the `major.minor` version number listed in the first line of its `index.d.ts` file. For example, here are the first few lines of [Node's type declarations](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/1253faabf5e0d2c5470db6ea87795d7f96fef7e2/types/node/index.d.ts) for version `10.12.x` at the time of writing: @@ -339,24 +352,24 @@ For example, here are the first few lines of [Node's type declarations](https:// // Type definitions for Node.js 10.12 // Project: http://nodejs.org/ // Definitions by: Microsoft TypeScript -// DefinitelyTyped +// Definitely Typed // Alberto Schiabel ``` Because `10.12` is at the end the first line, the npm version of the `@types/node` package will also be `10.12.x`. Note that the first-line comment in the `index.d.ts` file should only contain the `major.minor` version (e.g. `10.12`) and should not contain a patch version (e.g. `10.12.4`). This is because only the major and minor release numbers are aligned between library packages and type declaration packages. -The patch release number of the type declaration package (e.g. `.0` in `10.12.0`) is initialized to zero by DefinitelyTyped and is incremented each time a new `@types/node` package is published to NPM for the same major/minor version of the corresponding library. +The patch release number of the type declaration package (e.g. `.0` in `10.12.0`) is initialized to zero by Definitely Typed and is incremented each time a new `@types/node` package is published to NPM for the same major/minor version of the corresponding library. Sometimes type declaration package versions and library package versions can get out of sync. Below are a few common reasons why, in order of how much they inconvenience users of a library. Only the last case is typically problematic. * As noted above, the patch version of the type declaration package is unrelated to the library patch version. - This allows DefinitelyTyped to safely update type declarations for the same major/minor version of a library. + This allows Definitely Typed to safely update type declarations for the same major/minor version of a library. * If updating a package for new functionality, don't forget to update the version number to line up with that version of the library. If users make sure versions correspond between JavaScript packages and their respective `@types` packages, then `npm update` should typically just work. -* It's common for type declaration package updates to lag behind library updates because it's often library users, not maintainers, who update DefinitelyTyped when new library features are released. +* It's common for type declaration package updates to lag behind library updates because it's often library users, not maintainers, who update Definitely Typed when new library features are released. So there may be a lag of days, weeks, or even months before a helpful community member sends a PR to update the type declaration package for a new library release. If you're impacted by this, you can be the change you want to see in the world and you can be that helpful community member! @@ -366,7 +379,7 @@ Only the last case is typically problematic. [Semantic versioning](https://semver.org/) requires that versions with breaking changes must increment the major version number. For example, a library that removes a publicly exported function after its `3.5.8` release must bump its version to `4.0.0` in its next release. -Furthermore, when the library's `4.0.0` release is out, its DefinitelyTyped type declaration package should also be updated to `4.0.0`, including any breaking changes to the library's API. +Furthermore, when the library's `4.0.0` release is out, its Definitely Typed type declaration package should also be updated to `4.0.0`, including any breaking changes to the library's API. Many libraries have a large installed base of developers (including maintainers of other packages using that library as a dependency) who won't move right away to a new version that has breaking changes, because it might be months until a maintainer has time to rewrite code to adapt to the new version. In the meantime, users of old library versions still may want to update type declarations for older versions. @@ -398,7 +411,7 @@ At the time of writing, the [history v2 `tsconfig.json`](https://github.com/Defi } ``` -If there are other packages in DefinitelyTyped that are incompatible with the new version, you will need to add path mappings to the old version. +If there are other packages in Definitely Typed that are incompatible with the new version, you will need to add path mappings to the old version. You will also need to do this recursively for packages depending on packages depending on the old version. For example, `react-router` depends on `history@2`, so [react-router `tsconfig.json`](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/react-router/v2/tsconfig.json) has a path mapping to `"history": [ "history/v2" ]`. diff --git a/notNeededPackages.json b/notNeededPackages.json index 4289393363..cf61daf58d 100644 --- a/notNeededPackages.json +++ b/notNeededPackages.json @@ -18,6 +18,12 @@ "sourceRepoURL": "https://github.com/ceolter/ag-grid", "asOfVersion": "3.2.0" }, + { + "libraryName": "aggregate-error", + "typingsPackageName": "aggregate-error", + "sourceRepoURL": "https://github.com/sindresorhus/aggregate-error", + "asOfVersion": "2.2.0" + }, { "libraryName": "ajv", "typingsPackageName": "ajv", @@ -198,6 +204,12 @@ "sourceRepoURL": "https://github.com/ded/bowser", "asOfVersion": "1.1.1" }, + { + "libraryName": "boxen", + "typingsPackageName": "boxen", + "sourceRepoURL": "https://github.com/sindresorhus/boxen", + "asOfVersion": "3.0.1" + }, { "libraryName": "Bugsnag Browser", "typingsPackageName": "bugsnag-js", @@ -216,12 +228,24 @@ "sourceRepoURL": "https://github.com/blakeembrey/camel-case", "asOfVersion": "1.2.1" }, + { + "libraryName": "camelcase", + "typingsPackageName": "camelcase", + "sourceRepoURL": "https://github.com/sindresorhus/camelcase", + "asOfVersion": "5.2.0" + }, { "libraryName": "catalog", "typingsPackageName": "catalog", "sourceRepoURL": "https://github.com/interactivethings/catalog", "asOfVersion": "3.5.0" }, + { + "libraryName": "chai-http", + "typingsPackageName": "chai-http", + "sourceRepoURL": "https://github.com/chaijs/chai-http", + "asOfVersion": "4.2.0" + }, { "libraryName": "chalk", "typingsPackageName": "chalk", @@ -240,12 +264,24 @@ "sourceRepoURL": "https://github.com/mapbox/cheap-ruler", "asOfVersion": "2.5.0" }, + { + "libraryName": "chokidar", + "typingsPackageName": "chokidar", + "sourceRepoURL": "https://github.com/paulmillr/chokidar", + "asOfVersion": "2.1.3" + }, { "libraryName": "chunked-dc", "typingsPackageName": "chunked-dc", "sourceRepoURL": "https://github.com/saltyrtc/chunked-dc-js", "asOfVersion": "0.2.2" }, + { + "libraryName": "clean-webpack-plugin", + "typingsPackageName": "clean-webpack-plugin", + "sourceRepoURL": "https://github.com/johnagan/clean-webpack-plugin", + "asOfVersion": "2.0.0" + }, { "libraryName": "colors.js (colors)", "typingsPackageName": "colors", @@ -258,6 +294,12 @@ "sourceRepoURL": "https://github.com/tj/commander.js", "asOfVersion": "2.12.2" }, + { + "libraryName": "conf", + "typingsPackageName": "conf", + "sourceRepoURL": "https://github.com/sindresorhus/conf", + "asOfVersion": "3.0.0" + }, { "libraryName": "confirmdialog", "typingsPackageName": "confirmdialog", @@ -270,6 +312,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/constant-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "copy-text-to-clipboard", + "typingsPackageName": "copy-text-to-clipboard", + "sourceRepoURL": "https://github.com/sindresorhus/copy-text-to-clipboard", + "asOfVersion": "2.0.1" + }, { "libraryName": "cordova-plugin-battery-status", "typingsPackageName": "cordova-plugin-battery-status", @@ -384,6 +432,18 @@ "sourceRepoURL": "https://github.com/jayphelps/core-decorators.js", "asOfVersion": "0.20.0" }, + { + "libraryName": "cp-file", + "typingsPackageName": "cp-file", + "sourceRepoURL": "https://github.com/sindresorhus/cp-file", + "asOfVersion": "6.1.1" + }, + { + "libraryName": "cpy", + "typingsPackageName": "cpy", + "sourceRepoURL": "https://github.com/sindresorhus/cpy", + "asOfVersion": "7.1.1" + }, { "libraryName": "cypress", "typingsPackageName": "cypress", @@ -402,18 +462,36 @@ "sourceRepoURL": "https://github.com/DataDog/dd-trace-js", "asOfVersion": "0.9.0" }, + { + "libraryName": "decamelize", + "typingsPackageName": "decamelize", + "sourceRepoURL": "https://github.com/sindresorhus/decamelize", + "asOfVersion": "3.0.1" + }, { "libraryName": "decimal.js", "typingsPackageName": "decimal.js", "sourceRepoURL": "https://github.com/MikeMcl/decimal.js", "asOfVersion": "7.4.0" }, + { + "libraryName": "decompress-response", + "typingsPackageName": "decompress-response", + "sourceRepoURL": "https://github.com/sindresorhus/decompress-response", + "asOfVersion": "4.1.0" + }, { "libraryName": "deepmerge", "typingsPackageName": "deepmerge", "sourceRepoURL": "git@github.com:KyleAMathews/deepmerge.git", "asOfVersion": "2.2.0" }, + { + "libraryName": "del", + "typingsPackageName": "del", + "sourceRepoURL": "https://github.com/sindresorhus/del", + "asOfVersion": "4.0.0" + }, { "libraryName": "delay", "typingsPackageName": "delay", @@ -444,6 +522,12 @@ "sourceRepoURL": "https://github.com/joyent/docker-file-parser", "asOfVersion": "1.0.3" }, + { + "libraryName": "dom-loaded", + "typingsPackageName": "dom-loaded", + "sourceRepoURL": "https://github.com/sindresorhus/dom-loaded", + "asOfVersion": "1.1.0" + }, { "libraryName": "dot-case", "typingsPackageName": "dot-case", @@ -498,6 +582,12 @@ "sourceRepoURL": "https://github.com/loopline-systems/electron-builder", "asOfVersion": "2.8.0" }, + { + "libraryName": "element-ready", + "typingsPackageName": "element-ready", + "sourceRepoURL": "https://github.com/sindresorhus/element-ready", + "asOfVersion": "3.1.0" + }, { "libraryName": "email-addresses", "typingsPackageName": "email-addresses", @@ -510,6 +600,12 @@ "sourceRepoURL": "https://github.com/Sembiance/email-validator", "asOfVersion": "1.0.6" }, + { + "libraryName": "env-paths", + "typingsPackageName": "env-paths", + "sourceRepoURL": "https://github.com/sindresorhus/env-paths", + "asOfVersion": "2.1.0" + }, { "libraryName": "error-stack-parser", "typingsPackageName": "error-stack-parser", @@ -606,6 +702,24 @@ "sourceRepoURL": "https://github.com/taylorhakes/fecha", "asOfVersion": "2.3.1" }, + { + "libraryName": "file-type", + "typingsPackageName": "file-type", + "sourceRepoURL": "https://github.com/sindresorhus/file-type", + "asOfVersion": "10.9.1" + }, + { + "libraryName": "filenamify", + "typingsPackageName": "filenamify", + "sourceRepoURL": "https://github.com/sindresorhus/filenamify", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "filenamify-url", + "typingsPackageName": "filenamify-url", + "sourceRepoURL": "https://github.com/sindresorhus/filenamify-url", + "asOfVersion": "2.0.0" + }, { "libraryName": "FineUploader", "typingsPackageName": "fine-uploader", @@ -618,6 +732,12 @@ "sourceRepoURL": "https://www.firebase.com/docs/javascript/firebase", "asOfVersion": "3.2.1" }, + { + "libraryName": "fkill", + "typingsPackageName": "fkill", + "sourceRepoURL": "https://github.com/sindresorhus/fkill", + "asOfVersion": "6.0.0" + }, { "libraryName": "flatpickr", "typingsPackageName": "flatpickr", @@ -666,6 +786,12 @@ "sourceRepoURL": "https://github.com/manuelbieh/Geolib", "asOfVersion": "2.0.23" }, + { + "libraryName": "get-stream", + "typingsPackageName": "get-stream", + "sourceRepoURL": "https://github.com/sindresorhus/get-stream", + "asOfVersion": "5.0.0" + }, { "libraryName": "github", "typingsPackageName": "github", @@ -678,6 +804,12 @@ "sourceRepoURL": "https://github.com/jdalrymple/node-gitlab", "asOfVersion": "2.0.0" }, + { + "libraryName": "globby", + "typingsPackageName": "globby", + "sourceRepoURL": "https://github.com/sindresorhus/globby", + "asOfVersion": "9.1.0" + }, { "libraryName": "Google Cloud Storage", "typingsPackageName": "google-cloud__storage", @@ -714,12 +846,30 @@ "sourceRepoURL": "https://github.com/ivogabe/gulp-typescript", "asOfVersion": "2.13.0" }, + { + "libraryName": "handlebars", + "typingsPackageName": "handlebars", + "sourceRepoURL": "https://github.com/wycats/handlebars.js", + "asOfVersion": "4.1.0" + }, { "libraryName": "handsontable", "typingsPackageName": "handsontable", "sourceRepoURL": "https://handsontable.com/", "asOfVersion": "0.35.0" }, + { + "libraryName": "has-yarn", + "typingsPackageName": "has-yarn", + "sourceRepoURL": "https://github.com/sindresorhus/has-yarn", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "hasha", + "typingsPackageName": "hasha", + "sourceRepoURL": "https://github.com/sindresorhus/hasha", + "asOfVersion": "4.0.0" + }, { "libraryName": "hibp", "typingsPackageName": "hibp", @@ -738,6 +888,12 @@ "sourceRepoURL": "https://github.com/prettymuchbryce/node-http-status", "asOfVersion": "1.2.0" }, + { + "libraryName": "humanize-string", + "typingsPackageName": "humanize-string", + "sourceRepoURL": "https://github.com/sindresorhus/humanize-string", + "asOfVersion": "2.0.1" + }, { "libraryName": "i18next-browser-languagedetector", "typingsPackageName": "i18next-browser-languagedetector", @@ -762,6 +918,12 @@ "sourceRepoURL": "https://github.com/bpmn-io/ids", "asOfVersion": "0.2.2" }, + { + "libraryName": "image-type", + "typingsPackageName": "image-type", + "sourceRepoURL": "https://github.com/sindresorhus/image-type", + "asOfVersion": "4.0.1" + }, { "libraryName": "immutability-helper", "typingsPackageName": "immutability-helper", @@ -786,6 +948,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/internal-ip", "asOfVersion": "4.1.0" }, + { + "libraryName": "into-stream", + "typingsPackageName": "into-stream", + "sourceRepoURL": "https://github.com/sindresorhus/into-stream", + "asOfVersion": "5.0.0" + }, { "libraryName": "inversify", "typingsPackageName": "inversify", @@ -834,12 +1002,30 @@ "sourceRepoURL": "https://github.com/blakeembrey/is-lower-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "is-online", + "typingsPackageName": "is-online", + "sourceRepoURL": "https://github.com/sindresorhus/is-online", + "asOfVersion": "8.1.0" + }, { "libraryName": "is-plain-object", "typingsPackageName": "is-plain-object", "sourceRepoURL": "https://github.com/jonschlinkert/is-plain-object", "asOfVersion": "2.0.4" }, + { + "libraryName": "is-scoped", + "typingsPackageName": "is-scoped", + "sourceRepoURL": "https://github.com/sindresorhus/is-scoped", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "is-svg", + "typingsPackageName": "is-svg", + "sourceRepoURL": "https://github.com/sindresorhus/is-svg", + "asOfVersion": "4.0.1" + }, { "libraryName": "is-upper-case", "typingsPackageName": "is-upper-case", @@ -918,6 +1104,12 @@ "sourceRepoURL": "https://github.com/keycloak/keycloak", "asOfVersion": "3.4.1" }, + { + "libraryName": "knex", + "typingsPackageName": "knex", + "sourceRepoURL": "https://github.com/tgriesser/knex", + "asOfVersion": "0.16.1" + }, { "libraryName": "knockout-paging", "typingsPackageName": "knockout-paging", @@ -942,6 +1134,12 @@ "sourceRepoURL": "https://github.com/elitechance/lambda-phi", "asOfVersion": "1.0.1" }, + { + "libraryName": "latest-version", + "typingsPackageName": "latest-version", + "sourceRepoURL": "https://github.com/sindresorhus/latest-version", + "asOfVersion": "5.0.0" + }, { "libraryName": "ldclient-js", "typingsPackageName": "ldclient-js", @@ -954,6 +1152,12 @@ "sourceRepoURL": "https://github.com/stevemao/left-pad", "asOfVersion": "1.2.0" }, + { + "libraryName": "leven", + "typingsPackageName": "leven", + "sourceRepoURL": "https://github.com/sindresorhus/leven", + "asOfVersion": "3.0.0" + }, { "libraryName": "Linq.JS", "typingsPackageName": "linq", @@ -990,6 +1194,12 @@ "sourceRepoURL": "https://github.com/steelsojka/lodash-decorators", "asOfVersion": "4.0.0" }, + { + "libraryName": "log-update", + "typingsPackageName": "log-update", + "sourceRepoURL": "https://github.com/sindresorhus/log-update", + "asOfVersion": "3.1.0" + }, { "libraryName": "log4javascript", "typingsPackageName": "log4javascript", @@ -1014,6 +1224,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/lower-case-first", "asOfVersion": "1.0.1" }, + { + "libraryName": "make-dir", + "typingsPackageName": "make-dir", + "sourceRepoURL": "https://github.com/sindresorhus/make-dir", + "asOfVersion": "2.1.0" + }, { "libraryName": "mali", "typingsPackageName": "mali", @@ -1032,6 +1248,12 @@ "sourceRepoURL": "https://github.com/runk/node-maxmind", "asOfVersion": "2.0.5" }, + { + "libraryName": "mem", + "typingsPackageName": "mem", + "sourceRepoURL": "https://github.com/sindresorhus/mem", + "asOfVersion": "4.2.0" + }, { "libraryName": "mendixmodelsdk", "typingsPackageName": "mendixmodelsdk", @@ -1086,6 +1308,12 @@ "sourceRepoURL": "https://github.com/LearnBoost/monk.git", "asOfVersion": "6.0.0" }, + { + "libraryName": "move-file", + "typingsPackageName": "move-file", + "sourceRepoURL": "https://github.com/sindresorhus/move-file", + "asOfVersion": "1.1.0" + }, { "libraryName": "MQTT", "typingsPackageName": "mqtt", @@ -1128,6 +1356,36 @@ "sourceRepoURL": "https://github.com/paularmstrong/normalizr", "asOfVersion": "2.0.18" }, + { + "libraryName": "npm-email", + "typingsPackageName": "npm-email", + "sourceRepoURL": "https://github.com/sindresorhus/npm-email", + "asOfVersion": "3.1.0" + }, + { + "libraryName": "npm-keyword", + "typingsPackageName": "npm-keyword", + "sourceRepoURL": "https://github.com/sindresorhus/npm-keyword", + "asOfVersion": "6.0.0" + }, + { + "libraryName": "npm-name", + "typingsPackageName": "npm-name", + "sourceRepoURL": "https://github.com/sindresorhus/npm-name", + "asOfVersion": "5.2.1" + }, + { + "libraryName": "npm-run-path", + "typingsPackageName": "npm-run-path", + "sourceRepoURL": "https://github.com/sindresorhus/npm-run-path", + "asOfVersion": "3.0.1" + }, + { + "libraryName": "npm-user", + "typingsPackageName": "npm-user", + "sourceRepoURL": "https://github.com/sindresorhus/npm-user", + "asOfVersion": "4.0.0" + }, { "libraryName": "Nuka Carousel", "typingsPackageName": "nuka-carousel", @@ -1140,30 +1398,180 @@ "sourceRepoURL": "https://github.com/foretagsplatsen/numbro/", "asOfVersion": "1.9.3" }, + { + "libraryName": "on-change", + "typingsPackageName": "on-change", + "sourceRepoURL": "https://github.com/sindresorhus/on-change", + "asOfVersion": "1.1.0" + }, { "libraryName": "Onsen UI", "typingsPackageName": "onsenui", "sourceRepoURL": "http://onsen.io", "asOfVersion": "2.0.0" }, + { + "libraryName": "ora", + "typingsPackageName": "ora", + "sourceRepoURL": "https://github.com/sindresorhus/ora", + "asOfVersion": "3.2.0" + }, + { + "libraryName": "p-any", + "typingsPackageName": "p-any", + "sourceRepoURL": "https://github.com/sindresorhus/p-any", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-cancelable", + "typingsPackageName": "p-cancelable", + "sourceRepoURL": "https://github.com/sindresorhus/p-cancelable", + "asOfVersion": "1.1.0" + }, + { + "libraryName": "p-catch-if", + "typingsPackageName": "p-catch-if", + "sourceRepoURL": "https://github.com/sindresorhus/p-catch-if", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-debounce", + "typingsPackageName": "p-debounce", + "sourceRepoURL": "https://github.com/sindresorhus/p-debounce", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-each-series", + "typingsPackageName": "p-each-series", + "sourceRepoURL": "https://github.com/sindresorhus/p-each-series", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-event", + "typingsPackageName": "p-event", + "sourceRepoURL": "https://github.com/sindresorhus/p-event", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "p-every", + "typingsPackageName": "p-every", + "sourceRepoURL": "https://github.com/kevva/p-every", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-limit", + "typingsPackageName": "p-limit", + "sourceRepoURL": "https://github.com/sindresorhus/p-limit", + "asOfVersion": "2.2.0" + }, + { + "libraryName": "p-locate", + "typingsPackageName": "p-locate", + "sourceRepoURL": "https://github.com/sindresorhus/p-locate", + "asOfVersion": "4.0.0" + }, + { + "libraryName": "p-log", + "typingsPackageName": "p-log", + "sourceRepoURL": "https://github.com/sindresorhus/p-log", + "asOfVersion": "2.0.0" + }, { "libraryName": "p-map", "typingsPackageName": "p-map", "sourceRepoURL": "https://github.com/sindresorhus/p-map", "asOfVersion": "2.0.0" }, + { + "libraryName": "p-map-series", + "typingsPackageName": "p-map-series", + "sourceRepoURL": "https://github.com/sindresorhus/p-map-series", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-memoize", + "typingsPackageName": "p-memoize", + "sourceRepoURL": "https://github.com/sindresorhus/p-memoize", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "p-one", + "typingsPackageName": "p-one", + "sourceRepoURL": "https://github.com/kevva/p-one", + "asOfVersion": "2.0.0" + }, { "libraryName": "p-pipe", "typingsPackageName": "p-pipe", "sourceRepoURL": "https://github.com/sindresorhus/p-pipe", "asOfVersion": "2.0.1" }, + { + "libraryName": "p-progress", + "typingsPackageName": "p-progress", + "sourceRepoURL": "https://github.com/sindresorhus/p-progress", + "asOfVersion": "0.3.0" + }, + { + "libraryName": "p-props", + "typingsPackageName": "p-props", + "sourceRepoURL": "https://github.com/sindresorhus/p-props", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-queue", + "typingsPackageName": "p-queue", + "sourceRepoURL": "https://github.com/sindresorhus/p-queue", + "asOfVersion": "3.2.1" + }, + { + "libraryName": "p-reduce", + "typingsPackageName": "p-reduce", + "sourceRepoURL": "https://github.com/sindresorhus/p-reduce", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-retry", + "typingsPackageName": "p-retry", + "sourceRepoURL": "https://github.com/sindresorhus/p-retry", + "asOfVersion": "4.0.0" + }, + { + "libraryName": "p-series", + "typingsPackageName": "p-series", + "sourceRepoURL": "https://github.com/sindresorhus/p-series", + "asOfVersion": "2.0.0" + }, + { + "libraryName": "p-some", + "typingsPackageName": "p-some", + "sourceRepoURL": "https://github.com/sindresorhus/p-some", + "asOfVersion": "4.0.1" + }, + { + "libraryName": "p-tap", + "typingsPackageName": "p-tap", + "sourceRepoURL": "https://github.com/sindresorhus/p-tap", + "asOfVersion": "2.0.0" + }, { "libraryName": "p-throttle", "typingsPackageName": "p-throttle", "sourceRepoURL": "https://github.com/sindresorhus/p-throttle", "asOfVersion": "2.1.0" }, + { + "libraryName": "p-timeout", + "typingsPackageName": "p-timeout", + "sourceRepoURL": "https://github.com/sindresorhus/p-timeout", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "package-json", + "typingsPackageName": "package-json", + "sourceRepoURL": "https://github.com/sindresorhus/package-json", + "asOfVersion": "6.1.0" + }, { "libraryName": "param-case", "typingsPackageName": "param-case", @@ -1188,12 +1596,24 @@ "sourceRepoURL": "https://github.com/blakeembrey/path-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "path-key", + "typingsPackageName": "path-key", + "sourceRepoURL": "https://github.com/sindresorhus/path-key", + "asOfVersion": "3.0.1" + }, { "libraryName": "path-to-regexp", "typingsPackageName": "path-to-regexp", "sourceRepoURL": "https://github.com/pillarjs/path-to-regexp", "asOfVersion": "1.7.0" }, + { + "libraryName": "path-type", + "typingsPackageName": "path-type", + "sourceRepoURL": "https://github.com/sindresorhus/path-type", + "asOfVersion": "4.0.0" + }, { "libraryName": "perfect-scrollbar", "typingsPackageName": "perfect-scrollbar", @@ -1230,12 +1650,36 @@ "sourceRepoURL": "https://github.com/PeculiarVentures/pkcs11js", "asOfVersion": "1.0.4" }, + { + "libraryName": "pkg-conf", + "typingsPackageName": "pkg-conf", + "sourceRepoURL": "https://github.com/sindresorhus/pkg-conf", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "pkg-dir", + "typingsPackageName": "pkg-dir", + "sourceRepoURL": "https://github.com/sindresorhus/pkg-dir", + "asOfVersion": "4.0.0" + }, + { + "libraryName": "pkg-versions", + "typingsPackageName": "pkg-versions", + "sourceRepoURL": "https://github.com/sindresorhus/pkg-versions", + "asOfVersion": "2.0.0" + }, { "libraryName": "plottable", "typingsPackageName": "plottable", "sourceRepoURL": "http://plottablejs.org/", "asOfVersion": "3.7.0" }, + { + "libraryName": "png-async", + "typingsPackageName": "png-async", + "sourceRepoURL": "https://github.com/kanreisa/node-png-async", + "asOfVersion": "0.9.4" + }, { "libraryName": "poly2tri.js", "typingsPackageName": "poly2tri", @@ -1266,6 +1710,12 @@ "sourceRepoURL": "https://github.com/angular/protractor", "asOfVersion": "4.0.0" }, + { + "libraryName": "ps-list", + "typingsPackageName": "ps-list", + "sourceRepoURL": "https://github.com/sindresorhus/ps-list", + "asOfVersion": "6.2.1" + }, { "libraryName": "qiniu", "typingsPackageName": "qiniu", @@ -1278,6 +1728,18 @@ "sourceRepoURL": "https://github.com/kazuhikoarase/qrcode-generator", "asOfVersion": "1.0.6" }, + { + "libraryName": "query-string", + "typingsPackageName": "query-string", + "sourceRepoURL": "https://github.com/sindresorhus/query-string", + "asOfVersion": "6.3.0" + }, + { + "libraryName": "quick-lru", + "typingsPackageName": "quick-lru", + "sourceRepoURL": "https://github.com/sindresorhus/quick-lru", + "asOfVersion": "3.0.0" + }, { "libraryName": "Raven JS", "typingsPackageName": "raven-js", @@ -1404,6 +1866,12 @@ "sourceRepoURL": "https://github.com/tanem/react-svg", "asOfVersion": "5.0.0" }, + { + "libraryName": "read-chunk", + "typingsPackageName": "read-chunk", + "sourceRepoURL": "https://github.com/sindresorhus/read-chunk", + "asOfVersion": "3.1.0" + }, { "libraryName": "realm", "typingsPackageName": "realm", @@ -1542,6 +2010,12 @@ "sourceRepoURL": "https://github.com/Lellansin/node-scanf", "asOfVersion": "0.7.3" }, + { + "libraryName": "screenfull", + "typingsPackageName": "screenfull", + "sourceRepoURL": "https://github.com/sindresorhus/screenfull.js", + "asOfVersion": "4.1.0" + }, { "libraryName": "sendgrid", "typingsPackageName": "sendgrid", @@ -1578,6 +2052,18 @@ "sourceRepoURL": "https://github.com/zeh/simplesignal", "asOfVersion": "1.0.0" }, + { + "libraryName": "@sindresorhus/df", + "typingsPackageName": "sindresorhus__df", + "sourceRepoURL": "https://github.com/sindresorhus/df", + "asOfVersion": "3.0.0" + }, + { + "libraryName": "@sindresorhus/slugify", + "typingsPackageName": "sindresorhus__slugify", + "sourceRepoURL": "https://github.com/sindresorhus/slugify", + "asOfVersion": "0.9.1" + }, { "libraryName": "sip.js", "typingsPackageName": "sip.js", @@ -1686,6 +2172,12 @@ "sourceRepoURL": "http://tabrisjs.com", "asOfVersion": "1.8.0" }, + { + "libraryName": "tabris-plugin-firebase", + "typingsPackageName": "tabris-plugin-firebase", + "sourceRepoURL": "https://github.com/eclipsesource/tabris-plugin-firebase", + "asOfVersion": "2.1.0" + }, { "libraryName": "tcomb", "typingsPackageName": "tcomb", @@ -1698,6 +2190,12 @@ "sourceRepoURL": "https://github.com/terser-js/terser", "asOfVersion": "3.12.0" }, + { + "libraryName": "time-span", + "typingsPackageName": "time-span", + "sourceRepoURL": "https://github.com/sindresorhus/time-span", + "asOfVersion": "3.0.1" + }, { "libraryName": "timezonecomplete", "typingsPackageName": "timezonecomplete", @@ -1710,6 +2208,12 @@ "sourceRepoURL": "https://github.com/blakeembrey/title-case", "asOfVersion": "1.1.2" }, + { + "libraryName": "trash", + "typingsPackageName": "trash", + "sourceRepoURL": "https://github.com/sindresorhus/trash", + "asOfVersion": "5.0.1" + }, { "libraryName": "TsMonad", "typingsPackageName": "tsmonad", @@ -1758,6 +2262,12 @@ "sourceRepoURL": "https://github.com/kriasoft/universal-router", "asOfVersion": "8.0.0" }, + { + "libraryName": "unused-filename", + "typingsPackageName": "unused-filename", + "sourceRepoURL": "https://github.com/sindresorhus/unused-filename", + "asOfVersion": "2.0.0" + }, { "libraryName": "upper-case", "typingsPackageName": "upper-case", @@ -1818,6 +2328,12 @@ "sourceRepoURL": "https://github.com/sindresorhus/wait-for-localhost", "asOfVersion": "3.1.0" }, + { + "libraryName": "wallpaper", + "typingsPackageName": "wallpaper", + "sourceRepoURL": "https://github.com/sindresorhus/wallpaper", + "asOfVersion": "4.3.0" + }, { "libraryName": "webcola", "typingsPackageName": "webcola", @@ -1898,9 +2414,9 @@ }, { "libraryName": "@xmpp/jid", - "typingsPackageName": "xmpp-jid", + "typingsPackageName": "xmpp__jid", "sourceRepoURL": "github.com/node-xmpp/node-xmpp/", - "asOfVersion": "1.2.0" + "asOfVersion": "1.2.1" }, { "libraryName": "xterm.js", @@ -1914,6 +2430,12 @@ "sourceRepoURL": "none", "asOfVersion": "2.1.0" }, + { + "libraryName": "zapier-platform-core", + "typingsPackageName": "zapier-platform-core", + "sourceRepoURL": "https://github.com/zapier/zapier-platform-core", + "asOfVersion": "6.1.1" + }, { "libraryName": "zetapush-js", "typingsPackageName": "zetapush-js", diff --git a/package.json b/package.json index 1a5124c035..f4c48b1b32 100644 --- a/package.json +++ b/package.json @@ -17,6 +17,7 @@ "scripts": { "compile-scripts": "tsc -p scripts", "not-needed": "node scripts/not-needed.js", + "update-codeowners": "node scripts/update-codeowners.js", "test": "node node_modules/types-publisher/bin/tester/test.js --run-from-definitely-typed", "lint": "dtslint types" }, diff --git a/scripts/tsconfig.json b/scripts/tsconfig.json index 899f96af64..6e0fd5a58c 100644 --- a/scripts/tsconfig.json +++ b/scripts/tsconfig.json @@ -1,13 +1,10 @@ { "compilerOptions": { + "allowJs": true, + "checkJs": true, "module": "commonjs", "target": "es6", - "noImplicitAny": true, - "strictNullChecks": true, - "noImplicitReturns": true, - "noImplicitThis": true, - "noUnusedLocals": true, - "noUnusedParameters": true, + "strict": true, "baseUrl": "../types", "typeRoots": [ "../types" @@ -15,4 +12,4 @@ "types": [], "forceConsistentCasingInFileNames": true } -} \ No newline at end of file +} diff --git a/scripts/update-codeowners.js b/scripts/update-codeowners.js new file mode 100644 index 0000000000..56eda138c6 --- /dev/null +++ b/scripts/update-codeowners.js @@ -0,0 +1,126 @@ +/// +// Must reference esnext.asynciterable lib, since octokit uses AsyncIterable internally +const cp = require("child_process"); +const Octokit = require("@octokit/rest"); +const { AllPackages, getDefinitelyTyped, loggerWithErrors, + parseDefinitions, parseNProcesses, clean } = require("types-publisher"); +const { writeFile } = require("fs-extra"); + +async function main() { + const options = { definitelyTypedPath: ".", progress: false, parseInParallel: true }; + const log = loggerWithErrors()[0]; + + clean(); + const dt = await getDefinitelyTyped(options, log); + await parseDefinitions(dt, { nProcesses: parseNProcesses(), definitelyTypedPath: "." }, log); + const allPackages = await AllPackages.read(dt); + const typings = allPackages.allTypings(); + const maxPathLen = Math.max(...typings.map(t => t.subDirectoryPath.length)); + const entries = mapDefined(typings, t => getEntry(t, maxPathLen)); + await writeFile([options.definitelyTypedPath, ".github", "CODEOWNERS"].join("/"), `${header}\n\n${entries.join("\n")}\n`, { encoding: "utf-8" }); +} + +const token = /** @type {string} */(process.env.GH_TOKEN); +const gh = new Octokit(); +const reviewers = ["weswigham", "sandersn", "RyanCavanaugh"] +const now = new Date(); +const branchName = `codeowner-update-${now.getFullYear()}${padNum(now.getMonth())}${padNum(now.getDay())}`; +const remoteUrl = `https://${token}@github.com/DefinitelyTyped/DefinitelyTyped.git`; +runSequence([ + ["git", ["checkout", "."]], // reset any changes +]); + +main().then(() => { + runSequence([ + ["git", ["checkout", "-b", branchName]], // create a branch + ["git", ["add", ".github/CODEOWNERS"]], // Add CODEOWNERS + ["git", ["commit", "-m", `"Update CODEOWNERS"`]], // Commit all changes + ["git", ["remote", "add", "fork", remoteUrl]], // Add the remote fork + ["git", ["push", "--set-upstream", "fork", branchName, "-f"]] // push the branch + ]); + + gh.authenticate({ + type: "token", + token, + }); + return gh.pulls.create({ + owner: "DefinitelyTyped", + repo: "DefinitelyTyped", + maintainer_can_modify: true, + title: `🤖 CODEOWNERS has changed`, + head: `DefinitelyTyped:${branchName}`, + base: "master", + body: + `Please review the diff and merge if no changes are unexpected. + +cc ${reviewers.map(r => "@" + r).join(" ")}`, + }) +}).then(r => { + const num = r.data.number; + console.log(`Pull request ${num} created.`); + return gh.pulls.createReviewRequest({ + owner: "DefinitelyTyped", + repo: "DefinitelyTyped", + number: num, + reviewers, + }); +}).then(() => { + console.log(`Reviewers requested, done.`); +}).catch(e => { + console.error(e); + process.exit(1); +}); + +/** @param {[string, string[]][]} tasks */ +function runSequence(tasks) { + for (const task of tasks) { + console.log(`${task[0]} ${task[1].join(" ")}`); + const result = cp.spawnSync(task[0], task[1], { timeout: 100000, shell: true, stdio: "inherit" }); + if (result.status !== 0) throw new Error(`${task[0]} ${task[1].join(" ")} failed: ${result.stderr && result.stderr.toString()}`); + } +} + +/** @param {number} number */ +function padNum(number) { + const str = "" + number; + return str.length >= 2 ? str : "0" + str; +} + + +const header = +`# This file is generated. +# Add yourself to the "Definitions by:" list instead. +# See https://github.com/DefinitelyTyped/DefinitelyTyped#edit-an-existing-package`; + +/** + * @param { { contributors: ReadonlyArray<{githubUsername?: string }>, subDirectoryPath: string} } pkg + * @param {number} maxPathLen + * @return {string | undefined} + */ +function getEntry(pkg, maxPathLen) { + const users = mapDefined(pkg.contributors, c => c.githubUsername); + if (!users.length) { + return undefined; + } + + const path = `${pkg.subDirectoryPath}/`.padEnd(maxPathLen); + return `/types/${path} ${users.map(u => `@${u}`).join(" ")}`; +} + +/** + * @template T,U + * @param {ReadonlyArray} arr + * @param {(t: T) => U | undefined} mapper + * @return U[] + */ +function mapDefined(arr, mapper) { + const out = []; + for (const a of arr) { + const res = mapper(a); + if (res !== undefined) { + out.push(res); + } + } + return out; +} + diff --git a/types/absolute/tslint.json b/types/absolute/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/absolute/tslint.json +++ b/types/absolute/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/acc-wizard/tslint.json b/types/acc-wizard/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/acc-wizard/tslint.json +++ b/types/acc-wizard/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ace/tslint.json b/types/ace/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ace/tslint.json +++ b/types/ace/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/actioncable/tslint.json b/types/actioncable/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/actioncable/tslint.json +++ b/types/actioncable/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/add-zero/add-zero-tests.ts b/types/add-zero/add-zero-tests.ts index ac0509d26d..852f1eddb9 100644 --- a/types/add-zero/add-zero-tests.ts +++ b/types/add-zero/add-zero-tests.ts @@ -1,3 +1,3 @@ -import addZero from "add-zero"; +import addZero = require("add-zero"); addZero(5, 2); diff --git a/types/add-zero/index.d.ts b/types/add-zero/index.d.ts index 907364a62d..15c21d4d11 100644 --- a/types/add-zero/index.d.ts +++ b/types/add-zero/index.d.ts @@ -3,4 +3,5 @@ // Definitions by: Giles Roadnight // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function addZero(value: string | number, digits?: number): string; +export = addZero; +declare function addZero(value: string | number, digits?: number): string; diff --git a/types/add2home/tslint.json b/types/add2home/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/add2home/tslint.json +++ b/types/add2home/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/adone/glosses/collections/buffer_list.d.ts b/types/adone/glosses/collections/buffer_list.d.ts index b2a4157385..482055fecc 100644 --- a/types/adone/glosses/collections/buffer_list.d.ts +++ b/types/adone/glosses/collections/buffer_list.d.ts @@ -30,7 +30,7 @@ declare namespace adone.collection { /** * Ends the stream */ - end(chunk?: Buffer): void; + end(chunk?: Buffer | string): void; end(chunk?: () => void): void; /** diff --git a/types/adone/index.d.ts b/types/adone/index.d.ts index 521bdf6e03..f7249c00b4 100644 --- a/types/adone/index.d.ts +++ b/types/adone/index.d.ts @@ -2,7 +2,7 @@ // Project: https://github.com/ciferox/adone // Definitions by: am , Maximus // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.6 +// TypeScript Version: 2.8 /// /// diff --git a/types/adone/tslint.json b/types/adone/tslint.json index 8c265eebb4..177bd33372 100644 --- a/types/adone/tslint.json +++ b/types/adone/tslint.json @@ -13,6 +13,7 @@ "no-unnecessary-qualifier": false, "unified-signatures": false, "space-before-function-paren": false, - "await-promise": false + "await-promise": false, + "no-restricted-globals": false } -} \ No newline at end of file +} diff --git a/types/agenda/tslint.json b/types/agenda/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/agenda/tslint.json +++ b/types/agenda/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/aggregate-error/aggregate-error-tests.ts b/types/aggregate-error/aggregate-error-tests.ts deleted file mode 100644 index 69e544f9ee..0000000000 --- a/types/aggregate-error/aggregate-error-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ -import AggregateError = require('aggregate-error'); - -const err = new AggregateError([new Error('foo'), 'bar']); - -for (const el of Array.from(err)) { - const err: Error = el; -} - -throw err; diff --git a/types/aggregate-error/index.d.ts b/types/aggregate-error/index.d.ts deleted file mode 100644 index 8c8c4cd3b2..0000000000 --- a/types/aggregate-error/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Type definitions for aggregate-error 1.0 -// Project: https://github.com/sindresorhus/aggregate-error#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = AggregateError; - -declare class AggregateError extends Error implements Iterable { - constructor(errors: Iterable); - - [Symbol.iterator](): Iterator; -} diff --git a/types/aggregate-error/tsconfig.json b/types/aggregate-error/tsconfig.json deleted file mode 100644 index f092ab1c3e..0000000000 --- a/types/aggregate-error/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "aggregate-error-tests.ts" - ] -} \ No newline at end of file diff --git a/types/alertify/tslint.json b/types/alertify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/alertify/tslint.json +++ b/types/alertify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/algoliasearch/algoliasearch-tests.ts b/types/algoliasearch/algoliasearch-tests.ts index fdd0f395fe..fa6e29dbab 100644 --- a/types/algoliasearch/algoliasearch-tests.ts +++ b/types/algoliasearch/algoliasearch-tests.ts @@ -98,6 +98,7 @@ let _algoliaIndexSettings: IndexSettings = { placeholders: { '': [''] }, camelCaseAttributes: [''], sortFacetValuesBy: 'count', + queryLanguages: ['fr', 'es'], }; let _algoliaQueryParameters: QueryParameters = { @@ -147,6 +148,7 @@ let _algoliaQueryParameters: QueryParameters = { tagFilters: [''], facetFilters: [''], analytics: false, + clickAnalytics: true, analyticsTags: [''], synonyms: true, replaceSynonymsInHighlight: false, diff --git a/types/algoliasearch/index.d.ts b/types/algoliasearch/index.d.ts index 8e3ba4c5ab..86cedc9b93 100644 --- a/types/algoliasearch/index.d.ts +++ b/types/algoliasearch/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for algoliasearch-client-js 3.30.0 +// Type definitions for algoliasearch-client-js 3.30.1 // Project: https://github.com/algolia/algoliasearch-client-js // Definitions by: Baptiste Coquelle // Haroen Viaene @@ -6,6 +6,7 @@ // Samuel Vaillant // Kai Eichinger // Nery Ortez +// Antoine Rousseau // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -1425,6 +1426,12 @@ declare namespace algoliasearch { * https://www.algolia.com/doc/api-reference/api-parameters/analytics/ */ analytics?: boolean; + /** + * If set to true, enables the Click Analytics feature + * default false + * https://www.algolia.com/doc/api-reference/api-parameters/clickAnalytics/ + */ + clickAnalytics?: boolean; /** * If set, tag your query with the specified identifiers * default: [] @@ -1778,12 +1785,20 @@ declare namespace algoliasearch { }; /** * List of attributes on which to do a decomposition of camel case words. - * - https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ + * https://www.algolia.com/doc/api-reference/api-parameters/camelCaseAttributes/ */ camelCaseAttributes?: string[]; - + /** + * Controls how facet values are sorted. + * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ + */ sortFacetValuesBy?: 'count' | 'alpha'; + /** + * Sets the languages to be used by language-specific settings and functionalities + * such as ignorePlurals, removeStopWords, and CJK word-detection. + * https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/ + */ + queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>; } interface Response { diff --git a/types/algoliasearch/lite/index.d.ts b/types/algoliasearch/lite/index.d.ts index 11e22f5ccf..2fd13ec2d0 100644 --- a/types/algoliasearch/lite/index.d.ts +++ b/types/algoliasearch/lite/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for algoliasearch-client-js 3.30.0 +// Type definitions for algoliasearch-client-js 3.30.1 // Project: https://github.com/algolia/algoliasearch-client-js // Definitions by: Baptiste Coquelle // Haroen Viaene @@ -7,6 +7,7 @@ // Claas Brüggemann // Kai Eichinger // Nery Ortez +// Antoine Rousseau // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -505,6 +506,12 @@ declare namespace algoliasearch { * https://www.algolia.com/doc/api-reference/api-parameters/analytics/ */ analytics?: boolean; + /** + * If set to true, enables the Click Analytics feature + * default false + * https://www.algolia.com/doc/api-reference/api-parameters/clickAnalytics/ + */ + clickAnalytics?: boolean; /** * If set, tag your query with the specified identifiers * default: [] @@ -534,9 +541,16 @@ declare namespace algoliasearch { userData?: string | object; /** + * Controls how facet values are sorted. * https://www.algolia.com/doc/api-reference/api-parameters/sortFacetValuesBy/ */ sortFacetValuesBy?: 'count' | 'alpha'; + /** + * Sets the languages to be used by language-specific settings and functionalities + * such as ignorePlurals, removeStopWords, and CJK word-detection. + * https://www.algolia.com/doc/api-reference/api-parameters/queryLanguages/ + */ + queryLanguages?: Array<'af' | 'ar' | 'az' | 'bg' | 'bn' | 'ca' | 'cs' | 'cy' | 'da' | 'de' | 'el' | 'en' | 'eo' | 'es' | 'et' | 'eu' | 'fa' | 'fi' | 'fo' | 'fr' | 'ga' | 'gl' | 'he' | 'hi' | 'hu' | 'hy' | 'id' | 'is' | 'it' | 'ja' | 'ka' | 'kk' | 'ko' | 'ku' | 'ky' | 'lt' | 'lv' | 'mi' | 'mn' | 'mr' | 'ms' | 'mt' | 'nb' | 'nl' | 'no' | 'ns' | 'pl' | 'ps' | 'pt' | 'pt-br' | 'qu' | 'ro' | 'ru' | 'sk' | 'sq' | 'sv' | 'sw' | 'ta' | 'te' | 'th' | 'tl' | 'tn' | 'tr' | 'tt' | 'uk' | 'ur' | 'uz' | 'zh'>; } namespace SearchForFacetValues { diff --git a/types/algoliasearch/tslint.json b/types/algoliasearch/tslint.json index 886f1a8b6c..4ef1833aa4 100644 --- a/types/algoliasearch/tslint.json +++ b/types/algoliasearch/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/alt/tslint.json b/types/alt/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/alt/tslint.json +++ b/types/alt/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/amap-js-api-indoor-map/amap-js-api-indoor-map-tests.ts b/types/amap-js-api-indoor-map/amap-js-api-indoor-map-tests.ts new file mode 100644 index 0000000000..f6efc2dc54 --- /dev/null +++ b/types/amap-js-api-indoor-map/amap-js-api-indoor-map-tests.ts @@ -0,0 +1,114 @@ +// $ExpectType IndoorMap +new AMap.IndoorMap(); +// $ExpectType IndoorMap +new AMap.IndoorMap({}); +// $ExpectType IndoorMap +const indoorMap = new AMap.IndoorMap({ + zIndex: 1, + opacity: 0.5, + cursor: 'cursor', + hideFloorBar: false, + alaysShow: true +}); + +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId'); +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId', (error, result) => { + // $ExpectType Error | null + error; + // $ExpectType SearchResult + result; + // $ExpectType string + result.id; + // $ExpectType 0 | 1 + result.status; + if (result.status === 0) { + // $ExpectType Building + const building = result.building; + { + // $ExpectType number + building.floor; + // $ExpectType FloorDetails + const floorDetails = building.floor_details; + { + // $ExpectType number[] + floorDetails.floor_indexs; + // $ExpectType string[] + floorDetails.floor_names; + // $ExpectType string[] + floorDetails.floor_nonas; + } + // $ExpectType string + building.id; + // $ExpectType LngLat + building.lnglat; + // $ExpectType string + building.name; + } + } else { + // $ExpectType Error + result.error; + } +}); +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId', 1); +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId', 1, () => { }); +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId', 1, 'shopId'); +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId', 1, 'shopId', () => { }); +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId', 1, 'shopId', true); +// $ExpectType void +indoorMap.showIndoorMap('indoorMapId', 1, 'shopId', true, () => { }); + +let floor: undefined | false; +floor = indoorMap.showFloor(1); +floor = indoorMap.showFloor(1, true); + +// $ExpectType void +indoorMap.showFloorBar(); + +// $ExpectType void +indoorMap.hideFloorBar(); + +// $ExpectType void +indoorMap.hideLabels(); + +// $ExpectType string | null +indoorMap.getSelectedBuildingId(); + +// $ExpectType Building | null +const building = indoorMap.getSelectedBuilding(); +if (building) { + // $ExpectType number + building.floor; + // $ExpectType FloorDetails + building.floor_details; + // $ExpectType string + building.id; + // $ExpectType LngLat + building.lnglat; + // $ExpectType string + building.name; +} + +indoorMap.on('complete', (event: AMap.IndoorMap.EventMap['complete']) => { + // $ExpectType "complete" + event.type; +}); + +indoorMap.on('click', (event: AMap.IndoorMap.EventMap['click']) => { + // $ExpectType string + event.building_id; + // $ExpectType number + event.floor; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Shop + event.shop; + // $ExpectType "click" + event.type; +}); diff --git a/types/amap-js-api-indoor-map/index.d.ts b/types/amap-js-api-indoor-map/index.d.ts new file mode 100644 index 0000000000..9b30ea1722 --- /dev/null +++ b/types/amap-js-api-indoor-map/index.d.ts @@ -0,0 +1,239 @@ +// Type definitions for non-npm package amap-js-api-indoor-map 1.4 +// Project: https://lbs.amap.com/api/javascript-api/reference/indoormap +// Definitions by: breeze9527 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +declare namespace AMap { + namespace IndoorMap { + interface EventMap { + complete: Event<'complete'>; + click: MouseEvent<'click'>; + + floor_complete: Event<'floor_complete', SearchResult>; + mouseover: MouseEvent<'mouseover'>; + mouseout: MouseEvent<'mouseout'>; + } + type MouseEvent = Event; + interface Options extends Layer.Options { + /** + * 图层叠加的顺序值 + */ + zIndex?: number; + /** + * 图层的透明度 + */ + opacity?: number; + /** + * 鼠标悬停到店铺面时的鼠标样式 + */ + cursor?: string; + /** + * 是否隐藏楼层切换控件 + */ + hideFloorBar?: boolean; + /** + * 是否持续显示 + */ + alaysShow?: boolean; + + // internal + visible?: boolean; + featurezIndex?: number; + zooms?: [number, number]; + disableIconRender?: boolean; + disableLabelRender?: boolean; + disableHoverMarker?: boolean; + autoLoadBuildingsInTile?: boolean; + } + interface FloorDetails { + /** + * 各楼层索引 + */ + floor_indexs: number[]; + /** + * 各楼层英文 + */ + floor_nonas: string[]; + /** + * 各楼层名字 + */ + floor_names: string[]; + } + type ShopCategory = 'public' | 'connection' | 'shop'; + interface Shop { + /** + * 店铺的id + */ + id: string; + /** + * 兴趣点ID + */ + poiId: string; + /** + * 店铺所属楼宇ID + */ + building_id: string; + /** + * 店铺名称 + */ + name: string; + /** + * 店铺的经纬度 + */ + lnglat: LngLat; + /** + * 分类 + */ + category: ShopCategory; + } + interface Building { + /** + * 所属楼宇ID + */ + id: string; + /** + * 楼层名称 + */ + name: string; + /** + * 楼层的经纬度 + */ + lnglat: LngLat; + /** + * 所在楼层 + */ + floor: number; + floor_details: FloorDetails; + } + interface SearchSuccessResult { + /** + * 楼层的id + */ + id: string; + status: 0; + /** + * 建筑信息 + */ + building: Building; + } + interface SearchErrorResult { + /** + * 楼宇id + */ + id: string; + status: 1; + error: Error; + } + type SearchResult = SearchSuccessResult | SearchErrorResult; + } + + class IndoorMap extends Layer { + /** + * 室内地图 + * @param options 选项 + */ + constructor(options?: IndoorMap.Options); + /** + * 显示指定室内地图信息 + * @param indoorId 建筑物ID + * @param callback 回调 + */ + showIndoorMap( + indoorId: string, + callback?: (error: null | Error, result: IndoorMap.SearchResult) => void + ): void; + /** + * 显示指定室内地图信息 + * @param indoorId 建筑物ID + * @param floor 楼层 + * @param callback 回调 + */ + showIndoorMap( + indoorId: string, + floor?: number, + callback?: (error: null | Error, result: IndoorMap.SearchResult) => void + ): void; + /** + * 显示指定室内地图信息 + * @param indoorId 建筑物ID + * @param floor 楼层 + * @param shopId 商铺ID + * @param callback 回调 + */ + showIndoorMap( + indoorId: string, + floor?: number, + shopId?: string, + callback?: (error: null | Error, result: IndoorMap.SearchResult) => void + ): void; + /** + * 显示指定室内地图信息 + * @param indoorId 建筑物ID + * @param floor 楼层 + * @param shopId 商铺ID + * @param noMove 阻止移动 + * @param callback 回调 + */ + showIndoorMap( + indoorId: string, + floor?: number, + shopId?: string, + noMove?: boolean, + callback?: (error: null | Error, result: IndoorMap.SearchResult) => void + ): void; + /** + * 显示指定的楼层 + * @param floor 楼层 + * @param noMove 禁止移动 + */ + showFloor(floor: number, noMove?: boolean): false | undefined; + /** + * 显示楼层切换控件 + */ + showFloorBar(): void; + /** + * 隐藏楼层切换控件 + */ + hideFloorBar(): void; + /** + * 显示室内地图标注 + */ + showLabels(): void; + /** + * 隐藏室内地图标注 + */ + hideLabels(): void; + /** + * 获取处于被选中状态的室内地图的ID + */ + getSelectedBuildingId(): string | null; + /** + * 获取处于被选中状态的室内地图的一些基本信息 + */ + getSelectedBuilding(): IndoorMap.Building | null; + + // internal + getFloorBar(): void; + setSelectedBuildingId(id: string): void; + } +} diff --git a/types/amap-js-api-indoor-map/tsconfig.json b/types/amap-js-api-indoor-map/tsconfig.json new file mode 100644 index 0000000000..da736c3c7b --- /dev/null +++ b/types/amap-js-api-indoor-map/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "amap-js-api-indoor-map-tests.ts" + ] +} diff --git a/types/filenamify/tslint.json b/types/amap-js-api-indoor-map/tslint.json similarity index 100% rename from types/filenamify/tslint.json rename to types/amap-js-api-indoor-map/tslint.json diff --git a/types/amap-js-api-map3d/amap-js-api-map3d-tests.ts b/types/amap-js-api-map3d/amap-js-api-map3d-tests.ts new file mode 100644 index 0000000000..ec89b74476 --- /dev/null +++ b/types/amap-js-api-map3d/amap-js-api-map3d-tests.ts @@ -0,0 +1,489 @@ +/** + * preset.ts + */ + +declare const map: AMap.Map; +declare const lnglat: AMap.LngLat; +declare const size: AMap.Size; +declare const lnglatTuple: [number, number]; +declare const pixel: AMap.Pixel; +declare const layer: AMap.Layer; +declare const ambientLight: AMap.Lights.AmbientLight; +declare const directionLight: AMap.Lights.DirectionLight; +declare const line: AMap.Object3D.Line; +declare const mesh: AMap.Object3D.Mesh; +declare const object3d: AMap.Object3D; +declare const geometry: AMap.Geometry3D.Mesh; + +/** + * lights.ts + */ + +// $ExpectType AmbientLight +const testAmbientLight = new AMap.Lights.AmbientLight([0.1, 0, 0.1], 1); + +// $ExpectType void +testAmbientLight.setColor([0.1, 1, 0.5]); + +// $ExpectType void +testAmbientLight.setIntensity(1); + +// $ExpectType DirectionLight +const testDirectionLight = new AMap.Lights.DirectionLight([1, 2, 3], [1, 2, 3], 1); + +// $ExpectType void +testDirectionLight.setColor([1, 2, 3]); + +// $ExpectType void +testDirectionLight.setIntensity(1); + +// $ExpectType void +testDirectionLight.setDirection([1, 2, 3]); + +/** + * map3d.ts + */ + +// $ExpectType Object3DResult | null +map.getObject3DByContainerPos(pixel); + +// $ExpectType Object3DResult | null +const containserPos = map.getObject3DByContainerPos(pixel, [layer], true); +if (containserPos) { + // $ExpectType number + containserPos.index; + // $ExpectType Vector3 + containserPos.point; + // $ExpectType number + containserPos.distance; + // $ExpectType Object3D + containserPos.object; +} else { + // $ExpectType null + containserPos; +} + +map.AmbientLight = ambientLight; +map.AmbientLight = undefined; + +map.DirectionLight = directionLight; +map.DirectionLight = undefined; + +/** + * object3d-group.ts + */ + +// $ExpectType Object3DGroup +const testObject3dGroup1 = new AMap.Object3DGroup(); +// $ExpectType Object3DGroup +const testObject3dGroup2 = new AMap.Object3DGroup(); + +// $ExpectType Object3D[] +testObject3dGroup1.children; +// $ExpectType Mesh[] +testObject3dGroup2.children; + +// $ExoectType void +testObject3dGroup1.add(line); +// $ExoectType void +testObject3dGroup1.add(mesh); +// $ExoectType void +testObject3dGroup2.add(mesh); +// $ExpectError +testObject3dGroup2.add(line); + +// $ExoectType void +testObject3dGroup1.remove(line); +// $ExoectType void +testObject3dGroup1.remove(mesh); +// $ExoectType void +testObject3dGroup2.remove(mesh); +// $ExpectError +testObject3dGroup2.remove(line); + +/** + * object3d-Layer.ts + */ + +// $ExpectType Object3DLayer +new AMap.Object3DLayer(); +// $ExpectType Object3DLayer +new AMap.Object3DLayer({}); +// $ExpectType Object3DLayer +const testObject3DLayer = new AMap.Object3DLayer({ + map, + visible: true, + opacity: 0.1, + zIndex: 2, + zooms: [1, 2] +}); + +// $ExpectType void +testObject3DLayer.setMap(null); +// $ExpectType void +testObject3DLayer.setMap(map); + +// $ExpectType Map | null | undefined +testObject3DLayer.getMap(); + +// $ExpectType void +testObject3DLayer.hide(); + +// $ExpectType void +testObject3DLayer.show(); + +// $ExpectType void +testObject3DLayer.setOpacity(1); + +// $ExpectType number +testObject3DLayer.getOpacity(); + +// $ExpectType void +testObject3DLayer.setzIndex(1); + +// $ExpectType number +testObject3DLayer.getzIndex(); + +// $ExpectType [number, number] +testObject3DLayer.getZooms(); + +// $ExpectType void +testObject3DLayer.add(object3d); + +// $ExpectType void +testObject3DLayer.remove(object3d); + +// $ExpectType void +testObject3DLayer.clear(); + +// $ExpectType void +testObject3DLayer.reDraw(); + +/** + * vector3.ts + */ + +// $ExpectType Vector3 +const testVector = new AMap.Vector3([1, 2, 3]); +// $ExpectType Vector3 +new AMap.Vector3(testVector); + +// $ExpectType [number, number, number] +testVector.elements; + +// $ExpectType void +testVector.set(1, 2, 3); + +// $ExpectType number +testVector.dot(); + +// $ExpectType Vector3 +testVector.clone(); + +// $ExpectType Vector3 +testVector.add(testVector); +// $ExpectType Vector3 +testVector.add([1, 2, 3]); + +// $ExpectType Vector3 +testVector.sub(testVector); +// $ExpectType Vector3 +testVector.sub([1, 2, 3]); + +// $ExpectType Vector3 +testVector.addVectors(testVector, testVector); + +// $ExpectType Vector3 +testVector.subVectors(testVector, testVector); + +// $ExpectType Vector3 +testVector.crossVectors(testVector, testVector); + +// $ExpectType Vector3 +testVector.normalize(); + +// $ExpectType number +testVector.length(); + +/** + * object3d/mesh.ts + */ + +// $ExpectType Mesh +const testMesh = new AMap.Object3D.Mesh(); + +// $ExpectError +testMesh.geometry = geometry; + +// $ExpectType number[] +testMesh.geometry.vertices; +// $ExpectError +testMesh.geometry.vertices = []; +testMesh.geometry.vertices.shift(); + +// $ExpectType number[] +testMesh.geometry.vertexColors; +// $ExpectError +testMesh.geometry.vertexColors = []; +testMesh.geometry.vertexColors.shift(); + +// $ExpectType number[] +testMesh.geometry.vertexUVs; +// $ExpectError +testMesh.geometry.vertexUVs = []; +testMesh.geometry.vertexUVs.shift(); + +// $ExpectType number[] +testMesh.geometry.faces; +// $ExpectError +testMesh.geometry.faces = []; +testMesh.geometry.faces.shift(); + +// $ExpectType number[] +testMesh.geometry.textureIndices; +// $ExpectError +testMesh.geometry.textureIndices = []; +testMesh.geometry.textureIndices.shift(); + +// $ExpectType (string | HTMLCanvasElement)[] +testMesh.textures; + +// $ExpectType boolean +testMesh.needUpdate; + +// $ExpectType boolean +testMesh.transparent; + +// $ExpectType boolean +testMesh.DEPTH_TEST; + +// $ExpectType void +testMesh.reDraw(); + +/** + * object3d/meshAcceptLights.ts + */ + +// $ExpectType MeshAcceptLights +const testMeshAcceptLights = new AMap.Object3D.MeshAcceptLights(); + +// $ExpectError +testMeshAcceptLights.geometry = geometry; + +// $ExpectType number[] +testMeshAcceptLights.geometry.vertices; +// $ExpectError +testMeshAcceptLights.geometry.vertices = []; +testMeshAcceptLights.geometry.vertices.shift(); + +// $ExpectType number[] +testMeshAcceptLights.geometry.vertexColors; +// $ExpectError +testMeshAcceptLights.geometry.vertexColors = []; +testMeshAcceptLights.geometry.vertexColors.shift(); + +// $ExpectType number[] +testMeshAcceptLights.geometry.vertexUVs; +// $ExpectError +testMeshAcceptLights.geometry.vertexUVs = []; +testMeshAcceptLights.geometry.vertexUVs.shift(); + +// $ExpectType number[] +testMeshAcceptLights.geometry.faces; +// $ExpectError +testMeshAcceptLights.geometry.faces = []; +testMeshAcceptLights.geometry.faces.shift(); + +// $ExpectType number[] +testMeshAcceptLights.geometry.textureIndices; +// $ExpectError +testMeshAcceptLights.geometry.textureIndices = []; +testMeshAcceptLights.geometry.textureIndices.shift(); + +// $ExpectType number[] +testMeshAcceptLights.geometry.vertexNormals; +// $ExpectError +testMeshAcceptLights.geometry.vertexNormals = []; +testMeshAcceptLights.geometry.vertexNormals.shift(); + +// $ExpectType (string | HTMLCanvasElement)[] +testMeshAcceptLights.textures; + +// $ExpectType boolean +testMeshAcceptLights.needUpdate; + +// $ExpectType boolean +testMeshAcceptLights.transparent; + +// $ExpectType boolean +testMeshAcceptLights.DEPTH_TEST; + +// $ExpectType void +testMeshAcceptLights.reDraw(); + +/** + * object3d/meshLine.ts + */ + +// $ExpectError +new AMap.Object3D.MeshLine(); +// $ExpectError +new AMap.Object3D.MeshLine({}); +// $ExpectType MeshLine +const testMeshLine = new AMap.Object3D.MeshLine({ + path: [lnglat], + width: 1, + height: 1, + color: 'red' +}); +// $ExpectType MeshLine +new AMap.Object3D.MeshLine({ + path: [lnglat], + color: [0, 0, 1, 1] +}); +// $ExpectType MeshLine +new AMap.Object3D.MeshLine({ + path: [[1, 2]] +}); +// $ExpectType MeshLine +new AMap.Object3D.MeshLine({ + path: [lnglat], + unit: 'meter' +}); +// $ExpectType MeshLine +new AMap.Object3D.MeshLine({ + path: [pixel], + unit: 'px' +}); +// $ExpectError +new AMap.Object3D.MeshLine({ + path: [lnglat], + unit: 'px' +}); +// $ExpectError +new AMap.Object3D.MeshLine({ + path: [pixel], + unit: 'meter' +}); + +// $ExpectType number[] +testMeshLine.geometry.vertices; +// $ExpectError +testMeshLine.geometry.vertices = []; +testMeshLine.geometry.vertices.shift(); + +// $ExpectType number[] +testMeshLine.geometry.vertexUVs; +// $ExpectError +testMeshLine.geometry.vertexUVs = []; +testMeshLine.geometry.vertexUVs.shift(); + +// $ExpectType number[] +testMeshLine.geometry.vertexColors; +// $ExpectError +testMeshLine.geometry.vertexColors = []; +testMeshLine.geometry.vertexColors.shift(); + +// $ExpectType number[] +testMeshLine.geometry.vertexColors; +// $ExpectError +testMeshLine.geometry.vertexColors = []; +testMeshLine.geometry.vertexColors.shift(); + +// $ExpectType number[] +testMeshLine.geometry.vertexIndices; +// $ExpectError +testMeshLine.geometry.vertexIndices = []; +testMeshLine.geometry.vertexIndices.shift(); + +// $ExpectType number[] +testMeshLine.geometry.directions; +// $ExpectError +testMeshLine.geometry.directions = []; +testMeshLine.geometry.directions.shift(); + +// $ExpectType number[] +testMeshLine.geometry.textureIndices; +// $ExpectError +testMeshLine.geometry.textureIndices = []; +testMeshLine.geometry.textureIndices.shift(); + +// $ExpectType number +testMeshLine.width; + +// $ExpectType void +testMeshLine.setPath([lnglat]); +// $ExpectType void +testMeshLine.setPath([lnglatTuple]); +// $ExpectType void +testMeshLine.setPath([pixel]); + +// $ExpectType void +testMeshLine.setWidth(10); + +// $ExpectType void +testMeshLine.setHeight(10); + +// $ExpectType void +testMeshLine.setColor('red'); + +/** + * object3d/prism.ts + */ + +// $ExpectError +new AMap.Object3D.Prism(); +// $ExpectError +new AMap.Object3D.Prism({}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [lnglat], + color: 'red' +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [lnglat], + color: 'red', + height: 1, + color2: 'blue' +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [pixel], + color: 'red' +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [lnglat], + color: 'red' +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [[lnglat]], + color: 'red' +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [[pixel]], + color: 'red' +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [[lnglatTuple]], + color: 'red' +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [lnglat], + color: ['red'] +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [lnglat], + color: [1, 1, 1, 1] +}); +// $ExpectType Prism +new AMap.Object3D.Prism({ + path: [lnglat], + color: [[1, 1, 1, 1]] +}); diff --git a/types/amap-js-api-map3d/geometry-3d.d.ts b/types/amap-js-api-map3d/geometry-3d.d.ts new file mode 100644 index 0000000000..edb4fd2a85 --- /dev/null +++ b/types/amap-js-api-map3d/geometry-3d.d.ts @@ -0,0 +1,28 @@ +declare namespace AMap { + abstract class Geometry3D { + readonly vertices: number[]; + readonly vertexUVs: number[]; + readonly vertexColors: number[]; + } + + namespace Geometry3D { + class Mesh extends Geometry3D { + readonly type: 'mesh'; + readonly faces: number[]; + readonly textureIndices: number[]; + } + + class Line extends Geometry3D { + readonly type: 'line'; + readonly segments: number[]; + readonly textureIndices: number[]; + } + + class Points extends Geometry3D { + readonly type: 'points'; + readonly pointSizes: number[]; + readonly pointAreas: number[]; + readonly textureIndices: number[]; + } + } +} diff --git a/types/amap-js-api-map3d/index.d.ts b/types/amap-js-api-map3d/index.d.ts new file mode 100644 index 0000000000..43be45eb13 --- /dev/null +++ b/types/amap-js-api-map3d/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for non-npm package amap-js-api-map3d 1.4 +// Project: https://lbs.amap.com/api/javascript-api/reference/maps-3d +// Definitions by: breeze9527 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +/// +/// +/// +/// +/// +/// +/// diff --git a/types/amap-js-api-map3d/lights.d.ts b/types/amap-js-api-map3d/lights.d.ts new file mode 100644 index 0000000000..b637ee79ef --- /dev/null +++ b/types/amap-js-api-map3d/lights.d.ts @@ -0,0 +1,17 @@ +declare namespace AMap { + namespace Lights { + class AmbientLight { + constructor(color: [number, number, number], intensity: number); + setColor(color: [number, number, number]): void; + setIntensity(intensity: number): void; + } + + class DirectionLight { + constructor(direction: [number, number, number], color: [number, number, number], intensity: number); + update(): void; + setDirection(direction: [number, number, number]): void; + setColor(direction: [number, number, number]): void; + setIntensity(intensity: number): void; + } + } +} diff --git a/types/amap-js-api-map3d/map3d.d.ts b/types/amap-js-api-map3d/map3d.d.ts new file mode 100644 index 0000000000..f2345f1a30 --- /dev/null +++ b/types/amap-js-api-map3d/map3d.d.ts @@ -0,0 +1,15 @@ +declare namespace AMap { + namespace Map { + interface Object3DResult { + index: number; + point: Vector3; + distance: number; + object: Object3D; + } + } + interface Map { + AmbientLight?: Lights.AmbientLight; + DirectionLight?: Lights.DirectionLight; + getObject3DByContainerPos(pixel: Pixel, layers?: Layer[], all?: boolean): Map.Object3DResult | null; + } +} diff --git a/types/amap-js-api-map3d/object3d-group.d.ts b/types/amap-js-api-map3d/object3d-group.d.ts new file mode 100644 index 0000000000..4c1f4d90d3 --- /dev/null +++ b/types/amap-js-api-map3d/object3d-group.d.ts @@ -0,0 +1,8 @@ +declare namespace AMap { + class Object3DGroup extends Object3D { + constructor(); + children: C[]; + add(object3d: C): void; + remove(object3d: C): void; + } +} diff --git a/types/amap-js-api-map3d/object3d-layer.d.ts b/types/amap-js-api-map3d/object3d-layer.d.ts new file mode 100644 index 0000000000..de29a0bfd9 --- /dev/null +++ b/types/amap-js-api-map3d/object3d-layer.d.ts @@ -0,0 +1,27 @@ +declare namespace AMap { + namespace Object3DLayer { + interface Options { + map?: Map; + visible?: boolean; + opacity?: number; + zIndex?: number; + zooms?: [number, number]; + } + } + + class Object3DLayer extends Layer { + constructor(options?: Object3DLayer.Options) + add(object3d: Object3D): void; + remove(object3d: Object3D): void; + clear(): void; + reDraw(): void; + + // internal + setOption(options: { + position?: number; + scale?: number; + height?: number; + scene?: number; + }): void; + } +} diff --git a/types/amap-js-api-map3d/object3d.d.ts b/types/amap-js-api-map3d/object3d.d.ts new file mode 100644 index 0000000000..32f63e2378 --- /dev/null +++ b/types/amap-js-api-map3d/object3d.d.ts @@ -0,0 +1,92 @@ +declare namespace AMap { + class Object3D { + readonly geometry: Geometry3D; + transparent: boolean; + DEPTH_TEST: boolean; + textures: Array; + needUpdate: boolean; + reDraw(): void; + + // internal + reset(): void; + } + + namespace Object3D { + class Mesh extends Object3D { + readonly geometry: Geometry3D.Mesh; + } + + class MeshAcceptLights extends Mesh { + readonly geometry: Geometry3D.Mesh & { readonly vertexNormals: number[] }; + } + + namespace Prism { + interface Options { + path: LngLat[] | Pixel[] | Array>; + color: string | number[] | Array; + height?: number; + color2?: string | number[] | Array; + } + } + class Prism extends MeshAcceptLights { + constructor(options: Prism.Options); + } + + // tslint:disable-next-line + class Wall extends Prism { } + + class Line extends Object3D { + readonly geometry: Geometry3D.Line; + } + + namespace ThinLine { + interface Options { + path: Array<[number, number]>; + color: string; + altitude?: number; + dashArray?: number[]; + } + } + class ThinLine extends Line { + constructor(options: ThinLine.Options); + } + + class Points extends Object3D { + readonly geometry: Geometry3D.Points; + borderColor: string; + borderWeight: number; + } + + class RoundPoints extends Points { + merge: boolean; + } + + namespace MeshLine { + type Options = { + width?: number; + height?: number | number[]; + color?: string | number[]; + } & ({ + unit?: 'meter'; + path: Array<[number, number]> | LngLat[]; + } | { + unit: 'px'; + path: Array<[number, number]> | Pixel[]; + }); + } + // inherit from WideLine + class MeshLine extends Object3D { + constructor(options: MeshLine.Options); + readonly geometry: Geometry3D & { + readonly vertexIndices: number[]; + readonly directions: number[]; + readonly textureIndices: number[]; + }; + width: number; + setPath(path: LngLat[] | Pixel[] | Array<[number, number]>): void; + setWidth(width: number): void; + setHeight(height: number | number[]): void; + setColor(color: string): void; + } + } +} diff --git a/types/amap-js-api-map3d/tsconfig.json b/types/amap-js-api-map3d/tsconfig.json new file mode 100644 index 0000000000..e28735d963 --- /dev/null +++ b/types/amap-js-api-map3d/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "forceConsistentCasingInFileNames": true + }, + "files": [ + "geometry-3d.d.ts", + "index.d.ts", + "lights.d.ts", + "map3d.d.ts", + "object3d-group.d.ts", + "object3d-layer.d.ts", + "object3d.d.ts", + "vector3.d.ts", + "amap-js-api-map3d-tests.ts" + ] +} diff --git a/types/make-dir/tslint.json b/types/amap-js-api-map3d/tslint.json similarity index 100% rename from types/make-dir/tslint.json rename to types/amap-js-api-map3d/tslint.json diff --git a/types/amap-js-api-map3d/vector3.d.ts b/types/amap-js-api-map3d/vector3.d.ts new file mode 100644 index 0000000000..1cb02fe9b0 --- /dev/null +++ b/types/amap-js-api-map3d/vector3.d.ts @@ -0,0 +1,16 @@ +declare namespace AMap { + class Vector3 { + readonly elements: [number, number, number]; + constructor(elements: [number, number, number] | Vector3); + set(x: number, y: number, z: number): void; + dot(): number; + clone(): Vector3; + add(elements: [number, number, number] | Vector3): this; + sub(elements: [number, number, number] | Vector3): this; + addVectors(a: Vector3, b: Vector3): this; + subVectors(a: Vector3, b: Vector3): this; + crossVectors(a: Vector3, b: Vector3): this; + normalize(): this; + length(): number; + } +} diff --git a/types/amap-js-api/amap-js-api-tests.ts b/types/amap-js-api/amap-js-api-tests.ts new file mode 100644 index 0000000000..ee7a2ac583 --- /dev/null +++ b/types/amap-js-api/amap-js-api-tests.ts @@ -0,0 +1,3376 @@ +/** + * preset.ts + */ + +declare const map: AMap.Map; +declare const lnglat: AMap.LngLat; +declare const size: AMap.Size; +declare const lnglatTuple: [number, number]; +declare const pixel: AMap.Pixel; +declare const markerShape: AMap.MarkerShape; +declare const icon: AMap.Icon; +declare const bounds: AMap.Bounds; +declare const div: HTMLDivElement; +declare const lang: AMap.Lang; +declare const domEle: HTMLElement; +declare const canvasEle: HTMLCanvasElement; +declare const imgEle: HTMLImageElement; + +declare const circle: AMap.Circle; +declare const marker: AMap.Marker; +declare const layer: AMap.Layer; +declare const tileLayer: AMap.TileLayer; +declare const massMarksLayer: AMap.MassMarks; + +// declare const videoLayer: AMap.VideoLayer; +// declare const buildings: AMap.Buildings; +// declare const canvasLayer: AMap.CanvasLayer; +// declare const flexible: AMap.TileLayer.Flexible; +// declare const imageLayer: AMap.ImageLayer; +// declare const tileLayerGroup: AMap.LayerGroup; +// declare const layerGroup: AMap.LayerGroup; +// declare const trafficLayer: AMap.TileLayer.Traffic; +// declare const bezierCurve: AMap.BezierCurve; +// declare const contextMenu: AMap.ContextMenu; +// declare const polyline: AMap.Polyline; +// declare const polygon: AMap.Polygon; + +/** + * arryBounds.ts + */ + +// $ExpectType ArrayBounds +const testArrayBounds = new AMap.ArrayBounds([lnglat, lnglat, lnglat]); + +// $ExpectType LngLat[] +testArrayBounds.bounds; + +// $ExpectType boolean +testArrayBounds.contains(lnglat); + +// $ExpectType Bounds +testArrayBounds.toBounds(); + +// $ExpectType LngLat +testArrayBounds.getCenter(); + +/** + * bounds.ts + */ + +// $ExpectType Bounds +const testBounds = new AMap.Bounds(lnglat, lnglat); + +// $ExpectType boolean +testBounds.contains(lnglat); +// $ExpectType boolean +testBounds.contains(lnglatTuple); + +// $ExpectType LngLat +testBounds.getCenter(); + +// $ExpectType LngLat +testBounds.getSouthWest(); + +// $ExpectType LngLat +testBounds.getSouthEast(); + +// $ExpectType LngLat +testBounds.getNorthEast(); + +// $ExpectType LngLat +testBounds.getNorthWest(); + +// $ExpectType string +testBounds.toString(); + +/** + * browser.ts + */ + +const brwoser = AMap.Browser; + +// $ExpectType string +brwoser.ua; + +// $ExpectType boolean +brwoser.mobile; + +const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other' = brwoser.plat; + +// $ExpectType boolean +brwoser.mac; + +// $ExpectType boolean +brwoser.windows; + +// $ExpectType boolean +brwoser.ios; + +// $ExpectType boolean +brwoser.iPad; + +// $ExpectType boolean +brwoser.iPhone; + +// $ExpectType boolean +brwoser.android; + +// $ExpectType boolean +brwoser.android23; + +// $ExpectType boolean +brwoser.chrome; + +// $ExpectType boolean +brwoser.firefox; + +// $ExpectType boolean +brwoser.safari; + +// $ExpectType boolean +brwoser.wechat; + +// $ExpectType boolean +brwoser.uc; + +// $ExpectType boolean +brwoser.qq; + +// $ExpectType boolean +brwoser.ie; + +// $ExpectType boolean +brwoser.ie6; + +// $ExpectType boolean +brwoser.ie7; + +// $ExpectType boolean +brwoser.ie8; + +// $ExpectType boolean +brwoser.ie9; + +// $ExpectType boolean +brwoser.ie10; + +// $ExpectType boolean +brwoser.ie11; + +// $ExpectType boolean +brwoser.edge; + +// $ExpectType boolean +brwoser.ielt9; + +// $ExpectType boolean +brwoser.baidu; + +// $ExpectType boolean +brwoser.isLocalStorage; + +// $ExpectType boolean +brwoser.isGeolocation; + +// $ExpectType boolean +brwoser.mobileWebkit; + +// $ExpectType boolean +brwoser.mobileWebkit3d; + +// $ExpectType boolean +brwoser.mobileOpera; + +// $ExpectType boolean +brwoser.retina; + +// $ExpectType boolean +brwoser.touch; + +// $ExpectType boolean +brwoser.msPointer; + +// $ExpectType boolean +brwoser.pointer; + +// $ExpectType boolean +brwoser.webkit; + +// $ExpectType boolean +brwoser.ie3d; + +// $ExpectType boolean +brwoser.webkit3d; + +// $ExpectType boolean +brwoser.gecko3d; + +// $ExpectType boolean +brwoser.opera3d; + +// $ExpectType boolean +brwoser.any3d; + +// $ExpectType boolean +brwoser.isCanvas; + +// $ExpectType boolean +brwoser.isSvg; + +// $ExpectType boolean +brwoser.isVML; + +// $ExpectType boolean +brwoser.isWorker; + +// $ExpectType boolean +brwoser.isWebsocket; + +// $ExpectType boolean +brwoser.isWebGL(); + +/** + * convert-from.ts + */ + +declare const convertType: 'baidu' | 'mapbar' | 'gps' | null; +// $ExpectType void +AMap.convertFrom(lnglat, convertType, (status, result) => { + const temp: 'complete' | 'error' = status; + if (typeof result !== 'string') { + // $ExpectType string + result.info; + // $ExpectType LngLat[] + result.locations; + } else { + // $ExpectType string + result; + } +}); +// $ExpectType void +AMap.convertFrom([lnglat], null, () => { }); +// $ExpectType void +AMap.convertFrom(lnglatTuple, null, () => { }); +// $ExpectType void +AMap.convertFrom([lnglatTuple], null, () => { }); + +/** + * dom-util.ts + */ + +const domUtil = AMap.DomUtil; + +// $ExpectType Size +domUtil.getViewport(div); + +// $ExpectType Pixel +domUtil.getViewportOffset(div); + +// $ExpectType HTMLDivElement +domUtil.create('div'); +// $ExpectType HTMLAnchorElement +domUtil.create('a'); +// $ExpectType HTMLDivElement +domUtil.create('div', div); +// $ExpectType HTMLDivElement +domUtil.create('div', div, 'className'); + +// $ExpectType void +domUtil.setClass(div); +// $ExpectType void +domUtil.setClass(div, 'className'); + +// $ExpectType boolean +domUtil.hasClass(div, 'className'); + +// $ExpectType void +domUtil.removeClass(div, 'className'); + +// $ExpectType void +domUtil.setOpacity(div, 1); + +// $ExpectType void +domUtil.rotate(div, 10); +// $ExpectType void +domUtil.rotate(div, 10, { x: 10, y: 10 }); + +const util2: typeof AMap.DomUtil = domUtil.setCss(div, { textAlign: 'left' }); +// $ExpectError +domUtil.setCss(div, { textAlign: 10 }); + +// $ExpectType void +domUtil.empty(div); + +// $ExpectType void +domUtil.remove(div); + +/** + * event.ts + */ + +// $ExpectType Map +map.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; +}); + +// $ExpectType EventListener<0> +AMap.event.addDomListener(div, 'click', event => { + // $ExpectType number + event.clientX; +}); + +// $ExpectType EventListener<1> +AMap.event.addListener(map, 'hotspotclick', function(event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); +AMap.event.addListener(map, 'click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); + +// $ExpectType EventListener<1> +const eventListener = AMap.event.addListenerOnce(map, 'hotspotclick', function(event: AMap.Map.EventMap['hotspotclick']) { + // $ExpectType "hotspotclick" + event.type; + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType void +AMap.event.removeListener(eventListener); + +// $ExpectType void +AMap.event.trigger(map, 'click', { + lnglat, + pixel, + target: map +}); +// $ExpectType void +AMap.event.trigger(map, 'hotspotclick', { + lnglat, + name: 'name', + id: 'id', + isIndoorPOI: true +}); +// $ExpectType void +AMap.event.trigger(map, 'complete'); + +/** + * geometry-util.ts + */ + +{ + const point = lnglat; + const pointTuple = lnglatTuple; + const line = [point]; + const lineTuple = [pointTuple]; + const ring = [point]; + const ringTuple = [pointTuple]; + const polygon = [ring]; + const polygonTuple = [ringTuple]; + const geometryUtil = AMap.GeometryUtil; + + // $ExpectType number + geometryUtil.distance(point, point); + // $ExpectType number + geometryUtil.distance(pointTuple, pointTuple); + // $ExpectType number + geometryUtil.distance(point, line); + // $ExpectType number + geometryUtil.distance(pointTuple, lineTuple); + + // $ExpectType number + geometryUtil.ringArea(ring); + // $ExpectType number + geometryUtil.ringArea(ringTuple); + + // $ExpectType boolean + geometryUtil.isClockwise(ring); + // $ExpectType boolean + geometryUtil.isClockwise(ringTuple); + + // $ExpectType number + geometryUtil.distanceOfLine(line); + // $ExpectType number + geometryUtil.distanceOfLine(lineTuple); + + // $ExpectType [number, number][] + geometryUtil.ringRingClip(ring, ring); + // $ExpectType [number, number][] + geometryUtil.ringRingClip(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesRingRingIntersect(ring, ring); + // $ExpectType boolean + geometryUtil.doesRingRingIntersect(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesLineRingIntersect(line, ring); + // $ExpectType boolean + geometryUtil.doesLineRingIntersect(lineTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesLineLineIntersect(line, line); + // $ExpectType boolean + geometryUtil.doesLineLineIntersect(lineTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentPolygonIntersect(point, point, polygon); + // $ExpectType boolean + geometryUtil.doesSegmentPolygonIntersect(pointTuple, pointTuple, polygonTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentRingIntersect(point, point, ring); + // $ExpectType boolean + geometryUtil.doesSegmentRingIntersect(pointTuple, pointTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentLineIntersect(point, point, line); + // $ExpectType boolean + geometryUtil.doesSegmentLineIntersect(pointTuple, pointTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.doesSegmentsIntersect(point, point, point, point); + // $ExpectType boolean + geometryUtil.doesSegmentsIntersect(pointTuple, pointTuple, pointTuple, pointTuple); + + // $ExpectType boolean + geometryUtil.isPointInRing(point, ring); + // $ExpectType boolean + geometryUtil.isPointInRing(pointTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.isRingInRing(ring, ring); + // $ExpectType boolean + geometryUtil.isRingInRing(ringTuple, ringTuple); + + // $ExpectType boolean + geometryUtil.isPointInPolygon(point, polygon); + // $ExpectType boolean + geometryUtil.isPointInPolygon(pointTuple, polygonTuple); + + // $ExpectType [number, number][] + geometryUtil.makesureClockwise(lineTuple); + + // $ExpectType [number, number][] + geometryUtil.makesureAntiClockwise(lineTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnSegment(point, point, point); + // $ExpectType [number, number] + geometryUtil.closestOnSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnSegment(point, point, point); + // $ExpectType [number, number] + geometryUtil.closestOnSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType [number, number] + geometryUtil.closestOnLine(point, line); + // $ExpectType [number, number] + geometryUtil.closestOnLine(pointTuple, lineTuple); + + // $ExpectType number + geometryUtil.distanceToSegment(point, point, point); + // $ExpectType number + geometryUtil.distanceToSegment(pointTuple, pointTuple, pointTuple); + + // $ExpectType number + geometryUtil.distanceToLine(point, line); + // $ExpectType number + geometryUtil.distanceToLine(pointTuple, lineTuple); + + // $ExpectType boolean + geometryUtil.isPointOnSegment(point, point, point); + // $ExpectType boolean + geometryUtil.isPointOnSegment(point, point, point, 1); + // $ExpectType boolean + geometryUtil.isPointOnSegment(pointTuple, pointTuple, pointTuple); + // $ExpectType boolean + geometryUtil.isPointOnSegment(pointTuple, pointTuple, pointTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnLine(point, line); + // $ExpectType boolean + geometryUtil.isPointOnLine(point, line, 1); + // $ExpectType boolean + geometryUtil.isPointOnLine(pointTuple, lineTuple); + // $ExpectType boolean + geometryUtil.isPointOnLine(pointTuple, lineTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnRing(point, ring); + // $ExpectType boolean + geometryUtil.isPointOnRing(point, ring, 1); + // $ExpectType boolean + geometryUtil.isPointOnRing(pointTuple, ringTuple); + // $ExpectType boolean + geometryUtil.isPointOnRing(pointTuple, ringTuple, 1); + + // $ExpectType boolean + geometryUtil.isPointOnPolygon(point, polygon); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(point, polygon, 1); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(pointTuple, polygonTuple); + // $ExpectType boolean + geometryUtil.isPointOnPolygon(pointTuple, polygonTuple, 1); +} + +/** + * lnglat.ts + */ + +// $ExpectType LngLat +new AMap.LngLat(114, 22); +// $ExpectType LngLat +const testLnglat = new AMap.LngLat(113, 21); + +// $ExpectType LngLat +testLnglat.offset(1, 2); + +// $ExpectType number +testLnglat.distance(testLnglat); +// $ExpectType number +testLnglat.distance([testLnglat]); + +// $ExpectType number +testLnglat.getLng(); + +// $ExpectType number +testLnglat.getLat(); + +// $ExpectType boolean +testLnglat.equals(testLnglat); + +// $ExpectType string +testLnglat.toString(); + +// $ExpectType LngLat +testLnglat.add(testLnglat); +// $ExpectType LngLat +testLnglat.add(testLnglat, true); + +// $ExpectType LngLat +testLnglat.subtract(testLnglat); +// $ExpectType LngLat +testLnglat.subtract(testLnglat, true); + +// $ExpectType LngLat +testLnglat.divideBy(1); +// $ExpectType LngLat +testLnglat.divideBy(1, true); + +// $ExpectType LngLat +testLnglat.multiplyBy(1); +// $ExpectType LngLat +testLnglat.multiplyBy(1, true); + +/** + * map.ts + */ + +// $ExpectType Map +new AMap.Map('map'); +// $ExpectType Map +new AMap.Map(div); + +// $ExpectType Map +new AMap.Map(div, {}); + +// $ExpectType Map +const testMap = new AMap.Map(div, { + layers: [tileLayer], + zoom: 15, + center: [1, 2], + labelzIndex: 110, + zooms: [5, 15], + lang: 'zh_cn', + defaultCursor: 'default', + crs: 'EPSG4326', + animateEnable: true, + isHotspot: false, + defaultLayer: tileLayer, + rotateEnable: true, + resizeEnable: true, + showIndoorMap: true, + // indoorMap, // TODO + expandZoomRange: true, + dragEnable: true, + zoomEnable: true, + doubleClickZoom: true, + keyboardEnable: true, + jogEnable: true, + scrollWheel: true, + touchZoom: true, + mapStyle: '', + features: ['road'], + showBuildingBlock: true, + skyColor: '#fff', + preloadMode: true, + mask: [[1, 2], [2, 3], [3, 4]] +}); + +// $ExpectType number +testMap.getZoom(); + +// $ExpectType Layer[] +testMap.getLayers(); + +// $ExpectType LngLat +testMap.getCenter(); + +// $ExpectType HTMLElement | null +testMap.getContainer(); + +testMap.getCity(city => { + // $ExpectType string + city.city; + // $ExpectType string + city.citycode; + // $ExpectType string + city.district; + // $ExpectType string | never[] + city.province; +}); + +// $ExpectType Bounds +testMap.getBounds(); + +// $ExpectType number +testMap.getLabelzIndex(); + +// $ExpectType Lang +testMap.getLang(); + +// $ExpectType Size +testMap.getSize(); + +// $ExpectType number +testMap.getRotation(); + +// $ExpectType Status +const mapStatus = testMap.getStatus(); +// $ExpectType boolean +mapStatus.animateEnable; +// $ExpectType boolean +mapStatus.doubleClickZoom; +// $ExpectType boolean +mapStatus.dragEnable; +// $ExpectType boolean +mapStatus.isHotspot; +// $ExpectType boolean +mapStatus.jogEnable; +// $ExpectType boolean +mapStatus.keyboardEnable; +// $ExpectType boolean +mapStatus.pitchEnable; +// $ExpectType boolean +mapStatus.resizeEnable; +// $ExpectType boolean +mapStatus.rotateEnable; +// $ExpectType boolean +mapStatus.scrollWheel; +// $ExpectType boolean +mapStatus.touchZoom; +// $ExpectType boolean +mapStatus.zoomEnable; + +// $ExpectType string +testMap.getDefaultCursor(); + +// $ExpectType number +testMap.getResolution(); + +// $ExpectType number +testMap.getScale(); +// $ExpectType number +testMap.getScale(1); + +// $ExpectType void +testMap.setZoom(1); + +// $ExpectType void +testMap.setLabelzIndex(1); + +// $ExpectType void +testMap.setLayers([tileLayer]); + +// $ExpectType void +testMap.setCenter(lnglat); +// $ExpectType void +testMap.setCenter([1, 2]); + +// $ExpectType void +testMap.setZoomAndCenter(13, lnglat); +// $ExpectType void +testMap.setZoomAndCenter(13, [1, 2]); + +// $ExpectType void +testMap.setCity('city', (coord, zoom) => { + // $ExpectType string + coord[0]; + // $ExpectType string + coord[1]; + // $ExpectType number + zoom; +}); + +// $ExpectType Bounds +testMap.setBounds(bounds); + +// $ExpectType void +testMap.setLimitBounds(bounds); + +// $ExpectType void +testMap.clearLimitBounds(); + +// $ExpectType void +testMap.setLang('zh_cn'); + +// $ExpectType void +testMap.setRotation(1); + +// $ExpectType void +testMap.setStatus({}); +// $ExpectType void +testMap.setStatus({ + animateEnable: true, + doubleClickZoom: true, + dragEnable: true, + isHotspot: true, + jogEnable: true, + keyboardEnable: true, + pitchEnable: false, + resizeEnable: false, + rotateEnable: false, + scrollWheel: true, + touchZoom: true, + zoomEnable: true +}); + +// $ExpectType void +testMap.setDefaultCursor('default'); + +// $ExpectType void +testMap.zoomIn(); + +// $ExpectType void +testMap.zoomOut(); + +// $ExpectType void +testMap.panTo([1, 2]); +// $ExpectType void +testMap.panTo(lnglat); + +// $ExpectType void +testMap.panBy(1, 2); + +// $ExpectType void +testMap.clearMap(); + +// $ExpectType Map +testMap.plugin('plugin name', () => { }); +// $ExpectType Map +testMap.plugin(['plugin name'], () => { }); + +// $ExpectType void +testMap.clearInfoWindow(); + +// $ExpectType LngLat +testMap.pixelToLngLat(pixel); +// $ExpectType LngLat +testMap.pixelToLngLat(pixel, 1); + +// $ExpectType Pixel +testMap.lnglatToPixel(lnglat); +// $ExpectType Pixel +testMap.lnglatToPixel(lnglat, 1); + +// $ExpectType LngLat +testMap.containerToLngLat(pixel); + +// $ExpectType Pixel +testMap.lngLatToContainer(lnglat); +// $ExpectType Pixel +testMap.lnglatTocontainer(lnglat); + +// $ExpectType void +testMap.setMapStyle(''); +// $ExpectType string +testMap.getMapStyle(); + +// $ExpectType void +testMap.setFeatures('all'); +// $ExpectType void +testMap.setFeatures(['bg']); + +const feature: 'all' | 'bg' | 'point' | 'road' | 'building' | AMap.Map.Feature[] = testMap.getFeatures(); + +// $ExpectType void +testMap.setDefaultLayer(tileLayer); + +// $ExpectType void +testMap.setPitch(1); +// $ExpectType number +testMap.getPitch(); + +// $ExpectType ViewMode +testMap.getViewMode_(); + +// $ExpectType Pixel +testMap.lngLatToGeodeticCoord(lnglat); +// $ExpectType Pixel +testMap.lngLatToGeodeticCoord(lnglatTuple); + +// $ExpectType LngLat +testMap.geodeticCoordToLngLat(pixel); + +// $ExpectType void +testMap.destroy(); + +declare function dblClickHandler(this: AMap.Map, event: AMap.Map.EventMap['dblclick']): void; + +// $ExpectType Map +testMap.on('click', (event: AMap.Map.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Pixel + event.pixel; + // $ExpectType LngLat + event.lnglat; + // $ExpectType Map + event.target; +}); +// $ExpectType Map +testMap.on('dblclick', dblClickHandler); +// $ExpectType Map +testMap.on('complete', (event: AMap.Map.EventMap['complete']) => { + // $ExpectType "complete" + event.type; + // $ExpectError + event.value; +}); +// $ExpectType Map +testMap.on('hotspotclick', (event: AMap.Map.EventMap['hotspotclick']) => { + // $ExpectType string + event.id; + // $ExpectType LngLat + event.lnglat; + // $ExpectType string + event.name; + // $ExpectType "hotspotclick" + event.type; +}); +// $ExpectType Map +testMap.on('custom', (event: AMap.Event<'custom', { test: string }>) => { + // $ExpectType "custom" + event.type; + // $ExpectType string + event.test; +}); + +// $ExpectType Map +testMap.off('dblclick', dblClickHandler); +// $ExpectType Map +testMap.off('click', 'mv'); + +// $ExpectType Map +testMap.emit('click', { + target: testMap, + lnglat, + pixel +}); + +testMap.emit('complete'); +// $ExpectType Map +testMap.emit('hotspotclick', { + lnglat, + name: '123', + id: '123', + isIndoorPOI: true +}); +// $ExpectType Map +testMap.emit('custom', { + test: 1 +}); +// $ExpectType Map +testMap.emit('custom', undefined); + +/** + * pixel.ts + */ + +// $ExpectType Pixel +new AMap.Pixel(10, 20); +// $ExpectType Pixel +const testPixel = new AMap.Pixel(10, 20); + +// $ExpectType number +testPixel.getX(); + +// $ExpectType number +testPixel.getY(); + +// $ExpectType boolean +testPixel.equals(testPixel); + +// $ExpectType string +testPixel.toString(); + +// $ExpectType Pixel +testPixel.add({ x: 1, y: 2 }); +// $ExpectType Pixel +testPixel.add({ x: 1, y: 2 }, false); + +// $ExpectType Pixel +testPixel.round(); + +// $ExpectType Pixel +testPixel.floor(); + +// $ExpectType number +testPixel.length(); + +// $ExpectType number | null +testPixel.direction(); + +// $ExpectType Pixel +testPixel.toFixed(); +// $ExpectType Pixel +testPixel.toFixed(2); + +/** + * size.ts + */ + +// $ExpectType Size +const testSize = new AMap.Size(10, 20); + +// $ExpectType number +testSize.getHeight(); + +// $ExpectType number +testSize.getWidth(); + +// $ExpectType string +testSize.toString(); + +// $ExpectType boolean +testSize.contains({ x: 10, y: 10 }); + +/** + * util.ts + */ + +const util = AMap.Util; + +// $ExpectType string +util.colorNameToHex('colorName'); + +// $ExpectType string +util.rgbHex2Rgba('rgbHex'); + +// $ExpectType string +util.argbHex2Rgba('argbHex'); + +// $ExpectType boolean +util.isEmpty({}); +// $ExpectError +util.isEmpty(1); + +// $ExpectType number[] +util.deleteItemFromArray([1], 1); + +// $ExpectType number[] +util.deleteItemFromArrayByIndex([1], 1); + +// $ExpectType number +util.indexOf([1], 1); +// $ExpectError +util.indexOf([1], '1'); + +// $ExpectType number +util.format(1); +// $ExpectType number +util.format(1, 1); + +declare const value1: number | number[]; +// $ExpectType boolean +util.isArray(value1); +if (util.isArray(value1)) { + // $ExpectType number[] + value1; +} else { + // $ExpectType number + value1; +} + +declare const value2: number | HTMLElement; +// $ExpectType boolean +util.isDOM(value2); +if (util.isDOM(value2)) { + // $ExpectType HTMLElement + value2; +} else { + // $ExpectType number + value2; +} + +// $ExpectType boolean +util.includes([1], 1); +// $ExpectError +util.includes([1], '1'); + +// $ExpectType number +util.requestIdleCallback(() => { }); +// $ExpectType number +const idleCallbackHandle = util.requestIdleCallback(() => { }, { timeout: 1 }); + +// $ExpectType void +util.cancelIdleCallback(idleCallbackHandle); + +// $ExpectType number +util.requestAnimFrame(() => { }); +// $ExpectType number +const animFrameHandle = util.requestAnimFrame(function() { + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType void +util.cancelAnimFrame(animFrameHandle); + +/** + * view2d.ts + */ + +// $ExpectType View2D +new AMap.View2D(); +// $ExpectType View2D +new AMap.View2D({}); + +// $ExpectType View2D +new AMap.View2D({ + center: [1, 2], + rotation: 1, + zoom: 10, + crs: 'EPGS3395' +}); + +// $ExpectType View2D +const testView2d = new AMap.View2D({ + center: lnglat +}); + +// $ExpectType View2D +testView2d.on('complete', () => { }); + +/** + * layer/buildings.ts + */ + +// $ExpectType Buildings +new AMap.Buildings(); +// $ExpectType Buildings +new AMap.Buildings(); +// $ExpectType Buildings +const testBuildings = new AMap.Buildings({ + zooms: [1, 18], + opacity: 0.8, + heightFactor: 1, + visible: true, + zIndex: 10, + map +}); + +testBuildings.setStyle({ + hideWithoutStyle: false, + areas: [ + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [[1, 2]] + }, + { + visible: true, + rejectTexture: true, + color1: 'ffffff00', + color2: 'ffffcc00', + path: [lnglat] + }, + { + color1: 'ff99ff00', + path: [lnglat] + }, + ] +}); + +/** + * layer/canvasLayer.ts + */ + +// $ExpectType CanvasLayer +new AMap.CanvasLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType CanvasLayer +new AMap.CanvasLayer(); +// $ExpectType CanvasLayer +new AMap.CanvasLayer({}); +// $ExpectType CanvasLayer +const testCanvasLayer = new AMap.CanvasLayer({ + bounds +}); + +// $ExpectType void +testCanvasLayer.setMap(null); +// $ExpectType void +testCanvasLayer.setMap(map); + +// $ExpectType Map | null | undefined +testCanvasLayer.getMap(); + +// $ExpectType void +testCanvasLayer.show(); + +// $ExpectType void +testCanvasLayer.hide(); + +// $ExpectType number +testCanvasLayer.getzIndex(); + +// $ExpectType void +testCanvasLayer.setzIndex(10); + +// $ExpectType HTMLCanvasElement | null +testCanvasLayer.getElement(); + +// $ExpectType void +testCanvasLayer.setCanvas(canvasEle); + +// $ExpectType HTMLCanvasElement | undefined +testCanvasLayer.getCanvas(); + +/** + * layer/flexible.ts + */ + +// $ExpectType Flexible +new AMap.TileLayer.Flexible(); +// $ExpectType Flexible +new AMap.TileLayer.Flexible({}); +// $ExpectType Flexible +const testFlexible = new AMap.TileLayer.Flexible({ + createTile(x, y, z, success, fail) { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + z; + // $ExpectType void + success(imgEle); + // $ExpectType void + success(canvasEle); + // $ExpectType void + fail(); + }, + cacheSize: 10, + opacity: 1, + visible: true, + map, + zIndex: 1, + zooms: [1, 2] +}); + +// $ExpectType void +testFlexible.setMap(null); +// $ExpectType void +testFlexible.setMap(map); + +// $ExpectType Map | null | undefined +testFlexible.getMap(); + +// $ExpectType void +testFlexible.show(); + +// $ExpectType void +testFlexible.hide(); + +// $ExpectType void +testFlexible.setzIndex(10); + +// $ExpectType number +testFlexible.getzIndex(); + +/** + * layer/imageLayer.ts + */ + +// $ExpectType ImageLayer +new AMap.ImageLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType ImageLayer +new AMap.ImageLayer(); +// $ExpectType ImageLayer +new AMap.ImageLayer({}); +// $ExpectType ImageLayer +const testImageLayer = new AMap.ImageLayer({ + bounds +}); + +// $ExpectType void +testImageLayer.setMap(null); +// $ExpectType void +testImageLayer.setMap(map); + +// $ExpectType Map | null | undefined +testImageLayer.getMap(); + +// $ExpectType void +testImageLayer.show(); + +// $ExpectType void +testImageLayer.hide(); + +// $ExpectType number +testImageLayer.getzIndex(); + +// $ExpectType void +testImageLayer.setzIndex(10); + +// $ExpectType HTMLImageElement | null +testImageLayer.getElement(); + +// $ExpectType void +testImageLayer.setImageUrl('url'); + +// $ExpectType string | undefined +testImageLayer.getImageUrl(); + +/** + * layer/layer.ts + */ + +// $ExpectError +new AMap.Layer(); + +// $ExpectType HTMLDivElement | undefined +layer.getContainer(); + +// $ExpectType [number, number] +layer.getZooms(); + +// $ExpectType void +layer.setOpacity(1); + +// $ExpectType number +layer.getOpacity(); + +// $ExpectType void +layer.show(); + +// $ExpectType void +layer.hide(); + +// $ExpectType void +layer.setMap(); +// $ExpectType void +layer.setMap(map); + +// $ExpectType void +layer.setzIndex(1); + +// $ExpectType number +layer.getzIndex(); + +/** + * layer/layerGroup.ts + */ + +// $ExpectError +new AMap.LayerGroup(); + +// $ExpectType LayerGroup +new AMap.LayerGroup(tileLayer); +// $ExpectType LayerGroup +const testTileLayerGroup = new AMap.LayerGroup([tileLayer]); +// $ExpectType LayerGroup +const testAnyLauerGroup = new AMap.LayerGroup([]); + +// $ExpectType LayerGroup +testTileLayerGroup.addLayer(tileLayer); +// $ExpectType LayerGroup +testTileLayerGroup.addLayer([tileLayer]); +// $ExpectError +testTileLayerGroup.addLayer(massMarksLayer); + +// $ExpectType TileLayer[] +testTileLayerGroup.getLayers(); + +// $ExpectType TileLayer | null +testTileLayerGroup.getLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); + +testTileLayerGroup.hasLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType null + this; + + return true; +}); +testTileLayerGroup.hasLayer(tileLayer); + +// $ExpectType LayerGroup +testTileLayerGroup.removeLayer(tileLayer); +// $ExpectType LayerGroup +testTileLayerGroup.removeLayer([tileLayer]); + +// $ExpectType LayerGroup +testTileLayerGroup.clearLayers(); + +testTileLayerGroup.eachLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType TileLayer + this; +}); +testTileLayerGroup.eachLayer(function(item, index, list) { + // $ExpectType TileLayer + item; + // $ExpectType number + index; + // $ExpectType TileLayer[] + list; + // $ExpectType number + this.test; +}, { test: 1 }); + +// $ExpectType LayerGroup +testTileLayerGroup.setMap(map); + +// $ExpectType LayerGroup +testTileLayerGroup.hide(); + +// $ExpectType LayerGroup +testTileLayerGroup.show(); + +// $ExpectType LayerGroup +testTileLayerGroup.reload(); + +// $ExpectType LayerGroup +testTileLayerGroup.setOptions({}); + +// $ExpectType LayerGroup +testTileLayerGroup.setOptions({ + tileSize: 256 +}); +// layerGruop.setOptions({ +// // $ExpectError +// interval: 1 +// }); + +testAnyLauerGroup.addLayer(tileLayer); + +testAnyLauerGroup.addLayer(massMarksLayer); + +testAnyLauerGroup.setOptions({ + test: 1 +}); + +/** + * layer/massMarks.ts + */ + +const massMarksStyle1 = { + anchor: pixel, + url: '', + size, + rotation: 1 +}; +const massMarksStyle2 = { + anchor: pixel, + url: '', + size +}; +const massMarksData1 = { + lnglat +}; + +interface MassMarksCustomData extends AMap.MassMarks.Data { + name: string; + id: string; +} +const massMarksMassMarksCustomData: MassMarksCustomData = { + lnglat: [1, 2], + style: 1, + name: '', + id: '' +}; + +// $ExpectError +new AMap.MassMarks(); +// $ExpectError +new AMap.MassMarks([], {}); + +new AMap.MassMarks([], { + style: [massMarksStyle1, massMarksStyle2] +}); +new AMap.MassMarks([massMarksData1], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType MassMarks +const testMassMarks = new AMap.MassMarks([massMarksMassMarksCustomData], { + style: [massMarksStyle1, massMarksStyle2] +}); + +// $ExpectType void +testMassMarks.setStyle(massMarksStyle1); +// $ExpectType void +testMassMarks.setStyle([massMarksStyle1]); + +// $ExpectType Style | Style[] +testMassMarks.getStyle(); + +// $ExpectType void +testMassMarks.setData(''); + +// $ExpectError +testMassMarks.setData(massMarksData1); +// $ExpectError +testMassMarks.setData(massMarksMassMarksCustomData); + +const massMarksCustomData = testMassMarks.getData()[0]; +// $ExpectType string +massMarksCustomData.name; +// $ExpectType string +massMarksCustomData.id; +// $ExpectType LngLat +massMarksCustomData.lnglat; + +// $ExpectType void +testMassMarks.clear(); + +testMassMarks.on('click', (event: AMap.MassMarks.EventMap['click']) => { + // $ExpectType "click" + event.type; + + // $ExpectType MassMarksCustomData + event.data; + + // $ExpectType MassMarks + event.target; +}); + +/** + * layer/tileLayer.ts + */ + +// $ExpectType TileLayer +new AMap.TileLayer(); + +// $ExpectType TileLayer +new AMap.TileLayer({}); + +// $ExpectType TileLayer +const testTileLayer = new AMap.TileLayer({ + map, + tileSize: 256, + tileUrl: '', + errorUrl: '', + getTileUrl: (x, y, z) => '', + zIndex: 1, + opacity: 0.1, + zooms: [3, 18], + detectRetina: true +}); + +// $ExpectType string[] +testTileLayer.getTiles(); + +// $ExpectType void +testTileLayer.reload(); + +// $ExpectType void +testTileLayer.setTileUrl(''); +// $ExpectType void +testTileLayer.setTileUrl((x, y, level) => { + // $ExpectType number + x; + // $ExpectType number + y; + // $ExpectType number + level; + return ''; +}); + +// $ExpectType TileLayer +testTileLayer.on('complete', () => { }); + +testTileLayer.off('complete', () => { }); + +testTileLayer.emit('complete'); + +// $ExpectType Traffic +const testTrafficLayer = new AMap.TileLayer.Traffic({}); +// $ExpectType Traffic +new AMap.TileLayer.Traffic({ + autoRefresh: true, + interval: 180 +}); + +testTrafficLayer.on('complete', () => { }); + +/** + * layer/videoLayer.ts + */ + +// $ExpectType VideoLayer +new AMap.VideoLayer({ + map, + bounds, + visible: true, + zooms: [1, 2], + opacity: 1 +}); + +// $ExpectType VideoLayer +new AMap.VideoLayer(); +// $ExpectType VideoLayer +new AMap.VideoLayer({}); +// $ExpectType VideoLayer +const testVideoLayer = new AMap.VideoLayer({ + bounds +}); + +// $ExpectType void +testVideoLayer.setMap(null); +// $ExpectType void +testVideoLayer.setMap(map); + +// $ExpectType Map | null | undefined +testVideoLayer.getMap(); + +// $ExpectType void +testVideoLayer.show(); + +// $ExpectType void +testVideoLayer.hide(); + +// $ExpectType number +testVideoLayer.getzIndex(); + +// $ExpectType void +testVideoLayer.setzIndex(10); + +// $ExpectType HTMLVideoElement | null +testVideoLayer.getElement(); + +// $ExpectType void +testVideoLayer.setVideoUrl('url'); + +// $ExpectType string | string[] | undefined +testVideoLayer.getVideoUrl(); + +/** + * layer/wms.ts + */ + +// $ExpectType WMS +new AMap.TileLayer.WMS({ + url: 'url', + params: {} +}); +// $ExpectType WMS +const testWms = new AMap.TileLayer.WMS({ + url: 'url', + blend: true, + params: { + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' + }, + zooms: [1, 2], + tileSize: 256, + opacity: 1, + zIndex: 10, + visible: true +}); + +// $ExpectType void +testWms.setMap(map); +// $ExpectType void +testWms.setMap(null); + +// $ExpectType Map | null | undefined +testWms.getMap(); + +// $ExpectType void +testWms.show(); + +// $ExpectType void +testWms.hide(); + +// $ExpectType void +testWms.setzIndex(10); + +// $ExpectType number +testWms.getzIndex(); + +// $ExpectType void +testWms.setUrl('url'); + +// $ExpectType string +testWms.getUrl(); + +// $ExpectType void +testWms.setParams({ + VERSION: 'version', + LAYERS: 'layers', + STYLES: 'styles', + FORMAT: 'format', + TRANSPARENT: 'TRUE', + BGCOLOR: '#000', + EXCEPTIONS: 'exceptions', + TIME: 'time', + ELEVATION: 'elevation' +}); + +{ + const params = testWms.getParams(); + // $ExpectType string | undefined + params.VERSION; + // $ExpectType string | undefined + params.LAYERS; + // $ExpectType string | undefined + params.STYLES; + // $ExpectType string | undefined + params.FORMAT; + // $ExpectType "TRUE" | "FALSE" | undefined + params.TRANSPARENT; + // $ExpectType string | undefined + params.BGCOLOR; + // $ExpectType string | undefined + params.EXCEPTIONS; + // $ExpectType string | undefined + params.TIME; + // $ExpectType string | undefined + params.ELEVATION; +} + +/** + * layer/wmts.ts + */ + +// $ExpectType WMTS +new AMap.TileLayer.WMTS({ + url: 'url', + params: {} +}); +// $ExpectType WMTS +const testWmts = new AMap.TileLayer.WMTS({ + url: 'url', + blend: true, + tileSize: 256, + zooms: [1, 2], + opacity: 1, + zIndex: 10, + visible: true, + params: { + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' + } +}); + +// $ExpectType void +testWmts.setMap(map); +// $ExpectType void +testWmts.setMap(null); + +// $ExpectType Map | null | undefined +testWmts.getMap(); + +// $ExpectType void +testWmts.show(); + +// $ExpectType void +testWmts.hide(); + +// $ExpectType void +testWmts.setzIndex(10); + +// $ExpectType number +testWmts.getzIndex(); + +// $ExpectType void +testWmts.setUrl('url'); + +// $ExpectType string +testWmts.getUrl(); + +// $ExpectType void +testWmts.setParams({ + Version: 'version', + Layer: 'layers', + Style: 'style', + Format: 'format' +}); + +{ + const params = testWmts.getParams(); + // $ExpectType string | undefined + params.Version; + // $ExpectType string | undefined + params.Layer; + // $ExpectType string | undefined + params.Style; + // $ExpectType string | undefined + params.Format; +} + +/** + * overlay/bezierCurve.ts + */ + +interface BezierCurveExtraData { + test: number; +} + +const bezierCurvePath = [ + [1, 2, 3, 4], + [1, 2, 3], + [ + [1, 2, 3], + [1, 2] + ], + [1, 2] +]; + +// $ExpectError +new AMap.BezierCurve(); +// $ExpectError +new AMap.BezierCurve({}); +// $ExpectType BezierCurve +const testBezierCurve = new AMap.BezierCurve({ + map, + path: bezierCurvePath, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +// $ExpectType void +testBezierCurve.setPath(bezierCurvePath); + +// $ExpectType void +testBezierCurve.setPath(bezierCurvePath); + +// $ExpectType void +testBezierCurve.setOptions({}); +testBezierCurve.setOptions({ + map, + path: bezierCurvePath, + strokeColor: '#FF0000', + strokeOpacity: 0.6, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [1, 5], + zIndex: 10, + bubble: false, + showDir: true, + cursor: 'pointer', + isOutline: true, + outlineColor: '#00FF00', + borderWeight: 2 +}); + +{ + const options = testBezierCurve.getOptions(); + + // $ExpectType number | undefined + options.borderWeight; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType string | undefined + options.dirColor; + // $ExpectType string | undefined + options.dirImg; + // $ExpectType {} | BezierCurveExtraData | undefined + options.extData; + // $ExpectType boolean | undefined + options.geodesic; + // $ExpectType boolean | undefined + options.isOutline; + // $ExpectType "round" | "butt" | "square" | undefined + options.lineCap; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType string | undefined + options.outlineColor; + // $ExpectType (LngLat & { controlPoints: LngLat[]; })[] | undefined + options.path; + // $ExpectType boolean | undefined + options.showDir; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType number +testBezierCurve.getLength(); + +// $ExpectType Bounds | null +testBezierCurve.getBounds(); + +// $ExpectType void +testBezierCurve.show(); + +// $ExpectType void +testBezierCurve.hide(); + +// $ExpectType void +testBezierCurve.setMap(null); +testBezierCurve.setMap(map); + +// $ExpectType void +testBezierCurve.setExtData({ test: 1 }); +// $ExpectError +testBezierCurve.setExtData({ test: '123' }); + +// $ExpectType {} | BezierCurveExtraData +testBezierCurve.getExtData(); + +testBezierCurve.on('click', (event: AMap.BezierCurve.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType LngLat + event.lnglat; + // $ExpectType BezierCurve + event.target; +}); + +testBezierCurve.on('show', (event: AMap.BezierCurve.EventMap['show']) => { + // $ExpectType "show" + event.type; + // $ExpectType BezierCurve + event.target; +}); + +testBezierCurve.on('options', (event: AMap.BezierCurve.EventMap['options']) => { + // $ExpectType "options" + event.type; + // $ExpectError + event.target; +}); + +/** + * overlay/circle.ts + */ + +interface CircleExtraData { + test: number; +} + +// $ExpectType Circle +new AMap.Circle(); +new AMap.Circle({}); +// $ExpectType Circle +const testCircle = new AMap.Circle({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +// $ExpectType void +testCircle.setCenter(lnglat); +// $ExpectType void +testCircle.setCenter(lnglatTuple); + +// $ExpectType LngLat | undefined +testCircle.getCenter(); + +// $ExpectType Bounds | null +testCircle.getBounds(); + +// $ExpectType void +testCircle.setRadius(100); + +// $ExpectType number +testCircle.getRadius(); + +// $ExpectType void +testCircle.setOptions({}); +testCircle.setOptions({ + map, + zIndex: 10, + center: lnglat, + bubble: true, + cursor: 'pointer', + radius: 1000, + strokeColor: '#FF0000', + strokeOpcity: 0.8, + strokeWeight: 3, + fillColor: '#00FF00', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [2, 4] +}); + +{ + const options = testCircle.getOptions(); + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType LngLat | undefined + options.center; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | CircleExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType number | undefined + options.radius; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType Bounds | null +testCircle.getBounds(); + +// $ExpectType void +testCircle.hide(); + +// $ExpectType void +testCircle.show(); + +// $ExpectType void +testCircle.setMap(null); +// $ExpectType void +testCircle.setMap(map); + +// $ExpectType void +testCircle.setExtData({ test: 2 }); +// $ExpectError +testCircle.setExtData({ test: '1' }); + +// $ExpectType {} | CircleExtraData +testCircle.getExtData(); + +// $ExpectType boolean +testCircle.contains(lnglat); +// $ExpectType boolean +testCircle.contains(lnglatTuple); + +testCircle.on('click', (event: AMap.Circle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Circle + event.target; +}); + +testCircle.on('setCenter', (event: AMap.Circle.EventMap['setCenter']) => { + // $ExpectType "setCenter" + event.type; + // $ExpectError + event.target; +}); + +testCircle.on('change', (event: AMap.Circle.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType Circle + event.target; +}); + +/** + * overlay/contextMenu.ts + */ + +interface ContextMenuExtraData { + test: number; +} +// $ExpectType ContextMenu +new AMap.ContextMenu(); +// $ExpectType ContextMenu +new AMap.ContextMenu({}); +// $ExpectType ContextMenu +const testContextMenu = new AMap.ContextMenu({ + content: '
content
', +}); + +// $ExpectType void +testContextMenu.addItem('item', function() { + // $ExpectType HTMLLIElement + this; +}); +// $ExpectType void +testContextMenu.addItem('item', () => { }, 1); + +// $ExpectType void +testContextMenu.removeItem('item', () => {}); + +// $ExpectType void +testContextMenu.open(map, lnglatTuple); +// $ExpectType void +testContextMenu.open(map, lnglat); + +// $ExpectType void +testContextMenu.close(); + +testContextMenu.on('items', (event: AMap.ContextMenu.EventMap['items']) => { + // $ExpectType "items" + event.type; +}); + +testContextMenu.on('open', (event: AMap.ContextMenu.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType ContextMenu + event.target; +}); + +/** + * overlay/ellipse.ts + */ + +interface EllipseExtraData { + test: number; +} +// $ExpectType Ellipse +new AMap.Ellipse(); +// $ExpectType Ellipse +new AMap.Ellipse({}); +// $ExpectType Ellipse +const testEllipse = new AMap.Ellipse({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType LngLat | undefined +testEllipse.getCenter(); + +// $ExpectType void +testEllipse.setCenter(lnglat); +// $ExpectType void +testEllipse.setCenter(lnglatTuple); + +// $ExpectType Bounds | null +testEllipse.getBounds(); + +// $ExpectType void +testEllipse.setOptions({ + map, + zIndex: 10, + center: lnglat, + radius: [10000, 15000], + bubble: false, + cursor: 'pointer', + strokeColor: '#FF0000', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'dashed', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +{ + const options = testEllipse.getOptions(); + + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType LngLat | undefined + options.center; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | EllipseExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType [number, number] | undefined + options.radius; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType void +testEllipse.hide(); + +// $ExpectType void +testEllipse.show(); + +// $ExpectType void +testEllipse.setMap(null); +// $ExpectType void +testEllipse.setMap(map); + +// $ExpectType void +testEllipse.setExtData({ test: 2 }); +// $ExpectType {} | EllipseExtraData +testEllipse.getExtData(); + +// $ExpectType boolean +testEllipse.contains(lnglat); +// $ExpectType boolean +testEllipse.contains(lnglatTuple); + +/** + * overlay/geoJSON.ts + */ + +interface GeoJSONExtraData { + test: number; +} + +const geoJSONObject: AMap.GeoJSON.GeoJSONObject[] = [ + { + type: 'Feature', + properties: {}, + geometry: { + type: 'Point', + coordinates: lnglatTuple + } + }, + { + type: 'Feature', + properties: { test: 1 }, + geometry: { + type: 'LineString', + coordinates: [lnglatTuple, lnglatTuple] + } + } +]; + +// $ExpectType GeoJSON +new AMap.GeoJSON(); +// $ExpectType GeoJSON +new AMap.GeoJSON({}); +// $ExpectType GeoJSON +const testGeoJSON = new AMap.GeoJSON({ + geoJSON: geoJSONObject, + getMarker(obj, lnglat) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat + lnglat; + return marker; + }, + getPolyline(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return testPolyline; + }, + getPolygon(obj, lnglats) { + // $ExpectType GeoJSONObject + obj; + // $ExpectType LngLat[] + lnglats; + return testPolygon; + }, + coordsToLatLng(coord) { + // $ExpectType LngLat + coord; + return coord; + } +}); + +// $ExpectType void +testGeoJSON.importData(geoJSONObject); + +// $ExpectType GeoJSON +testGeoJSON.removeOverlay(marker); +// $ExpectType GeoJSON +testGeoJSON.removeOverlay([marker]); + +// $ExpectType boolean +testGeoJSON.hasOverlay(marker); +// $ExpectType boolean +testGeoJSON.hasOverlay(m => m === marker); + +// $ExpectType GeoJSON +testGeoJSON.addOverlay(marker); +// $ExpectType GeoJSON +testGeoJSON.addOverlay([marker]); + +// $ExpectType GeoJSONObject[] +testGeoJSON.toGeoJSON(); + +// $ExpectType GeoJSON +testGeoJSON.setMap(null); +// $ExpectType GeoJSON +testGeoJSON.setMap(map); + +// $ExpectType GeoJSON +testGeoJSON.hide(); + +// $ExpectType GeoJSON +testGeoJSON.show(); + +testGeoJSON.on('click', (event: AMap.MapsEvent<'click', AMap.Overlay>) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); + +/** + * overlay/icon.ts + */ + +// $ExpectType Icon +new AMap.Icon(); +// $ExpectType Icon +new AMap.Icon({}); +// $ExpectType Icon +new AMap.Icon({ + size, + imageOffset: pixel, + image: 'image uri', + imageSize: size +}); +// $ExpectType Icon +const testIcon = new AMap.Icon({ + size: [1, 2], + imageOffset: pixel, + image: 'image uri', + imageSize: [1, 2] +}); + +// $ExpectType Size +testIcon.getImageSize(); + +// $ExpectType void +testIcon.setImageSize(size); +// $ExpectType void +testIcon.setImageSize([1, 2]); + +/** + * overlay/infoWindow.ts + */ + +interface InfoWindowExtraData { + test: number; +} + +// $ExpectType InfoWindow +new AMap.InfoWindow(); +// $ExpectType InfoWindow +new AMap.InfoWindow({}); +// $ExpectType InfoWindow +const testInfoWindow = new AMap.InfoWindow({ + isCustom: false, + autoMove: false, + closeWhenClickMap: false, + content: 'content', + size: [100, 100], + offset: new AMap.Pixel(10, 10), + position: lnglat, + showShadow: true +}); + +// $ExpectType void +testInfoWindow.open(map); +// $ExpectType void +testInfoWindow.open(map, lnglat); +// $ExpectType void +testInfoWindow.open(map, lnglatTuple); + +// $ExpectType void +testInfoWindow.close(); + +// $ExpectType boolean +testInfoWindow.getIsOpen(); + +// $ExpectType void +testInfoWindow.setContent('content'); +// $ExpectType void +testInfoWindow.setContent(div); + +// $ExpectType string | HTMLElement | undefined +testInfoWindow.getContent(); + +// $ExpectType void +testInfoWindow.setPosition(lnglat); +// $ExpectType void +testInfoWindow.setPosition(lnglatTuple); + +// $ExpectType LngLat | undefined +testInfoWindow.getPosition(); + +// $ExpectType Size | undefined +testInfoWindow.getSize(); + +testInfoWindow.on('change', (event: AMap.InfoWindow.EventMap['change']) => { + // $ExpectType "change" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +testInfoWindow.on('close', (event: AMap.InfoWindow.EventMap['close']) => { + // $ExpectType "close" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +testInfoWindow.on('open', (event: AMap.InfoWindow.EventMap['open']) => { + // $ExpectType "open" + event.type; + // $ExpectType InfoWindow + event.target; +}); + +/** + * overlay/marker.ts + */ + +interface MarkerExtraData { + test: number; +} + +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker(); +// $ExpectType Marker +new AMap.Marker({}); +// $ExpectType Marker +export const testMarker = new AMap.Marker({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType void +testMarker.markOnAMAP({ + name: '123', + position: [1, 2] +}); +// $ExpectType void +testMarker.markOnAMAP(); +// $ExpectType void +testMarker.markOnAMAP({}); +// $ExpectType void +testMarker.markOnAMAP({ + position: [1, 2], + name: '123' +}); + +// $ExpectType Pixel +testMarker.getOffset(); + +// $ExpectType void +testMarker.setOffset(pixel); + +// $ExpectType void +testMarker.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +testMarker.getAnimation(); + +// $ExpectType void +testMarker.setClickable(true); + +// $ExpectType boolean +testMarker.getClickable(); + +// $ExpectType LngLat | undefined +testMarker.getPosition(); + +// $ExpectType void +testMarker.setPosition(lnglat); + +// $ExpectType void +testMarker.setAngle(0); + +// $ExpectType void +testMarker.setLabel(); +// $ExpectType void +testMarker.setLabel({}); +// $ExpectType void +testMarker.setLabel({ + content: 'label content', + offset: pixel +}); + +// $ExpectType Label | undefined +testMarker.getLabel(); + +// $ExpectType number +testMarker.getAngle(); + +// $ExpectType void +testMarker.setzIndex(100); + +// $ExpectType number +testMarker.getzIndex(); + +// $ExpectType void +testMarker.setIcon('icon uri'); +// $ExpectType void +testMarker.setIcon(icon); + +// $ExpectType string | Icon | undefined +testMarker.getIcon(); + +// $ExpectType void +testMarker.setDraggable(true); + +// $ExpectType boolean +testMarker.getDraggable(); + +// $ExpectType void +testMarker.setCursor('default'); + +// $ExpectType void +testMarker.setContent('content'); +// $ExpectType void +testMarker.setContent(domEle); + +// $ExpectType string | HTMLElement +testMarker.getContent(); + +// $ExpectType void +testMarker.moveAlong([lnglat], 100); +// $ExpectError +testMarker.moveAlong([[1, 2]], 100); +// $ExpectType void +testMarker.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +testMarker.moveTo(lnglat, 100); +// $ExpectType void +testMarker.moveTo([1, 2], 100); +// $ExpectType void +testMarker.moveTo([1, 2], 100, t => t); + +// $ExpectType void +testMarker.stopMove(); + +// $ExpectType boolean +testMarker.pauseMove(); + +// $ExpectType boolean +testMarker.resumeMove(); + +// $ExpectType void +testMarker.setMap(map); + +// $ExpectType void +testMarker.setTitle('title'); +// $ExpectError +testMarker.setTitle(); + +// $ExpectType string | undefined +testMarker.getTitle(); + +// $ExpectType void +testMarker.setTop(true); + +// $ExpectType boolean +testMarker.getTop(); + +// $ExpectType void +testMarker.setShadow(); +// $ExpectType void +testMarker.setShadow(icon); +// $ExpectType void +testMarker.setShadow('shadow url'); + +// $ExpectType string | Icon | undefined +testMarker.getShadow(); + +// $ExpectType void +testMarker.setShape(); +// $ExpectType void +testMarker.setShape(markerShape); + +// $ExpectType MarkerShape | undefined +testMarker.getShape(); + +testMarker.on('click', (event: AMap.Marker.EventMap['click']) => { + // $ExpectType {} | MarkerExtraData + event.target.getExtData(); +}); + +/** + * overlay/markerShape.ts + */ + +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1, 1] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2] +}); +// $ExpectType MarkerShape +new AMap.MarkerShape({ + type: 'poly', + coords: [1, 2, 3, 4, 5] +}); + +// $ExpectError +new AMap.MarkerShape({ + type: 'circle', + coords: [1, 1] +}); +// $ExpectError +new AMap.MarkerShape({ + type: 'rect', + coords: [1, 1, 1, 2, 2] +}); + +/** + * overlay/overlay.ts + */ + +interface OverlayExtraData { + test: number; +} +declare const testOverlay: AMap.Overlay; + +// $ExpectType void +testOverlay.show(); + +// $ExpectType void +testOverlay.hide(); + +// $ExpectType Map | null | undefined +testOverlay.getMap(); + +// $ExpectType void +testOverlay.setMap(map); +// $ExpectType void +testOverlay.setMap(null); + +// $ExpectError +testOverlay.setExtData({ any: 123 }); + +// $ExpectError OverlayExtraData +testOverlay.getExtData(); + +/** + * overlay/overlayGroup.ts + */ + +// $ExpectType OverlayGroup, any> +const testOverlayGroup2 = new AMap.OverlayGroup(); +// $ExpectType OverlayGroup, any> +new AMap.OverlayGroup(marker); +// $ExpectType OverlayGroup, any> +const testOverlayGroup = new AMap.OverlayGroup([marker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlay(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlay([marker]); +// $ExpectError +testOverlayGroup.addOverlay([testCircle]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlays(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.addOverlays([marker]); + +// $ExpectType Marker[] +testOverlayGroup.getOverlays(); + +// $ExpectType boolean +testOverlayGroup.hasOverlay(marker); +// $ExpectType boolean +testOverlayGroup.hasOverlay(o => o === marker); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlay(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlay([marker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlays(marker); +// $ExpectType OverlayGroup, any> +testOverlayGroup.removeOverlays([marker]); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.clearOverlays(); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.eachOverlay(function(overlay, index, overlays) { + // $ExpectType Marker + overlay; + // $ExpectType number + index; + // $ExpectType Marker[] + overlays; + // $ExpectType Marker + this; +}); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.setMap(null); +// $ExpectType OverlayGroup, any> +testOverlayGroup.setMap(map); + +// $ExpectType OverlayGroup, any> +testOverlayGroup2.setOptions({ + test: 1 +}); +// $ExpectType OverlayGroup, any> +testOverlayGroup.setOptions({ + map, + position: lnglat, + offset: pixel, + icon: 'iconUrl', + content: 'htmlString', + topWhenClick: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 10, + angle: 10, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: icon, + title: '123', + clickable: true, + shape: markerShape, + extData: { + test: 123 + } +}); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.show(); + +// $ExpectType OverlayGroup, any> +testOverlayGroup.hide(); + +testOverlayGroup.on('click', (event: AMap.MapsEvent<'click', AMap.Overlay>) => { + // $ExpectType "click" + event.type; + // $ExpectType Overlay + event.target; +}); + +/** + * overlay/polygon.ts + */ + +interface PolygonExtraData { + test: number; +} + +const polygonPath1 = [lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple, lnglatTuple]; +const polygonPath2 = [lnglat, lnglat, lnglat, lnglat, lnglat]; + +// $ExpectType Polygon +new AMap.Polygon(); +// $ExpectType Polygon +new AMap.Polygon({}); +// $ExpectType Polygon +const testPolygon = new AMap.Polygon({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.3, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [2, 4], + path: polygonPath1 +}); + +// $ExpectType void +testPolygon.setPath(polygonPath1); +// $ExpectType void +testPolygon.setPath(polygonPath2); +// $ExpectType void +testPolygon.setPath([polygonPath1, polygonPath2]); + +// $ExpectType LngLat[] | LngLat[][] +testPolygon.getPath(); + +// $ExpectType void +testPolygon.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 5, + fillColor: '#0000FF', + fillOpacity: 0.5, + draggable: true, + extData: { test: 1 }, + strokeStyle: 'dashed', + strokeDasharray: [4, 2], + path: [polygonPath2, polygonPath1] +}); + +{ + const options = testPolygon.getOptions(); + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | PolygonExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | LngLat[][] | undefined + options.path; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType Bounds | null +testPolygon.getBounds(); + +// $ExpectType number +testPolygon.getArea(); + +// $ExpectType void +testPolygon.setMap(null); +// $ExpectType void +testPolygon.setMap(map); + +// $ExpectType void +testPolygon.setExtData({ test: 1 }); + +// $ExpectType {} | PolygonExtraData +testPolygon.getExtData(); + +// $ExpectType boolean +testPolygon.contains(lnglat); +// $ExpectType boolean +testPolygon.contains(lnglatTuple); + +testPolygon.on('click', (event: AMap.Polygon.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polygon + event.target; +}); + +/** + * overlay/polyline.ts + */ + +interface PolylineExtraData { + test: number; +} + +// $ExpectType Polyline +new AMap.Polyline(); +// $ExpectType Polyline +new AMap.Polyline({}); +// $ExpectType Polyline +const testPolyline = new AMap.Polyline({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); +// Polyline + +// $ExpectType void +testPolyline.setPath([lnglat]); +// $ExpectType void +testPolyline.setPath([lnglatTuple]); + +// $ExpectType void +testPolyline.setOptions({}); +// $ExpectType void +testPolyline.setOptions({ + map, + zIndex: 10, + bubble: true, + cursor: 'default', + geodesic: true, + isOutline: true, + borderWeight: 1, + outlineColor: '#AA0000', + path: [lnglat, lnglat], + strokeColor: '#0000AA', + strokeOpacity: 0.5, + strokeWeight: 10, + strokeStyle: 'dashed', + strokeDasharray: [20, 10, 20], + lineJoin: 'bevel', + lineCap: 'butt', + draggable: true, + extData: { test: 1 }, + showDir: true +}); + +{ + const options = testPolyline.getOptions(); + // $ExpectType number | undefined + options.borderWeight; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType string | undefined + options.dirColor; + // $ExpectType string | undefined + options.dirImg; + // $ExpectType {} | PolylineExtraData | undefined + options.extData; + // $ExpectType boolean | undefined + options.geodesic; + // $ExpectType boolean | undefined + options.isOutline; + // $ExpectType "round" | "butt" | "square" | undefined + options.lineCap; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType string | undefined + options.outlineColor; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType boolean | undefined + options.showDir; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType number +testPolyline.getLength(); + +// $ExpectType Bounds | null +testPolyline.getBounds(); + +// $ExpectType void +testPolyline.hide(); + +// $ExpectType void +testPolyline.show(); + +// $ExpectType void +testPolyline.setMap(null); +// $ExpectType void +testPolyline.setMap(map); + +// $ExpectType void +testPolyline.setExtData({ test: 1 }); + +// $ExpectType {} | PolylineExtraData +testPolyline.getExtData(); + +testPolyline.on('click', (event: AMap.Polyline.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Polyline + event.target; +}); + +/** + * overlay/rectangle.ts + */ + +interface RectangleExtraData { + test: number; +} + +// $ExpectType Rectangle +new AMap.Rectangle(); +// $ExpectType Rectangle +new AMap.Rectangle({}); +// $ExpectType Rectangle +const testRectangle = new AMap.Rectangle({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +// $ExpectType Bounds | undefined +testRectangle.getBounds(); + +// $ExpectType void +testRectangle.setBounds(bounds); + +// $ExpectType void +testRectangle.setOptions({}); +// $ExpectType void +testRectangle.setOptions({ + map, + zIndex: 10, + bounds, + bubble: false, + cursor: 'pointer', + strokeColor: '#00FF00', + strokeOpacity: 0.8, + strokeWeight: 2, + fillColor: '#0000FF', + fillOpacity: 0.5, + strokeStyle: 'solid', + extData: { test: 1 }, + strokeDasharray: [1, 5] +}); + +{ + const options = testRectangle.getOptions(); + // $ExpectType Bounds | undefined + options.bounds; + // $ExpectType boolean | undefined + options.bubble; + // $ExpectType boolean | undefined + options.clickable; + // $ExpectType {} | RectangleExtraData | undefined + options.extData; + // $ExpectType string | undefined + options.fillColor; + // $ExpectType number | undefined + options.fillOpacity; + // $ExpectType "miter" | "round" | "bevel" | undefined + options.lineJoin; + // $ExpectType Map | undefined + options.map; + // $ExpectType LngLat[] | undefined + options.path; + // $ExpectType string | undefined + options.strokeColor; + // $ExpectType number[] | undefined + options.strokeDasharray; + // $ExpectType number | undefined + options.strokeOpacity; + // $ExpectType "dashed" | "solid" | undefined + options.strokeStyle; + // $ExpectType number | undefined + options.strokeWeight; + // $ExpectType string | undefined + options.texture; + // $ExpectType number | undefined + options.zIndex; +} + +// $ExpectType void +testRectangle.hide(); + +// $ExpectType void +testRectangle.show(); + +// $ExpectType void +testRectangle.setExtData({test: 2}); + +// $ExpectType {} | RectangleExtraData +testRectangle.getExtData(); + +// $ExpectType boolean +testRectangle.contains(lnglat); +// $ExpectType boolean +testRectangle.contains(lnglatTuple); + +testRectangle.on('click', (event: AMap.Rectangle.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Rectangle + event.target; +}); + +testRectangle.on('setBounds', (event: AMap.Rectangle.EventMap['setBounds']) => { + // $ExpectType "setBounds" + event.type; + // $ExpectError + event.target; +}); + +/** + * overlay/text.ts + */ + +interface TextExtraData { + test: number; +} + +// $ExpectType Text +new AMap.Text(); +// $ExpectType Text +new AMap.Text({}); +// $ExpectType Text +const testText = new AMap.Text({ + text: 'content', + textAlign: 'center', + verticalAlign: 'top', + map, + position: lnglat, + offset: pixel, + topWhenClick: true, + bubble: true, + draggable: true, + raiseOnDrag: true, + cursor: 'default', + visible: true, + zIndex: 100, + angle: 45, + autoRotation: true, + animation: 'AMAP_ANIMATION_BOUNCE', + shadow: 'https://webapi.amap.com/theme/v1.3/markers/0.png', + title: 'title', + clickable: true, + extData: { test: 1 } +}); + +// $ExpectType string +testText.getText(); + +// $ExpectType void +testText.setText('123'); + +// $ExpectType void +testText.setStyle({ + background: 'red', + width: '200px' +}); + +// $ExpectType void +testText.markOnAMAP({ + name: '123', + position: lnglatTuple +}); + +// $ExpectType Pixel +testText.getOffset(); + +// $ExpectType void +testText.setOffset(pixel); + +// $ExpectType void +testText.setAnimation('AMAP_ANIMATION_BOUNCE'); + +// $ExpectType AnimationName +testText.getAnimation(); + +// $ExpectType void +testText.setClickable(true); + +// $ExpectType boolean +testText.getClickable(); + +// $ExpectType LngLat | undefined +testText.getPosition(); + +// $ExpectType void +testText.setAngle(10); + +// $ExpectType number +testText.getAngle(); + +// $ExpectType void +testText.setzIndex(1); + +// $ExpectType number +testText.getzIndex(); + +// $ExpectType void +testText.setDraggable(true); + +// $ExpectType boolean +testText.getDraggable(); + +// $ExpectType void +testText.hide(); + +// $ExpectType void +testText.show(); + +// $ExpectType void +testText.setCursor('default'); + +// $ExpectType void +testText.moveAlong([lnglat], 100); + +// $ExpectType void +testText.moveAlong([lnglat], 100); +// $ExpectError +testText.moveAlong([[1, 2]], 100); +// $ExpectType void +testText.moveAlong([lnglat], 100, t => t, false); + +// $ExpectType void +testText.moveTo(lnglat, 100); +// $ExpectType void +testText.moveTo([1, 2], 100); +// $ExpectType void +testText.moveTo([1, 2], 100, t => t); + +// $ExpectType void +testText.stopMove(); + +// $ExpectType boolean +testText.pauseMove(); + +// $ExpectType boolean +testText.resumeMove(); + +// $ExpectType void +testText.setMap(map); + +// $ExpectType void +testText.setTitle('title'); +// $ExpectError +testText.setTitle(); + +// $ExpectType string | undefined +testText.getTitle(); + +// $ExpectType void +testText.setTop(true); + +// $ExpectType boolean +testText.getTop(); + +// $ExpectType void +testText.setShadow(); +// $ExpectType void +testText.setShadow(icon); +// $ExpectType void +testText.setShadow('shadow url'); + +// $ExpectType void +testText.setExtData({test: 1}); + +// $ExpectType {} | TextExtraData +testText.getExtData(); + +testText.on('click', (event: AMap.Text.EventMap['click']) => { + // $ExpectType "click" + event.type; + // $ExpectType Text + event.target; +}); diff --git a/types/amap-js-api/array-bounds.d.ts b/types/amap-js-api/array-bounds.d.ts new file mode 100644 index 0000000000..3e0145e049 --- /dev/null +++ b/types/amap-js-api/array-bounds.d.ts @@ -0,0 +1,15 @@ +declare namespace AMap { + class ArrayBounds { + constructor(bounds: LocationValue[]); + bounds: LngLat[]; + /** + * 判断传入的点是否在ArrayBounds内 + * @param point 目标点 + */ + contains(point: LocationValue): boolean; + + // internal + toBounds(): Bounds; + getCenter(): LngLat; + } +} diff --git a/types/amap-js-api/bounds.d.ts b/types/amap-js-api/bounds.d.ts new file mode 100644 index 0000000000..f594969292 --- /dev/null +++ b/types/amap-js-api/bounds.d.ts @@ -0,0 +1,39 @@ +declare namespace AMap { + class Bounds { + /** + * 地物对象的经纬度矩形范围。 + * @param southWest 西南角经纬度 + * @param northEast 东北角经纬度 + */ + constructor(southWest: LngLat, northEast: LngLat); + /** + * 指定点坐标是否在矩形范围内 + * @param point 制定坐标 + */ + contains(point: LocationValue): boolean; + /** + * 获取当前Bounds的中心点经纬度坐标 + */ + getCenter(): LngLat; + /** + * 获取西南角坐标 + */ + getSouthWest(): LngLat; + /** + * 获取东南角坐标 + */ + getSouthEast(): LngLat; + /** + * 获取东北角坐标 + */ + getNorthEast(): LngLat; + /** + * 获取西北角坐标 + */ + getNorthWest(): LngLat; + /** + * 以字符串形式返回地物对象的矩形范围 + */ + toString(): string; + } +} diff --git a/types/amap-js-api/browser.d.ts b/types/amap-js-api/browser.d.ts new file mode 100644 index 0000000000..26b3956aa1 --- /dev/null +++ b/types/amap-js-api/browser.d.ts @@ -0,0 +1,192 @@ +declare namespace AMap { + namespace Browser { + /** + * 当前浏览器userAgent + */ + const ua: string; + /** + * 是否移动设备 + */ + const mobile: boolean; + /** + * 平台类型,如:'windows'、'mac'、'ios'、'android'、'other' + */ + const plat: 'android' | 'ios' | 'windows' | 'mac' | 'other'; + /** + * 是否mac设备 + */ + const mac: boolean; + /** + * 是否windows设备 + */ + const windows: boolean; + /** + * 是否iOS设备 + */ + const ios: boolean; + /** + * 是否iPad + */ + const iPad: boolean; + /** + * 是否iPhone + */ + const iPhone: boolean; + /** + * 是否安卓设备 + */ + const android: boolean; + /** + * 是否安卓4以下系统 + */ + const android23: boolean; + /** + * 是否Chrome浏览器 + */ + const chrome: boolean; + /** + * 是否火狐浏览器 + */ + const firefox: boolean; + /** + * 是否Safari浏览器 + */ + const safari: boolean; + /** + * 是否微信 + */ + const wechat: boolean; + /** + * 是否UC浏览器 + */ + const uc: boolean; + /** + * 是否QQ或者QQ浏览器 + */ + const qq: boolean; + /** + * 是否IE + */ + const ie: boolean; + /** + * 是否IE6 + */ + const ie6: boolean; + /** + * 是否IE7 + */ + const ie7: boolean; + /** + * 是否IE8 + */ + const ie8: boolean; + /** + * 是否IE9 + */ + const ie9: boolean; + /** + * 是否IE10 + */ + const ie10: boolean; + /** + * 是否IE11 + */ + const ie11: boolean; + /** + * 是否Edge浏览器 + */ + const edge: boolean; + /** + * 是否IE9以下 + */ + const ielt9: boolean; + /** + * 是否百度浏览器 + */ + const baidu: boolean; + /** + * 是否支持LocaStorage + */ + const isLocalStorage: boolean; + /** + * 是否支持Geolocation + */ + const isGeolocation: boolean; + /** + * 是否Webkit移动浏览器 + */ + const mobileWebkit: boolean; + /** + * 是否支持Css3D的Webkit移动端浏览器 + */ + const mobileWebkit3d: boolean; + /** + * 是否Opera移动浏览器 + */ + const mobileOpera: boolean; + /** + * 是否高清屏幕,devicePixelRatio>1 + */ + const retina: boolean; + /** + * 是否触屏 + */ + const touch: boolean; + /** + * 是否msPointer设备 + */ + const msPointer: boolean; + /** + * 是否pointer设备 + */ + const pointer: boolean; + /** + * 是否webkit浏览器 + */ + const webkit: boolean; + /** + * 是否支持Css3D的ie浏览器 + */ + const ie3d: boolean; + /** + * 是否支持Css3D的Webkit浏览器 + */ + const webkit3d: boolean; + /** + * 是否支持Css3D的gecko浏览器 + */ + const gecko3d: boolean; + /** + * 是否支持Css3D的opera浏览器 + */ + const opera3d: boolean; + /** + * 是否支持Css3D的浏览器 + */ + const any3d: boolean; + /** + * 是否支持canvas + */ + const isCanvas: boolean; + /** + * 是否支持svg + */ + const isSvg: boolean; + /** + * 是否支持vml + */ + const isVML: boolean; + /** + * 是否支持WebWorker + */ + const isWorker: boolean; + /** + * 是否支持WebSocket + */ + const isWebsocket: boolean; + /** + * 判断是否支持webgl + */ + function isWebGL(): boolean; + } +} diff --git a/types/amap-js-api/common.d.ts b/types/amap-js-api/common.d.ts new file mode 100644 index 0000000000..8b442ad0a3 --- /dev/null +++ b/types/amap-js-api/common.d.ts @@ -0,0 +1,31 @@ +declare namespace AMap { + type SizeValue = Size | [number, number]; + type LocationValue = LngLat | [number, number]; + type Lang = 'zh_cn' | 'en' | 'zh_en'; + + type Event = { type: N } & + (V extends HTMLElement ? { value: V } + : V extends object ? V + : V extends undefined ? {} + : { value: V }); + type MapsEvent = Event; + + type StrokeLineJoin = 'miter' | 'round' | 'bevel'; + type StrokeLineCap = 'butt' | 'round' | 'square'; + type StrokeStyle = 'dashed' | 'solid'; + + type AnimationName = 'AMAP_ANIMATION_NONE' | 'AMAP_ANIMATION_DROP' | 'AMAP_ANIMATION_BOUNCE'; +} diff --git a/types/amap-js-api/convert-from.d.ts b/types/amap-js-api/convert-from.d.ts new file mode 100644 index 0000000000..61f83f9b94 --- /dev/null +++ b/types/amap-js-api/convert-from.d.ts @@ -0,0 +1,27 @@ +declare namespace AMap { + namespace convertFrom { + interface Result { + /** + * 成功状态文字描述 + */ + info: string; // 'ok' + /** + * 高德坐标集合 + */ + locations: LngLat[]; + } + type Type = 'gps' | 'baidu' | 'mapbar'; + type SearchStatus = 'complete' | 'error'; + } + /** + * 为坐标转换类,支持将其他坐标系的坐标点转换为高德坐标系。 + * @param lnglat 待转换坐标 + * @param type 用于说明是哪个服务商的坐标 + * @param callback 转换完成后的回调函数 + */ + function convertFrom( + lnglat: LocationValue | LocationValue[], + type: convertFrom.Type | null, + callback: (status: convertFrom.SearchStatus, result: string | convertFrom.Result) => void + ): void; +} diff --git a/types/amap-js-api/dom-util.d.ts b/types/amap-js-api/dom-util.d.ts new file mode 100644 index 0000000000..e39793f006 --- /dev/null +++ b/types/amap-js-api/dom-util.d.ts @@ -0,0 +1,78 @@ +declare namespace AMap { + namespace DomUtil { + /** + * 获取DOM元素的大小 + * @param dom DOM元素 + */ + function getViewport(dom: HTMLElement): Size; + /** + * 获取DOM元素距离窗口左上角的距离 + * @param dom DOM元素 + */ + function getViewportOffset(dom: HTMLElement): Pixel; + /** + * 在parentNode内部创建一个className类名的tagName元素 + * @param tagName 标签名称 + * @param parent 父节点 + * @param className 类名 + */ + function create( + tagName: K, + parent?: HTMLElement, + className?: string + ): HTMLElementTagNameMap[K]; + /** + * 给DOM元素设置为className样式 + * @param dom DOM元素 + * @param className 类名 + */ + function setClass(dom: HTMLElement, className?: string): void; + /** + * DOM元素是否包含className + * @param dom DOM元素 + * @param className 类名 + */ + function hasClass(dom: HTMLElement, className: string): boolean; + /** + * 给DOM元素添加一个className + * @param dom DOM元素 + * @param className 类名 + */ + function addClass(dom: HTMLElement, className: string): void; + /** + * 给DOM元素删除一个className + * @param dom DOM元素 + * @param className 类名 + */ + function removeClass(dom: HTMLElement, className: string): void; + /** + * 给DOM元素设定一个透明度 + * @param dom DOM元素 + * @param opacity 透明度(0-1) + */ + function setOpacity(dom: HTMLElement, opacity: number): void; + /** + * 给DOM元素旋转一个角度,以center为中心,center以元素左上角为坐标原点 + * @param dom DOM元素 + * @param deg 旋转角度 + * @param origin 旋转中心 + */ + function rotate(dom: HTMLElement, deg: number, origin?: { x: number, y: number }): void; + /** + * 给DOM元素删除一组样式,Object同样式表 + * @param dom DOM元素 + * @param style 样式 + */ + function setCss(dom: HTMLElement | HTMLElement[], style: Partial): typeof DomUtil; // this + /** + * 清空DOM元素 + * @param dom DOM元素 + */ + function empty(dom: HTMLElement): void; + /** + * 将DOM元素从父节点删除 + * @param dom DOM元素 + */ + function remove(dom: HTMLElement): void; + } +} diff --git a/types/amap-js-api/event.d.ts b/types/amap-js-api/event.d.ts new file mode 100644 index 0000000000..d90ee4c720 --- /dev/null +++ b/types/amap-js-api/event.d.ts @@ -0,0 +1,102 @@ +declare namespace AMap { + abstract class EventEmitter { + /** + * 注册事件 + * @param eventName 事件名称 + * @param handler 事件回调函数 + * @param context 事件回调中的上下文 + * @param once 触发一次 + * @param unshift 更改事件顺序 + */ + on( + eventName: string, + // tslint:disable-next-line:no-unnecessary-generics + handler: (this: C, event: E) => void, + context?: C, + once?: boolean, + unshift?: boolean + ): this; + /** + * 移除事件绑定 + * @param eventName 事件名称 + * @param handler 事件功能函数 + * @param context 事件上下文 + */ + off( + eventName: string, + // tslint:disable-next-line + handler: ((this: C, event: E) => void) | 'mv', + context?: C + ): this; + /** + * 触发事件 + * @param eventName 事件名称 + * @param data 事件数据 + */ + emit(eventName: string, data?: any): this; + } + + namespace event { + interface EventListener { + type: T; + } + /** + * 注册DOM对象事件 + * @param instance 需注册事件的DOM对象 + * @param eventName 事件名称 + * @param handler 事件功能函数 + * @param context 事件上下文 + */ + function addDomListener( + // tslint:disable-next-line: no-unnecessary-generics + instance: HTMLElementTagNameMap[N], + eventName: E, + handler: (this: C, event: HTMLElementEventMap[E]) => void, + context?: C + ): EventListener<0>; + /** + * 给对象注册事件 + * @param instance 需注册事件的对象 + * @param eventName 事件名称 + * @param handler 事件功能函数 + * @param context 事件上下文 + */ + function addListener( + // tslint:disable-next-line: no-unnecessary-generics + instance: I, + eventName: string, + // tslint:disable-next-line: no-unnecessary-generics + handler: (this: C, event: E) => void, + // tslint:disable-next-line: no-unnecessary-generics + context?: C + ): EventListener<1>; + /** + * 给对象注册一次性事件 + * @param instance 需注册事件的对象 + * @param eventName 事件名称 + * @param handler 事件功能函数 + * @param context 事件上下文 + */ + function addListenerOnce( + // tslint:disable-next-line: no-unnecessary-generics + instance: I, + eventName: string, + // tslint:disable-next-line: no-unnecessary-generics + handler: (this: C, event: E) => void, + // tslint:disable-next-line: no-unnecessary-generics + context?: C + ): EventListener<1>; + /** + * 删除事件 + * @param listener 侦听器 + */ + function removeListener(listener: EventListener<0 | 1>): void; + /** + * 触发非DOM事件 + * @param instance 触发对象 + * @param eventName 事件名称 + * @param data 事件数据 + */ + function trigger(instance: EventEmitter, eventName: string, data?: any): void; + } +} diff --git a/types/amap-js-api/geometry-util.d.ts b/types/amap-js-api/geometry-util.d.ts new file mode 100644 index 0000000000..c8a5eae2e9 --- /dev/null +++ b/types/amap-js-api/geometry-util.d.ts @@ -0,0 +1,192 @@ +declare namespace AMap { + namespace GeometryUtil { + /** + * 计算两个经纬度点之间的实际距离 + */ + function distance( + point1: LocationValue, + point2: LocationValue | LocationValue[] + ): number; + /** + * 计算一个经纬度路径围成区域的实际面积 + */ + function ringArea(ring: LocationValue[]): number; + /** + * 判断一个经纬度路径是否为顺时针 + */ + function isClockwise(path: LocationValue[]): boolean; + /** + * 计算一个经纬度路径的实际长度 + */ + function distanceOfLine(line: LocationValue[]): number; + /** + * 计算两个经纬度面的交叉区域 + */ + function ringRingClip( + ring1: LocationValue[], + ring2: LocationValue[] + ): Array<[number, number]>; + /** + * 判断两个经纬度面是否交叉 + */ + function doesRingRingIntersect( + ring1: LocationValue[], + ring2: LocationValue[] + ): boolean; + /** + * 判断经纬度路径和经纬度面是否交叉 + */ + function doesLineRingIntersect( + line: LocationValue[], + ring: LocationValue[] + ): boolean; + /** + * 判断两个经纬度路径是否相交 + */ + function doesLineLineIntersect( + line1: LocationValue[], + line2: LocationValue[] + ): boolean; + /** + * 判断线段和多个环是否相交 + */ + function doesSegmentPolygonIntersect( + point1: LocationValue, + point2: LocationValue, + polygon: LocationValue[][] + ): boolean; + /** + * 判断线段和一个环是否相交 + */ + function doesSegmentRingIntersect( + point1: LocationValue, + point2: LocationValue, + ring: LocationValue[] + ): boolean; + /** + * 判断线段和一个路径是否相交 + */ + function doesSegmentLineIntersect( + point1: LocationValue, + point2: LocationValue, + line: LocationValue[] + ): boolean; + /** + * 判断两个线段是否相交 + */ + function doesSegmentsIntersect( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue, + point4: LocationValue + ): boolean; + /** + * 判断点是否在环内 + */ + function isPointInRing(point: LocationValue, ring: LocationValue[]): boolean; + /** + * 判断环是否在另一个环内 + */ + function isRingInRing(ring1: LocationValue[], ring2: LocationValue[]): boolean; + /** + * 判断点是否在多个环组成区域内 + */ + function isPointInPolygon(point: LocationValue, polygon: LocationValue[][]): boolean; + /** + * 判断点是否在多个环组成区域内 + */ + function makesureClockwise(path: Array<[number, number]>): Array<[number, number]>; + /** + * 将一个路径变为逆时针 + */ + function makesureAntiClockwise(path: Array<[number, number]>): Array<[number, number]>; + /** + * 计算P2P3上距离P1最近的点 + * @param point1 P1 + * @param point2 P2 + * @param point3 P3 + */ + function closestOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): [number, number]; + /** + * 计算line上距离P最近的点 + */ + function closestOnLine(point: LocationValue, line: LocationValue[]): [number, number]; + /** + * 计算P2P3到P1的距离 + * @param point1 P1 + * @param point2 P2 + * @param point3 P3 + */ + function distanceToSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue + ): number; + /** + * 计算P到line的距离 + */ + function distanceToLine(point: LocationValue, line: LocationValue[]): number; + /** + * 判断P1是否在P2P3上 + * @param point1 P1 + * @param point2 P2 + * @param point3 P3 + * @param tolerance 误差范围 + */ + function isPointOnSegment( + point1: LocationValue, + point2: LocationValue, + point3: LocationValue, + tolerance?: number + ): boolean; + /** + * 判断P是否在line上 + * @param point 点P + * @param line 线 + * @param tolerance 误差范围 + */ + function isPointOnLine( + point: LocationValue, + line: LocationValue[], + tolerance?: number + ): boolean; + /** + * 判断P是否在ring的边上 + * @param point 点P + * @param ring 环 + * @param tolerance 误差范围 + */ + function isPointOnRing( + point: LocationValue, + ring: LocationValue[], + tolerance?: number + ): boolean; + /** + * 判断P是否在多个ring的边上 + * @param point 点P + * @param polygon 多边形 + * @param tolerance 误差范围 + */ + function isPointOnPolygon( + point: LocationValue, + polygon: LocationValue[][], + tolerance?: number + ): boolean; + + function doesPolygonPolygonIntersect( + polygon1: LocationValue[], + polygon2: LocationValue[] + ): boolean; + + function distanceToPolygon(point: LocationValue, polygon: LocationValue[]): number; + + function triangulateShape( + shape1: LngLat[] | Pixel[] | [number, number], + shape2: LngLat[] | Pixel[] | [number, number] + ): number[]; + } +} diff --git a/types/amap-js-api/index.d.ts b/types/amap-js-api/index.d.ts new file mode 100644 index 0000000000..5b8c1a5b94 --- /dev/null +++ b/types/amap-js-api/index.d.ts @@ -0,0 +1,48 @@ +// Type definitions for non-npm package amap-js-api 1.4 +// Project: https://lbs.amap.com/api/javascript-api/summary +// Definitions by: breeze9527 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/types/amap-js-api/layer/building.d.ts b/types/amap-js-api/layer/building.d.ts new file mode 100644 index 0000000000..1b7426e28d --- /dev/null +++ b/types/amap-js-api/layer/building.d.ts @@ -0,0 +1,54 @@ +declare namespace AMap { + namespace Buildings { + interface Options extends Layer.Options { + /** + * 可见级别范围 + */ + zooms?: [number, number]; + /** + * 不透明度 + */ + opacity?: number; + /** + * 高度比例系数,可控制3D视图下的楼块高度 + */ + heightFactor?: number; + /** + * 是否可见 + */ + visible?: boolean; + /** + * 层级 + */ + zIndex?: number; + + // inner + merge?: boolean; + sort?: boolean; + } + interface AreaStyle { + color1: string; + path: LocationValue[]; + color2?: string; + visible?: boolean; + rejectTexture?: boolean; + } + interface Style { + hideWithoutStyle?: boolean; + areas: AreaStyle[]; + } + } + + class Buildings extends Layer { + /** + * 楼块图层,单独展示矢量化的楼块图层 + * @param opts 图层选项 + */ + constructor(opts?: Buildings.Options); + /** + * 按区域设置楼块的颜色 + * @param style 颜色设置 + */ + setStyle(style: Buildings.Style): void; + } +} diff --git a/types/amap-js-api/layer/flexible.d.ts b/types/amap-js-api/layer/flexible.d.ts new file mode 100644 index 0000000000..d91970dc31 --- /dev/null +++ b/types/amap-js-api/layer/flexible.d.ts @@ -0,0 +1,38 @@ +declare namespace AMap { + namespace TileLayer { + namespace Flexible { + interface Options extends TileLayer.Options { + /** + * 创建切片回调 + * @param x 横坐标 + * @param y 纵坐标 + * @param z 层级 + * @param success 成功回调 + * @param fail 失败回调 + */ + createTile?( + x: number, + y: number, + z: number, + success: (tile: HTMLImageElement | HTMLCanvasElement) => void, + fail: () => void + ): void; + /** + * 内存中缓存的切片的数量上限 + */ + cacheSize?: number; + /** + * 是否显示 + */ + visible?: boolean; + } + } + class Flexible extends TileLayer { + /** + * 灵活切片图层 + * @param options 图层选项 + */ + constructor(options?: Flexible.Options); + } + } +} diff --git a/types/amap-js-api/layer/layer.d.ts b/types/amap-js-api/layer/layer.d.ts new file mode 100644 index 0000000000..64714bc68f --- /dev/null +++ b/types/amap-js-api/layer/layer.d.ts @@ -0,0 +1,56 @@ +declare namespace AMap { + namespace Layer { + interface Options { + /** + * 所属的地图对象 + */ + map?: Map; + } + } + + abstract class Layer extends EventEmitter { + /** + * 图层获取DOM节点 + */ + getContainer(): HTMLDivElement | undefined; + /** + * 获取图层缩放范围 + */ + getZooms(): [number, number]; + /** + * 设置透明度 + * @param alpha 透明度 + */ + setOpacity(alpha: number): void; + /** + * 设置透明度 + */ + getOpacity(): number; + /** + * 显示图层 + */ + show(): void; + /** + * 隐藏图层 + */ + hide(): void; + /** + * 设置图层所属地图 + * @param map map对象 + */ + setMap(map?: Map | null): void; + /** + * 获取图层所属地图 + */ + getMap(): Map | null | undefined; + /** + * 设置图层的层级 + * @param index 层级 + */ + setzIndex(index: number): void; + /** + * 获取图层的层级 + */ + getzIndex(): number; + } +} diff --git a/types/amap-js-api/layer/layerGroup.d.ts b/types/amap-js-api/layer/layerGroup.d.ts new file mode 100644 index 0000000000..6a07c8fc72 --- /dev/null +++ b/types/amap-js-api/layer/layerGroup.d.ts @@ -0,0 +1,56 @@ +declare namespace AMap { + class LayerGroup extends Layer { + /** + * 图层集合 + * @param layers 集合中的图层 + */ + constructor(layers: L | L[]); + /** + * 添加单个图层到集合中,不支持添加重复的图层 + * @param layer 图层 + */ + addLayer(layer: L | L[]): this; + /** + * 添加图层数组到集合中,不支持添加重复的图层 + * @param layers 图层数组 + */ + addLayers(layers: L | L[]): this; + /** + * 返回当前集合中所有的图层 + */ + getLayers(): L[]; + getLayer(finder: (this: null, item: L, index: number, list: L[]) => boolean): L | null; + /** + * 判断传入的图层实例是否在集合中 + * @param layer 目标图层 + */ + hasLayer(layer: L | ((this: null, item: L, index: number, list: L[]) => boolean)): boolean; + /** + * 从集合中删除传入的图层实例 + * @param layer 图层 + */ + removeLayer(layer: L | L[]): this; + /** + * 从集合中删除传入的图层实例数组 + * @param layers 图层数组 + */ + removeLayers(layers: L | L[]): this; + /** + * 清空集合 + */ + clearLayers(): this; + /** + * 对集合中的图层做迭代操作 + * @param iterator 迭代回调 + * @param context 执行上下文 + */ + eachLayer(iterator: (this: C, layer: L, index: number, list: L[]) => void, context?: C): void; + + // overwrite + setMap(map?: Map): this; + hide(): this; + show(): this; + reload(): this; + setOptions(options: any): this; + } +} diff --git a/types/amap-js-api/layer/massMarks.d.ts b/types/amap-js-api/layer/massMarks.d.ts new file mode 100644 index 0000000000..963f7e2ec6 --- /dev/null +++ b/types/amap-js-api/layer/massMarks.d.ts @@ -0,0 +1,99 @@ +declare namespace AMap { + namespace MassMarks { + interface EventMap { + click: UIEvent<'click', I>; + dblclick: UIEvent<'dblclick', I>; + mousedown: UIEvent<'mousedown', I>; + mouseup: UIEvent<'mouseup', I>; + mouseover: UIEvent<'mouseover', I>; + mouseout: UIEvent<'mouseout', I>; + touchstart: UIEvent<'touchstart', I>; + touchend: UIEvent<'touchend', I>; + } + + interface Style { + /** + * 图标显示位置偏移量,以图标的左上角为基准点(0,0)点 + */ + anchor: Pixel; + /** + * 图标的地址 + */ + url: string; + /** + * 图标的尺寸 + */ + size: Size; + /** + * 旋转角度 + */ + rotation?: number; + } + + type UIEvent = Event ? D : Data; + }>; + + interface Options extends Layer.Options { + /** + * 显示层级 + */ + zIndex?: number; + /** + * 指针样式 + */ + cursor?: string; + /** + * 是否在拖拽缩放过程中实时重绘 + */ + alwayRender?: boolean; + /** + * 设置点的样式 + */ + style: Style | Style[]; + // rejectMapMask + } + interface Data { + lnglat: LocationValue; + style?: number; + } + } + + class MassMarks extends Layer { + /** + * 海量点类,利用该类可同时在地图上展示万级别的点 + * @param data 点对象数组或url + * @param opts 选项 + */ + constructor(data: D[] | string, opts: MassMarks.Options); + /** + * 设置显示样式 + * @param style 样式设置 + */ + setStyle(style: MassMarks.Style | MassMarks.Style[]): void; + /** + * 获取显示样式 + */ + getStyle(): MassMarks.Style | MassMarks.Style[]; + /** + * 设置数据集 + * @param data 数据集 + */ + setData(data: D[] | string): void; + /** + * 获取数据集 + */ + getData(): Array> & { lnglat: LngLat }>; + /** + * 清除海量点 + */ + clear(): void; + } +} diff --git a/types/amap-js-api/layer/mediaLayer.d.ts b/types/amap-js-api/layer/mediaLayer.d.ts new file mode 100644 index 0000000000..43fee214bb --- /dev/null +++ b/types/amap-js-api/layer/mediaLayer.d.ts @@ -0,0 +1,94 @@ +declare namespace AMap { + namespace MediaLayer { + interface Options extends Layer.Options { + /** + * 显示范围 + */ + bounds?: Bounds; + /** + * 是否可见 + */ + visible?: boolean; + /** + * 缩放范围 + */ + zooms?: [number, number]; + /** + * 透明度 + */ + opacity?: number; + } + } + + abstract class MediaLayer extends Layer { + /** + * @param options 图层选项 + */ + constructor(options?: MediaLayer.Options); + /** + * 设置显示范围 + * @param bounds 显示范围 + */ + setBounds(bounds: Bounds): void; + /** + * 获取显示的范围 + */ + getBounds(): Bounds; + /** + * 设置图层选项 + * @param options 图层选项 + */ + setOptions(options: Partial): void; + /** + * 获取图层选项 + */ + getOptions(): Partial; + /** + * 获取元素 + */ + getElement(): E | null; + } + + /** + * 图片图层 + */ + class ImageLayer extends MediaLayer { + /** + * 修改Image的Url + * @param url url + */ + setImageUrl(url: string): void; + /** + * 返回Image的Url + */ + getImageUrl(): string | undefined; + } + + class VideoLayer extends MediaLayer { + /** + * 修改Video的Url + * @param source url + */ + setVideoUrl(source: string | string[]): void; + /** + * 返回Video的Url + */ + getVideoUrl(): string | string[] | undefined; + } + + class CanvasLayer extends MediaLayer { + /** + * 修改显示的Canvas + * @param canvas Canvas对象 + */ + setCanvas(canvas: HTMLCanvasElement): void; + /** + * 返回Canvas对象 + */ + getCanvas(): HTMLCanvasElement | undefined; + /** + * 当canvas的内容发生改变是用于刷新图层 + */ + reFresh(): void; + } +} diff --git a/types/amap-js-api/layer/tileLayer.d.ts b/types/amap-js-api/layer/tileLayer.d.ts new file mode 100644 index 0000000000..1a146b964c --- /dev/null +++ b/types/amap-js-api/layer/tileLayer.d.ts @@ -0,0 +1,91 @@ +declare namespace AMap { + namespace TileLayer { + interface EventMap { + complete: Event<'complete'>; + } + + interface Options extends Layer.Options { + /** + * 切片大小 + */ + tileSize?: number; + /** + * 切片取图地址(自1.3版本起,该属性与getTileUrl属性合并) + */ + tileUrl?: string; + /** + * 取图错误时的代替地址 + */ + errorUrl?: string; + /** + * 获取图块取图地址 + */ + getTileUrl?: string | ((x: number, y: number, level: number) => string); + /** + * 图层叠加的顺序值 + */ + zIndex?: number; + /** + * 图层的透明度 + */ + opacity?: number; + /** + * 支持的缩放级别范围 + */ + zooms?: [number, number]; + /** + * 是否在高清屏下进行清晰度适配 + */ + detectRetina?: boolean; + } + /** + * 卫星图层 + */ + class Satellite extends TileLayer { } + /** + * 路网图层 + */ + class RoadNet extends TileLayer { } + + namespace Traffic { + interface Options extends TileLayer.Options { + /** + * 是否设置可以自动刷新实时路况信息 + */ + autoRefresh?: boolean; + /** + * 设置刷新间隔时长 + */ + interval?: number; + } + } + class Traffic extends TileLayer { + /** + * 实时交通图层 + * @param options 图层选项 + */ + constructor(options?: Traffic.Options); + } + } + + class TileLayer extends Layer { + /** + * 切片图层 + * @param options 图层选项 + */ + constructor(options?: TileLayer.Options); + /** + * 获取当前图层所有切片号 + */ + getTiles(): string[]; + /** + * 重新加载此图层 + */ + reload(): void; + /** + * 设置图层的取图地址 + * @param url 取图地址 + */ + setTileUrl(url: string | ((x: number, y: number, level: number) => string)): void; + } +} diff --git a/types/amap-js-api/layer/wms.d.ts b/types/amap-js-api/layer/wms.d.ts new file mode 100644 index 0000000000..043975d856 --- /dev/null +++ b/types/amap-js-api/layer/wms.d.ts @@ -0,0 +1,56 @@ +declare namespace AMap { + namespace TileLayer { + namespace WMS { + interface Params { + VERSION?: string; + LAYERS?: string; + STYLES?: string; + FORMAT?: string; + TRANSPARENT?: 'TRUE' | 'FALSE'; + BGCOLOR?: string; + EXCEPTIONS?: string; + TIME?: string; + ELEVATION?: string; + } + interface Options extends Flexible.Options { + /** + * wms服务的url地址 + */ + url: string; + /** + * OGC标准的WMS地图服务的GetMap接口的参数 + */ + params: Params; + /** + * 地图级别切换时,不同级别的图片是否进行混合 + */ + blend?: boolean; + } + } + class WMS extends Flexible { + /** + * WMS图层 + * @param options 图层选项 + */ + constructor(options: WMS.Options); + /** + * 设置wms服务地址 + * @param url 服务地址 + */ + setUrl(url: string): void; + /** + * 返回wms服务地址 + */ + getUrl(): string; + /** + * 设置OGC标准的WMS getMap接口的参数 + * @param params 接口参数 + */ + setParams(params: WMS.Params): void; + /** + * 返回OGC标准的WMS getMap接口的参数 + */ + getParams(): WMS.Params; + } + } +} diff --git a/types/amap-js-api/layer/wmts.d.ts b/types/amap-js-api/layer/wmts.d.ts new file mode 100644 index 0000000000..7a122dd6b9 --- /dev/null +++ b/types/amap-js-api/layer/wmts.d.ts @@ -0,0 +1,52 @@ +declare namespace AMap { + namespace TileLayer { + namespace WMTS { + interface Params { + Version?: string; + Layer?: string; + Style?: string; + Format?: string; + } + interface Options extends Flexible.Options { + /** + * wmts服务的url地址 + */ + url: string; + /** + * OGC标准的WMTS地图服务的GetTile接口的参数 + */ + params: Params; + /** + * 地图级别切换时,不同级别的图片是否进行混合 + */ + blend?: boolean; + } + } + + class WMTS extends Flexible { + /** + * WMTS图层 + * @param options 图层选项 + */ + constructor(options: WMTS.Options); + /** + * 设置wmts服务地址 + * @param url 服务地址 + */ + setUrl(url: string): void; + /** + * 返回wmts服务地址 + */ + getUrl(): string; + /** + * 设置OGC标准的WMTS getTile接口的参数 + * @param params 接口参数 + */ + setParams(params: WMTS.Params): void; + /** + * 返回OGC标准的WMTS getTile接口的参数 + */ + getParams(): WMTS.Params; + } + } +} diff --git a/types/amap-js-api/lngLat.d.ts b/types/amap-js-api/lngLat.d.ts new file mode 100644 index 0000000000..f649a78de8 --- /dev/null +++ b/types/amap-js-api/lngLat.d.ts @@ -0,0 +1,45 @@ +declare namespace AMap { + class LngLat { + /** + * 构造一个地理坐标对象 + * @param lng 经度 + * @param lat 纬度 + * @param noAutofix 是否自动修正 + */ + constructor(lng: number, lat: number, noAutofix?: boolean); + /** + * 移动当前经纬度坐标得到新的坐标 + * @param east 移动经度,向右为正值 + * @param north 移动维度,向上为正值 + */ + offset(east: number, north: number): LngLat; + /** + * 当前经纬度和传入经纬度或者经纬度数组连线之间的地面距离,单位为米 + * @param lnglat 对比目标 + */ + distance(lnglat: LngLat | LngLat[]): number; + /** + * 获取经度值 + */ + getLng(): number; + /** + * 获取纬度值 + */ + getLat(): number; + /** + * 判断当前坐标对象与传入坐标对象是否相等 + * @param lnglat 判断目标 + */ + equals(lnglat: LngLat): boolean; + /** + * 以字符串的形式返回 + */ + toString(): string; + + // internal + add(lnglat: LngLat, noAutofix?: boolean): LngLat; + subtract(lnglat: LngLat, noAutofix?: boolean): LngLat; + divideBy(num: number, noAutofix?: boolean): LngLat; + multiplyBy(num: number, noAutofix?: boolean): LngLat; + } +} diff --git a/types/amap-js-api/map.d.ts b/types/amap-js-api/map.d.ts new file mode 100644 index 0000000000..e7937966b1 --- /dev/null +++ b/types/amap-js-api/map.d.ts @@ -0,0 +1,568 @@ +declare namespace AMap { + namespace Map { + type Feature = 'bg' | 'point' | 'road' | 'building'; + type ViewMode = '2D' | '3D'; + interface Options { + /** + * 地图视口,用于控制影响地图静态显示的属性 + */ + view?: View2D; + /** + * 地图图层数组,数组可以是图层 中的一个或多个,默认为普通二维地图 + */ + layers?: Layer[]; + /** + * 地图显示的缩放级别 + */ + zoom?: number; + /** + * 地图中心点坐标值 + */ + center?: LocationValue; + /** + * 地图标注显示顺序 + */ + labelzIndex?: number; + /** + * 地图显示的缩放级别范围 + */ + zooms?: [number, number]; + /** + * 地图语言类型 + */ + lang?: Lang; + /** + * 地图默认鼠标样式 + */ + defaultCursor?: string; + /** + * 地图显示的参考坐标系 + */ + crs?: 'EPSG3857' | 'EPSG3395' | 'EPSG4326'; + /** + * 地图平移过程中是否使用动画 + */ + animateEnable?: boolean; + /** + * 是否开启地图热点和标注的hover效果 + */ + isHotspot?: boolean; + /** + * 当前地图中默认显示的图层 + */ + defaultLayer?: TileLayer; + /** + * 地图是否可旋转 + */ + rotateEnable?: boolean; + /** + * 是否监控地图容器尺寸变化 + */ + resizeEnable?: boolean; + /** + * 是否在有矢量底图的时候自动展示室内地图 + */ + showIndoorMap?: boolean; + /** + * 在展示矢量图的时候自动展示室内地图图层 + */ + // indoorMap?: IndorMap + /** + * 是否支持可以扩展最大缩放级别 + */ + expandZoomRange?: boolean; + /** + * 地图是否可通过鼠标拖拽平移 + */ + dragEnable?: boolean; + /** + * 地图是否可缩放 + */ + zoomEnable?: boolean; + /** + * 地图是否可通过双击鼠标放大地图 + */ + doubleClickZoom?: boolean; + /** + * 地图是否可通过键盘控制 + */ + keyboardEnable?: boolean; + /** + * 地图是否使用缓动效果 + */ + jogEnable?: boolean; + /** + * 地图是否可通过鼠标滚轮缩放浏览 + */ + scrollWheel?: boolean; + /** + * 地图在移动终端上是否可通过多点触控缩放浏览地图 + */ + touchZoom?: boolean; + /** + * 当touchZoomCenter=1的时候,手机端双指缩放的以地图中心为中心,否则默认以双指中间点为中心 + */ + touchZoomCenter?: number; + /** + * 设置地图的显示样式 + */ + mapStyle?: string; + /** + * 设置地图上显示的元素种类 + */ + features?: Feature[] | 'all' | Feature; + /** + * 设置地图显示3D楼块效果 + */ + showBuildingBlock?: boolean; + /** + * 视图模式 + */ + viewMode?: ViewMode; + /** + * 俯仰角度 + */ + pitch?: number; + /** + * 是否允许设置俯仰角度 + */ + pitchEnable?: boolean; + /** + * 楼块出现和消失的时候是否显示动画过程 + */ + buildingAnimation?: boolean; + /** + * 调整天空颜色 + */ + skyColor?: string; + /** + * 设置地图的预加载模式 + */ + preloadMode?: boolean; + /** + * 为 Map 实例指定掩模的路径,各图层将只显示路径范围内图像 + */ + mask?: Array<[number, number]> | Array> | Array>>; + maxPitch?: number; + rotation?: number; + forceVector?: boolean; + + // internal + baseRender?: 'vw' | 'd' | 'dv' | 'v'; + overlayRender?: 'c' | 'd'; + showLabel?: boolean; + gridMapForeign?: boolean; + logoUrl?: string; + logoUrlRetina?: string; + copyright?: string; + turboMode?: boolean; + workerMode?: boolean; + // continuousZoomEnable?: boolean; + // showFog: boolean; + // yaw: number; + // scale: number; + // detectRetina: number; + } + interface Status { + /** + * 是否开启动画 + */ + animateEnable: boolean; + /** + * 是否双击缩放 + */ + doubleClickZoom: boolean; + /** + * 是否支持拖拽 + */ + dragEnable: boolean; + isHotspot: boolean; + /** + * 是否开启缓动效果 + */ + jogEnable: boolean; + /** + * 是否支持键盘 + */ + keyboardEnable: boolean; + /** + * 是否支持调整俯仰角 + */ + pitchEnable: boolean; + resizeEnable: boolean; + /** + * 是否支持旋转 + */ + rotateEnable: boolean; + /** + * 是否支持滚轮缩放 + */ + scrollWheel: boolean; + /** + * 是否支持触摸缩放 + */ + touchZoom: boolean; + /** + * 是否支持缩放 + */ + zoomEnable: boolean; + } + type HotspotEvent = Event; + interface EventMap { + click: MapsEvent<'click', Map>; + dblclick: MapsEvent<'dblclick', Map>; + rightclick: MapsEvent<'rightclick', Map>; + rdblclick: MapsEvent<'rdblclick', Map>; + mouseup: MapsEvent<'mouseup', Map>; + mousedown: MapsEvent<'mousedown', Map>; + mousemove: MapsEvent<'mousemove', Map>; + mousewheel: MapsEvent<'mousewheel', Map>; + mouseover: MapsEvent<'mouseover', Map>; + mouseout: MapsEvent<'mouseout', Map>; + touchstart: MapsEvent<'touchstart', Map>; + touchmove: MapsEvent<'touchmove', Map>; + touchend: MapsEvent<'touchend', Map>; + contextmenu: MapsEvent<'contextmenu', Map>; + + hotspotclick: HotspotEvent<'hotspotclick'>; + hotspotover: HotspotEvent<'hotspotover'>; + hotspotout: HotspotEvent<'hotspotout'>; + + complete: Event<'complete'>; + mapmove: Event<'mapmove'>; + movestart: Event<'movestart'>; + moveend: Event<'moveend'>; + zoomchange: Event<'zoomchange'>; + zoomstart: Event<'zoomstart'>; + zoomend: Event<'zoomend'>; + dragstart: Event<'dragstart'>; + dragging: Event<'dragging'>; + dragend: Event<'dragend'>; + resize: Event<'resize'>; + } + } + + class Map extends EventEmitter { + /** + * 构造一个地图对象 + * @param container 地图容器的id或者是DOM元素 + * @param opts 选项 + */ + constructor(container: string | HTMLElement, opts?: Map.Options); + /** + * 唤起高德地图客户端marker页 + * @param obj 唤起参数 + */ + poiOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void; + /** + * 唤起高德地图客户端marker详情页 + * @param obj 唤起参数 + */ + detailOnAMAP(obj: { id: string; location?: LocationValue; name?: string }): void; + /** + * 获取当前地图缩放级别 + */ + getZoom(): number; + /** + * 获取地图图层数组 + */ + getLayers(): Layer[]; + /** + * 获取地图中心点经纬度坐标值 + */ + getCenter(): LngLat; + /** + * 返回地图对象的容器 + */ + getContainer(): HTMLElement | null; + /** + * 获取地图中心点所在区域 + */ + getCity(callback: (cityData: { + /** + * 市名称 + */ + city: string; + /** + * 市代码 + */ + citycode: string; + /** + * 区名称 + */ + district: string; + /** + * 省 + */ + province: string | never[]; // province is empty array when getCity fail + }) => void): void; + /** + * 获取当前地图视图范围,获取当前可视区域 + */ + getBounds(): Bounds; + /** + * 获取当前地图标注的显示顺序 + */ + getLabelzIndex(): number; + /** + * 获取Map的限制区域 + */ + getLimitBounds(): Bounds; + /** + * 获取地图语言类型 + */ + getLang(): Lang; + /** + * 获取地图容器像素大小 + */ + getSize(): Size; + /** + * 获取地图顺时针旋转角度 + */ + getRotation(): number; + /** + * 获取当前地图状态信息 + */ + getStatus(): Map.Status; + /** + * 获取地图默认鼠标指针样式 + */ + getDefaultCursor(): string; + /** + * 获取指定位置的地图分辨率 + * @param point 指定经纬度 + */ + getResolution(point?: LocationValue): number; + /** + * 获取当前地图比例尺 + * @param dpi dpi + */ + getScale(dpi?: number): number; + /** + * 设置地图显示的缩放级别 + * @param level 缩放级别 + */ + setZoom(level: number): void; + /** + * 设置地图标注显示的顺序 + * @param index 显示顺序 + */ + setLabelzIndex(index: number): void; + /** + * 设置地图图层数组 + * @param layers 图层数组 + */ + setLayers(layers: Layer[]): void; + /** + * 添加覆盖物/图层 + * @param overlay 覆盖物/图层 + */ + add(overlay: Overlay | Overlay[]): void; + /** + * 删除覆盖物/图层 + * @param overlay 覆盖物/图层 + */ + remove(overlay: Overlay | Overlay[]): void; + /** + * 返回添加的覆盖物对象 + * @param type 覆盖物类型 + */ + getAllOverlays(type?: 'marker' | 'circle' | 'polyline' | 'polygon'): Overlay[]; + /** + * 设置地图显示的中心点 + * @param center 中心点经纬度 + */ + setCenter(center: LocationValue): void; + /** + * 地图缩放至指定级别并以指定点为地图显示中心点 + * @param zoomLevel 缩放等级 + * @param center 缩放中心 + */ + setZoomAndCenter(zoomLevel: number, center: LocationValue): void; + /** + * 按照行政区名称或adcode来设置地图显示的中心点。 + * @param city 城市名称或城市编码 + * @param callback 回调 + */ + setCity(city: string, callback: (this: this, coord: [string, string], zoom: number) => void): void; + /** + * 指定当前地图显示范围 + * @param bound 显示范围 + */ + setBounds(bound: Bounds): Bounds; + /** + * 设置Map的限制区域 + * @param bound 限制区域 + */ + setLimitBounds(bound: Bounds): void; + /** + * 清除限制区域 + */ + clearLimitBounds(): void; + /** + * 设置地图语言类型 + * @param lang 语言类型 + */ + setLang(lang: Lang): void; + /** + * 设置地图顺时针旋转角度,旋转原点为地图容器中心点 + * @param rotation 旋转角度 + */ + setRotation(rotation: number): void; + /** + * 设置当前地图显示状态 + * @param status 状态 + */ + setStatus(status: Partial): void; + /** + * 设置鼠标指针默认样式 + * @param cursor 指针样式 + */ + setDefaultCursor(cursor: string): void; + /** + * 地图放大一级显示 + */ + zoomIn(): void; + /** + * 地图缩小一级显示 + */ + zoomOut(): void; + /** + * 地图中心点平移至指定点位置 + * @param position 目标位置经纬度 + */ + panTo(position: LocationValue): void; + /** + * 以像素为单位,沿x方向和y方向移动地图 + * @param x 横向移动像素,向右为正 + * @param y 纵向移动像素,向下为正 + */ + panBy(x: number, y: number): void; + /** + * 根据地图上添加的覆盖物分布情况,自动缩放地图到合适的视野级别 + * @param overlayList 覆盖物数组 + * @param immediately 是否需要动画过程 + * @param avoid 上下左右的像素避让宽度 + * @param maxZoom 最大缩放级别 + */ + setFitView( + overlayList?: Overlay | Overlay[], + immediately?: boolean, + avoid?: [number, number, number, number], + maxZoom?: number + ): Bounds | false | undefined; + /** + * 删除地图上所有的覆盖物 + */ + clearMap(): void; + /** + * 注销地图对象,并清空地图容器 + */ + destroy(): void; + /** + * 加载插件, + * tips: 插件的类型定义不在本类型定义中给出,需要另行安装例如 + * 3d地图:@types/amap-js-api-map3d + * 地区搜索:@types/amap-js-api-place-search + * @param name 插件名称 + * @param callback 插件加载完成后的回调函数 + */ + plugin(name: string | string[], callback: () => void): this; + /** + * 添加控件 + * @param control 控件 + */ + addControl(control: {}): void; // TODO + /** + * 移除控件 + * @param control 控件 + */ + removeControl(control: {}): void; // TODO + /** + * 清除地图上的信息窗体。 + */ + clearInfoWindow(): void; + /** + * 平面地图像素坐标转换为地图经纬度坐标 + * @param pixel 像素坐标 + * @param level 缩放等级 + */ + pixelToLngLat(pixel: Pixel, level?: number): LngLat; + /** + * 地图经纬度坐标转换为平面地图像素坐标 + * @param lnglat 经纬度坐标 + * @param level 缩放等级 + */ + lnglatToPixel(lnglat: LocationValue, level?: number): Pixel; + /** + * 地图容器像素坐标转为地图经纬度坐标 + * @param pixel 地图像素坐标 + */ + containerToLngLat(pixel: Pixel): LngLat; + /** + * 地图经纬度坐标转为地图容器像素坐标 + * @param lnglat 经纬度坐标 + */ + lngLatToContainer(lnglat: LocationValue): Pixel; + /** + * 地图经纬度坐标转为地图容器像素坐标 + * @param lnglat 经纬度坐标 + */ + lnglatTocontainer(lnglat: LocationValue): Pixel; + /** + * 设置地图的显示样式 + * @param style 地图样式 + */ + setMapStyle(style: string): void; + /** + * 获取地图显示样式 + */ + getMapStyle(): string; + /** + * 设置地图上显示的元素种类 + * @param feature 元素 + */ + setFeatures(feature: Map.Feature | Map.Feature[] | 'all'): void; + /** + * 获取地图显示元素种类 + */ + getFeatures(): Map.Feature | Map.Feature[] | 'all'; + /** + * 修改底图图层 + * @param layer 图层 + */ + setDefaultLayer(layer: TileLayer): void; + /** + * 设置俯仰角 + * @param pitch 俯仰角 + */ + setPitch(pitch: number): void; + /** + * 获取俯仰角 + */ + getPitch(): number; + + getViewMode_(): Map.ViewMode; + lngLatToGeodeticCoord(lnglat: LocationValue): Pixel; + geodeticCoordToLngLat(pixel: Pixel): LngLat; + } +} diff --git a/types/amap-js-api/overlay/bezierCurve.d.ts b/types/amap-js-api/overlay/bezierCurve.d.ts new file mode 100644 index 0000000000..b861440a92 --- /dev/null +++ b/types/amap-js-api/overlay/bezierCurve.d.ts @@ -0,0 +1,35 @@ +declare namespace AMap { + namespace BezierCurve { + interface EventMap extends Polyline.EventMap { } + type Options = Merge, { + /** + * 贝瑟尔曲线的路径 + */ + path: Array>>; + // internal + tolerance?: number; + interpolateNumLimit?: [number | number]; + }>; + + interface GetOptionsResult extends Polyline.GetOptionsResult { + /** + * 贝瑟尔曲线的路径 + */ + path: Array; + } + } + class BezierCurve extends Polyline { + /** + * 贝瑟尔曲线 + * @param options 覆盖物选项 + */ + constructor(options: BezierCurve.Options); + /** + * 获取覆盖物选项 + */ + getOptions(): Partial>; + // internal + getInterpolateLngLats(): LngLat[]; + getSerializedPath(): number[][]; + } +} diff --git a/types/amap-js-api/overlay/circle.d.ts b/types/amap-js-api/overlay/circle.d.ts new file mode 100644 index 0000000000..c718119e5a --- /dev/null +++ b/types/amap-js-api/overlay/circle.d.ts @@ -0,0 +1,84 @@ +declare namespace AMap { + namespace Circle { + interface EventMap extends ShapeOverlay.EventMap { + setCenter: Event<'setCenter'>; + setRadius: Event<'setRadius'>; + } + + interface Options { + map?: Map; + zIndex?: number; + center?: LocationValue; + bubble?: boolean; + cursor?: string; + radius?: number; + strokeColor?: string; + strokeOpcity?: number; + strokeWeight?: number; + fillColor?: string; + fillOpacity?: number; + strokeStyle?: StrokeStyle; + extData?: ExtraData; + strokeDasharray?: number[]; + + // internal + visible?: boolean; + unit?: 'meter' | 'px'; // 'might be typo' + } + + type GetOptionsResult = Merge, { + path: LngLat[]; + center: LngLat; + radius: number; + }>; + } + + class Circle extends ShapeOverlay { + /** + * 圆形覆盖物 + * @param options 覆盖物选项 + */ + constructor(options?: Circle.Options); + /** + * 设置圆中心点 + * @param center 中心点经纬度 + * @param preventEvent 阻止触发事件 + */ + setCenter(center: LocationValue, preventEvent?: boolean): void; + /** + * 获取圆中心点 + */ + getCenter(): LngLat | undefined; + /** + * 获取圆外切矩形范围 + */ + getBounds(): Bounds | null; + /** + * 设置圆形的半径 + * @param radius 半径 + * @param preventEvent 阻止触发事件 + */ + setRadius(radius: number, preventEvent?: boolean): void; + /** + * 获取圆形的半径 + */ + getRadius(): number; + /** + * 修改选项 + * @param options 选项 + */ + setOptions(options?: Circle.Options): void; + /** + * 获取选项 + */ + getOptions(): Partial>; + /** + * 判断指定点坐标是否在圆内 + * @param point 坐标 + */ + contains(point: LocationValue): boolean; + + // internal + getPath(count?: number): LngLat[]; + } +} diff --git a/types/amap-js-api/overlay/circleMarker.d.ts b/types/amap-js-api/overlay/circleMarker.d.ts new file mode 100644 index 0000000000..0b67d7f13e --- /dev/null +++ b/types/amap-js-api/overlay/circleMarker.d.ts @@ -0,0 +1,7 @@ +declare namespace AMap { + // tslint:disable-next-line; + /** + * 圆点标记 + */ + class CircleMarker extends Circle {} +} diff --git a/types/amap-js-api/overlay/contextMenu.d.ts b/types/amap-js-api/overlay/contextMenu.d.ts new file mode 100644 index 0000000000..eacb6673c8 --- /dev/null +++ b/types/amap-js-api/overlay/contextMenu.d.ts @@ -0,0 +1,50 @@ +declare namespace AMap { + namespace ContextMenu { + interface Options { + /** + * 右键菜单内容 + */ + content?: string | HTMLElement; + + // internal + visible?: boolean; + } + + interface EventMap { + items: Event<'items'>; + open: Event<'open', { target: I }>; + close: Event<'close', { target: I }>; + } + } + + class ContextMenu extends Overlay { + /** + * 地图右键菜单 + * @param options 选项 + */ + constructor(options?: ContextMenu.Options); + /** + * 右键菜单中添加菜单项 + * @param text 菜单显示内容 + * @param fn 该菜单下需进行的操作 + * @param num 当前菜单项在右键菜单中的排序位置,以0开始 + */ + addItem(text: string, fn: (this: HTMLLIElement) => void, num?: number): void; + /** + * 删除一个菜单项 + * @param text 菜单显示内容 + * @param fn 该菜单下需进行的操作 + */ + removeItem(text: string, fn: (this: HTMLLIElement) => void): void; + /** + * 在地图的指定位置打开右键菜单。 + * @param map 目标地图 + * @param position 打开位置经纬度 + */ + open(map: Map, position: LocationValue): void; + /** + * 关闭右键菜单 + */ + close(): void; + } +} diff --git a/types/amap-js-api/overlay/ellipse.d.ts b/types/amap-js-api/overlay/ellipse.d.ts new file mode 100644 index 0000000000..de9da22e0c --- /dev/null +++ b/types/amap-js-api/overlay/ellipse.d.ts @@ -0,0 +1,49 @@ +declare namespace AMap { + namespace Ellipse { + interface EventMap extends ShapeOverlay.EventMap { + setPath: Event<'setPath'>; + setCenter: Event<'setCenter'>; + } + + interface Options extends Polygon.Options { + /** + * 椭圆的中心 + */ + center?: LocationValue; + /** + * 椭圆半径 + */ + radius?: [number, number]; + } + type GetOptionsResult = Merge, { + radius: [number, number]; + }>; + } + + class Ellipse extends Polygon { + /** + * 椭圆 + * @param options 选项 + */ + constructor(options?: Ellipse.Options); + /** + * 获取椭圆的中心点 + */ + getCenter(): LngLat | undefined; + /** + * 设置椭圆的中心点 + * @param center 中心点 + * @param preventEvent 阻止触发事件 + */ + setCenter(center: LocationValue, preventEvent?: boolean): void; + /** + * 修改椭圆属性 + * @param options 属性 + */ + setOptions(options: Ellipse.Options): void; + + // internal + setRadius(radius: [number, number], preventEvent?: boolean): void; + getRadius(): [number, number]; + } +} diff --git a/types/amap-js-api/overlay/geoJSON.d.ts b/types/amap-js-api/overlay/geoJSON.d.ts new file mode 100644 index 0000000000..aa3554cb04 --- /dev/null +++ b/types/amap-js-api/overlay/geoJSON.d.ts @@ -0,0 +1,72 @@ +declare namespace AMap { + namespace GeoJSON { + type Geometry = { + type: 'Point'; + coordinates: [number, number]; + } | { + type: 'MultiPoint' | 'LineString' | 'Polygon'; + coordinates: Array<[number, number]>; + } | { + type: 'MultiLineString' | 'MultiPolygon'; + coordinates: Array>; + } | { + type: 'GeometryCollection'; + geometries: Geometry[]; + }; + + type GeoJSONObject = { + type: 'Feature'; + properties: any; + geometry: Geometry; + } | { + type: 'FeatureCollection', + properties: any; + features: GeoJSONObject[]; + }; + interface Options { + /** + * 要加载的标准GeoJSON对象 + */ + geoJSON?: GeoJSONObject | GeoJSONObject[]; + /** + * 指定点要素的绘制方式 + * @param obj GeoJSON对象 + * @param lnglat 点的位置 + */ + getMarker?(obj: GeoJSONObject, lnglat: LngLat): Marker; + /** + * 指定线要素的绘制方式 + * @param obj GeoJSON对象 + * @param lnglats 线的路径 + */ + getPolyline?(obj: GeoJSONObject, lnglats: LngLat[]): Polyline; + /** + * 指定面要素的绘制方式 + * @param obj GeoJSON对象 + * @param lnglats 面的路径 + */ + getPolygon?(obj: GeoJSONObject, lnglats: LngLat[]): Polygon; + coordsToLatLng?(lnglat: LngLat): LngLat; + + // internal + coordsToLatLngs?(lnglats: LngLat[]): LngLat[]; + } + } + + class GeoJSON extends OverlayGroup { + /** + * GeoJSON + * @param options 选项 + */ + constructor(options?: GeoJSON.Options); + /** + * 加载新的GeoJSON对象,转化为覆盖物,旧的覆盖物将移除 + * @param obj GeoJSON对象 + */ + importData(obj: GeoJSON.GeoJSONObject | GeoJSON.GeoJSONObject[]): void; + /** + * 将当前对象包含的覆盖物转换为GeoJSON对象 + */ + toGeoJSON(): GeoJSON.GeoJSONObject[]; + } +} diff --git a/types/amap-js-api/overlay/icon.d.ts b/types/amap-js-api/overlay/icon.d.ts new file mode 100644 index 0000000000..18d75921bf --- /dev/null +++ b/types/amap-js-api/overlay/icon.d.ts @@ -0,0 +1,39 @@ +declare namespace AMap { + namespace Icon { + interface Options { + /** + * 图标尺寸 + */ + size?: SizeValue; + /** + * 图标取图偏移量 + */ + imageOffset?: Pixel; + /** + * 图标的取图地址 + */ + image?: string; + /** + * 图标所用图片大小 + */ + imageSize?: SizeValue; + } + } + + class Icon extends EventEmitter { + /** + * 点标记的图标 + * @param options 选项 + */ + constructor(options?: Icon.Options); + /** + * 设置图标图片大小 + * @param size 大小 + */ + setImageSize(size: SizeValue): void; + /** + * 获取图标图片大小 + */ + getImageSize(): Size; + } +} diff --git a/types/amap-js-api/overlay/infoWindow.d.ts b/types/amap-js-api/overlay/infoWindow.d.ts new file mode 100644 index 0000000000..1c9b69a9a3 --- /dev/null +++ b/types/amap-js-api/overlay/infoWindow.d.ts @@ -0,0 +1,98 @@ +declare namespace AMap { + namespace InfoWindow { + interface EventMap { + change: Event<'change', { target: I }>; + open: Event<'open', { target: I }>; + close: Event<'close', { target: I }>; + } + + interface Options extends Overlay.Options { + /** + * 是否自定义窗体 + */ + isCustom?: boolean; + /** + * 是否自动调整窗体到视野内 + */ + autoMove?: boolean; + /** + * 控制是否在鼠标点击地图后关闭信息窗体 + */ + closeWhenClickMap?: boolean; + /** + * 显示内容 + */ + content?: string | HTMLElement; + /** + * 信息窗体尺寸 + */ + size?: SizeValue; + /** + * 信息窗体显示位置偏移量 + */ + offset?: Pixel; + /** + * 信息窗体显示基点位置 + */ + position?: LocationValue; + /** + * 是否显示信息窗体阴影 + */ + showShadow?: boolean; + // internal + height?: number; + } + } + + class InfoWindow extends Overlay { + /** + * 信息展示窗体 + * @param options 选项 + */ + constructor(options?: InfoWindow.Options); + /** + * 在地图的指定位置打开信息窗体 + * @param map 地图 + * @param position 打开的位置 + */ + open(map: Map, position?: LocationValue): void; + /** + * 关闭信息窗体 + */ + close(): void; + /** + * 获取信息窗体是否打开 + */ + getIsOpen(): boolean; + /** + * 设置信息窗体内容 + * @param content 窗体内容 + */ + setContent(content: string | HTMLElement): void; + /** + * 获取信息窗体内容 + */ + getContent(): string | HTMLElement | undefined; + /** + * 设置信息窗体显示基点位置 + * @param lnglat 位置经纬度 + */ + setPosition(lnglat: LocationValue): void; + /** + * 获取信息窗体显示基点位置 + */ + getPosition(): LngLat | undefined; + /** + * 设置信息窗体大小 + * @param size 大小 + */ + setSize(size: SizeValue): void; + /** + * 获取信息窗体大小 + */ + getSize(): Size | undefined; + + // internal + setOffset(offset: Pixel): void; + } +} diff --git a/types/amap-js-api/overlay/marker.d.ts b/types/amap-js-api/overlay/marker.d.ts new file mode 100644 index 0000000000..42dddf394a --- /dev/null +++ b/types/amap-js-api/overlay/marker.d.ts @@ -0,0 +1,293 @@ +declare namespace AMap { + namespace Marker { + interface EventMap { + click: MapsEvent<'click', I>; + dblclick: MapsEvent<'dblclick', I>; + rightclick: MapsEvent<'rightclick', I>; + mousemove: MapsEvent<'mousemove', I>; + mouseover: MapsEvent<'mouseover', I>; + mouseout: MapsEvent<'mouseout', I>; + mousedown: MapsEvent<'mousedown', I>; + mouseup: MapsEvent<'mouseup', I>; + dragstart: MapsEvent<'dragstart', I>; + dragging: MapsEvent<'dragging', I>; + dragend: MapsEvent<'dragend', I>; + moving: Event<'moving', { passwdPath: LngLat[]; }>; + moveend: Event<'moveend'>; + movealong: Event<'movealong'>; + touchstart: MapsEvent<'touchstart', I>; + touchmove: MapsEvent<'touchmove', I>; + touchend: MapsEvent<'touchend', I>; + } + + interface Label { + content?: string; + offset?: Pixel; + } + + interface Options extends Overlay.Options { + /** + * 点标记在地图上显示的位置 + */ + position?: LocationValue; + /** + * 点标记显示位置偏移量 + */ + offset?: Pixel; + /** + * 需在点标记中显示的图标 + */ + icon?: string | Icon; + /** + * 点标记显示内容 + */ + content?: string | HTMLElement; + /** + * 鼠标点击时marker是否置顶 + */ + topWhenClick?: boolean; + /** + * 是否将覆盖物的鼠标或touch等事件冒泡到地图上 + */ + bubble?: boolean; + /** + * 点标记是否可拖拽移动 + */ + draggable?: boolean; + /** + * 拖拽点标记时是否开启点标记离开地图的效果 + */ + raiseOnDrag?: boolean; + /** + * 鼠标悬停时的鼠标样式 + */ + cursor?: string; + /** + * 点标记是否可见 + */ + visible?: boolean; + /** + * 点标记的叠加顺序 + */ + zIndex?: number; + /** + * 点标记的旋转角度 + */ + angle?: number; + /** + * 是否自动旋转 + */ + autoRotation?: boolean; + /** + * 点标记的动画效果 + */ + animation?: AnimationName; + /** + * 点标记阴影 + */ + shadow?: Icon | string; + /** + * 鼠标滑过点标记时的文字提示 + */ + title?: string; + /** + * 可点击区域 + */ + shape?: MarkerShape; + /** + * 文本标注 + */ + label?: Label; + + // internal + zooms?: [number, number]; + topWhenMouseOver?: boolean; + height?: number; + } + } + + class Marker extends Overlay { + /** + * 点标记 + * @param options 选项 + */ + constructor(options?: Marker.Options); + /** + * 唤起高德地图客户端标注页 + * @param obj 唤起参数 + */ + markOnAMAP(obj?: { name?: string, position?: LocationValue }): void; + /** + * 获取偏移量 + */ + getOffset(): Pixel; + /** + * 设置偏移量 + * @param offset 偏移量 + */ + setOffset(offset: Pixel): void; + /** + * 设置点标记的动画效果 + * @param animate 动画效果类型 + */ + setAnimation(animate: AnimationName, prevent?: boolean): void; + /** + * 获取点标记的动画效果类型 + */ + getAnimation(): AnimationName; + /** + * 设置点标记是支持鼠标单击事件 + * @param cilckable 是否支持点击 + */ + setClickable(cilckable: boolean): void; + /** + * 获取点标记是否支持鼠标单击事件 + */ + getClickable(): boolean; + /** + * 获取点标记的位置 + */ + getPosition(): LngLat | undefined; + /** + * 设置点标记位置 + * @param position 位置经纬度 + */ + setPosition(position: LocationValue): void; + /** + * 设置点标记的旋转角度 + * @param angle 旋转角度 + */ + setAngle(angle: number): void; + /** + * 设置点标记文本标签内容 + * @param label 标签内容 + */ + setLabel(label?: Marker.Label): void; + /** + * 获取点标记文本标签内容 + */ + getLabel(): Marker.Label | undefined; + /** + * 获取点标记的旋转角度 + */ + getAngle(): number; + /** + * 设置点标记的叠加顺序 + * @param index 层级 + */ + setzIndex(index: number): void; + /** + * 获取点标记的叠加顺序 + */ + getzIndex(): number; + /** + * 设置点标记的显示图标 + * @param content 图标 + */ + setIcon(content: string | Icon): void; + /** + * 获取Icon内容 + */ + getIcon(): string | Icon | undefined; + /** + * 设置点标记对象是否可拖拽移动 + * @param draggable 是否可拖拽移动 + */ + setDraggable(draggable: boolean): void; + /** + * 获取点标记对象是否可拖拽移动 + */ + getDraggable(): boolean; + /** + * 设置鼠标悬停时的光标 + * @param cursor 光标 + */ + setCursor(cursor: string): void; + /** + * 设置点标记显示内容,可以是HTML要素字符串或者HTML DOM对象 + * @param content 显示内容 + */ + setContent(content: string | HTMLElement): void; + /** + * 获取点标记内容 + */ + getContent(): string | HTMLElement; + /** + * 以指定的速度,点标记沿指定的路径移动 + * @param path 移动轨迹 + * @param speed 速度 + * @param timingFunction 缓动函数 + * @param circleable 是否循环 + */ + moveAlong( + path: LngLat[], + speed: number, + timingFunction?: (t: number) => number, + circleable?: boolean + ): void; + /** + * 以给定速度移动点标记到指定位置 + * @param lnglat 目标位置 + * @param speed 速度 + * @param timingFunction 缓动函数 + */ + moveTo( + lnglat: LocationValue, + speed: number, + timingFunction?: (t: number) => number + ): void; + /** + * 点标记停止动画 + */ + stopMove(): void; + /** + * 暂定点标记的动画效果 + */ + pauseMove(): boolean; + /** + * 重新开始点标记的动画效果 + */ + resumeMove(): boolean; + /** + * 指定目标显示地图 + * @param map 地图 + */ + setMap(map: null | Map): void; + /** + * 鼠标滑过点标时的文字提示 + * @param title 提示文字 + */ + setTitle(title: string): void; + /** + * 获取点标记的文字提示 + */ + getTitle(): string | undefined; + /** + * 设置是否展示在最顶层 + * @param isTop 是否展示在最顶层 + */ + setTop(isTop: boolean): void; + /** + * 获取是否展示在最顶层 + */ + getTop(): boolean; + /** + * 设置阴影效果 + * @param icon 阴影效果 + */ + setShadow(icon?: Icon | string): void; + /** + * 获取阴影图标 + */ + getShadow(): Icon | undefined | string; + /** + * 设置可点击区域 + * @param shape 可点击区域 + */ + setShape(shape?: MarkerShape): void; + /** + * 获取可点击区域 + */ + getShape(): MarkerShape | undefined; + } +} diff --git a/types/amap-js-api/overlay/markerShape.d.ts b/types/amap-js-api/overlay/markerShape.d.ts new file mode 100644 index 0000000000..19264f26cf --- /dev/null +++ b/types/amap-js-api/overlay/markerShape.d.ts @@ -0,0 +1,25 @@ +declare namespace AMap { + namespace MarkerShape { + interface CircleOptions { + type: 'circle'; + coords: [number, number, number]; + } + interface PolyOptions { + type: 'poly'; + coords: number[]; + } + interface RectOptions { + type: 'rect'; + coords: [number, number, number, number]; + } + type Options = CircleOptions | PolyOptions | RectOptions; + } + + class MarkerShape extends EventEmitter { + /** + * Marker点击范围 + * @param options 选项 + */ + constructor(options: MarkerShape.Options); + } +} diff --git a/types/amap-js-api/overlay/overlay.d.ts b/types/amap-js-api/overlay/overlay.d.ts new file mode 100644 index 0000000000..f90bdb57ed --- /dev/null +++ b/types/amap-js-api/overlay/overlay.d.ts @@ -0,0 +1,75 @@ +declare namespace AMap { + namespace Overlay { + interface EventMap { + touchstart: MapsEvent<'touchstart', I>; + touchmove: MapsEvent<'touchmove', I>; + touchend: MapsEvent<'touchend', I>; + click: MapsEvent<'click', I>; + rightclick: MapsEvent<'rightclick', I>; + dblclick: MapsEvent<'dblclick', I>; + mousemove: MapsEvent<'mousemove', I>; + mouseover: MapsEvent<'mouseover', I>; + mousedown: MapsEvent<'mousedown', I>; + mouseup: MapsEvent<'mouseup', I>; + } + interface Options { + /** + * 所属地图 + */ + map?: Map; + /** + * 鼠标悬停时的鼠标样式 + */ + cursor?: string; + /** + * 自定义数据 + */ + extData?: ExtraData; + /** + * 事件是否穿透到地图 + */ + bubble?: boolean; + /** + * 是否支持点击 + */ + clickable?: boolean; + /** + * 是否支持拖拽 + */ + draggable?: boolean; + } + } + abstract class Overlay extends EventEmitter { + constructor(options?: Overlay.Options); + /** + * 显示覆盖物 + */ + show(): void; + /** + * 隐藏覆盖物 + */ + hide(): void; + /** + * 获取所属地图 + */ + getMap(): Map | null | undefined; + /** + * 设置所属地图 + * @param map 地图 + */ + setMap(map: Map | null): void; + /** + * 设置自定义数据 + * @param extData 自定义数据 + */ + setExtData(extData: ExtraData): void; + /** + * 获取自定义数据 + */ + getExtData(): ExtraData | {}; + + // internal + setHeight(height?: number | string): void; + getHeight(): number | string; + } +} diff --git a/types/amap-js-api/overlay/overlayGroup.d.ts b/types/amap-js-api/overlay/overlayGroup.d.ts new file mode 100644 index 0000000000..a219e38fcd --- /dev/null +++ b/types/amap-js-api/overlay/overlayGroup.d.ts @@ -0,0 +1,82 @@ +type ReferOverlayOptions = + O extends AMap.BezierCurve ? AMap.BezierCurve.Options + : O extends AMap.Polyline ? AMap.Polyline.Options + : O extends AMap.Circle ? AMap.Circle.Options + : O extends AMap.Ellipse ? AMap.Ellipse.Options + : O extends AMap.Polygon ? AMap.Polygon.Options + : O extends AMap.Text ? AMap.Text.Options + : O extends AMap.Marker ? AMap.Marker.Options + : O extends AMap.Rectangle ? AMap.Rectangle.Options + : any; + +declare namespace AMap { + class OverlayGroup extends Overlay { + /** + * 覆盖物集合 + * @param overlays 覆盖物 + */ + constructor(overlays?: O | O[]); + /** + * 添加单个覆盖物到集合中,不支持添加重复的覆盖物 + * @param overlay 覆盖物 + */ + addOverlay(overlay: O | O[]): this; + /** + * 添加覆盖物数组到集合中,不支持添加重复的覆盖物 + * @param overlay 覆盖物数组 + */ + addOverlays(overlay: O | O[]): this; + /** + * 返回当前集合中所有的覆盖物 + */ + getOverlays(): O[]; + /** + * 判断传入的覆盖物实例是否在集合中 + * @param overlay 覆盖物 + */ + hasOverlay(overlay: O | ((this: null, item: O, index: number, list: O[]) => boolean)): boolean; + /** + * 从集合中删除传入的覆盖物实例 + * @param overlay 覆盖物 + */ + removeOverlay(overlay: O | O[]): this; + /** + * 从集合中删除传入的覆盖物实例数组 + * @param overlay 覆盖物数组 + */ + removeOverlays(overlay: O | O[]): this; + /** + * 清空集合 + */ + clearOverlays(): this; + /** + * 对集合中的覆盖物做迭代操作 + * @param iterator 迭代回调 + * @param context 执行上下文 + */ + eachOverlay(iterator: (this: C, overlay: O, index: number, overlays: O[]) => void, context?: C): this; + /** + * 指定集合中里覆盖物的显示地图 + * @param map 地图 + */ + setMap(map: null | Map): this; + /** + * 修改覆盖物属性 + * @param options 属性 + */ + setOptions(options: ReferOverlayOptions): this; + /** + * 在地图上显示集合中覆盖物 + */ + show(): this; + /** + * 在地图上隐藏集合中覆盖物 + */ + hide(): this; + /** + * 查找集合中的覆盖物 + * @param finder 查找回调 + */ + getOverlay(finder: ((this: null, item: O, index: number, list: O[]) => boolean) | O): O | null; + } +} diff --git a/types/amap-js-api/overlay/pathOverlay.d.ts b/types/amap-js-api/overlay/pathOverlay.d.ts new file mode 100644 index 0000000000..d46b23a1c3 --- /dev/null +++ b/types/amap-js-api/overlay/pathOverlay.d.ts @@ -0,0 +1,50 @@ +declare namespace AMap { + namespace PathOverlay { + interface EventMap extends ShapeOverlay.EventMap { } + interface Options extends Overlay.Options { + /** + * 是否可见 + */ + visible?: boolean; + /** + * 覆盖物层级 + */ + zIndex?: number; + /** + * 描边线条颜色 + */ + strokeColor?: string; + /** + * 描边线条透明度 + */ + strokeOpacity?: number; + /** + * 描边宽度 + */ + strokeWeight?: number; + /** + * 描边样式 + */ + strokeStyle?: StrokeStyle; + /** + * 虚线间隔 + */ + strokeDasharray?: number[]; + /** + * 折线拐点的绘制样式 + */ + lineJoin?: StrokeLineJoin; + /** + * 折线两端线帽的绘制样式 + */ + lineCap?: StrokeLineCap; + } + } + abstract class PathOverlay extends ShapeOverlay { + constructor(options?: PathOverlay.Options); + /** + * 获取范围 + */ + getBounds(): Bounds | (this extends Rectangle ? undefined : null); + } +} diff --git a/types/amap-js-api/overlay/polygon.d.ts b/types/amap-js-api/overlay/polygon.d.ts new file mode 100644 index 0000000000..20a9c3595e --- /dev/null +++ b/types/amap-js-api/overlay/polygon.d.ts @@ -0,0 +1,78 @@ +declare namespace AMap { + namespace Polygon { + interface EventMap extends PathOverlay.EventMap { } + interface Options extends PathOverlay.Options { + /** + * 多边形轮廓线的节点坐标数组 + */ + path?: LocationValue[] | LocationValue[][]; + /** + * 多边形填充颜色 + */ + fillColor?: string; + /** + * 边形填充透明度 + */ + fillOpacity?: number; + } + + interface GetOptionsResult extends ShapeOverlay.GetOptionsResult { + /** + * 多边形填充颜色 + */ + fillColor: string; + /** + * 边形填充透明度 + */ + fillOpacity: number; + /** + * 多边形轮廓线的节点坐标数组 + */ + path: LngLat[] | LngLat[][]; + /** + * 折线拐点的绘制样式 + */ + lineJoin: StrokeLineJoin; + texture: string; + } + } + + class Polygon extends PathOverlay { + /** + * 多边形 + * @param options 选项 + */ + constructor(options?: Polygon.Options); + /** + * 设置多边形轮廓线节点数组 + * @param path 轮廓线节点 + */ + setPath(path: LocationValue[] | LocationValue[][]): void; + /** + * 获取多边形轮廓线节点数组 + */ + getPath(): LngLat[] | LngLat[][]; + /** + * 修改多边形属性 + * @param options 属性 + */ + setOptions(options: Polygon.Options): void; + /** + * 获取多边形的属性 + */ + getOptions(): Partial< + this extends Omit ? Ellipse.GetOptionsResult : + this extends Omit ? Rectangle.GetOptionsResult : + Polygon.GetOptionsResult + >; + /** + * 获取多边形的面积 + */ + getArea(): number; + /** + * 判断指定点坐标是否在多边形范围内 + * @param point 坐标 + */ + contains(point: LocationValue): boolean; + } +} diff --git a/types/amap-js-api/overlay/polyline.d.ts b/types/amap-js-api/overlay/polyline.d.ts new file mode 100644 index 0000000000..c7abfa6331 --- /dev/null +++ b/types/amap-js-api/overlay/polyline.d.ts @@ -0,0 +1,119 @@ +declare namespace AMap { + namespace Polyline { + interface EventMap extends PathOverlay.EventMap { } + interface GetOptionsResult extends ShapeOverlay.GetOptionsResult { + /** + * 线条是否带描边 + */ + isOutline: boolean; + /** + * 线条描边颜色 + */ + outlineColor: string; + /** + * 是否绘制成大地线 + */ + geodesic: boolean; + /** + * 折线的节点数组 + */ + path: LngLat[]; + /** + * 折线拐点的绘制样式 + */ + lineJoin: StrokeLineJoin; + /** + * 折线两端线帽的绘制样式 + */ + lineCap: StrokeLineCap; + /** + * 描边的宽度 + */ + borderWeight: number; + /** + * 是否延路径显示方向箭头 + */ + showDir: boolean; + /** + * 方向箭头颜色 + */ + dirColor: string; + /** + * 方向箭头图片 + */ + dirImg: string; + } + + interface Options extends PathOverlay.Options { + /** + * 线条是否带描边 + */ + isOutline?: boolean; + /** + * 线条描边颜色 + */ + outlineColor?: string; + /** + * 是否绘制成大地线 + */ + geodesic?: boolean; + /** + * 方向箭头颜色 + */ + dirColor?: string; + /** + * 描边的宽度 + */ + borderWeight?: number; + /** + * 是否延路径显示方向箭头 + */ + showDir?: boolean; + + // internal + /** + * 折线的节点数组 + */ + path?: LocationValue[]; + } + } + + class Polyline extends PathOverlay { + /** + * 折线 + * @param options 选项 + */ + constructor(options?: BezierCurve.Options | Polyline.Options); + /** + * 设置组成该折线的节点数组 + * @param path 节点数组 + */ + setPath( + path: this extends Omit ? + Array>> + : LocationValue[] + ): void; + /** + * 获取折线路径的节点数组 + */ + getPath(): this extends Omit ? + Array + : LngLat[]; + /** + * 获取折线的总长度(单位:米) + */ + getLength(): number; + /** + * 设置线的属性 + * @param options 属性 + */ + setOptions(options: this extends Omit ? + Partial> + : Polyline.Options + ): void; + /** + * 获取线的属性 + */ + getOptions(): Partial>; + } +} diff --git a/types/amap-js-api/overlay/rectangle.d.ts b/types/amap-js-api/overlay/rectangle.d.ts new file mode 100644 index 0000000000..833a46d3dc --- /dev/null +++ b/types/amap-js-api/overlay/rectangle.d.ts @@ -0,0 +1,43 @@ +declare namespace AMap { + namespace Rectangle { + interface EventMap extends Polygon.EventMap { + setBounds: Event<'setBounds'>; + } + + interface Options extends Polygon.Options { + /** + * 矩形的范围 + */ + bounds?: Bounds; + } + type GetOptionsResult = Merge, { + /** + * 路径节点数组 + */ + path: LngLat[]; + /** + * 矩形的范围 + */ + bounds: Bounds; + texture: string; + }>; + } + class Rectangle extends Polygon { + /** + * 矩形 + * @param options 选项 + */ + constructor(options?: Rectangle.Options); + /** + * 获取矩形范围 + * @param bounds 矩形的范围 + * @param preventEvent 阻止触发事件 + */ + setBounds(bounds: Bounds, preventEvent?: boolean): void; + /** + * 修改矩形属性 + * @param options 属性 + */ + setOptions(options: Partial): void; + } +} diff --git a/types/amap-js-api/overlay/shapeOverlay.d.ts b/types/amap-js-api/overlay/shapeOverlay.d.ts new file mode 100644 index 0000000000..ab07fa3d88 --- /dev/null +++ b/types/amap-js-api/overlay/shapeOverlay.d.ts @@ -0,0 +1,80 @@ +declare namespace AMap { + namespace ShapeOverlay { + interface EventMap extends Overlay.EventMap { + show: Event<'show', { target: I }>; + hide: Event<'hide', { target: I }>; + options: Event<'options'>; + change: Event<'change', { target: I }>; + } + interface GetOptionsResult { + /** + * 所属地图 + */ + map: Map; + /** + * 层级 + */ + zIndex: number; + /** + * 线条颜色 + */ + strokeColor: string; + /** + * 线条透明度 + */ + strokeOpacity: number; + /** + * 线条宽度 + */ + strokeWeight: number; + /** + * 线条样式,虚线或者实线 + */ + strokeStyle: StrokeStyle; + /** + * 虚线的分段 + */ + strokeDasharray: number[]; + /** + * 自定义属性 + */ + extData: ExtraData | {}; + /** + * 事件是否穿透到地图 + */ + bubble: boolean; + /** + * 是否支持点击 + */ + clickable: boolean; + } + } + abstract class ShapeOverlay extends Overlay { + /** + * 设置覆盖物属性 + * @param options 属性 + */ + abstract setOptions(options: {}): void; + /** + * 获得属性 + */ + abstract getOptions(): {}; + /** + * 获得层级 + */ + getzIndex(): number; + /** + * 设置层级 + * @param zIndex 层级 + */ + setzIndex(zIndex: number): void; + /** + * 返回可见 + */ + getVisible(): boolean; + /** + * 设置是否可以拖拽 + */ + setDraggable(draggable: boolean): void; + } +} diff --git a/types/amap-js-api/overlay/text.d.ts b/types/amap-js-api/overlay/text.d.ts new file mode 100644 index 0000000000..50f9249ad9 --- /dev/null +++ b/types/amap-js-api/overlay/text.d.ts @@ -0,0 +1,41 @@ +declare namespace AMap { + namespace Text { + type TextAlign = 'left' | 'right' | 'center'; + type VerticalAlign = 'top' | 'middle' | 'bottom'; + interface EventMap extends Marker.EventMap { } + interface Options extends Marker.Options { + /** + * 文本内容 + */ + text?: string; + /** + * 对齐方式 + */ + textAlign?: TextAlign; + + verticalAlign?: VerticalAlign; + } + } + + class Text extends Marker { + /** + * 纯文本标记 + * @param options 选项 + */ + constructor(options?: Text.Options); + /** + * 标记显示的文本内容 + */ + getText(): string; + /** + * 修改文本内容 + * @param text 文本内容 + */ + setText(text: string): void; + /** + * 设置文本样式 + * @param style 文本样式 + */ + setStyle(style: object): void; + } +} diff --git a/types/amap-js-api/pixel.d.ts b/types/amap-js-api/pixel.d.ts new file mode 100644 index 0000000000..b211e1d88a --- /dev/null +++ b/types/amap-js-api/pixel.d.ts @@ -0,0 +1,36 @@ +declare namespace AMap { + class Pixel { + /** + * 像素坐标,确定地图上的一个像素点 + * @param x 横轴坐标 + * @param y 纵轴坐标 + * @param round 是否四舍五入 + */ + constructor(x: number, y: number, round?: boolean); + /** + * 获得X方向像素坐标 + */ + getX(): number; + /** + * 获得Y方向像素坐标 + */ + getY(): number; + /** + * 当前像素坐标与传入像素坐标是否相等 + * @param point 目标像素坐标 + */ + equals(point: Pixel): boolean; + /** + * 以字符串形式返回像素坐标对象 + */ + toString(): string; + + // internal + add(offset: {x: number; y: number}, round?: boolean): Pixel; + round(): Pixel; + floor(): Pixel; + length(): number; + direction(): null | number; + toFixed(decimals?: number): this; + } +} diff --git a/types/amap-js-api/size.d.ts b/types/amap-js-api/size.d.ts new file mode 100644 index 0000000000..f13c2fff0b --- /dev/null +++ b/types/amap-js-api/size.d.ts @@ -0,0 +1,25 @@ +declare namespace AMap { + class Size { + /** + * 地物对象的像素尺寸 + * @param width 宽度像素 + * @param height 长度像素 + */ + constructor(width: number, height: number); + /** + * 获得宽度 + */ + getWidth(): number; + /** + * 获得高度 + */ + getHeight(): number; + /** + * 以字符串形式返回尺寸大小对象 + */ + toString(): string; + + // internal + contains(size: { x: number; y: number }): boolean; + } +} diff --git a/types/amap-js-api/tsconfig.json b/types/amap-js-api/tsconfig.json new file mode 100644 index 0000000000..a26facba9e --- /dev/null +++ b/types/amap-js-api/tsconfig.json @@ -0,0 +1,66 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noEmit": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "forceConsistentCasingInFileNames": true + }, + "files": [ + "array-bounds.d.ts", + "bounds.d.ts", + "browser.d.ts", + "common.d.ts", + "convert-from.d.ts", + "dom-util.d.ts", + "event.d.ts", + "geometry-util.d.ts", + "index.d.ts", + "layer/building.d.ts", + "layer/flexible.d.ts", + "layer/layer.d.ts", + "layer/layerGroup.d.ts", + "layer/massMarks.d.ts", + "layer/mediaLayer.d.ts", + "layer/tileLayer.d.ts", + "layer/wms.d.ts", + "layer/wmts.d.ts", + "lngLat.d.ts", + "map.d.ts", + "overlay/bezierCurve.d.ts", + "overlay/circle.d.ts", + "overlay/circleMarker.d.ts", + "overlay/contextMenu.d.ts", + "overlay/ellipse.d.ts", + "overlay/geoJSON.d.ts", + "overlay/icon.d.ts", + "overlay/infoWindow.d.ts", + "overlay/marker.d.ts", + "overlay/markerShape.d.ts", + "overlay/overlay.d.ts", + "overlay/overlayGroup.d.ts", + "overlay/pathOverlay.d.ts", + "overlay/polygon.d.ts", + "overlay/polyline.d.ts", + "overlay/rectangle.d.ts", + "overlay/shapeOverlay.d.ts", + "overlay/text.d.ts", + "pixel.d.ts", + "size.d.ts", + "type-util.d.ts", + "util.d.ts", + "view2D.d.ts", + "amap-js-api-tests.ts" + ] +} diff --git a/types/screenfull/tslint.json b/types/amap-js-api/tslint.json similarity index 100% rename from types/screenfull/tslint.json rename to types/amap-js-api/tslint.json diff --git a/types/amap-js-api/type-util.d.ts b/types/amap-js-api/type-util.d.ts new file mode 100644 index 0000000000..1ced3d69c1 --- /dev/null +++ b/types/amap-js-api/type-util.d.ts @@ -0,0 +1,12 @@ +type Omit = { + [K in Exclude]: T[K] +}; + +type OptionalKey = { [K in keyof T]-?: undefined extends T[K] ? K : never }[keyof T]; +// type OmitUndefined = Omit; +// type PickUndefined = Omit>; + +type Merge = + { [K in Exclude>]-?: O[K]; } & + { [K in Extract, OptionalKey>]?: O[K]; } & + T; diff --git a/types/amap-js-api/util.d.ts b/types/amap-js-api/util.d.ts new file mode 100644 index 0000000000..ee275d66b5 --- /dev/null +++ b/types/amap-js-api/util.d.ts @@ -0,0 +1,76 @@ +declare namespace AMap { + namespace Util { + /** + * 将颜色名转换为16进制RGB颜色值 + * @param colorName 颜色名 + */ + function colorNameToHex(colorName: string): string; + /** + * 将16进制RGB转为rgba(R,G,B,A) + * @param hex 16进制RGB + */ + function rgbHex2Rgba(hex: string): string; + /** + * 将16进制RGBA转为rgba(R,G,B,A) + * @param hex 16进制RGBA + */ + function argbHex2Rgba(hex: string): string; + /** + * 判断一个对象是都为空 + * @param obj 目标对象 + */ + function isEmpty(obj: object): boolean; + /** + * 从数组删除元素 + * @param array 数组 + * @param item 元素 + */ + function deleteItemFromArray(array: T[], item: T): T[]; + /** + * 按索引删除数组元素 + * @param array 数组 + * @param index 索引 + */ + function deleteItemFromArrayByIndex(array: T[], index: number): T[]; + /** + * 返回元素索引 + * @param array 数组 + * @param item 元素 + */ + function indexOf(array: T[], item: T): number; + /** + * 保留小数点后指定位 + * @param floatNumber 数值 + * @param digits 小数点位数 + */ + function format(floatNumber: number, digits?: number): number; + /** + * 判断是否数组 + * @param data 判断对象 + */ + function isArray(data: any): data is any[]; + /** + * 判断参数是否为DOM元素 + * @param data 判断对象 + */ + function isDOM(data: any): data is HTMLElement; + /** + * 判断数组是否包含某个元素 + * @param array 数组 + * @param item 元素 + */ + function includes(array: T[], item: T): boolean; + + function requestIdleCallback(callback: (...args: any[]) => any, options?: { timeout?: number }): number; + + function cancelIdleCallback(handle: number): void; + + function requestAnimFrame(callback: (this: C, ...args: any[]) => any, context?: C): number; + + function cancelAnimFrame(handle: number): void; + + function color2RgbaArray(color: string | number[]): [number, number, number, number]; + + function color2Rgba(color: string | number[]): string; + } +} diff --git a/types/amap-js-api/view2D.d.ts b/types/amap-js-api/view2D.d.ts new file mode 100644 index 0000000000..f246c5c67f --- /dev/null +++ b/types/amap-js-api/view2D.d.ts @@ -0,0 +1,29 @@ +declare namespace AMap { + namespace View2D { + interface Options { + /** + * 地图中心点坐标值 + */ + center?: LocationValue; + /** + * 地图顺时针旋转角度 + */ + rotation?: number; + /** + * 地图显示的缩放级别 + */ + zoom?: number; + /** + * 地图显示的参考坐标系 + */ + crs?: 'EPGS3857' | 'EPGS3395' | 'EPGS4326'; + } + } + class View2D extends EventEmitter { + /** + * 二维地图显示视口,用于定义二维地图静态显示属性 + * @param options 选项 + */ + constructor(options?: View2D.Options); + } +} diff --git a/types/amazon-product-api/tslint.json b/types/amazon-product-api/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/amazon-product-api/tslint.json +++ b/types/amazon-product-api/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/amplitude-js/tslint.json b/types/amplitude-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/amplitude-js/tslint.json +++ b/types/amplitude-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/amqp-rpc/tslint.json b/types/amqp-rpc/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/amqp-rpc/tslint.json +++ b/types/amqp-rpc/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/amqplib/amqplib-tests.ts b/types/amqplib/amqplib-tests.ts index ef448d5b36..a42d2f717d 100644 --- a/types/amqplib/amqplib-tests.ts +++ b/types/amqplib/amqplib-tests.ts @@ -14,6 +14,14 @@ amqp.connect('amqp://localhost') amqp.connect('amqp://localhost') .then(connection => { + connection.serverProperties.copyright; // $ExpectType string | undefined + connection.serverProperties.platform; // $ExpectType string + connection.serverProperties.information; // $ExpectType string + connection.serverProperties.host; // $ExpectType string + connection.serverProperties.product; // $ExpectType string + connection.serverProperties.version; // $ExpectType string + connection.serverProperties.customField; // $ExpectType string | undefined + return connection.createChannel() .tap(channel => channel.checkQueue('myQueue')) .then(channel => { @@ -37,6 +45,14 @@ import amqpcb = require('amqplib/callback_api'); amqpcb.connect('amqp://localhost', (err, connection) => { if (!err) { + connection.serverProperties.copyright; // $ExpectType string | undefined + connection.serverProperties.platform; // $ExpectType string + connection.serverProperties.information; // $ExpectType string + connection.serverProperties.host; // $ExpectType string + connection.serverProperties.product; // $ExpectType string + connection.serverProperties.version; // $ExpectType string + connection.serverProperties.customField; // $ExpectType string | undefined + connection.createChannel((err, channel) => { if (!err) { channel.assertQueue('myQueue', {}, (err, ok) => { diff --git a/types/amqplib/callback_api.d.ts b/types/amqplib/callback_api.d.ts index 9fca3972e4..56842abc26 100644 --- a/types/amqplib/callback_api.d.ts +++ b/types/amqplib/callback_api.d.ts @@ -1,11 +1,12 @@ import events = require('events'); -import { Replies, Options, Message } from './properties'; +import { Replies, Options, Message, ServerProperties } from './properties'; export * from './properties'; export interface Connection extends events.EventEmitter { close(callback?: (err: any) => void): void; createChannel(callback: (err: any, channel: Channel) => void): void; createConfirmChannel(callback: (err: any, confirmChannel: ConfirmChannel) => void): void; + serverProperties: ServerProperties; } export interface Channel extends events.EventEmitter { diff --git a/types/amqplib/index.d.ts b/types/amqplib/index.d.ts index 7087d74edc..77e5d19ca9 100644 --- a/types/amqplib/index.d.ts +++ b/types/amqplib/index.d.ts @@ -8,13 +8,14 @@ import * as Promise from 'bluebird'; import * as events from 'events'; -import { Replies, Options, Message, GetMessage, ConsumeMessage } from './properties'; +import { Replies, Options, Message, GetMessage, ConsumeMessage, ServerProperties } from './properties'; export * from './properties'; export interface Connection extends events.EventEmitter { close(): Promise; createChannel(): Promise; createConfirmChannel(): Promise; + serverProperties: ServerProperties; } export interface Channel extends events.EventEmitter { diff --git a/types/amqplib/properties.d.ts b/types/amqplib/properties.d.ts index 97dc8ac393..4c7a210c6f 100644 --- a/types/amqplib/properties.d.ts +++ b/types/amqplib/properties.d.ts @@ -210,3 +210,13 @@ export interface XDeath { "original-expiration"?: any; "routing-keys": string[]; } + +export interface ServerProperties { + host: string; + product: string; + version: string; + platform: string; + copyright?: string; + information: string; + [key: string]: string | undefined; +} diff --git a/types/angular-agility/tslint.json b/types/angular-agility/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/angular-agility/tslint.json +++ b/types/angular-agility/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-animate/tslint.json b/types/angular-animate/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-animate/tslint.json +++ b/types/angular-animate/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-bootstrap-calendar/tslint.json b/types/angular-bootstrap-calendar/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-bootstrap-calendar/tslint.json +++ b/types/angular-bootstrap-calendar/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-bootstrap-lightbox/tslint.json b/types/angular-bootstrap-lightbox/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/angular-bootstrap-lightbox/tslint.json +++ b/types/angular-bootstrap-lightbox/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-breadcrumb/tslint.json b/types/angular-breadcrumb/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-breadcrumb/tslint.json +++ b/types/angular-breadcrumb/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-clipboard/tslint.json b/types/angular-clipboard/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-clipboard/tslint.json +++ b/types/angular-clipboard/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-cookie/tslint.json b/types/angular-cookie/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-cookie/tslint.json +++ b/types/angular-cookie/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-cookies/tslint.json b/types/angular-cookies/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-cookies/tslint.json +++ b/types/angular-cookies/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-deferred-bootstrap/tslint.json b/types/angular-deferred-bootstrap/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-deferred-bootstrap/tslint.json +++ b/types/angular-deferred-bootstrap/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-dialog-service/tslint.json b/types/angular-dialog-service/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-dialog-service/tslint.json +++ b/types/angular-dialog-service/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-dynamic-locale/tslint.json b/types/angular-dynamic-locale/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-dynamic-locale/tslint.json +++ b/types/angular-dynamic-locale/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-environment/tslint.json b/types/angular-environment/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-environment/tslint.json +++ b/types/angular-environment/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-es/tslint.json b/types/angular-es/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-es/tslint.json +++ b/types/angular-es/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-feature-flags/tslint.json b/types/angular-feature-flags/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-feature-flags/tslint.json +++ b/types/angular-feature-flags/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-file-saver/tslint.json b/types/angular-file-saver/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-file-saver/tslint.json +++ b/types/angular-file-saver/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-formly/index.d.ts b/types/angular-formly/index.d.ts index 55c4743fc9..0e73056eaf 100644 --- a/types/angular-formly/index.d.ts +++ b/types/angular-formly/index.d.ts @@ -83,9 +83,10 @@ declare namespace AngularFormly { } interface ISelectOption { - name: string; + name?: string; value?: string; group?: string; + [key: string]: any; } /** @@ -149,14 +150,37 @@ declare namespace AngularFormly { */ interface IWatcher { deep?: boolean; //Defaults to false - expression?: string | { (field: string, scope: ITemplateScope): boolean }; - listener: (field: string, newValue: any, oldValue: any, scope: ITemplateScope, stopWatching: Function) => void; + expression?: string | { (field: IFieldRuntimeObject, scope: ITemplateScope): boolean }; + listener: (field: IFieldRuntimeObject, newValue: any, oldValue: any, scope: ITemplateScope, stopWatching: Function) => void; type?: string; //Defaults to $watch but can be set to $watchCollection or $watchGroup } + interface IFieldRuntimeObject extends IFieldObject { + model: { + [key: string]: any; + }; + } + + interface IFieldConfigurationObject extends IFieldObject { + /** + * By default, the model passed to the formly-field directive is the same as the model passed to the + * formly-form. However, if the field has a model specified, then it is used for that field (and that + * field only). In addition, a deep watch is added to the formly-field directive's scope to run the + * expressionProperties when the specified model changes. + * + * Note, the formly-form directive will allow you to specify a string which is an (almost) formly + * expression which allows you to define the model as relative to the scope of the form. + * + * see http://docs.angular-formly.com/docs/field-configuration-object#model-object--string + */ + model?: string | { + [key: string]: any; + }; + } + // see http://docs.angular-formly.com/docs/field-configuration-object - interface IFieldConfigurationObject { + interface IFieldObject { /** @@ -279,22 +303,6 @@ declare namespace AngularFormly { link?: ng.IDirectiveLinkFn; - /** - * By default, the model passed to the formly-field directive is the same as the model passed to the - * formly-form. However, if the field has a model specified, then it is used for that field (and that - * field only). In addition, a deep watch is added to the formly-field directive's scope to run the - * expressionProperties when the specified model changes. - * - * Note, the formly-form directive will allow you to specify a string which is an (almost) formly - * expression which allows you to define the model as relative to the scope of the form. - * - * see http://docs.angular-formly.com/docs/field-configuration-object#model-object--string - */ - model?: string | { - [key: string]: any; - }; - - /** * Allows you to take advantage of ng-model-options directive. Formly's built-in templateManipulator (see * below) will add this attribute to your ng-model element automatically if this property exists. Note, @@ -617,7 +625,7 @@ declare namespace AngularFormly { //The index of the field the form is on (in ng-repeat) index: number; //the model of the form (or the model specified by the field if it was specified). - model?: string | { + model?: { [key: string]: any; }; //Shortcut to options.validation.errorExistsAndShouldBeVisible diff --git a/types/angular-formly/tslint.json b/types/angular-formly/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-formly/tslint.json +++ b/types/angular-formly/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-fullscreen/tslint.json b/types/angular-fullscreen/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-fullscreen/tslint.json +++ b/types/angular-fullscreen/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-gettext/tslint.json b/types/angular-gettext/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-gettext/tslint.json +++ b/types/angular-gettext/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-google-analytics/tslint.json b/types/angular-google-analytics/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-google-analytics/tslint.json +++ b/types/angular-google-analytics/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-growl-v2/tslint.json b/types/angular-growl-v2/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-growl-v2/tslint.json +++ b/types/angular-growl-v2/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-http-auth/tslint.json b/types/angular-http-auth/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-http-auth/tslint.json +++ b/types/angular-http-auth/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-httpi/tslint.json b/types/angular-httpi/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-httpi/tslint.json +++ b/types/angular-httpi/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-idle/tslint.json b/types/angular-idle/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-idle/tslint.json +++ b/types/angular-idle/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-jwt/tslint.json b/types/angular-jwt/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-jwt/tslint.json +++ b/types/angular-jwt/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-load/tslint.json b/types/angular-load/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-load/tslint.json +++ b/types/angular-load/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-loading-bar/tslint.json b/types/angular-loading-bar/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-loading-bar/tslint.json +++ b/types/angular-loading-bar/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-local-storage/tslint.json b/types/angular-local-storage/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-local-storage/tslint.json +++ b/types/angular-local-storage/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-localforage/tslint.json b/types/angular-localforage/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-localforage/tslint.json +++ b/types/angular-localforage/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-locker/tslint.json b/types/angular-locker/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/angular-locker/tslint.json +++ b/types/angular-locker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-media-queries/tslint.json b/types/angular-media-queries/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-media-queries/tslint.json +++ b/types/angular-media-queries/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-meteor/tslint.json b/types/angular-meteor/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/angular-meteor/tslint.json +++ b/types/angular-meteor/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-modal/tslint.json b/types/angular-modal/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-modal/tslint.json +++ b/types/angular-modal/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-notifications/tslint.json b/types/angular-notifications/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-notifications/tslint.json +++ b/types/angular-notifications/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-notify/tslint.json b/types/angular-notify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-notify/tslint.json +++ b/types/angular-notify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-odata-resources/tslint.json b/types/angular-odata-resources/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/angular-odata-resources/tslint.json +++ b/types/angular-odata-resources/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-permission/tslint.json b/types/angular-permission/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-permission/tslint.json +++ b/types/angular-permission/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-promise-tracker/tslint.json b/types/angular-promise-tracker/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-promise-tracker/tslint.json +++ b/types/angular-promise-tracker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-q-spread/tslint.json b/types/angular-q-spread/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-q-spread/tslint.json +++ b/types/angular-q-spread/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-route/tslint.json b/types/angular-route/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-route/tslint.json +++ b/types/angular-route/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-sanitize/tslint.json b/types/angular-sanitize/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-sanitize/tslint.json +++ b/types/angular-sanitize/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-scenario/tslint.json b/types/angular-scenario/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-scenario/tslint.json +++ b/types/angular-scenario/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-scroll/tslint.json b/types/angular-scroll/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-scroll/tslint.json +++ b/types/angular-scroll/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-signalr-hub/tslint.json b/types/angular-signalr-hub/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-signalr-hub/tslint.json +++ b/types/angular-signalr-hub/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-spinner/tslint.json b/types/angular-spinner/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-spinner/tslint.json +++ b/types/angular-spinner/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-storage/tslint.json b/types/angular-storage/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-storage/tslint.json +++ b/types/angular-storage/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-toastr/tslint.json b/types/angular-toastr/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-toastr/tslint.json +++ b/types/angular-toastr/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-toasty/tslint.json b/types/angular-toasty/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-toasty/tslint.json +++ b/types/angular-toasty/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-translate/tslint.json b/types/angular-translate/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-translate/tslint.json +++ b/types/angular-translate/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-ui-bootstrap/tslint.json b/types/angular-ui-bootstrap/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-ui-bootstrap/tslint.json +++ b/types/angular-ui-bootstrap/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-ui-notification/tslint.json b/types/angular-ui-notification/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-ui-notification/tslint.json +++ b/types/angular-ui-notification/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-ui-router/tslint.json b/types/angular-ui-router/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-ui-router/tslint.json +++ b/types/angular-ui-router/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-ui-scroll/tslint.json b/types/angular-ui-scroll/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-ui-scroll/tslint.json +++ b/types/angular-ui-scroll/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-ui-sortable/tslint.json b/types/angular-ui-sortable/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-ui-sortable/tslint.json +++ b/types/angular-ui-sortable/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-ui-tree/tslint.json b/types/angular-ui-tree/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/angular-ui-tree/tslint.json +++ b/types/angular-ui-tree/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-wizard/tslint.json b/types/angular-wizard/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/angular-wizard/tslint.json +++ b/types/angular-wizard/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular-xeditable/tslint.json b/types/angular-xeditable/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular-xeditable/tslint.json +++ b/types/angular-xeditable/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angular.throttle/tslint.json b/types/angular.throttle/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angular.throttle/tslint.json +++ b/types/angular.throttle/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angularfire/tslint.json b/types/angularfire/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/angularfire/tslint.json +++ b/types/angularfire/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angularlocalstorage/tslint.json b/types/angularlocalstorage/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angularlocalstorage/tslint.json +++ b/types/angularlocalstorage/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/angulartics/tslint.json b/types/angulartics/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/angulartics/tslint.json +++ b/types/angulartics/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/animation-frame/tslint.json b/types/animation-frame/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/animation-frame/tslint.json +++ b/types/animation-frame/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/animejs/animejs-tests.ts b/types/animejs/animejs-tests.ts index 697c79f738..8ed6fccf8e 100644 --- a/types/animejs/animejs-tests.ts +++ b/types/animejs/animejs-tests.ts @@ -1,4 +1,4 @@ -import * as anime from 'animejs'; +import anime from 'animejs'; const test1 = anime({ targets: 'div', @@ -17,9 +17,9 @@ const test2 = anime({ }, translateY: '40px', color: [ - {value: '#FF0000', duration: 2000}, - {value: '#00FF00', duration: 2000}, - {value: '#0000FF', duration: 2000}, + { value: '#FF0000', duration: 2000 }, + { value: '#00FF00', duration: 2000 }, + { value: '#0000FF', duration: 2000 }, ], duration: () => { return 1000000000000; @@ -69,3 +69,9 @@ const bezier = anime.bezier(0, 0, 100, 100); anime.easings['hello'] = anime.bezier(0, 0, 1900, 3020); const runningAnims = anime.running; anime.remove(".tiny-divvy-div"); + +anime.timeline().add({ + targets: [], + duration: 1000, + easing: "linear", +}, 0); diff --git a/types/animejs/index.d.ts b/types/animejs/index.d.ts index 069187b15e..607872039f 100644 --- a/types/animejs/index.d.ts +++ b/types/animejs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for animejs 2.0 // Project: http://animejs.com -// Definitions by: Andrew Babin +// Definitions by: Andrew Babin +// supaiku0 // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -110,7 +111,7 @@ declare namespace anime { } interface AnimeTimelineInstance extends AnimeInstance { - add(params: AnimeAnimParams): AnimeTimelineInstance; + add(params: AnimeAnimParams, timelineOffset?: string | number): AnimeTimelineInstance; } // Helpers diff --git a/types/animejs/tsconfig.json b/types/animejs/tsconfig.json index 02c5552371..9ed0aa7d69 100644 --- a/types/animejs/tsconfig.json +++ b/types/animejs/tsconfig.json @@ -14,6 +14,7 @@ "../" ], "types": [], + "allowSyntheticDefaultImports": true, "noEmit": true, "forceConsistentCasingInFileNames": true }, diff --git a/types/ansi-escapes/index.d.ts b/types/ansi-escapes/index.d.ts index 519d429545..d01e74661a 100644 --- a/types/ansi-escapes/index.d.ts +++ b/types/ansi-escapes/index.d.ts @@ -19,10 +19,10 @@ declare namespace Ansi { interface AnsiEscapes { cursorTo(x: number, y?: number): string; cursorMove(x: number, y?: number): string; - cursorUp(count: number): string; - cursorDown(count: number): string; - cursorForward(count: number): string; - cursorBackward(count: number): string; + cursorUp(count?: number): string; + cursorDown(count?: number): string; + cursorForward(count?: number): string; + cursorBackward(count?: number): string; cursorLeft: string; cursorSavePosition: string; diff --git a/types/ansi-styles/tslint.json b/types/ansi-styles/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ansi-styles/tslint.json +++ b/types/ansi-styles/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ansicolors/tslint.json b/types/ansicolors/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ansicolors/tslint.json +++ b/types/ansicolors/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/any-db-transaction/tslint.json b/types/any-db-transaction/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/any-db-transaction/tslint.json +++ b/types/any-db-transaction/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/any-db/tslint.json b/types/any-db/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/any-db/tslint.json +++ b/types/any-db/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/aphrodite/tslint.json b/types/aphrodite/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/aphrodite/tslint.json +++ b/types/aphrodite/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/api-error-handler/tslint.json b/types/api-error-handler/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/api-error-handler/tslint.json +++ b/types/api-error-handler/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/apigee-access/tslint.json b/types/apigee-access/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/apigee-access/tslint.json +++ b/types/apigee-access/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/app-root-path/tslint.json b/types/app-root-path/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/app-root-path/tslint.json +++ b/types/app-root-path/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/appframework/tslint.json b/types/appframework/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/appframework/tslint.json +++ b/types/appframework/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/appletvjs/tslint.json b/types/appletvjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/appletvjs/tslint.json +++ b/types/appletvjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/arbiter/tslint.json b/types/arbiter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/arbiter/tslint.json +++ b/types/arbiter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/arcgis-js-api/tslint.json b/types/arcgis-js-api/tslint.json index e3610fefae..89955128d5 100644 --- a/types/arcgis-js-api/tslint.json +++ b/types/arcgis-js-api/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/archiver/index.d.ts b/types/archiver/index.d.ts index a9cafca24b..a25b018c11 100644 --- a/types/archiver/index.d.ts +++ b/types/archiver/index.d.ts @@ -41,6 +41,8 @@ declare namespace archiver { class ArchiverError extends Error { code: string; // Since archiver format support is modular, we cannot enumerate all possible error codes, as the modules can throw arbitrary ones. data: any; + path?: any; + constructor(code: string, data: any); } diff --git a/types/archy/tslint.json b/types/archy/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/archy/tslint.json +++ b/types/archy/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/argv/tslint.json b/types/argv/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/argv/tslint.json +++ b/types/argv/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/array-foreach/tslint.json b/types/array-foreach/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/array-foreach/tslint.json +++ b/types/array-foreach/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/asana/tslint.json b/types/asana/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/asana/tslint.json +++ b/types/asana/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/asciify/tslint.json b/types/asciify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/asciify/tslint.json +++ b/types/asciify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/asn1js/tslint.json b/types/asn1js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/asn1js/tslint.json +++ b/types/asn1js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/aspnet-identity-pw/tslint.json b/types/aspnet-identity-pw/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/aspnet-identity-pw/tslint.json +++ b/types/aspnet-identity-pw/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/assertsharp/tslint.json b/types/assertsharp/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/assertsharp/tslint.json +++ b/types/assertsharp/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/async-polling/tslint.json b/types/async-polling/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/async-polling/tslint.json +++ b/types/async-polling/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/async-writer/tslint.json b/types/async-writer/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/async-writer/tslint.json +++ b/types/async-writer/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/atmosphere.js/tslint.json b/types/atmosphere.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/atmosphere.js/tslint.json +++ b/types/atmosphere.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/atob/atob-tests.ts b/types/atob/atob-tests.ts index e2e2618387..e9ec4589a5 100644 --- a/types/atob/atob-tests.ts +++ b/types/atob/atob-tests.ts @@ -1,3 +1,3 @@ -import atob from 'atob'; +import atob = require('atob'); atob('foo'); diff --git a/types/atob/index.d.ts b/types/atob/index.d.ts index 1feb3481e8..0da09c74b5 100644 --- a/types/atob/index.d.ts +++ b/types/atob/index.d.ts @@ -4,4 +4,5 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 -export default function(str: string): string; +export = _default; +declare function _default(str: string): string; diff --git a/types/atpl/tslint.json b/types/atpl/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/atpl/tslint.json +++ b/types/atpl/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/auth-header/index.d.ts b/types/auth-header/index.d.ts index fab462be9e..d5b5a27f77 100644 --- a/types/auth-header/index.d.ts +++ b/types/auth-header/index.d.ts @@ -7,7 +7,7 @@ type Params = | Array<[string, string | ReadonlyArray]> | {[key: string]: string | ReadonlyArray}; -export {Params}; +export { Params }; export interface TokenOptions { scheme: string; diff --git a/types/auth0-angular/tslint.json b/types/auth0-angular/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/auth0-angular/tslint.json +++ b/types/auth0-angular/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/auth0.widget/tslint.json b/types/auth0.widget/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/auth0.widget/tslint.json +++ b/types/auth0.widget/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/auth0/tslint.json b/types/auth0/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/auth0/tslint.json +++ b/types/auth0/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/autobahn/autobahn-tests.ts b/types/autobahn/autobahn-tests.ts index 8f05c25141..420d95a3d1 100644 --- a/types/autobahn/autobahn-tests.ts +++ b/types/autobahn/autobahn-tests.ts @@ -46,4 +46,31 @@ function test_client() { if (!connection.isOpen && !connection.isRetrying && connection.session == null) { connection.open(); } + + var { isConnected, transport: { info: { protocol, type, url } }, defer } = connection; + console.log(isConnected, protocol, type, url, defer); +} + +function test_custom_transport_factory() { + autobahn.transports.register('custom', CustomTransportFactory) + + var CustomFactoryFactory = autobahn.transports.get(''); + var customFactory = new CustomFactoryFactory({}); + var customTransport = customFactory.create() + console.log(customTransport.info); +} + +class CustomTransportFactory { + create(): autobahn.ITransport { + return { + onopen() {}, + onmessage(message: any[]) {}, + onclose(details: autobahn.ICloseEventDetails) {}, + send(message: any[]) {}, + close(errorCode: number, reason?: string) {}, + info: {type: 'custom'} + }; + } + + type: autobahn.TransportType = 'custom' } diff --git a/types/autobahn/index.d.ts b/types/autobahn/index.d.ts index 9c1d66fb85..cfa07c3518 100644 --- a/types/autobahn/index.d.ts +++ b/types/autobahn/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for AutobahnJS 0.9 -// Project: http://autobahn.ws/js/, https://github.com/crossbario/autobahn-js -// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino , Mathias Teier +// Type definitions for AutobahnJS 18.10 +// Project: https://crossbar.io/autobahn/, https://github.com/crossbario/autobahn-js +// Definitions by: Elad Zelingher , Andy Hawkins , Wladimir Totino , Mathias Teier , Fran Rodriguez // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// @@ -190,9 +190,12 @@ declare namespace autobahn { export class Connection { constructor(options?: IConnectionOptions); - isOpen: boolean; - isRetrying: boolean; - session?: Session; + readonly isConnected: boolean; + readonly isOpen: boolean; + readonly isRetrying: boolean; + readonly transport: ITransport; + readonly session?: Session; + readonly defer?: DeferFactory; open(): void; @@ -205,7 +208,7 @@ declare namespace autobahn { interface ITransportDefinition { url?: string; protocols?: string[]; - type: string; + type: TransportType; } type DeferFactory = () => When.Promise; @@ -226,7 +229,7 @@ declare namespace autobahn { url?: string; protocols?: string[]; onchallenge?: OnChallengeHandler; - realm?: string; + realm: string; authmethods?: string[]; authid?: string; } @@ -237,6 +240,19 @@ declare namespace autobahn { code: number; } + type DefaultTransportType = 'websocket' | 'longpoll' | 'rawsocket'; + + // Workaround to get intellisense on type unions of 'literals' | string. + // See https://github.com/Microsoft/TypeScript/issues/29729 + type CustomTransportType = string & { zz_IGNORE_ME?: never }; + type TransportType = DefaultTransportType | CustomTransportType; + + interface ITransportInfo { + url?: string; + protocol?: string; + type: TransportType; + } + interface ITransport { onopen: () => void; onmessage: (message: any[]) => void; @@ -244,19 +260,23 @@ declare namespace autobahn { send(message: any[]): void; close(errorCode: number, reason?: string): void; + info: ITransportInfo; } interface ITransportFactory { - // constructor(options: any); - type: string; + type: TransportType; create(): ITransport; } + + interface ITransportFactoryFactory { + new (options: any): ITransportFactory; + } interface ITransports { - register(name: string, factory: any): void; - isRegistered(name: string): boolean; - get(name: string): any; - list(): string[]; + register(name: TransportType, factory: ITransportFactoryFactory): void; + isRegistered(name: TransportType): boolean; + get(name: TransportType): ITransportFactoryFactory; + list(): TransportType[]; } interface ILog { diff --git a/types/autolinker/tslint.json b/types/autolinker/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/autolinker/tslint.json +++ b/types/autolinker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/autoprefixer-core/tslint.json b/types/autoprefixer-core/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/autoprefixer-core/tslint.json +++ b/types/autoprefixer-core/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/avoscloud-sdk/tslint.json b/types/avoscloud-sdk/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/avoscloud-sdk/tslint.json +++ b/types/avoscloud-sdk/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/aws-iot-device-sdk/tslint.json b/types/aws-iot-device-sdk/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/aws-iot-device-sdk/tslint.json +++ b/types/aws-iot-device-sdk/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/aws-lambda/aws-lambda-tests.ts b/types/aws-lambda/aws-lambda-tests.ts index ad063c20b6..edc2015616 100644 --- a/types/aws-lambda/aws-lambda-tests.ts +++ b/types/aws-lambda/aws-lambda-tests.ts @@ -8,10 +8,14 @@ declare let num: number; declare let error: Error; declare let bool: boolean; declare let boolOrUndefined: boolean | undefined; +declare let boolOrNumOrStr: boolean | number | string; declare let numOrUndefined: number | undefined; declare let apiGwEvtReqCtx: AWSLambda.APIGatewayEventRequestContext; declare let apiGwEvtReqCtxOpt: AWSLambda.APIGatewayEventRequestContext | null | undefined; declare let apiGwEvt: AWSLambda.APIGatewayEvent; +declare let albEvtReqCtx: AWSLambda.ALBEventRequestContext; +declare let albEvt: AWSLambda.ALBEvent; +declare let albRes: AWSLambda.ALBResult; declare let customAuthorizerEvt: AWSLambda.CustomAuthorizerEvent; declare let clientCtx: AWSLambda.ClientContext; declare let clientCtxOrUndefined: AWSLambda.ClientContext | undefined; @@ -125,6 +129,27 @@ str = apiGwEvt.stageVariables!["example"]; apiGwEvtReqCtx = apiGwEvt.requestContext; str = apiGwEvt.resource; +/* Application Load Balancer Event Request Context */ +str = albEvtReqCtx.elb.targetGroupArn; + +/* Application Load Balancer Event */ +str = albEvt.httpMethod; +str = albEvt.path; +str = albEvt.queryStringParameters!["example"]; +str = albEvt.headers!["example"]; +str = albEvt.multiValueQueryStringParameters!["example"][0]; +str = albEvt.multiValueHeaders!["example"][0]; +strOrNull = albEvt.body; +bool = albEvt.isBase64Encoded; + +/* Application Load Balancer Result */ +num = albRes.statusCode; +str = albRes.statusDescription; +boolOrNumOrStr = albRes.headers!["example"]; +boolOrNumOrStr = albRes.multiValueHeaders!["example"][0]; +str = albRes.body; +bool = albRes.isBase64Encoded; + /* API Gateway CustomAuthorizer Event */ str = customAuthorizerEvt.type; str = customAuthorizerEvt.methodArn; @@ -879,6 +904,33 @@ const inferredHandler: AWSLambda.S3Handler = (event, context, cb) => { // Test using default Callback type still works. const defaultCallbackHandler: AWSLambda.APIGatewayProxyHandler = (event: AWSLambda.APIGatewayEvent, context: AWSLambda.Context, cb: AWSLambda.Callback) => { }; +const albSyncHandler: AWSLambda.ALBHandler = ( + event: AWSLambda.ALBEvent, + context: AWSLambda.Context, + cb: AWSLambda.ALBCallback, +) => { + cb(null, { + statusCode: 200, + statusDescription: '200 OK', + headers: { }, + body: '', + isBase64Encoded: false, + }); +}; +const albAsyncHandler: AWSLambda.ALBHandler = async ( + event: AWSLambda.ALBEvent, + context: AWSLambda.Context, + cb: AWSLambda.ALBCallback, +) => { + return { + statusCode: 200, + statusDescription: '200 OK', + headers: { }, + body: '', + isBase64Encoded: false, + }; +}; + // Specific types let s3Handler: AWSLambda.S3Handler = (event: AWSLambda.S3Event, context: AWSLambda.Context, cb: AWSLambda.Callback) => {}; // Test old name @@ -1003,7 +1055,15 @@ const SQSEvent: AWSLambda.SQSEvent = { SenderId: "594035263019", ApproximateFirstReceiveTimestamp: "1529104986230" }, - messageAttributes: {}, + messageAttributes: { + testAttr: { + stringValue: "100", + binaryValue: "base64Str", + stringListValues: [], + binaryListValues: [], + dataType: "Number" + } + }, md5OfBody: "9bb58f26192e4ba00f01e2e7b136bbd8", eventSource: "aws:sqs", eventSourceARN: "arn:aws:sqs:us-west-2:594035263019:NOTFIFOQUEUE", @@ -1039,6 +1099,10 @@ const SQSMessageNode8AsyncHandler: AWSLambda.SQSHandler = async ( event; str = event.Records[0].messageId; anyObj = event.Records[0].body; + strOrUndefined = event.Records[0].messageAttributes.testAttr.stringValue; + strOrUndefined = event.Records[0].messageAttributes.testAttr.binaryValue; + str = event.Records[0].messageAttributes.testAttr.dataType; + // $ExpectType Context context; str = context.functionName; diff --git a/types/aws-lambda/index.d.ts b/types/aws-lambda/index.d.ts index 6ebccd452a..72a0edabf9 100644 --- a/types/aws-lambda/index.d.ts +++ b/types/aws-lambda/index.d.ts @@ -27,6 +27,8 @@ // Erik Dalén // Loïk Gaonac'h // Roberto Zen +// Richard Cornelissen +// Grzegorz Redlicki // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 @@ -85,6 +87,24 @@ export interface APIGatewayProxyEvent { } export type APIGatewayEvent = APIGatewayProxyEvent; // Old name +// https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html +export interface ALBEventRequestContext { + elb: { + targetGroupArn: string; + }; +} +export interface ALBEvent { + requestContext: ALBEventRequestContext; + httpMethod: string; + path: string; + queryStringParameters?: { [parameter: string]: string }; // URL encoded + headers?: { [header: string]: string }; + multiValueQueryStringParameters?: { [parameter: string]: string[] }; // URL encoded + multiValueHeaders?: { [header: string]: string[] }; + body: string | null; + isBase64Encoded: boolean; +} + // API Gateway CustomAuthorizer "event" export interface CustomAuthorizerEvent { type: string; @@ -473,6 +493,15 @@ export interface APIGatewayProxyResult { } export type ProxyResult = APIGatewayProxyResult; // Old name +export interface ALBResult { + statusCode: number; + statusDescription: string; + headers?: { [header: string]: boolean | number | string }; + multiValueHeaders?: { [header: string]: Array }; + body: string; + isBase64Encoded: boolean; +} + /** * API Gateway CustomAuthorizer AuthResponse. * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output @@ -536,10 +565,10 @@ export type StatementResource = MaybeStatementPrincipal & ({ Resource: string | export type StatementPrincipal = MaybeStatementResource & ({ Principal: PrincipalValue } | { NotPrincipal: PrincipalValue }); /** * API Gateway CustomAuthorizer AuthResponse.PolicyDocument.Statement. - * http://docs.aws.amazon.com/apigateway/latest/developerguide/use-custom-authorizer.html#api-gateway-custom-authorizer-output + * https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-lambda-authorizer-output.html */ export interface AuthResponseContext { - [name: string]: any; + [name: string]: boolean | number | string; } /** @@ -878,11 +907,17 @@ export interface SQSRecordAttributes { SenderId: string; ApproximateFirstReceiveTimestamp: string; } + +export type SQSMessageAttributeDataType = 'String' | 'Number' | 'Binary' | string; + export interface SQSMessageAttribute { - Name: string; - Type: string; - Value: string; + stringValue?: string; + binaryValue?: string; + stringListValues: never[]; // Not implemented. Reserved for future use. + binaryListValues: never[]; // Not implemented. Reserved for future use. + dataType: SQSMessageAttributeDataType; } + export interface SQSMessageAttributes { [name: string]: SQSMessageAttribute; } @@ -1051,6 +1086,9 @@ export type APIGatewayProxyCallback = Callback; export type ProxyHandler = APIGatewayProxyHandler; // Old name export type ProxyCallback = APIGatewayProxyCallback; // Old name +export type ALBHandler = Handler; +export type ALBCallback = Callback; + // TODO: IoT export type CodePipelineHandler = Handler; diff --git a/types/aws4/tslint.json b/types/aws4/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/aws4/tslint.json +++ b/types/aws4/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/axe-webdriverjs/index.d.ts b/types/axe-webdriverjs/index.d.ts index 3c8ae27249..c3bf23f788 100644 --- a/types/axe-webdriverjs/index.d.ts +++ b/types/axe-webdriverjs/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for axe-webdriverjs 2.0 // Project: https://github.com/dequelabs/axe-webdriverjs#readme -// Definitions by: My Self +// Definitions by: Joshua Goldberg // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 diff --git a/types/axel/tslint.json b/types/axel/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/axel/tslint.json +++ b/types/axel/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/azure-mobile-services-client/tslint.json b/types/azure-mobile-services-client/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/azure-mobile-services-client/tslint.json +++ b/types/azure-mobile-services-client/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/azure-sb/index.d.ts b/types/azure-sb/index.d.ts index acb0bed06a..cf458d4080 100644 --- a/types/azure-sb/index.d.ts +++ b/types/azure-sb/index.d.ts @@ -4,25 +4,31 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 -export import ServiceBusService = require('./lib/servicebusservice'); -export import NotificationHubService = require('./lib/notificationhubservice'); -export import WrapService = require('./lib/wrapservice'); +export import ServiceBusService = require("./lib/servicebusservice"); +export import NotificationHubService = require("./lib/notificationhubservice"); +export import WrapService = require("./lib/wrapservice"); -export function createServiceBusService(namespaceOrConnectionString?: string, - accessKey?: string, - issuer?: string, - acsNamespace?: string, - host?: string, - authenticationProvider?: object): ServiceBusService; +export function createServiceBusService( + namespaceOrConnectionString?: string, + accessKey?: string, + issuer?: string, + acsNamespace?: string, + host?: string, + authenticationProvider?: object +): ServiceBusService; -export function createNotificationHubService(hubName: string, - endpointOrConnectionString?: string, - sharedAccessKeyName?: string, - sharedAccessKeyValue?: string): NotificationHubService; +export function createNotificationHubService( + hubName: string, + endpointOrConnectionString?: string, + sharedAccessKeyName?: string, + sharedAccessKeyValue?: string +): NotificationHubService; -export function createWrapService(acsHost: string, - issuer?: string, - accessKey?: string): WrapService; +export function createWrapService( + acsHost: string, + issuer?: string, + accessKey?: string +): WrapService; export namespace Azure.ServiceBus { export type Duration = string; @@ -33,12 +39,12 @@ export namespace Azure.ServiceBus { } export interface ReceiveQueueMessageOptions { + isPeekLock?: boolean; timeoutIntervalInS?: number; } - export interface ReceiveSubscriptionMessageOptions extends ReceiveQueueMessageOptions { - isPeekLock?: boolean; - } + export interface ReceiveSubscriptionMessageOptions + extends ReceiveQueueMessageOptions {} interface IBrokerPropertiesResponse { readonly DeliveryCount: number; @@ -150,21 +156,21 @@ export namespace Azure.ServiceBus { readonly expiredPushChannel?: string; tags?: Array; templates?: { - [name: string]: { - body: string; - headers?: any; - expiry?: string; - tags?: Array; - }; + [name: string]: { + body: string; + headers?: any; + expiry?: string; + tags?: Array; + }; }; secondaryTile?: { - [titleId: string]: { - pushChannel: string; - tags?: Array; - templates?: any; - }; + [titleId: string]: { + pushChannel: string; + tags?: Array; + templates?: any; + }; }; - } + } export interface Response { body: Dictionary; @@ -185,23 +191,23 @@ export namespace Azure.ServiceBus { export namespace Results.Models { export enum EntityStatus { - Active = 'Active', - Creating = 'Creating', - Deleting = 'Deleting', - Disabled = 'Disabled', - ReceiveDisabled = 'ReceiveDisabled', - Renaming = 'Renaming', - Restoring = 'Restoring', - SendDisabled = 'SendDisabled', - Unknown = 'Unknown' + Active = "Active", + Creating = "Creating", + Deleting = "Deleting", + Disabled = "Disabled", + ReceiveDisabled = "ReceiveDisabled", + Renaming = "Renaming", + Restoring = "Restoring", + SendDisabled = "SendDisabled", + Unknown = "Unknown" } export enum EntityAvailabilityStatus { - Available = 'Available', - Limited = 'Limited', - Renaming = 'Renaming', - Restoring = 'Restoring', - Unknown = 'Unknown' + Available = "Available", + Limited = "Limited", + Renaming = "Renaming", + Restoring = "Restoring", + Unknown = "Unknown" } interface Base { @@ -240,11 +246,12 @@ export namespace Azure.ServiceBus { // [x: string]: string | Dictionary; // } - export const ActiveMessageCount = 'd2p1:ActiveMessageCount'; - export const DeadLetterMessageCount = 'd2p1:DeadLetterMessageCount'; - export const ScheduledMessageCount = 'd2p1:ScheduledMessageCount'; - export const TransferMessageCount = 'd2p1:TransferMessageCount'; - export const TransferDeadLetterMessageCount = 'd2p1:TransferDeadLetterMessageCount'; + export const ActiveMessageCount = "d2p1:ActiveMessageCount"; + export const DeadLetterMessageCount = "d2p1:DeadLetterMessageCount"; + export const ScheduledMessageCount = "d2p1:ScheduledMessageCount"; + export const TransferMessageCount = "d2p1:TransferMessageCount"; + export const TransferDeadLetterMessageCount = + "d2p1:TransferDeadLetterMessageCount"; export interface Topic extends ExtendedBase { AccessedAt: DateString; @@ -314,31 +321,43 @@ export namespace Azure.ServiceBus { /* * Callbacks */ - export type ResponseCallback = (error: Error | null, response: Response) => void; + export type ResponseCallback = ( + error: Error | null, + response: Response + ) => void; - export type ResultAndResponseCallback = (error: Error | null, - result: boolean | Results.Models.Base | Results.Models.Base[], - response: Response) => void; + export type ResultAndResponseCallback = ( + error: Error | null, + result: boolean | Results.Models.Base | Results.Models.Base[], + response: Response + ) => void; - export type TypedResultAndResponseCallback = (error: Error | null, - result: T, - response: Response) => void; + export type TypedResultAndResponseCallback = ( + error: Error | null, + result: T, + response: Response + ) => void; /* * Options interfaces with all properties as optional */ export type BrokerProperties = Partial; - export type BrokerPropertiesResponse = IBrokerPropertiesResponse & Partial; + export type BrokerPropertiesResponse = IBrokerPropertiesResponse & + Partial; export type CreateQueueOptions = Partial; export type CreateTopicOptions = Partial; - export type CreateTopicIfNotExistsOptions = Partial; + export type CreateTopicIfNotExistsOptions = Partial< + ICreateTopicIfNotExistsOptions + >; export type CreateSubscriptionOptions = Partial; export type ListSubscriptionsOptions = Partial; export type ListRulesOptions = Partial; export type ListTopicsOptions = Partial; export type ListQueuesOptions = Partial; export type CreateRuleOptions = Partial; - export type CreateNotificationHubOptions = Partial; + export type CreateNotificationHubOptions = Partial< + ICreateNotificationHubOptions + >; export type ListNotificationHubsOptions = Partial; export type MessageOrName = Message | string; diff --git a/types/azure-sb/tslint.json b/types/azure-sb/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/azure-sb/tslint.json +++ b/types/azure-sb/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/azure/tslint.json b/types/azure/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/azure/tslint.json +++ b/types/azure/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/babel__traverse/babel__traverse-tests.ts b/types/babel__traverse/babel__traverse-tests.ts index 98a0338021..2bc5a404d6 100644 --- a/types/babel__traverse/babel__traverse-tests.ts +++ b/types/babel__traverse/babel__traverse-tests.ts @@ -1,17 +1,15 @@ -import traverse, { Visitor } from "@babel/traverse"; +import traverse, { Visitor, NodePath } from "@babel/traverse"; import * as t from "@babel/types"; // Examples from: https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md const MyVisitor: Visitor = { Identifier: { enter(path) { - // $ExpectType NodePath - path; + const x: NodePath = path; console.log("Entered!"); }, exit(path) { - // $ExpectType NodePath - path; + const x: NodePath = path; console.log("Exited!"); } } diff --git a/types/babelify/tslint.json b/types/babelify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/babelify/tslint.json +++ b/types/babelify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/babyparse/tslint.json b/types/babyparse/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/babyparse/tslint.json +++ b/types/babyparse/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backbone-associations/tslint.json b/types/backbone-associations/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/backbone-associations/tslint.json +++ b/types/backbone-associations/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backbone-fetch-cache/tslint.json b/types/backbone-fetch-cache/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/backbone-fetch-cache/tslint.json +++ b/types/backbone-fetch-cache/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backbone-relational/tslint.json b/types/backbone-relational/tslint.json index 65e27fce52..fd5f6a3567 100644 --- a/types/backbone-relational/tslint.json +++ b/types/backbone-relational/tslint.json @@ -4,6 +4,7 @@ "array-type": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "jsdoc-format": false, "max-line-length": false, diff --git a/types/backbone.layoutmanager/tslint.json b/types/backbone.layoutmanager/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/backbone.layoutmanager/tslint.json +++ b/types/backbone.layoutmanager/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backbone.localstorage/tslint.json b/types/backbone.localstorage/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/backbone.localstorage/tslint.json +++ b/types/backbone.localstorage/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backbone.paginator/tslint.json b/types/backbone.paginator/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/backbone.paginator/tslint.json +++ b/types/backbone.paginator/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backbone.radio/tslint.json b/types/backbone.radio/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/backbone.radio/tslint.json +++ b/types/backbone.radio/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backbone/tslint.json b/types/backbone/tslint.json index f5ae3a6788..ab605d9227 100644 --- a/types/backbone/tslint.json +++ b/types/backbone/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "export-just-namespace": false, "interface-name": false, "jsdoc-format": false, diff --git a/types/backgrid/tslint.json b/types/backgrid/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/backgrid/tslint.json +++ b/types/backgrid/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/backlog-js/tslint.json b/types/backlog-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/backlog-js/tslint.json +++ b/types/backlog-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/baconjs/tslint.json b/types/baconjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/baconjs/tslint.json +++ b/types/baconjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/baidumap-web-sdk/tslint.json b/types/baidumap-web-sdk/tslint.json index eccb336643..43797d8dd7 100644 --- a/types/baidumap-web-sdk/tslint.json +++ b/types/baidumap-web-sdk/tslint.json @@ -7,6 +7,7 @@ "ban-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "max-line-length": false, "member-access": false, diff --git a/types/barcode/tslint.json b/types/barcode/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/barcode/tslint.json +++ b/types/barcode/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bardjs/tslint.json b/types/bardjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bardjs/tslint.json +++ b/types/bardjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/base16/tslint.json b/types/base16/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/base16/tslint.json +++ b/types/base16/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bases/tslint.json b/types/bases/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bases/tslint.json +++ b/types/bases/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/basicauth-middleware/index.d.ts b/types/basicauth-middleware/index.d.ts index 21e3a27ad8..38aedd850b 100644 --- a/types/basicauth-middleware/index.d.ts +++ b/types/basicauth-middleware/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for basicauth-middleware 3.1 // Project: https://github.com/nchaulet/basicauth-middleware -// Definitions by: My Self +// Definitions by: Nicolas Chaulet // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/batch-stream/tslint.json b/types/batch-stream/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/batch-stream/tslint.json +++ b/types/batch-stream/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bazinga-translator/tslint.json b/types/bazinga-translator/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bazinga-translator/tslint.json +++ b/types/bazinga-translator/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bcrypt-nodejs/tslint.json b/types/bcrypt-nodejs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bcrypt-nodejs/tslint.json +++ b/types/bcrypt-nodejs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bcrypt/tslint.json b/types/bcrypt/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bcrypt/tslint.json +++ b/types/bcrypt/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bcryptjs/tslint.json b/types/bcryptjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bcryptjs/tslint.json +++ b/types/bcryptjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/benchmark/tslint.json b/types/benchmark/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/benchmark/tslint.json +++ b/types/benchmark/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/better-curry/tslint.json b/types/better-curry/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/better-curry/tslint.json +++ b/types/better-curry/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bezier-js/tslint.json b/types/bezier-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bezier-js/tslint.json +++ b/types/bezier-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bgiframe/tslint.json b/types/bgiframe/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bgiframe/tslint.json +++ b/types/bgiframe/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bigint/tslint.json b/types/bigint/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bigint/tslint.json +++ b/types/bigint/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bignum/tslint.json b/types/bignum/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bignum/tslint.json +++ b/types/bignum/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bigscreen/tslint.json b/types/bigscreen/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bigscreen/tslint.json +++ b/types/bigscreen/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bind-ponyfill/tslint.json b/types/bind-ponyfill/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bind-ponyfill/tslint.json +++ b/types/bind-ponyfill/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bintrees/tslint.json b/types/bintrees/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bintrees/tslint.json +++ b/types/bintrees/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bip21/tslint.json b/types/bip21/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bip21/tslint.json +++ b/types/bip21/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bip32/index.d.ts b/types/bip32/index.d.ts index c536f741af..e76deef810 100644 --- a/types/bip32/index.d.ts +++ b/types/bip32/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for bip32 1.0 // Project: https://github.com/bitcoinjs/bip32#readme -// Definitions by: My Self +// Definitions by: eduhenke // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/bit-array/tslint.json b/types/bit-array/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bit-array/tslint.json +++ b/types/bit-array/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts index cc24c6573b..a2db324e39 100644 --- a/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts +++ b/types/bitcoinjs-lib/bitcoinjs-lib-tests.ts @@ -20,6 +20,10 @@ keyPair3.toWIF(); bitcoin.payments.p2pkh({ pubkey: keyPair3.publicKey }); const network = keyPair3.network; +const keyPair4 = bitcoin.ECPair.makeRandom({network: bitcoin.networks.regtest, rng}); +keyPair4.toWIF(); +bitcoin.payments.p2pkh({ pubkey: keyPair4.publicKey }); + // Test TransactionBuilder and Transaction const txb = new bitcoin.TransactionBuilder(); txb.addInput('aa94ab02c182214f090e99a0d57021caffd0f195a81c24602b1028b130b63e31', 0); diff --git a/types/bitcoinjs-lib/index.d.ts b/types/bitcoinjs-lib/index.d.ts index 4fb1bb16a7..7cedbc822a 100644 --- a/types/bitcoinjs-lib/index.d.ts +++ b/types/bitcoinjs-lib/index.d.ts @@ -191,6 +191,7 @@ export class TransactionBuilder { export const networks: { bitcoin: Network; testnet: Network; + regtest: Network; }; export const opcodes: { diff --git a/types/bl/tslint.json b/types/bl/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bl/tslint.json +++ b/types/bl/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/blazy/tslint.json b/types/blazy/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/blazy/tslint.json +++ b/types/blazy/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bleno/tslint.json b/types/bleno/tslint.json index 0f5eeaf557..d895c355d8 100644 --- a/types/bleno/tslint.json +++ b/types/bleno/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "dt-header": false, + "npm-naming": false, "unified-signatures": false } } diff --git a/types/blessed/blessed-tests.ts b/types/blessed/blessed-tests.ts index aa38af8985..00df6dbc7a 100644 --- a/types/blessed/blessed-tests.ts +++ b/types/blessed/blessed-tests.ts @@ -6,6 +6,24 @@ let screen: blessed.Widgets.Screen = null; // https://github.com/chjj/blessed/blob/master/test/widget-autopad.js +screen = blessed.screen({ + log: __dirname + "/logs/just-logs.log" +}); + +screen = blessed.screen({ + log: __dirname + "/logs/just-logs.log", + dump: false +}); + +screen = blessed.screen({ + dump: __dirname + "/logs/logs-and-all-in-and-output.log" +}); + +screen = blessed.screen({ + log: __dirname + "/logs/logs-and-all-in-and-output.log", + dump: true +}); + screen = blessed.screen({ dump: __dirname + "/logs/autopad.log", smartCSR: true, diff --git a/types/blessed/index.d.ts b/types/blessed/index.d.ts index 7dae1709d2..53dbf48706 100644 --- a/types/blessed/index.d.ts +++ b/types/blessed/index.d.ts @@ -1,6 +1,8 @@ // Type definitions for blessed 0.1 // Project: https://github.com/chjj/blessed -// Definitions by: Bryn Austin Bellomy , Steve Kellock +// Definitions by: Bryn Austin Bellomy +// Steve Kellock +// Max Brauer // Definitions: https://github.com/borisyankov/DefinitelyTyped // TypeScript Version: 2.1 @@ -925,12 +927,12 @@ export namespace Widgets { /** * Create a log file. See log method. */ - log?(...msg: any[]): void; + log?: string; /** * Dump all output and input to desired file. Can be used together with log option if set as a boolean. */ - dump?: string; + dump?: string | boolean; /** * Debug mode. Enables usage of the debug method. Also creates a debug console which will display when diff --git a/types/blessed/tslint.json b/types/blessed/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/blessed/tslint.json +++ b/types/blessed/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/blissfuljs/tslint.json b/types/blissfuljs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/blissfuljs/tslint.json +++ b/types/blissfuljs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/blob-stream/tslint.json b/types/blob-stream/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/blob-stream/tslint.json +++ b/types/blob-stream/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/blocks/tslint.json b/types/blocks/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/blocks/tslint.json +++ b/types/blocks/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/blue-tape/tslint.json b/types/blue-tape/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/blue-tape/tslint.json +++ b/types/blue-tape/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/blueimp-md5/tslint.json b/types/blueimp-md5/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/blueimp-md5/tslint.json +++ b/types/blueimp-md5/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bookshelf/index.d.ts b/types/bookshelf/index.d.ts index 7467b3178f..2edb269875 100644 --- a/types/bookshelf/index.d.ts +++ b/types/bookshelf/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bookshelfjs v0.9.4 +// Type definitions for bookshelfjs v0.13.0 // Project: http://bookshelfjs.org/ // Definitions by: Andrew Schurman , Vesa Poikajärvi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -317,6 +317,7 @@ declare namespace Bookshelf { interface SyncOptions { transacting?: Knex.Transaction; debug?: boolean; + withSchema?: string; } interface CollectionOptions { diff --git a/types/globby/package.json b/types/bookshelf/package.json similarity index 63% rename from types/globby/package.json rename to types/bookshelf/package.json index 136d4694e9..7bd76f13f8 100644 --- a/types/globby/package.json +++ b/types/bookshelf/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "fast-glob": "^2.0.2" + "knex": "^0.16.1" } } diff --git a/types/bookshelf/tslint.json b/types/bookshelf/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/bookshelf/tslint.json +++ b/types/bookshelf/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/boolify-string/tslint.json b/types/boolify-string/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/boolify-string/tslint.json +++ b/types/boolify-string/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootbox/tslint.json b/types/bootbox/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootbox/tslint.json +++ b/types/bootbox/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootpag/tslint.json b/types/bootpag/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootpag/tslint.json +++ b/types/bootpag/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-datepicker/tslint.json b/types/bootstrap-datepicker/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-datepicker/tslint.json +++ b/types/bootstrap-datepicker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-fileinput/tslint.json b/types/bootstrap-fileinput/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-fileinput/tslint.json +++ b/types/bootstrap-fileinput/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts b/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts index 78f92fcf71..a6b023d121 100644 --- a/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts +++ b/types/bootstrap-growl-ifightcrime/bootstrap-growl-ifightcrime-tests.ts @@ -14,7 +14,6 @@ let options: BootstrapGrowlIfightcrime.Options = { type: 'info', offset: offsetOptions, align: 'right', - width: 250, delay: 4000, allow_dismiss: true, stackup_spacing: 10 @@ -22,4 +21,16 @@ let options: BootstrapGrowlIfightcrime.Options = { $(document).ready(() => { $.bootstrapGrowl('Alert with options', options); + + const optionsWidthAuto: BootstrapGrowlIfightcrime.Options = { + ...options, + width: 'auto' + }; + $.bootstrapGrowl('Alert with options, width=auto', optionsWidthAuto); + + const optionsWidthAsNumber = { + ...options, + width: 120 + }; + $.bootstrapGrowl('Alert with options, width=120', optionsWidthAsNumber); }); diff --git a/types/bootstrap-growl-ifightcrime/index.d.ts b/types/bootstrap-growl-ifightcrime/index.d.ts index 45755682ea..2d37135be3 100644 --- a/types/bootstrap-growl-ifightcrime/index.d.ts +++ b/types/bootstrap-growl-ifightcrime/index.d.ts @@ -47,9 +47,9 @@ declare namespace BootstrapGrowlIfightcrime { align?: AlignType; /** - * Integer + * Integer or 'auto' */ - width?: number; + width?: number | 'auto'; /** * Time while the message will be displayed. It's not equivalent to the *demo* timeOut! diff --git a/types/bootstrap-maxlength/tslint.json b/types/bootstrap-maxlength/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-maxlength/tslint.json +++ b/types/bootstrap-maxlength/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-notify/bootstrap-notify-tests.ts b/types/bootstrap-notify/bootstrap-notify-tests.ts index 2977d39abf..4b288b2ca0 100644 --- a/types/bootstrap-notify/bootstrap-notify-tests.ts +++ b/types/bootstrap-notify/bootstrap-notify-tests.ts @@ -46,4 +46,21 @@ $.notify({ '' + '' + '' -}); \ No newline at end of file +}); + +const notifyResult = $.notify({ + message: 'Callbacks have the popup element as an argument', +},{ + onShow: function($ele) { + notifyResult.$ele === $ele; + }, + onShown: function($ele) { + notifyResult.$ele === $ele; + }, + onClose: function($ele) { + notifyResult.$ele === $ele; + }, + onClosed: function($ele) { + notifyResult.$ele === $ele; + }, +}); diff --git a/types/bootstrap-notify/index.d.ts b/types/bootstrap-notify/index.d.ts index 540f200d9c..75994ad365 100644 --- a/types/bootstrap-notify/index.d.ts +++ b/types/bootstrap-notify/index.d.ts @@ -48,16 +48,16 @@ interface NotifySettings { enter?: string; exit?: string; }; - onShow?: () => void; - onShown?: () => void; - onClose?: () => void; - onClosed?: () => void; + onShow?: ($ele: JQuery) => void; + onShown?: ($ele: JQuery) => void; + onClose?: ($ele: JQuery) => void; + onClosed?: ($ele: JQuery) => void; icon_type?: string; template?: string; } interface NotifyReturn { - $ele: JQueryStatic; + $ele: JQuery; close: () => void; update: (command: string, update: any) => void; } diff --git a/types/bootstrap-notify/tslint.json b/types/bootstrap-notify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-notify/tslint.json +++ b/types/bootstrap-notify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-select/tslint.json b/types/bootstrap-select/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-select/tslint.json +++ b/types/bootstrap-select/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-switch/tslint.json b/types/bootstrap-switch/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-switch/tslint.json +++ b/types/bootstrap-switch/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-table/tslint.json b/types/bootstrap-table/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-table/tslint.json +++ b/types/bootstrap-table/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap-touchspin/tslint.json b/types/bootstrap-touchspin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap-touchspin/tslint.json +++ b/types/bootstrap-touchspin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap.paginator/tslint.json b/types/bootstrap.paginator/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap.paginator/tslint.json +++ b/types/bootstrap.paginator/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap.timepicker/tslint.json b/types/bootstrap.timepicker/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bootstrap.timepicker/tslint.json +++ b/types/bootstrap.timepicker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bootstrap/bootstrap-tests.ts b/types/bootstrap/bootstrap-tests.ts index 9344423cfb..01e5d5352f 100755 --- a/types/bootstrap/bootstrap-tests.ts +++ b/types/bootstrap/bootstrap-tests.ts @@ -196,6 +196,12 @@ $("#popover").popover({ offset: 10, fallbackPlacement: ["flip", "clockwise"], boundary: "scrollParent", + sanitize: false, + whiteList: { + h1: [], + img: ['src', 'alt', 'title', 'width', 'height'], + }, + sanitizeFn: (x: string) => x.replace("<", ""), }); $("#popover").popover({ @@ -207,6 +213,10 @@ $("#popover").popover({ }, }); +$("#popover").popover({ + sanitizeFn: null, +}); + // -------------------------------------------------------------------------------------- // Scrollspy // -------------------------------------------------------------------------------------- @@ -280,10 +290,23 @@ $("#tooltip").on("hide.bs.tooltip", () => {}); $("#tooltip").tooltip({ animation: false, -}); - -$("#tooltip").tooltip({ container: "#container", + delay: {show: 500, hide: 100}, + html: true, + placement: "auto", + selector: "[rel=\"tooltip\"]", + template: '', + title: "Hello world", + trigger: "hover focus", + offset: 10, + fallbackPlacement: ["flip", "clockwise"], + boundary: "scrollParent", + sanitize: false, + whiteList: { + h1: [], + img: ['src', 'alt', 'title', 'width', 'height'], + }, + sanitizeFn: (x: string) => x.replace("<", ""), }); $("#tooltip").tooltip({ @@ -298,18 +321,6 @@ $("#tooltip").tooltip({ delay: 250, }); -$("#tooltip").tooltip({ - delay: {show: 500, hide: 100}, -}); - -$("#tooltip").tooltip({ - html: true, -}); - -$("#tooltip").tooltip({ - placement: "auto", -}); - $("#tooltip").tooltip({ placement(this, tooltip, trigger) { console.log(this.tip === tooltip); @@ -327,22 +338,10 @@ $("#tooltip").tooltip({ }, }); -$("#tooltip").tooltip({ - selector: "[rel=\"tooltip\"]", -}); - $("#tooltip").tooltip({ selector: false, }); -$("#tooltip").tooltip({ - template: '', -}); - -$("#tooltip").tooltip({ - title: "Hello world", -}); - $("#tooltip").tooltip({ title: document.getElementById("title-element") as HTMLElement, }); @@ -353,14 +352,6 @@ $("#tooltip").tooltip({ }, }); -$("#tooltip").tooltip({ - trigger: "hover focus", -}); - -$("#tooltip").tooltip({ - offset: 10, -}); - $("#tooltip").tooltip({ offset: "10px", }); @@ -369,14 +360,10 @@ $("#tooltip").tooltip({ fallbackPlacement: "clockwise", }); -$("#tooltip").tooltip({ - fallbackPlacement: ["flip", "clockwise"], -}); - -$("#tooltip").tooltip({ - boundary: "scrollParent", -}); - $("#tooltip").tooltip({ boundary: aHtmlElement, }); + +$("#popover").popover({ + sanitizeFn: null, +}); diff --git a/types/bootstrap/index.d.ts b/types/bootstrap/index.d.ts index 2fb473fc29..6dc5f21a28 100755 --- a/types/bootstrap/index.d.ts +++ b/types/bootstrap/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Bootstrap 4.2 +// Type definitions for Bootstrap 4.3 // Project: https://github.com/twbs/bootstrap/, https://getbootstrap.com // Definitions by: denisname // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -352,6 +352,25 @@ export interface TooltipOption { * @default "scrollParent" */ boundary?: Popper.Boundary | HTMLElement; + + /** + * Enable or disable the sanitization. If activated 'template', 'content' and 'title' options will be sanitized. + * + * @default true + */ + sanitize?: boolean; + + /** + * Object which contains allowed attributes and tags. + */ + whiteList?: {[key: string]: string[]}; + + /** + * Here you can supply your own sanitize function. This can be useful if you prefer to use a dedicated library to perform sanitization. + * + * @default null + */ + sanitizeFn?: null | ((input: string) => string); } // -------------------------------------------------------------------------------------- diff --git a/types/bounce.js/tslint.json b/types/bounce.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bounce.js/tslint.json +++ b/types/bounce.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/box2d/tslint.json b/types/box2d/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/box2d/tslint.json +++ b/types/box2d/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/boxen/boxen-tests.ts b/types/boxen/boxen-tests.ts deleted file mode 100644 index 303e5dd7fa..0000000000 --- a/types/boxen/boxen-tests.ts +++ /dev/null @@ -1,37 +0,0 @@ -import boxen = require('boxen'); - -boxen('unicorn'); // $ExpectType string -boxen('unicorn', { borderColor: 'black' }); // $ExpectType string -boxen('unicorn', { borderStyle: 'double' }); // $ExpectType string -boxen('unicorn', { borderStyle: 'foo' }); // $ExpectError -// $ExpectType string -boxen('unicorn', { - borderStyle: { - topLeft: '+', - topRight: '+', - bottomLeft: '+', - bottomRight: '+', - horizontal: '-', - vertical: '|', - }, -}); -boxen('unicorn', { dimBorder: true }); // $ExpectType string -boxen('unicorn', { padding: 1 }); // $ExpectType string -boxen('unicorn', { padding: { top: 1 } }); // $ExpectType string -boxen('unicorn', { padding: { right: 1 } }); // $ExpectType string -boxen('unicorn', { padding: { bottom: 1 } }); // $ExpectType string -boxen('unicorn', { padding: { left: 1 } }); // $ExpectType string -boxen('unicorn', { margin: 1 }); // $ExpectType string -boxen('unicorn', { margin: { top: 1 } }); // $ExpectType string -boxen('unicorn', { margin: { right: 1 } }); // $ExpectType string -boxen('unicorn', { margin: { bottom: 1 } }); // $ExpectType string -boxen('unicorn', { margin: { left: 1 } }); // $ExpectType string -boxen('unicorn', { float: 'right' }); // $ExpectType string -boxen('unicorn', { float: 'center' }); // $ExpectType string -boxen('unicorn', { float: 'left' }); // $ExpectType string -boxen('unicorn', { float: 'foo' }); // $ExpectError -boxen('unicorn', { backgroundColor: 'white' }); // $ExpectType string -boxen('unicorn', { align: 'left' }); // $ExpectType string -boxen('unicorn', { align: 'center' }); // $ExpectType string -boxen('unicorn', { align: 'right' }); // $ExpectType string -boxen('unicorn', { align: 'foo' }); // $ExpectError diff --git a/types/boxen/index.d.ts b/types/boxen/index.d.ts deleted file mode 100644 index 94b68bb5c7..0000000000 --- a/types/boxen/index.d.ts +++ /dev/null @@ -1,114 +0,0 @@ -// Type definitions for boxen 2.1 -// Project: https://github.com/sindresorhus/boxen#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -import { BoxDefinition, BoxNames } from 'cli-boxes'; - -export = boxen; - -/** - * Create boxes in the terminal - * @param input Text inside the box. - */ -declare function boxen(input: string, options?: boxen.Options): string; - -declare namespace boxen { - interface Options { - /** - * Color of the box border. - * Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray` or a hex value like `#ff0000` - */ - borderColor?: string; - - /** - * Style of the box border. - * Can be any of the above predefined styles or an object. - * - * Predefined values: - * - `single` - * ``` - * ┌───┐ - * │foo│ - * └───┘ - * ``` - * - `double` - * ``` - * ╔═══╗ - * ║foo║ - * ╚═══╝ - * ``` - * - `round` (`single` sides with round corners) - * ``` - * ╭───╮ - * │foo│ - * ╰───╯ - * ``` - * - `single-double` (`single` on top and bottom, `double` on right and left) - * ``` - * ╓───╖ - * ║foo║ - * ╙───╜ - * ``` - * - `double-single` (`double` on top and bottom, `single` on right and left) - * ``` - * ╒═══╕ - * │foo│ - * ╘═══╛ - * ``` - * - `classic` - * ``` - * +---+ - * |foo| - * +---+ - * ``` - */ - borderStyle?: BoxNames | BoxDefinition; - - /** - * Reduce opacity of the border. - * @default false - */ - dimBorder?: boolean; - - /** - * Space between the text and box border. - * When a number is specified, the left/right padding is 3 times the top/bottom to make it look nice. - * @default 0 - */ - padding?: number | PositionOptions; - - /** - * Space around the box. - * When a number is specified, the left/right margin is 3 times the top/bottom to make it look nice. - * @default 0 - */ - margin?: number | PositionOptions; - - /** - * Float the box on the available terminal screen space. - * @default 'left' - */ - float?: 'right' | 'center' | 'left'; - - /** - * Color of the background. - * Values: `black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray` or a hex value like `#ff0000` - */ - backgroundColor?: string; - - /** - * Align the text in the box based on the widest line. - * @default 'left' - */ - align?: 'left' | 'center' | 'right'; - } - - interface PositionOptions { - top?: number; - right?: number; - bottom?: number; - left?: number; - } -} diff --git a/types/bpmn-moddle/index.d.ts b/types/bpmn-moddle/index.d.ts index f4411e05fa..43a6431308 100644 --- a/types/bpmn-moddle/index.d.ts +++ b/types/bpmn-moddle/index.d.ts @@ -25,6 +25,7 @@ declare namespace BPMNModdle { interface TypeDerived { $type: ElementType; + $parent: TypeDerived; } interface BaseElement extends TypeDerived { /** diff --git a/types/braft-editor/index.d.ts b/types/braft-editor/index.d.ts index 62f339a41b..0edeb34b2c 100644 --- a/types/braft-editor/index.d.ts +++ b/types/braft-editor/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for braft-editor 1.9 // Project: https://github.com/margox/braft#readme -// Definitions by: My Self +// Definitions by: Jonny Yao // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/braintree-web/tslint.json b/types/braintree-web/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/braintree-web/tslint.json +++ b/types/braintree-web/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/breeze/tslint.json b/types/breeze/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/breeze/tslint.json +++ b/types/breeze/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/brorand/tslint.json b/types/brorand/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/brorand/tslint.json +++ b/types/brorand/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/browser-harness/tslint.json b/types/browser-harness/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/browser-harness/tslint.json +++ b/types/browser-harness/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/browser-pack/tslint.json b/types/browser-pack/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/browser-pack/tslint.json +++ b/types/browser-pack/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/browser-report/tslint.json b/types/browser-report/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/browser-report/tslint.json +++ b/types/browser-report/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/browser-resolve/tslint.json b/types/browser-resolve/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/browser-resolve/tslint.json +++ b/types/browser-resolve/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/browser-sync/index.d.ts b/types/browser-sync/index.d.ts index 72399f1618..58b85e09f3 100644 --- a/types/browser-sync/index.d.ts +++ b/types/browser-sync/index.d.ts @@ -7,7 +7,6 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -/// /// /// diff --git a/types/browser-sync/package.json b/types/browser-sync/package.json new file mode 100644 index 0000000000..a0e2ec3c5c --- /dev/null +++ b/types/browser-sync/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chokidar": "^2.1.2" + } +} diff --git a/types/browser-sync/tslint.json b/types/browser-sync/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/browser-sync/tslint.json +++ b/types/browser-sync/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/browserify/tslint.json b/types/browserify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/browserify/tslint.json +++ b/types/browserify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/browserslist/browserslist-tests.ts b/types/browserslist/browserslist-tests.ts index d5e88e5b5d..4617fc2490 100644 --- a/types/browserslist/browserslist-tests.ts +++ b/types/browserslist/browserslist-tests.ts @@ -1,4 +1,5 @@ import browserslist from "browserslist"; +import BrowserslistError from "browserslist/error"; browserslist(); // $ExpectType string[] browserslist(""); // $ExpectType string[] @@ -20,3 +21,5 @@ for (const opt of opts) { browserslist.coverage([""]); // $ExpectType number browserslist.coverage([""], { "": { "": 0 } }); // $ExpectType number + +new BrowserslistError('error'); // $ExpectType BrowserslistError diff --git a/types/browserslist/error.d.ts b/types/browserslist/error.d.ts new file mode 100644 index 0000000000..1c3e584471 --- /dev/null +++ b/types/browserslist/error.d.ts @@ -0,0 +1,6 @@ +declare class BrowserslistError extends Error { + constructor(message: any); + browserslist: true; +} + +export = BrowserslistError; diff --git a/types/browserslist/index.d.ts b/types/browserslist/index.d.ts index 7c4a0add0c..8850a45129 100644 --- a/types/browserslist/index.d.ts +++ b/types/browserslist/index.d.ts @@ -1,6 +1,7 @@ -// Type definitions for browserslist 4.3 +// Type definitions for browserslist 4.4 // Project: https://github.com/browserslist/browserslist#readme // Definitions by: Dave Cardwell +// Andrew Leedham // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.7 diff --git a/types/browserslist/tsconfig.json b/types/browserslist/tsconfig.json index cf68d8bf64..4dbd0e9b45 100644 --- a/types/browserslist/tsconfig.json +++ b/types/browserslist/tsconfig.json @@ -13,5 +13,5 @@ "forceConsistentCasingInFileNames": true, "esModuleInterop": true }, - "files": ["index.d.ts", "browserslist-tests.ts"] + "files": ["index.d.ts", "browserslist-tests.ts", "error.d.ts"] } diff --git a/types/bser/index.d.ts b/types/bser/index.d.ts new file mode 100644 index 0000000000..75695d85b1 --- /dev/null +++ b/types/bser/index.d.ts @@ -0,0 +1,100 @@ +// Type definitions for bser 2.0 +// Project: https://facebook.github.io/watchman/docs/bser.html +// Definitions by: Claas Ahlrichs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +/// + +import { EventEmitter } from "events"; +import Int64 = require("node-int64"); + +export type InputWrapper = + | Buffer + | string + | NodeJS.TypedArray + | DataView + | ArrayBuffer + | SharedArrayBuffer; +export type IntWrapper = number | Int64; +export type AnyWrapper = boolean | IntWrapper | null | string | object; + +export class Accumulator { + buf: Buffer; + readOffset: number; + writeOffset: number; + + constructor(initsize?: number); + + append(buf: InputWrapper): void; + + assertReadableSize(size: number): void; + + peekDouble(): number; + + peekInt(size: number): IntWrapper; + + peekString(size: number): string; + + readAdvance(size: number): void; + + readAvail(): number; + + readDouble(): number; + + // replace "IntWrapper" with "number"? + readInt(bytes: number): IntWrapper; + + readString(size: number): string; + + reserve(size: number): void; + + writeAvail(): number; + + writeByte(value: number): void; + + writeDouble(value: number): void; + + writeInt(value: number, size: number): void; +} + +export class BunserBuf extends EventEmitter { + buf: Accumulator; + state: 0 | 1; + // replace "IntWrapper" with "number"? + pduLen?: false | IntWrapper; + + constructor(); + + append( + buf: InputWrapper, + synchronous?: false + ): AnyWrapper | AnyWrapper[] | undefined; + append(buf: InputWrapper, synchronous: true): void; + + decodeAny(): AnyWrapper | AnyWrapper[]; + + decodeArray(): AnyWrapper[]; + + // replace "IntWrapper" with "number"? + decodeInt(relaxSizeAsserts?: boolean): false | IntWrapper; + + decodeObject(): object; + + decodeString(): string; + + decodeTemplate(): AnyWrapper[]; + + expectCode(expected: number): void; + + process(synchronous?: false): AnyWrapper | AnyWrapper[] | undefined; + process(synchronous: true): void; + + processLater(): void; + + raise(reason: string): void; +} + +export function dumpToBuffer(val: any): Buffer; + +export function loadFromBuffer(input: InputWrapper): AnyWrapper | AnyWrapper[]; diff --git a/types/bser/test/sample1.ts b/types/bser/test/sample1.ts new file mode 100644 index 0000000000..3958260c42 --- /dev/null +++ b/types/bser/test/sample1.ts @@ -0,0 +1,4 @@ +import * as bser from "bser"; + +const encoded = bser.dumpToBuffer(["hello"]); +console.log(bser.loadFromBuffer(encoded)); // ['hello'] diff --git a/types/bser/test/sample2.ts b/types/bser/test/sample2.ts new file mode 100644 index 0000000000..2ab145626a --- /dev/null +++ b/types/bser/test/sample2.ts @@ -0,0 +1,7 @@ +import * as bser from "bser"; + +const bunser = new bser.BunserBuf(); + +bunser.on("value", obj => { + console.log(obj); +}); diff --git a/types/bser/test/sample3.ts b/types/bser/test/sample3.ts new file mode 100644 index 0000000000..41831c4447 --- /dev/null +++ b/types/bser/test/sample3.ts @@ -0,0 +1,16 @@ +import * as bser from "bser"; +import net from "net"; + +const obj = "sample data"; +const bunser = new bser.BunserBuf(); + +bunser.on("value", obj => { + console.log("data from socket", obj); +}); + +const socket = net.connect("/socket"); + +socket.on("data", buf => { + bunser.append(buf); +}); +socket.write(bser.dumpToBuffer(obj)); diff --git a/types/bser/test/tests.ts b/types/bser/test/tests.ts new file mode 100644 index 0000000000..2037e0517b --- /dev/null +++ b/types/bser/test/tests.ts @@ -0,0 +1,86 @@ +import * as bser from "bser"; +import Int64 from "node-int64"; +import * as assert from "assert"; + +// This is a hard-coded template representation from the C test suite +const template = + "\x00\x01\x03\x28" + + "\x0b\x00\x03\x02\x02\x03\x04\x6e\x61\x6d\x65\x02" + + "\x03\x03\x61\x67\x65\x03\x03\x02\x03\x04\x66\x72" + + "\x65\x64\x03\x14\x02\x03\x04\x70\x65\x74\x65\x03" + + "\x1e\x0c\x03\x19"; + +const val = bser.loadFromBuffer(template); +assert.deepStrictEqual(val, [ + { name: "fred", age: 20 }, + { name: "pete", age: 30 }, + { age: 25 } +]); + +function roundtrip(val: any) { + const encoded = bser.dumpToBuffer(val); + const decoded = bser.loadFromBuffer(encoded); + assert.deepStrictEqual(decoded, val); +} + +const values_to_test = [ + 1, + "hello", + 1.5, + false, + true, + new Int64("0x0123456789abcdef"), + 127, + 128, + 129, + 32767, + 32768, + 32769, + 65534, + 65536, + 65537, + 2147483647, + 2147483648, + 2147483649, + null, + [1, 2, 3], + { foo: "bar" }, + { nested: { struct: "hello", list: [true, false, 1, "string"] } } +]; + +for (const value of values_to_test) { + roundtrip(value); +} +roundtrip(values_to_test); + +// Verify Accumulator edge cases +const acc = new bser.Accumulator(8); +acc.append("hello"); +assert.equal(acc.readAvail(), 5); +assert.equal(acc.readOffset, 0); +assert.equal(acc.readString(3), "hel"); +assert.equal(acc.readOffset, 3); +assert.equal(acc.readAvail(), 2); +assert.equal(acc.writeAvail(), 3); + +// This should trigger a shunt and not make the buffer bigger +acc.reserve(5); +assert.equal(acc.readOffset, 0, "shunted"); +assert.equal(acc.readAvail(), 2, "still have 2 available to read"); +assert.equal(acc.writeAvail(), 6, "2 left to read out of 8 total space"); +assert.equal(acc.peekString(2), "lo", "have the correct remainder"); + +// Don't include keys that have undefined values +const res = bser.dumpToBuffer({ expression: undefined }); +assert.deepStrictEqual(bser.loadFromBuffer(res), {}); + +// Dump numbers without fraction to integers +let buffer; +buffer = bser.dumpToBuffer(1); +assert.equal(buffer.toString("hex"), "000105020000000301"); +buffer = bser.dumpToBuffer(1.0); +assert.equal(buffer.toString("hex"), "000105020000000301"); + +// Dump numbers with fraction to double +buffer = bser.dumpToBuffer(1.1); +assert.equal(buffer.toString("hex"), "00010509000000079a9999999999f13f"); diff --git a/types/ora/v1/tsconfig.json b/types/bser/tsconfig.json similarity index 60% rename from types/ora/v1/tsconfig.json rename to types/bser/tsconfig.json index ad30053dff..4fb45a708a 100644 --- a/types/ora/v1/tsconfig.json +++ b/types/bser/tsconfig.json @@ -1,22 +1,13 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "ora": [ - "ora/v1" - ] - }, + "baseUrl": "../", + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true, @@ -24,6 +15,9 @@ }, "files": [ "index.d.ts", - "ora-tests.ts" + "test/tests.ts", + "test/sample1.ts", + "test/sample2.ts", + "test/sample3.ts" ] } diff --git a/types/aggregate-error/tslint.json b/types/bser/tslint.json similarity index 100% rename from types/aggregate-error/tslint.json rename to types/bser/tslint.json diff --git a/types/bson/tslint.json b/types/bson/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bson/tslint.json +++ b/types/bson/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/buble/index.d.ts b/types/buble/index.d.ts index db3cb0a7b7..5ac6a96ac6 100644 --- a/types/buble/index.d.ts +++ b/types/buble/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for buble 0.19 -// Project: https://github.com/Rich-Harris/buble#README +// Project: https://github.com/bublejs/buble // Definitions by: Hugo Alliaume // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 diff --git a/types/bucks/tslint.json b/types/bucks/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bucks/tslint.json +++ b/types/bucks/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/buffer-compare/tslint.json b/types/buffer-compare/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/buffer-compare/tslint.json +++ b/types/buffer-compare/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/buffer-equal/tslint.json b/types/buffer-equal/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/buffer-equal/tslint.json +++ b/types/buffer-equal/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/buffers/tslint.json b/types/buffers/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/buffers/tslint.json +++ b/types/buffers/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bull/bull-tests.tsx b/types/bull/bull-tests.tsx index 13ae21f5a4..64f4eef698 100644 --- a/types/bull/bull-tests.tsx +++ b/types/bull/bull-tests.tsx @@ -70,6 +70,19 @@ videoQueue.add({video: 'http://example.com/video1.mov'}); audioQueue.add({audio: 'http://example.com/audio1.mp3'}); imageQueue.add({image: 'http://example.com/image1.tiff'}); +////////////////////////////////////////////////////////////////////////////////// +// +// Test Redis Cluster connexion +// +////////////////////////////////////////////////////////////////////////////////// + +const clusterQueue = new Queue('queue on redis cluster', { + prefix: 'cluster-test', + createClient: (clusterUri: Redis.ClusterNode) => { + return new Redis.Cluster([{port: 6379, host: '127.0.0.1'}]); + } +}); + ////////////////////////////////////////////////////////////////////////////////// // // Re-using Redis Connections diff --git a/types/bull/index.d.ts b/types/bull/index.d.ts index cd2d1a9047..07de38e05d 100644 --- a/types/bull/index.d.ts +++ b/types/bull/index.d.ts @@ -13,6 +13,7 @@ // Dan Manastireanu // Kjell-Morten Bratsberg Thorsen // Christian D. +// Silas Rech // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -49,9 +50,9 @@ declare namespace Bull { /** * When specified, the `Queue` will use this function to create new `ioredis` client connections. - * This is useful if you want to re-use connections. + * This is useful if you want to re-use connections or connect to a Redis cluster. */ - createClient?(type: 'client' | 'subscriber' | 'bclient', redisOpts?: Redis.RedisOptions): Redis.Redis; + createClient?(type: 'client' | 'subscriber' | 'bclient', redisOpts?: Redis.RedisOptions): Redis.Redis | Redis.Cluster; /** * Prefix to use for all redis keys @@ -114,6 +115,9 @@ declare namespace Bull { type JobId = number | string; + type ProcessCallbackFunction = (job: Job, done: DoneCallback) => void; + type ProcessPromiseFunction = (job: Job) => Promise; + interface Job { id: JobId; @@ -397,6 +401,8 @@ declare namespace Bull { */ isReady(): Promise; + /* tslint:disable:unified-signatures */ + /** * Defines a processing function for the jobs placed into a given Queue. * @@ -414,7 +420,9 @@ declare namespace Bull { * If the promise is rejected, the error will be passed as a second argument to the "failed" event. * If it is resolved, its value will be the "completed" event's second argument. */ - process(callback: ((job: Job, done: DoneCallback) => void) | ((job: Job) => Promise) | string): void; + process(callback: ProcessCallbackFunction): void; + process(callback: ProcessPromiseFunction): void; + process(callback: string): void; /** * Defines a processing function for the jobs placed into a given Queue. @@ -435,7 +443,9 @@ declare namespace Bull { * * @param concurrency Bull will then call your handler in parallel respecting this maximum value. */ - process(concurrency: number, callback: ((job: Job, done: DoneCallback) => void) | ((job: Job) => Promise) | string): void; + process(concurrency: number, callback: ProcessCallbackFunction): void; + process(concurrency: number, callback: ProcessPromiseFunction): void; + process(concurrency: number, callback: string): void; /** * Defines a processing function for the jobs placed into a given Queue. @@ -456,8 +466,9 @@ declare namespace Bull { * * @param name Bull will only call the handler if the job name matches */ - // tslint:disable-next-line:unified-signatures - process(name: string, callback: ((job: Job, done: DoneCallback) => void) | ((job: Job) => Promise) | string): void; + process(name: string, callback: ProcessCallbackFunction): void; + process(name: string, callback: ProcessPromiseFunction): void; + process(name: string, callback: string): void; /** * Defines a processing function for the jobs placed into a given Queue. @@ -479,7 +490,11 @@ declare namespace Bull { * @param name Bull will only call the handler if the job name matches * @param concurrency Bull will then call your handler in parallel respecting this maximum value. */ - process(name: string, concurrency: number, callback: ((job: Job, done: DoneCallback) => void) | ((job: Job) => Promise) | string): void; + process(name: string, concurrency: number, callback: ProcessCallbackFunction): void; + process(name: string, concurrency: number, callback: ProcessPromiseFunction): void; + process(name: string, concurrency: number, callback: string): void; + + /* tslint:enable:unified-signatures */ /** * Creates a new job and adds it to the queue. @@ -598,7 +613,7 @@ declare namespace Bull { * Returns a promise that will return an array of job instances of the given types. * Optional parameters for range and ordering are provided. */ - getJobs(types: string[], start?: number, end?: number, asc?: boolean): Promise; + getJobs(types: string[], start?: number, end?: number, asc?: boolean): Promise>>; /** * Returns a promise that resolves with the job counts for the given queue. diff --git a/types/bunyan-config/tslint.json b/types/bunyan-config/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bunyan-config/tslint.json +++ b/types/bunyan-config/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bunyan-logentries/tslint.json b/types/bunyan-logentries/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bunyan-logentries/tslint.json +++ b/types/bunyan-logentries/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bunyan-prettystream/tslint.json b/types/bunyan-prettystream/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bunyan-prettystream/tslint.json +++ b/types/bunyan-prettystream/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bunyan-seq/index.d.ts b/types/bunyan-seq/index.d.ts index 6d2a29fb1c..c70b7bdacb 100644 --- a/types/bunyan-seq/index.d.ts +++ b/types/bunyan-seq/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for bunyan-blackhole 0.2 +// Type definitions for bunyan-seq 0.2 // Project: https://github.com/datalust/bunyan-seq, https://github.com/continuousit/bunyan-seq // Definitions by: Ray Booysen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped diff --git a/types/bunyan/index.d.ts b/types/bunyan/index.d.ts index f6f0b287aa..1e5c64d625 100644 --- a/types/bunyan/index.d.ts +++ b/types/bunyan/index.d.ts @@ -259,7 +259,7 @@ declare namespace Logger { limit?: number; } - class RingBuffer extends EventEmitter implements NodeJS.WritableStream { + class RingBuffer extends EventEmitter { constructor(options: RingBufferOptions); writable: boolean; @@ -277,7 +277,7 @@ declare namespace Logger { period?: string; } - class RotatingFileStream extends EventEmitter implements NodeJS.WritableStream { + class RotatingFileStream extends EventEmitter { constructor(options: RotatingFileStreamOptions); writable: boolean; diff --git a/types/busboy/tslint.json b/types/busboy/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/busboy/tslint.json +++ b/types/busboy/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/business-rules-engine/tslint.json b/types/business-rules-engine/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/business-rules-engine/tslint.json +++ b/types/business-rules-engine/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bwip-js/tslint.json b/types/bwip-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bwip-js/tslint.json +++ b/types/bwip-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/byline/tslint.json b/types/byline/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/byline/tslint.json +++ b/types/byline/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/bytebuffer/tslint.json b/types/bytebuffer/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/bytebuffer/tslint.json +++ b/types/bytebuffer/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cache-manager/cache-manager-tests.ts b/types/cache-manager/cache-manager-tests.ts index 30a8472a8b..d8ab154aa1 100644 --- a/types/cache-manager/cache-manager-tests.ts +++ b/types/cache-manager/cache-manager-tests.ts @@ -1,6 +1,6 @@ import * as cacheManager from 'cache-manager' -const memoryCache = cacheManager.caching({ store: 'memory', max: 100, ttl: 10/*seconds*/ }); +const memoryCache: cacheManager.Cache = cacheManager.caching({ store: 'memory', max: 100, ttl: 10/*seconds*/ }); const ttl = 5; memoryCache.set('foo', 'bar', { ttl: ttl }, (err) => { diff --git a/types/cache-manager/index.d.ts b/types/cache-manager/index.d.ts index fcd4458767..5898b0fa24 100644 --- a/types/cache-manager/index.d.ts +++ b/types/cache-manager/index.d.ts @@ -3,17 +3,17 @@ // Definitions by: Simon Gausmann // Definitions: https://github.com/borisyankov/DefinitelyTyped -interface CachingConfig { +export interface CachingConfig { ttl: number; } -interface StoreConfig extends CachingConfig { +export interface StoreConfig extends CachingConfig { store: string; max?: number; isCacheableValue?: (value: any) => boolean; } -interface Cache { +export interface Cache { set(key: string, value: T, options: CachingConfig, callback?: (error: any) => void): void; set(key: string, value: T, ttl: number, callback?: (error: any) => void): void; set(key: string, value: T, options: CachingConfig): Promise; @@ -31,12 +31,5 @@ interface Cache { del(key: string): Promise; } - - -declare namespace cacheManager { - function caching(IConfig: StoreConfig): Cache; - function multiCaching(Caches: Cache[]): Cache; -} - -export = cacheManager; - +export function caching(IConfig: StoreConfig): Cache; +export function multiCaching(Caches: Cache[]): Cache; diff --git a/types/cache-manager/tslint.json b/types/cache-manager/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cache-manager/tslint.json +++ b/types/cache-manager/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cacheable-request/cacheable-request-tests.ts b/types/cacheable-request/cacheable-request-tests.ts index 95458c14b7..f6964c8ec8 100644 --- a/types/cacheable-request/cacheable-request-tests.ts +++ b/types/cacheable-request/cacheable-request-tests.ts @@ -1,7 +1,6 @@ import * as http from 'http'; import * as https from 'https'; import CacheableRequest = require('cacheable-request'); -import QuickLRU = require('quick-lru'); // You can do let cacheableRequest = new CacheableRequest(http.request); @@ -14,7 +13,6 @@ cacheableRequest = new CacheableRequest(https.request); cacheableRequest = new CacheableRequest(http.request, 'redis://user:pass@localhost:6379'); cacheableRequest = new CacheableRequest(http.request, new Map()); -cacheableRequest = new CacheableRequest(http.request, new QuickLRU({ maxSize: 1000 })); cacheableRequest('example.com', res => { res; // $ExpectType ServerResponse | ResponseLike diff --git a/types/cal-heatmap/tslint.json b/types/cal-heatmap/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cal-heatmap/tslint.json +++ b/types/cal-heatmap/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/callsite/tslint.json b/types/callsite/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/callsite/tslint.json +++ b/types/callsite/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/calq/tslint.json b/types/calq/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/calq/tslint.json +++ b/types/calq/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/camelcase-keys/index.d.ts b/types/camelcase-keys/index.d.ts index f6be6b7f03..e29a576e6b 100644 --- a/types/camelcase-keys/index.d.ts +++ b/types/camelcase-keys/index.d.ts @@ -1,7 +1,15 @@ -// Type definitions for camelcase-keys 4.0 +// Type definitions for camelcase-keys 4.1 // Project: https://github.com/sindresorhus/camelcase-keys#readme // Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 export = camelcaseKeys; declare function camelcaseKeys(input: any, options?: { exclude?: string[] | RegExp[], deep?: boolean }): any; + +declare namespace camelcaseKeys { + interface Options { + deep?: boolean; + exclude?: Array; + } +} diff --git a/types/camelcase/camelcase-tests.ts b/types/camelcase/camelcase-tests.ts deleted file mode 100644 index 871ec5c3b2..0000000000 --- a/types/camelcase/camelcase-tests.ts +++ /dev/null @@ -1,10 +0,0 @@ -import camelCase = require('camelcase'); - -camelCase('foo-bar'); -camelCase('foo_bar'); -camelCase('Foo-Bar'); -camelCase('--foo.bar'); -camelCase('__foo__bar__'); -camelCase('foo bar'); -camelCase('foo', 'bar'); -camelCase('__foo__', '--bar'); diff --git a/types/camelcase/index.d.ts b/types/camelcase/index.d.ts deleted file mode 100644 index 83abf5a8a5..0000000000 --- a/types/camelcase/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for camelcase 4.1 -// Project: https://github.com/sindresorhus/camelcase -// Definitions by: Sam Verschueren -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = camelcase; - -declare function camelcase(...args: string[]): string; -declare namespace camelcase {} diff --git a/types/camelcase/tsconfig.json b/types/camelcase/tsconfig.json deleted file mode 100644 index bcc1b505e1..0000000000 --- a/types/camelcase/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "camelcase-tests.ts" - ] -} \ No newline at end of file diff --git a/types/camljs/tslint.json b/types/camljs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/camljs/tslint.json +++ b/types/camljs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/camo/tslint.json b/types/camo/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/camo/tslint.json +++ b/types/camo/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cannon/tslint.json b/types/cannon/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cannon/tslint.json +++ b/types/cannon/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/canvas-gauges/tslint.json b/types/canvas-gauges/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/canvas-gauges/tslint.json +++ b/types/canvas-gauges/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/carlo/carlo-tests.ts b/types/carlo/carlo-tests.ts new file mode 100644 index 0000000000..d01636d969 --- /dev/null +++ b/types/carlo/carlo-tests.ts @@ -0,0 +1,32 @@ +import carlo = require('carlo'); + +async function main() { + const app = await carlo.launch({ + title: 'Test' + }); + + app.browserForTest(); + + const window = await app.createWindow({}); + window.setBounds({ + top: 10, + width: 30 + }); +} + +(async () => { + // Launch the browser. + const app = await carlo.launch(); + + // Terminate Node.js process on app window closing. + app.on('exit', () => process.exit()); + + // Tell carlo where your web files are located. + app.serveFolder(__dirname); + + // Expose 'env' function in the web environment. + await app.exposeFunction('env', _ => process.env); + + // Navigate to the main page of your app. + await app.load('example.html'); +})(); diff --git a/types/carlo/index.d.ts b/types/carlo/index.d.ts new file mode 100644 index 0000000000..7e7aea0fc3 --- /dev/null +++ b/types/carlo/index.d.ts @@ -0,0 +1,400 @@ +// Type definitions for carlo 0.9 +// Project: https://github.com/GoogleChromeLabs/carlo#readme +// Definitions by: Adam Dierkens +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +import { Serializable, Browser, Page } from "puppeteer-core"; + +export type Channel = string; + +/** + * Evaluates a function in the context of the page + * @param pageFunction Function to be evaluated in the page context. + * @param args Arguments to pass to pageFunction. + * + * If the function passed to the Window.evaluate returns a Promise, + * then Window.evaluate would wait for the promise to resolve and return its value. + * + * If the function passed to the Window.evaluate returns a non-Serializable value, + * then Window.evaluate resolves to undefined. + */ +export type EvaluateFunction = (pageFunction: ((...args: any[]) => any) | string, ...args: Serializable[]) => Promise; + +export interface WindowOptions { + /** + * App window width in pixels. + */ + width?: number; + + /** + * App window height in pixels. + */ + height?: number; + + /** + * App window top offset in pixels. + */ + top?: number; + + /** + * App window left offset in pixels. + */ + left?: number; + + /** + * Background color using hex notation, defaults to '#ffffff'. + */ + bgcolor?: string; +} + +/** + * Set of configurable options to set on the app. + */ +export interface LaunchOptions extends WindowOptions { + /** + * Browser to be used, defaults to ['stable'] + */ + channel?: Channel[]; + + /** + * Application icon to be used in the system dock. + * Either buffer containing PNG or a path to the PNG file on the file system. + * This feature is only available in Chrome M72+. + * One can use 'canary' channel to see it in action before M72 hits stable. + */ + icon?: Buffer | string; + + /** + * Optional parameters to share between Carlo instances. + */ + paramsForReuse?: any; + + /** + * Application title + */ + title?: string; + + /** + * Path to a User Data Directory. This folder is created upon the first app launch and contains user settings and Web storage data. Defaults to '.profile'. + */ + userDataDir?: string; + + /** + * Path to a Chromium or Chrome executable to run instead of the automatically located Chrome. + * If executablePath is a relative path, then it is resolved relative to current working directory. + * Carlo is only guaranteed to work with the latest Chrome stable version. + */ + executablePath?: string; + + /** + * Additional arguments to pass to the browser instance. + */ + args?: string[]; +} + +export type AppEvent = 'exit' | 'window'; +export type WindowEvent = 'close'; + +export interface Bounds { + /** + * Top offset in pixels. + */ + top: number; + + /** + * Left offset in pixels. + */ + left: number; + + /** + * Width in pixels. + */ + width: number; + + /** + * Height in pixels. + */ + height: number; +} + +export interface Window { + /** + * 'close' - Emitted when the window closes. + * @param name 'close' + */ + on(name: AppEvent, callback: (...args: any[]) => void): void; + + /** + * Returns window bounds + */ + bounds(): Promise; + + /** + * Brings this window to front. + */ + bringToFront(): Promise; + + /** + * Closes this window. + */ + close(): Promise; + + evaluate: EvaluateFunction; + + /** + * @param name Name of the function on the window object. + * @param carloFunction Callback function which will be called in Carlo's context. + */ + exposeFunction(name: string, carloFunction: (...args: any[]) => any): Promise; + + /** + * Turns the window into the full screen mode. Behavior is platform specific. + */ + fullscreen(): Promise; + + /** + * Navigates the corresponding web page to the given uri, + * makes given params available in web page via carlo.loadParams() + * Resolves upon DOMContentLoaded event in the web page. + * @param uri Path to the resource relative to the folder passed into serveFolder() + * @param params Optional parameters to pass to the web application. + */ + load(uri: string, params?: any): Promise; + + /** + * Maximizes the window. Behavior is platform-specific. + */ + maximize(): Promise; + + /** + * Minimizes the window. Behavior is platform-specific. + */ + minimize(): Promise; + + /** + * Returns Puppeteer page object for testing. + */ + pageForTest(): Page; + + /** + * Returns the options.paramsForReuse value passed into the carlo.launch. + */ + paramsForReuse(): any; + + /** + * Same as App.serveFolder(folder[, prefix]), but only applies to current window. + * @param folder Folder with web content to make available to Chrome. + * @param prefix Prefix of the URL path to serve from the given folder. + */ + serveFolder(folder: string, prefix?: string): void; + + /** + * Same as App.serveHandler(handler), but only applies to the current window requests. + * Only single window-level handler can be installed in window. + * @param handle Network handler callback accepting the HttpRequest parameter. + */ + serveHandler(handle: (request: HttpRequest) => void): void; + + /** + * Same as App.serveOrigin(base[, prefix]), but only applies to current window. + * @param base Base to serve web content from. + * @param prefix Prefix of the URL path to serve from the given folder. + */ + serveOrigin(base: string, prefix?: string): Promise; + + /** + * Sets window bounds. Parameters top, left, width and height are all optional. + * Dimension or the offset is only applied when specified. + * @param bounds Window bounds + */ + setBounds(bounds: { + /** + * Top offset in pixels. + */ + top?: number; + + /** + * Left offset in pixels. + */ + left?: number; + + /** + * Width in pixels. + */ + width?: number; + + /** + * Height in pixels. + */ + height?: number; + }): Promise; +} + +export interface HttpRequest { + /** + * Aborts request. + * If request is a navigation request, navigation is aborted as well. + */ + abort(): Promise; + + /** + * Proceeds with the default behavior for this request. + * Either serves it from the filesystem or defers to the browser. + */ + continue(): Promise; + + /** + * Marks the request as failed. + * If request is a navigation request, navigation is still committed, but to a location that fails to be fetched. + */ + fail(): Promise; + + /** + * Fulfills the network request with the given data. 'Content-Length' header is generated in case it is not listed in the headers. + */ + fulfill(options: { + /** + * HTTP status code (200, 304, etc), defaults to 200. + */ + status: number; + + /** + * HTTP response headers. + */ + headers: object; + + /** + * Response body. + */ + body: Buffer; + }): Promise; + + /** + * Network request headers + */ + headers(): object; + + /** + * HTTP method of this network request (GET, POST, etc.) + */ + method(): string; + + /** + * Network request URL + */ + url(): string; +} + +export interface App { + /** + * 'exit' - Emitted when the last window closes. + * 'window' - Emitted when the new window opens. + * @param name 'exit' or 'window' + * @param callback + */ + on(name: AppEvent, callback: (...args: any[]) => void): void; + + /** + * Puppeteer browser object for testing. + */ + browserForTest(): Browser; + + createWindow(options?: WindowOptions): Promise; + + evaluate: EvaluateFunction; + + /** + * Closes the browser window + */ + exit(): Promise; + + /** + * The method adds a function called name on the pages' window object. + * When called, the function executes carloFunction in Node.js and returns a Promise which resolves to the return value of carloFunction. + * @param name + * @param carloFunction + */ + exposeFunction(name: string, carloFunction: (...args: any[]) => any): Promise; + + /** + * Shortcut to the main window's Window.load + * @param uri + * @param params + */ + load(uri: string, ...params: any[]): Promise; + + /** + * Running app guarantees to have main window. + * If current main window closes, a next open window becomes the main one. + */ + mainWindow(): Window; + + /** + * Makes the content of the given folder available to the Chrome web app + * @param folder Folder with web content to make available to Chrome + * @param prefix Prefix of the URL path to serve from the given folder + */ + serveFolder(folder: string, prefix?: string): void; + + /** + * Handler function is called with every network request in this app. + * It can abort, continue or fulfill each request. + * Only single app-wide handler can be registered. + * @param handler Network handler callback accepting the HttpRequest parameter. + */ + serveHandler(handler: (request: HttpRequest) => void): void; + + /** + * Fetches Carlo content from the specified origin instead of reading it from the file system, eg http://localhost:8080. + * This mode can be used for the fast development mode available in web frameworks. + * @param base Base to serve web content from. + * @param prefix Prefix of the URL path to serve from the given folder. + */ + serveOrigin(base: string, prefix?: string): void; + + /** + * Specifies image to be used as an app icon in the system dock. + * This feature is only available in Chrome M72+. One can use 'canary' channel to see it in action before M72 hits stable. + * @param image Either buffer containing PNG or a path to the PNG file on the file system. + */ + setIcon(image: Buffer | string): void; + + /** + * Returns all currently opened windows. + * Running app guarantees to have at least one open window. + */ + windows(): Window[]; +} + +/** + * Launches the browser + * @param options Set of configurable options to set on the app. + */ +export function launch(options?: LaunchOptions): Promise; + +/** + * Enters headless test mode. + */ +export function enterTestMode(): void; + +/** + * Returns additional information about the file, otherwise not available to the web. + * Available in Chrome M73+ + * + * @param file File to get additional information for + */ +export function fileInfo(file: any): Promise<{ + /** + * absolute path to the given file + */ + path: string; +}>; + +/** + * This method is available in the Web world and returns parameters passed into the window.load(). + * This is how Carlo passes initial set of handles to Node objects into the web world. + */ +export function loadParams(): Promise>; diff --git a/types/carlo/tsconfig.json b/types/carlo/tsconfig.json new file mode 100644 index 0000000000..6bb4f11fe4 --- /dev/null +++ b/types/carlo/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "target": "es2017", + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "carlo-tests.ts" + ] +} \ No newline at end of file diff --git a/types/boxen/tslint.json b/types/carlo/tslint.json similarity index 100% rename from types/boxen/tslint.json rename to types/carlo/tslint.json diff --git a/types/caseless/caseless-tests.ts b/types/caseless/caseless-tests.ts index 57eaae605e..39f6277350 100644 --- a/types/caseless/caseless-tests.ts +++ b/types/caseless/caseless-tests.ts @@ -1,9 +1,9 @@ -import caseless, { Caseless, httpify, Httpified } from "caseless"; +import caseless = require("caseless"); -new Caseless(); // $ExpectError +new caseless.Caseless(); // $ExpectError // tslint:disable-next-line: prefer-const -let c1: Caseless; +let c1: caseless.Caseless; caseless(); // $ExpectType Caseless caseless({}); // $ExpectType Caseless @@ -30,16 +30,16 @@ c2.swap(10); // $ExpectError c2.del('foo'); // $ExpectType boolean -httpify(null, {}); // $ExpectError -httpify(1, {}); // $ExpectError -httpify("2", {}); // $ExpectError -httpify({}, null); // $ExpectError -httpify({}, 1); // $ExpectError -httpify({}, "2"); // $ExpectError +caseless.httpify(null, {}); // $ExpectError +caseless.httpify(1, {}); // $ExpectError +caseless.httpify("2", {}); // $ExpectError +caseless.httpify({}, null); // $ExpectError +caseless.httpify({}, 1); // $ExpectError +caseless.httpify({}, "2"); // $ExpectError -httpify({}, {}); // $ExpectType Caseless +caseless.httpify({}, {}); // $ExpectType Caseless -const request: Httpified = {}; // $ExpectError +const request: caseless.Httpified = {}; // $ExpectError request.setHeader({}); // $ExpectType void request.setHeader('foo', 'bar'); // $ExpectType string | false diff --git a/types/caseless/index.d.ts b/types/caseless/index.d.ts index 9b19f8a150..3955664993 100644 --- a/types/caseless/index.d.ts +++ b/types/caseless/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/mikeal/caseless // Definitions by: downace // Matt R. Wilson +// Emily Klassen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -9,26 +10,28 @@ type KeyType = string; type ValueType = any; type RawDict = object; -export interface Caseless { - set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; - set(dict: RawDict): void; - has(name: KeyType): KeyType | false; - get(name: KeyType): ValueType | undefined; - swap(name: KeyType): void; - del(name: KeyType): boolean; +declare function caseless(dict?: RawDict): caseless.Caseless; + +declare namespace caseless { + function httpify(resp: object, headers: RawDict): Caseless; + + interface Caseless { + set(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; + set(dict: RawDict): void; + has(name: KeyType): KeyType | false; + get(name: KeyType): ValueType | undefined; + swap(name: KeyType): void; + del(name: KeyType): boolean; + } + + interface Httpified { + headers: RawDict; + setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; + setHeader(dict: RawDict): void; + hasHeader(name: KeyType): KeyType | false; + getHeader(name: KeyType): ValueType | undefined; + removeHeader(name: KeyType): boolean; + } } -export interface Httpified { - headers: RawDict; - setHeader(name: KeyType, value: ValueType, clobber?: boolean): KeyType | false; - setHeader(dict: RawDict): void; - hasHeader(name: KeyType): KeyType | false; - getHeader(name: KeyType): ValueType | undefined; - removeHeader(name: KeyType): boolean; -} - -export function httpify(resp: object, headers: RawDict): Caseless; - -declare function caseless(dict?: RawDict): Caseless; - -export default caseless; +export = caseless; diff --git a/types/cash/tslint.json b/types/cash/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cash/tslint.json +++ b/types/cash/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cassanknex/cassanknex-tests.ts b/types/cassanknex/cassanknex-tests.ts new file mode 100644 index 0000000000..b874d2a784 --- /dev/null +++ b/types/cassanknex/cassanknex-tests.ts @@ -0,0 +1,74 @@ +import cassanknex = require('cassanknex'); + +const knex = cassanknex({ + connection: { + contactPoints: ['127.0.0.1'] + } +}); + +knex.on('ready', (err) => { +}); + +interface BirdRow { + type: string; + canFly: boolean; +} + +const qb = knex("animals") + .insert({ + type: 'Stork', + canFly: true + }) + .into('birds'); + +qb.exec((err, res) => { +}); + +qb.eachRow((n, row) => { +}, (err) => { +}); + +interface FooRow { + id: string; + foo: string; + bar: number; + baz: string[]; +} + +const query2 = knex("keyspace") + .select("id", "foo", "bar", "baz") + .ttl('foo') + .where("id", "=", "1") + .orWhere("id", "in", ["2", "3"]) + .orWhere("baz", "=", ["bar"]) + .andWhere("foo", "IN", ["baz", "bar"]) + .limit(10) + .from("table"); + +query2.stream({ + readable() { + const row = this.read(); + }, + end() {}, + error() {} +}); + +const values = { + id: "foo", + bar: 13, + baz: ["foo", "bar"] +}; + +const query3 = knex("cassanKnexy") + .insert(values) + .usingTimestamp(250000) + .usingTTL(50000) + .into("columnFamily"); + +const [cql, params] = [query3.cql(), query3.bindings()]; + +const query4 = knex("cassanKnexy") + .update("columnFamily") + .add("bar", { foo: "baz" }) // "bar" is a map + .remove("foo", ["bar"]) // "foo" is a set + .where("id", "=", 1); diff --git a/types/cassanknex/index.d.ts b/types/cassanknex/index.d.ts new file mode 100644 index 0000000000..fd7f9c53f4 --- /dev/null +++ b/types/cassanknex/index.d.ts @@ -0,0 +1,204 @@ +// Type definitions for cassanknex 1.19 +// Project: https://github.com/azuqua/cassanknex +// Definitions by: Daniel Chao +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// + +import { EventEmitter } from "events"; +import { Client, ClientOptions, types, ResultCallback } from "cassandra-driver"; +import * as Long from "long"; +import { Readable } from "stream"; + +declare function CassanKnex(options?: CassanKnex.DriverOptions): CassanKnex.CassanKnex; + +export = CassanKnex; + +declare namespace CassanKnex { + interface DriverOptions { + debug?: boolean; + connection?: Client | ClientOptions; + } + + /** + * Will return the `never` type if `T[K]` is not a member of `Type`, for all `T[K]`. + */ + type TypeMatchedValue = T[K] extends Type ? This : never; + + interface MappedDict { + [key: string]: B; + } + + type InRestriction = 'in' | 'IN'; + + type ComparisonRestriction = '=' | '<' | '>' | '<=' | '>='; + + type SelectAsClause = { + [P in keyof T]: string; + }; + + interface CassanKnex extends EventEmitter { + (keyspace?: string): QueryBuilderRoot; + } + + interface StreamParams { + readable: (this: Readable) => any; + end: (this: Readable) => any; + error: (err: Error) => any; + } + + interface QueryBuilderRoot { + insert (values: Partial | T): InsertQueryBuilder; + select (...columns: Array): SelectQueryBuilder; + select (values: SelectAsClause): SelectQueryBuilder; + update (table: string): UpdateQueryBuilder; + delete (): DeleteQueryBuilder; + alterColumnFamily (columnFamily: string): AlterColumnFamilyQueryBuilder; + createColumnFamily (columnFamily: string): CreateColumnFamilyQueryBuilder; + createColumnFamilyIfNotExists (columnFamily: string): CreateColumnFamilyQueryBuilder; + createIndex (columnFamily: string, indexName: string, column: keyof T): QueryBuilder; + createIndexCustom (columnFamily: string, indexName: string, column: keyof T): QueryBuilder & CreateableIndexBuilder; + createType (typeName: string): CreateTypeQueryBuilder; + createTypeIfNotExists (typeName: string): CreateTypeQueryBuilder; + dropColumnFamily(columnFamily: string): QueryBuilder; + dropColumnFamilyIfExists(columnFamily: string): QueryBuilder; + dropType(): QueryBuilder; + dropTypeIfExists(): QueryBuilder; + truncate(columnFamily: string): QueryBuilder; + alterKeyspace(keyspace: string): KeyspaceQueryBuilder; + createKeyspace(keyspace: string): KeyspaceQueryBuilder; + createKeyspaceIfNotExists(keyspace: string): KeyspaceQueryBuilder; + dropKeyspace(): QueryBuilder; + dropKeyspaceIfExists(): QueryBuilder; + } + + interface QueryBuilder { + cql(): string; + bindings(): any[]; + exec(cb: ResultCallback): undefined; + eachRow(onEachRow: (n: number, row: types.Row) => any, onError: (err: Error) => any): undefined; + stream(params: StreamParams): undefined; + } + + interface FieldValueQueryBuilder { + decimal (columnName: K): TypeMatchedValue; + boolean (columnName: K): TypeMatchedValue; + blob (columnName: K): TypeMatchedValue; + timestamp (columnName: K): TypeMatchedValue; + date (columnName: K): TypeMatchedValue; + inet (columnName: K): TypeMatchedValue; + bigint (columnName: K): TypeMatchedValue; + counter (columnName: K): TypeMatchedValue; + double (columnName: K): TypeMatchedValue; + int (columnName: K): TypeMatchedValue; + float (columnName: K): TypeMatchedValue; + map (columnName: K, a: A, b: B): TypeMatchedValue, this>; + ascii (columnName: K): TypeMatchedValue; + text (columnName: K): TypeMatchedValue; + timeuuid (columnName: K): TypeMatchedValue; + uuid (columnName: K): TypeMatchedValue; + varchar (columnName: K): TypeMatchedValue; + list (columnName: K, typeName: string): TypeMatchedValue; + primary(primaryKey: string): this; + set (columnName: K, a: A): TypeMatchedValue, this>; + } + + interface CreateableColumnFamilyBuilder { + withCaching(): this; + withCompression(): this; + withCompaction(): this; + withClusteringOrderBy (value: K, direction: 'desc' | 'asc'): this; + } + + interface CreateableIndexBuilder { + withOptions(opts: MappedDict): this; + } + + interface KeyspaceableQueryBuilder { + withNetworkTopologyStrategy(strategy: MappedDict): this; + withSimpleStrategy(replicas: number): this; + withDurableWrites(durableWrites: boolean): this; + } + + interface InsertableQueryBuilder { + into(table: string): this; + ifNotExists(): this; + } + + interface TtlableQueryBuilder { + usingTimestamp(timestamp: number): this; + usingTTL(ttl: number): this; + } + + interface WhereableQueryBuilder { + where (lhs: K, comparison: InRestriction, rhs: Array): this; + where (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + orWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + orWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + andWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + andWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + tokenWhere (lhs: K, comparison: InRestriction, rhs: Array): this; + tokenWhere (lhs: K, comparison: ComparisonRestriction, rhs: T[K]): this; + ttl (columnName: K): this; + } + + interface IfableQueryBuilder { + if (lhs: K, comparison: ComparisonRestriction, rhs: T[K] | null): this; + } + + interface LimitableQueryBuilder { + limit(limit: number): this; + limitPerPartition(limit: number): this; + } + + interface FromableQueryBuilder { + from(table: string): this; + } + + interface UpdateableQueryBuilder { + set (key: K, value: T[K]): this; + set(object: Partial): this; + add (key: K, value: { [str: string]: T[K] }): TypeMatchedValue, this>; + add (key: K, value: Array): TypeMatchedValue, this>; + add(object: Partial): this; + remove (key: K, value: Array): this; + remove(object: Partial): this; + increment(column: keyof T, amount: number): this; + increment(object: Partial): this; + decrement(column: keyof T, amount: number): this; + decrement(object: Partial): this; + } + + interface AlterableQueryBuilder { + drop (...columns: K[]): this; + rename (column: K, newColumn: K): this; + alter (column: K, newType: string): this; + } + + type InsertQueryBuilder = QueryBuilder + & InsertableQueryBuilder + & TtlableQueryBuilder; + type SelectQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & LimitableQueryBuilder + & FromableQueryBuilder; + type UpdateQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & UpdateableQueryBuilder + & IfableQueryBuilder + & TtlableQueryBuilder; + type DeleteQueryBuilder = QueryBuilder + & WhereableQueryBuilder + & FromableQueryBuilder; + type CreateColumnFamilyQueryBuilder = QueryBuilder + & FieldValueQueryBuilder + & CreateableColumnFamilyBuilder; + type KeyspaceQueryBuilder = QueryBuilder + & KeyspaceableQueryBuilder; + type CreateTypeQueryBuilder = QueryBuilder + & FieldValueQueryBuilder; + type AlterColumnFamilyQueryBuilder = QueryBuilder + & AlterableQueryBuilder + & FieldValueQueryBuilder; +} diff --git a/types/cassanknex/tsconfig.json b/types/cassanknex/tsconfig.json new file mode 100644 index 0000000000..d77cbaca70 --- /dev/null +++ b/types/cassanknex/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", + "cassanknex-tests.ts" + ] +} \ No newline at end of file diff --git a/types/cassanknex/tslint.json b/types/cassanknex/tslint.json new file mode 100644 index 0000000000..4074d3cece --- /dev/null +++ b/types/cassanknex/tslint.json @@ -0,0 +1,7 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + "no-unnecessary-generics": false, + "strict-export-declare-modifiers": false + } +} \ No newline at end of file diff --git a/types/cbor/tslint.json b/types/cbor/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cbor/tslint.json +++ b/types/cbor/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/centra/centra-tests.ts b/types/centra/centra-tests.ts new file mode 100644 index 0000000000..908d94b41b --- /dev/null +++ b/types/centra/centra-tests.ts @@ -0,0 +1,52 @@ +import centra = require('centra'); +import { URL } from 'url'; + +function typeTests() { + // Test chaining + centra('http://google.com') + .query('param', 'value') + .path('mail') + .body({ a: 1, b: 2 }) + .header({ a: 'b' }) + .header('a', 'b') + .timeout(123) + .stream() + .compress() + .option('host', '123') + .option('port', 123) + .send().then(resp => { + resp.json().then((s: string) => s); + resp.text().then((s: string) => s); + resp.statusCode; + resp.coreRes; + resp.headers['asdf']; + resp.body.buffer.byteLength; + }); + + centra(new URL('google.com')) + .query('page', '2'); +} + +async function functionalTests() { + await centra('http://example.com').send().then(async r => { + if (r.statusCode !== 200) { + throw new Error('Bad status code'); + } + r.text().then(t => t); + }); + + await centra(new URL('https://jsonplaceholder.typicode.com/todos')) + .query('userId', 1) + .timeout(1000) + .compress() + .send() + .then(r => { + r.json().then((todos: any[]) => { + if (!todos.every(t => t.userId === 1)) { + throw new Error('Query params did not work'); + } + }); + }); +} + +functionalTests(); diff --git a/types/centra/index.d.ts b/types/centra/index.d.ts new file mode 100644 index 0000000000..ae08d8ac2b --- /dev/null +++ b/types/centra/index.d.ts @@ -0,0 +1,54 @@ +// Type definitions for centra 2.2 +// Project: https://github.com/ethanent/centra +// Definitions by: Tony Wooster +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.1 + +/// + +import { RequestOptions, IncomingMessage } from 'http'; +import { URL } from 'url'; + +interface CentraFactory { + (url: URL | string, method?: string): Centra.Request; +} + +declare const Centra: CentraFactory; + +declare namespace Centra { + interface Response { + coreRes: IncomingMessage; + headers: IncomingMessage['headers']; + statusCode: IncomingMessage['statusCode']; + body: Buffer; + + json(): Promise; + text(): Promise; + } + + interface Request { + url: URL; + method: string; + data: string | Buffer | null; + sendDataAs: 'form' | 'json' | 'buffer' | null; + reqHeaders: { [k: string]: string }; + streamEnabled: boolean; + compressionEnabled: boolean; + timeoutTime: number | null; + coreOptions: RequestOptions; + + query(key: string, value: any): this; + query(params: { [k: string]: any }): this; + path(relativePath: string): this; + body(data: any, sendAs?: 'json' | 'buffer' | 'form'): this; + header(key: string, value: string): this; + header(headers: { [k: string]: string }): this; + timeout(timeMs: number): this; + option(key: T, value: RequestOptions[T]): this; + stream(): this; + compress(): this; + send(): Promise; + } +} + +export = Centra; diff --git a/types/fkill/tsconfig.json b/types/centra/tsconfig.json similarity index 94% rename from types/fkill/tsconfig.json rename to types/centra/tsconfig.json index 2e36e29395..6d690a3120 100644 --- a/types/fkill/tsconfig.json +++ b/types/centra/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "fkill-tests.ts" + "centra-tests.ts" ] } diff --git a/types/camelcase/tslint.json b/types/centra/tslint.json similarity index 100% rename from types/camelcase/tslint.json rename to types/centra/tslint.json diff --git a/types/cesium/index.d.ts b/types/cesium/index.d.ts index 398d05ad33..34f9fd148d 100644 --- a/types/cesium/index.d.ts +++ b/types/cesium/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for cesium 1.47 +// Type definitions for cesium 1.54 // Project: http://cesiumjs.org // Definitions by: Aigars Zeiza // Harry Nicholls // Jared Szechy // Radek Goláň jr. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 3.0 // tslint:disable-next-line:export-just-namespace export = Cesium; @@ -312,7 +312,7 @@ declare namespace Cesium { clockRange: ClockRange; canAnimate: boolean; shouldAnimate: boolean; - onTick: Event; + onTick: Event<[Clock]>; constructor(options: { startTime?: JulianDate; stopTime?: JulianDate; @@ -704,11 +704,11 @@ declare namespace Cesium { constructor(options?: { tilingScheme?: TilingScheme; ellipsoid?: Ellipsoid }); } - class Event { + class Event { numberOfListeners: number; - addEventListener(listener: () => void, scope?: any): Event.RemoveCallback; - removeEventListener(listener: () => void, scope?: any): boolean; - raiseEvent(...args: any[]): void; + addEventListener(listener: (...args: T) => void, scope?: any): Event.RemoveCallback; + removeEventListener(listener: (...args: T) => void, scope?: any): boolean; + raiseEvent(...args: T): void; } namespace Event { @@ -1393,7 +1393,7 @@ declare namespace Cesium { class ScreenSpaceEventHandler { constructor(element?: HTMLCanvasElement); - setInputAction(action: () => void, type: number, modifier?: number): void; + setInputAction(action: (click: { position: Cartesian2 }) => void, type: number, modifier?: number): void; getInputAction(type: number, modifier?: number): () => void; removeInputAction(type: number, modifier?: number): void; isDestroyed(): boolean; @@ -1512,7 +1512,7 @@ declare namespace Cesium { retry: boolean; error: Error; constructor(provider: ImageryProvider | TerrainProvider, message: string, x?: number, y?: number, level?: number, timesRetried?: number, error?: Error); - static handleError(previousError: TileProviderError, provider: ImageryProvider | TerrainProvider, event: Event, + static handleError(previousError: TileProviderError, provider: ImageryProvider | TerrainProvider, event: Event<[TileProviderError]>, message: string, x: number, y: number, level: number, retryFunction: TileProviderError.RetryFunction, errorDetails?: Error): TileProviderError; static handleSuccess(previousError: TileProviderError): void; @@ -1562,7 +1562,7 @@ declare namespace Cesium { } class TimeIntervalCollection { - readonly changedEvent: Event; + readonly changedEvent: Event<[TimeIntervalCollection]>; readonly start: JulianDate; readonly isStartIncluded: boolean; readonly stop: JulianDate; @@ -3134,6 +3134,15 @@ declare namespace Cesium { static clone(hpr: HeadingPitchRange, result?: HeadingPitchRange): HeadingPitchRange; } + // tslint:disable-next-line:no-unnecessary-class + class Cesium3DTileset { + constructor(Cesium3DTilesetItem: { + url: string; + maximumScreenSpaceError: number; + maximumNumberOfLoadedTiles: number; + }) + } + class ImageryLayer { alpha: number; brightness: number; @@ -4379,8 +4388,8 @@ declare namespace Cesium { allowDataSourcesToSuspendAnimation: boolean; trackedEntity: Entity; selectedEntity: Entity; - readonly trackedEntityChanged: Event; - readonly selectedEntityChanged: Event; + readonly trackedEntityChanged: Event<[Entity?]>; + readonly selectedEntityChanged: Event<[Entity?]>; readonly shadowMap: ShadowMap; readonly vrButton: VRButton; shadows: boolean; diff --git a/types/chai-as-promised/tslint.json b/types/chai-as-promised/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-as-promised/tslint.json +++ b/types/chai-as-promised/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-datetime/tslint.json b/types/chai-datetime/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-datetime/tslint.json +++ b/types/chai-datetime/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-dom/tslint.json b/types/chai-dom/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-dom/tslint.json +++ b/types/chai-dom/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-enzyme/tslint.json b/types/chai-enzyme/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-enzyme/tslint.json +++ b/types/chai-enzyme/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-fuzzy/tslint.json b/types/chai-fuzzy/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-fuzzy/tslint.json +++ b/types/chai-fuzzy/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-http/chai-http-tests.ts b/types/chai-http/chai-http-tests.ts deleted file mode 100644 index 37a4df794e..0000000000 --- a/types/chai-http/chai-http-tests.ts +++ /dev/null @@ -1,141 +0,0 @@ -import fs = require('fs'); -import http = require('http'); -import chai = require('chai'); -import ChaiHttp = require('chai-http'); -import when = require('when'); - -chai.use(ChaiHttp); - -// ReSharper disable WrongExpressionStatement - -// Add promise support if this does not exist natively. -if (!global.Promise) { - chai.request.addPromises(when.promise); -} - -declare const app: http.Server; - -chai.request(app).get('/'); -chai.request('http://localhost:8080').get('/'); - -chai.request(app) - .put('/user/me') - .set('X-API-Key', 'foobar') - .send({ password: '123', confirmPassword: '123' }); - -chai.request(app) - .post('/user/me') - .field('_method', 'put') - .field('password', '123') - .field('confirmPassword', '123'); - -chai.request(app) - .post('/user/avatar') - .attach('imageField', fs.readFileSync('avatar.png'), 'avatar.png'); - -chai.request(app) - .get('/protected') - .auth('user', 'pass'); - -// HTTPS request, from: https://github.com/visionmedia/superagent/commit/6158efbf42cb93d77c1a70887284be783dd7dabe -const ca = fs.readFileSync('ca.cert.pem'); -const key = fs.readFileSync('key.pem'); -const cert = fs.readFileSync('cert.pem'); -const callback = (err: any, res: ChaiHttp.Response) => {}; - -chai.request(app) - .post('/secure') - .ca(ca) - .key(key) - .cert(cert) - .end(callback); - -const pfx = fs.readFileSync('cert.pfx'); -chai.request(app) - .post('/secure') - .pfx(pfx) - .end(callback); - -chai.request(app) - .get('/search') - .query({ name: 'foo', limit: 10 }); - -chai.request(app) - .get('/download') - .buffer() - .parse((res, cb) => { - let data = ''; - res.setEncoding('binary'); - res.on('data', (chunk: any) => { data += chunk; }); - res.on('end', () => { cb(undefined, new Buffer(data, 'binary')); }); - }); - -chai.request(app) - .put('/user/me') - .send({ passsword: '123', confirmPassword: '123' }) - .end((err: any, res: ChaiHttp.Response) => { - chai.expect(err).to.be.null; - chai.expect(res).to.have.status(200); - }); - -chai.request(app) - .put('/user/me') - .send({ passsword: '123', confirmPassword: '123' }) - .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)) - .catch((err: any) => { throw err; }); - -chai.request(app) - .keepOpen() - .close((err: any) => { throw err; }); - -const agent = chai.request.agent(app); - -agent - .post('/session') - .send({ username: 'me', password: '123' }) - .then((res: ChaiHttp.Response) => { - chai.expect(res).to.have.cookie('sessionid'); - // The `agent` now has the sessionid cookie saved, and will send it - // back to the server in the next request: - return agent.get('/user/me') - .then((res: ChaiHttp.Response) => chai.expect(res).to.have.status(200)); - }); - -agent.close((err: any) => { throw err; }); - -function test1() { - const req = chai.request(app).get('/'); - req.then((res: ChaiHttp.Response) => { - chai.expect(res).to.have.status(200); - chai.expect(res).to.have.header('content-type', 'text/plain'); - chai.expect(res).to.have.header('content-type', /^text/); - chai.expect(res).to.have.headers; - chai.expect('127.0.0.1').to.be.an.ip; - chai.expect(res).to.be.json; - chai.expect(res).to.be.html; - chai.expect(res).to.be.text; - chai.expect(res).to.redirect; - chai.expect(res).to.redirectTo('http://example.com'); - chai.expect(res).to.have.param('orderby'); - chai.expect(res).to.have.param('orderby', 'date'); - chai.expect(res).to.not.have.param('limit'); - chai.expect(req).to.have.cookie('session_id'); - chai.expect(req).to.have.cookie('session_id', '1234'); - chai.expect(req).to.not.have.cookie('PHPSESSID'); - chai.expect(res).to.have.cookie('session_id'); - chai.expect(res).to.have.cookie('session_id', '1234'); - chai.expect(res).to.not.have.cookie('PHPSESSID'); - chai.expect(res.body).to.have.property('version', '4.0.0'); - chai.expect(res.text).to.equal(''); - }, (err: any) => { - throw err; - }); -} - -when(chai.request(app).get('/')).done(() => console.log('success'), () => console.log('failure')); - -Promise.resolve(1) - .then(val => chai.request(app).get(`/user/${val}`)) - .then(res => { - chai.expect(res).to.have.status(200); - }); diff --git a/types/chai-http/index.d.ts b/types/chai-http/index.d.ts deleted file mode 100644 index de3caa13e7..0000000000 --- a/types/chai-http/index.d.ts +++ /dev/null @@ -1,78 +0,0 @@ -// Type definitions for chai-http 3.0 -// Project: https://github.com/chaijs/chai-http -// Definitions by: Wim Looman -// Liam Jones -// Federico Caselli -// Bas Luksenburg -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// -/// - -import * as request from 'superagent'; - -declare global { - namespace Chai { - interface ChaiStatic { - request: ChaiHttpRequest; - } - - interface ChaiHttpRequest { - (server: any): ChaiHttp.Agent; - agent(server: any): ChaiHttp.Agent; - addPromises(promiseConstructor: any): void; - } - - interface Assertion { - status(code: number): Assertion; - header(key: string, value?: string | RegExp): Assertion; - headers: Assertion; - json: Assertion; - text: Assertion; - html: Assertion; - redirect: Assertion; - redirectTo(location: string): Assertion; - param(key: string, value?: string): Assertion; - cookie(key: string, value?: string): Assertion; - } - - interface TypeComparison { - ip: Assertion; - } - } - - namespace ChaiHttp { - interface Promise { - then(onFulfilled: (value: T) => U, onRejected?: (reason: any) => U): Promise; - } - - interface Response { - body: any; - type: string; - status: number; - text: string; - setEncoding(encoding: string): void; - on(event: string, fn: (...args: any[]) => void): void; - } - - interface Agent { - get(url: string, callback?: (err: any, res: Response) => void): request.Request; - post(url: string, callback?: (err: any, res: Response) => void): request.Request; - put(url: string, callback?: (err: any, res: Response) => void): request.Request; - head(url: string, callback?: (err: any, res: Response) => void): request.Request; - del(url: string, callback?: (err: any, res: Response) => void): request.Request; - options(url: string, callback?: (err: any, res: Response) => void): request.Request; - patch(url: string, callback?: (err: any, res: Response) => void): request.Request; - keepOpen(): Agent; - close(callback?: (err: any) => void): Agent; - } - - interface TypeComparison { - ip: any; - } - } -} - -declare function chaiHttp(chai: any, utils: any): void; -export = chaiHttp; diff --git a/types/chai-http/tsconfig.json b/types/chai-http/tsconfig.json deleted file mode 100644 index 45d92cf188..0000000000 --- a/types/chai-http/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "chai-http-tests.ts" - ] -} \ No newline at end of file diff --git a/types/chai-jquery/tslint.json b/types/chai-jquery/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-jquery/tslint.json +++ b/types/chai-jquery/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-moment/chai-moment-tests.ts b/types/chai-moment/chai-moment-tests.ts new file mode 100644 index 0000000000..6354c4796b --- /dev/null +++ b/types/chai-moment/chai-moment-tests.ts @@ -0,0 +1,14 @@ +import { assert, expect, use } from 'chai'; +import chaiMoment = require('chai-moment'); + +use(chaiMoment); + +// bdd style +expect('2019-03-14').to.be.afterMoment('2019-03-12', 'day'); +expect('2019-03-14').to.be.beforeMoment('2019-03-16'); +expect('2019-03-14').to.be.sameMoment('2019-03-14', 'day'); + +// tdd style +assert.afterMoment('2019-03-14', '2019-03-12'); +assert.beforeMoment('2019-03-14', '2019-03-18', 'day'); +assert.sameMoment('2019-03-14', '2019-03-14', 'day'); diff --git a/types/chai-moment/index.d.ts b/types/chai-moment/index.d.ts new file mode 100644 index 0000000000..0b19b7573f --- /dev/null +++ b/types/chai-moment/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for chai-moment 0.1 +// Project: https://github.com/picardy/chai-moment +// Definitions by: Chris Godsey +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare global { + namespace Chai { + interface Assertion extends LanguageChains, NumericComparison, TypeComparison { + afterMoment(expected: string, granularity?: string): void; + beforeMoment(expected: string, granularity?: string): void; + sameMoment(expected: string, granularity?: string): void; + } + + interface Assert { + afterMoment(val: any, exp: any, granularity?: any, msg?: any): void; + beforeMoment(val: any, exp: any, granularity?: any, msg?: any): void; + sameMoment(val: any, exp: any, granularity?: any, msg?: any): void; + } + } +} + +declare function chaiMoment(chai: any, utils: any): void; +export = chaiMoment; diff --git a/types/chai-moment/tsconfig.json b/types/chai-moment/tsconfig.json new file mode 100644 index 0000000000..571fe4f114 --- /dev/null +++ b/types/chai-moment/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", + "chai-moment-tests.ts" + ] +} diff --git a/types/chai-moment/tslint.json b/types/chai-moment/tslint.json new file mode 100644 index 0000000000..2750cc0197 --- /dev/null +++ b/types/chai-moment/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" } \ No newline at end of file diff --git a/types/chai-spies/tslint.json b/types/chai-spies/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-spies/tslint.json +++ b/types/chai-spies/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-string/tslint.json b/types/chai-string/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-string/tslint.json +++ b/types/chai-string/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chai-things/tslint.json b/types/chai-things/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chai-things/tslint.json +++ b/types/chai-things/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chance/tslint.json b/types/chance/tslint.json index 2ef6444ebb..a2a331133e 100644 --- a/types/chance/tslint.json +++ b/types/chance/tslint.json @@ -3,6 +3,7 @@ "rules": { "adjacent-overload-signatures": false, "dt-header": false, + "npm-naming": false, "no-declare-current-package": false, "no-single-declare-module": false, "no-unnecessary-generics": false, diff --git a/types/change-emitter/tslint.json b/types/change-emitter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/change-emitter/tslint.json +++ b/types/change-emitter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chart.js/chart.js-tests.ts b/types/chart.js/chart.js-tests.ts index e35c556b56..879ef9bb3f 100644 --- a/types/chart.js/chart.js-tests.ts +++ b/types/chart.js/chart.js-tests.ts @@ -115,7 +115,9 @@ const scaleOptions: Chart.RadialLinearScale = { lineArc: false, display: false, scaleLabel: { - display: false + display: false, + lineHeight: 1, + padding: 0, }, }; const radarChartOptions: Chart.RadialChartOptions = { diff --git a/types/chart.js/index.d.ts b/types/chart.js/index.d.ts index 7745713c84..111c8da57f 100644 --- a/types/chart.js/index.d.ts +++ b/types/chart.js/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for Chart.js 2.7 -// Project: https://github.com/nnnick/Chart.js, http://www.chartjs.org +// Project: https://github.com/nnnick/Chart.js, https://www.chartjs.org // Definitions by: Alberto Nuti // Fabien Lavocat // KentarouTakeda @@ -33,7 +33,7 @@ declare class Chart { clear: () => {}; toBase64Image: () => string; generateLegend: () => {}; - getElementAtEvent: (e: any) => {}; + getElementAtEvent: (e: any) => [{}]; getElementsAtEvent: (e: any) => Array<{}>; getDatasetAtEvent: (e: any) => Array<{}>; getDatasetMeta: (index: number) => Meta; @@ -60,62 +60,8 @@ declare class Chart { static Tooltip: Chart.ChartTooltipsStaticConfiguration; } declare class PluginServiceStatic { - register(plugin: PluginServiceGlobalRegistration & PluginServiceRegistrationOptions): void; - unregister(plugin: PluginServiceGlobalRegistration & PluginServiceRegistrationOptions): void; -} - -interface PluginServiceGlobalRegistration { - id?: string; -} - -interface PluginServiceRegistrationOptions { - beforeInit?(chartInstance: Chart, options?: any): void; - afterInit?(chartInstance: Chart, options?: any): void; - - beforeUpdate?(chartInstance: Chart, options?: any): void; - afterUpdate?(chartInstance: Chart, options?: any): void; - - beforeLayout?(chartInstance: Chart, options?: any): void; - afterLayout?(chartInstance: Chart, options?: any): void; - - beforeDatasetsUpdate?(chartInstance: Chart, options?: any): void; - afterDatasetsUpdate?(chartInstance: Chart, options?: any): void; - - beforeDatasetUpdate?(chartInstance: Chart, options?: any): void; - afterDatasetUpdate?(chartInstance: Chart, options?: any): void; - - // This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw - // to do something on each animation frame - beforeRender?(chartInstance: Chart, options?: any): void; - afterRender?(chartInstance: Chart, options?: any): void; - - // Easing is for animation - beforeDraw?(chartInstance: Chart, easing: string, options?: any): void; - afterDraw?(chartInstance: Chart, easing: string, options?: any): void; - - // Before the datasets are drawn but after scales are drawn - beforeDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void; - afterDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void; - - beforeDatasetDraw?(chartInstance: Chart, easing: string, options?: any): void; - afterDatasetDraw?(chartInstance: Chart, easing: string, options?: any): void; - - // Called before drawing the `tooltip`. If any plugin returns `false`, - // the tooltip drawing is cancelled until another `render` is triggered. - beforeTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void; - // Called after drawing the `tooltip`. Note that this hook will not, - // be called if the tooltip drawing has been previously cancelled. - afterTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void; - - // Called when an event occurs on the chart - beforeEvent?(chartInstance: Chart, event: Event, options?: any): void; - afterEvent?(chartInstance: Chart, event: Event, options?: any): void; - - resize?(chartInstance: Chart, newChartSize: Chart.ChartSize, options?: any): void; - destroy?(chartInstance: Chart): void; - - /** @deprecated since version 2.5.0. Use `afterLayout` instead. */ - afterScaleUpdate?(chartInstance: Chart, options?: any): void; + register(plugin: Chart.PluginServiceGlobalRegistration & Chart.PluginServiceRegistrationOptions): void; + unregister(plugin: Chart.PluginServiceGlobalRegistration & Chart.PluginServiceRegistrationOptions): void; } interface Meta { @@ -357,7 +303,7 @@ declare namespace Chart { cornerRadius?: number; multiKeyBackground?: string; callbacks?: ChartTooltipCallback; - filter?(item: ChartTooltipItem): boolean; + filter?(item: ChartTooltipItem, data: ChartData): boolean; itemSort?(itemA: ChartTooltipItem, itemB: ChartTooltipItem): number; position?: string; caretPadding?: number; @@ -480,10 +426,12 @@ declare namespace Chart { interface ScaleTitleOptions { display?: boolean; labelString?: string; + lineHeight?: number | string; fontColor?: ChartColor; fontFamily?: string; fontSize?: number; fontStyle?: string; + padding?: ChartLayoutPaddingObject | number; } interface TickOptions extends NestedTickOptions { @@ -566,7 +514,7 @@ declare namespace Chart { hoverBorderWidth?: number | number[]; label?: string; lineTension?: number; - steppedLine?: 'before' | 'after' | boolean; + steppedLine?: 'before' | 'after' | 'middle' | boolean; pointBorderColor?: ChartColor | ChartColor[]; pointBackgroundColor?: ChartColor | ChartColor[]; pointBorderWidth?: number | number[]; @@ -683,6 +631,60 @@ declare namespace Chart { x: number; y: number; } + + interface PluginServiceGlobalRegistration { + id?: string; + } + + interface PluginServiceRegistrationOptions { + beforeInit?(chartInstance: Chart, options?: any): void; + afterInit?(chartInstance: Chart, options?: any): void; + + beforeUpdate?(chartInstance: Chart, options?: any): void; + afterUpdate?(chartInstance: Chart, options?: any): void; + + beforeLayout?(chartInstance: Chart, options?: any): void; + afterLayout?(chartInstance: Chart, options?: any): void; + + beforeDatasetsUpdate?(chartInstance: Chart, options?: any): void; + afterDatasetsUpdate?(chartInstance: Chart, options?: any): void; + + beforeDatasetUpdate?(chartInstance: Chart, options?: any): void; + afterDatasetUpdate?(chartInstance: Chart, options?: any): void; + + // This is called at the start of a render. It is only called once, even if the animation will run for a number of frames. Use beforeDraw or afterDraw + // to do something on each animation frame + beforeRender?(chartInstance: Chart, options?: any): void; + afterRender?(chartInstance: Chart, options?: any): void; + + // Easing is for animation + beforeDraw?(chartInstance: Chart, easing: string, options?: any): void; + afterDraw?(chartInstance: Chart, easing: string, options?: any): void; + + // Before the datasets are drawn but after scales are drawn + beforeDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void; + afterDatasetsDraw?(chartInstance: Chart, easing: string, options?: any): void; + + beforeDatasetDraw?(chartInstance: Chart, easing: string, options?: any): void; + afterDatasetDraw?(chartInstance: Chart, easing: string, options?: any): void; + + // Called before drawing the `tooltip`. If any plugin returns `false`, + // the tooltip drawing is cancelled until another `render` is triggered. + beforeTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void; + // Called after drawing the `tooltip`. Note that this hook will not, + // be called if the tooltip drawing has been previously cancelled. + afterTooltipDraw?(chartInstance: Chart, tooltipData?: any, options?: any): void; + + // Called when an event occurs on the chart + beforeEvent?(chartInstance: Chart, event: Event, options?: any): void; + afterEvent?(chartInstance: Chart, event: Event, options?: any): void; + + resize?(chartInstance: Chart, newChartSize: ChartSize, options?: any): void; + destroy?(chartInstance: Chart): void; + + /** @deprecated since version 2.5.0. Use `afterLayout` instead. */ + afterScaleUpdate?(chartInstance: Chart, options?: any): void; + } } export = Chart; diff --git a/types/chartist/tslint.json b/types/chartist/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chartist/tslint.json +++ b/types/chartist/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/checksum/tslint.json b/types/checksum/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/checksum/tslint.json +++ b/types/checksum/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cheerio/cheerio-tests.ts b/types/cheerio/cheerio-tests.ts index 719c0c70da..89ffb9e28f 100644 --- a/types/cheerio/cheerio-tests.ts +++ b/types/cheerio/cheerio-tests.ts @@ -24,6 +24,8 @@ if ($fromElement("ul > li").length !== 3) { throw new Error("Expecting 3 elements when passing `CheerioElement` to `load()`"); } +$ = cheerio.load(Buffer.from(html)); + $ = cheerio.load(html, { normalizeWhitespace: true, xmlMode: true diff --git a/types/cheerio/index.d.ts b/types/cheerio/index.d.ts index 6c893021a3..f25c978ed0 100644 --- a/types/cheerio/index.d.ts +++ b/types/cheerio/index.d.ts @@ -1,8 +1,10 @@ // Type definitions for Cheerio v0.22.0 // Project: https://github.com/cheeriojs/cheerio -// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani , LiJinyao , Chennakrishna , AzSiAz +// Definitions by: Bret Little , VILIC VANE , Wayne Maurer , Umar Nizamani , LiJinyao , Chennakrishna , AzSiAz , Ryo Ota // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + interface Cheerio { // Document References // Cheerio https://github.com/cheeriojs/cheerio @@ -266,7 +268,7 @@ interface CheerioElement { } interface CheerioAPI extends CheerioSelector, CheerioStatic { - load(html: string, options?: CheerioOptionsInterface): CheerioStatic; + load(html: string | Buffer, options?: CheerioOptionsInterface): CheerioStatic; load(element: CheerioElement, options?: CheerioOptionsInterface): CheerioStatic; } diff --git a/types/cheerio/tslint.json b/types/cheerio/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cheerio/tslint.json +++ b/types/cheerio/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/child-process-promise/child-process-promise-tests.ts b/types/child-process-promise/child-process-promise-tests.ts new file mode 100644 index 0000000000..365e7e8f60 --- /dev/null +++ b/types/child-process-promise/child-process-promise-tests.ts @@ -0,0 +1,15 @@ +import * as cpp from "child-process-promise"; + +import { + ChildProcess +} from 'child_process'; + +const a = cpp.exec("echo \"Hello world!\""); +a.childProcess; // $ExpectType ChildProcess + +(async () => { + const at = await a; + at.childProcess; // $ExpectType ChildProcess + at.stdout; // $ExpectType string + at.stderr; // $ExpectType string +})(); diff --git a/types/child-process-promise/index.d.ts b/types/child-process-promise/index.d.ts new file mode 100644 index 0000000000..344657f4f1 --- /dev/null +++ b/types/child-process-promise/index.d.ts @@ -0,0 +1,104 @@ +// Type definitions for child-process-promise 2.2 +// Project: https://github.com/patrick-steele-idem/child-process-promise +// Definitions by: Luis Paulo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/// + +import { + ChildProcess, + ExecFileOptionsWithBufferEncoding, ExecFileOptionsWithOtherEncoding, + ExecFileOptionsWithStringEncoding, + ExecOptions, + ForkOptions, + SpawnOptions +} from 'child_process'; + +/** + * Simple wrapper around the child_process module that makes use of promises + */ + +export interface PromiseResult { + childProcess: ChildProcess; + stdout: Enc; + stderr: Enc; +} + +export interface SpawnPromiseResult extends PromiseResult { + code: number; +} + +export interface ChildProcessPromise extends Promise { + childProcess: ChildProcess; +} + +export interface Options { + /** + * Pass an additional capture option to buffer the result of stdout and/or stderr + * Default: [] + */ + capture?: []|['stdout'|'stderr']|['stdout', 'stderr']|['stderr', 'stdout']; + /** + * Array of the numbers that should be interpreted as successful execution codes + * Default: [0] + */ + successfulExitCodes?: number[]; +} + +export function exec( + command: Readonly, + options: Readonly +): ChildProcessPromise>; +export function exec( + command: Readonly, + options: Readonly +): ChildProcessPromise>; +export function exec( + command: Readonly, + options: Readonly +): ChildProcessPromise>; +export function exec( + command: Readonly, + options?: Readonly +): ChildProcessPromise>; + +export function execFile( + file: Readonly, + options: Readonly +): ChildProcessPromise>; +export function execFile( + file: Readonly, + args: ReadonlyArray | null, + options: Readonly +): ChildProcessPromise>; +export function execFile( + file: Readonly, + options: Readonly +): ChildProcessPromise>; +export function execFile( + file: Readonly, + options: Readonly +): ChildProcessPromise>; +export function execFile( + file: Readonly, + args: ReadonlyArray | null, + options: Readonly +): ChildProcessPromise>; +export function execFile( + file: Readonly, + args?: ReadonlyArray | null, + options?: Readonly +): ChildProcessPromise>; + +export function spawn( + command: Readonly, + args?: ReadonlyArray | null, + options?: Readonly +): ChildProcessPromise; + +export function fork( + modulePath: string, + args?: ReadonlyArray, + options?: Readonly +): ChildProcessPromise; diff --git a/types/child-process-promise/tsconfig.json b/types/child-process-promise/tsconfig.json new file mode 100644 index 0000000000..b0f60c39eb --- /dev/null +++ b/types/child-process-promise/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", + "child-process-promise-tests.ts" + ] +} diff --git a/types/chai-http/tslint.json b/types/child-process-promise/tslint.json similarity index 100% rename from types/chai-http/tslint.json rename to types/child-process-promise/tslint.json diff --git a/types/chocolatechipjs/tslint.json b/types/chocolatechipjs/tslint.json index 9969e961d1..c5bc46f555 100644 --- a/types/chocolatechipjs/tslint.json +++ b/types/chocolatechipjs/tslint.json @@ -5,6 +5,7 @@ "adjacent-overload-signatures": false, "ban-types": false, "dt-header": false, + "npm-naming": false, "no-any-union": false, "unified-signatures": false, "no-unnecessary-generics": false, diff --git a/types/chokidar/chokidar-tests.ts b/types/chokidar/chokidar-tests.ts deleted file mode 100644 index 13e5fe6a90..0000000000 --- a/types/chokidar/chokidar-tests.ts +++ /dev/null @@ -1,57 +0,0 @@ -import * as fs from 'fs'; -import chokidar = require('chokidar'); - -const watcher = chokidar.watch('file, dir, or glob', { - ignored: /[\/\\]\./, persistent: true -}); - -const log = console.log.bind(console); - -watcher - .on('add', (path: string) => { - log('File', path, 'has been added'); - }) - .on('addDir', (path: string) => { - log('Directory', path, 'has been added'); - }) - .on('change', (path: string) => { - log('File', path, 'has been changed'); - }) - .on('unlink', (path: string) => { - log('File', path, 'has been removed'); - }) - .on('unlinkDir', (path: string) => { - log('Directory', path, 'has been removed'); - }) - .on('error', (error: any) => { - log('Error happened', error); - }) - .on('ready', () => { - log('Initial scan complete. Ready for changes.'); - }) - .on('raw', (event: string, path: string, details: any) => { - log('Raw event info:', event, path, details); - }); - -// 'add', 'addDir' and 'change' events also receive stat() results as second -// argument when available: http://nodejs.org/api/fs.html#fs_class_fs_stats -watcher.on('change', (path: string, stats: fs.Stats) => { - if (stats) { - console.log('File', path, 'changed size to', stats.size); - } -}); - -// Watch new files. -watcher.add('new-file'); -watcher.add(['new-file-2', 'new-file-3', '**/other-file*']); - -// Un-watch some files. -watcher.unwatch('new-file*'); - -// Only needed if watching is `persistent: true`. -watcher.close(); - -// One-liner -chokidar.watch('.', { ignored: /[\/\\]\./ }).on('all', (event: string, path: string) => { - console.log(event, path); -}); diff --git a/types/chokidar/index.d.ts b/types/chokidar/index.d.ts deleted file mode 100644 index 6acc9af265..0000000000 --- a/types/chokidar/index.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -// Type definitions for chokidar 1.7 -// Project: https://github.com/paulmillr/chokidar -// Definitions by: Stefan Steinhart -// Felix Becker -// Zach Cardoza -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -import * as fs from 'fs'; -import { EventEmitter } from 'events'; - -/** - * The object's keys are all the directories (using absolute paths unless the `cwd` option was - * used), and the values are arrays of the names of the items contained in each directory. - */ -export interface WatchedPaths { - [directory: string]: string[]; -} - -export class FSWatcher extends EventEmitter implements fs.FSWatcher { - /** - * Constructs a new FSWatcher instance with optional WatchOptions parameter. - */ - constructor(options?: WatchOptions); - - /** - * Add files, directories, or glob patterns for tracking. Takes an array of strings or just one - * string. - */ - add(paths: string | string[]): void; - - /** - * Stop watching files, directories, or glob patterns. Takes an array of strings or just one - * string. - */ - unwatch(paths: string | string[]): void; - - /** - * Returns an object representing all the paths on the file system being watched by this - * `FSWatcher` instance. The object's keys are all the directories (using absolute paths unless - * the `cwd` option was used), and the values are arrays of the names of the items contained in - * each directory. - */ - getWatched(): WatchedPaths; - - /** - * Removes all listeners from watched files. - */ - close(): void; -} - -export interface WatchOptions { - /** - * Indicates whether the process should continue to run as long as files are being watched. If - * set to `false` when using `fsevents` to watch, no more events will be emitted after `ready`, - * even if the process continues to run. - */ - persistent?: boolean; - - /** - * ([anymatch](https://github.com/es128/anymatch)-compatible definition) Defines files/paths to - * be ignored. The whole relative or absolute path is tested, not just filename. If a function - * with two arguments is provided, it gets called twice per path - once with a single argument - * (the path), second time with two arguments (the path and the - * [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object of that path). - */ - ignored?: any; - - /** - * If set to `false` then `add`/`addDir` events are also emitted for matching paths while - * instantiating the watching as chokidar discovers these file paths (before the `ready` event). - */ - ignoreInitial?: boolean; - - /** - * When `false`, only the symlinks themselves will be watched for changes instead of following - * the link references and bubbling events through the link's path. - */ - followSymlinks?: boolean; - - /** - * The base directory from which watch `paths` are to be derived. Paths emitted with events will - * be relative to this. - */ - cwd?: string; - - /** - * If set to true then the strings passed to .watch() and .add() are treated as literal path - * names, even if they look like globs. Default: false. - */ - disableGlobbing?: boolean; - - /** - * Whether to use fs.watchFile (backed by polling), or fs.watch. If polling leads to high CPU - * utilization, consider setting this to `false`. It is typically necessary to **set this to - * `true` to successfully watch files over a network**, and it may be necessary to successfully - * watch files in other non-standard situations. Setting to `true` explicitly on OS X overrides - * the `useFsEvents` default. - */ - usePolling?: boolean; - - /** - * Whether to use the `fsevents` watching interface if available. When set to `true` explicitly - * and `fsevents` is available this supercedes the `usePolling` setting. When set to `false` on - * OS X, `usePolling: true` becomes the default. - */ - useFsEvents?: boolean; - - /** - * If relying upon the [`fs.Stats`](http://nodejs.org/api/fs.html#fs_class_fs_stats) object that - * may get passed with `add`, `addDir`, and `change` events, set this to `true` to ensure it is - * provided even in cases where it wasn't already available from the underlying watch events. - */ - alwaysStat?: boolean; - - /** - * If set, limits how many levels of subdirectories will be traversed. - */ - depth?: number; - - /** - * Interval of file system polling. - */ - interval?: number; - - /** - * Interval of file system polling for binary files. ([see list of binary extensions](https://gi - * thub.com/sindresorhus/binary-extensions/blob/master/binary-extensions.json)) - */ - binaryInterval?: number; - - /** - * Indicates whether to watch files that don't have read permissions if possible. If watching - * fails due to `EPERM` or `EACCES` with this set to `true`, the errors will be suppressed - * silently. - */ - ignorePermissionErrors?: boolean; - - /** - * `true` if `useFsEvents` and `usePolling` are `false`). Automatically filters out artifacts - * that occur when using editors that use "atomic writes" instead of writing directly to the - * source file. If a file is re-added within 100 ms of being deleted, Chokidar emits a `change` - * event rather than `unlink` then `add`. If the default of 100 ms does not work well for you, - * you can override it by setting `atomic` to a custom value, in milliseconds. - */ - atomic?: boolean | number; - - /** - * can be set to an object in order to adjust timing params: - */ - awaitWriteFinish?: AwaitWriteFinishOptions | boolean; -} - -export interface AwaitWriteFinishOptions { - /** - * Amount of time in milliseconds for a file size to remain constant before emitting its event. - */ - stabilityThreshold?: number; - - /** - * File size polling interval. - */ - pollInterval?: number; -} - -/** - * produces an instance of `FSWatcher`. - */ -export function watch(paths: string | string[], options?: WatchOptions): FSWatcher; diff --git a/types/chrome-apps/tslint.json b/types/chrome-apps/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chrome-apps/tslint.json +++ b/types/chrome-apps/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chrome/tslint.json b/types/chrome/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/chrome/tslint.json +++ b/types/chrome/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/chui/tslint.json b/types/chui/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/chui/tslint.json +++ b/types/chui/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cipher-base/cipher-base-tests.ts b/types/cipher-base/cipher-base-tests.ts new file mode 100644 index 0000000000..b81238ee98 --- /dev/null +++ b/types/cipher-base/cipher-base-tests.ts @@ -0,0 +1,17 @@ +import CipherBase = require("cipher-base"); + +const buf = new Buffer(1); + +class CipherTest extends CipherBase { + constructor() { + super(); + } + + final() { + return buf; + } + + update(testBuffer: Buffer) { + return testBuffer; + } +} diff --git a/types/cipher-base/index.d.ts b/types/cipher-base/index.d.ts new file mode 100644 index 0000000000..f43ca2cdb9 --- /dev/null +++ b/types/cipher-base/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for cipher-base 1.0 +// Project: https://github.com/crypto-browserify/cipher-base +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +declare abstract class CipherBase { + constructor(hashMode?: string); + abstract final(): Buffer; + abstract update(value: Buffer, inputEnc?: string, outputEnc?: string): Buffer; +} + +export = CipherBase; diff --git a/types/cipher-base/tsconfig.json b/types/cipher-base/tsconfig.json new file mode 100644 index 0000000000..217193ea64 --- /dev/null +++ b/types/cipher-base/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "cipher-base-tests.ts" + ] +} diff --git a/types/cipher-base/tslint.json b/types/cipher-base/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/cipher-base/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/circular-dependency-plugin/circular-dependency-plugin-tests.ts b/types/circular-dependency-plugin/circular-dependency-plugin-tests.ts new file mode 100644 index 0000000000..8c627651e7 --- /dev/null +++ b/types/circular-dependency-plugin/circular-dependency-plugin-tests.ts @@ -0,0 +1,29 @@ +import * as CircularDependencyPlugin from 'circular-dependency-plugin'; +import * as webpack from 'webpack'; + +new CircularDependencyPlugin(); +new CircularDependencyPlugin({}); + +const MAX_CYCLES = 5; +let numCyclesDetected = 0; + +new CircularDependencyPlugin({ + allowAsyncCycles: false, + cwd: process.cwd(), + exclude: /a\.js|node_modules/, + failOnError: true, + onDetected({ module: webpackModuleRecord, paths, compilation }) { + numCyclesDetected++; + compilation.warnings.push(new Error(paths.join(' -> '))); + }, + onStart({ compilation }) { + numCyclesDetected = 0; + }, + onEnd({ compilation }) { + if (numCyclesDetected > MAX_CYCLES) { + compilation.errors.push(new Error('Too many cycles')); + } + }, +}); + +webpack({ plugins: [new CircularDependencyPlugin()] }); diff --git a/types/circular-dependency-plugin/index.d.ts b/types/circular-dependency-plugin/index.d.ts new file mode 100644 index 0000000000..89c14b0ec0 --- /dev/null +++ b/types/circular-dependency-plugin/index.d.ts @@ -0,0 +1,30 @@ +// Type definitions for circular-dependency-plugin 5.0 +// Project: https://github.com/aackerman/circular-dependency-plugin +// Definitions by: Olegs Jeremejevs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +import { Plugin, Module, compilation } from 'webpack'; + +export = CircularDependencyPlugin; + +declare class CircularDependencyPlugin extends Plugin { + constructor(options?: CircularDependencyPlugin.Options); + // Not exposing `isCyclic` because it isn't meant to be public, I believe +} + +declare namespace CircularDependencyPlugin { + interface Options { + allowAsyncCycles?: boolean; + cwd?: string; + exclude?: RegExp; + failOnError?: boolean; + onDetected?: (x: { + module: Module; + paths: string[]; + compilation: compilation.Compilation; + }) => void; + onEnd?: (x: { compilation: compilation.Compilation }) => void; + onStart?: (x: { compilation: compilation.Compilation }) => void; + } +} diff --git a/types/circular-dependency-plugin/tsconfig.json b/types/circular-dependency-plugin/tsconfig.json new file mode 100644 index 0000000000..476eb673dd --- /dev/null +++ b/types/circular-dependency-plugin/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", + "circular-dependency-plugin-tests.ts" + ] +} diff --git a/types/chokidar/tslint.json b/types/circular-dependency-plugin/tslint.json similarity index 100% rename from types/chokidar/tslint.json rename to types/circular-dependency-plugin/tslint.json diff --git a/types/clamp-js-main/clamp-js-main-tests.ts b/types/clamp-js-main/clamp-js-main-tests.ts index f903b82a06..c85eaed664 100644 --- a/types/clamp-js-main/clamp-js-main-tests.ts +++ b/types/clamp-js-main/clamp-js-main-tests.ts @@ -1,4 +1,5 @@ -import clamp, { ClampOptions, ClampResponse } from 'clamp-js-main'; +import clamp = require('clamp-js-main'); +import { ClampOptions, ClampResponse } from 'clamp-js-main'; const element: HTMLElement = document.createElement('div'); element.style.setProperty('width', '5px'); diff --git a/types/clamp-js-main/index.d.ts b/types/clamp-js-main/index.d.ts index 75286172cb..80cf322896 100644 --- a/types/clamp-js-main/index.d.ts +++ b/types/clamp-js-main/index.d.ts @@ -3,18 +3,21 @@ // Definitions by: Sinziana Nicolae // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface ClampOptions { - clamp?: number|string; - useNativeClamp?: boolean; - splitOnChars?: string[]; - animate?: boolean; - truncationChar?: string; - truncationHTML?: string | null; +declare namespace clamp { + interface ClampOptions { + clamp?: number|string; + useNativeClamp?: boolean; + splitOnChars?: string[]; + animate?: boolean; + truncationChar?: string; + truncationHTML?: string | null; + } + + interface ClampResponse { + original: string; + clamped: string; + } } -export interface ClampResponse { - original: string; - clamped: string; -} - -export default function clamp(element: HTMLElement, options?: ClampOptions): ClampResponse; +export = clamp; +declare function clamp(element: HTMLElement, options?: clamp.ClampOptions): clamp.ClampResponse; diff --git a/types/cldrjs/tslint.json b/types/cldrjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cldrjs/tslint.json +++ b/types/cldrjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/clean-webpack-plugin/clean-webpack-plugin-tests.ts b/types/clean-webpack-plugin/clean-webpack-plugin-tests.ts deleted file mode 100644 index 6d60f36d51..0000000000 --- a/types/clean-webpack-plugin/clean-webpack-plugin-tests.ts +++ /dev/null @@ -1,17 +0,0 @@ -import CleanWebpackPlugin = require('clean-webpack-plugin'); - -const paths = [ - 'path', - 'glob/**/*.js', -]; - -new CleanWebpackPlugin(paths); -new CleanWebpackPlugin(paths, 'root-directory'); -new CleanWebpackPlugin(paths, {}); -new CleanWebpackPlugin(paths, { - root: 'root-directory', - verbose: true, - dry: true, - watch: true, - exclude: ['a, b'], -}); diff --git a/types/clean-webpack-plugin/index.d.ts b/types/clean-webpack-plugin/index.d.ts deleted file mode 100644 index 7c23e51df5..0000000000 --- a/types/clean-webpack-plugin/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for clean-webpack-plugin 0.1 -// Project: https://github.com/johnagan/clean-webpack-plugin -// Definitions by: Jed Fox -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { Plugin } from 'webpack'; - -export = CleanWebpackPlugin; - -declare class CleanWebpackPlugin extends Plugin { - /** - * @param paths A glob or array of globs to delete - */ - constructor(paths: string | ReadonlyArray, options?: string | CleanWebpackPlugin.Options); -} - -declare namespace CleanWebpackPlugin { - interface Options { - /** - * Absolute path to your webpack root folder (paths appended to this) - * Default: root of your package - */ - root?: string; - /** - * Write logs to the console. - */ - verbose?: boolean; - /** - * Set to `true` to emulate deletion without actually removing any files. - */ - dry?: boolean; - /** - * If true, remove files on recompile. - */ - watch?: boolean; - /** - * Instead of removing whole path recursively, - * remove all path's content with exclusion of provided immediate children. - * Good for not removing shared files from build directories. - */ - exclude?: ReadonlyArray; - /** - * Allow the plugin to clean folders outside of the webpack root - */ - allowExternal?: boolean; - } -} diff --git a/types/clean-webpack-plugin/tsconfig.json b/types/clean-webpack-plugin/tsconfig.json deleted file mode 100644 index 8d0f70d644..0000000000 --- a/types/clean-webpack-plugin/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "clean-webpack-plugin-tests.ts" - ] -} \ No newline at end of file diff --git a/types/cli-color/tslint.json b/types/cli-color/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cli-color/tslint.json +++ b/types/cli-color/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cli-progress/index.d.ts b/types/cli-progress/index.d.ts index 3ac9dfe8a3..4c2c516d37 100644 --- a/types/cli-progress/index.d.ts +++ b/types/cli-progress/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for cli-progress 1.8 // Project: https://github.com/AndiDittrich/Node.CLI-Progress -// Definitions by: My Self +// Definitions by: Mohamed Hegazy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 diff --git a/types/cli/tslint.json b/types/cli/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cli/tslint.json +++ b/types/cli/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cliff/tslint.json b/types/cliff/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cliff/tslint.json +++ b/types/cliff/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/clipboard-js/tslint.json b/types/clipboard-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/clipboard-js/tslint.json +++ b/types/clipboard-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/clone-deep/clone-deep-tests.ts b/types/clone-deep/clone-deep-tests.ts new file mode 100644 index 0000000000..6911c13de4 --- /dev/null +++ b/types/clone-deep/clone-deep-tests.ts @@ -0,0 +1,16 @@ +import cloneDeep = require('clone-deep'); + +cloneDeep(Object.create(null)); // $ExpectType object +cloneDeep({}); // $ExpectType object +cloneDeep({}); // $ExpectType {} +cloneDeep(new Array()); // $ExpectType any[] +cloneDeep([]); // $ExpectType any[] +cloneDeep(42); // $ExpectType number +cloneDeep('clone'); // $ExpectType string +cloneDeep({}, true); // $ExpectType object +cloneDeep({}, true); // $ExpectType {} +cloneDeep(42, true); // $ExpectType number +cloneDeep({}, _ => ({})); // $ExpectType object +cloneDeep({}, _ => ({})); // $ExpectType {} +cloneDeep({}, _ => 42); // $ExpectError +cloneDeep(42, _ => ({})); // $ExpectError diff --git a/types/clone-deep/index.d.ts b/types/clone-deep/index.d.ts new file mode 100644 index 0000000000..7918daaa40 --- /dev/null +++ b/types/clone-deep/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for clone-deep 4.0 +// Project: https://github.com/jonschlinkert/clone-deep +// Definitions by: Tanfonto +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +declare function cloneDeep( + val: T, + instanceClone?: true | ((val: T) => T) +): T; + +export = cloneDeep; diff --git a/types/env-paths/tsconfig.json b/types/clone-deep/tsconfig.json similarity index 77% rename from types/env-paths/tsconfig.json rename to types/clone-deep/tsconfig.json index 62dcbca022..cb1cebdf1f 100644 --- a/types/env-paths/tsconfig.json +++ b/types/clone-deep/tsconfig.json @@ -4,7 +4,7 @@ "lib": ["es6"], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": ["../"], @@ -12,8 +12,5 @@ "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "env-paths-tests.ts" - ] + "files": ["index.d.ts", "clone-deep-tests.ts"] } diff --git a/types/clean-webpack-plugin/tslint.json b/types/clone-deep/tslint.json similarity index 100% rename from types/clean-webpack-plugin/tslint.json rename to types/clone-deep/tslint.json diff --git a/types/clone/tslint.json b/types/clone/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/clone/tslint.json +++ b/types/clone/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/closure-compiler/tslint.json b/types/closure-compiler/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/closure-compiler/tslint.json +++ b/types/closure-compiler/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cloud-env/tslint.json b/types/cloud-env/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cloud-env/tslint.json +++ b/types/cloud-env/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cls-hooked/cls-hooked-tests.ts b/types/cls-hooked/cls-hooked-tests.ts index affaa6c54a..60931e1253 100644 --- a/types/cls-hooked/cls-hooked-tests.ts +++ b/types/cls-hooked/cls-hooked-tests.ts @@ -21,3 +21,24 @@ bindLater((x: number) => { const session2 = cls.getNamespace('my session'); session2.get('user'); + +const appNamespace = cls.createNamespace('applicationNameSpace'); +const context = appNamespace.createContext(); + +function bindWithMiddleware(middlewareFn: () => void) { + return session.bind(middlewareFn, context); +} + +bindWithMiddleware(() => { + // Some middleware that doing something in the application +}); + +// In some place in the application, we want to set a value to a given key to be used elsewhere +appNamespace.enter(context); +appNamespace.set('requestId', 'someId'); +appNamespace.exit(context); + +// Retrieve that value set before without losing the context when chaining several middleware +appNamespace.enter(context); +appNamespace.get('requestId'); +appNamespace.exit(context); diff --git a/types/cls-hooked/index.d.ts b/types/cls-hooked/index.d.ts index 57e6b79c60..4fa385c52f 100644 --- a/types/cls-hooked/index.d.ts +++ b/types/cls-hooked/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for cls-hooked 4.2 +// Type definitions for cls-hooked 4.3 // Project: https://github.com/jeff-lewis/cls-hooked // Definitions by: Leo Liang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -18,6 +18,8 @@ export interface Namespace { bind(fn: F, context?: any): F; // tslint:disable-line: ban-types bindEmitter(emitter: EventEmitter): void; createContext(): any; + enter(context: any): void; + exit(context: any): void; } export function createNamespace(name: string): Namespace; diff --git a/types/clui/clui-tests.ts b/types/clui/clui-tests.ts new file mode 100644 index 0000000000..1968b10cba --- /dev/null +++ b/types/clui/clui-tests.ts @@ -0,0 +1,96 @@ +import { Gauge, Line, LineBuffer, Progress, Sparkline, Spinner } from 'clui'; +import * as clc from 'cli-color'; + +// LineBuffer +const outputBuffer = new LineBuffer({ + x: 0, + y: 0, + width: 'console', + height: 'console' +}); + +new Line(outputBuffer) + .column('Title Placehole', 20, [clc.green]) + .fill() + .store(); + +new Line(outputBuffer) + .fill() + .store(); + +new Line(outputBuffer) + .column('Suscipit', 20, [clc.cyan]) + .column('Voluptatem', 20, [clc.cyan]) + .column('Nesciunt', 20, [clc.cyan]) + .column('Laudantium', 11, [clc.cyan]) + .fill() + .store(); + +for (let l = 0; l < 20; l++) { + new Line(outputBuffer) + .column((Math.random() * 100).toFixed(3), 20) + .column((Math.random() * 100).toFixed(3), 20) + .column((Math.random() * 100).toFixed(3), 20) + .column((Math.random() * 100).toFixed(3), 11) + .fill() + .store(); +} + +outputBuffer.output(); + +// Line +new Line() + .padding(2) + .column('Column One', 20, [clc.cyan]) + .column('Column Two', 20, [clc.cyan]) + .column('Column Three', 20, [clc.cyan]) + .column('Column Four', 20, [clc.cyan]) + .fill() + .output(); + +new Line() + .padding(2) + .column((Math.random() * 100).toFixed(3), 20) + .column((Math.random() * 100).toFixed(3), 20) + .column((Math.random() * 100).toFixed(3), 20) + .column((Math.random() * 100).toFixed(3), 20) + .fill() + .output(); + +// Gauge +const total = 33660133376; +const free = 17763860480; +const used = total - free; +const human = Math.ceil(used / 1000000) + ' MB'; + +console.log(Gauge(used, total, 20, total * 0.8, human)); + +// Sparkline +const reqsPerSec = [10, 12, 3, 7, 12, 9, 23, 10, 9, 19, 16, 18, 12, 12]; + +console.log(Sparkline(reqsPerSec, 'reqs/sec')); + +// Progress +const thisProgressBar = new Progress(20); +console.log(thisProgressBar.update(10, 30)); + +// or + +const thisPercentBar = new Progress(20); +console.log(thisPercentBar.update(0.4)); + +// Spinner +const countdown = new Spinner('Exiting in 10 seconds... ', ['⣾', '⣽', '⣻', '⢿', '⡿', '⣟', '⣯', '⣷']); + +countdown.start(); + +let n = 10; +const interval = setInterval(() => { + n--; + countdown.message(`Exiting in ${n} seconds...`); + if (n === 0) { + console.log('\n'); + countdown.stop(); + clearInterval(interval); + } +}, 1000); diff --git a/types/clui/index.d.ts b/types/clui/index.d.ts new file mode 100644 index 0000000000..339ac031d9 --- /dev/null +++ b/types/clui/index.d.ts @@ -0,0 +1,157 @@ +// Type definitions for clui 0.3 +// Project: https://github.com/nathanpeck/clui#readme +// Definitions by: Farzad Majidfayyaz +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import * as clc from 'cli-color'; + +export interface LineBufferOptions { + x?: number; + y?: number; + width?: number | 'console'; + height?: number | 'console'; + scroll?: number; +} + +export class LineBuffer { + /** + * Creates an object for buffering a group of text lines and then outputting them + * @param options Values to build the buffer + */ + constructor(options: LineBufferOptions); + + /** + * Return the height of the `LineBuffer`, when specified as `console` + */ + height(): number; + + /** + * Return the width of the `LineBuffer`, when specified as `console` + */ + width(): number; + + /** + * Put a `Line` object into the `LineBuffer` + * @param line The line object to put into the buffer + */ + addLine(line: Line): void; + + /** + * If you don't have enough lines in the buffer, this will fill the reset of + * the lines with empty spaces + */ + fill(): void; + + /** + * Draw the `LineBuffer` to screen + */ + output(): void; +} + +/** + * This chainable object can be used to generate a line of text with columns, padding, and fill + */ +export class Line { + /** + * Create a new instance of Line object + * @param buffer Object to be used as buffer + */ + constructor(buffer?: LineBuffer); + + /** + * Output `width` characters of blank space + * @param width Number of characters to print + */ + padding(width: number): Line; + + /** + * Output text within a column of the specified width + * @param text Text to print + * @param width Width of the column + * @param styles List of `cli-color` styles to apply + */ + column(text: string, width: number, styles?: clc.Format[]): Line; + + /** + * At the end of a line, fill the rest of the columns to the right edge + */ + fill(): Line; + + /** + * Print the generated line of text to the console + */ + output(): Line; + + /** + * Return the contents of this line as a string + */ + contents(): string; + + /** + * Store this line into the buffer + */ + store(): void; +} + +/** + * Creates a basic horizontal gauge to the screen + * @param value The current value of the metric being displayed by this gauge + * @param maxValue The highest possible value of the metric being displayed + * @param guageWidth How many columns widt to draw the gauge + * @param dangerZone The point after which the value will be drawn in red because it's too high + * @param suffix A value to output after the gauge itself + */ +export function Gauge( + value: number, + maxValue: number, + guageWidth: number, + dangerZone: number, + suffix: string, +): string; + +/** + * A simple command line sparkline that draws a series of values, and highlights the peak for the period + * @param values An array of values to go into the sparkline + * @param suffix A suffix to use when drawing the current and max values at the end of the sparkline + */ +export function Sparkline(values: number[], suffix: string): string; + +export class Progress { + /** + * Creates a progress bar + * @param length The desired length of the progress bar in characters + */ + constructor(length: number); + + /** + * Returns the progress bar min/max context to write to stdout + * @param currentValueOrPercent Current value (or percent) of the progress bar + * @param maxValue Maximum value of the progress bar + */ + update(currentValueOrPercent: number, maxValue?: number): string; +} + +export class Spinner { + /** + * Creates a new spinner + * @param statusText The default text to display while the spinner is spinning + * @param style Array of graphical characters used to draw the spinner + */ + constructor(statusText: string, style?: string[]); + + /** + * Show the spinner on the screen + */ + start(): void; + + /** + * Update the status message that follows the spinner + * @param statusMessage Message to be displayed + */ + message(statusMessage: string): void; + + /** + * Erase the spinner from the screen + */ + stop(): void; +} diff --git a/types/clui/tsconfig.json b/types/clui/tsconfig.json new file mode 100644 index 0000000000..05235b1de8 --- /dev/null +++ b/types/clui/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "clui-tests.ts" + ] +} diff --git a/types/conf/tslint.json b/types/clui/tslint.json similarity index 100% rename from types/conf/tslint.json rename to types/clui/tslint.json diff --git a/types/co-body/tslint.json b/types/co-body/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/co-body/tslint.json +++ b/types/co-body/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/codemirror/tslint.json b/types/codemirror/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/codemirror/tslint.json +++ b/types/codemirror/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/coffeeify/tslint.json b/types/coffeeify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/coffeeify/tslint.json +++ b/types/coffeeify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/collections/tslint.json b/types/collections/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/collections/tslint.json +++ b/types/collections/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/collectionsjs/collectionsjs-tests.ts b/types/collectionsjs/collectionsjs-tests.ts new file mode 100644 index 0000000000..47ab0b00bb --- /dev/null +++ b/types/collectionsjs/collectionsjs-tests.ts @@ -0,0 +1,61 @@ +import Collection from 'collectionsjs'; + +const collectable = [ + { name: 'Arya Stark', age: 9 }, + { name: 'Bran Stark', age: 7 }, + { name: 'Jon Snow', age: 14 } +]; + +const characters = [ + { name: 'Ned Stark', age: 40}, + { name: 'Catelyn Stark', age: 35} +]; + +const item = { name: 'Sansa Stark', age: 13 }; + +const array = [ + { name: 'Robert Baratheon', age: 40 }, + { name: 'Joffrey Baratheon', age: 13 } +]; + +const collection = new Collection(collectable); // $ExpectType Collection<{ name: string; age: number; }> + +collection.add(item); // $ExpectType Collection<{ name: string; age: number; }> +collection.all(); // $ExpectType Collection<{ name: string; age: number; }> +collection.average('age'); // $ExpectType number +collection.chunk(2).all(); // $ExpectType Collection<{ name: string; age: number; }> +collection.collect(collectable); // $ExpectType Collection<{ name: string; age: number; }> +collection.concat(characters); // $ExpectType Collection<{ name: string; age: number; }> +collection.contains(stark => stark.name === 'John Snow'); // $ExpectType boolean +collection.count(); // $ExpectType number +collection.each(stark => stark.age = 3); // $ExpectType Collection<{ name: string; age: number; }> +collection.filter(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.find({ name: 'Bran Stark', age: 7 }); // $ExpectType number +collection.first(item => item.age > 7); // $ExpectType { name: string; age: number; } +collection.flatten(true); // $ExpectType Collection<{ name: string; age: number; }> +collection.get(2); // $ExpectType { name: string; age: number; } +collection.has({ name: 'Bran Stark', age: 7 }); // $ExpectType boolean +collection.join(); // $ExpectType string +collection.keys(); // $ExpectType Collection<{ name: string; age: number; }> +collection.last(); // $ExpectType { name: string; age: number; } +collection.map(stark => stark.name); // $ExpectType Collection +collection.pluck('name'); // $ExpectType Collection<{ name: string; age: number; }> +collection.push({name: 'Robb Stark', age: 17}); // $ExpectType Collection<{ name: string; age: number; }> +const value = new Collection([1, 2, 3]).reduce((previous, current) => previous + current, 0); // $ExpectType number +collection.reject(stark => stark.age < 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.remove({name: 'Robb Stark', age: 17}); // $ExpectType boolean +collection.reverse(); // $ExpectType Collection<{ name: string; age: number; }> +collection.skip(2); // $ExpectType Collection<{ name: string; age: number; }> +collection.slice(1, 3); // $ExpectType Collection<{ name: string; age: number; }> +collection.sort(); // $ExpectType Collection<{ name: string; age: number; }> +collection.sortBy('name'); // $ExpectType Collection<{ name: string; age: number; }> +collection.stringify(); // $ExpectType string +collection.sum('age'); // $ExpectType number +collection.take(2); // $ExpectType Collection<{ name: string; age: number; }> +Collection.macro('addToMembers', (collection, n) => collection.map((collectionItem: any) => collectionItem + n)); + +collection.unique(stark => stark.age); // $ExpectType Collection<{ name: string; age: number; }> +collection.values(); // $ExpectType Collection<{ name: string; age: number; }> +collection.where('age', 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.where(stark => stark.age === 14); // $ExpectType Collection<{ name: string; age: number; }> +collection.zip(array); // $ExpectType Collection<{ name: string; age: number; }> diff --git a/types/collectionsjs/index.d.ts b/types/collectionsjs/index.d.ts new file mode 100644 index 0000000000..1a9bfe7062 --- /dev/null +++ b/types/collectionsjs/index.d.ts @@ -0,0 +1,47 @@ +// Type definitions for collectionsjs 0.3 +// Project: https://github.com/logaretm/collectionsjs#readme +// Definitions by: Jaymeh +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +export default class Collection { + constructor(items?: T[]); + add(item: T): Collection; + all(): Collection; + average(property?: string | ((property?: number) => number)): number; + chunk(size: number): Collection; + collect(collectable: T[]): Collection; + concat(collection: T[]|Collection): Collection; + contains(closure: ((item: T) => boolean)): boolean; + count(): number; + each(callback: (item: T) => void): Collection; + filter(callback: (item: T) => boolean): Collection; + find(item: T): number; + first(callback?: ((item: T) => boolean)|null): T; + flatten(deep?: boolean): Collection; + get(index: number): T; + has(item: T): boolean; + join(separator?: string): string; + keys(): Collection; + last(callback?: ((item: T) => boolean)|null): T; + map(callback: (item: T) => R): Collection; + pluck(property: string): Collection; + push(item: T): Collection; + reduce(callback: (previous: R, current: T) => R, initial: R): R; + reject(callback: (item: T) => boolean): Collection; + remove(item: T): boolean; + reverse(): Collection; + skip(count: number): Collection; + slice(start: number, end?: number): Collection; + sort(compare?: () => boolean): Collection; + sortBy(property: string, order?: string): Collection; + stringify(): string; + sum(property: T extends object ? keyof T : never): number; + take(count: number): Collection; + static macro(name: string, callback: (coll: Collection, ...args: unknown[]) => unknown): void; + unique(callback?: string|null|((item: T) => any)): Collection; + values(): Collection; + where(key: K, value: T[K]): Collection; + where(callback: (item: T) => boolean): Collection; + zip(array: T[]|Collection): Collection; +} diff --git a/types/collectionsjs/tsconfig.json b/types/collectionsjs/tsconfig.json new file mode 100644 index 0000000000..6ec4a9edc3 --- /dev/null +++ b/types/collectionsjs/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "collectionsjs-tests.ts" + ] +} diff --git a/types/conf/v0/tslint.json b/types/collectionsjs/tslint.json similarity index 100% rename from types/conf/v0/tslint.json rename to types/collectionsjs/tslint.json diff --git a/types/colorbrewer/tslint.json b/types/colorbrewer/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/colorbrewer/tslint.json +++ b/types/colorbrewer/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/com.darktalker.cordova.screenshot/tslint.json b/types/com.darktalker.cordova.screenshot/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/com.darktalker.cordova.screenshot/tslint.json +++ b/types/com.darktalker.cordova.screenshot/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/combokeys/tslint.json b/types/combokeys/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/combokeys/tslint.json +++ b/types/combokeys/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cometd/index.d.ts b/types/cometd/index.d.ts index d7103f15cd..ff780cfd42 100644 --- a/types/cometd/index.d.ts +++ b/types/cometd/index.d.ts @@ -70,6 +70,15 @@ export interface Configuration { * CometD may fail to remain within the max URI length when encoded in JSON. */ maxURILength?: number; + /** + * Uses the scheduler service available in Web Workers via Worker.setTimeout(fn, delay) rather + * than using that available via Window.setTimeout(fn, delay). Browsers are now throttling the + * Window scheduler in background tabs to save battery in mobile devices, so the Window scheduler + * events are delayed by possibly several seconds, causing CometD sessions to timeout on the + * server. The Worker scheduler is not throttled and guarantees that scheduler events happen + * on time. + */ + useWorkerScheduler?: boolean; } export interface Message { diff --git a/types/command-line-commands/tslint.json b/types/command-line-commands/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/command-line-commands/tslint.json +++ b/types/command-line-commands/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/commangular/tslint.json b/types/commangular/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/commangular/tslint.json +++ b/types/commangular/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/compare-version/tslint.json b/types/compare-version/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/compare-version/tslint.json +++ b/types/compare-version/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/complex/complex-tests.ts b/types/complex/complex-tests.ts index 8268f0c135..7979c80435 100644 --- a/types/complex/complex-tests.ts +++ b/types/complex/complex-tests.ts @@ -1,4 +1,4 @@ -import Complex from 'complex'; +import Complex = require('complex'); let z: Complex = new Complex(2, 3); z = Complex.from(2, 3); diff --git a/types/complex/index.d.ts b/types/complex/index.d.ts index 3f44ba8e1e..4b3ad612e1 100644 --- a/types/complex/index.d.ts +++ b/types/complex/index.d.ts @@ -4,7 +4,8 @@ // Paul Vasich // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default class Complex { +export = Complex; +declare class Complex { /** * @param real The real part of the number * @param im The imaginary part of the number diff --git a/types/component-emitter/tslint.json b/types/component-emitter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/component-emitter/tslint.json +++ b/types/component-emitter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/compose-function/tslint.json b/types/compose-function/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/compose-function/tslint.json +++ b/types/compose-function/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/compression/tslint.json b/types/compression/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/compression/tslint.json +++ b/types/compression/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/concaveman/tslint.json b/types/concaveman/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/concaveman/tslint.json +++ b/types/concaveman/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/condense-whitespace/condense-whitespace-tests.ts b/types/condense-whitespace/condense-whitespace-tests.ts new file mode 100644 index 0000000000..027b106195 --- /dev/null +++ b/types/condense-whitespace/condense-whitespace-tests.ts @@ -0,0 +1,7 @@ +import condense = require("condense-whitespace"); + +// $ExpectType string +condense(" \n\n\t Hello World \t\n"); + +// $ExpectError +condense(1); diff --git a/types/condense-whitespace/index.d.ts b/types/condense-whitespace/index.d.ts new file mode 100644 index 0000000000..403d0eeec1 --- /dev/null +++ b/types/condense-whitespace/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for condense-whitespace 1.0 +// Project: https://github.com/sindresorhus/condense-whitespace +// Definitions by: Daniel Cassidy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +declare function condenseWhitespace(str: string): string; + +export = condenseWhitespace; diff --git a/types/decompress-response/tsconfig.json b/types/condense-whitespace/tsconfig.json similarity index 92% rename from types/decompress-response/tsconfig.json rename to types/condense-whitespace/tsconfig.json index c7a77a9fd1..8d5705205d 100644 --- a/types/decompress-response/tsconfig.json +++ b/types/condense-whitespace/tsconfig.json @@ -6,8 +6,8 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, + "strictNullChecks": true, "baseUrl": "../", "typeRoots": [ "../" @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "decompress-response-tests.ts" + "condense-whitespace-tests.ts" ] } diff --git a/types/conf/v1/tslint.json b/types/condense-whitespace/tslint.json similarity index 100% rename from types/conf/v1/tslint.json rename to types/condense-whitespace/tslint.json diff --git a/types/conf/conf-tests.ts b/types/conf/conf-tests.ts deleted file mode 100644 index ce67cd4799..0000000000 --- a/types/conf/conf-tests.ts +++ /dev/null @@ -1,54 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -new Conf({ - defaults: { - foo: 'bar', - unicorn: 'rainbow', - }, -}); -new Conf({ configName: '' }); -new Conf({ projectName: 'foo' }); -new Conf({ cwd: '' }); -new Conf({ encryptionKey: '' }); -new Conf({ encryptionKey: new Buffer('') }); -new Conf({ encryptionKey: new Uint8Array([1]) }); -new Conf({ encryptionKey: new DataView(new ArrayBuffer(2)) }); -new Conf({ fileExtension: '.foo' }); - -// $ExpectError -new Conf({ - defaults: { - foo: 'bar', - unicorn: ['rainbow'], - }, -}); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('null', null); // $ExpectError - -conf.get('foo'); // $ExpectType string | number | boolean -conf.get('foo', 'bar'); // $ExpectType string | number | boolean -conf.get('foo', null); // $ExpectError -conf.delete('foo'); -conf.has('foo'); // $ExpectType boolean -conf.clear(); -conf.onDidChange('foo', (oldVal, newVal) => { - // $ExpectType string | number | boolean | undefined - oldVal; - // $ExpectType string | number | boolean | undefined - newVal; -}); - -conf.size; // $ExpectType number -conf.store = { - foo: 'bar', - unicorn: 'rainbow', -}; -conf.path; // $ExpectType string - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean -} diff --git a/types/conf/index.d.ts b/types/conf/index.d.ts deleted file mode 100644 index 57d7285a3e..0000000000 --- a/types/conf/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -// Type definitions for conf 2.1 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -/// - -declare class Conf implements Iterable<[string, T]> { - store: { [key: string]: T }; - readonly path: string; - readonly size: number; - - constructor(options?: Conf.Options); - get(key: string, defaultValue?: T): T; - set(key: string, val: T): void; - set(object: { [key: string]: T }): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - onDidChange(key: string, callback: (oldVal: T | undefined, newVal: T | undefined) => void): void; - [Symbol.iterator](): Iterator<[string, T]>; -} - -declare namespace Conf { - interface Options { - defaults?: { [key: string]: T }; - configName?: string; - projectName?: string; - cwd?: string; - encryptionKey?: string | Buffer | NodeJS.TypedArray | DataView; - fileExtension?: string; - } -} - -export = Conf; diff --git a/types/conf/v0/conf-tests.ts b/types/conf/v0/conf-tests.ts deleted file mode 100644 index 1368e45c29..0000000000 --- a/types/conf/v0/conf-tests.ts +++ /dev/null @@ -1,20 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('object', { - foo: 'bar', - unicorn: ['rainbow'] -}); - -conf.get('foo'); -conf.delete('foo'); -conf.has('foo'); -conf.clear(); - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean | symbol | {} -} diff --git a/types/conf/v0/index.d.ts b/types/conf/v0/index.d.ts deleted file mode 100644 index 21c136e823..0000000000 --- a/types/conf/v0/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for conf 0.11 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -interface Options { - defaults?: any; - configName?: string; - projectName?: string; - cwd?: string; -} - -declare class Conf implements Iterable<[string, string | number | boolean | symbol | {}]> { - path: string; - store: any; - - readonly size: number; - - constructor(options?: Options); - get(key: string): any; - set(key: string, val: string | number | boolean | symbol | {}): void; - set(object: {}): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - [Symbol.iterator](): Iterator<[string, string | number | boolean | symbol | {}]>; -} - -export = Conf; diff --git a/types/conf/v0/tsconfig.json b/types/conf/v0/tsconfig.json deleted file mode 100644 index 004bd4a1b5..0000000000 --- a/types/conf/v0/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "conf": [ - "conf/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "conf-tests.ts" - ] -} \ No newline at end of file diff --git a/types/conf/v1/conf-tests.ts b/types/conf/v1/conf-tests.ts deleted file mode 100644 index 4ee492da8d..0000000000 --- a/types/conf/v1/conf-tests.ts +++ /dev/null @@ -1,41 +0,0 @@ -import Conf = require('conf'); - -const conf = new Conf(); -new Conf({ - defaults: { - foo: 'bar', - unicorn: 'rainbow', - }, - configName: '', - projectName: 'foo', - cwd: '', -}); -// $ExpectError -new Conf({ - defaults: { - foo: 'bar', - unicorn: ['rainbow'], - }, -}); -conf.set('foo', 'bar'); -conf.set('hello', 1); -conf.set('unicorn', false); -conf.set('null', null); // $ExpectError - -conf.get('foo'); // $ExpectType string | number | boolean -conf.get('foo', 'bar'); // $ExpectType string | number | boolean -conf.get('foo', null); // $ExpectError -conf.delete('foo'); -conf.has('foo'); // $ExpectType boolean -conf.clear(); - -conf.store = { - foo: 'bar', - unicorn: 'rainbow', -}; -conf.path; // $ExpectType string - -for (const [key, value] of conf) { - key; // $ExpectType string - value; // $ExpectType string | number | boolean -} diff --git a/types/conf/v1/index.d.ts b/types/conf/v1/index.d.ts deleted file mode 100644 index f08cff1584..0000000000 --- a/types/conf/v1/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Type definitions for conf 1.4 -// Project: https://github.com/sindresorhus/conf -// Definitions by: Sam Verschueren -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -interface Options { - defaults?: { [key: string]: T }; - configName?: string; - projectName?: string; - cwd?: string; -} - -declare class Conf implements Iterable<[string, T]> { - store: { [key: string]: T }; - readonly path: string; - readonly size: number; - - constructor(options?: Options); - get(key: string, defaultValue?: T): T; - set(key: string, val: T): void; - set(object: { [key: string]: T }): void; - has(key: string): boolean; - delete(key: string): void; - clear(): void; - onDidChange(key: string, callback: (oldVal: any, newVal: any) => void): void; - [Symbol.iterator](): Iterator<[string, T]>; -} - -export = Conf; diff --git a/types/conf/v1/tsconfig.json b/types/conf/v1/tsconfig.json deleted file mode 100644 index 86b3a62f41..0000000000 --- a/types/conf/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "target": "es6", - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "conf": [ - "conf/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "conf-tests.ts" - ] -} diff --git a/types/confidence/tslint.json b/types/confidence/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/confidence/tslint.json +++ b/types/confidence/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/config-yaml/index.d.ts b/types/config-yaml/index.d.ts index 6f2be7957b..2b4e07628d 100644 --- a/types/config-yaml/index.d.ts +++ b/types/config-yaml/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for config-yaml 1.1 // Project: https://github.com/neolao/config-yaml#readme -// Definitions by: My Self +// Definitions by: Arylo Yeung // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 diff --git a/types/config/tslint.json b/types/config/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/config/tslint.json +++ b/types/config/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/confit/tslint.json b/types/confit/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/confit/tslint.json +++ b/types/confit/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-datadog/index.d.ts b/types/connect-datadog/index.d.ts index df18c0c208..9b68fb6a4f 100644 --- a/types/connect-datadog/index.d.ts +++ b/types/connect-datadog/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for connect-datadog 0.0 // Project: https://github.com/datadog/node-connect-datadog // Definitions by: Moshe Good +// Michael Mifsud // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -19,6 +20,6 @@ declare namespace Factory { method?: boolean; protocol?: boolean; response_code?: boolean; - dogstatsd?: dogstatsd.StatsD; + dogstatsd?: dogstatsd.StatsDClient; } } diff --git a/types/connect-flash/tslint.json b/types/connect-flash/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-flash/tslint.json +++ b/types/connect-flash/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-livereload/tslint.json b/types/connect-livereload/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-livereload/tslint.json +++ b/types/connect-livereload/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-modrewrite/tslint.json b/types/connect-modrewrite/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-modrewrite/tslint.json +++ b/types/connect-modrewrite/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-mongo/connect-mongo-tests.ts b/types/connect-mongo/connect-mongo-tests.ts index 351975d84c..4e3c7f8381 100644 --- a/types/connect-mongo/connect-mongo-tests.ts +++ b/types/connect-mongo/connect-mongo-tests.ts @@ -45,8 +45,8 @@ app.use(session({ // NativeMongoPromiseOptions var Client = mongodb.MongoClient; -var mongoDbPromise = Client.connect('mongodb://localhost/test'); +var mongoDbPromise = Client.connect('mongodb://localhost/test').then(client => client.db()) app.use(session({ secret: 'secret', - store: new MongoStore({ dbPromise: mongoDbPromise}) + store: new MongoStore({ dbPromise: mongoDbPromise }) })); diff --git a/types/connect-mongo/tsconfig.json b/types/connect-mongo/tsconfig.json index c0c9ab3043..dc0b76551d 100644 --- a/types/connect-mongo/tsconfig.json +++ b/types/connect-mongo/tsconfig.json @@ -4,14 +4,6 @@ "lib": [ "es6" ], - "paths": { - "mongodb": [ - "mongodb/v2" - ], - "mongoose": [ - "mongoose/v4" - ] - }, "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, diff --git a/types/connect-mongo/tslint.json b/types/connect-mongo/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-mongo/tslint.json +++ b/types/connect-mongo/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-mongodb-session/tslint.json b/types/connect-mongodb-session/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-mongodb-session/tslint.json +++ b/types/connect-mongodb-session/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-redis/connect-redis-tests.ts b/types/connect-redis/connect-redis-tests.ts index a312ffd3ca..603b226dcc 100644 --- a/types/connect-redis/connect-redis-tests.ts +++ b/types/connect-redis/connect-redis-tests.ts @@ -6,5 +6,8 @@ const store = new RedisStore({ host: 'localhost', port: 6379, logErrors: error => console.warn(error), - scanCount: 80, + scanCount: 80, + ttl: (store, sess, sessionID) => { + return 60; + } }); diff --git a/types/connect-redis/index.d.ts b/types/connect-redis/index.d.ts index c5a26de73a..9b56777ac3 100644 --- a/types/connect-redis/index.d.ts +++ b/types/connect-redis/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for connect-redis // Project: https://npmjs.com/package/connect-redis // Definitions by: Xavier Stouder +// Seth Butler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -26,7 +27,7 @@ declare module "connect-redis" { port?: number; socket?: string; url?: string; - ttl?: number; + ttl?: number | string | ((store: RedisStore, sess: Express.SessionData, sid: string) => number); disableTTL?: boolean; db?: number; pass?: string; diff --git a/types/connect-redis/tslint.json b/types/connect-redis/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-redis/tslint.json +++ b/types/connect-redis/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-slashes/tslint.json b/types/connect-slashes/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-slashes/tslint.json +++ b/types/connect-slashes/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect-timeout/tslint.json b/types/connect-timeout/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect-timeout/tslint.json +++ b/types/connect-timeout/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/connect/tslint.json b/types/connect/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/connect/tslint.json +++ b/types/connect/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/console-stamp/tslint.json b/types/console-stamp/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/console-stamp/tslint.json +++ b/types/console-stamp/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/consolidate/tslint.json b/types/consolidate/tslint.json index a403f5da2b..69c84d8f83 100644 --- a/types/consolidate/tslint.json +++ b/types/consolidate/tslint.json @@ -9,6 +9,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/consul/tslint.json b/types/consul/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/consul/tslint.json +++ b/types/consul/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/contentful-resolve-response/tslint.json b/types/contentful-resolve-response/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/contentful-resolve-response/tslint.json +++ b/types/contentful-resolve-response/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/contextjs/tslint.json b/types/contextjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/contextjs/tslint.json +++ b/types/contextjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cookie-session/tslint.json b/types/cookie-session/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cookie-session/tslint.json +++ b/types/cookie-session/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cookie_js/tslint.json b/types/cookie_js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cookie_js/tslint.json +++ b/types/cookie_js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/copy-paste/tslint.json b/types/copy-paste/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/copy-paste/tslint.json +++ b/types/copy-paste/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/copy-text-to-clipboard/copy-text-to-clipboard-tests.ts b/types/copy-text-to-clipboard/copy-text-to-clipboard-tests.ts deleted file mode 100644 index 4a1e63b28c..0000000000 --- a/types/copy-text-to-clipboard/copy-text-to-clipboard-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ -import copy = require('copy-text-to-clipboard'); - -const button: HTMLButtonElement | null = document.getElementById('my-button'); -if (button) { - button.addEventListener('click', () => { - copy('🦄🌈'); - }); -} diff --git a/types/copy-text-to-clipboard/index.d.ts b/types/copy-text-to-clipboard/index.d.ts deleted file mode 100644 index 56493778d0..0000000000 --- a/types/copy-text-to-clipboard/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for copy-text-to-clipboard 1.0 -// Project: https://github.com/sindresorhus/copy-text-to-clipboard#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = copy; - -declare function copy(text: string): boolean; diff --git a/types/copy-text-to-clipboard/tslint.json b/types/copy-text-to-clipboard/tslint.json deleted file mode 100644 index 1c36270d47..0000000000 --- a/types/copy-text-to-clipboard/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-angle-bracket-type-assertion": false - } -} diff --git a/types/cordova-ionic/tslint.json b/types/cordova-ionic/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-ionic/tslint.json +++ b/types/cordova-ionic/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-app-version/tslint.json b/types/cordova-plugin-app-version/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-app-version/tslint.json +++ b/types/cordova-plugin-app-version/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-background-mode/tslint.json b/types/cordova-plugin-background-mode/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-background-mode/tslint.json +++ b/types/cordova-plugin-background-mode/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-ble-central/tslint.json b/types/cordova-plugin-ble-central/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-ble-central/tslint.json +++ b/types/cordova-plugin-ble-central/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-device-name/tslint.json b/types/cordova-plugin-device-name/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-device-name/tslint.json +++ b/types/cordova-plugin-device-name/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-email-composer/tslint.json b/types/cordova-plugin-email-composer/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-email-composer/tslint.json +++ b/types/cordova-plugin-email-composer/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-ibeacon/tslint.json b/types/cordova-plugin-ibeacon/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-ibeacon/tslint.json +++ b/types/cordova-plugin-ibeacon/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-insomnia/tslint.json b/types/cordova-plugin-insomnia/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-insomnia/tslint.json +++ b/types/cordova-plugin-insomnia/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-keyboard/tslint.json b/types/cordova-plugin-keyboard/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-keyboard/tslint.json +++ b/types/cordova-plugin-keyboard/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-mapsforge/tslint.json b/types/cordova-plugin-mapsforge/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-mapsforge/tslint.json +++ b/types/cordova-plugin-mapsforge/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-ms-adal/tslint.json b/types/cordova-plugin-ms-adal/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-ms-adal/tslint.json +++ b/types/cordova-plugin-ms-adal/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-ouralabs/tslint.json b/types/cordova-plugin-ouralabs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-ouralabs/tslint.json +++ b/types/cordova-plugin-ouralabs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-qrscanner/tslint.json b/types/cordova-plugin-qrscanner/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-qrscanner/tslint.json +++ b/types/cordova-plugin-qrscanner/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-spinner/tslint.json b/types/cordova-plugin-spinner/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-spinner/tslint.json +++ b/types/cordova-plugin-spinner/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-websql/tslint.json b/types/cordova-plugin-websql/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-websql/tslint.json +++ b/types/cordova-plugin-websql/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova-plugin-x-socialsharing/tslint.json b/types/cordova-plugin-x-socialsharing/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova-plugin-x-socialsharing/tslint.json +++ b/types/cordova-plugin-x-socialsharing/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova/tslint.json b/types/cordova/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/cordova/tslint.json +++ b/types/cordova/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordova_app_version_plugin/tslint.json b/types/cordova_app_version_plugin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordova_app_version_plugin/tslint.json +++ b/types/cordova_app_version_plugin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cordovarduino/tslint.json b/types/cordovarduino/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cordovarduino/tslint.json +++ b/types/cordovarduino/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/core-object/core-object-tests.ts b/types/core-object/core-object-tests.ts index b434ee97fc..dfdc0f4073 100644 --- a/types/core-object/core-object-tests.ts +++ b/types/core-object/core-object-tests.ts @@ -1,5 +1,5 @@ import { Mix, MethodNames } from 'core-object/-private/utils'; -import CoreObject, { ExtendOptions, ExtendThisType } from 'core-object'; +import CoreObject = require('core-object'); //////////// Mix //////////// @@ -24,14 +24,14 @@ names3; // $ExpectType "a" //////////// ExtendOptions //////////// -const extendOptions1: ExtendOptions<{}> = { a: 1, b: 'hi' }; -const extendOptions2: ExtendOptions<{ a: number }> = { b: 'hi' }; -const extendOptions3: ExtendOptions<{ a: number }> = { a: 5 }; -const extendOptions4: ExtendOptions<{ a: number }> = { a: 'hi' }; // $ExpectError +const extendOptions1: CoreObject.ExtendOptions<{}> = { a: 1, b: 'hi' }; +const extendOptions2: CoreObject.ExtendOptions<{ a: number }> = { b: 'hi' }; +const extendOptions3: CoreObject.ExtendOptions<{ a: number }> = { a: 5 }; +const extendOptions4: CoreObject.ExtendOptions<{ a: number }> = { a: 'hi' }; // $ExpectError //////////// ExtendThisType //////////// -declare function extendThisType1(options: T & ExtendThisType<{ prop: string; method: () => number }, T>): void; +declare function extendThisType1(options: T & CoreObject.ExtendThisType<{ prop: string; method: () => number }, T>): void; extendThisType1({ otherMethod() { this.prop; // $ExpectType string diff --git a/types/core-object/index.d.ts b/types/core-object/index.d.ts index aa4566cac2..7a6131bac4 100644 --- a/types/core-object/index.d.ts +++ b/types/core-object/index.d.ts @@ -6,18 +6,21 @@ import { Mix, Super, Constructor } from './-private/utils'; -/** The type of options allowed to be passed to `Base.extend()` */ -export type ExtendOptions = { [K in keyof Base]?: Base[K] } & Record; +declare namespace CoreObject { + /** The type of options allowed to be passed to `Base.extend()` */ + type ExtendOptions = { [K in keyof Base]?: Base[K] } & Record; -/** The `this` type for any methods on the options passed to `Base.extend()` */ -export type ExtendThisType = ThisType & { _super: Super }>; + /** The `this` type for any methods on the options passed to `Base.extend()` */ + type ExtendThisType = ThisType & { _super: Super }>; +} -export default class CoreObject { +declare class CoreObject { // TODO restrict to `Record` once we can restrict to 3.0+ on DT init(options?: Record): void; - static extend, Ext extends ExtendOptions>>( + static extend, Ext extends CoreObject.ExtendOptions>>( this: BaseClass, - options: Ext & ExtendThisType, Ext> + options: Ext & CoreObject.ExtendThisType, Ext> ): BaseClass & Constructor, Ext>>; } +export = CoreObject; diff --git a/types/cors/tslint.json b/types/cors/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cors/tslint.json +++ b/types/cors/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/couchbase/tslint.json b/types/couchbase/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/couchbase/tslint.json +++ b/types/couchbase/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/countdown/tslint.json b/types/countdown/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/countdown/tslint.json +++ b/types/countdown/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/counterpart/counterpart-tests.ts b/types/counterpart/counterpart-tests.ts index db9f1cf5d6..850b026ecf 100644 --- a/types/counterpart/counterpart-tests.ts +++ b/types/counterpart/counterpart-tests.ts @@ -2,6 +2,8 @@ import * as counterpart from 'counterpart'; counterpart('translation.to.be.used'); counterpart(['translation', 'to', 'be', 'used']); +counterpart.translate('translation.to.be.used'); +counterpart.translate(['translation', 'to', 'be', 'used']); counterpart.setSeparator('*'); diff --git a/types/counterpart/index.d.ts b/types/counterpart/index.d.ts index f09ad0708c..3fd0caeac7 100644 --- a/types/counterpart/index.d.ts +++ b/types/counterpart/index.d.ts @@ -9,6 +9,7 @@ type LocaleChangeHandler = (newLocale: string, oldLocale: string) => void; interface Counterpart { (key: string|string[], options?: object): string; + translate(key: string|string[], options?: object): string; setSeparator(value: string): string; onTranslationNotFound(callback: NotFoundHandler): void; diff --git a/types/cp-file/cp-file-tests.ts b/types/cp-file/cp-file-tests.ts deleted file mode 100644 index 173a650e8f..0000000000 --- a/types/cp-file/cp-file-tests.ts +++ /dev/null @@ -1,19 +0,0 @@ -import cpFile = require('cp-file'); - -cpFile('src/unicorn.png', 'dist/unicorn.png').then(() => {}); -cpFile('src/unicorn.png', 'dist/unicorn.png', {overwrite: false}).then(() => {}); -cpFile('src/unicorn.png', 'dist/unicorn.png') - .on('progress', data => { - let str: string; - let num: number; - - str = data.src; - str = data.dest; - num = data.size; - num = data.written; - num = data.percent; - }) - .then(() => {}); - -cpFile.sync('src/unicorn.png', 'dist/unicorn.png'); -cpFile.sync('src/unicorn.png', 'dist/unicorn.png', {overwrite: false}); diff --git a/types/cp-file/index.d.ts b/types/cp-file/index.d.ts deleted file mode 100644 index d0966f4c85..0000000000 --- a/types/cp-file/index.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Type definitions for cp-file 4.2 -// Project: https://github.com/sindresorhus/cp-file#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = cpFile; - -declare function cpFile(source: string, destination: string, options?: cpFile.Options): Promise & cpFile.ProgressEmitter; - -declare namespace cpFile { - function sync(source: string, destination: string, options?: Options): void; - - interface ProgressEmitter { - on(event: 'progress', handler: (data: ProgressData) => void): Promise; - } - - interface Options { - overwrite?: boolean; - } - - interface ProgressData { - src: string; - dest: string; - size: number; - written: number; - percent: number; - } -} diff --git a/types/cpy/cpy-tests.ts b/types/cpy/cpy-tests.ts deleted file mode 100644 index 1800ab35bf..0000000000 --- a/types/cpy/cpy-tests.ts +++ /dev/null @@ -1,18 +0,0 @@ -import cpy = require('cpy'); - -cpy(['src/*.png', '!src/goat.png'], 'dist').then(() => {}); -cpy('foo.js', 'destination', { - rename: basename => `prefix-${basename}`, - cwd: '/', - parents: true, - stat: true, - overwrite: false, -}); -cpy('foo.js', 'destination') - .on('progress', progress => { - let num: number; - num = progress.completedFiles; - num = progress.totalFiles; - num = progress.completedSize; - }) - .then(() => {}); diff --git a/types/cpy/index.d.ts b/types/cpy/index.d.ts deleted file mode 100644 index b6ca781137..0000000000 --- a/types/cpy/index.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -// Type definitions for cpy 5.1 -// Project: https://github.com/sindresorhus/cpy#readme -// Definitions by: Mohamed Hegazy -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -import glob = require('glob'); -import cpFile = require('cp-file'); - -export = cpy; -declare function cpy(files: string | string[], destination: string, opts?: cpy.Options): Promise & cpy.ProgressEmitter; - -declare namespace cpy { - interface ProgressEmitter { - on(event: 'progress', handler: (progress: ProgressData) => void): Promise; - } - - type Options = CpyOptions & glob.IOptions & cpFile.Options; - - interface CpyOptions { - cwd?: string; - parents?: boolean; - rename?: string | ((basename: string) => string); - } - - interface ProgressData { - completedFiles: number; - totalFiles: number; - completedSize: number; - } -} diff --git a/types/cradle/tslint.json b/types/cradle/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cradle/tslint.json +++ b/types/cradle/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/create-error/tslint.json b/types/create-error/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/create-error/tslint.json +++ b/types/create-error/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/createjs-lib/tslint.json b/types/createjs-lib/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/createjs-lib/tslint.json +++ b/types/createjs-lib/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/createjs/tslint.json b/types/createjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/createjs/tslint.json +++ b/types/createjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/credential/credential-tests.ts b/types/credential/credential-tests.ts index 9d1a59ec65..81b6c368c0 100644 --- a/types/credential/credential-tests.ts +++ b/types/credential/credential-tests.ts @@ -11,15 +11,20 @@ var newPassword = 'I have a really great password.'; pw.hash(newPassword, function(err, hash) { if (err) { throw err; } console.log('Store the password hash.', hash); + if (typeof hash === "string") { + console.log('The hash is a string, as expected'); + } else { + console.log('The has is NOT a string'); + } }); -var storedHash = { +var storedHash = JSON.stringify({ "hash": "gNofnhlBl36AdRyktwATxKoqWKa6hsIEzwCmW/YXN//7PtiJwCRbepV9fUKu0L9TJELCKoDiBy6rGM8ov7lg2yLY", "salt": "yyN3KUzlr4KrKWMM2K3d2Ddxf8OTq+vkKG+mtnmQVIibxSJz8drfzkYzqcH0EM+PVKR/1nClRr/CPDuJsq+FOcIw", "keyLength": 66, "hashMethod": "pbkdf2", "iterations": 181019 -}; +}); var userInput = 'I have a really great password.'; pw.verify(storedHash, userInput, function(err, isValid) { diff --git a/types/credential/index.d.ts b/types/credential/index.d.ts index 16b588dd72..cec4719468 100644 --- a/types/credential/index.d.ts +++ b/types/credential/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for credential +// Type definitions for credential 2.0 // Project: https://github.com/ericelliott/credential // Definitions by: Phú // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -10,24 +10,16 @@ interface defaultOptions { hashMethod: string; } -interface hashObject { - hash: string; - salt: string; - keyLength: number; - hashMethod: string; - iterations: number; -} - -type HashCallback = (err: Error, hash: hashObject) => void; +type HashCallback = (err: Error, hash: string) => void; type VerifyCallback = (err: Error, isValid: boolean) => void; declare function credential(defaultOptions?: defaultOptions): { hash(password: string, callback: HashCallback): void; - hash(password: string): Promise; + hash(password: string): Promise; // iterations(work: number, base): number; - verify(hash: hashObject | string, password: string, callback: VerifyCallback): void; - verify(hash: hashObject | string, password: string): Promise; + verify(hash: string, password: string, callback: VerifyCallback): void; + verify(hash: string, password: string): Promise; expired(hash: string, days: number): boolean; } diff --git a/types/credential/tslint.json b/types/credential/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/credential/tslint.json +++ b/types/credential/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/credit-card-type/tslint.json b/types/credit-card-type/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/credit-card-type/tslint.json +++ b/types/credit-card-type/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cron/cron-tests.ts b/types/cron/cron-tests.ts index d146fe6a61..f152498eca 100644 --- a/types/cron/cron-tests.ts +++ b/types/cron/cron-tests.ts @@ -46,6 +46,12 @@ var job = new CronJob(moment(), () => { timeZone /* Time zone of this job. */ ); +// Another example with system commands +var job = new CronJob('00 30 11 * * 1-5', 'ls', { command: 'ls', args: ['./'] }, + true, /* Start the job right now */ + timeZone /* Time zone of this job. */ +); + // For good measure var job = new CronJob({ cronTime: '00 30 11 * * 1-5', @@ -59,10 +65,14 @@ var job = new CronJob({ start: false, timeZone: 'America/Los_Angeles' }); -console.log(job.lastDate()); -console.log(job.nextDates());// Should be a Moment object -console.log(job.nextDates(1));// Should be an array of Moment object -console.log(job.running); +const ld = job.lastDate(); // $ExpectType Date +console.log(ld); +const nd = job.nextDates(); // $ExpectType Moment +console.log(nd); +const nds = job.nextDates(1); // $ExpectType Moment | Moment[] +console.log(nds);// Should be a Moment array +const ru = job.running // $ExpectType boolean +console.log(ru); job.setTime(new CronTime('00 30 11 * * 1-2')); job.start(); job.stop(); diff --git a/types/cron/index.d.ts b/types/cron/index.d.ts index b508c0d1fd..de4398333c 100644 --- a/types/cron/index.d.ts +++ b/types/cron/index.d.ts @@ -1,10 +1,15 @@ -// Type definitions for cron 1.6 +// Type definitions for cron 1.7 // Project: https://www.npmjs.com/package/cron // Definitions by: Hiroki Horiuchi // Lundarl Gholoi // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +/// + import { Moment } from 'moment'; +import { SpawnOptions } from "child_process"; + +export declare type CronCommand = (() => void) | string | { command: string, args?: ReadonlyArray, options?: SpawnOptions}; export declare class CronTime { /** @@ -17,10 +22,14 @@ export declare class CronTime { /** * Tells you when ```CronTime``` will be run. - * @param i Indicate which turn of run after now. If not given return next run time. */ public sendAt(): Moment; - public sendAt(i?: number): Moment[]; + /** + * Tells you when ```CronTime``` will be run. + * @param i Indicate which turn of run after now. If not given return next run time. + * @returns A `Moment` when the source passed in the constructor is a `Date` or a `Moment` and an array of `Moment` when the source is a string + */ + public sendAt(i?: number): Moment | Moment[]; /** * Get the number of milliseconds in the future at which to fire our callbacks. */ @@ -35,11 +44,11 @@ export declare interface CronJobParameters { /** * The function to fire at the specified time. If an ```onComplete``` callback was provided, ```onTick``` will receive it as an argument. ```onTick``` may call ```onComplete``` when it has finished its work. */ - onTick: () => void; + onTick: CronCommand; /** * A function that will fire when the job is stopped with ```job.stop()```, and may also be called by ```onTick``` at the end of each run. */ - onComplete?: () => void; + onComplete?: CronCommand; /** * Specifies whether to start the job just before exiting the constructor. By default this is set to false. If left at default you will need to call ```job.start()``` in order to start the job (assuming ```job``` is the variable you set the cronjob to). This does not immediately fire your ```onTick``` function, it just gives you more control over the behavior of your jobs. */ @@ -88,7 +97,7 @@ export declare class CronJob { * @param utcOffset This allows you to specify the offset of your timezone rather than using the ```timeZone``` param. Probably don't use both ```timeZone``` and ```utcOffset``` together or weird things may happen. * @param unrefTimeout If you have code that keeps the event loop running and want to stop the node process when that finishes regardless of the state of your cronjob, you can do so making use of this parameter. This is off by default and cron will run as if it needs to control the event loop. For more information take a look at [timers#timers_timeout_unref](https://nodejs.org/api/timers.html#timers_timeout_unref) from the NodeJS docs. */ - constructor(cronTime: string | Date | Moment, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean); + constructor(cronTime: string | Date | Moment, onTick: CronCommand, onComplete?: CronCommand, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean); /** * Create a new ```CronJob```. * @param options Job parameters. @@ -114,10 +123,15 @@ export declare class CronJob { public lastDate(): Date; /** * Tells you when a ```CronTime``` will be run. - * @param i Indicate which turn of run after now. If not given return next run time. */ + public nextDate(): Moment; public nextDates(): Moment; - public nextDates(i?: number): Moment[]; + /** + * Tells you when a ```CronTime``` will be run. + * @param i Indicate which turn of run after now. If not given return next run time. + * @returns A `Moment` when the cronTime passed in the constructor is a `Date` or a `Moment` and an array of `Moment` when the cronTime is a string + */ + public nextDates(i?: number): Moment | Moment[]; /** * Add another ```onTick``` function. * @param callback Target function. @@ -126,7 +140,7 @@ export declare class CronJob { } export declare var job: - ((cronTime: string | Date | Moment, onTick: () => void, onComplete?: () => void, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean) => CronJob) + ((cronTime: string | Date | Moment, onTick: () => void, onComplete?: CronCommand, start?: boolean, timeZone?: string, context?: any, runOnInit?: boolean, utcOffset?: string | number, unrefTimeout?: boolean) => CronJob) | ((options: CronJobParameters) => CronJob); export declare var time: (source: string | Date | Moment, zone?: string) => CronTime; export declare var sendAt: (cronTime: string | Date | Moment) => Moment; diff --git a/types/cron/tslint.json b/types/cron/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cron/tslint.json +++ b/types/cron/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cross-storage/tslint.json b/types/cross-storage/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cross-storage/tslint.json +++ b/types/cross-storage/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/crossfilter/tslint.json b/types/crossfilter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/crossfilter/tslint.json +++ b/types/crossfilter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/crossroads/tslint.json b/types/crossroads/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/crossroads/tslint.json +++ b/types/crossroads/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/crpc/crpc-tests.ts b/types/crpc/crpc-tests.ts index ade069cbba..b9b59ba718 100644 --- a/types/crpc/crpc-tests.ts +++ b/types/crpc/crpc-tests.ts @@ -1,3 +1,3 @@ -import crpc from 'crpc'; +import crpc = require('crpc'); const client = crpc('https://example.com/'); diff --git a/types/crpc/index.d.ts b/types/crpc/index.d.ts index 8947443c42..a599dacab5 100644 --- a/types/crpc/index.d.ts +++ b/types/crpc/index.d.ts @@ -4,6 +4,9 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 -export type Client = (path: string, body: any, options?: {} | null) => Promise; +declare namespace crpc { + type Client = (path: string, body: any, options?: {} | null) => Promise; +} -export default function crpc(baseUrl: string, options?: {}): Client; +export = crpc; +declare function crpc(baseUrl: string, options?: {}): crpc.Client; diff --git a/types/crypto-js/tslint.json b/types/crypto-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/crypto-js/tslint.json +++ b/types/crypto-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cryptojs/tslint.json b/types/cryptojs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cryptojs/tslint.json +++ b/types/cryptojs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cson/tslint.json b/types/cson/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cson/tslint.json +++ b/types/cson/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/css-modules-loader-core/css-modules-loader-core-tests.ts b/types/css-modules-loader-core/css-modules-loader-core-tests.ts new file mode 100644 index 0000000000..d8fe2966d7 --- /dev/null +++ b/types/css-modules-loader-core/css-modules-loader-core-tests.ts @@ -0,0 +1,24 @@ +/// + +import Core, { Source } from "css-modules-loader-core"; + +const core = new Core(); +const emptyPlugins = new Core([]); +const withPlugins = new Core([ + Core.values, + Core.localByDefault, + Core.extractImports, + Core.scope +]); +const withDefaultPlugins = new Core(Core.defaultPlugins); + +// $ExpectError +const noArray = new Core(Core.values); + +// Validating the source can be anything that has toString() defined +const bufferSource: Source = new Buffer("str"); + +core.load("str").then(({ injectableSource, exportTokens }) => { + const str: string = injectableSource; + exportTokens["key"] = "value"; +}); diff --git a/types/css-modules-loader-core/index.d.ts b/types/css-modules-loader-core/index.d.ts new file mode 100644 index 0000000000..d7bd533ac1 --- /dev/null +++ b/types/css-modules-loader-core/index.d.ts @@ -0,0 +1,50 @@ +// Type definitions for css-modules-loader-core 1.1 +// Project: https://github.com/css-modules/css-modules-loader-core +// Definitions by: Spencer Miskoviak +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +import { Plugin } from "postcss"; + +declare namespace Core { + type Source = + | string + | { + toString(): string; + }; + + type PathFetcher = ( + file: string, + relativeTo: string, + depTrace: string + ) => void; + + interface ExportTokens { + [index: string]: string; + } + + interface Result { + injectableSource: string; + exportTokens: ExportTokens; + } +} + +declare class Core { + static values: Plugin<{}>; + static localByDefault: Plugin<{}>; + static extractImports: Plugin<{}>; + static scope: Plugin<{}>; + static defaultPlugins: Array>; + + constructor(plugins?: Array>); + + load( + source: Core.Source, + sourcePath?: string, + trace?: string, + pathFetcher?: Core.PathFetcher + ): Promise; +} + +export = Core; +export as namespace Core; diff --git a/types/css-modules-loader-core/package.json b/types/css-modules-loader-core/package.json new file mode 100644 index 0000000000..06a694067a --- /dev/null +++ b/types/css-modules-loader-core/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "postcss": "7.x.x" + } +} diff --git a/types/css-modules-loader-core/tsconfig.json b/types/css-modules-loader-core/tsconfig.json new file mode 100644 index 0000000000..a4b15a0258 --- /dev/null +++ b/types/css-modules-loader-core/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", + "css-modules-loader-core-tests.ts" + ] +} diff --git a/types/cp-file/tslint.json b/types/css-modules-loader-core/tslint.json similarity index 100% rename from types/cp-file/tslint.json rename to types/css-modules-loader-core/tslint.json diff --git a/types/css-modules-require-hook/tslint.json b/types/css-modules-require-hook/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/css-modules-require-hook/tslint.json +++ b/types/css-modules-require-hook/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/css/tslint.json b/types/css/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/css/tslint.json +++ b/types/css/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cssbeautify/tslint.json b/types/cssbeautify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cssbeautify/tslint.json +++ b/types/cssbeautify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/csurf/tslint.json b/types/csurf/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/csurf/tslint.json +++ b/types/csurf/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cuid/tslint.json b/types/cuid/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cuid/tslint.json +++ b/types/cuid/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/custom-error-generator/tslint.json b/types/custom-error-generator/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/custom-error-generator/tslint.json +++ b/types/custom-error-generator/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cybozulabs-md5/tslint.json b/types/cybozulabs-md5/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/cybozulabs-md5/tslint.json +++ b/types/cybozulabs-md5/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/cypress-axe/index.d.ts b/types/cypress-axe/index.d.ts index 507a5f773d..3ba776e14f 100644 --- a/types/cypress-axe/index.d.ts +++ b/types/cypress-axe/index.d.ts @@ -1,12 +1,21 @@ -// Type definitions for cypress-axe 0.3 +// Type definitions for cypress-axe 0.4 // Project: https://github.com/avanslaars/cypress-axe#readme // Definitions by: Justin Hall // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -declare namespace Cypress { - interface Chainable { - injectAxe(): void; - checkA11y(): void; +import { ElementContext, RunOptions } from 'axe-core'; + +declare module 'axe-core' { + interface Node {} +} + +declare global { + namespace Cypress { + interface Chainable { + injectAxe(): void; + checkA11y(context?: ElementContext, options?: RunOptions): void; + configureAxe(options?: RunOptions): void; + } } } diff --git a/types/cypress-axe/package.json b/types/cypress-axe/package.json new file mode 100644 index 0000000000..71df6dd355 --- /dev/null +++ b/types/cypress-axe/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "axe-core": "^3.1.2" + } +} diff --git a/types/cypress-axe/tslint.json b/types/cypress-axe/tslint.json index 3db14f85ea..4f44991c3c 100644 --- a/types/cypress-axe/tslint.json +++ b/types/cypress-axe/tslint.json @@ -1 +1,6 @@ -{ "extends": "dtslint/dt.json" } +{ + "extends": "dtslint/dt.json", + "rules": { + "no-empty-interface": false + } +} diff --git a/types/cytoscape/index.d.ts b/types/cytoscape/index.d.ts index b4ca7de92f..aec7c9bf6c 100644 --- a/types/cytoscape/index.d.ts +++ b/types/cytoscape/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for Cytoscape.js 3.3 +// Type definitions for Cytoscape.js 3.4 // Project: http://js.cytoscape.org/ // Definitions by: Fabian Schmidt and Fred Eisele // Shenghan Gao @@ -3229,7 +3229,7 @@ declare namespace cytoscape { * This finds the shortest path from the starting node to all other nodes in the collection. * http://js.cytoscape.org/#eles.bellmanFord */ - bellmanFort(options: SearchBellmanFordOptions): SearchBellmanFordResult; + bellmanFord(options: SearchBellmanFordOptions): SearchBellmanFordResult; /** * Perform Kruskal's algorithm on the elements in the collection, * returning the minimum spanning tree, assuming undirected edges. diff --git a/types/d3-box/tslint.json b/types/d3-box/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/d3-box/tslint.json +++ b/types/d3-box/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/d3-cloud/d3-cloud-tests.ts b/types/d3-cloud/d3-cloud-tests.ts index e3bffed4cb..19a140959f 100644 --- a/types/d3-cloud/d3-cloud-tests.ts +++ b/types/d3-cloud/d3-cloud-tests.ts @@ -27,8 +27,11 @@ d3.layout.cloud().size([300, 300]) .font("Impact") .fontSize(function(d:ICompTextSize) { return d.size; }) .on("end", draw) + .random() + .canvas() .start(); + function draw(words:ICompTextSize[]) { d3.select("body").append("svg") .attr("width", 300) diff --git a/types/d3-cloud/index.d.ts b/types/d3-cloud/index.d.ts index fdf2dbc719..b0a3b8a78c 100644 --- a/types/d3-cloud/index.d.ts +++ b/types/d3-cloud/index.d.ts @@ -1,6 +1,6 @@ -// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.2 +// Type definitions for d3JS cloud layout plugin by Jason Davies v1.2.5 // Project: https://github.com/jasondavies/d3-cloud -// Definitions by: hans windhoff +// Definitions by: hans windhoff , locknono // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import * as d3 from 'd3'; @@ -71,6 +71,24 @@ declare module 'd3' { padding(padding: number): Cloud; padding(padding: (datum: T, index: number) => number): Cloud; + /** + * If specified, sets the internal random number generator,used for selecting the initial position of each word, + * and the clockwise/counterclockwise direction of the spiral for each word. + * + * @param randomFunction should return a number in the range [0, 1).The default is Math.random. + */ + random(): Cloud; + random(randomFunction: () => number): Cloud; + + /** + * If specified, sets the canvas generator function, which is used internally to draw text. + * When using Node.js, you will almost definitely override the default, e.g. using the canvas module. + * @param canvasGenerator should return a HTMLCanvasElement.The default is: ()=>{document.createElement("canvas");} + * + */ + canvas():Cloud; + canvas(canvasGenerator: () => HTMLCanvasElement): Cloud; + on(type: "word", listener: (word: T) => void): Cloud; on(type: "end", listener: (tags: T[], bounds: { x: number; y: number }[]) => void): Cloud; on(type: string, listener: (...args: any[]) => void): Cloud; diff --git a/types/d3-cloud/tslint.json b/types/d3-cloud/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/d3-cloud/tslint.json +++ b/types/d3-cloud/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/d3-sankey/index.d.ts b/types/d3-sankey/index.d.ts index 4f70bbbe61..3f10e2d1ae 100644 --- a/types/d3-sankey/index.d.ts +++ b/types/d3-sankey/index.d.ts @@ -1,10 +1,10 @@ -// Type definitions for D3JS d3-sankey module 0.7 +// Type definitions for D3JS d3-sankey module 0.11 // Project: https://github.com/d3/d3-sankey/ // Definitions by: Tom Wanzek , Alex Ford // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 -// Last module patch version validated against: 0.7.1 +// Last module patch version validated against: 0.11 import { Link } from 'd3-shape'; @@ -337,6 +337,18 @@ export interface SankeyLayout, b: SankeyNode) => number) | undefined; + + /** + * Set the node comparison function and return this Sankey layout generator. + * + * @param compare Node comparison function. + */ + nodeSort(compare: (a: SankeyNode, b: SankeyNode) => number): this; } /** diff --git a/types/d3-tip/tslint.json b/types/d3-tip/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/d3-tip/tslint.json +++ b/types/d3-tip/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/d3.slider/tslint.json b/types/d3.slider/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/d3.slider/tslint.json +++ b/types/d3.slider/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/d3pie/tslint.json b/types/d3pie/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/d3pie/tslint.json +++ b/types/d3pie/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/dat.gui/tslint.json b/types/dat.gui/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/dat.gui/tslint.json +++ b/types/dat.gui/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/data-driven/tslint.json b/types/data-driven/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/data-driven/tslint.json +++ b/types/data-driven/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/datadog-statsd-metrics-collector/datadog-statsd-metrics-collector-tests.ts b/types/datadog-statsd-metrics-collector/datadog-statsd-metrics-collector-tests.ts new file mode 100644 index 0000000000..ef5691a57d --- /dev/null +++ b/types/datadog-statsd-metrics-collector/datadog-statsd-metrics-collector-tests.ts @@ -0,0 +1,43 @@ +import datadog = require('node-dogstatsd'); +import Collector = require('datadog-statsd-metrics-collector'); + +const client = new datadog.StatsD('localhost'); + +// constructors +let collector = new Collector(client); +collector = new Collector(client, 1000); + +// interface +const key = 'key'; +const timeValue = 99; +const sampleRate = 0.85; +const incrementBy = 7; +const decrementBy = 5; +const gaugeValue = 199; +const tags: string[] = ['tag1', 'tag2']; + +collector.timing(key, timeValue); +collector.timing(key, timeValue, sampleRate); +collector.timing(key, timeValue, sampleRate, tags); + +collector.increment(key); +collector.increment(key, sampleRate); +collector.increment(key, sampleRate, tags); + +collector.incrementBy(key, incrementBy); +collector.incrementBy(key, incrementBy, tags); + +collector.decrement(key); +collector.decrement(key, sampleRate); +collector.decrement(key, sampleRate, tags); + +collector.decrementBy(key, decrementBy); +collector.decrementBy(key, decrementBy, tags); + +collector.gauge(key, gaugeValue); +collector.gauge(key, gaugeValue, sampleRate); +collector.gauge(key, gaugeValue, sampleRate, tags); + +collector.histogram(key, timeValue); +collector.histogram(key, timeValue, sampleRate); +collector.histogram(key, timeValue, sampleRate, tags); diff --git a/types/datadog-statsd-metrics-collector/index.d.ts b/types/datadog-statsd-metrics-collector/index.d.ts new file mode 100644 index 0000000000..741c5a9f43 --- /dev/null +++ b/types/datadog-statsd-metrics-collector/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for datadog-statsd-metrics-collector 1.1 +// Project: https://github.com/xzyfer/datadog-statsd-metrics-collector#readme +// Definitions by: Michael Mifsud +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +import dogstatsd = require('node-dogstatsd'); + +declare class Collector implements dogstatsd.StatsDClient { + constructor(client: dogstatsd.StatsDClient, delayMilliseconds?: number); + + timing(stat: string, time: number, sample_rate?: number, tags?: string[]): void; + + increment(stat: string, sample_rate?: number, tags?: string[]): void; + incrementBy(stat: string, value: number, tags?: string[]): void; + + decrement(stat: string, sample_rate?: number, tags?: string[]): void; + decrementBy(stat: string, value: number, tags?: string[]): void; + + gauge(stat: string, value: number, sample_rate?: number, tags?: string[]): void; + + histogram(stat: string, time: number, sample_rate?: number, tags?: string[]): void; +} + +export = Collector; diff --git a/types/conf/tsconfig.json b/types/datadog-statsd-metrics-collector/tsconfig.json similarity index 89% rename from types/conf/tsconfig.json rename to types/datadog-statsd-metrics-collector/tsconfig.json index 479fa6b41f..d136060376 100644 --- a/types/conf/tsconfig.json +++ b/types/datadog-statsd-metrics-collector/tsconfig.json @@ -4,7 +4,6 @@ "lib": [ "es6" ], - "target": "es6", "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": true, @@ -19,6 +18,6 @@ }, "files": [ "index.d.ts", - "conf-tests.ts" + "datadog-statsd-metrics-collector-tests.ts" ] } diff --git a/types/cpy/tslint.json b/types/datadog-statsd-metrics-collector/tslint.json similarity index 100% rename from types/cpy/tslint.json rename to types/datadog-statsd-metrics-collector/tslint.json diff --git a/types/datatables.net/datatables.net-tests.ts b/types/datatables.net/datatables.net-tests.ts index d6903ce1db..bdb10aa671 100644 --- a/types/datatables.net/datatables.net-tests.ts +++ b/types/datatables.net/datatables.net-tests.ts @@ -615,7 +615,7 @@ dt.columns('.select-filter').eq(0).each((colIdx: any) => { // Create the select list and search operation const select = $('') .appendTo( - dt.column(0).footer() + dt.column(0).footer() ) .on('change', () => { dt @@ -735,7 +735,7 @@ $('#example').on('click', 'tbody td', () => { alert('Data source: ' + dt.column(idx).dataSrc()); }); -const column_footer = column.footer(); +const column_footer: HTMLElement = column.footer(); const column_p = dt.column(0); // $(column.footer()).html( // column_p @@ -745,15 +745,15 @@ const column_p = dt.column(0); // }) // ); -const column_header = column.header(); +const column_header: HTMLElement = column.header(); $('#example tbody').on('click', 'td', function() { const idx = dt.cell(this).index().column; - const title = dt.column(idx).header(); + const title: HTMLElement = dt.column(idx).header(); alert('Column title clicked on: ' + $(title).html()); }); -let column_index = column.index(); +let column_index: number = column.index(); column_index = column.index("visibile"); dt.column(0).visible(false); @@ -762,11 +762,9 @@ alert(idx); // will show 0 dt.column('0:visible').order('asc'); -const column_nodes = column.nodes(); -dt.column(-1) - .nodes(); -// .to$() // Convert to a jQuery object -// .addClass('ready'); +const column_nodes: DataTables.Api = column.nodes(); +column_nodes.to$() // Convert to a jQuery object + .addClass('ready'); const column_search_get = column.search(); let column_search_set = column.search("string"); @@ -784,7 +782,7 @@ dt.columns('.select-filter').eq(0).each((colIdx: any) => { // Create the select list and search operation const select = $('; + } + + interface Result { + puzzle: Puzzle; + status: State; + } + + interface Input { + columns: number[][]; + content?: State[]; + rows: number[][]; + } + + type State = 0 | 1 | -1; +} + +declare function solve(filename: string): solve.Result; + +export = solve; diff --git a/types/nonogram-solver/nonogram-solver-tests.ts b/types/nonogram-solver/nonogram-solver-tests.ts new file mode 100644 index 0000000000..5850711fab --- /dev/null +++ b/types/nonogram-solver/nonogram-solver-tests.ts @@ -0,0 +1,10 @@ +import solve = require('nonogram-solver'); + +const { status, puzzle } = solve('input.json'); + +puzzle; // $ExpectType Puzzle +puzzle.columnHints; // $ExpectType number[][] +puzzle.isFinished; // $expectType boolean +puzzle.svg; // $expectType string + +status; // $ExpectType State diff --git a/types/nonogram-solver/tsconfig.json b/types/nonogram-solver/tsconfig.json new file mode 100644 index 0000000000..688aea0d5e --- /dev/null +++ b/types/nonogram-solver/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", + "nonogram-solver-tests.ts" + ] +} diff --git a/types/npm-email/tslint.json b/types/nonogram-solver/tslint.json similarity index 100% rename from types/npm-email/tslint.json rename to types/nonogram-solver/tslint.json diff --git a/types/nopt/tslint.json b/types/nopt/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/nopt/tslint.json +++ b/types/nopt/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/notie/tslint.json b/types/notie/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/notie/tslint.json +++ b/types/notie/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/notify/tslint.json b/types/notify/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/notify/tslint.json +++ b/types/notify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/notifyjs-browser/tslint.json b/types/notifyjs-browser/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/notifyjs-browser/tslint.json +++ b/types/notifyjs-browser/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/notifyjs/tslint.json b/types/notifyjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/notifyjs/tslint.json +++ b/types/notifyjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/nouislider/tslint.json b/types/nouislider/tslint.json index b6afb8acee..4017299a0e 100644 --- a/types/nouislider/tslint.json +++ b/types/nouislider/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/npm-email/index.d.ts b/types/npm-email/index.d.ts deleted file mode 100644 index 055a68f8af..0000000000 --- a/types/npm-email/index.d.ts +++ /dev/null @@ -1,14 +0,0 @@ -// Type definitions for npm-email 3.0 -// Project: https://github.com/sindresorhus/npm-email#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = npmEmail; - -/** - * Get the email of an npm user. - * - * @param username npm username to look up. - * @returns A promise for the user's email address. - */ -declare function npmEmail(username: string): Promise; diff --git a/types/npm-email/npm-email-tests.ts b/types/npm-email/npm-email-tests.ts deleted file mode 100644 index b0640c73e3..0000000000 --- a/types/npm-email/npm-email-tests.ts +++ /dev/null @@ -1,3 +0,0 @@ -import npmEmail = require('npm-email'); - -npmEmail('sindresorhus'); // $ExpectType Promise diff --git a/types/npm-email/tsconfig.json b/types/npm-email/tsconfig.json deleted file mode 100644 index 985ed0472a..0000000000 --- a/types/npm-email/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "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-email-tests.ts" - ] -} diff --git a/types/npm-keyword/index.d.ts b/types/npm-keyword/index.d.ts deleted file mode 100644 index 94c8af9f13..0000000000 --- a/types/npm-keyword/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -// Type definitions for npm-keyword 5.0 -// Project: https://github.com/sindresorhus/npm-keyword#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = npmKeyword; - -/** - * Get a list of npm packages with a certain keyword. - * - * @param keyword One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']` - * @returns A promise for a list of packages having the specified keyword in their package.json `keyword` property. - */ -declare function npmKeyword( - keyword: string | string[], - options?: npmKeyword.Options -): Promise; - -declare namespace npmKeyword { - /** - * @param keyword One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']` - * @returns A promise for a list of package names. Use this if you don't need the description as it's faster. - */ - function names(keyword: string | string[], options?: Options): Promise; - - /** - * @param keyword One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']` - * @returns A promise for the count of packages. - */ - function count(keyword: string | string[]): Promise; - - interface Options { - /** - * Limits the amount of results. - * @default 250 - */ - size?: number; - } - - interface PackageDescriptor { - name: string; - description: string; - } -} diff --git a/types/npm-keyword/npm-keyword-tests.ts b/types/npm-keyword/npm-keyword-tests.ts deleted file mode 100644 index 17418bdb04..0000000000 --- a/types/npm-keyword/npm-keyword-tests.ts +++ /dev/null @@ -1,7 +0,0 @@ -import npmKeyword = require('npm-keyword'); - -npmKeyword('gulpplugin'); // $ExpectType Promise -npmKeyword('gulpplugin', { size: 10 }); // $ExpectType Promise -npmKeyword.names('gulpplugin'); // $ExpectType Promise -npmKeyword.names('gulpplugin', { size: 10 }); // $ExpectType Promise -npmKeyword.count('gulpplugin'); // $ExpectType Promise diff --git a/types/npm-keyword/tsconfig.json b/types/npm-keyword/tsconfig.json deleted file mode 100644 index b0c0fed33d..0000000000 --- a/types/npm-keyword/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "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-keyword-tests.ts" - ] -} diff --git a/types/npm-name/index.d.ts b/types/npm-name/index.d.ts deleted file mode 100644 index e4830f377e..0000000000 --- a/types/npm-name/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Type definitions for npm-name 5.0 -// Project: https://github.com/sindresorhus/npm-name#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = npmName; - -declare function npmName(name: string): Promise; - -declare namespace npmName { - function many(names: T[]): Promise>; -} diff --git a/types/npm-name/npm-name-tests.ts b/types/npm-name/npm-name-tests.ts deleted file mode 100644 index cb8283699c..0000000000 --- a/types/npm-name/npm-name-tests.ts +++ /dev/null @@ -1,12 +0,0 @@ -import npmName = require('npm-name'); - -// $ExpectType Promise -npmName('chalk'); - -npmName.many(['chalk', '@sindresorhus/is', 'abc123']).then(result => { - // $ExpectType Map<"chalk" | "@sindresorhus/is" | "abc123", boolean> - result; - - // $ExpectType boolean | undefined - result.get('chalk'); -}); diff --git a/types/npm-run-path/index.d.ts b/types/npm-run-path/index.d.ts deleted file mode 100644 index 6a052e0450..0000000000 --- a/types/npm-run-path/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Type definitions for npm-run-path 2.0 -// Project: https://github.com/sindresorhus/npm-run-path#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = npmRunPath; - -/** - * Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries. - */ -declare function npmRunPath(options?: npmRunPath.Options): string; - -declare namespace npmRunPath { - function env(options?: EnvOptions): ProcessEnv; - - interface Options { - /** - * Working directory. - */ - cwd?: string; - /** - * PATH to be appended. - * Set it to an empty string to exclude the default [PATH](https://github.com/sindresorhus/path-key). - * @default PATH - */ - path?: string; - } - - interface EnvOptions { - /** - * Working directory. - */ - cwd?: string; - /** - * Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct - * [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use - * in the `child_process` options. - */ - env?: ProcessEnv; - } - - interface ProcessEnv { - [key: string]: string | undefined; - } -} diff --git a/types/npm-run-path/npm-run-path-tests.ts b/types/npm-run-path/npm-run-path-tests.ts deleted file mode 100644 index 4cff236373..0000000000 --- a/types/npm-run-path/npm-run-path-tests.ts +++ /dev/null @@ -1,16 +0,0 @@ -/// - -import childProcess = require('child_process'); -import npmRunPath = require('npm-run-path'); - -npmRunPath(); // $ExpectType string -npmRunPath({ cwd: '/foo' }); // $ExpectType string -npmRunPath({ path: '/usr/local/bin' }); // $ExpectType string - -npmRunPath.env(); // $ExpectType ProcessEnv -npmRunPath.env({ cwd: '/foo' }); // $ExpectType ProcessEnv -npmRunPath.env({ env: process.env }); // $ExpectType ProcessEnv - -childProcess.execFileSync('foo', { - env: npmRunPath.env(), -}); diff --git a/types/npm-run-path/tsconfig.json b/types/npm-run-path/tsconfig.json deleted file mode 100644 index d6738a23ca..0000000000 --- a/types/npm-run-path/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "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-run-path-tests.ts" - ] -} diff --git a/types/npm-user/index.d.ts b/types/npm-user/index.d.ts deleted file mode 100644 index 2d03c12c0c..0000000000 --- a/types/npm-user/index.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -// Type definitions for npm-user 3.0 -// Project: https://github.com/sindresorhus/npm-user#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = npmUser; - -declare function npmUser(name: string): Promise; - -declare namespace npmUser { - interface UserData { - name: string | null; - avatar: string | null; - email: string | null; - github: string | null; - twitter: string | null; - } -} diff --git a/types/npm-user/npm-user-tests.ts b/types/npm-user/npm-user-tests.ts deleted file mode 100644 index 1d63de27ef..0000000000 --- a/types/npm-user/npm-user-tests.ts +++ /dev/null @@ -1,11 +0,0 @@ -import npmUser = require('npm-user'); - -npmUser('sindresorhus').then(user => { - user; // $ExpectType UserData - - user.name; // $ExpectType string | null - user.avatar; // $ExpectType string | null - user.email; // $ExpectType string | null - user.github; // $ExpectType string | null - user.twitter; // $ExpectType string | null -}); diff --git a/types/npm-user/tsconfig.json b/types/npm-user/tsconfig.json deleted file mode 100644 index 1e5c1d464f..0000000000 --- a/types/npm-user/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "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-user-tests.ts" - ] -} diff --git a/types/npm/tslint.json b/types/npm/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/npm/tslint.json +++ b/types/npm/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/nprogress/tslint.json b/types/nprogress/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/nprogress/tslint.json +++ b/types/nprogress/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/numeral/tslint.json b/types/numeral/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/numeral/tslint.json +++ b/types/numeral/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/nunjucks-date/tslint.json b/types/nunjucks-date/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/nunjucks-date/tslint.json +++ b/types/nunjucks-date/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/nvd3/tslint.json b/types/nvd3/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/nvd3/tslint.json +++ b/types/nvd3/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/nw.gui/tslint.json b/types/nw.gui/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/nw.gui/tslint.json +++ b/types/nw.gui/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/nw.js/tslint.json b/types/nw.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/nw.js/tslint.json +++ b/types/nw.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/o.js/tslint.json b/types/o.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/o.js/tslint.json +++ b/types/o.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/oakdex-pokedex/index.d.ts b/types/oakdex-pokedex/index.d.ts new file mode 100644 index 0000000000..8ca4fa709d --- /dev/null +++ b/types/oakdex-pokedex/index.d.ts @@ -0,0 +1,349 @@ +// Type definitions for oakdex-pokedex 0.4 +// Project: https://github.com/jalyna/oakdex-pokedex +// Definitions by: Jalyna Schroeder +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export interface Translations { + de: string; + en: string; + cz?: string; + dk?: string; + fr?: string; + gr?: string; + it?: string; + pl?: string; + tr?: string; + jp?: string; + es?: string; +} + +export interface PokemonEvolution { + to: string; + level?: number; + happiness?: boolean; + trade?: boolean; + level_up?: boolean; + item?: string; + hold_item?: string; + move_learned?: string; + conditions?: string[]; +} + +export interface PokemonAbility { + name: string; + hidden?: boolean; +} + +export interface StatObject { + hp: number; + atk: number; + def: number; + sp_atk: number; + sp_def: number; + speed: number; +} + +export interface MegaEvolution { + types: string[]; + ability: string; + height_us: string; + height_eu: string; + weight_us: string; + weight_eu: string; + base_stats: StatObject; + mega_stone: string; + image_suffix?: string; +} + +export interface PokemonVariation { + condition?: string; + names: Translations; + types: string[]; + height_us?: string; + height_eu?: string; + weight_us?: string; + weight_eu?: string; + base_stats?: StatObject; + pokeathlon_stats?: { + speed?: number[]; + power?: number[]; + stamina?: number[]; + skill?: number[]; + jump?: number[] + }; + abilities?: string[]; + image_suffix?: string; +} + +export interface Learnset { + move: string; + level?: number; + tm?: string; + egg_move?: boolean; + variations?: string[]; +} + +export interface MoveLearnset { + games: string[]; + learnset: Learnset[]; +} + +export interface Pokemon { + names: Translations; + categories: Translations; + national_id: number; + kanto_id: number | null; + johto_id: number | null; + hoenn_id: number | null; + sinnoh_id: number | null; + unova_id: number | null; + kalos_id: number | null; + alola_id: number | null; + ultra_alola_id: number | null; + pokedex_entries: { + [key: string]: Translations; + }; + evolution_from: string | null; + evolutions: PokemonEvolution[]; + types: string[]; + abilities: PokemonAbility[]; + gender_ratios: null | { + female: number; + male: number; + }; + catch_rate: number; + egg_groups: string[]; + hatch_time: number[]; + height_us: string; + height_eu: string; + weight_us: string; + weight_eu: string; + base_exp_yield: number; + leveling_rate: string; + ev_yield: StatObject; + color: string; + base_friendship: number; + base_stats: StatObject; + pokeathlon_stats?: { + speed?: number[]; + power?: number[]; + stamina?: number[]; + skill?: number[]; + jump?: number[]; + }; + mega_evolutions: MegaEvolution[]; + variation_names?: Translations; + variations: PokemonVariation[]; + move_learnsets: MoveLearnset[]; +} + +export interface MoveStatusCondition { + condition: string; + probability: number; +} + +export interface MoveStatModifier { + stat: string; + change_by: number; + affects_user?: boolean; +} + +export interface MoveContest { + contest: string; + condition: string; + appeal: number; + jam: number; +} + +export interface Move { + names: Translations; + index_number: number; + pp: number; + max_pp: number; + power: number; + accuracy: number; + type: string; + category: string; + priority: number; + target: string; + critical_hit: number; + pokedex_entries: { + [key: string]: Translations; + }; + contests: MoveContest[]; + makes_contact: boolean; + affected_by_protect: boolean; + affected_by_magic_coat: boolean; + affected_by_snatch: boolean; + affected_by_mirror_move: boolean; + affected_by_kings_rock: boolean; + in_battle_properties?: { + increased_critical_hit_ratio?: boolean; + status_conditions?: MoveStatusCondition[] + }; + stat_modifiers?: MoveStatModifier[]; +} + +export interface Ability { + names: Translations; + index_number: number; + descriptions: Translations; +} + +export interface PokemonType { + names: Translations; + color: string; + effectivness: { + Normal: number; + Fighting: number; + Flying: number; + Poison: number; + Ground: number; + Rock: number; + Bug: number; + Ghost: number; + Steel: number; + Fire: number; + Water: number; + Grass: number; + Electric: number; + Psychic: number; + Ice: number; + Dragon: number; + Dark: number; + Fairy: number; + }; +} + +export interface LocationPokemon { + pokemon: string; + location: string; + min_level: number; + max_level: number; + rarity: string; + games: string[]; + day_times?: string[]; + seasons?: string[]; + variation?: string; +} + +export interface Location { + names: Translations; + pokemon: LocationPokemon[]; +} + +export interface Region { + names: Translations; + locations: Location[]; +} + +export interface EggGroup { + names: Translations; +} + +export interface Generation { + names: Translations; + dex_name: string; + number: number; + games: Translations[]; +} + +export interface Nature { + names: Translations; + increased_stat: string | null; + decreased_stat: string | null; + favorite_flavor: string | null; + disliked_flavor: string | null; +} + +export interface ItemPrice { + games: string[]; + buying: number; + selling: number; +} + +export interface ItemPocket { + pocket: string; + generations: number[]; +} + +export interface ItemDescription { + translations: Translations; + games: string[]; +} + +export interface ItemPokemonChange { + field: string; + change_by_percent?: number; + revive?: boolean; + change_by?: number; + change?: string; + conditions?: string[]; +} + +export interface ItemMoveChange { + field: string; + change_by_percent?: number; + change_by?: number; + change_by_max?: number; +} + +export interface ItemEffect { + condition: string; + target: string; + triggers_evolution?: boolean; + pokemon_changes?: ItemPokemonChange[]; + move_changes?: ItemMoveChange[]; +} + +export interface Item { + names: Translations; + category: string; + descriptions: ItemDescription[]; + prices: ItemPrice[]; + pockets: ItemPocket[]; + effects: ItemEffect[]; + fling_power: number; +} + +export interface Conditions { + [key: string]: any; +} + +export function resetPokemon(): void; + +export function importPokemon(customPokemon: string[] | string | Pokemon[]): void; + +export function findPokemon(idOrName: string | number): Pokemon | null; + +export function findMove(name: string): Move | null; + +export function findAbility(name: string): Ability | null; + +export function findType(name: string): PokemonType | null; + +export function findRegion(name: string): Region | null; + +export function findEggGroup(name: string): EggGroup | null; + +export function findGeneration(name: string): Generation | null; + +export function findNature(name: string): Nature | null; + +export function findItem(name: string): Item | null; + +export function allPokemon(conditions?: Conditions): Pokemon[]; + +export function allItems(conditions?: Conditions): Item[]; + +export function allTypes(conditions?: Conditions): PokemonType[]; + +export function allAbilities(conditions?: Conditions): Ability[]; + +export function allRegions(conditions?: Conditions): Region[]; + +export function allEggGroups(conditions?: Conditions): EggGroup[]; + +export function allGenerations(conditions?: Conditions): Generation[]; + +export function allNatures(conditions?: Conditions): Nature[]; diff --git a/types/oakdex-pokedex/oakdex-pokedex-tests.ts b/types/oakdex-pokedex/oakdex-pokedex-tests.ts new file mode 100644 index 0000000000..670c348cbb --- /dev/null +++ b/types/oakdex-pokedex/oakdex-pokedex-tests.ts @@ -0,0 +1,492 @@ +import { + Pokemon, + Move, + Ability, + PokemonType, + Region, + EggGroup, + Generation, + Nature, + Item +} from 'oakdex-pokedex'; + +// Pokemon +() => { + const pikachu: Pokemon = { + names: { + fr: 'Pikachu', + de: 'Pikachu', + it: 'Pikachu', + en: 'Pikachu' + }, + national_id: 25, + types: [ + 'Electric' + ], + abilities: [ + { + name: 'Static' + }, + { + name: 'Lightning Rod', + hidden: true + } + ], + gender_ratios: { + male: 50, + female: 50 + }, + catch_rate: 190, + egg_groups: [ + 'Field', + 'Fairy' + ], + hatch_time: [ + 5355, + 5609 + ], + height_us: '1\'04"', + height_eu: '0.4 m', + weight_us: '13.2 lbs.', + weight_eu: '6.0 kg', + base_exp_yield: 105, + leveling_rate: 'Medium Fast', + ev_yield: { + hp: 0, + atk: 0, + def: 0, + sp_atk: 0, + sp_def: 0, + speed: 2 + }, + color: 'Yellow', + base_friendship: 70, + base_stats: { + hp: 35, + atk: 55, + def: 30, + sp_atk: 50, + sp_def: 40, + speed: 90 + }, + evolutions: [ + { + to: 'Raichu', + item: 'Thunderstone' + } + ], + evolution_from: 'Pichu', + alola_id: 25, + categories: { + en: 'Mouse Pokémon', + de: 'Maus' + }, + kanto_id: 25, + johto_id: 22, + hoenn_id: 163, + sinnoh_id: 104, + unova_id: null, + kalos_id: 36, + mega_evolutions: [], + variations: [ + { + names: { + fr: 'Pikachu (Pokémon partenaire)', + de: 'Pikachu (Partner-Pokémon)', + it: 'Pikachu (Pokémon compagno)', + en: 'Pikachu (Partner Pokémon)' + }, + types: [ + 'Electric' + ], + base_stats: { + hp: 45, + atk: 80, + def: 50, + sp_atk: 75, + sp_def: 60, + speed: 120 + } + } + ], + pokedex_entries: { + Red: { + en: 'When several of these Pokémon gather, their electricity could build and cause lightning storms.', + de: 'Wenn sich mehrere dieser Pokémon versammeln, kann ihre Energie Blitzgewitter erzeugen.' + }, + Blue: { + en: 'When several of these Pokémon gather, their electricity could build and cause lightning storms.', + de: 'Wenn sich mehrere dieser Pokémon versammeln, kann ihre Energie Blitzgewitter erzeugen.' + } + }, + pokeathlon_stats: { + speed: [ + 3, + 4 + ], + power: [ + 3, + 4 + ], + stamina: [ + 3, + 4 + ], + skill: [ + 3, + 4 + ], + jump: [ + 3, + 4 + ] + }, + ultra_alola_id: 32, + move_learnsets: [ + { + games: [ + 'Red', + 'Blue' + ], + learnset: [ + { + move: 'Growl', + level: 1 + }, + { + move: 'Thunder Shock', + level: 1 + }, + { + move: 'Thunder Wave', + level: 9 + }, + { + move: 'Quick Attack', + level: 16 + }, + { + move: 'Swift', + level: 26 + }, + { + move: 'Agility', + level: 33 + }, + { + move: 'Thunder', + level: 43 + }, + { + move: 'Flash', + tm: 'HM5' + }, + { + move: 'Mega Punch', + tm: 'TM1' + }, + { + move: 'Mega Kick', + tm: 'TM5' + }, + { + move: 'Toxic', + egg_move: true + } + ] + } + ] + }; +}; + +// Move +() => { + const tackle: Move = { + index_number: 33, + pp: 35, + max_pp: 56, + power: 50, + accuracy: 100, + category: 'physical', + priority: 0, + target: 'target_adjacent_single', + critical_hit: 0, + makes_contact: true, + affected_by_protect: true, + affected_by_magic_coat: false, + affected_by_snatch: false, + affected_by_mirror_move: false, + affected_by_kings_rock: true, + names: { + cz: 'Nárazový útok', + dk: 'Tackling', + fr: 'Charge', + de: 'Tackle', + gr: 'Εφόρμηση', + en: 'Tackle' + }, + type: 'Normal', + contests: [ + { + contest: 'Contests', + appeal: 4, + jam: 0, + condition: 'Tough' + }, + { + contest: 'Super Contests', + appeal: 3, + jam: 0, + condition: 'Tough' + }, + { + contest: 'Contest Spectaculars', + appeal: 4, + jam: 0, + condition: 'Tough' + } + ], + pokedex_entries: { + Gold: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + }, + Silver: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + }, + Crystal: { + en: 'A full-body charge attack.', + de: 'Attacke mit vollem Körpereinsatz.' + } + } + }; +}; + +// Ability +() => { + const airLock: Ability = { + index_number: 76, + names: { + fr: 'Air Lock', + de: 'Klimaschutz', + it: 'Riparo', + en: 'Air Lock' + }, + descriptions: { + en: 'Eliminates the effects of weather.', + de: 'Example' + } + }; +}; + +// EggGroup +() => { + const bug: EggGroup = { + names: { + en: 'Bug', + jp: 'むし (虫) Mushi', + fr: 'Insecte', + de: 'Käfer', + it: 'Coleottero', + es: 'Bicho' + } + }; +}; + +// Generation +() => { + const gen1: Generation = { + number: 1, + dex_name: 'kanto_id', + names: { + en: 'Generation I', + de: 'Generation I' + }, + games: [ + { + en: 'Red', + de: 'Rot' + }, + { + en: 'Blue', + de: 'Blau' + }, + { + en: 'Yellow', + de: 'Gelb' + } + ] + }; +}; + +// Item +() => { + const potion: Item = { + names: { + en: 'Potion', + de: 'Trank', + fr: 'Potion', + es: 'Poción', + it: 'Pozione' + }, + category: 'Potions', + descriptions: [ + { + games: [ + 'Gold', + 'Silver', + 'Crystal' + ], + translations: { + en: 'Restores Pokémon HP by 20.', + de: 'Füllt die KP um 20 auf.' + } + } + ], + prices: [ + { + games: [ + 'Red', + 'Blue', + 'Yellow' + ], + buying: 300, + selling: 150 + }, + { + games: [ + 'Sun', + 'Moon', + 'Ultra Sun', + 'Ultra Moon' + ], + buying: 200, + selling: 100 + } + ], + pockets: [ + { + generations: [ + 1, + 2, + 3 + ], + pocket: 'Items' + }, + { + generations: [ + 4, + 5, + 6, + 7 + ], + pocket: 'Medicine' + } + ], + fling_power: 30, + effects: [ + { + condition: 'Always', + target: 'Single Pokemon', + pokemon_changes: [ + { + field: 'current_hp', + change_by: 20 + } + ] + } + ] + }; +}; + +// Nature +() => { + const bold: Nature = { + names: { + en: 'Bold', + de: 'Kühn' + }, + increased_stat: 'def', + decreased_stat: 'atk', + favorite_flavor: 'Sour', + disliked_flavor: 'Spicy' + }; +}; + +// PokemonType +() => { + const dragon: PokemonType = { + names: { + dk: 'Drage', + fr: 'Dragon', + de: 'Drache', + gr: 'Δράκου Drakou', + it: 'Drago', + pl: 'SmokSmoczy', + en: 'Dragon' + }, + effectivness: { + Normal: 1, + Fighting: 1, + Flying: 1, + Poison: 1, + Ground: 1, + Rock: 1, + Bug: 1, + Ghost: 1, + Steel: 0.5, + Fire: 1, + Water: 1, + Grass: 1, + Electric: 1, + Psychic: 1, + Ice: 1, + Dragon: 2, + Dark: 1, + Fairy: 0 + }, + color: '#6F35FC' + }; +}; + +// Region +() => { + const alola: Region = { + names: { + en: 'Alola', + fr: 'Alola', + es: 'Alola', + de: 'Alola', + it: 'Alola' + }, + locations: [ + { + names: { + en: 'Route 1', + fr: 'Abords d\'Ekaeka', + es: 'Afueras de Hauoli', + de: 'Hauholi-Stadtrand', + it: 'Periferia di Hau\'oli' + }, + pokemon: [ + { + pokemon: 'Pikipek', + location: 'Walking', + min_level: 2, + max_level: 3, + rarity: 'common', + games: [ + 'Sun', + 'Moon' + ], + day_times: [ + 'day', + 'night' + ] + } + ] + } + ] + }; +}; diff --git a/types/filenamify-url/tsconfig.json b/types/oakdex-pokedex/tsconfig.json similarity index 93% rename from types/filenamify-url/tsconfig.json rename to types/oakdex-pokedex/tsconfig.json index dd7225304e..0934229423 100644 --- a/types/filenamify-url/tsconfig.json +++ b/types/oakdex-pokedex/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "filenamify-url-tests.ts" + "oakdex-pokedex-tests.ts" ] } diff --git a/types/env-paths/tslint.json b/types/oakdex-pokedex/tslint.json similarity index 100% rename from types/env-paths/tslint.json rename to types/oakdex-pokedex/tslint.json diff --git a/types/oauth.js/tslint.json b/types/oauth.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/oauth.js/tslint.json +++ b/types/oauth.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/object-assign/tslint.json b/types/object-assign/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/object-assign/tslint.json +++ b/types/object-assign/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/object-diff/tslint.json b/types/object-diff/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/object-diff/tslint.json +++ b/types/object-diff/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/object-hash/tslint.json b/types/object-hash/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/object-hash/tslint.json +++ b/types/object-hash/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/object-refs/tslint.json b/types/object-refs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/object-refs/tslint.json +++ b/types/object-refs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/oblo-util/tslint.json b/types/oblo-util/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/oblo-util/tslint.json +++ b/types/oblo-util/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/oboe/tslint.json b/types/oboe/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/oboe/tslint.json +++ b/types/oboe/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/observe-js/tslint.json b/types/observe-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/observe-js/tslint.json +++ b/types/observe-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/oclazyload/tslint.json b/types/oclazyload/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/oclazyload/tslint.json +++ b/types/oclazyload/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/odata/tslint.json b/types/odata/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/odata/tslint.json +++ b/types/odata/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/office-js-preview/index.d.ts b/types/office-js-preview/index.d.ts index b55d2cbb42..abda90c0fe 100644 --- a/types/office-js-preview/index.d.ts +++ b/types/office-js-preview/index.d.ts @@ -660,6 +660,12 @@ declare namespace Office { *
HostsAccess, Excel, Outlook, PowerPoint, Project, Word
*/ interface Context { + /** + * Provides information and access to the signed-in user. + * + * @beta + */ + auth: Auth; /** * True, if the current platform allows the add-in to display a UI for selling or upgrading; otherwise returns False. * @@ -962,11 +968,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3)
PowerPoint Y Y Y
Word Y Y Y
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3: without `options` parameter;
Mailbox Preview: adds support for `options` parameter)
PowerPoint Y Y Y
Word Y Y Y
* * @param options Optional. An object literal that contains one or more of the following properties. @@ -974,7 +980,7 @@ declare namespace Office { * this value indicates of the handled event should continue execution or be canceled. * For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. */ - completed(options?: any): void; + completed(options?: { allowEvent: boolean }): void; } /** @@ -1263,6 +1269,84 @@ declare namespace Office { */ asyncContext?: any } + + /** + * The Office Auth namespace, Office.context.auth, provides a method that allows the Office host to obtain an access token to the add-in's web application. + * Indirectly, this also enables the add-in to access the signed-in user's Microsoft Graph data without requiring the user to sign in a second time. + * + * @beta + */ + interface Auth { + /** + * Calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Enables add-ins to identify users. + * Server side code can use this token to access Microsoft Graph for the add-in's web application by using the + * {@link https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols-oauth-on-behalf-of | "on behalf of" OAuth flow}. + * + * Important: In Outlook, this API is not supported if the add-in is loaded in an Outlook.com or Gmail mailbox. + * + * @remarks + * + * + *
HostsExcel, OneNote, Outlook, PowerPoint, Word
Requirement sets{@link https://docs.microsoft.com/office/dev/add-ins/develop/specify-office-hosts-and-api-requirements | IdentityAPI}
+ * + * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational + * Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. + * + * @param options - Optional. Accepts an AuthOptions object to define sign-on behaviors. + * @param callback - Optional. Accepts a callback method that can use parse the token for the user's ID or use the token in the "on behalf of" flow to get access to Microsoft Graph. + * If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * + * @beta + */ + getAccessTokenAsync(options?: AuthOptions, callback?: (result: AsyncResult) => void): void; + /** + * Calls the Azure Active Directory V 2.0 endpoint to get an access token to your add-in's web application. Enables add-ins to identify users. + * Server side code can use this token to access Microsoft Graph for the add-in's web application by using the + * {@link https://docs.microsoft.com/azure/active-directory/develop/active-directory-v2-protocols-oauth-on-behalf-of | "on behalf of" OAuth flow}. + * + * Important: In Outlook, this API is not supported if the add-in is loaded in an Outlook.com or Gmail mailbox. + * + * @remarks + * + * + *
HostsExcel, OneNote, Outlook, PowerPoint, Word
Requirement sets{@link https://docs.microsoft.com/office/dev/add-ins/develop/specify-office-hosts-and-api-requirements | IdentityAPI}
+ * + * This API requires a single sign-on configuration that bridges the add-in to an Azure application. Office users sign-in with Organizational + * Accounts and Microsoft Accounts. Microsoft Azure returns tokens intended for both user account types to access resources in the Microsoft Graph. + * + * @param callback - Optional. Accepts a callback method that can use parse the token for the user's ID or use the token in the "on behalf of" flow to get access to Microsoft Graph. + * If AsyncResult.status is "succeeded", then AsyncResult.value is the raw AAD v. 2.0-formatted access token. + * + * @beta + */ + getAccessTokenAsync(callback?: (result: AsyncResult) => void): void; + } + /** + * Provides options for the user experience when Office obtains an access token to the add-in from AAD v. 2.0 with the getAccessTokenAsync method. + */ + interface AuthOptions { + /** + * Causes Office to display the add-in consent experience. Useful if the add-in's Azure permissions have changed or if the user's consent has + * been revoked. + */ + forceConsent?: boolean, + /** + * Prompts the user to add their Office account (or to switch to it, if it is already added). + */ + forceAddAccount?: boolean, + /** + * Causes Office to prompt the user to provide the additional factor when the tenancy being targeted by Microsoft Graph requires multifactor + * authentication. The string value identifies the type of additional factor that is required. In most cases, you won't know at development + * time whether the user's tenant requires an additional factor or what the string should be. So this option would be used in a "second try" + * call of getAccessTokenAsync after Microsoft Graph has sent an error requesting the additional factor and containing the string that should + * be used with the authChallenge option. + */ + authChallenge?: string + /** + * A user-defined item of any type that is returned, unchanged, in the asyncContext property of the AsyncResult object that is passed to a callback. + */ + asyncContext?: any + } /** * Provides an option for preserving context data of any type, unchanged, for use in a callback. */ @@ -1633,7 +1717,7 @@ declare namespace Office { */ controlBackgroundColor: string; /** - * Gets the Office theme body control color as a hexadecimal color triplet (e.g. "FFA500"). + * Gets the Office theme control foreground color as a hexadecimal color triplet (e.g. "FFA500"). */ controlForegroundColor: string; } @@ -4720,7 +4804,9 @@ declare namespace Office { * In Excel, if you specify formulas in the TableData object you pass for the data parameter, you might not get the results you expect due to * the "calculated columns" feature of Excel, which automatically duplicates formulas within a column. To work around this when you want to * write `data` that contains formulas to a selected table, try specifying the data as an array of arrays (instead of a TableData object), and - * specify the coercionType as Microsoft.Office.Matrix or "matrix". + * specify the coercionType as Microsoft.Office.Matrix or "matrix". However, this technique will block the "calculated columns" feature only + * when one of the following conditions is met: (1) you are writing to all the cells of the column, or (2) there are already at least two + * different formulas in the column. * * @param options Provides options for how to insert data to the selection. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. @@ -4904,7 +4990,9 @@ declare namespace Office { * In Excel, if you specify formulas in the TableData object you pass for the data parameter, you might not get the results you expect due to * the "calculated columns" feature of Excel, which automatically duplicates formulas within a column. To work around this when you want to * write `data` that contains formulas to a selected table, try specifying the data as an array of arrays (instead of a TableData object), and - * specify the coercionType as Microsoft.Office.Matrix or "matrix". + * specify the coercionType as Microsoft.Office.Matrix or "matrix". However, this technique will block the "calculated columns" feature only + * when one of the following conditions is met: (1) you are writing to all the cells of the column, or (2) there are already at least two + * different formulas in the column. * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. * The AsyncResult.value property always returns undefined because there is no object or data to retrieve. @@ -10751,6 +10839,12 @@ declare namespace Office { * Gets the size of the attachment in bytes. */ size: number; + /** + * Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`. + * + * [Api set: Mailbox Preview] + */ + url: string; } /** * The body object provides methods for adding and updating the content of the message or appointment. @@ -18893,7 +18987,6 @@ declare namespace Excel { address?: boolean; addressLocal?: boolean; format?: Excel.CellPropertiesFormatLoadOptions; - hasSpill?: boolean; hidden?: boolean; hyperlink?: boolean; style?: boolean; @@ -18941,7 +19034,6 @@ declare namespace Excel { interface CellProperties extends SettableCellProperties { address?: string; addressLocal?: string; - hasSpill?: boolean; hidden?: boolean; } /** Represents the input parameter of setRowProperties. */ @@ -18956,7 +19048,6 @@ declare namespace Excel { rowIndex?: number; address?: string; addressLocal?: string; - hasSpill?: boolean; } /** Represents the input parameter of setColumnProperties. */ interface SettableColumnProperties extends SettableCellProperties { @@ -18970,7 +19061,6 @@ declare namespace Excel { columnIndex?: number; address?: string; addressLocal?: string; - hasSpill?: boolean; } /** Represents the returned format properties of getCellProperties or format input parameter of setCellProperties. */ interface CellPropertiesFormat { @@ -19322,7 +19412,7 @@ declare namespace Excel { } /** * - * Provides information about the workbook AutoSave setting changed event. + * Provides information about the workbook's onAutoSaveSettingChanged event. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -20052,7 +20142,7 @@ declare namespace Excel { interface ShapeActivatedEventArgs { /** * - * Gets the id of the shape that is activated. + * Gets the id of the activated shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -20085,7 +20175,7 @@ declare namespace Excel { interface ShapeDeactivatedEventArgs { /** * - * Gets the id of the shape that is deactivated. + * Gets the id of the shape deactivated shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -20415,6 +20505,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly names: Excel.NamedItemCollection; + /** + * + * Represents a collection of PivotTableStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly pivotTableStyles: Excel.PivotTableStyleCollection; /** * * Represents a collection of PivotTables associated with the workbook. Read-only. @@ -20443,6 +20541,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.4] */ readonly settings: Excel.SettingCollection; + /** + * + * Represents a collection of SlicerStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly slicerStyles: Excel.SlicerStyleCollection; /** * * Represents a collection of Slicers associated with the workbook. Read-only. @@ -20458,6 +20564,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.7] */ readonly styles: Excel.StyleCollection; + /** + * + * Represents a collection of TableStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly tableStyles: Excel.TableStyleCollection; /** * * Represents a collection of tables associated with the workbook. Read-only. @@ -20465,6 +20579,14 @@ declare namespace Excel { * [Api set: ExcelApi 1.1] */ readonly tables: Excel.TableCollection; + /** + * + * Represents a collection of TimelineStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly timelineStyles: Excel.TimelineStyleCollection; /** * * Represents a collection of worksheets associated with the workbook. Read-only. @@ -20474,7 +20596,7 @@ declare namespace Excel { readonly worksheets: Excel.WorksheetCollection; /** * - * True if the workbook is in auto save mode. + * Specifies whether or not the workbook is in autosave mode. Read-Only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -20499,8 +20621,8 @@ declare namespace Excel { chartDataPointTrack: boolean; /** * - * True if no changes have been made to the specified workbook since it was last saved. - You can set this property to True if you want to close a modified workbook without either saving it or being prompted to save it. + * Specifies whether or not changes have been made since the workbook was last saved. + You can set this property to true if you want to close a modified workbook without either saving it or being prompted to save it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -20515,7 +20637,7 @@ declare namespace Excel { readonly name: string; /** * - * True if the workbook has ever been saved locally or online. + * Specifies whether or not the workbook has ever been saved locally or online. Read-Only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -20683,7 +20805,7 @@ declare namespace Excel { }): Excel.Workbook; /** * - * Occurs when AutoSave setting is changed on the workbook. + * Occurs when the autoSave setting is changed on the workbook. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @@ -21047,7 +21169,7 @@ declare namespace Excel { copy(positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Excel.Worksheet): Excel.Worksheet; /** * - * Deletes the worksheet from the workbook. Note that if the worksheet's visibility is set to "VeryHidden", the delete operation will fail with a GeneralException. + * Deletes the worksheet from the workbook. * * [Api set: ExcelApi 1.1] */ @@ -21303,11 +21425,11 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param base64File Required. Base64 string representing the source workbook. - * @param sheetNamesToInsert Optional. The speified worksheet names to insert. By default it will insert all worksheets from the source workbook. - * @param positionType Optional. Insert position type, see Excel.WorksheetPositionType for details. Default is "Start". - * @param relativeTo Optional. The referencing worksheet object or worksheet name/id in the current workbook. Default is null and based on the postionType parameter it will insert worksheets at the start or end of the current workbook. - * @returns An array where each item represents the Id of the new inserted worksheet. + * @param base64File Required. The base64-encoded string representing the source workbook file. + * @param sheetNamesToInsert Optional. The names of individual worksheets to insert. By default, all the worksheets from the source workbook are inserted. + * @param positionType Optional. Where in the current workbook the new worksheets will be inserted. See Excel.WorksheetPositionType for details. Default is "Start". + * @param relativeTo Optional. The worksheet in the current workbook that is referenced for the positionType parameter. Default is null and, based on positionType, it will insert worksheets at the start or end of the current workbook. + * @returns An array of ids corresponding to each newly inserted worksheet. */ addFromBase64(base64File: string, sheetNamesToInsert?: string[], positionType?: Excel.WorksheetPositionType, relativeTo?: Worksheet | string): OfficeExtension.ClientResult; /** @@ -21316,11 +21438,11 @@ declare namespace Excel { * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * - * @param base64File Required. Base64 string representing the source workbook. - * @param sheetNamesToInsert Optional. The speified worksheet names to insert. By default it will insert all worksheets from the source workbook. - * @param positionType Optional. Insert position type, see Excel.WorksheetPositionType for details. Default is "Start". - * @param relativeTo Optional. The referencing worksheet object or worksheet name/id in the current workbook. Default is null and based on the postionType parameter it will insert worksheets at the start or end of the current workbook. - * @returns An array where each item represents the Id of the new inserted worksheet. + * @param base64File Required. The base64-encoded string representing the source workbook file. + * @param sheetNamesToInsert Optional. The names of individual worksheets to insert. By default, all the worksheets from the source workbook are inserted. + * @param positionType Optional. Where in the current workbook the new worksheets will be inserted. See Excel.WorksheetPositionType for details. Default is "Start". + * @param relativeTo Optional. The worksheet in the current workbook that is referenced for the positionType parameter. Default is null and, based on positionType, it will insert worksheets at the start or end of the current workbook. + * @returns An array of ids corresponding to each newly inserted worksheet. */ addFromBase64(base64File: string, sheetNamesToInsert?: string[], positionType?: "None" | "Before" | "After" | "Beginning" | "End", relativeTo?: Worksheet | string): OfficeExtension.ClientResult; /** @@ -22104,7 +22226,7 @@ declare namespace Excel { findOrNullObject(text: string, criteria: Excel.SearchCriteria): Excel.Range; /** * - * Does FlashFill to current range. Flash Fill will automatically fills data when it senses a pattern, so the range must be single column range and have data around in order to find pattern. + * Does FlashFill to current range.Flash Fill will automatically fills data when it senses a pattern, so the range must be single column range and have data around in order to find pattern. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -22345,7 +22467,7 @@ declare namespace Excel { getSpecialCellsOrNullObject(cellType: "ConditionalFormats" | "DataValidations" | "Blanks" | "Constants" | "Formulas" | "SameConditionalFormat" | "SameDataValidation" | "Visible", cellValueType?: "All" | "Errors" | "ErrorsLogical" | "ErrorsNumbers" | "ErrorsText" | "ErrorsLogicalNumber" | "ErrorsLogicalText" | "ErrorsNumberText" | "Logical" | "LogicalNumbers" | "LogicalText" | "LogicalNumbersText" | "Numbers" | "NumbersText" | "Text"): Excel.RangeAreas; /** * - * Gets the range object containing the anchor cell for a cell getting spilled into. Fails if applied to a range with more than one cell. Read only. + * Gets the range object containing the anchor cell for a cell getting spilled into. Fails if applied to a range with more than one cell. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -22353,12 +22475,30 @@ declare namespace Excel { getSpillParent(): Excel.Range; /** * - * Gets the range object containing the spill range when called on an anchor cell. Fails if applied to a range with more than one cell. Read only. + * Gets the range object containing the anchor cell for a cell getting spilled into. Read-only. + If it is not a spill cell or more than once cells are give, a null object will be returned. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getSpillParentOrNullObject(): Excel.Range; + /** + * + * Gets the range object containing the spill range when called on an anchor cell. Fails if applied to a range with more than one cell. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ getSpillingToRange(): Excel.Range; + /** + * + * Gets the range object containing the spill range when called on an anchor cell. Read-only. + If the range is not an anchor cell or spill range can't be found, a null object will be returned. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getSpillingToRangeOrNullObject(): Excel.Range; /** * * Returns a Range object that represents the surrounding region for the top-left cell in this range. A surrounding region is a range bounded by any combination of blank rows and blank columns relative to this range. @@ -22467,7 +22607,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - setCellProperties(cellPropertiesData: SettableCellProperties[][]): void; + setCellProperties(cellPropertiesData: SettableCellProperties[][] | OfficeExtension.ClientResult): void; /** * * Updates the range based on a single-dimensional array of column properties, encapsulating things like font, fill, borders, alignment, and so forth. @@ -22475,7 +22615,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - setColumnProperties(columnPropertiesData: SettableColumnProperties[]): void; + setColumnProperties(columnPropertiesData: SettableColumnProperties[] | OfficeExtension.ClientResult): void; /** * * Set a range to be recalculated when the next recalculation occurs. @@ -22491,7 +22631,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - setRowProperties(rowPropertiesData: SettableRowProperties[]): void; + setRowProperties(rowPropertiesData: SettableRowProperties[] | OfficeExtension.ClientResult): void; /** * * Displays the card for an active cell if it has rich value content. @@ -35318,6 +35458,730 @@ declare namespace Excel { */ toJSON(): Excel.Interfaces.StyleCollectionData; } + /** + * + * Represents a collection of TableStyles. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class TableStyleCollection extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** Gets the loaded child items in this collection. */ + readonly items: Excel.TableStyle[]; + /** + * + * Creates a blank TableStyle with the specified name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name The unique name for the new TableStyle. Will throw an invalid argument exception if the name is already in use. + * @param makeUniqueName Optional, defaults to false. If true, will append numbers to the name in order to make it unique, if needed. + * @returns The newly created TableStyle. + */ + add(name: string, makeUniqueName?: boolean): Excel.TableStyle; + /** + * + * Gets the number of table styles in the collection. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets the default TableStyle for the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The TableStyle object that is the current default TableStyle. + */ + getDefault(): Excel.TableStyle; + /** + * + * Gets a TableStyle by name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the TableStyle to be retrieved. + * @returns The TableStyle object whose name matches the input. + */ + getItem(name: string): Excel.TableStyle; + /** + * + * Gets a TableStyle by name. If the TableStyle does not exist, will return a null object. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the TableStyle to be retrieved. + * @returns The TableStyle object whose name matches the input. + */ + getItemOrNullObject(name: string): Excel.TableStyle; + /** + * + * Sets the default TableStyle for use in the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param newDefaultStyle The TableStyle object or name of the TableStyle object that should be the new default. + */ + setDefault(newDefaultStyle: TableStyle | string): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.TableStyleCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.TableStyleCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.TableStyleCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.TableStyleCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.TableStyleCollection; + load(option?: string | string[]): Excel.TableStyleCollection; + load(option?: OfficeExtension.LoadOption): Excel.TableStyleCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Excel.TableStyleCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.TableStyleCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ + toJSON(): Excel.Interfaces.TableStyleCollectionData; + } + /** + * + * Represents a TableStyle, which defines the style elements by region of the Table. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class TableStyle extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** + * + * Gets the name of the TableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name: string; + /** + * + * True means that this TableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly readOnly: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.TableStyle): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.TableStyleUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.TableStyle): void; + /** + * + * Deletes the TableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + delete(): void; + /** + * + * Creates a duplicate of this TableStyle with copies of all the style elements. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The new TableStyle object that has been duplicated from this TableStyle. + */ + duplicate(): Excel.TableStyle; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.TableStyle` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.TableStyle` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.TableStyle` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.TableStyleLoadOptions): Excel.TableStyle; + load(option?: string | string[]): Excel.TableStyle; + load(option?: { + select?: string; + expand?: string; + }): Excel.TableStyle; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Excel.TableStyle object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.TableStyleData`) that contains shallow copies of any loaded child properties from the original object. + */ + toJSON(): Excel.Interfaces.TableStyleData; + } + /** + * + * Represents a collection of PivotTable styles. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class PivotTableStyleCollection extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** Gets the loaded child items in this collection. */ + readonly items: Excel.PivotTableStyle[]; + /** + * + * Creates a blank PivotTableStyle with the specified name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name The unique name for the new PivotTableStyle. Will throw an invalid argument exception if the name is already in use. + * @param makeUniqueName Optional, defaults to false. If true, will append numbers to the name in order to make it unique, if needed. + * @returns The newly created PivotTableStyle. + */ + add(name: string, makeUniqueName?: boolean): Excel.PivotTableStyle; + /** + * + * Gets the number of PivotTable styles in the collection. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets the default PivotTableStyle for the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The PivotTableStyle object that is the current default PivotTableStyle. + */ + getDefault(): Excel.PivotTableStyle; + /** + * + * Gets a PivotTableStyle by name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the PivotTableStyle to be retrieved. + * @returns The PivotTableStyle object whose name matches the input. + */ + getItem(name: string): Excel.PivotTableStyle; + /** + * + * Gets a PivotTableStyle by name. If the PivotTableStyle does not exist, will return a null object. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the PivotTableStyle to be retrieved. + * @returns The PivotTableStyle object whose name matches the input. + */ + getItemOrNullObject(name: string): Excel.PivotTableStyle; + /** + * + * Sets the default PivotTableStyle for use in the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param newDefaultStyle The PivotTableStyle object or name of the PivotTableStyle object that should be the new default. + */ + setDefault(newDefaultStyle: PivotTableStyle | string): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotTableStyleCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotTableStyleCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotTableStyleCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotTableStyleCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.PivotTableStyleCollection; + load(option?: string | string[]): Excel.PivotTableStyleCollection; + load(option?: OfficeExtension.LoadOption): Excel.PivotTableStyleCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Excel.PivotTableStyleCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.PivotTableStyleCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ + toJSON(): Excel.Interfaces.PivotTableStyleCollectionData; + } + /** + * + * Represents a PivotTable Style, which defines style elements by PivotTable region. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class PivotTableStyle extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** + * + * Gets the name of the PivotTableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name: string; + /** + * + * True means that this PivotTableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly readOnly: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.PivotTableStyle): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.PivotTableStyleUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.PivotTableStyle): void; + /** + * + * Deletes the PivotTableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + delete(): void; + /** + * + * Creates a duplicate of this PivotTableStyle with copies of all the style elements. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The new PivotTableStyle object that has been duplicated from this PivotTableStyle. + */ + duplicate(): Excel.PivotTableStyle; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.PivotTableStyle` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.PivotTableStyle` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.PivotTableStyle` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.PivotTableStyleLoadOptions): Excel.PivotTableStyle; + load(option?: string | string[]): Excel.PivotTableStyle; + load(option?: { + select?: string; + expand?: string; + }): Excel.PivotTableStyle; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Excel.PivotTableStyle object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.PivotTableStyleData`) that contains shallow copies of any loaded child properties from the original object. + */ + toJSON(): Excel.Interfaces.PivotTableStyleData; + } + /** + * + * Represents a collection of SlicerStyle objects. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class SlicerStyleCollection extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** Gets the loaded child items in this collection. */ + readonly items: Excel.SlicerStyle[]; + /** + * + * Creates a blank SlicerStyle with the specified name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name The unique name for the new SlicerStyle. Will throw an invalid argument exception if the name is already in use. + * @param makeUniqueName Optional, defaults to false. If true, will append numbers to the name in order to make it unique, if needed. + * @returns The newly created SlicerStyle. + */ + add(name: string, makeUniqueName?: boolean): Excel.SlicerStyle; + /** + * + * Gets the number of slicer styles in the collection. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets the default SlicerStyle for the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The SlicerStyle object that is the current default SlicerStyle. + */ + getDefault(): Excel.SlicerStyle; + /** + * + * Gets a SlicerStyle by name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the SlicerStyle to be retrieved. + * @returns The SlicerStyle object whose name matches the input. + */ + getItem(name: string): Excel.SlicerStyle; + /** + * + * Gets a SlicerStyle by name. If the SlicerStyle does not exist, will return a null object. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the SlicerStyle to be retrieved. + * @returns The SlicerStyle object whose name matches the input. + */ + getItemOrNullObject(name: string): Excel.SlicerStyle; + /** + * + * Sets the default SlicerStyle for use in the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param newDefaultStyle The SlicerStyle object or name of the SlicerStyle object that should be the new default. + */ + setDefault(newDefaultStyle: SlicerStyle | string): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.SlicerStyleCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.SlicerStyleCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.SlicerStyleCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.SlicerStyleCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.SlicerStyleCollection; + load(option?: string | string[]): Excel.SlicerStyleCollection; + load(option?: OfficeExtension.LoadOption): Excel.SlicerStyleCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Excel.SlicerStyleCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.SlicerStyleCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ + toJSON(): Excel.Interfaces.SlicerStyleCollectionData; + } + /** + * + * Represents a Slicer Style, which defines style elements by region of the slicer. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class SlicerStyle extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** + * + * Gets the name of the SlicerStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name: string; + /** + * + * True means that this SlicerStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly readOnly: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.SlicerStyle): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.SlicerStyleUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.SlicerStyle): void; + /** + * + * Deletes the SlicerStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + delete(): void; + /** + * + * Creates a duplicate of this SlicerStyle with copies of all the style elements. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The new SlicerStyle object that has been duplicated from this SlicerStyle. + */ + duplicate(): Excel.SlicerStyle; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.SlicerStyle` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.SlicerStyle` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.SlicerStyle` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.SlicerStyleLoadOptions): Excel.SlicerStyle; + load(option?: string | string[]): Excel.SlicerStyle; + load(option?: { + select?: string; + expand?: string; + }): Excel.SlicerStyle; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Excel.SlicerStyle object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.SlicerStyleData`) that contains shallow copies of any loaded child properties from the original object. + */ + toJSON(): Excel.Interfaces.SlicerStyleData; + } + /** + * + * Represents a collection of TimelineStyles. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class TimelineStyleCollection extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** Gets the loaded child items in this collection. */ + readonly items: Excel.TimelineStyle[]; + /** + * + * Creates a blank TimelineStyle with the specified name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name The unique name for the new TimelineStyle. Will throw an invalid argument exception if the name is already in use. + * @param makeUniqueName Optional, defaults to false. If true, will append numbers to the name in order to make it unique, if needed. + * @returns The newly created TimelineStyle. + */ + add(name: string, makeUniqueName?: boolean): Excel.TimelineStyle; + /** + * + * Gets the number of timeline styles in the collection. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getCount(): OfficeExtension.ClientResult; + /** + * + * Gets the default TimelineStyle for the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The TimelineStyle object that is the current default TimelineStyle. + */ + getDefault(): Excel.TimelineStyle; + /** + * + * Gets a TimelineStyle by name. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the TimelineStyle to be retrieved. + * @returns The TimelineStyle object whose name matches the input. + */ + getItem(name: string): Excel.TimelineStyle; + /** + * + * Gets a TimelineStyle by name. If the TimelineStyle does not exist, will return a null object. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param name Name of the TimelineStyle to be retrieved. + * @returns The TimelineStyle object whose name matches the input. + */ + getItemOrNullObject(name: string): Excel.TimelineStyle; + /** + * + * Sets the default TimelineStyle for use in the parent object's scope. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param newDefaultStyle The TimelineStyle object or name of the TimelineStyle object that should be the new default. + */ + setDefault(newDefaultStyle: TimelineStyle | string): void; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.TimelineStyleCollection` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.TimelineStyleCollection` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.TimelineStyleCollection` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.TimelineStyleCollectionLoadOptions & Excel.Interfaces.CollectionLoadOptions): Excel.TimelineStyleCollection; + load(option?: string | string[]): Excel.TimelineStyleCollection; + load(option?: OfficeExtension.LoadOption): Excel.TimelineStyleCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Excel.TimelineStyleCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.TimelineStyleCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ + toJSON(): Excel.Interfaces.TimelineStyleCollectionData; + } + /** + * + * Represents a Timeline style, which defines style elements by region in the Timeline. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + class TimelineStyle extends OfficeExtension.ClientObject { + /** The request context associated with the object. This connects the add-in's process to the Office host application's process. */ + context: RequestContext; + /** + * + * Gets the name of the TimelineStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name: string; + /** + * + * True means that this TimelineStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly readOnly: boolean; + /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. + * + * @remarks + * + * This method has the following additional signature: + * + * `set(properties: Excel.TimelineStyle): void` + * + * @param properties A JavaScript object with properties that are structured isomorphically to the properties of the object on which the method is called. + * @param options Provides an option to suppress errors if the properties object tries to set any read-only properties. + */ + set(properties: Interfaces.TimelineStyleUpdateData, options?: OfficeExtension.UpdateOptions): void; + /** Sets multiple properties on the object at the same time, based on an existing loaded object. */ + set(properties: Excel.TimelineStyle): void; + /** + * + * Deletes the TableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + delete(): void; + /** + * + * Creates a duplicate of this TimelineStyle with copies of all the style elements. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * @returns The new TimelineStyle object that has been duplicated from this TimelineStyle. + */ + duplicate(): Excel.TimelineStyle; + /** + * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. + * + * @remarks + * + * In addition to this signature, this method has the following signatures: + * + * `load(option?: string | string[]): Excel.TimelineStyle` - Where option is a comma-delimited string or an array of strings that specify the properties to load. + * + * `load(option?: { select?: string; expand?: string; }): Excel.TimelineStyle` - Where option.select is a comma-delimited string that specifies the properties to load, and options.expand is a comma-delimited string that specifies the navigation properties to load. + * + * `load(option?: { select?: string; expand?: string; top?: number; skip?: number }): Excel.TimelineStyle` - Only available on collection types. It is similar to the preceding signature. Option.top specifies the maximum number of collection items that can be included in the result. Option.skip specifies the number of items that are to be skipped and not included in the result. If option.top is specified, the result set will start after skipping the specified number of items. + * + * @param options Provides options for which properties of the object to load. + */ + load(option?: Excel.Interfaces.TimelineStyleLoadOptions): Excel.TimelineStyle; + load(option?: string | string[]): Excel.TimelineStyle; + load(option?: { + select?: string; + expand?: string; + }): Excel.TimelineStyle; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Excel.TimelineStyle object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Excel.Interfaces.TimelineStyleData`) that contains shallow copies of any loaded child properties from the original object. + */ + toJSON(): Excel.Interfaces.TimelineStyleData; + } /** * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -35960,7 +36824,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - getStartCell(): Excel.Range; + getCellAfterBreak(): Excel.Range; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -36260,12 +37124,36 @@ declare namespace Excel { readonly replies: Excel.CommentReplyCollection; /** * - * Get/Set the content. + * Get author email of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly authorEmail: string; + /** + * + * Get author name of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly authorName: string; + /** + * + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content: string; + /** + * + * Get creation time of the comment. Will return null if the comment is converted from note, as in this case, the comment will not has created date. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly creationDate: Date; /** * * Represents the comment identifier. Read-only. @@ -36304,6 +37192,14 @@ declare namespace Excel { * @beta */ delete(): void; + /** + * + * Get location of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getLocation(): Excel.Range; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -36429,12 +37325,36 @@ declare namespace Excel { context: RequestContext; /** * - * Get/Set the content. + * Get author email of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly authorEmail: string; + /** + * + * Get author name of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly authorName: string; + /** + * + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content: string; + /** + * + * Get creation time of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readonly creationDate: Date; /** * * Represents the comment reply identifier. Read-only. @@ -36473,6 +37393,14 @@ declare namespace Excel { * @beta */ delete(): void; + /** + * + * Get location of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + getLocation(): Excel.Range; /** * * Get its parent comment of this reply. @@ -36510,7 +37438,7 @@ declare namespace Excel { } /** * - * Represents all the shapes in the worksheet. + * Represents a collection of all the shapes in the worksheet. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36522,27 +37450,27 @@ declare namespace Excel { readonly items: Excel.Shape[]; /** * - * Adds a geometric shape to worksheet. Returns a Shape object that represents the new shape. + * Adds a geometric shape to the worksheet. Returns a Shape object that represents the new shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param geometricShapeType Represents the geometric type of the shape. See Excel.GeometricShapeType for details. + * @param geometricShapeType Represents the type of the geometric shape. See Excel.GeometricShapeType for details. */ addGeometricShape(geometricShapeType: Excel.GeometricShapeType): Excel.Shape; /** * - * Adds a geometric shape to worksheet. Returns a Shape object that represents the new shape. + * Adds a geometric shape to the worksheet. Returns a Shape object that represents the new shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param geometricShapeType Represents the geometric type of the shape. See Excel.GeometricShapeType for details. + * @param geometricShapeType Represents the type of the geometric shape. See Excel.GeometricShapeType for details. */ addGeometricShape(geometricShapeType: "LineInverse" | "Triangle" | "RightTriangle" | "Rectangle" | "Diamond" | "Parallelogram" | "Trapezoid" | "NonIsoscelesTrapezoid" | "Pentagon" | "Hexagon" | "Heptagon" | "Octagon" | "Decagon" | "Dodecagon" | "Star4" | "Star5" | "Star6" | "Star7" | "Star8" | "Star10" | "Star12" | "Star16" | "Star24" | "Star32" | "RoundRectangle" | "Round1Rectangle" | "Round2SameRectangle" | "Round2DiagonalRectangle" | "SnipRoundRectangle" | "Snip1Rectangle" | "Snip2SameRectangle" | "Snip2DiagonalRectangle" | "Plaque" | "Ellipse" | "Teardrop" | "HomePlate" | "Chevron" | "PieWedge" | "Pie" | "BlockArc" | "Donut" | "NoSmoking" | "RightArrow" | "LeftArrow" | "UpArrow" | "DownArrow" | "StripedRightArrow" | "NotchedRightArrow" | "BentUpArrow" | "LeftRightArrow" | "UpDownArrow" | "LeftUpArrow" | "LeftRightUpArrow" | "QuadArrow" | "LeftArrowCallout" | "RightArrowCallout" | "UpArrowCallout" | "DownArrowCallout" | "LeftRightArrowCallout" | "UpDownArrowCallout" | "QuadArrowCallout" | "BentArrow" | "UturnArrow" | "CircularArrow" | "LeftCircularArrow" | "LeftRightCircularArrow" | "CurvedRightArrow" | "CurvedLeftArrow" | "CurvedUpArrow" | "CurvedDownArrow" | "SwooshArrow" | "Cube" | "Can" | "LightningBolt" | "Heart" | "Sun" | "Moon" | "SmileyFace" | "IrregularSeal1" | "IrregularSeal2" | "FoldedCorner" | "Bevel" | "Frame" | "HalfFrame" | "Corner" | "DiagonalStripe" | "Chord" | "Arc" | "LeftBracket" | "RightBracket" | "LeftBrace" | "RightBrace" | "BracketPair" | "BracePair" | "Callout1" | "Callout2" | "Callout3" | "AccentCallout1" | "AccentCallout2" | "AccentCallout3" | "BorderCallout1" | "BorderCallout2" | "BorderCallout3" | "AccentBorderCallout1" | "AccentBorderCallout2" | "AccentBorderCallout3" | "WedgeRectCallout" | "WedgeRRectCallout" | "WedgeEllipseCallout" | "CloudCallout" | "Cloud" | "Ribbon" | "Ribbon2" | "EllipseRibbon" | "EllipseRibbon2" | "LeftRightRibbon" | "VerticalScroll" | "HorizontalScroll" | "Wave" | "DoubleWave" | "Plus" | "FlowChartProcess" | "FlowChartDecision" | "FlowChartInputOutput" | "FlowChartPredefinedProcess" | "FlowChartInternalStorage" | "FlowChartDocument" | "FlowChartMultidocument" | "FlowChartTerminator" | "FlowChartPreparation" | "FlowChartManualInput" | "FlowChartManualOperation" | "FlowChartConnector" | "FlowChartPunchedCard" | "FlowChartPunchedTape" | "FlowChartSummingJunction" | "FlowChartOr" | "FlowChartCollate" | "FlowChartSort" | "FlowChartExtract" | "FlowChartMerge" | "FlowChartOfflineStorage" | "FlowChartOnlineStorage" | "FlowChartMagneticTape" | "FlowChartMagneticDisk" | "FlowChartMagneticDrum" | "FlowChartDisplay" | "FlowChartDelay" | "FlowChartAlternateProcess" | "FlowChartOffpageConnector" | "ActionButtonBlank" | "ActionButtonHome" | "ActionButtonHelp" | "ActionButtonInformation" | "ActionButtonForwardNext" | "ActionButtonBackPrevious" | "ActionButtonEnd" | "ActionButtonBeginning" | "ActionButtonReturn" | "ActionButtonDocument" | "ActionButtonSound" | "ActionButtonMovie" | "Gear6" | "Gear9" | "Funnel" | "MathPlus" | "MathMinus" | "MathMultiply" | "MathDivide" | "MathEqual" | "MathNotEqual" | "CornerTabs" | "SquareTabs" | "PlaqueTabs" | "ChartX" | "ChartStar" | "ChartPlus"): Excel.Shape; /** * - * Group a subset of shapes in a worksheet. Returns a Shape object that represents the new group of shapes. + * Groups a subset of shapes in this collection's worksheet. Returns a Shape object that represents the new group of shapes. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36552,12 +37480,12 @@ declare namespace Excel { addGroup(values: Array): Excel.Shape; /** * - * Creates an image from a base64 string and adds it to worksheet. Returns the Shape object that represents the new Image. + * Creates an image from a base64-encoded string and adds it to the worksheet. Returns the Shape object that represents the new image. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param base64ImageString A base64 encoded image in JPEG or PNG formats. + * @param base64ImageString A base64-encoded string representing an image in either JPEG or PNG format. */ addImage(base64ImageString: string): Excel.Shape; /** @@ -36567,10 +37495,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param startLeft The distance, in points, from the start left of the line to the left side of the worksheet. - * @param startTop The distance, in points, from the start top of the line to the top of the worksheet. - * @param endLeft The distance, in points, from the end left of the line to the left of the worksheet. - * @param endTop The distance, in points, from the end top of the line to the top of the worksheet. + * @param startLeft The distance, in points, from the start of the line to the left side of the worksheet. + * @param startTop The distance, in points, from the start of the line to the top of the worksheet. + * @param endLeft The distance, in points, from the end of the line to the left of the worksheet. + * @param endTop The distance, in points, from the end of the line to the top of the worksheet. * @param connectorType Represents the connector type. See Excel.ConnectorType for details. */ addLine(startLeft: number, startTop: number, endLeft: number, endTop: number, connectorType?: Excel.ConnectorType): Excel.Shape; @@ -36581,26 +37509,26 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param startLeft The distance, in points, from the start left of the line to the left side of the worksheet. - * @param startTop The distance, in points, from the start top of the line to the top of the worksheet. - * @param endLeft The distance, in points, from the end left of the line to the left of the worksheet. - * @param endTop The distance, in points, from the end top of the line to the top of the worksheet. + * @param startLeft The distance, in points, from the start of the line to the left side of the worksheet. + * @param startTop The distance, in points, from the start of the line to the top of the worksheet. + * @param endLeft The distance, in points, from the end of the line to the left of the worksheet. + * @param endTop The distance, in points, from the end of the line to the top of the worksheet. * @param connectorType Represents the connector type. See Excel.ConnectorType for details. */ addLine(startLeft: number, startTop: number, endLeft: number, endTop: number, connectorType?: "Straight" | "Elbow" | "Curve"): Excel.Shape; /** * - * Creates an SVG from a XML string and adds it to worksheet. Returns a Shape object that represents the new Image. + * Creates a scalable vector graphic (SVG) from an XML string and adds it to the worksheet. Returns a Shape object that represents the new image. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param xmlImageString An XML string that represents an SVG. + * @param xml An XML string that represents the SVG. */ - addSVG(xmlImageString: string): Excel.Shape; + addSvg(xml: string): Excel.Shape; /** * - * Adds a textbox to worksheet by telling it's text content. Returns a Shape object that represents the new text box. + * Adds a text box to the worksheet with the provided text as the content. Returns a Shape object that represents the new text box. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36628,12 +37556,12 @@ declare namespace Excel { getItem(name: string): Excel.Shape; /** * - * Gets a shape based on its position in the collection. + * Gets a shape using its position in the collection. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param index Index value of the object to be retrieved. Zero-indexed. + * @param index The zero-based index of the shape to be retrieved. */ getItemAt(index: number): Excel.Shape; /** @@ -36662,7 +37590,7 @@ declare namespace Excel { } /** * - * Represents a generic shape object in the worksheet. + * Represents a generic shape object in the worksheet. A shape could be a geometric shape, a line, a group of shapes, etc. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36672,7 +37600,7 @@ declare namespace Excel { context: RequestContext; /** * - * Returns the fill formatting of the shape object. Read-only. + * Returns the fill formatting of this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36680,7 +37608,7 @@ declare namespace Excel { readonly fill: Excel.ShapeFill; /** * - * Returns the geometric shape for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GeometricShape. + * Returns the geometric shape associated with the shape. An error will be thrown if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36688,7 +37616,7 @@ declare namespace Excel { readonly geometricShape: Excel.GeometricShape; /** * - * Returns the shape group for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GroupShape. + * Returns the shape group associated with the shape. An error will be thrown if the shape type is not "GroupShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36696,7 +37624,7 @@ declare namespace Excel { readonly group: Excel.ShapeGroup; /** * - * Returns the image for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * Returns the image associated with the shape. An error will be thrown if the shape type is not "Image". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36704,7 +37632,7 @@ declare namespace Excel { readonly image: Excel.Image; /** * - * Returns the line object for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * Returns the line associated with the shape. An error will be thrown if the shape type is not "Line". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36712,7 +37640,7 @@ declare namespace Excel { readonly line: Excel.Line; /** * - * Returns the line formatting of the shape object. Read-only. + * Returns the line formatting of this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36720,7 +37648,7 @@ declare namespace Excel { readonly lineFormat: Excel.ShapeLineFormat; /** * - * Represents the parent group of the specified shape. + * Represents the parent group of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36728,7 +37656,7 @@ declare namespace Excel { readonly parentGroup: Excel.Shape; /** * - * Returns the textFrame object of a shape. Read only. + * Returns the text frame object of this shape. Read only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36736,7 +37664,7 @@ declare namespace Excel { readonly textFrame: Excel.TextFrame; /** * - * Returns or sets the alternative descriptive text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative description text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36744,7 +37672,7 @@ declare namespace Excel { altTextDescription: string; /** * - * Returns or sets the alternative title text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative title text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36752,7 +37680,7 @@ declare namespace Excel { altTextTitle: string; /** * - * Returns the number of connection sites on the specified shape. Read-only. + * Returns the number of connection sites on this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36760,7 +37688,7 @@ declare namespace Excel { readonly connectionSiteCount: number; /** * - * Represents the geometric shape type of the specified shape. See Excel.GeometricShapeType for detail. Returns null if the shape is not geometric, for example, get GeometricShapeType of a line or a chart will return null. + * Represents the geometric shape type of this geometric shape. See Excel.GeometricShapeType for details. Returns null if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36769,7 +37697,7 @@ declare namespace Excel { /** * * Represents the height, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36785,8 +37713,8 @@ declare namespace Excel { readonly id: string; /** * - * The distance, in points, from the left side of the shape to the left of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the left side of the shape to the left side of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36794,7 +37722,7 @@ declare namespace Excel { left: number; /** * - * Represents the level of the specified shape. Level 0 means the shape is not part of any group, level 1 means the shape is part of a top-level group, etc. + * Represents the level of the specified shape. For example, a level of 0 means that the shape is not part of any groups, a level of 1 means the shape is part of a top-level group, and a level of 2 means the shape is part of a sub-group of the top level. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36802,7 +37730,7 @@ declare namespace Excel { readonly level: number; /** * - * Represents if the aspect ratio locked, in boolean, of the shape. + * Specifies whether or not the aspect ratio of this shape is locked. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36818,7 +37746,7 @@ declare namespace Excel { name: string; /** * - * Represents the placment, value that represents the way the object is attached to the cells below it. + * Represents how the object is attached to the cells below it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36834,8 +37762,8 @@ declare namespace Excel { rotation: number; /** * - * The distance, in points, from the top edge of the shape to the top of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the top edge of the shape to the top edge of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36843,15 +37771,15 @@ declare namespace Excel { top: number; /** * - * Returns the type of the specified shape. Read-only. See Excel.ShapeType for detail. + * Returns the type of this shape. See Excel.ShapeType for details. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - readonly type: Excel.ShapeType | "Unknown" | "Image" | "GeometricShape" | "Group" | "Line"; + readonly type: Excel.ShapeType | "Unsupported" | "Image" | "GeometricShape" | "Group" | "Line"; /** * - * Represents the visibility, in boolean, of the specified shape. + * Represents the visibility of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36860,7 +37788,7 @@ declare namespace Excel { /** * * Represents the width, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36868,7 +37796,7 @@ declare namespace Excel { width: number; /** * - * Returns the position of the specified shape in the z-order, the very bottom shape's z-order value is 0. Read-only. + * Returns the position of the specified shape in the z-order, with 0 representing the bottom of the order stack. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -36890,12 +37818,32 @@ declare namespace Excel { set(properties: Excel.Shape): void; /** * - * Deletes the Shape + * Removes the shape from the worksheet. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ delete(): void; + /** + * + * Converts the shape to an image and returns the image as a base64-encoded string. The DPI is 96. The only supported formats are `Excel.PictureFormat.BMP`, `Excel.PictureFormat.PNG`, `Excel.PictureFormat.JPEG`, and `Excel.PictureFormat.GIF`. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param format Specifies the format of the image. + */ + getAsImage(format: Excel.PictureFormat): OfficeExtension.ClientResult; + /** + * + * Converts the shape to an image and returns the image as a base64-encoded string. The DPI is 96. The only supported formats are `Excel.PictureFormat.BMP`, `Excel.PictureFormat.PNG`, `Excel.PictureFormat.JPEG`, and `Excel.PictureFormat.GIF`. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + * + * @param format Specifies the format of the image. + */ + getAsImage(format: "UNKNOWN" | "BMP" | "JPEG" | "GIF" | "PNG" | "SVG"): OfficeExtension.ClientResult; /** * * Moves the shape horizontally by the specified number of points. @@ -36903,18 +37851,18 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param increment Specifies how far the shape is to be moved horizontally, in points. A positive value moves the shape to the right; a negative value moves it to the left. If the sheet is RTL, IncrementLeft with a positive value should move the shape to the left instead of right. + * @param increment The increment, in points, the shape will be horizontally moved. A positive value moves the shape to the right and a negative value moves it to the left. If the sheet is right-to-left oriented, this is reversed: positive values will move the shape to the left and negative values will move it to the right. */ incrementLeft(increment: number): void; /** * - * Changes the rotation of the shape around the z-axis by the specified number of degrees. - Use the Rotation property to set the absolute rotation of the shape. + * Rotates the shape clockwise around the z-axis by the specified number of degrees. + Use the `rotation` property to set the absolute rotation of the shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param increment Specifies how far the shape is to be rotated horizontally, in degrees. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise. + * @param increment How many degrees the shape will be rotated. A positive value rotates the shape clockwise; a negative value rotates it counterclockwise. */ incrementRotation(increment: number): void; /** @@ -36924,93 +37872,77 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param increment Specifies how far the shape is to be moved vertically, in points. A positive value moves the shape down; a negative value moves it up. + * @param increment The increment, in points, the shape will be vertically moved. in points. A positive value moves the shape down and a negative value moves it up. */ incrementTop(increment: number): void; /** * - * Saves the shape as a picture and returns the picture in the form of base64 encoded string, using the DPI sets to 96. Only support saves as to Excel.PictureFormat.BMP, Excel.PictureFormat.PNG, Excel.PictureFormat.JPEG and Excel.PictureFormat.GIF. - * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] - * @beta - */ - saveAsPicture(format: Excel.PictureFormat): OfficeExtension.ClientResult; - /** - * - * Saves the shape as a picture and returns the picture in the form of base64 encoded string, using the DPI sets to 96. Only support saves as to Excel.PictureFormat.BMP, Excel.PictureFormat.PNG, Excel.PictureFormat.JPEG and Excel.PictureFormat.GIF. - * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] - * @beta - */ - saveAsPicture(format: "UNKNOWN" | "BMP" | "JPEG" | "GIF" | "PNG" | "SVG"): OfficeExtension.ClientResult; - /** - * - * Scales the height of the shape by a specified factor. For pictures, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current height. + * Scales the height of the shape by a specified factor. For images, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current height. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * * @param scaleFactor Specifies the ratio between the height of the shape after you resize it and the current or original height. - * @param scaleType OriginalSize to scale the shape relative to its original size. CurrentSize to scale it relative to its current size. You can specify OriginalSize for this argument only if the specified shape is a picture. - * @param scaleFrom Optional. One of the constants of ShapeScaleFrom which specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. + * @param scaleType Specifies whether the shape is scaled relative to its original or current size. The original size scaling option only works for images. + * @param scaleFrom Optional. Specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. */ scaleHeight(scaleFactor: number, scaleType: Excel.ShapeScaleType, scaleFrom?: Excel.ShapeScaleFrom): void; /** * - * Scales the height of the shape by a specified factor. For pictures, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current height. + * Scales the height of the shape by a specified factor. For images, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current height. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * * @param scaleFactor Specifies the ratio between the height of the shape after you resize it and the current or original height. - * @param scaleType OriginalSize to scale the shape relative to its original size. CurrentSize to scale it relative to its current size. You can specify OriginalSize for this argument only if the specified shape is a picture. - * @param scaleFrom Optional. One of the constants of ShapeScaleFrom which specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. + * @param scaleType Specifies whether the shape is scaled relative to its original or current size. The original size scaling option only works for images. + * @param scaleFrom Optional. Specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. */ scaleHeight(scaleFactor: number, scaleType: "CurrentSize" | "OriginalSize", scaleFrom?: "ScaleFromTopLeft" | "ScaleFromMiddle" | "ScaleFromBottomRight"): void; /** * - * Scales the width of the shape by a specified factor. For pictures, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current width. + * Scales the width of the shape by a specified factor. For images, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current width. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * * @param scaleFactor Specifies the ratio between the width of the shape after you resize it and the current or original width. - * @param scaleType OriginalSize to scale the shape relative to its original size. CurrentSize to scale it relative to its current size. You can specify OriginalSize for this argument only if the specified shape is a picture. - * @param scaleFrom Optional. One of the constants of ShapeScaleFrom which specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. + * @param scaleType Specifies whether the shape is scaled relative to its original or current size. The original size scaling option only works for images. + * @param scaleFrom Optional. Specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. */ scaleWidth(scaleFactor: number, scaleType: Excel.ShapeScaleType, scaleFrom?: Excel.ShapeScaleFrom): void; /** * - * Scales the width of the shape by a specified factor. For pictures, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current width. + * Scales the width of the shape by a specified factor. For images, you can indicate whether you want to scale the shape relative to the original or the current size. Shapes other than pictures are always scaled relative to their current width. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * * @param scaleFactor Specifies the ratio between the width of the shape after you resize it and the current or original width. - * @param scaleType OriginalSize to scale the shape relative to its original size. CurrentSize to scale it relative to its current size. You can specify OriginalSize for this argument only if the specified shape is a picture. - * @param scaleFrom Optional. One of the constants of ShapeScaleFrom which specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. + * @param scaleType Specifies whether the shape is scaled relative to its original or current size. The original size scaling option only works for images. + * @param scaleFrom Optional. Specifies which part of the shape retains its position when the shape is scaled. If omitted, it represents the shape's upper left corner retains its position. */ scaleWidth(scaleFactor: number, scaleType: "CurrentSize" | "OriginalSize", scaleFrom?: "ScaleFromTopLeft" | "ScaleFromMiddle" | "ScaleFromBottomRight"): void; /** * - * Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order). + * Moves the specified shape up or down the collection's z-order, which shifts it in front of or behind other shapes. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param value where to move the specified shape relative to the other shapes. See Excel.ShapeZOrder for detail. + * @param position Where to move the shape in the z-order stack relative to the other shapes. See Excel.ShapeZOrder for details. */ - setZOrder(value: Excel.ShapeZOrder): void; + setZOrder(position: Excel.ShapeZOrder): void; /** * - * Moves the specified shape in front of or behind other shapes in the collection (that is, changes the shape's position in the z-order). + * Moves the specified shape up or down the collection's z-order, which shifts it in front of or behind other shapes. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param value where to move the specified shape relative to the other shapes. See Excel.ShapeZOrder for detail. + * @param position Where to move the shape in the z-order stack relative to the other shapes. See Excel.ShapeZOrder for details. */ - setZOrder(value: "BringToFront" | "BringForward" | "SendToBack" | "SendBackward"): void; + setZOrder(position: "BringToFront" | "BringForward" | "SendToBack" | "SendBackward"): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -37044,7 +37976,7 @@ declare namespace Excel { readonly onActivated: OfficeExtension.EventHandlers; /** * - * Occurs when the shape is activated. + * Occurs when the shape is deactivated. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @@ -37060,7 +37992,7 @@ declare namespace Excel { } /** * - * Represents a geometric shape object inside a worksheet. A geometric shape can be a line, rectangle, block arrow, equation, flowchart, start, banner, callout or basic shape in Excel. + * Represents a geometric shape inside a worksheet. A geometric shape can be a rectangle, block arrow, equation symbol, flowchart item, star, banner, callout, or any other basic shape in Excel. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37070,7 +38002,7 @@ declare namespace Excel { context: RequestContext; /** * - * Returns the shape object for the geometric shape. Read-only. + * Returns the Shape object for the geometric shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37078,7 +38010,7 @@ declare namespace Excel { readonly shape: Excel.Shape; /** * - * Represents the shape identifier. Read-only. + * Returns the shape identifier. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37113,7 +38045,7 @@ declare namespace Excel { } /** * - * Represents an image object in the worksheet. + * Represents an image in the worksheet. To get the corresponding Shape object, use Image.shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37123,7 +38055,7 @@ declare namespace Excel { context: RequestContext; /** * - * Returns the shape object for the image. Read-only. + * Returns the Shape object associated with the image. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37139,7 +38071,7 @@ declare namespace Excel { readonly id: string; /** * - * Returns the format for the image. Read-only. + * Returns the format of the image. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37174,7 +38106,7 @@ declare namespace Excel { } /** * - * Represents a shape group object inside a worksheet. + * Represents a shape group inside a worksheet. To get the corresponding Shape object, use `ShapeGroup.shape`. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37184,7 +38116,7 @@ declare namespace Excel { context: RequestContext; /** * - * Returns the shape object for the group. Read-only. + * Returns the Shape object associated with the group. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37192,7 +38124,7 @@ declare namespace Excel { readonly shape: Excel.Shape; /** * - * Returns the shape collection in the group. Read-only. + * Returns the collection of Shape objects. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37243,7 +38175,7 @@ declare namespace Excel { } /** * - * Represents a shape collection inside a shape group. + * Represents the shape collection inside a shape group. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37255,7 +38187,7 @@ declare namespace Excel { readonly items: Excel.Shape[]; /** * - * Returns the number of shapes in the group shape. Read-only. + * Returns the number of shapes in the shape group. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37268,7 +38200,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param name Name of the shape to be retrieved. + * @param name The name of the shape to be retrieved. */ getItem(name: string): Excel.Shape; /** @@ -37278,7 +38210,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param index Index value of the object to be retrieved. Zero-indexed. + * @param index The zero-based index value of the object to be retrieved. */ getItemAt(index: number): Excel.Shape; /** @@ -37307,7 +38239,7 @@ declare namespace Excel { } /** * - * Represents a Line object inside a worksheet. + * Represents a line inside a worksheet. To get the corresponding Shape object, use `Line.shape`. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37317,7 +38249,7 @@ declare namespace Excel { context: RequestContext; /** * - * Represents the shape object that the beginning of the specified line is attached to. Read-only. + * Represents the shape to which the beginning of the specified line is attached. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37325,7 +38257,7 @@ declare namespace Excel { readonly beginConnectedShape: Excel.Shape; /** * - * Represents the shape object that the end of the specified line is attached to. Read-only. + * Represents the shape to which the end of the specified line is attached. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37333,7 +38265,7 @@ declare namespace Excel { readonly endConnectedShape: Excel.Shape; /** * - * Returns the shape object for the line. Read-only. + * Returns the Shape object associated with the line. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37346,7 +38278,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadLength: Excel.ArrowHeadLength | "Short" | "Medium" | "Long"; + beginArrowheadLength: Excel.ArrowheadLength | "Short" | "Medium" | "Long"; /** * * Represents the style of the arrowhead at the beginning of the specified line. @@ -37354,7 +38286,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadStyle: Excel.ArrowHeadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; + beginArrowheadStyle: Excel.ArrowheadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; /** * * Represents the width of the arrowhead at the beginning of the specified line. @@ -37362,10 +38294,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadWidth: Excel.ArrowHeadWidth | "Narrow" | "Medium" | "Wide"; + beginArrowheadWidth: Excel.ArrowheadWidth | "Narrow" | "Medium" | "Wide"; /** * - * Represents an integer that specifies the connection site that the beginning of a connector is connected to. Read-only. Returns null when the beginning of the line is not attached to any shape. + * Represents the connection site to which the beginning of a connector is connected. Read-only. Returns null when the beginning of the line is not attached to any shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37378,7 +38310,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadLength: Excel.ArrowHeadLength | "Short" | "Medium" | "Long"; + endArrowheadLength: Excel.ArrowheadLength | "Short" | "Medium" | "Long"; /** * * Represents the style of the arrowhead at the end of the specified line. @@ -37386,7 +38318,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadStyle: Excel.ArrowHeadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; + endArrowheadStyle: Excel.ArrowheadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; /** * * Represents the width of the arrowhead at the end of the specified line. @@ -37394,10 +38326,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadWidth: Excel.ArrowHeadWidth | "Narrow" | "Medium" | "Wide"; + endArrowheadWidth: Excel.ArrowheadWidth | "Narrow" | "Medium" | "Wide"; /** * - * Represents an integer that specifies the connection site that the end of a connector is connected to. Read-only. Returns null when the end of the line is not attached to any shape. + * Represents the connection site to which the end of a connector is connected. Read-only. Returns null when the end of the line is not attached to any shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37413,7 +38345,7 @@ declare namespace Excel { readonly id: string; /** * - * Represents whether the beginning of the specified line is connected to a shape. Read-only. + * Specifies whether or not the beginning of the specified line is connected to a shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37421,7 +38353,7 @@ declare namespace Excel { readonly isBeginConnected: boolean; /** * - * Represents whether the end of the specified line is connected to a shape. Read-only. + * Specifies whether or not the end of the specified line is connected to a shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37456,18 +38388,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param shape The shape to attach the beginning of the connector to. - * @param connectionSite The connection site on the shape which the beginning of the connector attach to. Must be an integer between 0 and the connection site count(not included) of the specified shape. + * @param shape The shape to connect. + * @param connectionSite The connection site on the shape to which the beginning of the connector is attached. Must be an integer between 0 (inclusive) and the connection-site count of the specified shape (exclusive). */ - beginConnect(shape: Excel.Shape, connectionSite: number): void; - /** - * - * Detaches the beginning of the specified connector from the shape it's attached to. - * - * [Api set: ExcelApi BETA (PREVIEW ONLY)] - * @beta - */ - beginDisconnect(): void; + connectBeginShape(shape: Excel.Shape, connectionSite: number): void; /** * * Attaches the end of the specified connector to a specified shape. @@ -37475,18 +38399,26 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param shape The shape to attach the end of the connector to. - * @param connectionSite The connection site on the shape which the end of the connector attach to. Must be an integer between 0 and the connection site count(not included) of the specified shape. + * @param shape The shape to connect. + * @param connectionSite The connection site on the shape to which the end of the connector is attached. Must be an integer between 0 (inclusive) and the connection-site count of the specified shape (exclusive). */ - endConnect(shape: Excel.Shape, connectionSite: number): void; + connectEndShape(shape: Excel.Shape, connectionSite: number): void; /** * - * Detaches the end of the specified connector from the shape it's attached to. + * Detaches the beginning of the specified connector from a shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endDisconnect(): void; + disconnectBeginShape(): void; + /** + * + * Detaches the end of the specified connector from a shape. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + disconnectEndShape(): void; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -37516,7 +38448,7 @@ declare namespace Excel { } /** * - * Represents the fill formatting for a shape object. + * Represents the fill formatting of a shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37526,15 +38458,15 @@ declare namespace Excel { context: RequestContext; /** * - * Represents the shape fill fore color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") + * Represents the shape fill foreground color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - foreColor: string; + foregroundColor: string; /** * - * Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). For API not supported shape types or special fill type with inconsistent transparencies, return null. For example, gradient fill type could have inconsistent transparencies. + * Returns or sets the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns null if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37542,7 +38474,7 @@ declare namespace Excel { transparency: number; /** * - * Returns the fill type of the shape. Read-only. See Excel.ShapeFillType for detail. + * Returns the fill type of the shape. Read-only. See Excel.ShapeFillType for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37564,7 +38496,7 @@ declare namespace Excel { set(properties: Excel.ShapeFill): void; /** * - * Clears the fill formatting of a shape object. + * Clears the fill formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37572,7 +38504,7 @@ declare namespace Excel { clear(): void; /** * - * Sets the fill formatting of a shape object to a uniform color, fill type changeing to Solid Fill. + * Sets the fill formatting of the shape to a uniform color. This changes the fill type to "Solid". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37609,7 +38541,7 @@ declare namespace Excel { } /** * - * Represents the line formatting for the shape object. For picture and geometric shape, line formatting represents the border of shape object. + * Represents the line formatting for the shape object. For images and geometric shapes, line formatting represents the border of the shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37627,7 +38559,7 @@ declare namespace Excel { color: string; /** * - * Represents the line style of the shape. Returns null when line is not visible or has mixed line dash style property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent dash styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37635,7 +38567,7 @@ declare namespace Excel { dashStyle: Excel.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** * - * Represents the line style of the shape object. Returns null when line is not visible or has mixed line visible property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37643,7 +38575,7 @@ declare namespace Excel { style: Excel.ShapeLineStyle | "Single" | "ThickBetweenThin" | "ThickThin" | "ThinThick" | "ThinThin"; /** * - * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has mixed line transparency property (e.g. group type of shape). + * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has inconsistent transparencies. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37651,7 +38583,7 @@ declare namespace Excel { transparency: number; /** * - * Represents whether the line formatting of a shape element is visible. Returns null when the shape has mixed line visible property (e.g. group type of shape). + * Represents whether or not the line formatting of a shape element is visible. Returns null when the shape has inconsistent visibilities. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37659,7 +38591,7 @@ declare namespace Excel { visible: boolean; /** * - * Represents weight of the line, in points. Returns null when the line is not visible or has mixed line weight property (e.g. group type of shape). + * Represents the weight of the line, in points. Returns null when the line is not visible or there are inconsistent line weights. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37708,7 +38640,7 @@ declare namespace Excel { } /** * - * Represents the text frame for a shape object. + * Represents the text frame of a shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37718,7 +38650,7 @@ declare namespace Excel { context: RequestContext; /** * - * Represents the text range in the text frame. + * Represents the text that is attached to a shape in the text frame, and properties and methods for manipulating the text. See Excel.TextRange for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37726,12 +38658,12 @@ declare namespace Excel { readonly textRange: Excel.TextRange; /** * - * Gets or sets the auto sizing settings for the text frame. A text frame can be set to auto size the text to fit the text frame, or auto size the text frame to fit the text, or without auto sizing. + * Gets or sets the automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - autoSize: Excel.ShapeAutoSize | "AutoSizeNone" | "AutoSizeTextToFitShape" | "AutoSizeShapeToFitText" | "AutoSizeMixed"; + autoSizeSetting: Excel.ShapeAutoSize | "AutoSizeNone" | "AutoSizeTextToFitShape" | "AutoSizeShapeToFitText" | "AutoSizeMixed"; /** * * Represents the bottom margin, in points, of the text frame. @@ -37742,7 +38674,7 @@ declare namespace Excel { bottomMargin: number; /** * - * Specifies whether the TextFrame contains text. + * Specifies whether the text frame contains text. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37750,20 +38682,20 @@ declare namespace Excel { readonly hasText: boolean; /** * - * Represents the horizontal alignment of the text frame. + * Represents the horizontal alignment of the text frame. See Excel.ShapeTextHorizontalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - horizontalAlignment: Excel.ShapeTextHorizontalAlignType | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed" | "ShapeTextHorizontalAlignType_MaxEnumIDs"; + horizontalAlignment: Excel.ShapeTextHorizontalAlignment | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed"; /** * - * Represents the horizontal overflow type of the text frame. + * Represents the horizontal overflow behavior of the text frame. See Excel.ShapeTextHorizontalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - horizontalOverflow: Excel.ShapeTextHorzOverflowType | "Overflow" | "Clip" | "ShapeTextHorzOverflowType_MaxEnumIDs"; + horizontalOverflow: Excel.ShapeTextHorizontalOverflow | "Overflow" | "Clip"; /** * * Represents the left margin, in points, of the text frame. @@ -37774,20 +38706,20 @@ declare namespace Excel { leftMargin: number; /** * - * Represents the text orientation of the text frame. + * Represents the text orientation of the text frame. See Excel.ShapeTextOrientation for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - orientation: Excel.ShapeTextOrientationType | "Horizontal" | "Vertical" | "Vertical270" | "WordArtVertical" | "EastAsianVertical" | "MongolianVertical" | "WordArtVerticalRTL" | "ShapeTextOrientationType_MaxEnumIDs"; + orientation: Excel.ShapeTextOrientation | "Horizontal" | "Vertical" | "Vertical270" | "WordArtVertical" | "EastAsianVertical" | "MongolianVertical" | "WordArtVerticalRTL"; /** * - * Represents the reading order of the text frame, RTL or LTR. + * Represents the reading order of the text frame, either left-to-right or right-to-left. See Excel.ShapeTextReadingOrder for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - readingOrder: Excel.ShapeTextReadingOrder | "LTR" | "RTL"; + readingOrder: Excel.ShapeTextReadingOrder | "LeftToRight" | "RightToLeft"; /** * * Represents the right margin, in points, of the text frame. @@ -37806,20 +38738,20 @@ declare namespace Excel { topMargin: number; /** * - * Represents the vertical alignment of the text frame. + * Represents the vertical alignment of the text frame. See Excel.ShapeTextVerticalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - verticalAlignment: Excel.ShapeTextVerticalAlignType | "Top" | "Middle" | "Bottom" | "Justified" | "Distributed" | "ShapeTextVerticalAlignType_MaxEnumIDs"; + verticalAlignment: Excel.ShapeTextVerticalAlignment | "Top" | "Middle" | "Bottom" | "Justified" | "Distributed"; /** * - * Represents the vertical overflow type of the text frame. + * Represents the vertical overflow behavior of the text frame. See Excel.ShapeTextVerticalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - verticalOverflow: Excel.ShapeTextVertOverflowType | "Overflow" | "Ellipsis" | "Clip" | "ShapeTextVertOverflowType_MaxEnumIDs"; + verticalOverflow: Excel.ShapeTextVerticalOverflow | "Overflow" | "Ellipsis" | "Clip"; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. * * @remarks @@ -37836,7 +38768,7 @@ declare namespace Excel { set(properties: Excel.TextFrame): void; /** * - * Deletes all the text in the textframe. + * Deletes all the text in the text frame. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37870,6 +38802,9 @@ declare namespace Excel { toJSON(): Excel.Interfaces.TextFrameData; } /** + * + * Contains the text that is attached to a shape, in addition to properties and methods for manipulating the text. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -37908,15 +38843,15 @@ declare namespace Excel { set(properties: Excel.TextRange): void; /** * - * Returns a TextRange object for characters in the given range. + * Returns a TextRange object for the substring in the given range. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta * - * @param start Position of the first character in the returned range. - * @param length Optional. The number of characters to be returned. If omitted, it represents the number of characters from "start" to the end of the last paragraph in TextRange. + * @param start The zero-based index of the first character to get from the text range. + * @param length Optional. The number of characters to be returned in the new text range. If length is omitted, all the characters from start to the end of the text range's last paragraph will be returned. */ - getCharacters(start: number, length?: number): Excel.TextRange; + getSubstring(start: number, length?: number): Excel.TextRange; /** * Queues up a command to load the specified properties of the object. You must call "context.sync()" before reading the properties. * @@ -37946,7 +38881,7 @@ declare namespace Excel { } /** * - * This object represents the font attributes (font name, font size, color, etc.) for a TextRange in the Shape. + * Represents the font attributes, such as font name, font size, and color, for a shape's TextRange object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37964,7 +38899,7 @@ declare namespace Excel { bold: boolean; /** * - * HTML color code representation of the text color. E.g. #FF0000 represents Red. Returns null if the TextRange includes text fragments with different colors. + * The HTML color code representation of the text color (e.g. "#FF0000" represents red). Returns null if the TextRange includes text fragments with different colors. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37972,7 +38907,7 @@ declare namespace Excel { color: string; /** * - * Represents the italic status of font. Return null if the TextRange includes both italic and non-italic text fragments. + * Represents the italic status of font. Returns null if the TextRange includes both italic and non-italic text fragments. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37980,7 +38915,7 @@ declare namespace Excel { italic: boolean; /** * - * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, represents corresponding font name; otherwise represents Latin font name. + * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37988,7 +38923,7 @@ declare namespace Excel { name: string; /** * - * Represents font size in points (e.g. 11). Return null if the TextRange includes text fragments with different font sizes. + * Represents font size in points (e.g. 11). Returns null if the TextRange includes text fragments with different font sizes. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -37996,7 +38931,7 @@ declare namespace Excel { size: number; /** * - * Type of underline applied to the font. Return null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. + * Type of underline applied to the font. Returns null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -39078,6 +40013,9 @@ declare namespace Excel { power = "Power" } /** + * + * Specifies where in the z-order a shape should be moved relative to other shapes. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -39088,17 +40026,23 @@ declare namespace Excel { sendBackward = "SendBackward" } /** + * + * Specifies the type of a shape. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ enum ShapeType { - unknown = "Unknown", + unsupported = "Unsupported", image = "Image", geometricShape = "GeometricShape", group = "Group", line = "Line" } /** + * + * Specifies whether the shape is scaled relative to its original or current size. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -39107,6 +40051,9 @@ declare namespace Excel { originalSize = "OriginalSize" } /** + * + * Specifies which part of the shape retains its position when the shape is scaled. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -39116,18 +40063,54 @@ declare namespace Excel { scaleFromBottomRight = "ScaleFromBottomRight" } /** + * + * Specifies a shape's fill type. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ enum ShapeFillType { + /** + * + * No fill. + * + */ noFill = "NoFill", + /** + * + * Solid fill. + * + */ solid = "Solid", + /** + * + * Gradient fill. + * + */ gradient = "Gradient", + /** + * + * Pattern fill. + * + */ pattern = "Pattern", + /** + * + * Picture and texture fill. + * + */ pictureAndTexture = "PictureAndTexture", + /** + * + * Mixed fill. + * + */ mixed = "Mixed" } /** + * + * The type of underline applied to a font. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -39151,29 +40134,88 @@ declare namespace Excel { wavyDouble = "WavyDouble" } /** + * + * The format of the image. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ enum PictureFormat { unknown = "UNKNOWN", + /** + * + * Bitmap image. + * + */ bmp = "BMP", + /** + * + * Joint Photographic Experts Group. + * + */ jpeg = "JPEG", + /** + * + * Graphics Interchange Format. + * + */ gif = "GIF", + /** + * + * Portable Network Graphics. + * + */ png = "PNG", + /** + * + * Scalable Vector Graphic. + * + */ svg = "SVG" } /** + * + * The style for a line. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ enum ShapeLineStyle { + /** + * + * Single line. + * + */ single = "Single", + /** + * + * Thick line with a thin line on each side. + * + */ thickBetweenThin = "ThickBetweenThin", + /** + * + * Thick line next to thin line. For horizontal lines, the thick line is above the thin line. For vertical lines, the thick line is to the left of the thin line. + * + */ thickThin = "ThickThin", + /** + * + * Thick line next to thin line. For horizontal lines, the thick line is below the thin line. For vertical lines, the thick line is to the right of the thin line. + * + */ thinThick = "ThinThick", + /** + * + * Two thin lines. + * + */ thinThin = "ThinThin" } /** + * + * The dash style for a line. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -39195,7 +40237,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ArrowHeadLength { + enum ArrowheadLength { short = "Short", medium = "Medium", long = "Long" @@ -39204,7 +40246,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ArrowHeadStyle { + enum ArrowheadStyle { none = "None", triangle = "Triangle", stealth = "Stealth", @@ -39216,7 +40258,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ArrowHeadWidth { + enum ArrowheadWidth { narrow = "Narrow", medium = "Medium", wide = "Wide" @@ -40523,6 +41565,9 @@ declare namespace Excel { fetchingData = "FetchingData" } /** + * + * Specifies the shape type for a GeometricShape object. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -40877,12 +41922,30 @@ declare namespace Excel { text = "Text" } /** + * + * Specifies the way that an object is attached to its underlying cells. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ enum Placement { + /** + * + * The object is moved with the cells. + * + */ twoCell = "TwoCell", + /** + * + * The object is moved and sized with the cells. + * + */ oneCell = "OneCell", + /** + * + * The object is free floating. + * + */ absolute = "Absolute" } /** @@ -40913,85 +41976,136 @@ declare namespace Excel { rectangularGradient = "RectangularGradient" } /** + * + * Specifies the horizontal alignment for the text frame in a shape. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ShapeTextHorizontalAlignType { + enum ShapeTextHorizontalAlignment { left = "Left", center = "Center", right = "Right", justify = "Justify", justifyLow = "JustifyLow", distributed = "Distributed", - thaiDistributed = "ThaiDistributed", - shapeTextHorizontalAlignType_MaxEnumIDs = "ShapeTextHorizontalAlignType_MaxEnumIDs" + thaiDistributed = "ThaiDistributed" } /** + * + * Specifies the vertical alignment for the text frame in a shape. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ShapeTextVerticalAlignType { + enum ShapeTextVerticalAlignment { top = "Top", middle = "Middle", bottom = "Bottom", justified = "Justified", - distributed = "Distributed", - shapeTextVerticalAlignType_MaxEnumIDs = "ShapeTextVerticalAlignType_MaxEnumIDs" + distributed = "Distributed" } /** + * + * Specifies the vertical overflow for the text frame in a shape. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ShapeTextVertOverflowType { + enum ShapeTextVerticalOverflow { + /** + * + * Allow text to overflow the text frame vertically (can be from the top, bottom, or both depending on the text alignment). + * + */ overflow = "Overflow", + /** + * + * Hide text that does not fit vertically within the text frame, and add an ellipsis (...) at the end of the visible text. + * + */ ellipsis = "Ellipsis", - clip = "Clip", - shapeTextVertOverflowType_MaxEnumIDs = "ShapeTextVertOverflowType_MaxEnumIDs" + /** + * + * Hide text that does not fit vertically within the text frame. + * + */ + clip = "Clip" } /** + * + * Specifies the horizontal overflow for the text frame in a shape. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ShapeTextHorzOverflowType { + enum ShapeTextHorizontalOverflow { overflow = "Overflow", - clip = "Clip", - shapeTextHorzOverflowType_MaxEnumIDs = "ShapeTextHorzOverflowType_MaxEnumIDs" + clip = "Clip" } /** + * + * Specifies the reading order for the text frame in a shape. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ enum ShapeTextReadingOrder { - ltr = "LTR", - rtl = "RTL" + leftToRight = "LeftToRight", + rightToLeft = "RightToLeft" } /** + * + * Specifies the orientation for the text frame in a shape. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - enum ShapeTextOrientationType { + enum ShapeTextOrientation { horizontal = "Horizontal", vertical = "Vertical", vertical270 = "Vertical270", wordArtVertical = "WordArtVertical", eastAsianVertical = "EastAsianVertical", mongolianVertical = "MongolianVertical", - wordArtVerticalRTL = "WordArtVerticalRTL", - shapeTextOrientationType_MaxEnumIDs = "ShapeTextOrientationType_MaxEnumIDs" + wordArtVerticalRTL = "WordArtVerticalRTL" } /** + * + * Determines the type of automatic sizing allowed. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ enum ShapeAutoSize { + /** + * + * No autosizing. + * + */ autoSizeNone = "AutoSizeNone", + /** + * + * The text is adjusted to fit the shape. + * + */ autoSizeTextToFitShape = "AutoSizeTextToFitShape", + /** + * + * The shape is adjusted to fit the text. + * + */ autoSizeShapeToFitText = "AutoSizeShapeToFitText", + /** + * + * A combination of automatic sizing schemes are used. + * + */ autoSizeMixed = "AutoSizeMixed" } /** * - * Specifies the close behavior for workbook.close API. + * Specifies the close behavior for Workbook.close API. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -41012,7 +42126,7 @@ declare namespace Excel { } /** * - * Specifies the save behavior for workbook.save API. + * Specifies the save behavior for Workbook.save API. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -44972,8 +46086,8 @@ declare namespace Excel { chartDataPointTrack?: boolean; /** * - * True if no changes have been made to the specified workbook since it was last saved. - You can set this property to True if you want to close a modified workbook without either saving it or being prompted to save it. + * Specifies whether or not changes have been made since the workbook was last saved. + You can set this property to true if you want to close a modified workbook without either saving it or being prompted to save it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -48777,6 +49891,66 @@ declare namespace Excel { interface StyleCollectionUpdateData { items?: Excel.Interfaces.StyleData[]; } + /** An interface for updating data on the TableStyleCollection object, for use in "tableStyleCollection.set({ ... })". */ + interface TableStyleCollectionUpdateData { + items?: Excel.Interfaces.TableStyleData[]; + } + /** An interface for updating data on the TableStyle object, for use in "tableStyle.set({ ... })". */ + interface TableStyleUpdateData { + /** + * + * Gets the name of the TableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + } + /** An interface for updating data on the PivotTableStyleCollection object, for use in "pivotTableStyleCollection.set({ ... })". */ + interface PivotTableStyleCollectionUpdateData { + items?: Excel.Interfaces.PivotTableStyleData[]; + } + /** An interface for updating data on the PivotTableStyle object, for use in "pivotTableStyle.set({ ... })". */ + interface PivotTableStyleUpdateData { + /** + * + * Gets the name of the PivotTableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + } + /** An interface for updating data on the SlicerStyleCollection object, for use in "slicerStyleCollection.set({ ... })". */ + interface SlicerStyleCollectionUpdateData { + items?: Excel.Interfaces.SlicerStyleData[]; + } + /** An interface for updating data on the SlicerStyle object, for use in "slicerStyle.set({ ... })". */ + interface SlicerStyleUpdateData { + /** + * + * Gets the name of the SlicerStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + } + /** An interface for updating data on the TimelineStyleCollection object, for use in "timelineStyleCollection.set({ ... })". */ + interface TimelineStyleCollectionUpdateData { + items?: Excel.Interfaces.TimelineStyleData[]; + } + /** An interface for updating data on the TimelineStyle object, for use in "timelineStyle.set({ ... })". */ + interface TimelineStyleUpdateData { + /** + * + * Gets the name of the TimelineStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + } /** An interface for updating data on the PageLayout object, for use in "pageLayout.set({ ... })". */ interface PageLayoutUpdateData { /** @@ -49072,7 +50246,7 @@ declare namespace Excel { interface CommentUpdateData { /** * - * Get/Set the content. + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49087,7 +50261,7 @@ declare namespace Excel { interface CommentReplyUpdateData { /** * - * Get/Set the content. + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49102,7 +50276,7 @@ declare namespace Excel { interface ShapeUpdateData { /** * - * Returns the fill formatting of the shape object. + * Returns the fill formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49110,7 +50284,7 @@ declare namespace Excel { fill?: Excel.Interfaces.ShapeFillUpdateData; /** * - * Returns the line formatting of the shape object. + * Returns the line formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49118,7 +50292,7 @@ declare namespace Excel { lineFormat?: Excel.Interfaces.ShapeLineFormatUpdateData; /** * - * Returns or sets the alternative descriptive text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative description text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49126,7 +50300,7 @@ declare namespace Excel { altTextDescription?: string; /** * - * Returns or sets the alternative title text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative title text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49134,7 +50308,7 @@ declare namespace Excel { altTextTitle?: string; /** * - * Represents the geometric shape type of the specified shape. See Excel.GeometricShapeType for detail. Returns null if the shape is not geometric, for example, get GeometricShapeType of a line or a chart will return null. + * Represents the geometric shape type of this geometric shape. See Excel.GeometricShapeType for details. Returns null if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49143,7 +50317,7 @@ declare namespace Excel { /** * * Represents the height, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49151,8 +50325,8 @@ declare namespace Excel { height?: number; /** * - * The distance, in points, from the left side of the shape to the left of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the left side of the shape to the left side of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49160,7 +50334,7 @@ declare namespace Excel { left?: number; /** * - * Represents if the aspect ratio locked, in boolean, of the shape. + * Specifies whether or not the aspect ratio of this shape is locked. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49176,7 +50350,7 @@ declare namespace Excel { name?: string; /** * - * Represents the placment, value that represents the way the object is attached to the cells below it. + * Represents how the object is attached to the cells below it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49192,8 +50366,8 @@ declare namespace Excel { rotation?: number; /** * - * The distance, in points, from the top edge of the shape to the top of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the top edge of the shape to the top edge of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49201,7 +50375,7 @@ declare namespace Excel { top?: number; /** * - * Represents the visibility, in boolean, of the specified shape. + * Represents the visibility of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49210,7 +50384,7 @@ declare namespace Excel { /** * * Represents the width, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49230,7 +50404,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadLength?: Excel.ArrowHeadLength | "Short" | "Medium" | "Long"; + beginArrowheadLength?: Excel.ArrowheadLength | "Short" | "Medium" | "Long"; /** * * Represents the style of the arrowhead at the beginning of the specified line. @@ -49238,7 +50412,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadStyle?: Excel.ArrowHeadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; + beginArrowheadStyle?: Excel.ArrowheadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; /** * * Represents the width of the arrowhead at the beginning of the specified line. @@ -49246,7 +50420,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadWidth?: Excel.ArrowHeadWidth | "Narrow" | "Medium" | "Wide"; + beginArrowheadWidth?: Excel.ArrowheadWidth | "Narrow" | "Medium" | "Wide"; /** * * Represents the length of the arrowhead at the end of the specified line. @@ -49254,7 +50428,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadLength?: Excel.ArrowHeadLength | "Short" | "Medium" | "Long"; + endArrowheadLength?: Excel.ArrowheadLength | "Short" | "Medium" | "Long"; /** * * Represents the style of the arrowhead at the end of the specified line. @@ -49262,7 +50436,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadStyle?: Excel.ArrowHeadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; + endArrowheadStyle?: Excel.ArrowheadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; /** * * Represents the width of the arrowhead at the end of the specified line. @@ -49270,7 +50444,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadWidth?: Excel.ArrowHeadWidth | "Narrow" | "Medium" | "Wide"; + endArrowheadWidth?: Excel.ArrowheadWidth | "Narrow" | "Medium" | "Wide"; /** * * Represents the connector type for the line. @@ -49284,15 +50458,15 @@ declare namespace Excel { interface ShapeFillUpdateData { /** * - * Represents the shape fill fore color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") + * Represents the shape fill foreground color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - foreColor?: string; + foregroundColor?: string; /** * - * Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). For API not supported shape types or special fill type with inconsistent transparencies, return null. For example, gradient fill type could have inconsistent transparencies. + * Returns or sets the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns null if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49311,7 +50485,7 @@ declare namespace Excel { color?: string; /** * - * Represents the line style of the shape. Returns null when line is not visible or has mixed line dash style property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent dash styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49319,7 +50493,7 @@ declare namespace Excel { dashStyle?: Excel.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** * - * Represents the line style of the shape object. Returns null when line is not visible or has mixed line visible property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49327,7 +50501,7 @@ declare namespace Excel { style?: Excel.ShapeLineStyle | "Single" | "ThickBetweenThin" | "ThickThin" | "ThinThick" | "ThinThin"; /** * - * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has mixed line transparency property (e.g. group type of shape). + * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has inconsistent transparencies. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49335,7 +50509,7 @@ declare namespace Excel { transparency?: number; /** * - * Represents whether the line formatting of a shape element is visible. Returns null when the shape has mixed line visible property (e.g. group type of shape). + * Represents whether or not the line formatting of a shape element is visible. Returns null when the shape has inconsistent visibilities. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49343,7 +50517,7 @@ declare namespace Excel { visible?: boolean; /** * - * Represents weight of the line, in points. Returns null when the line is not visible or has mixed line weight property (e.g. group type of shape). + * Represents the weight of the line, in points. Returns null when the line is not visible or there are inconsistent line weights. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49354,12 +50528,12 @@ declare namespace Excel { interface TextFrameUpdateData { /** * - * Gets or sets the auto sizing settings for the text frame. A text frame can be set to auto size the text to fit the text frame, or auto size the text frame to fit the text, or without auto sizing. + * Gets or sets the automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - autoSize?: Excel.ShapeAutoSize | "AutoSizeNone" | "AutoSizeTextToFitShape" | "AutoSizeShapeToFitText" | "AutoSizeMixed"; + autoSizeSetting?: Excel.ShapeAutoSize | "AutoSizeNone" | "AutoSizeTextToFitShape" | "AutoSizeShapeToFitText" | "AutoSizeMixed"; /** * * Represents the bottom margin, in points, of the text frame. @@ -49370,20 +50544,20 @@ declare namespace Excel { bottomMargin?: number; /** * - * Represents the horizontal alignment of the text frame. + * Represents the horizontal alignment of the text frame. See Excel.ShapeTextHorizontalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - horizontalAlignment?: Excel.ShapeTextHorizontalAlignType | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed" | "ShapeTextHorizontalAlignType_MaxEnumIDs"; + horizontalAlignment?: Excel.ShapeTextHorizontalAlignment | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed"; /** * - * Represents the horizontal overflow type of the text frame. + * Represents the horizontal overflow behavior of the text frame. See Excel.ShapeTextHorizontalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - horizontalOverflow?: Excel.ShapeTextHorzOverflowType | "Overflow" | "Clip" | "ShapeTextHorzOverflowType_MaxEnumIDs"; + horizontalOverflow?: Excel.ShapeTextHorizontalOverflow | "Overflow" | "Clip"; /** * * Represents the left margin, in points, of the text frame. @@ -49394,20 +50568,20 @@ declare namespace Excel { leftMargin?: number; /** * - * Represents the text orientation of the text frame. + * Represents the text orientation of the text frame. See Excel.ShapeTextOrientation for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - orientation?: Excel.ShapeTextOrientationType | "Horizontal" | "Vertical" | "Vertical270" | "WordArtVertical" | "EastAsianVertical" | "MongolianVertical" | "WordArtVerticalRTL" | "ShapeTextOrientationType_MaxEnumIDs"; + orientation?: Excel.ShapeTextOrientation | "Horizontal" | "Vertical" | "Vertical270" | "WordArtVertical" | "EastAsianVertical" | "MongolianVertical" | "WordArtVerticalRTL"; /** * - * Represents the reading order of the text frame, RTL or LTR. + * Represents the reading order of the text frame, either left-to-right or right-to-left. See Excel.ShapeTextReadingOrder for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - readingOrder?: Excel.ShapeTextReadingOrder | "LTR" | "RTL"; + readingOrder?: Excel.ShapeTextReadingOrder | "LeftToRight" | "RightToLeft"; /** * * Represents the right margin, in points, of the text frame. @@ -49426,20 +50600,20 @@ declare namespace Excel { topMargin?: number; /** * - * Represents the vertical alignment of the text frame. + * Represents the vertical alignment of the text frame. See Excel.ShapeTextVerticalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - verticalAlignment?: Excel.ShapeTextVerticalAlignType | "Top" | "Middle" | "Bottom" | "Justified" | "Distributed" | "ShapeTextVerticalAlignType_MaxEnumIDs"; + verticalAlignment?: Excel.ShapeTextVerticalAlignment | "Top" | "Middle" | "Bottom" | "Justified" | "Distributed"; /** * - * Represents the vertical overflow type of the text frame. + * Represents the vertical overflow behavior of the text frame. See Excel.ShapeTextVerticalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - verticalOverflow?: Excel.ShapeTextVertOverflowType | "Overflow" | "Ellipsis" | "Clip" | "ShapeTextVertOverflowType_MaxEnumIDs"; + verticalOverflow?: Excel.ShapeTextVerticalOverflow | "Overflow" | "Ellipsis" | "Clip"; } /** An interface for updating data on the TextRange object, for use in "textRange.set({ ... })". */ interface TextRangeUpdateData { @@ -49472,7 +50646,7 @@ declare namespace Excel { bold?: boolean; /** * - * HTML color code representation of the text color. E.g. #FF0000 represents Red. Returns null if the TextRange includes text fragments with different colors. + * The HTML color code representation of the text color (e.g. "#FF0000" represents red). Returns null if the TextRange includes text fragments with different colors. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49480,7 +50654,7 @@ declare namespace Excel { color?: string; /** * - * Represents the italic status of font. Return null if the TextRange includes both italic and non-italic text fragments. + * Represents the italic status of font. Returns null if the TextRange includes both italic and non-italic text fragments. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49488,7 +50662,7 @@ declare namespace Excel { italic?: boolean; /** * - * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, represents corresponding font name; otherwise represents Latin font name. + * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49496,7 +50670,7 @@ declare namespace Excel { name?: string; /** * - * Represents font size in points (e.g. 11). Return null if the TextRange includes text fragments with different font sizes. + * Represents font size in points (e.g. 11). Returns null if the TextRange includes text fragments with different font sizes. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49504,7 +50678,7 @@ declare namespace Excel { size?: number; /** * - * Type of underline applied to the font. Return null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. + * Type of underline applied to the font. Returns null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49725,6 +50899,14 @@ declare namespace Excel { names?: Excel.Interfaces.NamedItemData[]; /** * + * Represents a collection of PivotTableStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + pivotTableStyles?: Excel.Interfaces.PivotTableStyleData[]; + /** + * * Represents a collection of PivotTables associated with the workbook. Read-only. * * [Api set: ExcelApi 1.3] @@ -49753,6 +50935,14 @@ declare namespace Excel { settings?: Excel.Interfaces.SettingData[]; /** * + * Represents a collection of SlicerStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + slicerStyles?: Excel.Interfaces.SlicerStyleData[]; + /** + * * Represents a collection of Slicers associated with the workbook. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] @@ -49768,6 +50958,14 @@ declare namespace Excel { styles?: Excel.Interfaces.StyleData[]; /** * + * Represents a collection of TableStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + tableStyles?: Excel.Interfaces.TableStyleData[]; + /** + * * Represents a collection of tables associated with the workbook. Read-only. * * [Api set: ExcelApi 1.1] @@ -49775,6 +50973,14 @@ declare namespace Excel { tables?: Excel.Interfaces.TableData[]; /** * + * Represents a collection of TimelineStyles associated with the workbook. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + timelineStyles?: Excel.Interfaces.TimelineStyleData[]; + /** + * * Represents a collection of worksheets associated with the workbook. Read-only. * * [Api set: ExcelApi 1.1] @@ -49782,7 +50988,7 @@ declare namespace Excel { worksheets?: Excel.Interfaces.WorksheetData[]; /** * - * True if the workbook is in auto save mode. + * Specifies whether or not the workbook is in autosave mode. Read-Only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49807,8 +51013,8 @@ declare namespace Excel { chartDataPointTrack?: boolean; /** * - * True if no changes have been made to the specified workbook since it was last saved. - You can set this property to True if you want to close a modified workbook without either saving it or being prompted to save it. + * Specifies whether or not changes have been made since the workbook was last saved. + You can set this property to true if you want to close a modified workbook without either saving it or being prompted to save it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -49823,7 +51029,7 @@ declare namespace Excel { name?: string; /** * - * True if the workbook has ever been saved locally or online. + * Specifies whether or not the workbook has ever been saved locally or online. Read-Only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -54577,6 +55783,98 @@ declare namespace Excel { interface StyleCollectionData { items?: Excel.Interfaces.StyleData[]; } + /** An interface describing the data returned by calling "tableStyleCollection.toJSON()". */ + interface TableStyleCollectionData { + items?: Excel.Interfaces.TableStyleData[]; + } + /** An interface describing the data returned by calling "tableStyle.toJSON()". */ + interface TableStyleData { + /** + * + * Gets the name of the TableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + /** + * + * True means that this TableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** An interface describing the data returned by calling "pivotTableStyleCollection.toJSON()". */ + interface PivotTableStyleCollectionData { + items?: Excel.Interfaces.PivotTableStyleData[]; + } + /** An interface describing the data returned by calling "pivotTableStyle.toJSON()". */ + interface PivotTableStyleData { + /** + * + * Gets the name of the PivotTableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + /** + * + * True means that this PivotTableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** An interface describing the data returned by calling "slicerStyleCollection.toJSON()". */ + interface SlicerStyleCollectionData { + items?: Excel.Interfaces.SlicerStyleData[]; + } + /** An interface describing the data returned by calling "slicerStyle.toJSON()". */ + interface SlicerStyleData { + /** + * + * Gets the name of the SlicerStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + /** + * + * True means that this SlicerStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** An interface describing the data returned by calling "timelineStyleCollection.toJSON()". */ + interface TimelineStyleCollectionData { + items?: Excel.Interfaces.TimelineStyleData[]; + } + /** An interface describing the data returned by calling "timelineStyle.toJSON()". */ + interface TimelineStyleData { + /** + * + * Gets the name of the TimelineStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: string; + /** + * + * True means that this TimelineStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } /** An interface describing the data returned by calling "pageLayout.toJSON()". */ interface PageLayoutData { /** @@ -54899,12 +56197,36 @@ declare namespace Excel { replies?: Excel.Interfaces.CommentReplyData[]; /** * - * Get/Set the content. + * Get author email of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorEmail?: string; + /** + * + * Get author name of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorName?: string; + /** + * + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content?: string; + /** + * + * Get creation time of the comment. Will return null if the comment is converted from note, as in this case, the comment will not has created date. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + creationDate?: Date; /** * * Represents the comment identifier. Read-only. @@ -54930,12 +56252,36 @@ declare namespace Excel { interface CommentReplyData { /** * - * Get/Set the content. + * Get author email of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorEmail?: string; + /** + * + * Get author name of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorName?: string; + /** + * + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content?: string; + /** + * + * Get creation time of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + creationDate?: Date; /** * * Represents the comment reply identifier. Read-only. @@ -54961,7 +56307,7 @@ declare namespace Excel { interface ShapeData { /** * - * Returns the fill formatting of the shape object. Read-only. + * Returns the fill formatting of this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -54969,7 +56315,7 @@ declare namespace Excel { fill?: Excel.Interfaces.ShapeFillData; /** * - * Returns the line formatting of the shape object. Read-only. + * Returns the line formatting of this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -54977,7 +56323,7 @@ declare namespace Excel { lineFormat?: Excel.Interfaces.ShapeLineFormatData; /** * - * Returns or sets the alternative descriptive text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative description text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -54985,7 +56331,7 @@ declare namespace Excel { altTextDescription?: string; /** * - * Returns or sets the alternative title text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative title text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -54993,7 +56339,7 @@ declare namespace Excel { altTextTitle?: string; /** * - * Returns the number of connection sites on the specified shape. Read-only. + * Returns the number of connection sites on this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55001,7 +56347,7 @@ declare namespace Excel { connectionSiteCount?: number; /** * - * Represents the geometric shape type of the specified shape. See Excel.GeometricShapeType for detail. Returns null if the shape is not geometric, for example, get GeometricShapeType of a line or a chart will return null. + * Represents the geometric shape type of this geometric shape. See Excel.GeometricShapeType for details. Returns null if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55010,7 +56356,7 @@ declare namespace Excel { /** * * Represents the height, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55026,8 +56372,8 @@ declare namespace Excel { id?: string; /** * - * The distance, in points, from the left side of the shape to the left of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the left side of the shape to the left side of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55035,7 +56381,7 @@ declare namespace Excel { left?: number; /** * - * Represents the level of the specified shape. Level 0 means the shape is not part of any group, level 1 means the shape is part of a top-level group, etc. + * Represents the level of the specified shape. For example, a level of 0 means that the shape is not part of any groups, a level of 1 means the shape is part of a top-level group, and a level of 2 means the shape is part of a sub-group of the top level. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55043,7 +56389,7 @@ declare namespace Excel { level?: number; /** * - * Represents if the aspect ratio locked, in boolean, of the shape. + * Specifies whether or not the aspect ratio of this shape is locked. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55059,7 +56405,7 @@ declare namespace Excel { name?: string; /** * - * Represents the placment, value that represents the way the object is attached to the cells below it. + * Represents how the object is attached to the cells below it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55075,8 +56421,8 @@ declare namespace Excel { rotation?: number; /** * - * The distance, in points, from the top edge of the shape to the top of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the top edge of the shape to the top edge of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55084,15 +56430,15 @@ declare namespace Excel { top?: number; /** * - * Returns the type of the specified shape. Read-only. See Excel.ShapeType for detail. + * Returns the type of this shape. See Excel.ShapeType for details. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - type?: Excel.ShapeType | "Unknown" | "Image" | "GeometricShape" | "Group" | "Line"; + type?: Excel.ShapeType | "Unsupported" | "Image" | "GeometricShape" | "Group" | "Line"; /** * - * Represents the visibility, in boolean, of the specified shape. + * Represents the visibility of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55101,7 +56447,7 @@ declare namespace Excel { /** * * Represents the width, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55109,7 +56455,7 @@ declare namespace Excel { width?: number; /** * - * Returns the position of the specified shape in the z-order, the very bottom shape's z-order value is 0. Read-only. + * Returns the position of the specified shape in the z-order, with 0 representing the bottom of the order stack. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55120,7 +56466,7 @@ declare namespace Excel { interface GeometricShapeData { /** * - * Represents the shape identifier. Read-only. + * Returns the shape identifier. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55139,7 +56485,7 @@ declare namespace Excel { id?: string; /** * - * Returns the format for the image. Read-only. + * Returns the format of the image. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55150,7 +56496,7 @@ declare namespace Excel { interface ShapeGroupData { /** * - * Returns the shape collection in the group. Read-only. + * Returns the collection of Shape objects. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55178,7 +56524,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadLength?: Excel.ArrowHeadLength | "Short" | "Medium" | "Long"; + beginArrowheadLength?: Excel.ArrowheadLength | "Short" | "Medium" | "Long"; /** * * Represents the style of the arrowhead at the beginning of the specified line. @@ -55186,7 +56532,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadStyle?: Excel.ArrowHeadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; + beginArrowheadStyle?: Excel.ArrowheadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; /** * * Represents the width of the arrowhead at the beginning of the specified line. @@ -55194,10 +56540,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadWidth?: Excel.ArrowHeadWidth | "Narrow" | "Medium" | "Wide"; + beginArrowheadWidth?: Excel.ArrowheadWidth | "Narrow" | "Medium" | "Wide"; /** * - * Represents an integer that specifies the connection site that the beginning of a connector is connected to. Read-only. Returns null when the beginning of the line is not attached to any shape. + * Represents the connection site to which the beginning of a connector is connected. Read-only. Returns null when the beginning of the line is not attached to any shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55210,7 +56556,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadLength?: Excel.ArrowHeadLength | "Short" | "Medium" | "Long"; + endArrowheadLength?: Excel.ArrowheadLength | "Short" | "Medium" | "Long"; /** * * Represents the style of the arrowhead at the end of the specified line. @@ -55218,7 +56564,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadStyle?: Excel.ArrowHeadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; + endArrowheadStyle?: Excel.ArrowheadStyle | "None" | "Triangle" | "Stealth" | "Diamond" | "Oval" | "Open"; /** * * Represents the width of the arrowhead at the end of the specified line. @@ -55226,10 +56572,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadWidth?: Excel.ArrowHeadWidth | "Narrow" | "Medium" | "Wide"; + endArrowheadWidth?: Excel.ArrowheadWidth | "Narrow" | "Medium" | "Wide"; /** * - * Represents an integer that specifies the connection site that the end of a connector is connected to. Read-only. Returns null when the end of the line is not attached to any shape. + * Represents the connection site to which the end of a connector is connected. Read-only. Returns null when the end of the line is not attached to any shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55245,7 +56591,7 @@ declare namespace Excel { id?: string; /** * - * Represents whether the beginning of the specified line is connected to a shape. Read-only. + * Specifies whether or not the beginning of the specified line is connected to a shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55253,7 +56599,7 @@ declare namespace Excel { isBeginConnected?: boolean; /** * - * Represents whether the end of the specified line is connected to a shape. Read-only. + * Specifies whether or not the end of the specified line is connected to a shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55272,15 +56618,15 @@ declare namespace Excel { interface ShapeFillData { /** * - * Represents the shape fill fore color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") + * Represents the shape fill foreground color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - foreColor?: string; + foregroundColor?: string; /** * - * Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). For API not supported shape types or special fill type with inconsistent transparencies, return null. For example, gradient fill type could have inconsistent transparencies. + * Returns or sets the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns null if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55288,7 +56634,7 @@ declare namespace Excel { transparency?: number; /** * - * Returns the fill type of the shape. Read-only. See Excel.ShapeFillType for detail. + * Returns the fill type of the shape. Read-only. See Excel.ShapeFillType for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55307,7 +56653,7 @@ declare namespace Excel { color?: string; /** * - * Represents the line style of the shape. Returns null when line is not visible or has mixed line dash style property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent dash styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55315,7 +56661,7 @@ declare namespace Excel { dashStyle?: Excel.ShapeLineDashStyle | "Dash" | "DashDot" | "DashDotDot" | "LongDash" | "LongDashDot" | "RoundDot" | "Solid" | "SquareDot" | "LongDashDotDot" | "SystemDash" | "SystemDot" | "SystemDashDot"; /** * - * Represents the line style of the shape object. Returns null when line is not visible or has mixed line visible property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55323,7 +56669,7 @@ declare namespace Excel { style?: Excel.ShapeLineStyle | "Single" | "ThickBetweenThin" | "ThickThin" | "ThinThick" | "ThinThin"; /** * - * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has mixed line transparency property (e.g. group type of shape). + * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has inconsistent transparencies. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55331,7 +56677,7 @@ declare namespace Excel { transparency?: number; /** * - * Represents whether the line formatting of a shape element is visible. Returns null when the shape has mixed line visible property (e.g. group type of shape). + * Represents whether or not the line formatting of a shape element is visible. Returns null when the shape has inconsistent visibilities. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55339,7 +56685,7 @@ declare namespace Excel { visible?: boolean; /** * - * Represents weight of the line, in points. Returns null when the line is not visible or has mixed line weight property (e.g. group type of shape). + * Represents the weight of the line, in points. Returns null when the line is not visible or there are inconsistent line weights. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55350,12 +56696,12 @@ declare namespace Excel { interface TextFrameData { /** * - * Gets or sets the auto sizing settings for the text frame. A text frame can be set to auto size the text to fit the text frame, or auto size the text frame to fit the text, or without auto sizing. + * Gets or sets the automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - autoSize?: Excel.ShapeAutoSize | "AutoSizeNone" | "AutoSizeTextToFitShape" | "AutoSizeShapeToFitText" | "AutoSizeMixed"; + autoSizeSetting?: Excel.ShapeAutoSize | "AutoSizeNone" | "AutoSizeTextToFitShape" | "AutoSizeShapeToFitText" | "AutoSizeMixed"; /** * * Represents the bottom margin, in points, of the text frame. @@ -55366,7 +56712,7 @@ declare namespace Excel { bottomMargin?: number; /** * - * Specifies whether the TextFrame contains text. + * Specifies whether the text frame contains text. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55374,20 +56720,20 @@ declare namespace Excel { hasText?: boolean; /** * - * Represents the horizontal alignment of the text frame. + * Represents the horizontal alignment of the text frame. See Excel.ShapeTextHorizontalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - horizontalAlignment?: Excel.ShapeTextHorizontalAlignType | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed" | "ShapeTextHorizontalAlignType_MaxEnumIDs"; + horizontalAlignment?: Excel.ShapeTextHorizontalAlignment | "Left" | "Center" | "Right" | "Justify" | "JustifyLow" | "Distributed" | "ThaiDistributed"; /** * - * Represents the horizontal overflow type of the text frame. + * Represents the horizontal overflow behavior of the text frame. See Excel.ShapeTextHorizontalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - horizontalOverflow?: Excel.ShapeTextHorzOverflowType | "Overflow" | "Clip" | "ShapeTextHorzOverflowType_MaxEnumIDs"; + horizontalOverflow?: Excel.ShapeTextHorizontalOverflow | "Overflow" | "Clip"; /** * * Represents the left margin, in points, of the text frame. @@ -55398,20 +56744,20 @@ declare namespace Excel { leftMargin?: number; /** * - * Represents the text orientation of the text frame. + * Represents the text orientation of the text frame. See Excel.ShapeTextOrientation for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - orientation?: Excel.ShapeTextOrientationType | "Horizontal" | "Vertical" | "Vertical270" | "WordArtVertical" | "EastAsianVertical" | "MongolianVertical" | "WordArtVerticalRTL" | "ShapeTextOrientationType_MaxEnumIDs"; + orientation?: Excel.ShapeTextOrientation | "Horizontal" | "Vertical" | "Vertical270" | "WordArtVertical" | "EastAsianVertical" | "MongolianVertical" | "WordArtVerticalRTL"; /** * - * Represents the reading order of the text frame, RTL or LTR. + * Represents the reading order of the text frame, either left-to-right or right-to-left. See Excel.ShapeTextReadingOrder for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - readingOrder?: Excel.ShapeTextReadingOrder | "LTR" | "RTL"; + readingOrder?: Excel.ShapeTextReadingOrder | "LeftToRight" | "RightToLeft"; /** * * Represents the right margin, in points, of the text frame. @@ -55430,20 +56776,20 @@ declare namespace Excel { topMargin?: number; /** * - * Represents the vertical alignment of the text frame. + * Represents the vertical alignment of the text frame. See Excel.ShapeTextVerticalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - verticalAlignment?: Excel.ShapeTextVerticalAlignType | "Top" | "Middle" | "Bottom" | "Justified" | "Distributed" | "ShapeTextVerticalAlignType_MaxEnumIDs"; + verticalAlignment?: Excel.ShapeTextVerticalAlignment | "Top" | "Middle" | "Bottom" | "Justified" | "Distributed"; /** * - * Represents the vertical overflow type of the text frame. + * Represents the vertical overflow behavior of the text frame. See Excel.ShapeTextVerticalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - verticalOverflow?: Excel.ShapeTextVertOverflowType | "Overflow" | "Ellipsis" | "Clip" | "ShapeTextVertOverflowType_MaxEnumIDs"; + verticalOverflow?: Excel.ShapeTextVerticalOverflow | "Overflow" | "Ellipsis" | "Clip"; } /** An interface describing the data returned by calling "textRange.toJSON()". */ interface TextRangeData { @@ -55476,7 +56822,7 @@ declare namespace Excel { bold?: boolean; /** * - * HTML color code representation of the text color. E.g. #FF0000 represents Red. Returns null if the TextRange includes text fragments with different colors. + * The HTML color code representation of the text color (e.g. "#FF0000" represents red). Returns null if the TextRange includes text fragments with different colors. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55484,7 +56830,7 @@ declare namespace Excel { color?: string; /** * - * Represents the italic status of font. Return null if the TextRange includes both italic and non-italic text fragments. + * Represents the italic status of font. Returns null if the TextRange includes both italic and non-italic text fragments. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55492,7 +56838,7 @@ declare namespace Excel { italic?: boolean; /** * - * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, represents corresponding font name; otherwise represents Latin font name. + * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55500,7 +56846,7 @@ declare namespace Excel { name?: string; /** * - * Represents font size in points (e.g. 11). Return null if the TextRange includes text fragments with different font sizes. + * Represents font size in points (e.g. 11). Returns null if the TextRange includes text fragments with different font sizes. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55508,7 +56854,7 @@ declare namespace Excel { size?: number; /** * - * Type of underline applied to the font. Return null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. + * Type of underline applied to the font. Returns null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55825,7 +57171,7 @@ declare namespace Excel { tables?: Excel.Interfaces.TableCollectionLoadOptions; /** * - * True if the workbook is in auto save mode. + * Specifies whether or not the workbook is in autosave mode. Read-Only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55850,8 +57196,8 @@ declare namespace Excel { chartDataPointTrack?: boolean; /** * - * True if no changes have been made to the specified workbook since it was last saved. - You can set this property to True if you want to close a modified workbook without either saving it or being prompted to save it. + * Specifies whether or not changes have been made since the workbook was last saved. + You can set this property to true if you want to close a modified workbook without either saving it or being prompted to save it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -55866,7 +57212,7 @@ declare namespace Excel { name?: boolean; /** * - * True if the workbook has ever been saved locally or online. + * Specifies whether or not the workbook has ever been saved locally or online. Read-Only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63091,6 +64437,214 @@ declare namespace Excel { */ wrapText?: boolean; } + /** + * + * Represents a collection of TableStyles. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface TableStyleCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the name of the TableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: True means that this TableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** + * + * Represents a TableStyle, which defines the style elements by region of the Table. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface TableStyleLoadOptions { + $all?: boolean; + /** + * + * Gets the name of the TableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * True means that this TableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** + * + * Represents a collection of PivotTable styles. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface PivotTableStyleCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the name of the PivotTableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: True means that this PivotTableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** + * + * Represents a PivotTable Style, which defines style elements by PivotTable region. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface PivotTableStyleLoadOptions { + $all?: boolean; + /** + * + * Gets the name of the PivotTableStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * True means that this PivotTableStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** + * + * Represents a collection of SlicerStyle objects. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface SlicerStyleCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the name of the SlicerStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: True means that this SlicerStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** + * + * Represents a Slicer Style, which defines style elements by region of the slicer. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface SlicerStyleLoadOptions { + $all?: boolean; + /** + * + * Gets the name of the SlicerStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * True means that this SlicerStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** + * + * Represents a collection of TimelineStyles. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface TimelineStyleCollectionLoadOptions { + $all?: boolean; + /** + * + * For EACH ITEM in the collection: Gets the name of the TimelineStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * For EACH ITEM in the collection: True means that this TimelineStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } + /** + * + * Represents a Timeline style, which defines style elements by region in the Timeline. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + interface TimelineStyleLoadOptions { + $all?: boolean; + /** + * + * Gets the name of the TimelineStyle. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + name?: boolean; + /** + * + * True means that this TimelineStyle object is read-only. Read-only. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + readOnly?: boolean; + } /** * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63647,12 +65201,36 @@ declare namespace Excel { $all?: boolean; /** * - * For EACH ITEM in the collection: Get/Set the content. + * For EACH ITEM in the collection: Get author email of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorEmail?: boolean; + /** + * + * For EACH ITEM in the collection: Get author name of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorName?: boolean; + /** + * + * For EACH ITEM in the collection: Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content?: boolean; + /** + * + * For EACH ITEM in the collection: Get creation time of the comment. Will return null if the comment is converted from note, as in this case, the comment will not has created date. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + creationDate?: boolean; /** * * For EACH ITEM in the collection: Represents the comment identifier. Read-only. @@ -63681,12 +65259,36 @@ declare namespace Excel { $all?: boolean; /** * - * Get/Set the content. + * Get author email of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorEmail?: boolean; + /** + * + * Get author name of the comment. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorName?: boolean; + /** + * + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content?: boolean; + /** + * + * Get creation time of the comment. Will return null if the comment is converted from note, as in this case, the comment will not has created date. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + creationDate?: boolean; /** * * Represents the comment identifier. Read-only. @@ -63715,12 +65317,36 @@ declare namespace Excel { $all?: boolean; /** * - * For EACH ITEM in the collection: Get/Set the content. + * For EACH ITEM in the collection: Get author email of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorEmail?: boolean; + /** + * + * For EACH ITEM in the collection: Get author name of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorName?: boolean; + /** + * + * For EACH ITEM in the collection: Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content?: boolean; + /** + * + * For EACH ITEM in the collection: Get creation time of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + creationDate?: boolean; /** * * For EACH ITEM in the collection: Represents the comment reply identifier. Read-only. @@ -63749,12 +65375,36 @@ declare namespace Excel { $all?: boolean; /** * - * Get/Set the content. + * Get author email of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorEmail?: boolean; + /** + * + * Get author name of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + authorName?: boolean; + /** + * + * Get or set the content. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ content?: boolean; + /** + * + * Get creation time of the comment reply. + * + * [Api set: ExcelApi BETA (PREVIEW ONLY)] + * @beta + */ + creationDate?: boolean; /** * * Represents the comment reply identifier. Read-only. @@ -63774,7 +65424,7 @@ declare namespace Excel { } /** * - * Represents all the shapes in the worksheet. + * Represents a collection of all the shapes in the worksheet. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63783,7 +65433,7 @@ declare namespace Excel { $all?: boolean; /** * - * For EACH ITEM in the collection: Returns the fill formatting of the shape object. + * For EACH ITEM in the collection: Returns the fill formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63791,7 +65441,7 @@ declare namespace Excel { fill?: Excel.Interfaces.ShapeFillLoadOptions; /** * - * For EACH ITEM in the collection: Returns the geometric shape for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GeometricShape. + * For EACH ITEM in the collection: Returns the geometric shape associated with the shape. An error will be thrown if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63799,7 +65449,7 @@ declare namespace Excel { geometricShape?: Excel.Interfaces.GeometricShapeLoadOptions; /** * - * For EACH ITEM in the collection: Returns the shape group for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GroupShape. + * For EACH ITEM in the collection: Returns the shape group associated with the shape. An error will be thrown if the shape type is not "GroupShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63807,7 +65457,7 @@ declare namespace Excel { group?: Excel.Interfaces.ShapeGroupLoadOptions; /** * - * For EACH ITEM in the collection: Returns the image for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * For EACH ITEM in the collection: Returns the image associated with the shape. An error will be thrown if the shape type is not "Image". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63815,7 +65465,7 @@ declare namespace Excel { image?: Excel.Interfaces.ImageLoadOptions; /** * - * For EACH ITEM in the collection: Returns the line object for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * For EACH ITEM in the collection: Returns the line associated with the shape. An error will be thrown if the shape type is not "Line". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63823,7 +65473,7 @@ declare namespace Excel { line?: Excel.Interfaces.LineLoadOptions; /** * - * For EACH ITEM in the collection: Returns the line formatting of the shape object. + * For EACH ITEM in the collection: Returns the line formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63831,7 +65481,7 @@ declare namespace Excel { lineFormat?: Excel.Interfaces.ShapeLineFormatLoadOptions; /** * - * For EACH ITEM in the collection: Represents the parent group of the specified shape. + * For EACH ITEM in the collection: Represents the parent group of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63839,7 +65489,7 @@ declare namespace Excel { parentGroup?: Excel.Interfaces.ShapeLoadOptions; /** * - * For EACH ITEM in the collection: Returns the textFrame object of a shape. Read only. + * For EACH ITEM in the collection: Returns the text frame object of this shape. Read only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63847,7 +65497,7 @@ declare namespace Excel { textFrame?: Excel.Interfaces.TextFrameLoadOptions; /** * - * For EACH ITEM in the collection: Returns or sets the alternative descriptive text string for a Shape object when the object is saved to a Web page. + * For EACH ITEM in the collection: Returns or sets the alternative description text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63855,7 +65505,7 @@ declare namespace Excel { altTextDescription?: boolean; /** * - * For EACH ITEM in the collection: Returns or sets the alternative title text string for a Shape object when the object is saved to a Web page. + * For EACH ITEM in the collection: Returns or sets the alternative title text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63863,7 +65513,7 @@ declare namespace Excel { altTextTitle?: boolean; /** * - * For EACH ITEM in the collection: Returns the number of connection sites on the specified shape. Read-only. + * For EACH ITEM in the collection: Returns the number of connection sites on this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63871,7 +65521,7 @@ declare namespace Excel { connectionSiteCount?: boolean; /** * - * For EACH ITEM in the collection: Represents the geometric shape type of the specified shape. See Excel.GeometricShapeType for detail. Returns null if the shape is not geometric, for example, get GeometricShapeType of a line or a chart will return null. + * For EACH ITEM in the collection: Represents the geometric shape type of this geometric shape. See Excel.GeometricShapeType for details. Returns null if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63880,7 +65530,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Represents the height, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63896,8 +65546,8 @@ declare namespace Excel { id?: boolean; /** * - * For EACH ITEM in the collection: The distance, in points, from the left side of the shape to the left of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * For EACH ITEM in the collection: The distance, in points, from the left side of the shape to the left side of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63905,7 +65555,7 @@ declare namespace Excel { left?: boolean; /** * - * For EACH ITEM in the collection: Represents the level of the specified shape. Level 0 means the shape is not part of any group, level 1 means the shape is part of a top-level group, etc. + * For EACH ITEM in the collection: Represents the level of the specified shape. For example, a level of 0 means that the shape is not part of any groups, a level of 1 means the shape is part of a top-level group, and a level of 2 means the shape is part of a sub-group of the top level. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63913,7 +65563,7 @@ declare namespace Excel { level?: boolean; /** * - * For EACH ITEM in the collection: Represents if the aspect ratio locked, in boolean, of the shape. + * For EACH ITEM in the collection: Specifies whether or not the aspect ratio of this shape is locked. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63929,7 +65579,7 @@ declare namespace Excel { name?: boolean; /** * - * For EACH ITEM in the collection: Represents the placment, value that represents the way the object is attached to the cells below it. + * For EACH ITEM in the collection: Represents how the object is attached to the cells below it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63945,8 +65595,8 @@ declare namespace Excel { rotation?: boolean; /** * - * For EACH ITEM in the collection: The distance, in points, from the top edge of the shape to the top of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * For EACH ITEM in the collection: The distance, in points, from the top edge of the shape to the top edge of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63954,7 +65604,7 @@ declare namespace Excel { top?: boolean; /** * - * For EACH ITEM in the collection: Returns the type of the specified shape. Read-only. See Excel.ShapeType for detail. + * For EACH ITEM in the collection: Returns the type of this shape. See Excel.ShapeType for details. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63962,7 +65612,7 @@ declare namespace Excel { type?: boolean; /** * - * For EACH ITEM in the collection: Represents the visibility, in boolean, of the specified shape. + * For EACH ITEM in the collection: Represents the visibility of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63971,7 +65621,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Represents the width, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63979,7 +65629,7 @@ declare namespace Excel { width?: boolean; /** * - * For EACH ITEM in the collection: Returns the position of the specified shape in the z-order, the very bottom shape's z-order value is 0. Read-only. + * For EACH ITEM in the collection: Returns the position of the specified shape in the z-order, with 0 representing the bottom of the order stack. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63988,7 +65638,7 @@ declare namespace Excel { } /** * - * Represents a generic shape object in the worksheet. + * Represents a generic shape object in the worksheet. A shape could be a geometric shape, a line, a group of shapes, etc. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -63997,7 +65647,7 @@ declare namespace Excel { $all?: boolean; /** * - * Returns the fill formatting of the shape object. + * Returns the fill formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64005,7 +65655,7 @@ declare namespace Excel { fill?: Excel.Interfaces.ShapeFillLoadOptions; /** * - * Returns the geometric shape for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GeometricShape. + * Returns the geometric shape associated with the shape. An error will be thrown if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64013,7 +65663,7 @@ declare namespace Excel { geometricShape?: Excel.Interfaces.GeometricShapeLoadOptions; /** * - * Returns the shape group for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GroupShape. + * Returns the shape group associated with the shape. An error will be thrown if the shape type is not "GroupShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64021,7 +65671,7 @@ declare namespace Excel { group?: Excel.Interfaces.ShapeGroupLoadOptions; /** * - * Returns the image for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * Returns the image associated with the shape. An error will be thrown if the shape type is not "Image". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64029,7 +65679,7 @@ declare namespace Excel { image?: Excel.Interfaces.ImageLoadOptions; /** * - * Returns the line object for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * Returns the line associated with the shape. An error will be thrown if the shape type is not "Line". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64037,7 +65687,7 @@ declare namespace Excel { line?: Excel.Interfaces.LineLoadOptions; /** * - * Returns the line formatting of the shape object. + * Returns the line formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64045,7 +65695,7 @@ declare namespace Excel { lineFormat?: Excel.Interfaces.ShapeLineFormatLoadOptions; /** * - * Represents the parent group of the specified shape. + * Represents the parent group of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64053,7 +65703,7 @@ declare namespace Excel { parentGroup?: Excel.Interfaces.ShapeLoadOptions; /** * - * Returns the textFrame object of a shape. Read only. + * Returns the text frame object of this shape. Read only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64061,7 +65711,7 @@ declare namespace Excel { textFrame?: Excel.Interfaces.TextFrameLoadOptions; /** * - * Returns or sets the alternative descriptive text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative description text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64069,7 +65719,7 @@ declare namespace Excel { altTextDescription?: boolean; /** * - * Returns or sets the alternative title text string for a Shape object when the object is saved to a Web page. + * Returns or sets the alternative title text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64077,7 +65727,7 @@ declare namespace Excel { altTextTitle?: boolean; /** * - * Returns the number of connection sites on the specified shape. Read-only. + * Returns the number of connection sites on this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64085,7 +65735,7 @@ declare namespace Excel { connectionSiteCount?: boolean; /** * - * Represents the geometric shape type of the specified shape. See Excel.GeometricShapeType for detail. Returns null if the shape is not geometric, for example, get GeometricShapeType of a line or a chart will return null. + * Represents the geometric shape type of this geometric shape. See Excel.GeometricShapeType for details. Returns null if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64094,7 +65744,7 @@ declare namespace Excel { /** * * Represents the height, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64110,8 +65760,8 @@ declare namespace Excel { id?: boolean; /** * - * The distance, in points, from the left side of the shape to the left of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the left side of the shape to the left side of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64119,7 +65769,7 @@ declare namespace Excel { left?: boolean; /** * - * Represents the level of the specified shape. Level 0 means the shape is not part of any group, level 1 means the shape is part of a top-level group, etc. + * Represents the level of the specified shape. For example, a level of 0 means that the shape is not part of any groups, a level of 1 means the shape is part of a top-level group, and a level of 2 means the shape is part of a sub-group of the top level. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64127,7 +65777,7 @@ declare namespace Excel { level?: boolean; /** * - * Represents if the aspect ratio locked, in boolean, of the shape. + * Specifies whether or not the aspect ratio of this shape is locked. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64143,7 +65793,7 @@ declare namespace Excel { name?: boolean; /** * - * Represents the placment, value that represents the way the object is attached to the cells below it. + * Represents how the object is attached to the cells below it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64159,8 +65809,8 @@ declare namespace Excel { rotation?: boolean; /** * - * The distance, in points, from the top edge of the shape to the top of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * The distance, in points, from the top edge of the shape to the top edge of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64168,7 +65818,7 @@ declare namespace Excel { top?: boolean; /** * - * Returns the type of the specified shape. Read-only. See Excel.ShapeType for detail. + * Returns the type of this shape. See Excel.ShapeType for details. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64176,7 +65826,7 @@ declare namespace Excel { type?: boolean; /** * - * Represents the visibility, in boolean, of the specified shape. + * Represents the visibility of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64185,7 +65835,7 @@ declare namespace Excel { /** * * Represents the width, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64193,7 +65843,7 @@ declare namespace Excel { width?: boolean; /** * - * Returns the position of the specified shape in the z-order, the very bottom shape's z-order value is 0. Read-only. + * Returns the position of the specified shape in the z-order, with 0 representing the bottom of the order stack. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64202,7 +65852,7 @@ declare namespace Excel { } /** * - * Represents a geometric shape object inside a worksheet. A geometric shape can be a line, rectangle, block arrow, equation, flowchart, start, banner, callout or basic shape in Excel. + * Represents a geometric shape inside a worksheet. A geometric shape can be a rectangle, block arrow, equation symbol, flowchart item, star, banner, callout, or any other basic shape in Excel. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64211,7 +65861,7 @@ declare namespace Excel { $all?: boolean; /** * - * Returns the shape object for the geometric shape. + * Returns the Shape object for the geometric shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64219,7 +65869,7 @@ declare namespace Excel { shape?: Excel.Interfaces.ShapeLoadOptions; /** * - * Represents the shape identifier. Read-only. + * Returns the shape identifier. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64228,7 +65878,7 @@ declare namespace Excel { } /** * - * Represents an image object in the worksheet. + * Represents an image in the worksheet. To get the corresponding Shape object, use Image.shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64237,7 +65887,7 @@ declare namespace Excel { $all?: boolean; /** * - * Returns the shape object for the image. + * Returns the Shape object associated with the image. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64253,7 +65903,7 @@ declare namespace Excel { id?: boolean; /** * - * Returns the format for the image. Read-only. + * Returns the format of the image. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64262,7 +65912,7 @@ declare namespace Excel { } /** * - * Represents a shape group object inside a worksheet. + * Represents a shape group inside a worksheet. To get the corresponding Shape object, use `ShapeGroup.shape`. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64271,7 +65921,7 @@ declare namespace Excel { $all?: boolean; /** * - * Returns the shape object for the group. + * Returns the Shape object associated with the group. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64288,7 +65938,7 @@ declare namespace Excel { } /** * - * Represents a shape collection inside a shape group. + * Represents the shape collection inside a shape group. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64297,7 +65947,7 @@ declare namespace Excel { $all?: boolean; /** * - * For EACH ITEM in the collection: Returns the fill formatting of the shape object. + * For EACH ITEM in the collection: Returns the fill formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64305,7 +65955,7 @@ declare namespace Excel { fill?: Excel.Interfaces.ShapeFillLoadOptions; /** * - * For EACH ITEM in the collection: Returns the geometric shape for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GeometricShape. + * For EACH ITEM in the collection: Returns the geometric shape associated with the shape. An error will be thrown if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64313,7 +65963,7 @@ declare namespace Excel { geometricShape?: Excel.Interfaces.GeometricShapeLoadOptions; /** * - * For EACH ITEM in the collection: Returns the shape group for the shape object. Error will be thrown, if the shape object is other shape type (Like, Image, SmartArt, etc.) rather than GroupShape. + * For EACH ITEM in the collection: Returns the shape group associated with the shape. An error will be thrown if the shape type is not "GroupShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64321,7 +65971,7 @@ declare namespace Excel { group?: Excel.Interfaces.ShapeGroupLoadOptions; /** * - * For EACH ITEM in the collection: Returns the image for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * For EACH ITEM in the collection: Returns the image associated with the shape. An error will be thrown if the shape type is not "Image". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64329,7 +65979,7 @@ declare namespace Excel { image?: Excel.Interfaces.ImageLoadOptions; /** * - * For EACH ITEM in the collection: Returns the line object for the shape object. Error will be thrown, if the shape object is other shape type (Like, GeometricShape, SmartArt, etc.) rather than Image. + * For EACH ITEM in the collection: Returns the line associated with the shape. An error will be thrown if the shape type is not "Line". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64337,7 +65987,7 @@ declare namespace Excel { line?: Excel.Interfaces.LineLoadOptions; /** * - * For EACH ITEM in the collection: Returns the line formatting of the shape object. + * For EACH ITEM in the collection: Returns the line formatting of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64345,7 +65995,7 @@ declare namespace Excel { lineFormat?: Excel.Interfaces.ShapeLineFormatLoadOptions; /** * - * For EACH ITEM in the collection: Represents the parent group of the specified shape. + * For EACH ITEM in the collection: Represents the parent group of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64353,7 +66003,7 @@ declare namespace Excel { parentGroup?: Excel.Interfaces.ShapeLoadOptions; /** * - * For EACH ITEM in the collection: Returns the textFrame object of a shape. Read only. + * For EACH ITEM in the collection: Returns the text frame object of this shape. Read only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64361,7 +66011,7 @@ declare namespace Excel { textFrame?: Excel.Interfaces.TextFrameLoadOptions; /** * - * For EACH ITEM in the collection: Returns or sets the alternative descriptive text string for a Shape object when the object is saved to a Web page. + * For EACH ITEM in the collection: Returns or sets the alternative description text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64369,7 +66019,7 @@ declare namespace Excel { altTextDescription?: boolean; /** * - * For EACH ITEM in the collection: Returns or sets the alternative title text string for a Shape object when the object is saved to a Web page. + * For EACH ITEM in the collection: Returns or sets the alternative title text for a Shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64377,7 +66027,7 @@ declare namespace Excel { altTextTitle?: boolean; /** * - * For EACH ITEM in the collection: Returns the number of connection sites on the specified shape. Read-only. + * For EACH ITEM in the collection: Returns the number of connection sites on this shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64385,7 +66035,7 @@ declare namespace Excel { connectionSiteCount?: boolean; /** * - * For EACH ITEM in the collection: Represents the geometric shape type of the specified shape. See Excel.GeometricShapeType for detail. Returns null if the shape is not geometric, for example, get GeometricShapeType of a line or a chart will return null. + * For EACH ITEM in the collection: Represents the geometric shape type of this geometric shape. See Excel.GeometricShapeType for details. Returns null if the shape type is not "GeometricShape". * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64394,7 +66044,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Represents the height, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64410,8 +66060,8 @@ declare namespace Excel { id?: boolean; /** * - * For EACH ITEM in the collection: The distance, in points, from the left side of the shape to the left of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * For EACH ITEM in the collection: The distance, in points, from the left side of the shape to the left side of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64419,7 +66069,7 @@ declare namespace Excel { left?: boolean; /** * - * For EACH ITEM in the collection: Represents the level of the specified shape. Level 0 means the shape is not part of any group, level 1 means the shape is part of a top-level group, etc. + * For EACH ITEM in the collection: Represents the level of the specified shape. For example, a level of 0 means that the shape is not part of any groups, a level of 1 means the shape is part of a top-level group, and a level of 2 means the shape is part of a sub-group of the top level. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64427,7 +66077,7 @@ declare namespace Excel { level?: boolean; /** * - * For EACH ITEM in the collection: Represents if the aspect ratio locked, in boolean, of the shape. + * For EACH ITEM in the collection: Specifies whether or not the aspect ratio of this shape is locked. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64443,7 +66093,7 @@ declare namespace Excel { name?: boolean; /** * - * For EACH ITEM in the collection: Represents the placment, value that represents the way the object is attached to the cells below it. + * For EACH ITEM in the collection: Represents how the object is attached to the cells below it. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64459,8 +66109,8 @@ declare namespace Excel { rotation?: boolean; /** * - * For EACH ITEM in the collection: The distance, in points, from the top edge of the shape to the top of the worksheet. - Throws an invalid argument exception when set with negative value as input. + * For EACH ITEM in the collection: The distance, in points, from the top edge of the shape to the top edge of the worksheet. + Throws an invalid argument exception when set with a negative value as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64468,7 +66118,7 @@ declare namespace Excel { top?: boolean; /** * - * For EACH ITEM in the collection: Returns the type of the specified shape. Read-only. See Excel.ShapeType for detail. + * For EACH ITEM in the collection: Returns the type of this shape. See Excel.ShapeType for details. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64476,7 +66126,7 @@ declare namespace Excel { type?: boolean; /** * - * For EACH ITEM in the collection: Represents the visibility, in boolean, of the specified shape. + * For EACH ITEM in the collection: Represents the visibility of this shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64485,7 +66135,7 @@ declare namespace Excel { /** * * For EACH ITEM in the collection: Represents the width, in points, of the shape. - Throws an invalid argument exception when set with negative value or zero as input. + Throws an invalid argument exception when set with a negative value or zero as input. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64493,7 +66143,7 @@ declare namespace Excel { width?: boolean; /** * - * For EACH ITEM in the collection: Returns the position of the specified shape in the z-order, the very bottom shape's z-order value is 0. Read-only. + * For EACH ITEM in the collection: Returns the position of the specified shape in the z-order, with 0 representing the bottom of the order stack. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64502,7 +66152,7 @@ declare namespace Excel { } /** * - * Represents a Line object inside a worksheet. + * Represents a line inside a worksheet. To get the corresponding Shape object, use `Line.shape`. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64511,7 +66161,7 @@ declare namespace Excel { $all?: boolean; /** * - * Represents the shape object that the beginning of the specified line is attached to. + * Represents the shape to which the beginning of the specified line is attached. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64519,7 +66169,7 @@ declare namespace Excel { beginConnectedShape?: Excel.Interfaces.ShapeLoadOptions; /** * - * Represents the shape object that the end of the specified line is attached to. + * Represents the shape to which the end of the specified line is attached. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64527,7 +66177,7 @@ declare namespace Excel { endConnectedShape?: Excel.Interfaces.ShapeLoadOptions; /** * - * Returns the shape object for the line. + * Returns the Shape object associated with the line. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64540,7 +66190,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadLength?: boolean; + beginArrowheadLength?: boolean; /** * * Represents the style of the arrowhead at the beginning of the specified line. @@ -64548,7 +66198,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadStyle?: boolean; + beginArrowheadStyle?: boolean; /** * * Represents the width of the arrowhead at the beginning of the specified line. @@ -64556,10 +66206,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - beginArrowHeadWidth?: boolean; + beginArrowheadWidth?: boolean; /** * - * Represents an integer that specifies the connection site that the beginning of a connector is connected to. Read-only. Returns null when the beginning of the line is not attached to any shape. + * Represents the connection site to which the beginning of a connector is connected. Read-only. Returns null when the beginning of the line is not attached to any shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64572,7 +66222,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadLength?: boolean; + endArrowheadLength?: boolean; /** * * Represents the style of the arrowhead at the end of the specified line. @@ -64580,7 +66230,7 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadStyle?: boolean; + endArrowheadStyle?: boolean; /** * * Represents the width of the arrowhead at the end of the specified line. @@ -64588,10 +66238,10 @@ declare namespace Excel { * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - endArrowHeadWidth?: boolean; + endArrowheadWidth?: boolean; /** * - * Represents an integer that specifies the connection site that the end of a connector is connected to. Read-only. Returns null when the end of the line is not attached to any shape. + * Represents the connection site to which the end of a connector is connected. Read-only. Returns null when the end of the line is not attached to any shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64607,7 +66257,7 @@ declare namespace Excel { id?: boolean; /** * - * Represents whether the beginning of the specified line is connected to a shape. Read-only. + * Specifies whether or not the beginning of the specified line is connected to a shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64615,7 +66265,7 @@ declare namespace Excel { isBeginConnected?: boolean; /** * - * Represents whether the end of the specified line is connected to a shape. Read-only. + * Specifies whether or not the end of the specified line is connected to a shape. Read-only. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64632,7 +66282,7 @@ declare namespace Excel { } /** * - * Represents the fill formatting for a shape object. + * Represents the fill formatting of a shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64641,15 +66291,15 @@ declare namespace Excel { $all?: boolean; /** * - * Represents the shape fill fore color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") + * Represents the shape fill foreground color in HTML color format, of the form #RRGGBB (e.g. "FFA500") or as a named HTML color (e.g. "orange") * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - foreColor?: boolean; + foregroundColor?: boolean; /** * - * Returns or sets the degree of transparency of the specified fill as a value from 0.0 (opaque) through 1.0 (clear). For API not supported shape types or special fill type with inconsistent transparencies, return null. For example, gradient fill type could have inconsistent transparencies. + * Returns or sets the transparency percentage of the fill as a value from 0.0 (opaque) through 1.0 (clear). Returns null if the shape type does not support transparency or the shape fill has inconsistent transparency, such as with a gradient fill type. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64657,7 +66307,7 @@ declare namespace Excel { transparency?: boolean; /** * - * Returns the fill type of the shape. Read-only. See Excel.ShapeFillType for detail. + * Returns the fill type of the shape. Read-only. See Excel.ShapeFillType for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64666,7 +66316,7 @@ declare namespace Excel { } /** * - * Represents the line formatting for the shape object. For picture and geometric shape, line formatting represents the border of shape object. + * Represents the line formatting for the shape object. For images and geometric shapes, line formatting represents the border of the shape. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64683,7 +66333,7 @@ declare namespace Excel { color?: boolean; /** * - * Represents the line style of the shape. Returns null when line is not visible or has mixed line dash style property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent dash styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64691,7 +66341,7 @@ declare namespace Excel { dashStyle?: boolean; /** * - * Represents the line style of the shape object. Returns null when line is not visible or has mixed line visible property (e.g. group type of shape). See Excel.ShapeLineStyle for details. + * Represents the line style of the shape. Returns null when the line is not visible or there are inconsistent styles. See Excel.ShapeLineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64699,7 +66349,7 @@ declare namespace Excel { style?: boolean; /** * - * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has mixed line transparency property (e.g. group type of shape). + * Represents the degree of transparency of the specified line as a value from 0.0 (opaque) through 1.0 (clear). Returns null when the shape has inconsistent transparencies. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64707,7 +66357,7 @@ declare namespace Excel { transparency?: boolean; /** * - * Represents whether the line formatting of a shape element is visible. Returns null when the shape has mixed line visible property (e.g. group type of shape). + * Represents whether or not the line formatting of a shape element is visible. Returns null when the shape has inconsistent visibilities. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64715,7 +66365,7 @@ declare namespace Excel { visible?: boolean; /** * - * Represents weight of the line, in points. Returns null when the line is not visible or has mixed line weight property (e.g. group type of shape). + * Represents the weight of the line, in points. Returns null when the line is not visible or there are inconsistent line weights. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64724,7 +66374,7 @@ declare namespace Excel { } /** * - * Represents the text frame for a shape object. + * Represents the text frame of a shape object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64733,7 +66383,7 @@ declare namespace Excel { $all?: boolean; /** * - * Represents the text range in the text frame. + * Represents the text that is attached to a shape in the text frame, and properties and methods for manipulating the text. See Excel.TextRange for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64741,12 +66391,12 @@ declare namespace Excel { textRange?: Excel.Interfaces.TextRangeLoadOptions; /** * - * Gets or sets the auto sizing settings for the text frame. A text frame can be set to auto size the text to fit the text frame, or auto size the text frame to fit the text, or without auto sizing. + * Gets or sets the automatic sizing settings for the text frame. A text frame can be set to automatically fit the text to the text frame, to automatically fit the text frame to the text, or not perform any automatic sizing. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ - autoSize?: boolean; + autoSizeSetting?: boolean; /** * * Represents the bottom margin, in points, of the text frame. @@ -64757,7 +66407,7 @@ declare namespace Excel { bottomMargin?: boolean; /** * - * Specifies whether the TextFrame contains text. + * Specifies whether the text frame contains text. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64765,7 +66415,7 @@ declare namespace Excel { hasText?: boolean; /** * - * Represents the horizontal alignment of the text frame. + * Represents the horizontal alignment of the text frame. See Excel.ShapeTextHorizontalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64773,7 +66423,7 @@ declare namespace Excel { horizontalAlignment?: boolean; /** * - * Represents the horizontal overflow type of the text frame. + * Represents the horizontal overflow behavior of the text frame. See Excel.ShapeTextHorizontalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64789,7 +66439,7 @@ declare namespace Excel { leftMargin?: boolean; /** * - * Represents the text orientation of the text frame. + * Represents the text orientation of the text frame. See Excel.ShapeTextOrientation for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64797,7 +66447,7 @@ declare namespace Excel { orientation?: boolean; /** * - * Represents the reading order of the text frame, RTL or LTR. + * Represents the reading order of the text frame, either left-to-right or right-to-left. See Excel.ShapeTextReadingOrder for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64821,7 +66471,7 @@ declare namespace Excel { topMargin?: boolean; /** * - * Represents the vertical alignment of the text frame. + * Represents the vertical alignment of the text frame. See Excel.ShapeTextVerticalAlignment for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64829,7 +66479,7 @@ declare namespace Excel { verticalAlignment?: boolean; /** * - * Represents the vertical overflow type of the text frame. + * Represents the vertical overflow behavior of the text frame. See Excel.ShapeTextVerticalOverflow for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64837,6 +66487,9 @@ declare namespace Excel { verticalOverflow?: boolean; } /** + * + * Contains the text that is attached to a shape, in addition to properties and methods for manipulating the text. + * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta */ @@ -64861,7 +66514,7 @@ declare namespace Excel { } /** * - * This object represents the font attributes (font name, font size, color, etc.) for a TextRange in the Shape. + * Represents the font attributes, such as font name, font size, and color, for a shape's TextRange object. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64878,7 +66531,7 @@ declare namespace Excel { bold?: boolean; /** * - * HTML color code representation of the text color. E.g. #FF0000 represents Red. Returns null if the TextRange includes text fragments with different colors. + * The HTML color code representation of the text color (e.g. "#FF0000" represents red). Returns null if the TextRange includes text fragments with different colors. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64886,7 +66539,7 @@ declare namespace Excel { color?: boolean; /** * - * Represents the italic status of font. Return null if the TextRange includes both italic and non-italic text fragments. + * Represents the italic status of font. Returns null if the TextRange includes both italic and non-italic text fragments. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64894,7 +66547,7 @@ declare namespace Excel { italic?: boolean; /** * - * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, represents corresponding font name; otherwise represents Latin font name. + * Represents font name (e.g. "Calibri"). If the text is Complex Script or East Asian language, this is the corresponding font name; otherwise it is the Latin font name. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64902,7 +66555,7 @@ declare namespace Excel { name?: boolean; /** * - * Represents font size in points (e.g. 11). Return null if the TextRange includes text fragments with different font sizes. + * Represents font size in points (e.g. 11). Returns null if the TextRange includes text fragments with different font sizes. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -64910,7 +66563,7 @@ declare namespace Excel { size?: boolean; /** * - * Type of underline applied to the font. Return null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. + * Type of underline applied to the font. Returns null if the TextRange includes text fragments with different underline styles. See Excel.ShapeFontUnderlineStyle for details. * * [Api set: ExcelApi BETA (PREVIEW ONLY)] * @beta @@ -65291,6 +66944,10 @@ declare namespace Word { * Create a new instance of Word.Application object */ static newObject(context: OfficeExtension.ClientRequestContext): Word.Application; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Application object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ApplicationData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): { [key: string]: string; }; @@ -65705,6 +67362,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Body; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Body object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.BodyData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.BodyData; } /** @@ -65844,7 +67505,7 @@ declare namespace Word { readonly id: number; /** * - * Gets the placeholder text of the content control. Dimmed text will be displayed when the content control is empty. + * Gets or sets the placeholder text of the content control. Dimmed text will be displayed when the content control is empty. * * [Api set: WordApi 1.1] */ @@ -66079,7 +67740,7 @@ declare namespace Word { insertOoxml(ooxml: string, insertLocation: "Before" | "After" | "Start" | "End" | "Replace"): Word.Range; /** * - * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. This method is only supported if the content control encompasses one or more paragraphs in entirety. + * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * @@ -66089,7 +67750,7 @@ declare namespace Word { insertParagraph(paragraphText: string, insertLocation: Word.InsertLocation): Word.Paragraph; /** * - * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. This method is only supported if the content control encompasses one or more paragraphs in entirety. + * Inserts a paragraph at the specified location. The insertLocation value can be 'Start', 'End', 'Before', or 'After'. * * [Api set: WordApi 1.1] * @@ -66215,9 +67876,9 @@ declare namespace Word { * Occurs when data within the content control are changed. To get the new text, load this content control in the handler. To get the old text, do not load it. * * [Api set: WordApi BETA (PREVIEW ONLY)] - * @beta * * @eventproperty + * @beta */ readonly onDataChanged: OfficeExtension.EventHandlers; /** @@ -66225,9 +67886,9 @@ declare namespace Word { * Occurs when the content control is deleted. Do not load this content control in the handler, otherwise you won't be able to get its original properties. * * [Api set: WordApi BETA (PREVIEW ONLY)] - * @beta * * @eventproperty + * @beta */ readonly onDeleted: OfficeExtension.EventHandlers; /** @@ -66235,9 +67896,9 @@ declare namespace Word { * Occurs when selection within the content control is changed. * * [Api set: WordApi BETA (PREVIEW ONLY)] - * @beta * * @eventproperty + * @beta */ readonly onSelectionChanged: OfficeExtension.EventHandlers; /** @@ -66248,6 +67909,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.ContentControl; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.ContentControl object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ContentControlData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.ContentControlData; } /** @@ -66355,6 +68020,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.ContentControlCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.ContentControlCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ContentControlCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.ContentControlCollectionData; } /** @@ -66437,6 +68106,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.CustomProperty; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.CustomProperty object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.CustomPropertyData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.CustomPropertyData; } /** @@ -66518,6 +68191,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.CustomPropertyCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.CustomPropertyCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.CustomPropertyCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.CustomPropertyCollectionData; } /** @@ -66687,6 +68364,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.CustomXmlPart; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.CustomXmlPart object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.CustomXmlPartData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.CustomXmlPartData; } /** @@ -66775,6 +68456,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.CustomXmlPartCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.CustomXmlPartCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.CustomXmlPartCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.CustomXmlPartCollectionData; } /** @@ -66859,6 +68544,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.CustomXmlPartScopedCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.CustomXmlPartScopedCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.CustomXmlPartScopedCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.CustomXmlPartScopedCollectionData; } /** @@ -67005,9 +68694,9 @@ declare namespace Word { * Occurs when a content control is added. Run context.sync() in the handler to get the new content control's properties. * * [Api set: WordApi BETA (PREVIEW ONLY)] - * @beta * * @eventproperty + * @beta */ readonly onContentControlAdded: OfficeExtension.EventHandlers; /** @@ -67018,6 +68707,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Document; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Document object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.DocumentData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.DocumentData; } /** @@ -67034,6 +68727,7 @@ declare namespace Word { * Gets the body object of the document. The body is the text that excludes headers, footers, footnotes, textboxes, etc.. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ readonly body: Word.Body; /** @@ -67041,6 +68735,7 @@ declare namespace Word { * Gets the collection of content control objects in the document. This includes content controls in the body of the document, headers, footers, textboxes, etc.. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ readonly contentControls: Word.ContentControlCollection; /** @@ -67048,6 +68743,7 @@ declare namespace Word { * Gets the custom XML parts in the document. Read-only. * * [Api set: WordApiHiddenDocument 1.4] + * @beta */ readonly customXmlParts: Word.CustomXmlPartCollection; /** @@ -67055,6 +68751,7 @@ declare namespace Word { * Gets the properties of the document. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ readonly properties: Word.DocumentProperties; /** @@ -67062,6 +68759,7 @@ declare namespace Word { * Gets the collection of section objects in the document. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ readonly sections: Word.SectionCollection; /** @@ -67069,6 +68767,7 @@ declare namespace Word { * Gets the add-in's settings in the document. Read-only. * * [Api set: WordApiHiddenDocument 1.4] + * @beta */ readonly settings: Word.SettingCollection; /** @@ -67076,6 +68775,7 @@ declare namespace Word { * Indicates whether the changes in the document have been saved. A value of true indicates that the document hasn't changed since it was saved. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ readonly saved: boolean; /** Sets multiple properties of an object at the same time. You can pass either a plain object with the appropriate properties, or another API object of the same type. @@ -67097,6 +68797,7 @@ declare namespace Word { * Deletes a bookmark, if exists, from the document. * * [Api set: WordApiHiddenDocument 1.4] + * @beta * * @param name Required. The bookmark name, which is case-insensitive. */ @@ -67106,6 +68807,7 @@ declare namespace Word { * Gets a bookmark's range. Throws if the bookmark does not exist. * * [Api set: WordApiHiddenDocument 1.4] + * @beta * * @param name Required. The bookmark name, which is case-insensitive. */ @@ -67115,6 +68817,7 @@ declare namespace Word { * Gets a bookmark's range. Returns a null object if the bookmark does not exist. * * [Api set: WordApiHiddenDocument 1.4] + * @beta * * @param name Required. The bookmark name, which is case-insensitive. */ @@ -67131,6 +68834,7 @@ declare namespace Word { * Saves the document. This will use the Word default file naming convention if the document has not been saved before. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ save(): void; /** @@ -67162,6 +68866,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.DocumentCreated; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.DocumentCreated object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.DocumentCreatedData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.DocumentCreatedData; } /** @@ -67342,6 +69050,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.DocumentProperties; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.DocumentProperties object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.DocumentPropertiesData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.DocumentPropertiesData; } /** @@ -67378,6 +69090,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor: string; @@ -67473,6 +69189,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Font; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Font object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.FontData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.FontData; } /** @@ -67837,6 +69557,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.InlinePicture; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.InlinePicture object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.InlinePictureData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.InlinePictureData; } /** @@ -67890,6 +69614,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.InlinePictureCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.InlinePictureCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.InlinePictureCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.InlinePictureCollectionData; } /** @@ -68125,6 +69853,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.List; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.List object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ListData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.ListData; } /** @@ -68205,6 +69937,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.ListCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.ListCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ListCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.ListCollectionData; } /** @@ -68307,6 +70043,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.ListItem; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.ListItem object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ListItemData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.ListItemData; } /** @@ -68897,6 +70637,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Paragraph; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Paragraph object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ParagraphData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.ParagraphData; } /** @@ -68964,6 +70708,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.ParagraphCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.ParagraphCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.ParagraphCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.ParagraphCollectionData; } /** @@ -69512,6 +71260,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Range; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Range object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.RangeData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.RangeData; } /** @@ -69565,6 +71317,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.RangeCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.RangeCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.RangeCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.RangeCollectionData; } /** @@ -69665,6 +71421,10 @@ declare namespace Word { * Create a new instance of Word.SearchOptions object */ static newObject(context: OfficeExtension.ClientRequestContext): Word.SearchOptions; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.SearchOptions object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.SearchOptionsData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.SearchOptionsData; } /** @@ -69776,6 +71536,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Section; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Section object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.SectionData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.SectionData; } /** @@ -69829,6 +71593,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.SectionCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.SectionCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.SectionCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.SectionCollectionData; } /** @@ -69912,6 +71680,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Setting; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Setting object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.SettingData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.SettingData; } /** @@ -69999,6 +71771,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.SettingCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.SettingCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.SettingCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.SettingCollectionData; } /** @@ -70570,6 +72346,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.Table; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.Table object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.TableData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.TableData; } /** @@ -70623,6 +72403,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.TableCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.TableCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.TableCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.TableCollectionData; } /** @@ -70912,6 +72696,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.TableRow; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.TableRow object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.TableRowData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.TableRowData; } /** @@ -70965,6 +72753,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.TableRowCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.TableRowCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.TableRowCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.TableRowCollectionData; } /** @@ -71235,6 +73027,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.TableCell; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.TableCell object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.TableCellData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.TableCellData; } /** @@ -71288,6 +73084,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.TableCellCollection; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original `Word.TableCellCollection` object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.TableCellCollectionData`) that contains an "items" array with shallow copies of any loaded properties from the collection's items. + */ toJSON(): Word.Interfaces.TableCellCollectionData; } /** @@ -71363,6 +73163,10 @@ declare namespace Word { * Release the memory associated with this object, if it has previously been tracked. This call is shorthand for context.trackedObjects.remove(thisObject). Having many tracked objects slows down the host application, so please remember to free any objects you add, once you're done using them. You will need to call "context.sync()" before the memory release takes effect. */ untrack(): Word.TableBorder; + /** + * Overrides the JavaScript `toJSON()` method in order to provide more useful output when an API object is passed to `JSON.stringify()`. (`JSON.stringify`, in turn, calls the `toJSON` method of the object that is passed to it.) + * Whereas the original Word.TableBorder object is an API object, the `toJSON` method returns a plain JavaScript object (typed as `Word.Interfaces.TableBorderData`) that contains shallow copies of any loaded child properties from the original object. + */ toJSON(): Word.Interfaces.TableBorderData; } /** @@ -72403,6 +74207,7 @@ declare namespace Word { * Gets the body object of the document. The body is the text that excludes headers, footers, footnotes, textboxes, etc.. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ body?: Word.Interfaces.BodyUpdateData; /** @@ -72410,6 +74215,7 @@ declare namespace Word { * Gets the properties of the document. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ properties?: Word.Interfaces.DocumentPropertiesUpdateData; } @@ -72506,6 +74312,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor?: string; @@ -73123,48 +74933,6 @@ declare namespace Word { paragraphs?: Word.Interfaces.ParagraphData[]; /** * - * Gets the parent body of the body. For example, a table cell body's parent body could be a header. Throws if there isn't a parent body. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentBody?: Word.Interfaces.BodyData; - /** - * - * Gets the parent body of the body. For example, a table cell body's parent body could be a header. Returns a null object if there isn't a parent body. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentBodyOrNullObject?: Word.Interfaces.BodyData; - /** - * - * Gets the content control that contains the body. Throws if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.1] - */ - parentContentControl?: Word.Interfaces.ContentControlData; - /** - * - * Gets the content control that contains the body. Returns a null object if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentContentControlOrNullObject?: Word.Interfaces.ContentControlData; - /** - * - * Gets the parent section of the body. Throws if there isn't a parent section. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentSection?: Word.Interfaces.SectionData; - /** - * - * Gets the parent section of the body. Returns a null object if there isn't a parent section. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentSectionOrNullObject?: Word.Interfaces.SectionData; - /** - * * Gets the collection of table objects in the body. Read-only. * * [Api set: WordApi 1.3] @@ -73238,55 +75006,6 @@ declare namespace Word { paragraphs?: Word.Interfaces.ParagraphData[]; /** * - * Gets the parent body of the content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentBody?: Word.Interfaces.BodyData; - /** - * - * Gets the content control that contains the content control. Throws if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.1] - */ - parentContentControl?: Word.Interfaces.ContentControlData; - /** - * - * Gets the content control that contains the content control. Returns a null object if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentContentControlOrNullObject?: Word.Interfaces.ContentControlData; - /** - * - * Gets the table that contains the content control. Throws if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTable?: Word.Interfaces.TableData; - /** - * - * Gets the table cell that contains the content control. Throws if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCell?: Word.Interfaces.TableCellData; - /** - * - * Gets the table cell that contains the content control. Returns a null object if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCellOrNullObject?: Word.Interfaces.TableCellData; - /** - * - * Gets the table that contains the content control. Returns a null object if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableOrNullObject?: Word.Interfaces.TableData; - /** - * * Gets the collection of table objects in the content control. Read-only. * * [Api set: WordApi 1.3] @@ -73511,6 +75230,7 @@ declare namespace Word { * Gets the body object of the document. The body is the text that excludes headers, footers, footnotes, textboxes, etc.. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ body?: Word.Interfaces.BodyData; /** @@ -73518,6 +75238,7 @@ declare namespace Word { * Gets the collection of content control objects in the document. This includes content controls in the body of the document, headers, footers, textboxes, etc.. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ contentControls?: Word.Interfaces.ContentControlData[]; /** @@ -73525,6 +75246,7 @@ declare namespace Word { * Gets the custom XML parts in the document. Read-only. * * [Api set: WordApiHiddenDocument 1.4] + * @beta */ customXmlParts?: Word.Interfaces.CustomXmlPartData[]; /** @@ -73532,6 +75254,7 @@ declare namespace Word { * Gets the properties of the document. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ properties?: Word.Interfaces.DocumentPropertiesData; /** @@ -73539,6 +75262,7 @@ declare namespace Word { * Gets the collection of section objects in the document. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ sections?: Word.Interfaces.SectionData[]; /** @@ -73546,6 +75270,7 @@ declare namespace Word { * Gets the add-in's settings in the document. Read-only. * * [Api set: WordApiHiddenDocument 1.4] + * @beta */ settings?: Word.Interfaces.SettingData[]; /** @@ -73553,6 +75278,7 @@ declare namespace Word { * Indicates whether the changes in the document have been saved. A value of true indicates that the document hasn't changed since it was saved. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ saved?: boolean; } @@ -73712,6 +75438,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor?: string; @@ -73767,55 +75497,6 @@ declare namespace Word { } /** An interface describing the data returned by calling "inlinePicture.toJSON()". */ interface InlinePictureData { - /** - * - * Gets the parent paragraph that contains the inline image. Read-only. - * - * [Api set: WordApi 1.2] - */ - paragraph?: Word.Interfaces.ParagraphData; - /** - * - * Gets the content control that contains the inline image. Throws if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.1] - */ - parentContentControl?: Word.Interfaces.ContentControlData; - /** - * - * Gets the content control that contains the inline image. Returns a null object if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentContentControlOrNullObject?: Word.Interfaces.ContentControlData; - /** - * - * Gets the table that contains the inline image. Throws if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTable?: Word.Interfaces.TableData; - /** - * - * Gets the table cell that contains the inline image. Throws if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCell?: Word.Interfaces.TableCellData; - /** - * - * Gets the table cell that contains the inline image. Returns a null object if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCellOrNullObject?: Word.Interfaces.TableCellData; - /** - * - * Gets the table that contains the inline image. Returns a null object if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableOrNullObject?: Word.Interfaces.TableData; /** * * Gets or sets a string that represents the alternative text associated with the inline image. @@ -73932,13 +75613,6 @@ declare namespace Word { } /** An interface describing the data returned by calling "paragraph.toJSON()". */ interface ParagraphData { - /** - * - * Gets the collection of content control objects in the paragraph. Read-only. - * - * [Api set: WordApi 1.1] - */ - contentControls?: Word.Interfaces.ContentControlData[]; /** * * Gets the text format of the paragraph. Use this to get and set font name, size, color, and other properties. Read-only. @@ -73955,13 +75629,6 @@ declare namespace Word { inlinePictures?: Word.Interfaces.InlinePictureData[]; /** * - * Gets the List to which this paragraph belongs. Throws if the paragraph is not in a list. Read-only. - * - * [Api set: WordApi 1.3] - */ - list?: Word.Interfaces.ListData; - /** - * * Gets the ListItem for the paragraph. Throws if the paragraph is not part of a list. Read-only. * * [Api set: WordApi 1.3] @@ -73974,62 +75641,6 @@ declare namespace Word { * [Api set: WordApi 1.3] */ listItemOrNullObject?: Word.Interfaces.ListItemData; - /** - * - * Gets the List to which this paragraph belongs. Returns a null object if the paragraph is not in a list. Read-only. - * - * [Api set: WordApi 1.3] - */ - listOrNullObject?: Word.Interfaces.ListData; - /** - * - * Gets the parent body of the paragraph. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentBody?: Word.Interfaces.BodyData; - /** - * - * Gets the content control that contains the paragraph. Throws if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.1] - */ - parentContentControl?: Word.Interfaces.ContentControlData; - /** - * - * Gets the content control that contains the paragraph. Returns a null object if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentContentControlOrNullObject?: Word.Interfaces.ContentControlData; - /** - * - * Gets the table that contains the paragraph. Throws if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTable?: Word.Interfaces.TableData; - /** - * - * Gets the table cell that contains the paragraph. Throws if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCell?: Word.Interfaces.TableCellData; - /** - * - * Gets the table cell that contains the paragraph. Returns a null object if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCellOrNullObject?: Word.Interfaces.TableCellData; - /** - * - * Gets the table that contains the paragraph. Returns a null object if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableOrNullObject?: Word.Interfaces.TableData; /** * * Gets or sets the alignment for a paragraph. The value can be 'left', 'centered', 'right', or 'justified'. @@ -74149,13 +75760,6 @@ declare namespace Word { } /** An interface describing the data returned by calling "range.toJSON()". */ interface RangeData { - /** - * - * Gets the collection of content control objects in the range. Read-only. - * - * [Api set: WordApi 1.1] - */ - contentControls?: Word.Interfaces.ContentControlData[]; /** * * Gets the text format of the range. Use this to get and set font name, size, color, and other properties. Read-only. @@ -74170,76 +75774,6 @@ declare namespace Word { * [Api set: WordApi 1.2] */ inlinePictures?: Word.Interfaces.InlinePictureData[]; - /** - * - * Gets the collection of list objects in the range. Read-only. - * - * [Api set: WordApi 1.3] - */ - lists?: Word.Interfaces.ListData[]; - /** - * - * Gets the collection of paragraph objects in the range. Read-only. - * - * [Api set: WordApi 1.1] - */ - paragraphs?: Word.Interfaces.ParagraphData[]; - /** - * - * Gets the parent body of the range. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentBody?: Word.Interfaces.BodyData; - /** - * - * Gets the content control that contains the range. Throws if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.1] - */ - parentContentControl?: Word.Interfaces.ContentControlData; - /** - * - * Gets the content control that contains the range. Returns a null object if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentContentControlOrNullObject?: Word.Interfaces.ContentControlData; - /** - * - * Gets the table that contains the range. Throws if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTable?: Word.Interfaces.TableData; - /** - * - * Gets the table cell that contains the range. Throws if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCell?: Word.Interfaces.TableCellData; - /** - * - * Gets the table cell that contains the range. Returns a null object if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCellOrNullObject?: Word.Interfaces.TableCellData; - /** - * - * Gets the table that contains the range. Returns a null object if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableOrNullObject?: Word.Interfaces.TableData; - /** - * - * Gets the collection of table objects in the range. Read-only. - * - * [Api set: WordApi 1.3] - */ - tables?: Word.Interfaces.TableData[]; /** * * Gets the first hyperlink in the range, or sets a hyperlink on the range. All hyperlinks in the range are deleted when you set a new hyperlink on the range. Use a '#' to separate the address part from the optional location part. @@ -74380,55 +75914,6 @@ declare namespace Word { font?: Word.Interfaces.FontData; /** * - * Gets the parent body of the table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentBody?: Word.Interfaces.BodyData; - /** - * - * Gets the content control that contains the table. Throws if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentContentControl?: Word.Interfaces.ContentControlData; - /** - * - * Gets the content control that contains the table. Returns a null object if there isn't a parent content control. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentContentControlOrNullObject?: Word.Interfaces.ContentControlData; - /** - * - * Gets the table that contains this table. Throws if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTable?: Word.Interfaces.TableData; - /** - * - * Gets the table cell that contains this table. Throws if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCell?: Word.Interfaces.TableCellData; - /** - * - * Gets the table cell that contains this table. Returns a null object if it is not contained in a table cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableCellOrNullObject?: Word.Interfaces.TableCellData; - /** - * - * Gets the table that contains this table. Returns a null object if it is not contained in a table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTableOrNullObject?: Word.Interfaces.TableData; - /** - * * Gets all of the table rows. Read-only. * * [Api set: WordApi 1.3] @@ -74581,13 +76066,6 @@ declare namespace Word { * [Api set: WordApi 1.3] */ font?: Word.Interfaces.FontData; - /** - * - * Gets parent table. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTable?: Word.Interfaces.TableData; /** * * Gets the number of cells in the row. Read-only. @@ -74658,20 +76136,6 @@ declare namespace Word { * [Api set: WordApi 1.3] */ body?: Word.Interfaces.BodyData; - /** - * - * Gets the parent row of the cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentRow?: Word.Interfaces.TableRowData; - /** - * - * Gets the parent table of the cell. Read-only. - * - * [Api set: WordApi 1.3] - */ - parentTable?: Word.Interfaces.TableData; /** * * Gets the index of the cell in its row. Read-only. @@ -75357,6 +76821,7 @@ declare namespace Word { * Gets the body object of the document. The body is the text that excludes headers, footers, footnotes, textboxes, etc.. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ body?: Word.Interfaces.BodyLoadOptions; /** @@ -75364,6 +76829,7 @@ declare namespace Word { * Gets the properties of the document. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ properties?: Word.Interfaces.DocumentPropertiesLoadOptions; /** @@ -75371,6 +76837,7 @@ declare namespace Word { * Indicates whether the changes in the document have been saved. A value of true indicates that the document hasn't changed since it was saved. Read-only. * * [Api set: WordApiHiddenDocument 1.3] + * @beta */ saved?: boolean; } @@ -75535,6 +77002,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor?: boolean; @@ -81015,6 +82486,7 @@ declare namespace OneNote { } enum ErrorCodes { generalException = "GeneralException", + operationAborted = "OperationAborted", } module Interfaces { /** diff --git a/types/office-js-preview/tslint.json b/types/office-js-preview/tslint.json index 86c4ba7acc..e0b27fe373 100644 --- a/types/office-js-preview/tslint.json +++ b/types/office-js-preview/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "file-name-casing": false, diff --git a/types/office-js/index.d.ts b/types/office-js/index.d.ts index f976e947ec..67a90d9688 100644 --- a/types/office-js/index.d.ts +++ b/types/office-js/index.d.ts @@ -962,11 +962,11 @@ declare namespace Office { * * *Supported hosts, by platform* * - * - * - * - * - * + * + * + * + * + * *
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3)
PowerPoint Y Y Y
Word Y Y Y
Office for Windows desktop Office Online (in browser) Office for iPad
Excel Y Y Y
Outlook Y (Mailbox 1.3: without `options` parameter;
Mailbox Preview: adds support for `options` parameter)
PowerPoint Y Y Y
Word Y Y Y
* * @param options Optional. An object literal that contains one or more of the following properties. @@ -974,7 +974,7 @@ declare namespace Office { * this value indicates of the handled event should continue execution or be canceled. * For example, an add-in that handles the ItemSend event can set allowEvent = false to cancel sending of the message. */ - completed(options?: any): void; + completed(options?: { allowEvent: boolean }): void; } /** @@ -1633,7 +1633,7 @@ declare namespace Office { */ controlBackgroundColor: string; /** - * Gets the Office theme body control color as a hexadecimal color triplet (e.g. "FFA500"). + * Gets the Office theme control foreground color as a hexadecimal color triplet (e.g. "FFA500"). */ controlForegroundColor: string; } @@ -4720,7 +4720,9 @@ declare namespace Office { * In Excel, if you specify formulas in the TableData object you pass for the data parameter, you might not get the results you expect due to * the "calculated columns" feature of Excel, which automatically duplicates formulas within a column. To work around this when you want to * write `data` that contains formulas to a selected table, try specifying the data as an array of arrays (instead of a TableData object), and - * specify the coercionType as Microsoft.Office.Matrix or "matrix". + * specify the coercionType as Microsoft.Office.Matrix or "matrix". However, this technique will block the "calculated columns" feature only + * when one of the following conditions is met: (1) you are writing to all the cells of the column, or (2) there are already at least two + * different formulas in the column. * * @param options Provides options for how to insert data to the selection. * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. @@ -4904,7 +4906,9 @@ declare namespace Office { * In Excel, if you specify formulas in the TableData object you pass for the data parameter, you might not get the results you expect due to * the "calculated columns" feature of Excel, which automatically duplicates formulas within a column. To work around this when you want to * write `data` that contains formulas to a selected table, try specifying the data as an array of arrays (instead of a TableData object), and - * specify the coercionType as Microsoft.Office.Matrix or "matrix". + * specify the coercionType as Microsoft.Office.Matrix or "matrix". However, this technique will block the "calculated columns" feature only + * when one of the following conditions is met: (1) you are writing to all the cells of the column, or (2) there are already at least two + * different formulas in the column. * * @param callback Optional. A function that is invoked when the callback returns, whose only parameter is of type {@link Office.AsyncResult}. * The AsyncResult.value property always returns undefined because there is no object or data to retrieve. @@ -10751,6 +10755,12 @@ declare namespace Office { * Gets the size of the attachment in bytes. */ size: number; + /** + * Gets the url of the attachment if its type is `MailboxEnums.AttachmentType.Cloud`. + * + * [Api set: Mailbox Preview] + */ + url: string; } /** * The body object provides methods for adding and updating the content of the message or appointment. @@ -52434,6 +52444,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor: string; @@ -57248,6 +57262,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor?: string; @@ -58382,6 +58400,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor?: string; @@ -60096,6 +60118,10 @@ declare namespace Word { * * Gets or sets the highlight color. To set it, use a value either in the '#RRGGBB' format or the color name. To remove highlight color, set it to null. The returned highlight color can be in the '#RRGGBB' format, an empty string for mixed highlight colors, or null for no highlight color. * + * **Note**: Only the default highlight colors are available in Office for Windows Desktop. + * These are "Yellow", "Lime", "Turquoise", "Pink", "Blue", "Red", "DarkBlue", "Teal", "Green", "Purple", "DarkRed", "Olive", "Gray", "LightGray", and "Black". + * When the add-in runs in Office for Windows Desktop, any other color is converted to the closest color when applied to the font. + * * [Api set: WordApi 1.1] */ highlightColor?: boolean; diff --git a/types/office-js/tslint.json b/types/office-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/office-js/tslint.json +++ b/types/office-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/offline-js/tslint.json b/types/offline-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/offline-js/tslint.json +++ b/types/offline-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/offscreencanvas/index.d.ts b/types/offscreencanvas/index.d.ts new file mode 100644 index 0000000000..89e2b14df6 --- /dev/null +++ b/types/offscreencanvas/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for non-npm package offscreencanvas-browser 2019.3 +// Project: https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +// Definitions by: Klaus Reimer +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +// TypeScript Version: 3.1 + +// https://html.spec.whatwg.org/multipage/canvas.html#canvasdrawimage +interface CanvasDrawImage { + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, dx: number, dy: number, dw: number, dh: number): void; + drawImage(image: CanvasImageSource | OffscreenCanvas, sx: number, sy: number, sw: number, sh: number, + dx: number, dy: number, dw: number, dh: number): void; +} + +// https://html.spec.whatwg.org/multipage/imagebitmap-and-animations.html#dom-createimagebitmap +declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas): Promise; +declare function createImageBitmap(image: ImageBitmapSource | OffscreenCanvas, sx: number, sy: number, + sw: number, sh: number): Promise; + +// https://html.spec.whatwg.org/multipage/canvas.html#dom-canvas-transfercontroltooffscreen +interface HTMLCanvasElement extends HTMLElement { + transferControlToOffscreen(): OffscreenCanvas; +} + +// https://html.spec.whatwg.org/multipage/canvas.html#offscreencanvasrenderingcontext2d +interface OffscreenCanvasRenderingContext2D extends CanvasState, CanvasTransform, CanvasCompositing, + CanvasImageSmoothing, CanvasFillStrokeStyles, CanvasShadowStyles, CanvasFilters, CanvasRect, + CanvasDrawPath, CanvasText, CanvasDrawImage, CanvasImageData, CanvasPathDrawingStyles, + CanvasTextDrawingStyles, CanvasPath { + readonly canvas: OffscreenCanvas; +} +declare var OffscreenCanvasRenderingContext2D: { + prototype: OffscreenCanvasRenderingContext2D; + new (): OffscreenCanvasRenderingContext2D; +}; + +// https://html.spec.whatwg.org/multipage/canvas.html#the-offscreencanvas-interface +interface OffscreenCanvas extends EventTarget { + width: number; + height: number; + getContext(contextId: "2d", contextAttributes?: CanvasRenderingContext2DSettings): + OffscreenCanvasRenderingContext2D | null; + getContext(contextId: "webgl", contextAttributes?: WebGLContextAttributes): WebGLRenderingContext | null; + getContext(contextId: string, contextAttributes?: {}): OffscreenCanvasRenderingContext2D + | WebGLRenderingContext | null; + transferToImageBitmap(): ImageBitmap; + convertToBlob(options?: { type?: string, quality?: number }): Promise; +} +declare var OffscreenCanvas: { + prototype: OffscreenCanvas; + new (width: number, height: number): OffscreenCanvas; +}; diff --git a/types/offscreencanvas/offscreencanvas-tests.ts b/types/offscreencanvas/offscreencanvas-tests.ts new file mode 100644 index 0000000000..9f89e374b3 --- /dev/null +++ b/types/offscreencanvas/offscreencanvas-tests.ts @@ -0,0 +1,33 @@ +// Test constructor +const offscreenCanvas: OffscreenCanvas = new OffscreenCanvas(20, 10); + +// Test OffscreenCanvas properties +let width: number = offscreenCanvas.width; +let height: number = offscreenCanvas.height; + +// Test OffscreenCanvas methods +const context2D: OffscreenCanvasRenderingContext2D | null = offscreenCanvas.getContext("2d"); +const webglContext: WebGLRenderingContext | null = offscreenCanvas.getContext("webgl"); +const otherContext: OffscreenCanvasRenderingContext2D | WebGLRenderingContext | null = + offscreenCanvas.getContext("foobar"); +const imageBitmap: ImageBitmap = offscreenCanvas.transferToImageBitmap(); +const blob1: Promise = offscreenCanvas.convertToBlob(); +const blob2: Promise = offscreenCanvas.convertToBlob({ type: "image/jpeg" }); +const blob3: Promise = offscreenCanvas.convertToBlob({ type: "image/jpeg", quality: 0.92 }); + +// Test OffscreenCanvasRenderingContext2D properties +const canvasRef: OffscreenCanvas = context2D!.canvas; + +// Test HTMLCanvasElement methods +const canvas: HTMLCanvasElement = document.createElement("canvas"); +const transferredCanvas: OffscreenCanvas = canvas.transferControlToOffscreen(); + +// Test CanvasRenderingContext2D methods +const ctx = canvas.getContext("2d")!; +ctx.drawImage(offscreenCanvas, 0, 0); +ctx.drawImage(offscreenCanvas, 0, 0, 20, 10); +ctx.drawImage(offscreenCanvas, 0, 0, 20, 10, 0, 0, 20, 10); + +// Test createImageBitmap function with offscreen canvas +const imageBitmap1 = createImageBitmap(offscreenCanvas); +const imageBitmap2 = createImageBitmap(offscreenCanvas, 1, 2, 3, 4); diff --git a/types/offscreencanvas/tsconfig.json b/types/offscreencanvas/tsconfig.json new file mode 100644 index 0000000000..12d786084f --- /dev/null +++ b/types/offscreencanvas/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", + "offscreencanvas-tests.ts" + ] +} diff --git a/types/npm-keyword/tslint.json b/types/offscreencanvas/tslint.json similarity index 100% rename from types/npm-keyword/tslint.json rename to types/offscreencanvas/tslint.json diff --git a/types/oidc-token-manager/tslint.json b/types/oidc-token-manager/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/oidc-token-manager/tslint.json +++ b/types/oidc-token-manager/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ol/assertionerror/index.d.ts b/types/ol/AssertionError/index.d.ts similarity index 100% rename from types/ol/assertionerror/index.d.ts rename to types/ol/AssertionError/index.d.ts diff --git a/types/ol/attribution/index.d.ts b/types/ol/Attribution/index.d.ts similarity index 100% rename from types/ol/attribution/index.d.ts rename to types/ol/Attribution/index.d.ts diff --git a/types/ol/collection/index.d.ts b/types/ol/Collection/index.d.ts similarity index 100% rename from types/ol/collection/index.d.ts rename to types/ol/Collection/index.d.ts diff --git a/types/ol/disposable/index.d.ts b/types/ol/Disposable/index.d.ts similarity index 100% rename from types/ol/disposable/index.d.ts rename to types/ol/Disposable/index.d.ts diff --git a/types/ol/feature/index.d.ts b/types/ol/Feature/index.d.ts similarity index 100% rename from types/ol/feature/index.d.ts rename to types/ol/Feature/index.d.ts diff --git a/types/ol/geolocation/index.d.ts b/types/ol/Geolocation/index.d.ts similarity index 100% rename from types/ol/geolocation/index.d.ts rename to types/ol/Geolocation/index.d.ts diff --git a/types/ol/graticule/index.d.ts b/types/ol/Graticule/index.d.ts similarity index 100% rename from types/ol/graticule/index.d.ts rename to types/ol/Graticule/index.d.ts diff --git a/types/ol/image/index.d.ts b/types/ol/Image/index.d.ts similarity index 100% rename from types/ol/image/index.d.ts rename to types/ol/Image/index.d.ts diff --git a/types/ol/imagebase/index.d.ts b/types/ol/ImageBase/index.d.ts similarity index 100% rename from types/ol/imagebase/index.d.ts rename to types/ol/ImageBase/index.d.ts diff --git a/types/ol/imagetile/index.d.ts b/types/ol/ImageTile/index.d.ts similarity index 100% rename from types/ol/imagetile/index.d.ts rename to types/ol/ImageTile/index.d.ts diff --git a/types/ol/kinetic/index.d.ts b/types/ol/Kinetic/index.d.ts similarity index 100% rename from types/ol/kinetic/index.d.ts rename to types/ol/Kinetic/index.d.ts diff --git a/types/ol/map/index.d.ts b/types/ol/Map/index.d.ts similarity index 100% rename from types/ol/map/index.d.ts rename to types/ol/Map/index.d.ts diff --git a/types/ol/mapbrowserevent/index.d.ts b/types/ol/MapBrowserEvent/index.d.ts similarity index 100% rename from types/ol/mapbrowserevent/index.d.ts rename to types/ol/MapBrowserEvent/index.d.ts diff --git a/types/ol/mapbrowserpointerevent/index.d.ts b/types/ol/MapBrowserPointerEvent/index.d.ts similarity index 100% rename from types/ol/mapbrowserpointerevent/index.d.ts rename to types/ol/MapBrowserPointerEvent/index.d.ts diff --git a/types/ol/mapevent/index.d.ts b/types/ol/MapEvent/index.d.ts similarity index 100% rename from types/ol/mapevent/index.d.ts rename to types/ol/MapEvent/index.d.ts diff --git a/types/ol/object/index.d.ts b/types/ol/Object/index.d.ts similarity index 100% rename from types/ol/object/index.d.ts rename to types/ol/Object/index.d.ts diff --git a/types/ol/observable/index.d.ts b/types/ol/Observable/index.d.ts similarity index 100% rename from types/ol/observable/index.d.ts rename to types/ol/Observable/index.d.ts diff --git a/types/ol/overlay/index.d.ts b/types/ol/Overlay/index.d.ts similarity index 100% rename from types/ol/overlay/index.d.ts rename to types/ol/Overlay/index.d.ts diff --git a/types/ol/tile/index.d.ts b/types/ol/Tile/index.d.ts similarity index 100% rename from types/ol/tile/index.d.ts rename to types/ol/Tile/index.d.ts diff --git a/types/ol/vectortile/index.d.ts b/types/ol/VectorTile/index.d.ts similarity index 100% rename from types/ol/vectortile/index.d.ts rename to types/ol/VectorTile/index.d.ts diff --git a/types/ol/view/index.d.ts b/types/ol/View/index.d.ts similarity index 100% rename from types/ol/view/index.d.ts rename to types/ol/View/index.d.ts diff --git a/types/ol/control/attribution.d.ts b/types/ol/control/Attribution.d.ts similarity index 100% rename from types/ol/control/attribution.d.ts rename to types/ol/control/Attribution.d.ts diff --git a/types/ol/control/control.d.ts b/types/ol/control/Control.d.ts similarity index 100% rename from types/ol/control/control.d.ts rename to types/ol/control/Control.d.ts diff --git a/types/ol/control/fullscreen.d.ts b/types/ol/control/Fullscreen.d.ts similarity index 100% rename from types/ol/control/fullscreen.d.ts rename to types/ol/control/Fullscreen.d.ts diff --git a/types/ol/control/mouseposition.d.ts b/types/ol/control/MousePosition.d.ts similarity index 100% rename from types/ol/control/mouseposition.d.ts rename to types/ol/control/MousePosition.d.ts diff --git a/types/ol/control/overviewmap.d.ts b/types/ol/control/OverviewMap.d.ts similarity index 100% rename from types/ol/control/overviewmap.d.ts rename to types/ol/control/OverviewMap.d.ts diff --git a/types/ol/control/rotate.d.ts b/types/ol/control/Rotate.d.ts similarity index 100% rename from types/ol/control/rotate.d.ts rename to types/ol/control/Rotate.d.ts diff --git a/types/ol/control/scaleline.d.ts b/types/ol/control/ScaleLine.d.ts similarity index 100% rename from types/ol/control/scaleline.d.ts rename to types/ol/control/ScaleLine.d.ts diff --git a/types/ol/control/zoom.d.ts b/types/ol/control/Zoom.d.ts similarity index 100% rename from types/ol/control/zoom.d.ts rename to types/ol/control/Zoom.d.ts diff --git a/types/ol/control/zoomslider.d.ts b/types/ol/control/ZoomSlider.d.ts similarity index 100% rename from types/ol/control/zoomslider.d.ts rename to types/ol/control/ZoomSlider.d.ts diff --git a/types/ol/control/zoomtoextent.d.ts b/types/ol/control/ZoomToExtent.d.ts similarity index 100% rename from types/ol/control/zoomtoextent.d.ts rename to types/ol/control/ZoomToExtent.d.ts diff --git a/types/ol/events/event.d.ts b/types/ol/events/Event.d.ts similarity index 100% rename from types/ol/events/event.d.ts rename to types/ol/events/Event.d.ts diff --git a/types/ol/events/eventtarget.d.ts b/types/ol/events/EventTarget.d.ts similarity index 100% rename from types/ol/events/eventtarget.d.ts rename to types/ol/events/EventTarget.d.ts diff --git a/types/ol/format/esrijson.d.ts b/types/ol/format/EsriJSON.d.ts similarity index 100% rename from types/ol/format/esrijson.d.ts rename to types/ol/format/EsriJSON.d.ts diff --git a/types/ol/format/feature.d.ts b/types/ol/format/Feature.d.ts similarity index 100% rename from types/ol/format/feature.d.ts rename to types/ol/format/Feature.d.ts diff --git a/types/ol/format/gml2.d.ts b/types/ol/format/GML2.d.ts similarity index 100% rename from types/ol/format/gml2.d.ts rename to types/ol/format/GML2.d.ts diff --git a/types/ol/format/gml3.d.ts b/types/ol/format/GML3.d.ts similarity index 100% rename from types/ol/format/gml3.d.ts rename to types/ol/format/GML3.d.ts diff --git a/types/ol/format/gmlbase.d.ts b/types/ol/format/GMLBase.d.ts similarity index 100% rename from types/ol/format/gmlbase.d.ts rename to types/ol/format/GMLBase.d.ts diff --git a/types/ol/format/gpx.d.ts b/types/ol/format/GPX.d.ts similarity index 100% rename from types/ol/format/gpx.d.ts rename to types/ol/format/GPX.d.ts diff --git a/types/ol/format/geojson.d.ts b/types/ol/format/GeoJSON.d.ts similarity index 100% rename from types/ol/format/geojson.d.ts rename to types/ol/format/GeoJSON.d.ts diff --git a/types/ol/format/igc.d.ts b/types/ol/format/IGC.d.ts similarity index 100% rename from types/ol/format/igc.d.ts rename to types/ol/format/IGC.d.ts diff --git a/types/ol/format/jsonfeature.d.ts b/types/ol/format/JSONFeature.d.ts similarity index 100% rename from types/ol/format/jsonfeature.d.ts rename to types/ol/format/JSONFeature.d.ts diff --git a/types/ol/format/kml.d.ts b/types/ol/format/KML.d.ts similarity index 100% rename from types/ol/format/kml.d.ts rename to types/ol/format/KML.d.ts diff --git a/types/ol/format/mvt.d.ts b/types/ol/format/MVT.d.ts similarity index 100% rename from types/ol/format/mvt.d.ts rename to types/ol/format/MVT.d.ts diff --git a/types/ol/format/osmxml.d.ts b/types/ol/format/OSMXML.d.ts similarity index 100% rename from types/ol/format/osmxml.d.ts rename to types/ol/format/OSMXML.d.ts diff --git a/types/ol/format/polyline.d.ts b/types/ol/format/Polyline.d.ts similarity index 100% rename from types/ol/format/polyline.d.ts rename to types/ol/format/Polyline.d.ts diff --git a/types/ol/format/textfeature.d.ts b/types/ol/format/TextFeature.d.ts similarity index 100% rename from types/ol/format/textfeature.d.ts rename to types/ol/format/TextFeature.d.ts diff --git a/types/ol/format/topojson.d.ts b/types/ol/format/TopoJSON.d.ts similarity index 100% rename from types/ol/format/topojson.d.ts rename to types/ol/format/TopoJSON.d.ts diff --git a/types/ol/format/wfs.d.ts b/types/ol/format/WFS.d.ts similarity index 100% rename from types/ol/format/wfs.d.ts rename to types/ol/format/WFS.d.ts diff --git a/types/ol/format/wkt.d.ts b/types/ol/format/WKT.d.ts similarity index 100% rename from types/ol/format/wkt.d.ts rename to types/ol/format/WKT.d.ts diff --git a/types/ol/format/wmscapabilities.d.ts b/types/ol/format/WMSCapabilities.d.ts similarity index 100% rename from types/ol/format/wmscapabilities.d.ts rename to types/ol/format/WMSCapabilities.d.ts diff --git a/types/ol/format/wmsgetfeatureinfo.d.ts b/types/ol/format/WMSGetFeatureInfo.d.ts similarity index 100% rename from types/ol/format/wmsgetfeatureinfo.d.ts rename to types/ol/format/WMSGetFeatureInfo.d.ts diff --git a/types/ol/format/wmtscapabilities.d.ts b/types/ol/format/WMTSCapabilities.d.ts similarity index 100% rename from types/ol/format/wmtscapabilities.d.ts rename to types/ol/format/WMTSCapabilities.d.ts diff --git a/types/ol/format/xml.d.ts b/types/ol/format/XML.d.ts similarity index 100% rename from types/ol/format/xml.d.ts rename to types/ol/format/XML.d.ts diff --git a/types/ol/format/xmlfeature.d.ts b/types/ol/format/XMLFeature.d.ts similarity index 100% rename from types/ol/format/xmlfeature.d.ts rename to types/ol/format/XMLFeature.d.ts diff --git a/types/ol/geom/circle.d.ts b/types/ol/geom/Circle.d.ts similarity index 100% rename from types/ol/geom/circle.d.ts rename to types/ol/geom/Circle.d.ts diff --git a/types/ol/geom/geometry.d.ts b/types/ol/geom/Geometry.d.ts similarity index 100% rename from types/ol/geom/geometry.d.ts rename to types/ol/geom/Geometry.d.ts diff --git a/types/ol/geom/geometrycollection.d.ts b/types/ol/geom/GeometryCollection.d.ts similarity index 100% rename from types/ol/geom/geometrycollection.d.ts rename to types/ol/geom/GeometryCollection.d.ts diff --git a/types/ol/geom/linestring.d.ts b/types/ol/geom/LineString.d.ts similarity index 100% rename from types/ol/geom/linestring.d.ts rename to types/ol/geom/LineString.d.ts diff --git a/types/ol/geom/linearring.d.ts b/types/ol/geom/LinearRing.d.ts similarity index 100% rename from types/ol/geom/linearring.d.ts rename to types/ol/geom/LinearRing.d.ts diff --git a/types/ol/geom/multipoint.d.ts b/types/ol/geom/MultiPoint.d.ts similarity index 100% rename from types/ol/geom/multipoint.d.ts rename to types/ol/geom/MultiPoint.d.ts diff --git a/types/ol/geom/multipolygon.d.ts b/types/ol/geom/MultiPolygon.d.ts similarity index 100% rename from types/ol/geom/multipolygon.d.ts rename to types/ol/geom/MultiPolygon.d.ts diff --git a/types/ol/geom/multilinestring.d.ts b/types/ol/geom/MultilineString.d.ts similarity index 100% rename from types/ol/geom/multilinestring.d.ts rename to types/ol/geom/MultilineString.d.ts diff --git a/types/ol/geom/point.d.ts b/types/ol/geom/Point.d.ts similarity index 100% rename from types/ol/geom/point.d.ts rename to types/ol/geom/Point.d.ts diff --git a/types/ol/geom/polygon.d.ts b/types/ol/geom/Polygon.d.ts similarity index 100% rename from types/ol/geom/polygon.d.ts rename to types/ol/geom/Polygon.d.ts diff --git a/types/ol/geom/simplegeometry.d.ts b/types/ol/geom/SimpleGeometry.d.ts similarity index 100% rename from types/ol/geom/simplegeometry.d.ts rename to types/ol/geom/SimpleGeometry.d.ts diff --git a/types/ol/interaction/doubleclickzoom.d.ts b/types/ol/interaction/DoubleClickZoom.d.ts similarity index 100% rename from types/ol/interaction/doubleclickzoom.d.ts rename to types/ol/interaction/DoubleClickZoom.d.ts diff --git a/types/ol/interaction/draganddrop.d.ts b/types/ol/interaction/DragAndDrop.d.ts similarity index 100% rename from types/ol/interaction/draganddrop.d.ts rename to types/ol/interaction/DragAndDrop.d.ts diff --git a/types/ol/interaction/dragbox.d.ts b/types/ol/interaction/DragBox.d.ts similarity index 100% rename from types/ol/interaction/dragbox.d.ts rename to types/ol/interaction/DragBox.d.ts diff --git a/types/ol/interaction/dragpan.d.ts b/types/ol/interaction/DragPan.d.ts similarity index 100% rename from types/ol/interaction/dragpan.d.ts rename to types/ol/interaction/DragPan.d.ts diff --git a/types/ol/interaction/dragrotate.d.ts b/types/ol/interaction/DragRotate.d.ts similarity index 100% rename from types/ol/interaction/dragrotate.d.ts rename to types/ol/interaction/DragRotate.d.ts diff --git a/types/ol/interaction/dragrotateandzoom.d.ts b/types/ol/interaction/DragRotateAndZoom.d.ts similarity index 100% rename from types/ol/interaction/dragrotateandzoom.d.ts rename to types/ol/interaction/DragRotateAndZoom.d.ts diff --git a/types/ol/interaction/dragzoom.d.ts b/types/ol/interaction/DragZoom.d.ts similarity index 100% rename from types/ol/interaction/dragzoom.d.ts rename to types/ol/interaction/DragZoom.d.ts diff --git a/types/ol/interaction/draw.d.ts b/types/ol/interaction/Draw.d.ts similarity index 100% rename from types/ol/interaction/draw.d.ts rename to types/ol/interaction/Draw.d.ts diff --git a/types/ol/interaction/extent.d.ts b/types/ol/interaction/Extent.d.ts similarity index 100% rename from types/ol/interaction/extent.d.ts rename to types/ol/interaction/Extent.d.ts diff --git a/types/ol/interaction/interaction.d.ts b/types/ol/interaction/Interaction.d.ts similarity index 100% rename from types/ol/interaction/interaction.d.ts rename to types/ol/interaction/Interaction.d.ts diff --git a/types/ol/interaction/keyboardpan.d.ts b/types/ol/interaction/KeyboardPan.d.ts similarity index 100% rename from types/ol/interaction/keyboardpan.d.ts rename to types/ol/interaction/KeyboardPan.d.ts diff --git a/types/ol/interaction/keyboardzoom.d.ts b/types/ol/interaction/KeyboardZoom.d.ts similarity index 100% rename from types/ol/interaction/keyboardzoom.d.ts rename to types/ol/interaction/KeyboardZoom.d.ts diff --git a/types/ol/interaction/modify.d.ts b/types/ol/interaction/Modify.d.ts similarity index 100% rename from types/ol/interaction/modify.d.ts rename to types/ol/interaction/Modify.d.ts diff --git a/types/ol/interaction/mousewheelzoom.d.ts b/types/ol/interaction/MouseWheelZoom.d.ts similarity index 100% rename from types/ol/interaction/mousewheelzoom.d.ts rename to types/ol/interaction/MouseWheelZoom.d.ts diff --git a/types/ol/interaction/pinchrotate.d.ts b/types/ol/interaction/PinchRotate.d.ts similarity index 100% rename from types/ol/interaction/pinchrotate.d.ts rename to types/ol/interaction/PinchRotate.d.ts diff --git a/types/ol/interaction/pinchzoom.d.ts b/types/ol/interaction/PinchZoom.d.ts similarity index 100% rename from types/ol/interaction/pinchzoom.d.ts rename to types/ol/interaction/PinchZoom.d.ts diff --git a/types/ol/interaction/pointer.d.ts b/types/ol/interaction/Pointer.d.ts similarity index 100% rename from types/ol/interaction/pointer.d.ts rename to types/ol/interaction/Pointer.d.ts diff --git a/types/ol/interaction/select.d.ts b/types/ol/interaction/Select.d.ts similarity index 100% rename from types/ol/interaction/select.d.ts rename to types/ol/interaction/Select.d.ts diff --git a/types/ol/interaction/snap.d.ts b/types/ol/interaction/Snap.d.ts similarity index 100% rename from types/ol/interaction/snap.d.ts rename to types/ol/interaction/Snap.d.ts diff --git a/types/ol/interaction/translate.d.ts b/types/ol/interaction/Translate.d.ts similarity index 100% rename from types/ol/interaction/translate.d.ts rename to types/ol/interaction/Translate.d.ts diff --git a/types/ol/layer/base.d.ts b/types/ol/layer/Base.d.ts similarity index 100% rename from types/ol/layer/base.d.ts rename to types/ol/layer/Base.d.ts diff --git a/types/ol/layer/group.d.ts b/types/ol/layer/Group.d.ts similarity index 100% rename from types/ol/layer/group.d.ts rename to types/ol/layer/Group.d.ts diff --git a/types/ol/layer/heatmap.d.ts b/types/ol/layer/Heatmap.d.ts similarity index 100% rename from types/ol/layer/heatmap.d.ts rename to types/ol/layer/Heatmap.d.ts diff --git a/types/ol/layer/image.d.ts b/types/ol/layer/Image.d.ts similarity index 100% rename from types/ol/layer/image.d.ts rename to types/ol/layer/Image.d.ts diff --git a/types/ol/layer/layer.d.ts b/types/ol/layer/Layer.d.ts similarity index 100% rename from types/ol/layer/layer.d.ts rename to types/ol/layer/Layer.d.ts diff --git a/types/ol/layer/tile.d.ts b/types/ol/layer/Tile.d.ts similarity index 100% rename from types/ol/layer/tile.d.ts rename to types/ol/layer/Tile.d.ts diff --git a/types/ol/layer/vector.d.ts b/types/ol/layer/Vector.d.ts similarity index 100% rename from types/ol/layer/vector.d.ts rename to types/ol/layer/Vector.d.ts diff --git a/types/ol/layer/vectortile.d.ts b/types/ol/layer/VectorTile.d.ts similarity index 100% rename from types/ol/layer/vectortile.d.ts rename to types/ol/layer/VectorTile.d.ts diff --git a/types/ol/ol-tests.ts b/types/ol/ol-tests.ts index be19e61a2b..f8117f43ac 100644 --- a/types/ol/ol-tests.ts +++ b/types/ol/ol-tests.ts @@ -1,317 +1,163 @@ -import ControlAttribution from 'ol/control/attribution'; - -import ControlControl from 'ol/control/control'; - -import ControlFullScreen from 'ol/control/fullscreen'; - -import ControlMousePosition from 'ol/control/mouseposition'; - -import ControlOverviewMap from 'ol/control/overviewmap'; - -import ControlRotate from 'ol/control/rotate'; - -import ControlScaleLine from 'ol/control/scaleline'; - -import ControlZoom from 'ol/control/zoom'; - -import ControlZoomSlider from 'ol/control/zoomslider'; - -import ControlZoomToExtent from 'ol/control/zoomtoextent'; - -import Eventscondition from 'ol/events/condition'; - -import EventsEvent from 'ol/events/event'; - -import EventsEventTarget from 'ol/events/eventtarget'; - -import FormatEsriJSON from 'ol/format/esrijson'; - -import FormatFeature from 'ol/format/feature'; - -import Formatfilter from 'ol/format/filter'; - -import FormatGeoJSON from 'ol/format/geojson'; - -import FormatGML2 from 'ol/format/gml2'; - -import FormatGML3 from 'ol/format/gml3'; - -import FormatGMLBase from 'ol/format/gmlbase'; - -import FormatGPX from 'ol/format/gpx'; - -import FormatIGC from 'ol/format/igc'; - -import FormatJSONFeature from 'ol/format/jsonfeature'; - -import FormatKML from 'ol/format/kml'; - -import FormatMVT from 'ol/format/mvt'; - -import FormatOSMXML from 'ol/format/osmxml'; - -import FormatPolyline from 'ol/format/polyline'; - -import FormatTextFeature from 'ol/format/textfeature'; - -import FormatTopoJSON from 'ol/format/topojson'; - -import FormatWFS from 'ol/format/wfs'; - -import FormatWKT from 'ol/format/wkt'; - -import FormatWMSCapabilities from 'ol/format/wmscapabilities'; - -import FormatWMSGetFeatureInfo from 'ol/format/wmsgetfeatureinfo'; - -import FormatWMTSCapabilities from 'ol/format/wmtscapabilities'; - -import FormatXML from 'ol/format/xml'; - -import FormatXMLFeature from 'ol/format/xmlfeature'; - -import GeomCircle from 'ol/geom/circle'; - -import GeomGeometry from 'ol/geom/geometry'; - -import GeomGeometryCollection from 'ol/geom/geometrycollection'; - -import GeomLinearRing from 'ol/geom/linearring'; - -import GeomLineString from 'ol/geom/linestring'; - -import GeomMultiLineString from 'ol/geom/multilinestring'; - -import GeomMultiPoint from 'ol/geom/multipoint'; - -import GeomMultiPolygon from 'ol/geom/multipolygon'; - -import GeomPoint from 'ol/geom/point'; - -import GeomPolygon from 'ol/geom/polygon'; - -import GeomSimpleGeometry from 'ol/geom/simplegeometry'; - -import InteractionDoubleClickZoom from 'ol/interaction/doubleclickzoom'; - -import InteractionDragAndDrop from 'ol/interaction/draganddrop'; - -import InteractionDragBox from 'ol/interaction/dragbox'; - -import InteractionDragPan from 'ol/interaction/dragpan'; - -import InteractionDragRotate from 'ol/interaction/dragrotate'; - -import InteractionDragRotateAndZoom from 'ol/interaction/dragrotateandzoom'; - -import InteractionDragZoom from 'ol/interaction/dragzoom'; - -import InteractionDraw from 'ol/interaction/draw'; - -import InteractionInteraction from 'ol/interaction/interaction'; - -import InteractionKeyboardPan from 'ol/interaction/keyboardpan'; - -import InteractionKeyboardZoom from 'ol/interaction/keyboardzoom'; - -import InteractionModify from 'ol/interaction/modify'; - -import InteractionMouseWheelZoom from 'ol/interaction/mousewheelzoom'; - -import InteractionPinchRotate from 'ol/interaction/pinchrotate'; - -import InteractionPinchZoom from 'ol/interaction/pinchzoom'; - -import InteractionPointer from 'ol/interaction/pointer'; - -import InteractionSelect from 'ol/interaction/select'; - -import InteractionSnap from 'ol/interaction/snap'; - -import InteractionTranslate from 'ol/interaction/translate'; - -import LayerBase from 'ol/layer/base'; - -import LayerGroup from 'ol/layer/group'; - -import LayerHeatmap from 'ol/layer/heatmap'; - -import LayerImage from 'ol/layer/image'; - -import LayerLayer from 'ol/layer/layer'; - -import LayerTile from 'ol/layer/tile'; - -import LayerVector from 'ol/layer/vector'; - -import LayerVectorTile from 'ol/layer/vectortile'; - -import PointerPointerEvent from 'ol/pointer/pointerevent'; - -import Proj from 'ol/proj'; - -import ProjProjection from 'ol/proj/projection'; - -import Rendercanvas from 'ol/render/canvas'; - -import RenderEvent from 'ol/render/event'; - -import RenderFeature from 'ol/render/feature'; - -import RenderVectorContext from 'ol/render/vectorcontext'; - -import SourceBingMaps from 'ol/source/bingmaps'; - -import SourceCartoDB from 'ol/source/cartodb'; - -import SourceCluster from 'ol/source/cluster'; - -import SourceImage from 'ol/source/image'; - -import SourceImageArcGISRest from 'ol/source/imagearcgisrest'; - -import SourceImageCanvas from 'ol/source/imagecanvas'; - -import SourceImageMapGuide from 'ol/source/imagemapguide'; - -import SourceImageStatic from 'ol/source/imagestatic'; - -import SourceImageVector from 'ol/source/imagevector'; - -import SourceImageWMS from 'ol/source/imagewms'; - -import SourceOSM from 'ol/source/osm'; - -import SourceRaster from 'ol/source/raster'; - -import SourceSource from 'ol/source/source'; - -import SourceStamen from 'ol/source/stamen'; - -import SourceTile from 'ol/source/tile'; - -import SourceTileArcGISRest from 'ol/source/tilearcgisrest'; - -import SourceTileDebug from 'ol/source/tiledebug'; - -import SourceTileImage from 'ol/source/tileimage'; - -import SourceTileJSON from 'ol/source/tilejson'; - -import SourceTileUTFGrid from 'ol/source/tileutfgrid'; - -import SourceTileWMS from 'ol/source/tilewms'; - -import SourceUrlTile from 'ol/source/urltile'; - -import SourceVector from 'ol/source/vector'; - -import SourceVectorTile from 'ol/source/vectortile'; - -import SourceWMTS from 'ol/source/wmts'; - -import SourceXYZ from 'ol/source/xyz'; - -import SourceZoomify from 'ol/source/zoomify'; - -import StyleAtlasManager from 'ol/style/atlasmanager'; - -import StyleCircle from 'ol/style/circle'; - -import StyleFill from 'ol/style/fill'; - -import StyleIcon from 'ol/style/icon'; - -import StyleImage from 'ol/style/image'; - -import StyleRegularShape from 'ol/style/regularshape'; - -import StyleStroke from 'ol/style/stroke'; - -import StyleStyle from 'ol/style/style'; - -import StyleText from 'ol/style/text'; - -import TilegridTileGrid from 'ol/tilegrid/tilegrid'; - -import TilegridWMTS from 'ol/tilegrid/wmts'; - -import AssertionError from 'ol/assertionerror'; - -import Attribution from 'ol/attribution'; - -import Collection from 'ol/collection'; - -import Color from 'ol/color'; - -import Colorlike from 'ol/colorlike'; - -import Control from 'ol/control'; - +import AssertionError from 'ol/AssertionError'; +import AtlasManager from 'ol/style/AtlasManager'; +// import Attribution from 'ol/Attribution'; +import Attribution from 'ol/control/Attribution'; +import Base from 'ol/layer/Base'; +import BingMaps from 'ol/source/BingMaps'; +import canvas from 'ol/render/canvas'; +import CartoDB from 'ol/source/CartoDB'; +import Circle from 'ol/geom/Circle'; +// import Circle from 'ol/style/Circle'; +import Cluster from 'ol/source/Cluster'; +import Collection from 'ol/Collection'; +import color from 'ol/color'; +import colorlike from 'ol/colorlike'; +import condition from 'ol/events/condition'; +import control from 'ol/control'; +import Control from 'ol/control/Control'; +// import coordinate from 'ol/coordinate'; import DeviceOrientation from 'ol/deviceorientation'; - -import Disposable from 'ol/disposable'; - -import Easing from 'ol/easing'; - -import Events from 'ol/events'; - -import Extent from 'ol/extent'; - -import Feature from 'ol/feature'; - -import FeatureLoader from 'ol/featureloader'; - -import Geolocation from 'ol/geolocation'; - -import Graticule from 'ol/graticule'; - -import Image from 'ol/image'; - -import ImageBase from 'ol/imagebase'; - -import ImageTile from 'ol/imagetile'; - -import Interaction from 'ol/interaction'; - -import Kinetic from 'ol/kinetic'; - -import Loadingstrategy from 'ol/loadingstrategy'; - -import Map from 'ol/map'; - -import MapBrowserEvent from 'ol/mapbrowserevent'; - -import MapBrowserPointerEvent from 'ol/mapbrowserpointerevent'; - -import MapEvent from 'ol/mapevent'; - -import Object from 'ol/object'; - -import Observable from 'ol/observable'; - -import Overlay from 'ol/overlay'; - +import Disposable from 'ol/Disposable'; +import DoubleClickZoom from 'ol/interaction/DoubleClickZoom'; +import DragAndDrop from 'ol/interaction/DragAndDrop'; +import DragBox from 'ol/interaction/DragBox'; +import DragPan from 'ol/interaction/DragPan'; +import DragRotateAndZoom from 'ol/interaction/DragRotateAndZoom'; +import DragRotate from 'ol/interaction/DragRotate'; +import DragZoom from 'ol/interaction/DragZoom'; +import Draw from 'ol/interaction/Draw'; +import easing from 'ol/easing'; +import EsriJSON from 'ol/format/EsriJSON'; +// import Event from 'ol/events/Event'; +import Event from 'ol/render/Event'; +import events from 'ol/events'; +import EventTarget from 'ol/events/EventTarget'; +import extent from 'ol/extent'; +import Extent from 'ol/interaction/Extent'; +// import Feature from 'ol/Feature'; +import Feature from 'ol/format/Feature'; +// import Feature from 'ol/render/Feature'; +import featureloader from 'ol/featureloader'; +import Fill from 'ol/style/Fill'; +import filter from 'ol/format/filter'; +import FullScreen from 'ol/control/Fullscreen'; +import GeoJSON from 'ol/format/GeoJSON'; +import Geolocation from 'ol/Geolocation'; +import GeometryCollection from 'ol/geom/GeometryCollection'; +import Geometry from 'ol/geom/Geometry'; +import GML2 from 'ol/format/GML2'; +import GML3 from 'ol/format/GML3'; +import GMLBase from 'ol/format/GMLBase'; +import GPX from 'ol/format/GPX'; +import Graticule from 'ol/Graticule'; +import Group from 'ol/layer/Group'; +import Heatmap from 'ol/layer/Heatmap'; +import Icon from 'ol/style/Icon'; +import IGC from 'ol/format/IGC'; +import ImageArcGISRest from 'ol/source/ImageArcGISRest'; +import ImageBase from 'ol/ImageBase'; +import ImageCanvas from 'ol/source/ImageCanvas'; +// import Image from 'ol/Image'; +import Image from 'ol/layer/Image'; +// import Image from 'ol/source/Image'; +// import Image from 'ol/style/Image'; +import ImageMapGuide from 'ol/source/ImageMapGuide'; +import ImageStatic from 'ol/source/ImageStatic'; +import ImageTile from 'ol/ImageTile'; +import ImageVector from 'ol/source/ImageVector'; +import ImageWMS from 'ol/source/ImageWMS'; +import interaction from 'ol/interaction'; +import Interaction from 'ol/interaction/Interaction'; +import JSONFeature from 'ol/format/JSONFeature'; +import KeyboardPan from 'ol/interaction/KeyboardPan'; +import KeyboardZoom from 'ol/interaction/KeyboardZoom'; +import Kinetic from 'ol/Kinetic'; +import KML from 'ol/format/KML'; +import Layer from 'ol/layer/Layer'; +import LinearRing from 'ol/geom/LinearRing'; +import LineString from 'ol/geom/LineString'; +import loadingstrategy from 'ol/loadingstrategy'; +import MapBrowserEvent from 'ol/MapBrowserEvent'; +import MapBrowserPointerEvent from 'ol/MapBrowserPointerEvent'; +import MapEvent from 'ol/MapEvent'; +import Map from 'ol/Map'; +import Modify from 'ol/interaction/Modify'; +import MousePosition from 'ol/control/MousePosition'; +import MouseWheelZoom from 'ol/interaction/MouseWheelZoom'; +import MultiLineString from 'ol/geom/MultilineString'; +import MultiPoint from 'ol/geom/MultiPoint'; +import MultiPolygon from 'ol/geom/MultiPolygon'; +import MVT from 'ol/format/MVT'; +import Object from 'ol/Object'; +import Observable from 'ol/Observable'; +import ol from 'ol'; +import OSM from 'ol/source/OSM'; +import OSMXML from 'ol/format/OSMXML'; +import Overlay from 'ol/Overlay'; +import OverviewMap from 'ol/control/OverviewMap'; +import PinchRotate from 'ol/interaction/PinchRotate'; +import PinchZoom from 'ol/interaction/PinchZoom'; +import PointerEvent from 'ol/pointer/PointerEvent'; +import Pointer from 'ol/interaction/Pointer'; +import Point from 'ol/geom/Point'; +import Polygon from 'ol/geom/Polygon'; +import Polyline from 'ol/format/Polyline'; +import Projection from 'ol/proj/Projection'; +import proj from 'ol/proj'; +import Raster from 'ol/source/Raster'; +import RegularShape from 'ol/style/RegularShape'; +import Rotate from 'ol/control/Rotate'; +import ScaleLine from 'ol/control/ScaleLine'; +import Select from 'ol/interaction/Select'; +import SimpleGeometry from 'ol/geom/SimpleGeometry'; +import Snap from 'ol/interaction/Snap'; +import Source from 'ol/source/Source'; import Sphere from 'ol/sphere'; - -import Tile from 'ol/tile'; - -import Tilegrid from 'ol/tilegrid'; - -import VectorTile from 'ol/vectortile'; - -import View from 'ol/view'; +import Stamen from 'ol/source/Stamen'; +import Stroke from 'ol/style/Stroke'; +import Style from 'ol/style/Style'; +import TextFeature from 'ol/format/TextFeature'; +import Text from 'ol/style/Text'; +import TileArcGISRest from 'ol/source/TileArcGISRest'; +import TileDebug from 'ol/source/TileDebug'; +import Tile from 'ol/layer/Tile'; +// import Tile from 'ol/source/Tile'; +// import Tile from 'ol/Tile'; +import tilegrid from 'ol/tilegrid'; +import TileGrid from 'ol/tilegrid/TileGrid'; +import TileImage from 'ol/source/TileImage'; +import TileJSON from 'ol/source/TileJSON'; +import TileUTFGrid from 'ol/source/TileUTFGrid'; +import TileWMS from 'ol/source/TileWMS'; +import TopoJSON from 'ol/format/TopoJSON'; +import Translate from 'ol/interaction/Translate'; +import UrlTile from 'ol/source/UrlTile'; +import VectorContext from 'ol/render/VectorContext'; +import Vector from 'ol/layer/Vector'; +// import Vector from 'ol/source/Vector'; +// import VectorTile from 'ol/layer/VectorTile'; +// import VectorTile from 'ol/source/VectorTile'; +import VectorTile from 'ol/VectorTile'; +import View from 'ol/View'; +import WFS from 'ol/format/WFS'; +import WKT from 'ol/format/WKT'; +import WMSCapabilities from 'ol/format/WMSCapabilities'; +import WMSGetFeatureInfo from 'ol/format/WMSGetFeatureInfo'; +import WMTSCapabilities from 'ol/format/WMTSCapabilities'; +import WMTS from 'ol/source/WMTS'; +// import WMTS from 'ol/tilegrid/WMTS'; +import XMLFeature from 'ol/format/XMLFeature'; +import XML from 'ol/format/XML'; +import XYZ from 'ol/source/XYZ'; +import Zoom from 'ol/control/Zoom'; +import Zoomify from 'ol/source/Zoomify'; +import ZoomSlider from 'ol/control/ZoomSlider'; +import ZoomToExtent from 'ol/control/ZoomToExtent'; // Map const map: ol.Map = new Map({} as any); declare const mapView: View; -declare const layerBase: LayerBase; -declare const control: ControlControl; -declare const interaction: InteractionInteraction; map.setView(mapView); -map.addLayer(layerBase); -map.addControl(control); -map.addInteraction(interaction); // View let view: View; diff --git a/types/ol/pointer/pointerevent.d.ts b/types/ol/pointer/PointerEvent.d.ts similarity index 100% rename from types/ol/pointer/pointerevent.d.ts rename to types/ol/pointer/PointerEvent.d.ts diff --git a/types/ol/proj/projection.d.ts b/types/ol/proj/Projection.d.ts similarity index 100% rename from types/ol/proj/projection.d.ts rename to types/ol/proj/Projection.d.ts diff --git a/types/ol/render/event.d.ts b/types/ol/render/Event.d.ts similarity index 100% rename from types/ol/render/event.d.ts rename to types/ol/render/Event.d.ts diff --git a/types/ol/render/feature.d.ts b/types/ol/render/Feature.d.ts similarity index 100% rename from types/ol/render/feature.d.ts rename to types/ol/render/Feature.d.ts diff --git a/types/ol/render/vectorcontext.d.ts b/types/ol/render/VectorContext.d.ts similarity index 100% rename from types/ol/render/vectorcontext.d.ts rename to types/ol/render/VectorContext.d.ts diff --git a/types/ol/source/bingmaps.d.ts b/types/ol/source/BingMaps.d.ts similarity index 100% rename from types/ol/source/bingmaps.d.ts rename to types/ol/source/BingMaps.d.ts diff --git a/types/ol/source/cartodb.d.ts b/types/ol/source/CartoDB.d.ts similarity index 100% rename from types/ol/source/cartodb.d.ts rename to types/ol/source/CartoDB.d.ts diff --git a/types/ol/source/cluster.d.ts b/types/ol/source/Cluster.d.ts similarity index 100% rename from types/ol/source/cluster.d.ts rename to types/ol/source/Cluster.d.ts diff --git a/types/ol/source/image.d.ts b/types/ol/source/Image.d.ts similarity index 100% rename from types/ol/source/image.d.ts rename to types/ol/source/Image.d.ts diff --git a/types/ol/source/imagearcgisrest.d.ts b/types/ol/source/ImageArcGISRest.d.ts similarity index 100% rename from types/ol/source/imagearcgisrest.d.ts rename to types/ol/source/ImageArcGISRest.d.ts diff --git a/types/ol/source/imagecanvas.d.ts b/types/ol/source/ImageCanvas.d.ts similarity index 100% rename from types/ol/source/imagecanvas.d.ts rename to types/ol/source/ImageCanvas.d.ts diff --git a/types/ol/source/imagemapguide.d.ts b/types/ol/source/ImageMapGuide.d.ts similarity index 100% rename from types/ol/source/imagemapguide.d.ts rename to types/ol/source/ImageMapGuide.d.ts diff --git a/types/ol/source/imagestatic.d.ts b/types/ol/source/ImageStatic.d.ts similarity index 100% rename from types/ol/source/imagestatic.d.ts rename to types/ol/source/ImageStatic.d.ts diff --git a/types/ol/source/imagevector.d.ts b/types/ol/source/ImageVector.d.ts similarity index 100% rename from types/ol/source/imagevector.d.ts rename to types/ol/source/ImageVector.d.ts diff --git a/types/ol/source/imagewms.d.ts b/types/ol/source/ImageWMS.d.ts similarity index 100% rename from types/ol/source/imagewms.d.ts rename to types/ol/source/ImageWMS.d.ts diff --git a/types/ol/source/osm.d.ts b/types/ol/source/OSM.d.ts similarity index 100% rename from types/ol/source/osm.d.ts rename to types/ol/source/OSM.d.ts diff --git a/types/ol/source/raster.d.ts b/types/ol/source/Raster.d.ts similarity index 100% rename from types/ol/source/raster.d.ts rename to types/ol/source/Raster.d.ts diff --git a/types/ol/source/source.d.ts b/types/ol/source/Source.d.ts similarity index 100% rename from types/ol/source/source.d.ts rename to types/ol/source/Source.d.ts diff --git a/types/ol/source/stamen.d.ts b/types/ol/source/Stamen.d.ts similarity index 100% rename from types/ol/source/stamen.d.ts rename to types/ol/source/Stamen.d.ts diff --git a/types/ol/source/tile.d.ts b/types/ol/source/Tile.d.ts similarity index 100% rename from types/ol/source/tile.d.ts rename to types/ol/source/Tile.d.ts diff --git a/types/ol/source/tilearcgisrest.d.ts b/types/ol/source/TileArcGISRest.d.ts similarity index 100% rename from types/ol/source/tilearcgisrest.d.ts rename to types/ol/source/TileArcGISRest.d.ts diff --git a/types/ol/source/tiledebug.d.ts b/types/ol/source/TileDebug.d.ts similarity index 100% rename from types/ol/source/tiledebug.d.ts rename to types/ol/source/TileDebug.d.ts diff --git a/types/ol/source/tileimage.d.ts b/types/ol/source/TileImage.d.ts similarity index 100% rename from types/ol/source/tileimage.d.ts rename to types/ol/source/TileImage.d.ts diff --git a/types/ol/source/tilejson.d.ts b/types/ol/source/TileJSON.d.ts similarity index 100% rename from types/ol/source/tilejson.d.ts rename to types/ol/source/TileJSON.d.ts diff --git a/types/ol/source/tileutfgrid.d.ts b/types/ol/source/TileUTFGrid.d.ts similarity index 100% rename from types/ol/source/tileutfgrid.d.ts rename to types/ol/source/TileUTFGrid.d.ts diff --git a/types/ol/source/tilewms.d.ts b/types/ol/source/TileWMS.d.ts similarity index 100% rename from types/ol/source/tilewms.d.ts rename to types/ol/source/TileWMS.d.ts diff --git a/types/ol/source/urltile.d.ts b/types/ol/source/UrlTile.d.ts similarity index 100% rename from types/ol/source/urltile.d.ts rename to types/ol/source/UrlTile.d.ts diff --git a/types/ol/source/vector.d.ts b/types/ol/source/Vector.d.ts similarity index 100% rename from types/ol/source/vector.d.ts rename to types/ol/source/Vector.d.ts diff --git a/types/ol/source/vectortile.d.ts b/types/ol/source/VectorTile.d.ts similarity index 100% rename from types/ol/source/vectortile.d.ts rename to types/ol/source/VectorTile.d.ts diff --git a/types/ol/source/wmts.d.ts b/types/ol/source/WMTS.d.ts similarity index 100% rename from types/ol/source/wmts.d.ts rename to types/ol/source/WMTS.d.ts diff --git a/types/ol/source/xyz.d.ts b/types/ol/source/XYZ.d.ts similarity index 100% rename from types/ol/source/xyz.d.ts rename to types/ol/source/XYZ.d.ts diff --git a/types/ol/source/zoomify.d.ts b/types/ol/source/Zoomify.d.ts similarity index 100% rename from types/ol/source/zoomify.d.ts rename to types/ol/source/Zoomify.d.ts diff --git a/types/ol/style/atlasmanager.d.ts b/types/ol/style/AtlasManager.d.ts similarity index 100% rename from types/ol/style/atlasmanager.d.ts rename to types/ol/style/AtlasManager.d.ts diff --git a/types/ol/style/circle.d.ts b/types/ol/style/Circle.d.ts similarity index 100% rename from types/ol/style/circle.d.ts rename to types/ol/style/Circle.d.ts diff --git a/types/ol/style/fill.d.ts b/types/ol/style/Fill.d.ts similarity index 100% rename from types/ol/style/fill.d.ts rename to types/ol/style/Fill.d.ts diff --git a/types/ol/style/icon.d.ts b/types/ol/style/Icon.d.ts similarity index 100% rename from types/ol/style/icon.d.ts rename to types/ol/style/Icon.d.ts diff --git a/types/ol/style/image.d.ts b/types/ol/style/Image.d.ts similarity index 100% rename from types/ol/style/image.d.ts rename to types/ol/style/Image.d.ts diff --git a/types/ol/style/regularshape.d.ts b/types/ol/style/RegularShape.d.ts similarity index 100% rename from types/ol/style/regularshape.d.ts rename to types/ol/style/RegularShape.d.ts diff --git a/types/ol/style/stroke.d.ts b/types/ol/style/Stroke.d.ts similarity index 100% rename from types/ol/style/stroke.d.ts rename to types/ol/style/Stroke.d.ts diff --git a/types/ol/style/style.d.ts b/types/ol/style/Style.d.ts similarity index 100% rename from types/ol/style/style.d.ts rename to types/ol/style/Style.d.ts diff --git a/types/ol/style/text.d.ts b/types/ol/style/Text.d.ts similarity index 100% rename from types/ol/style/text.d.ts rename to types/ol/style/Text.d.ts diff --git a/types/ol/tilegrid/tilegrid.d.ts b/types/ol/tilegrid/TileGrid.d.ts similarity index 100% rename from types/ol/tilegrid/tilegrid.d.ts rename to types/ol/tilegrid/TileGrid.d.ts diff --git a/types/ol/tilegrid/wmts.d.ts b/types/ol/tilegrid/WMTS.d.ts similarity index 100% rename from types/ol/tilegrid/wmts.d.ts rename to types/ol/tilegrid/WMTS.d.ts diff --git a/types/ol/tsconfig.json b/types/ol/tsconfig.json index 186bb605e0..8751d240da 100644 --- a/types/ol/tsconfig.json +++ b/types/ol/tsconfig.json @@ -20,159 +20,159 @@ "files": [ "index.d.ts", "ol-tests.ts", - "control/attribution.d.ts", - "control/control.d.ts", - "control/fullscreen.d.ts", - "control/mouseposition.d.ts", - "control/overviewmap.d.ts", - "control/rotate.d.ts", - "control/scaleline.d.ts", - "control/zoom.d.ts", - "control/zoomslider.d.ts", - "control/zoomtoextent.d.ts", + "control/Attribution.d.ts", + "control/Control.d.ts", + "control/Fullscreen.d.ts", + "control/MousePosition.d.ts", + "control/OverviewMap.d.ts", + "control/Rotate.d.ts", + "control/ScaleLine.d.ts", + "control/Zoom.d.ts", + "control/ZoomSlider.d.ts", + "control/ZoomToExtent.d.ts", "events/condition.d.ts", - "events/event.d.ts", - "events/eventtarget.d.ts", - "format/esrijson.d.ts", - "format/feature.d.ts", + "events/Event.d.ts", + "events/EventTarget.d.ts", + "format/EsriJSON.d.ts", + "format/Feature.d.ts", "format/filter.d.ts", - "format/geojson.d.ts", - "format/gml2.d.ts", - "format/gml3.d.ts", - "format/gmlbase.d.ts", - "format/gpx.d.ts", - "format/igc.d.ts", - "format/jsonfeature.d.ts", - "format/kml.d.ts", - "format/mvt.d.ts", - "format/osmxml.d.ts", - "format/polyline.d.ts", - "format/textfeature.d.ts", - "format/topojson.d.ts", - "format/wfs.d.ts", - "format/wkt.d.ts", - "format/wmscapabilities.d.ts", - "format/wmsgetfeatureinfo.d.ts", - "format/wmtscapabilities.d.ts", - "format/xml.d.ts", - "format/xmlfeature.d.ts", - "geom/circle.d.ts", - "geom/geometry.d.ts", - "geom/geometrycollection.d.ts", - "geom/linearring.d.ts", - "geom/linestring.d.ts", - "geom/multilinestring.d.ts", - "geom/multipoint.d.ts", - "geom/multipolygon.d.ts", - "geom/point.d.ts", - "geom/polygon.d.ts", - "geom/simplegeometry.d.ts", - "interaction/doubleclickzoom.d.ts", - "interaction/draganddrop.d.ts", - "interaction/dragbox.d.ts", - "interaction/dragpan.d.ts", - "interaction/dragrotate.d.ts", - "interaction/dragrotateandzoom.d.ts", - "interaction/dragzoom.d.ts", - "interaction/draw.d.ts", - "interaction/extent.d.ts", - "interaction/interaction.d.ts", - "interaction/keyboardpan.d.ts", - "interaction/keyboardzoom.d.ts", - "interaction/modify.d.ts", - "interaction/mousewheelzoom.d.ts", - "interaction/pinchrotate.d.ts", - "interaction/pinchzoom.d.ts", - "interaction/pointer.d.ts", - "interaction/select.d.ts", - "interaction/snap.d.ts", - "interaction/translate.d.ts", - "layer/base.d.ts", - "layer/group.d.ts", - "layer/heatmap.d.ts", - "layer/image.d.ts", - "layer/layer.d.ts", - "layer/tile.d.ts", - "layer/vector.d.ts", - "layer/vectortile.d.ts", - "pointer/pointerevent.d.ts", + "format/GeoJSON.d.ts", + "format/GML2.d.ts", + "format/GML3.d.ts", + "format/GMLBase.d.ts", + "format/GPX.d.ts", + "format/IGC.d.ts", + "format/JSONFeature.d.ts", + "format/KML.d.ts", + "format/MVT.d.ts", + "format/OSMXML.d.ts", + "format/Polyline.d.ts", + "format/TextFeature.d.ts", + "format/TopoJSON.d.ts", + "format/WFS.d.ts", + "format/WKT.d.ts", + "format/WMSCapabilities.d.ts", + "format/WMSGetFeatureInfo.d.ts", + "format/WMTSCapabilities.d.ts", + "format/XML.d.ts", + "format/XMLFeature.d.ts", + "geom/Circle.d.ts", + "geom/GeometryCollection.d.ts", + "geom/Geometry.d.ts", + "geom/LinearRing.d.ts", + "geom/LineString.d.ts", + "geom/MultilineString.d.ts", + "geom/MultiPoint.d.ts", + "geom/MultiPolygon.d.ts", + "geom/Point.d.ts", + "geom/Polygon.d.ts", + "geom/SimpleGeometry.d.ts", + "interaction/DoubleClickZoom.d.ts", + "interaction/DragAndDrop.d.ts", + "interaction/DragBox.d.ts", + "interaction/DragPan.d.ts", + "interaction/DragRotateAndZoom.d.ts", + "interaction/DragRotate.d.ts", + "interaction/DragZoom.d.ts", + "interaction/Draw.d.ts", + "interaction/Extent.d.ts", + "interaction/Interaction.d.ts", + "interaction/KeyboardPan.d.ts", + "interaction/KeyboardZoom.d.ts", + "interaction/Modify.d.ts", + "interaction/MouseWheelZoom.d.ts", + "interaction/PinchRotate.d.ts", + "interaction/PinchZoom.d.ts", + "interaction/Pointer.d.ts", + "interaction/Select.d.ts", + "interaction/Snap.d.ts", + "interaction/Translate.d.ts", + "layer/Base.d.ts", + "layer/Group.d.ts", + "layer/Heatmap.d.ts", + "layer/Image.d.ts", + "layer/Layer.d.ts", + "layer/Tile.d.ts", + "layer/Vector.d.ts", + "layer/VectorTile.d.ts", + "pointer/PointerEvent.d.ts", "proj/index.d.ts", - "proj/projection.d.ts", + "proj/Projection.d.ts", "render/canvas.d.ts", - "render/event.d.ts", - "render/feature.d.ts", - "render/vectorcontext.d.ts", - "source/bingmaps.d.ts", - "source/cartodb.d.ts", - "source/cluster.d.ts", - "source/image.d.ts", - "source/imagearcgisrest.d.ts", - "source/imagecanvas.d.ts", - "source/imagemapguide.d.ts", - "source/imagestatic.d.ts", - "source/imagevector.d.ts", - "source/imagewms.d.ts", - "source/osm.d.ts", - "source/raster.d.ts", - "source/source.d.ts", - "source/stamen.d.ts", - "source/tile.d.ts", - "source/tilearcgisrest.d.ts", - "source/tiledebug.d.ts", - "source/tileimage.d.ts", - "source/tilejson.d.ts", - "source/tileutfgrid.d.ts", - "source/tilewms.d.ts", - "source/urltile.d.ts", - "source/vector.d.ts", - "source/vectortile.d.ts", - "source/wmts.d.ts", - "source/xyz.d.ts", - "source/zoomify.d.ts", - "style/atlasmanager.d.ts", - "style/circle.d.ts", - "style/fill.d.ts", - "style/icon.d.ts", - "style/image.d.ts", - "style/regularshape.d.ts", - "style/stroke.d.ts", - "style/style.d.ts", - "style/text.d.ts", - "tilegrid/tilegrid.d.ts", - "tilegrid/wmts.d.ts", - "assertionerror/index.d.ts", - "attribution/index.d.ts", - "collection/index.d.ts", + "render/Event.d.ts", + "render/Feature.d.ts", + "render/VectorContext.d.ts", + "source/BingMaps.d.ts", + "source/CartoDB.d.ts", + "source/Cluster.d.ts", + "source/ImageArcGISRest.d.ts", + "source/ImageCanvas.d.ts", + "source/Image.d.ts", + "source/ImageMapGuide.d.ts", + "source/ImageStatic.d.ts", + "source/ImageVector.d.ts", + "source/ImageWMS.d.ts", + "source/OSM.d.ts", + "source/Raster.d.ts", + "source/Source.d.ts", + "source/Stamen.d.ts", + "source/TileArcGISRest.d.ts", + "source/TileDebug.d.ts", + "source/Tile.d.ts", + "source/TileImage.d.ts", + "source/TileJSON.d.ts", + "source/TileUTFGrid.d.ts", + "source/TileWMS.d.ts", + "source/UrlTile.d.ts", + "source/Vector.d.ts", + "source/VectorTile.d.ts", + "source/WMTS.d.ts", + "source/XYZ.d.ts", + "source/Zoomify.d.ts", + "style/AtlasManager.d.ts", + "style/Circle.d.ts", + "style/Fill.d.ts", + "style/Icon.d.ts", + "style/Image.d.ts", + "style/RegularShape.d.ts", + "style/Stroke.d.ts", + "style/Style.d.ts", + "style/Text.d.ts", + "tilegrid/TileGrid.d.ts", + "tilegrid/WMTS.d.ts", + "AssertionError/index.d.ts", + "Attribution/index.d.ts", + "Collection/index.d.ts", "color/index.d.ts", "colorlike/index.d.ts", "control/index.d.ts", "coordinate/index.d.ts", "deviceorientation/index.d.ts", - "disposable/index.d.ts", + "Disposable/index.d.ts", "easing/index.d.ts", "events/index.d.ts", "extent/index.d.ts", - "feature/index.d.ts", + "Feature/index.d.ts", "featureloader/index.d.ts", - "geolocation/index.d.ts", - "graticule/index.d.ts", - "image/index.d.ts", - "imagebase/index.d.ts", - "imagetile/index.d.ts", + "Geolocation/index.d.ts", + "Graticule/index.d.ts", + "ImageBase/index.d.ts", + "Image/index.d.ts", + "ImageTile/index.d.ts", "interaction/index.d.ts", - "kinetic/index.d.ts", + "Kinetic/index.d.ts", "loadingstrategy/index.d.ts", - "map/index.d.ts", - "mapbrowserevent/index.d.ts", - "mapbrowserpointerevent/index.d.ts", - "mapevent/index.d.ts", - "object/index.d.ts", - "observable/index.d.ts", - "overlay/index.d.ts", + "MapBrowserEvent/index.d.ts", + "MapBrowserPointerEvent/index.d.ts", + "MapEvent/index.d.ts", + "Map/index.d.ts", + "Object/index.d.ts", + "Observable/index.d.ts", + "Overlay/index.d.ts", "sphere/index.d.ts", - "tile/index.d.ts", + "Tile/index.d.ts", "tilegrid/index.d.ts", - "vectortile/index.d.ts", - "view/index.d.ts" + "VectorTile/index.d.ts", + "View/index.d.ts" ] -} \ No newline at end of file +} diff --git a/types/on-change/index.d.ts b/types/on-change/index.d.ts deleted file mode 100644 index 44fff26e60..0000000000 --- a/types/on-change/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for on-change 0.1 -// Project: https://github.com/sindresorhus/on-change#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -export = onChange; - -declare function onChange(object: T, onChange: () => void): T; diff --git a/types/on-change/on-change-tests.ts b/types/on-change/on-change-tests.ts deleted file mode 100644 index 003d89aab7..0000000000 --- a/types/on-change/on-change-tests.ts +++ /dev/null @@ -1,17 +0,0 @@ -import onChange = require('on-change'); - -const object = { - foo: false, - a: { - b: [ - { - c: false, - }, - ], - }, -}; - -const watchedObject = onChange(object, () => {}); - -watchedObject.foo = true; -watchedObject.a.b[0].c = true; diff --git a/types/on-change/tsconfig.json b/types/on-change/tsconfig.json deleted file mode 100644 index 433629ab82..0000000000 --- a/types/on-change/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "on-change-tests.ts" - ] -} diff --git a/types/onoff/tslint.json b/types/onoff/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/onoff/tslint.json +++ b/types/onoff/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/open-graph/index.d.ts b/types/open-graph/index.d.ts new file mode 100644 index 0000000000..14a3fe3ce6 --- /dev/null +++ b/types/open-graph/index.d.ts @@ -0,0 +1,74 @@ +// Type definitions for open-graph 0.2 +// Project: https://github.com/samholmes/node-open-graph +// Definitions by: Florian Keller +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.2 + +/// + +declare namespace og { + interface Metadata { + [key: string]: string | string[] | undefined; + /** An alternate url to use if the webpage requires HTTPS. */ + secure_url?: string | string[]; + /** A MIME type for this image. */ + type?: string | string[]; + } + + interface ImageVideoMetadata extends Metadata { + /** A description of what is in the image (not a caption). If the page specifies an `og:image` it should specify `og:image:alt`. */ + alt?: string | string[]; + /** The number of pixels high. */ + height?: string | string[]; + /** The */ + url?: string | string[]; + /** The number of pixels wide. */ + width?: string | string[]; + } + + interface Data { + [key: string]: string | string[] | ImageVideoMetadata | Metadata | undefined; + /** A URL to an audio file to accompany this object. */ + audio?: string | string[] | Metadata; + /** A one to two sentence description of your object. */ + description?: string | string[]; + /** + * The word that appears before this object's title in a sentence. An enum of (a, an, the, "", auto). + * If auto is chosen, the consumer of your data should chose between "a" or "an". Default is "" (blank). + */ + determiner?: string | string[]; + /** An image URL which should represent your object within the graph. */ + image?: string | string[] | ImageVideoMetadata; + /** The locale these tags are marked up in. Of the format `language_TERRITORY`. Default is `en_US`. */ + locale?: + | string | string[] + | { + /** An array of other locales this page is available in. */ + alternate?: string | string[]; + }; + /** If your object is part of a larger web site, the name which should be displayed for the overall site. e.g., "IMDb". */ + site_name?: string | string[]; + /** The title of your object as it should appear within the graph, e.g., "The Rock". */ + title: string | string[]; + /** The type of your object, e.g., "video.movie". Depending on the type you specify, other properties may also be required. */ + type?: string | string[]; + /** The canonical URL of your object that will be used as its permanent ID in the graph, e.g., "http://www.imdb.com/title/tt0117500/". */ + url?: string | string[]; + /** A URL to a video file that complements this object. */ + video?: string | string[] | ImageVideoMetadata; + } + + type DataCallback = (err: Error | null, data: Data | undefined) => void; + type RequestCallback = (err: Error | null, data: string | undefined) => void; + + interface Options { + strict?: boolean; + } + + function parse(websiteContent: string, options?: Options): Data; + function getHTML(url: string | Cheerio, callback: RequestCallback): void; +} + +declare function og(url: string, callback: og.DataCallback, options?: og.Options): void; + +export = og; diff --git a/types/open-graph/open-graph-tests.ts b/types/open-graph/open-graph-tests.ts new file mode 100644 index 0000000000..4e3db10438 --- /dev/null +++ b/types/open-graph/open-graph-tests.ts @@ -0,0 +1,18 @@ +import og = require('open-graph'); + +const url = 'http://github.com/samholmes/node-open-graph/raw/master/test.html'; + +og(url, (err, meta) => { + if (meta) { + meta.custom; + meta.description; // $ExpectType string | string[] | undefined + } +}); + +og.parse('content', { + strict: true, +}); + +og.getHTML('http://github.com/samholmes/node-open-graph/raw/master/test.html', (err, data) => { + data; // $ExpectType string | undefined +}); diff --git a/types/open-graph/tsconfig.json b/types/open-graph/tsconfig.json new file mode 100644 index 0000000000..72fa10a12d --- /dev/null +++ b/types/open-graph/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", + "open-graph-tests.ts" + ] +} diff --git a/types/npm-name/tslint.json b/types/open-graph/tslint.json similarity index 100% rename from types/npm-name/tslint.json rename to types/open-graph/tslint.json diff --git a/types/open/tslint.json b/types/open/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/open/tslint.json +++ b/types/open/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/openjscad/tslint.json b/types/openjscad/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/openjscad/tslint.json +++ b/types/openjscad/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/openpgp/index.d.ts b/types/openpgp/index.d.ts index d564c6df6d..c9a95e8c6a 100644 --- a/types/openpgp/index.d.ts +++ b/types/openpgp/index.d.ts @@ -1,859 +1,5162 @@ -// Type definitions for openpgp 4.0.1 -// Project: http://openpgpjs.org/ +// Type definitions for openpgp v4.4.10 +// Project: https://openpgpjs.org // Definitions by: Guillaume Lacasa // Errietta Kostala // Daniel Montesinos // Carlos Villavicencio // Eric Camellini +// SardineFIsh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 +import BN = require("bn.js"); +import stream = require("stream") + +export { } + +// Declare to fix type issue +type NodeStream = stream; +type Integer = number; +type Infinity = any; +type ReadableStream = any; export as namespace openpgp; -export interface UserId { - name?: string, - email?: string, +export namespace cleartext { + /** + * Class that represents an OpenPGP cleartext signed message. + * See {@link https://tools.ietf.org/html/rfc4880#section-7} + */ + class CleartextMessage { + /** + * @param text The cleartext of the signed message + * @param signature The detached signature or an empty signature for unsigned messages + */ + constructor(text: string, signature: signature.Signature); + + /** + * Returns the key IDs of the keys that signed the cleartext message + * @returns array of keyid objects + */ + getSigningKeyIds(): any[]; + + /** + * Sign the cleartext message + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature + * @param date (optional) The creation time of the signature that should be created + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new cleartext message with signed content + */ + sign(privateKeys: any[], signature: signature.Signature, date: Date, userIds: any[]): Promise; + + /** + * Sign the cleartext message + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature + * @param date (optional) The creation time of the signature that should be created + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new detached signature of message content + */ + signDetached(privateKeys: any[], signature: signature.Signature, date: Date, userIds: any[]): Promise; + + /** + * Verify signatures of cleartext signed message + * @param keys array of keys to verify signatures + * @param date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + verify(keys: any[], date: Date): Promise>; + + /** + * Verify signatures of cleartext signed message + * @param keys array of keys to verify signatures + * @param date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + verifyDetached(keys: any[], date: Date): Promise>; + + /** + * Get cleartext + * @returns cleartext of message + */ + getText(): string; + + /** + * Returns ASCII armored text of cleartext signed message + * @returns ASCII armor + */ + armor(): string | ReadableStream; + } + + /** + * reads an OpenPGP cleartext signed message and returns a CleartextMessage object + * @param armoredText text to be parsed + * @returns new cleartext message object + */ + function readArmored(armoredText: string | ReadableStream): CleartextMessage; + + /** + * Creates a new CleartextMessage object from text + * @param text + */ + function fromText(text: string): void; } -export interface SessionKey { - data: Uint8Array, - algorithm: string +/** + * @see module:config/config + */ +export namespace config { + var prefer_hash_algorithm: any; + + var encryption_cipher: any; + + var compression: any; + + var deflate_level: any; + + /** + * Use Authenticated Encryption with Additional Data (AEAD) protection for symmetric encryption. + * **NOT INTEROPERABLE WITH OTHER OPENPGP IMPLEMENTATIONS** + * **FUTURE OPENPGP.JS VERSIONS MAY BREAK COMPATIBILITY WHEN USING THIS OPTION** + */ + var aead_protect: any; + + /** + * Use Authenticated Encryption with Additional Data (AEAD) protection for symmetric encryption. + * 0 means we implement a variant of {@link https://tools.ietf.org/html/draft-ford-openpgp-format-00|this IETF draft}. + * 4 means we implement {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04|RFC4880bis-04}. + * Note that this determines how AEAD packets are parsed even when aead_protect is set to false + */ + var aead_protect_version: any; + + /** + * Default Authenticated Encryption with Additional Data (AEAD) encryption mode + * Only has an effect when aead_protect is set to true. + */ + var aead_mode: any; + + /** + * Chunk Size Byte for Authenticated Encryption with Additional Data (AEAD) mode + * Only has an effect when aead_protect is set to true. + * Must be an integer value from 0 to 56. + */ + var aead_chunk_size_byte: any; + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-3.7.1.3|RFC4880 3.7.1.3}: + * Iteration Count Byte for S2K (String to Key) + */ + var s2k_iteration_count_byte: any; + + /** + * Use integrity protection for symmetric encryption + */ + var integrity_protect: any; + + var ignore_mdc_error: any; + + var allow_unauthenticated_stream: any; + + var checksum_required: any; + + var rsa_blinding: any; + + /** + * Work-around for rare GPG decryption bug when encrypting with multiple passwords. + * **Slower and slightly less secure** + */ + var password_collision_check: any; + + var revocations_expire: any; + + var use_native: any; + + var min_bytes_for_web_crypto: any; + + var zero_copy: any; + + var debug: any; + + var tolerant: any; + + var show_version: any; + + var show_comment: any; + + var versionstring: any; + + var commentstring: any; + + var keyserver: any; + + var node_store: any; + + /** + * Max userid string length (used for parsing) + */ + var max_userid_length: any; + + namespace localStorage { + class LocalStorage { + /** + * This object is used for storing and retrieving configuration from HTML5 local storage. + */ + constructor(); + + /** + * Reads the config out of the HTML5 local storage + * and initializes the object config. + * if config is null the default config will be used + */ + read(): void; + + /** + * Writes the config to HTML5 local storage + */ + write(): void; + } + } } -export interface EncryptOptions { - message: message.Message - publicKeys?: key.Key | key.Key[], - privateKeys?: key.Key | key.Key[], - passwords?: string | string[], - sessionKey?: SessionKey, - compression?: enums.compression, - armor?: boolean, - streaming?: 'web' | 'node' | false - detached?: boolean, - signature?: Signature, - returnSessionKey?: boolean, - wildcard?: boolean, - date?: Date, - fromUserId?: UserId, - toUserId?: UserId, +export class LocalStorage { + /** + * This object is used for storing and retrieving configuration from HTML5 local storage. + */ + constructor(); + + /** + * Reads the config out of the HTML5 local storage + * and initializes the object config. + * if config is null the default config will be used + */ + read(): void; + + /** + * Writes the config to HTML5 local storage + */ + write(): void; } -export interface EncryptedMessage { - data?: string, - message?: message.Message, - signature?: string | ReadableStream | Signature // TODO add NodeStream - sessionKey?: SessionKey + + +/** + * @see module:crypto/crypto + * @see module:crypto/signature + * @see module:crypto/public_key + * @see module:crypto/cipher + * @see module:crypto/random + * @see module:crypto/hash + */ +export namespace crypto { + /** + * @see module:crypto/public_key/elliptic/ecdh + */ + namespace aes_kw { + /** + * AES key wrap + * @param key + * @param data + * @returns + */ + function wrap(key: string, data: string): Uint8Array; + + /** + * AES key unwrap + * @param key + * @param data + * @returns + * @throws + */ + function unwrap(key: string, data: string): Uint8Array; + } + + namespace cfb { + function encrypt(algo: any, key: any, plaintext: any, iv: any): any + function decrypt(algo: any, key: any, ciphertext: any, iv: any): Promise + } + + namespace cipher { + /** + * AES-128 encryption and decryption (ID 7) + * @param key 128-bit key + * @see + * @see + * @returns + */ + function aes128(key: string): object; + + /** + * AES-128 Block Cipher (ID 8) + * @param key 192-bit key + * @see + * @see + * @returns + */ + function aes192(key: string): object; + + /** + * AES-128 Block Cipher (ID 9) + * @param key 256-bit key + * @see + * @see + * @returns + */ + function aes256(key: string): object; + + /** + * Triple DES Block Cipher (ID 2) + * @param key 192-bit key + * @see + * @returns + */ + function tripledes(key: string): object; + + /** + * CAST-128 Block Cipher (ID 3) + * @param key 128-bit key + * @see + * @returns + */ + function cast5(key: string): object; + + /** + * Twofish Block Cipher (ID 10) + * @param key 256-bit key + * @see + * @returns + */ + function twofish(key: string): object; + + /** + * Blowfish Block Cipher (ID 4) + * @param key 128-bit key + * @see + * @returns + */ + function blowfish(key: string): object; + + /** + * Not implemented + * @throws + */ + function idea(): void; + } + + namespace cmac { + /** + * This implementation of CMAC is based on the description of OMAC in + * http://web.cs.ucdavis.edu/~rogaway/papers/eax.pdf. As per that + * document: + * We have made a small modification to the OMAC algorithm as it was + * originally presented, changing one of its two constants. + * Specifically, the constant 4 at line 85 was the constant 1/2 (the + * multiplicative inverse of 2) in the original definition of OMAC [14]. + * The OMAC authors indicate that they will promulgate this modification + * [15], which slightly simplifies implementations. + */ + const blockLength: any; + + /** + * xor `padding` into the end of `data`. This function implements "the + * operation xor→ [which] xors the shorter string into the end of longer + * one". Since data is always as least as long as padding, we can + * simplify the implementation. + * @param data + * @param padding + */ + function rightXorMut(data: Uint8Array, padding: Uint8Array): void; + } + + namespace crypto { + /** + * Encrypts data using specified algorithm and public key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} for public key algorithms. + * @param algo Public key algorithm + * @param pub_params Algorithm-specific public key parameters + * @param data Data to be encrypted as MPI + * @param fingerprint Recipient fingerprint + * @returns encrypted session key parameters + */ + function publicKeyEncrypt(algo: enums.publicKey, pub_params: Array, data: type.mpi.MPI, fingerprint: string): any[]; + + /** + * Decrypts data using specified algorithm and private key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} for public key algorithms. + * @param algo Public key algorithm + * @param key_params Algorithm-specific public, private key parameters + * @param data_params encrypted session key parameters + * @param fingerprint Recipient fingerprint + * @returns An MPI containing the decrypted data + */ + function publicKeyDecrypt(algo: enums.publicKey, key_params: Array, data_params: Array, fingerprint: string): type.mpi.MPI; + + /** + * Returns the types comprising the private key of an algorithm + * @param algo The public key algorithm + * @returns The array of types + */ + function getPrivKeyParamTypes(algo: string): any[]; + + /** + * Returns the types comprising the public key of an algorithm + * @param algo The public key algorithm + * @returns The array of types + */ + function getPubKeyParamTypes(algo: string): any[]; + + /** + * Returns the types comprising the encrypted session key of an algorithm + * @param algo The public key algorithm + * @returns The array of types + */ + function getEncSessionKeyParamTypes(algo: string): any[]; + + /** + * Generate algorithm-specific key parameters + * @param algo The public key algorithm + * @param bits Bit length for RSA keys + * @param oid Object identifier for ECC keys + * @returns The array of parameters + */ + function generateParams(algo: string, bits: Integer, oid: type.oid.OID): any[]; + + /** + * Generates a random byte prefix for the specified algorithm + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param algo Symmetric encryption algorithm + * @returns Random bytes with length equal to the block size of the cipher, plus the last two bytes repeated. + */ + function getPrefixRandom(algo: enums.symmetric): Uint8Array; + + /** + * Generating a session key for the specified symmetric algorithm + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param algo Symmetric encryption algorithm + * @returns Random bytes as a string to be used as a key + */ + function generateSessionKey(algo: enums.symmetric): Uint8Array; + } + + namespace eax { + /** + * Class to en/decrypt using EAX mode. + * @param cipher The symmetric cipher algorithm to use e.g. 'aes128' + * @param key The encryption key + */ + function EAX(cipher: string, key: Uint8Array): void; + + /** + * Encrypt plaintext input. + * @param plaintext The cleartext input to be encrypted + * @param nonce The nonce (16 bytes) + * @param adata Associated data to sign + * @returns The ciphertext output + */ + function encrypt(plaintext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + + /** + * Decrypt ciphertext input. + * @param ciphertext The ciphertext input to be decrypted + * @param nonce The nonce (16 bytes) + * @param adata Associated data to verify + * @returns The plaintext output + */ + function decrypt(ciphertext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + } + + namespace gcm { + /** + * Class to en/decrypt using GCM mode. + * @param cipher The symmetric cipher algorithm to use e.g. 'aes128' + * @param key The encryption key + */ + function GCM(cipher: string, key: Uint8Array): void; + } + + /** + * @see + * @see + */ + namespace hash { + /** + * @see module:md5 + */ + var md5: any; + + /** + * @see asmCrypto + */ + var sha1: any; + + /** + * @see hash.js + */ + var sha224: any; + + /** + * @see asmCrypto + */ + var sha256: any; + + /** + * @see hash.js + */ + var sha384: any; + + /** + * @see asmCrypto + */ + var sha512: any; + + /** + * @see hash.js + */ + var ripemd: any; + + /** + * Create a hash on the specified data using the specified algorithm + * @param algo Hash algorithm type (see {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4}) + * @param data Data to be hashed + * @returns hash value + */ + function digest(algo: enums.hash, data: Uint8Array): Promise; + + /** + * Returns the hash size in bytes of the specified hash algorithm type + * @param algo Hash algorithm type (See {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4}) + * @returns Size in bytes of the resulting hash + */ + function getHashByteLength(algo: enums.hash): Integer; + } + + /** + * @see module:packet.PublicKeyEncryptedSessionKey + */ + namespace pkcs5 { + /** + * Add pkcs5 padding to a text. + * @param msg Text to add padding + * @returns Text with padding added + */ + function encode(msg: string): string; + + /** + * Remove pkcs5 padding from a string. + * @param msg Text to remove padding from + * @returns Text with padding removed + */ + function decode(msg: string): string; + } + + namespace ocb { + /** + * Class to en/decrypt using OCB mode. + * @param cipher The symmetric cipher algorithm to use e.g. 'aes128' + * @param key The encryption key + */ + function OCB(cipher: string, key: Uint8Array): void; + + /** + * Encrypt plaintext input. + * @param plaintext The cleartext input to be encrypted + * @param nonce The nonce (15 bytes) + * @param adata Associated data to sign + * @returns The ciphertext output + */ + function encrypt(plaintext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + + /** + * Decrypt ciphertext input. + * @param ciphertext The ciphertext input to be decrypted + * @param nonce The nonce (15 bytes) + * @param adata Associated data to sign + * @returns The ciphertext output + */ + function decrypt(ciphertext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + } + + /** + * @see module:crypto/public_key/rsa + * @see module:crypto/public_key/elliptic/ecdh + * @see module:packet.PublicKeyEncryptedSessionKey + */ + namespace pkcs1 { + namespace eme { + /** + * Create a EME-PKCS1-v1_5 padded message + * @see + * @param M message to be encoded + * @param k the length in octets of the key modulus + * @returns EME-PKCS1 padded message + */ + function encode(M: string, k: Integer): Promise; + + /** + * Decode a EME-PKCS1-v1_5 padded message + * @see + * @param EM encoded message, an octet string + * @returns message, an octet string + */ + function decode(EM: string): string; + } + + namespace emsa { + /** + * Create a EMSA-PKCS1-v1_5 padded message + * @see + * @param algo Hash algorithm type used + * @param hashed message to be encoded + * @param emLen intended length in octets of the encoded message + * @returns encoded message + */ + function encode(algo: Integer, hashed: Uint8Array, emLen: Integer): string; + } + + /** + * ASN1 object identifiers for hashes + * @see + */ + const hash_headers: any; + } + + namespace public_key { + namespace dsa { + /** + * DSA Sign function + * @param hash_algo + * @param hashed + * @param g + * @param p + * @param q + * @param x + * @returns + */ + function sign(hash_algo: Integer, hashed: Uint8Array, g: BN, p: BN, q: BN, x: BN): object; + + /** + * DSA Verify function + * @param hash_algo + * @param r + * @param s + * @param hashed + * @param g + * @param p + * @param q + * @param y + * @returns BN + */ + function verify(hash_algo: Integer, r: BN, s: BN, hashed: Uint8Array, g: BN, p: BN, q: BN, y: BN): any; + } + + namespace elgamal { + /** + * ElGamal Encryption function + * @param m + * @param p + * @param g + * @param y + * @returns + */ + function encrypt(m: BN, p: BN, g: BN, y: BN): object; + + /** + * ElGamal Encryption function + * @param c1 + * @param c2 + * @param p + * @param x + * @returns BN + */ + function decrypt(c1: BN, c2: BN, p: BN, x: BN): any; + } + + /** + * @see module:crypto/public_key/elliptic/curve + * @see module:crypto/public_key/elliptic/ecdh + * @see module:crypto/public_key/elliptic/ecdsa + * @see module:crypto/public_key/elliptic/eddsa + */ + namespace elliptic { + namespace curve { + class Curve { + } + } + + namespace ecdh { + /** + * Generate ECDHE ephemeral key and secret from public key + * @param curve Elliptic curve object + * @param Q Recipient public key + * @returns Returns public part of ephemeral key and generated ephemeral secret + */ + function genPublicEphemeralKey(curve: curve.Curve, Q: Uint8Array): Promise<{ V: Uint8Array, S: BN }>; + + /** + * Encrypt and wrap a session key + * @param oid Elliptic curve object identifier + * @param cipher_algo Symmetric cipher to use + * @param hash_algo Hash algorithm to use + * @param m Value derived from session key (RFC 6637) + * @param Q Recipient public key + * @param fingerprint Recipient fingerprint + * @returns Returns public part of ephemeral key and encoded session key + */ + function encrypt(oid: type.oid.OID, cipher_algo: enums.symmetric, hash_algo: enums.hash, m: type.mpi.MPI, Q: Uint8Array, fingerprint: string): Promise<{ V: BN, C: BN }>; + + /** + * Generate ECDHE secret from private key and public part of ephemeral key + * @param curve Elliptic curve object + * @param V Public part of ephemeral key + * @param d Recipient private key + * @returns Generated ephemeral secret + */ + function genPrivateEphemeralKey(curve: curve.Curve, V: Uint8Array, d: Uint8Array): Promise; + + /** + * Decrypt and unwrap the value derived from session key + * @param oid Elliptic curve object identifier + * @param cipher_algo Symmetric cipher to use + * @param hash_algo Hash algorithm to use + * @param V Public part of ephemeral key + * @param C Encrypted and wrapped value derived from session key + * @param d Recipient private key + * @param fingerprint Recipient fingerprint + * @returns Value derived from session + */ + function decrypt(oid: type.oid.OID, cipher_algo: enums.symmetric, hash_algo: enums.hash, V: Uint8Array, C: Uint8Array, d: Uint8Array, fingerprint: string): Promise; + } + + namespace ecdsa { + /** + * Sign a message using the provided key + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used to sign + * @param m Message to sign + * @param d Private key used to sign the message + * @param hashed The hashed message + * @returns Signature of the message + */ + function sign(oid: type.oid.OID, hash_algo: enums.hash, m: Uint8Array, d: Uint8Array, hashed: Uint8Array): object; + + /** + * Verifies if a signature is valid for a message + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used in the signature + * @param signature Signature to verify + * @param m Message to verify + * @param Q Public key used to verify the message + * @param hashed The hashed message + * @returns + */ + function verify(oid: type.oid.OID, hash_algo: enums.hash, signature: object, m: Uint8Array, Q: Uint8Array, hashed: Uint8Array): boolean; + } + + namespace eddsa { + /** + * Sign a message using the provided keygit + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used to sign + * @param m Message to sign + * @param d Private key used to sign + * @param hashed The hashed message + * @returns Signature of the message + */ + function sign(oid: type.oid.OID, hash_algo: enums.hash, m: Uint8Array, d: Uint8Array, hashed: Uint8Array): object; + + /** + * Verifies if a signature is valid for a message + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used in the signature + * @param signature Signature to verify the message + * @param m Message to verify + * @param Q Public key used to verify the message + * @param hashed The hashed message + * @returns + */ + function verify(oid: type.oid.OID, hash_algo: enums.hash, signature: object, m: Uint8Array, Q: Uint8Array, hashed: Uint8Array): boolean; + } + + namespace key { + class KeyPair { + } + } + } + + namespace prime { + /** + * Probabilistic random number generator + * @param bits Bit length of the prime + * @param e Optional RSA exponent to check against the prime + * @param k Optional number of iterations of Miller-Rabin test + * @returns BN + */ + function randomProbablePrime(bits: Integer, e: BN, k: Integer): any; + + /** + * Probabilistic primality testing + * @param n Number to test + * @param e Optional RSA exponent to check against the prime + * @param k Optional number of iterations of Miller-Rabin test + * @returns + */ + function isProbablePrime(n: BN, e: BN, k: Integer): boolean; + + /** + * Tests whether n is probably prime or not using Fermat's test with b = 2. + * Fails if b^(n-1) mod n === 1. + * @param n Number to test + * @param b Optional Fermat test base + * @returns + */ + function fermat(n: BN, b: Integer): boolean; + + /** + * Tests whether n is probably prime or not using the Miller-Rabin test. + * See HAC Remark 4.28. + * @param n Number to test + * @param k Optional number of iterations of Miller-Rabin test + * @param rand Optional function to generate potential witnesses + * @returns + */ + function millerRabin(n: BN, k: Integer, rand: Function): boolean; + } + + namespace rsa { + /** + * Create signature + * @param m message + * @param n RSA public modulus + * @param e RSA public exponent + * @param d RSA private exponent + * @returns RSA Signature + */ + function sign(m: BN, n: BN, e: BN, d: BN): BN; + + /** + * Verify signature + * @param s signature + * @param n RSA public modulus + * @param e RSA public exponent + * @returns + */ + function verify(s: BN, n: BN, e: BN): BN; + + /** + * Encrypt message + * @param m message + * @param n RSA public modulus + * @param e RSA public exponent + * @returns RSA Ciphertext + */ + function encrypt(m: BN, n: BN, e: BN): BN; + + /** + * Decrypt RSA message + * @param m message + * @param n RSA public modulus + * @param e RSA public exponent + * @param d RSA private exponent + * @param p RSA private prime p + * @param q RSA private prime q + * @param u RSA private inverse of prime q + * @returns RSA Plaintext + */ + function decrypt(m: BN, n: BN, e: BN, d: BN, p: BN, q: BN, u: BN): BN; + + /** + * Generate a new random private key B bits long with public exponent E. + * When possible, webCrypto is used. Otherwise, primes are generated using + * 40 rounds of the Miller-Rabin probabilistic random prime generation algorithm. + * @see module:crypto/public_key/prime + * @param B RSA bit length + * @param E RSA public exponent in hex string + * @returns RSA public modulus, RSA public exponent, RSA private exponent, + * RSA private prime p, RSA private prime q, u = q ** -1 mod p + */ + function generate(B: Integer, E: string): object; + } + } + + namespace random { + /** + * Retrieve secure random byte array of the specified length + * @param length Length in bytes to generate + * @returns Random byte array + */ + function getRandomBytes(length: Integer): Uint8Array; + + /** + * Create a secure random MPI that is greater than or equal to min and less than max. + * @param min Lower bound, included + * @param max Upper bound, excluded + * @returns Random MPI + */ + function getRandomBN(min: type.mpi.MPI, max: type.mpi.MPI): BN; + + /** + * Buffer for secure random numbers + */ + function RandomBuffer(): void; + } + + namespace signature { + /** + * Verifies the signature provided for data using specified algorithms and public key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} + * and {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4} + * for public key and hash algorithms. + * @param algo Public key algorithm + * @param hash_algo Hash algorithm + * @param msg_MPIs Algorithm-specific signature parameters + * @param pub_MPIs Algorithm-specific public key parameters + * @param data Data for which the signature was created + * @param hashed The hashed data + * @returns True if signature is valid + */ + function verify(algo: enums.publicKey, hash_algo: enums.hash, msg_MPIs: type.mpi.MPI[], pub_MPIs: type.mpi.MPI[], data: Uint8Array, hashed: Uint8Array): boolean; + + /** + * Creates a signature on data using specified algorithms and private key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} + * and {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4} + * for public key and hash algorithms. + * @param algo Public key algorithm + * @param hash_algo Hash algorithm + * @param key_params Algorithm-specific public and private key parameters + * @param data Data to be signed + * @param hashed The hashed data + * @returns Signature + */ + function sign(algo: enums.publicKey, hash_algo: enums.hash, key_params: type.mpi.MPI[], data: Uint8Array, hashed: Uint8Array): Uint8Array; + } } -export interface DecryptOptions { - message: message.Message, - privateKeys?: key.Key | key.Key[], - passwords?: string | string[], - sessionKeys?: SessionKey | SessionKey[], - publicKeys?: key.Key | key.Key[], - format?: string, - streaming?: 'web' | 'node' | false, - signature?: Signature, - date?: Date, +export namespace eme { + /** + * Create a EME-PKCS1-v1_5 padded message + * @see + * @param M message to be encoded + * @param k the length in octets of the key modulus + * @returns EME-PKCS1 padded message + */ + function encode(M: string, k: Integer): Promise; + + /** + * Decode a EME-PKCS1-v1_5 padded message + * @see + * @param EM encoded message, an octet string + * @returns message, an octet string + */ + function decode(EM: string): string; } -export interface SignOptions { - message: message.Message, - privateKeys?: key.Key | key.Key[], - armor?: boolean, - streaming?: 'web' | 'node' | false, - detached?: boolean - date?: Date, - fromUserIds?: UserId[] +export namespace emsa { + /** + * Create a EMSA-PKCS1-v1_5 padded message + * @see + * @param algo Hash algorithm type used + * @param hashed message to be encoded + * @param emLen intended length in octets of the encoded message + * @returns encoded message + */ + function encode(algo: Integer, hashed: Uint8Array, emLen: Integer): string; } -export interface SignedMessage { - signature?: string | ReadableStream | Signature, // TODO add NodeStream - data?: string | ReadableStream, // TODO add NodeStream - message?: message.Message +export namespace encoding { + namespace armor { + /** + * Add additional information to the armor version of an OpenPGP binary + * packet block. + * @author Alex + * @version 2011-12-16 + * @param customComment (optional) additional comment to add to the armored string + * @returns The header information + */ + function addheader(customComment: string): string; + + /** + * Calculates a checksum over the given data and returns it base64 encoded + * @param data Data to create a CRC-24 checksum for + * @returns Base64 encoded checksum + */ + function getCheckSum(data: string | ReadableStream): string | ReadableStream; + + /** + * Internal function to calculate a CRC-24 checksum over a given string (data) + * @param data Data to create a CRC-24 checksum for + * @returns The CRC-24 checksum + */ + function createcrc24(data: string | ReadableStream): Uint8Array | ReadableStream; + + /** + * Splits a message into two parts, the body and the checksum. This is an internal function + * @param text OpenPGP armored message part + * @returns An object with attribute "body" containing the body + * and an attribute "checksum" containing the checksum. + */ + function splitChecksum(text: string): object; + + /** + * DeArmor an OpenPGP armored message; verify the checksum and return + * the encoded bytes + * @param text OpenPGP armored message + * @returns An object with attribute "text" containing the message text, + * an attribute "data" containing a stream of bytes and "type" for the ASCII armor type + */ + function dearmor(text: string): Promise; + + /** + * Armor an OpenPGP binary packet block + * @param messagetype type of the message + * @param body + * @param partindex + * @param parttotal + * @param customComment (optional) additional comment to add to the armored string + * @returns Armored text + */ + function armor(messagetype: Integer, body: any, partindex: Integer, parttotal: Integer, customComment?: string): string | ReadableStream; + } + + namespace base64 { + /** + * Convert binary array to radix-64 + * @param t Uint8Array to convert + * @param u if true, output is URL-safe + * @returns radix-64 version of input string + */ + function s2r(t: Uint8Array | ReadableStream, u?: boolean): string | ReadableStream; + + /** + * Convert radix-64 to binary array + * @param t radix-64 string to convert + * @param u if true, input is interpreted as URL-safe + * @returns binary array version of input string + */ + function r2s(t: string | ReadableStream, u: boolean): Uint8Array | ReadableStream; + } } -export interface KeyContainer { - key: key.Key, + + +export namespace enums { + /** + * Maps curve names under various standards to one + * @see + */ + type curve = "p256" | "p384" | "p251" | "secp256k1" | "ed25519" | "curve25519" | "brainpoolP256r1" | "brainpoolP384r1" | "brainpoolP512r1"; + + /** + * A string to key specifier type + */ + enum s2k { + simple = 0, + salted = 1, + iterated = 3, + gnu = 101, + } + + /** + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-9.1|RFC4880bis-04, section 9.1} + */ + enum publicKey { + /** + * RSA (Encrypt or Sign) [HAC] + */ + rsa_encrypt_sign = 1, + /** + * RSA (Encrypt only) [HAC] + */ + rsa_encrypt = 2, + /** + * RSA (Sign only) [HAC] + */ + rsa_sign = 3, + /** + * Elgamal (Encrypt only) [ELGAMAL] [HAC] + */ + elgamal = 16, + /** + * DSA (Sign only) [FIPS186] [HAC] + */ + dsa = 17, + /** + * ECDH (Encrypt only) [RFC6637] + */ + ecdh = 18, + /** + * ECDSA (Sign only) [RFC6637] + */ + ecdsa = 19, + /** + * EdDSA (Sign only) + * [ {@link https://tools.ietf.org/html/draft-koch-eddsa-for-openpgp-04|Draft RFC}] + */ + eddsa = 22, + /** + * Reserved for AEDH + */ + aedh = 23, + /** + * Reserved for AEDSA + */ + aedsa = 24, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC4880, section 9.2} + */ + enum symmetric { + plaintext = 0, + /** + * Not implemented! + */ + idea = 1, + "3des" = 2, + tripledes = 2, + cast5 = 3, + blowfish = 4, + aes128 = 7, + aes192 = 8, + aes256 = 9, + twofish = 10, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-9.3|RFC4880, section 9.3} + */ + enum compression { + uncompressed = 0, + /** + * RFC1951 + */ + zip = 1, + /** + * RFC1950 + */ + zlib = 2, + bzip2 = 3, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC4880, section 9.4} + */ + enum hash { + md5 = 1, + sha1 = 2, + ripemd = 3, + sha256 = 8, + sha384 = 9, + sha512 = 10, + sha224 = 11, + } + + /** + * A list of hash names as accepted by webCrypto functions. + * {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest|Parameters, algo} + */ + enum webHash { + "SHA-1" = 2, + "SHA-256" = 8, + "SHA-384" = 9, + "SHA-512" = 10, + } + + /** + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-9.6|RFC4880bis-04, section 9.6} + */ + enum aead { + eax = 1, + ocb = 2, + experimental_gcm = 100, + } + + /** + * A list of packet types and numeric tags associated with them. + */ + enum packet { + publicKeyEncryptedSessionKey = 1, + signature = 2, + symEncryptedSessionKey = 3, + onePassSignature = 4, + secretKey = 5, + publicKey = 6, + secretSubkey = 7, + compressed = 8, + symmetricallyEncrypted = 9, + marker = 10, + literal = 11, + trust = 12, + userid = 13, + publicSubkey = 14, + userAttribute = 17, + symEncryptedIntegrityProtected = 18, + modificationDetectionCode = 19, + symEncryptedAEADProtected = 20, + } + + /** + * Data types in the literal packet + */ + enum literal { + /** + * Binary data 'b' + */ + binary = 98, + /** + * Text data 't' + */ + text = 116, + /** + * Utf8 data 'u' + */ + utf8 = 117, + /** + * MIME message body part 'm' + */ + mime = 109, + } + + /** + * One pass signature packet type + */ + enum signature { + /** + * 0x00: Signature of a binary document. + */ + binary = 0, + /** + * 0x01: Signature of a canonical text document. + * Canonicalyzing the document by converting line endings. + */ + text = 1, + /** + * 0x02: Standalone signature. + * This signature is a signature of only its own subpacket contents. + * It is calculated identically to a signature over a zero-lengh + * binary document. Note that it doesn't make sense to have a V3 + * standalone signature. + */ + standalone = 2, + /** + * 0x10: Generic certification of a User ID and Public-Key packet. + * The issuer of this certification does not make any particular + * assertion as to how well the certifier has checked that the owner + * of the key is in fact the person described by the User ID. + */ + cert_generic = 16, + /** + * 0x11: Persona certification of a User ID and Public-Key packet. + * The issuer of this certification has not done any verification of + * the claim that the owner of this key is the User ID specified. + */ + cert_persona = 17, + /** + * 0x12: Casual certification of a User ID and Public-Key packet. + * The issuer of this certification has done some casual + * verification of the claim of identity. + */ + cert_casual = 18, + /** + * 0x13: Positive certification of a User ID and Public-Key packet. + * The issuer of this certification has done substantial + * verification of the claim of identity. + * Most OpenPGP implementations make their "key signatures" as 0x10 + * certifications. Some implementations can issue 0x11-0x13 + * certifications, but few differentiate between the types. + */ + cert_positive = 19, + /** + * 0x30: Certification revocation signature + * This signature revokes an earlier User ID certification signature + * (signature class 0x10 through 0x13) or direct-key signature + * (0x1F). It should be issued by the same key that issued the + * revoked signature or an authorized revocation key. The signature + * is computed over the same data as the certificate that it + * revokes, and should have a later creation date than that + * certificate. + */ + cert_revocation = 48, + /** + * 0x18: Subkey Binding Signature + * This signature is a statement by the top-level signing key that + * indicates that it owns the subkey. This signature is calculated + * directly on the primary key and subkey, and not on any User ID or + * other packets. A signature that binds a signing subkey MUST have + * an Embedded Signature subpacket in this binding signature that + * contains a 0x19 signature made by the signing subkey on the + * primary key and subkey. + */ + subkey_binding = 24, + /** + * 0x19: Primary Key Binding Signature + * This signature is a statement by a signing subkey, indicating + * that it is owned by the primary key and subkey. This signature + * is calculated the same way as a 0x18 signature: directly on the + * primary key and subkey, and not on any User ID or other packets. + * When a signature is made over a key, the hash data starts with the + * octet 0x99, followed by a two-octet length of the key, and then body + * of the key packet. (Note that this is an old-style packet header for + * a key packet with two-octet length.) A subkey binding signature + * (type 0x18) or primary key binding signature (type 0x19) then hashes + * the subkey using the same format as the main key (also using 0x99 as + * the first octet). + */ + key_binding = 25, + /** + * 0x1F: Signature directly on a key + * This signature is calculated directly on a key. It binds the + * information in the Signature subpackets to the key, and is + * appropriate to be used for subpackets that provide information + * about the key, such as the Revocation Key subpacket. It is also + * appropriate for statements that non-self certifiers want to make + * about the key itself, rather than the binding between a key and a + * name. + */ + key = 31, + /** + * 0x20: Key revocation signature + * The signature is calculated directly on the key being revoked. A + * revoked key is not to be used. Only revocation signatures by the + * key being revoked, or by an authorized revocation key, should be + * considered valid revocation signatures.a + */ + key_revocation = 32, + /** + * 0x28: Subkey revocation signature + * The signature is calculated directly on the subkey being revoked. + * A revoked subkey is not to be used. Only revocation signatures + * by the top-level signature key that is bound to this subkey, or + * by an authorized revocation key, should be considered valid + * revocation signatures. + * Key revocation signatures (types 0x20 and 0x28) + * hash only the key being revoked. + */ + subkey_revocation = 40, + /** + * 0x40: Timestamp signature. + * This signature is only meaningful for the timestamp contained in + * it. + */ + timestamp = 64, + /** + * 0x50: Third-Party Confirmation signature. + * This signature is a signature over some other OpenPGP Signature + * packet(s). It is analogous to a notary seal on the signed data. + * A third-party signature SHOULD include Signature Target + * subpacket(s) to give easy identification. Note that we really do + * mean SHOULD. There are plausible uses for this (such as a blind + * party that only sees the signature, not the key or source + * document) that cannot include a target subpacket. + */ + third_party = 80, + } + + /** + * Signature subpacket type + */ + enum signatureSubpacket { + signature_creation_time = 2, + signature_expiration_time = 3, + exportable_certification = 4, + trust_signature = 5, + regular_expression = 6, + revocable = 7, + key_expiration_time = 9, + placeholder_backwards_compatibility = 10, + preferred_symmetric_algorithms = 11, + revocation_key = 12, + issuer = 16, + notation_data = 20, + preferred_hash_algorithms = 21, + preferred_compression_algorithms = 22, + key_server_preferences = 23, + preferred_key_server = 24, + primary_user_id = 25, + policy_uri = 26, + key_flags = 27, + signers_user_id = 28, + reason_for_revocation = 29, + features = 30, + signature_target = 31, + embedded_signature = 32, + issuer_fingerprint = 33, + preferred_aead_algorithms = 34, + } + + /** + * Key flags + */ + enum keyFlags { + /** + * 0x01 - This key may be used to certify other keys. + */ + certify_keys = 1, + /** + * 0x02 - This key may be used to sign data. + */ + sign_data = 2, + /** + * 0x04 - This key may be used to encrypt communications. + */ + encrypt_communication = 4, + /** + * 0x08 - This key may be used to encrypt storage. + */ + encrypt_storage = 8, + /** + * 0x10 - The private component of this key may have been split + * by a secret-sharing mechanism. + */ + split_private_key = 16, + /** + * 0x20 - This key may be used for authentication. + */ + authentication = 32, + /** + * 0x80 - The private component of this key may be in the + * possession of more than one person. + */ + shared_private_key = 128, + } + + /** + * Key status + */ + enum keyStatus { + invalid = 0, + expired = 1, + revoked = 2, + valid = 3, + no_self_cert = 4, + } + + /** + * Armor type + */ + enum armor { + multipart_section = 0, + multipart_last = 1, + signed = 2, + message = 3, + public_key = 4, + private_key = 5, + signature = 6, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-5.2.3.23|RFC4880, section 5.2.3.23} + */ + enum reasonForRevocation { + /** + * No reason specified (key revocations or cert revocations) + */ + no_reason = 0, + /** + * Key is superseded (key revocations) + */ + key_superseded = 1, + /** + * Key material has been comPromised (key revocations) + */ + key_comPromised = 2, + /** + * Key is retired and no longer used (key revocations) + */ + key_retired = 3, + /** + * User ID information is no longer valid (cert revocations) + */ + userid_invalid = 32, + } + + /** + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-5.2.3.25|RFC4880bis-04, section 5.2.3.25} + */ + enum features { + /** + * 0x01 - Modification Detection (packets 18 and 19) + */ + modification_detection = 1, + /** + * 0x02 - AEAD Encrypted Data Packet (packet 20) and version 5 + * Symmetric-Key Encrypted Session Key Packets (packet 3) + */ + aead = 2, + /** + * 0x04 - Version 5 Public-Key Packet format and corresponding new + * fingerprint format + */ + v5_keys = 4, + } + + /** + * Asserts validity and converts from string/integer to integer. + */ + function write(): void; + + /** + * Converts from an integer to string. + */ + function read(): void; } -export interface KeyPair extends KeyContainer { - privateKeyArmored: string, - publicKeyArmored: string, - revocationCertificate: string +export namespace hkp { + class HKP { + /** + * Initialize the HKP client and configure it with the key server url and fetch function. + * @param keyServerBaseUrl (optional) The HKP key server base url including + * the protocol to use, e.g. 'https://pgp.mit.edu'; defaults to + * openpgp.config.keyserver (https://keyserver.ubuntu.com) + */ + constructor(keyServerBaseUrl: string); + + /** + * Search for a public key on the key server either by key ID or part of the user ID. + * @param options.keyID The long public key ID. + * @param options.query This can be any part of the key user ID such as name + * or email address. + * @returns The ascii armored public key. + */ + lookup(): Promise; + + /** + * Upload a public key to the server. + * @param publicKeyArmored An ascii armored public key to be uploaded. + * @returns + */ + upload(publicKeyArmored: string): Promise; + } } -export interface KeyOptions { - userIds?: UserId[], - passphrase?: string, - numBits?: number, - keyExpirationTime?: number, - curve?: string, - date?: Date, - subkeys?: KeyOptions[] +export class HKP { + /** + * Initialize the HKP client and configure it with the key server url and fetch function. + * @param keyServerBaseUrl (optional) The HKP key server base url including + * the protocol to use, e.g. 'https://pgp.mit.edu'; defaults to + * openpgp.config.keyserver (https://keyserver.ubuntu.com) + */ + constructor(keyServerBaseUrl: string); + + /** + * Search for a public key on the key server either by key ID or part of the user ID. + * @param options.keyID The long public key ID. + * @param options.query This can be any part of the key user ID such as name + * or email address. + * @returns The ascii armored public key. + */ + lookup(): Promise; + + /** + * Upload a public key to the server. + * @param publicKeyArmored An ascii armored public key to be uploaded. + * @returns + */ + upload(publicKeyArmored: string): Promise; } -export interface Keyid { - bytes: string, +export namespace key { + /** + * Class that represents an OpenPGP key. Must contain a primary key. + * Can contain additional subkeys, signatures, user ids, user attributes. + */ + class Key { + /** + * @param packetlist The packets that form this key + */ + constructor(packetlist: packet.List); + + /** + * Transforms packetlist to structured key data + * @param packetlist The packets that form a key + */ + packetlist2structure(packetlist: packet.List): void; + + /** + * Transforms structured key data to packetlist + * @returns The packets that form a key + */ + toPacketlist(): packet.List; + + /** + * Returns an array containing all public or private subkeys matching keyId; + * If keyId is not present, returns all subkeys. + * @param keyId + * @returns + */ + getSubkeys(keyId: type.keyid.Keyid): any[]; + + /** + * Returns an array containing all public or private keys matching keyId. + * If keyId is not present, returns all keys starting with the primary key. + * @param keyId + * @returns + */ + getKeys(keyId: type.keyid.Keyid): any[]; + + /** + * Returns key IDs of all keys + * @returns + */ + getKeyIds(): any[]; + + /** + * Returns userids + * @returns array of userids + */ + getUserIds(): any[]; + + /** + * Returns true if this is a public key + * @returns + */ + isPublic(): boolean; + + /** + * Returns true if this is a private key + * @returns + */ + isPrivate(): boolean; + + /** + * Returns key as public key (shallow copy) + * @returns new public Key + */ + toPublic(): Key; + + /** + * Returns ASCII armored text of key + * @returns ASCII armor + */ + armor(): ReadableStream; + + /** + * Returns last created key or key by given keyId that is available for signing and verification + * @param keyId, optional + * @param date (optional) use the given date for verification instead of the current time + * @param userId, optional user ID + * @returns key or null if no signing key has been found + */ + getSigningKey(keyId: type.keyid.Keyid, date?: Date, userId?: object): Promise; + + /** + * Returns last created key or key by given keyId that is available for encryption or decryption + * @param keyId, optional + * @param date, optional + * @param userId, optional + * @returns key or null if no encryption key has been found + */ + getEncryptionKey(keyId?: type.keyid.Keyid, date?: Date, userId?: string): Promise; + + /** + * Encrypts all secret key and subkey packets matching keyId + * @param passphrases - if multiple passphrases, then should be in same order as packets each should encrypt + * @param keyId + * @returns + */ + encrypt(passphrases: string | any[], keyId?: type.keyid.Keyid): Promise>; + + /** + * Decrypts all secret key and subkey packets matching keyId + * @param passphrases + * @param keyId + * @returns true if all matching key and subkey packets decrypted successfully + */ + decrypt(passphrases: string | string[], keyId?: type.keyid.Keyid): Promise; + + /** + * Checks if a signature on a key is revoked + * @param + * @param signature The signature to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the certificate is revoked + */ + isRevoked(signature: packet.Signature, key?: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date?: Date): Promise; + + /** + * Verify primary key. Checks for revocation signatures, expiration time + * and valid self signature + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID + * @returns The status of the primary key + */ + verifyPrimaryKey(date?: Date, userId?: object): Promise; + + /** + * Returns the latest date when the key can be used for encrypting, signing, or both, depending on the `capabilities` paramater. + * When `capabilities` is null, defaults to returning the expiry date of the primary key. + * Returns null if `capabilities` is passed and the key does not have the specified capabilities or is revoked or invalid. + * Returns Infinity if the key doesn't expire. + * @param {encrypt | sign | encrypt_sign} capabilities, optional + * @param keyId, optional + * @param userId, optional user ID + * @returns + */ + getExpirationTime(capabilities: any, keyId: type.keyid.Keyid, userId: object): Promise; + + /** + * Returns primary user and most significant (latest valid) self signature + * - if multiple primary users exist, returns the one with the latest self signature + * - otherwise, returns the user with the latest self signature + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID to get instead of the primary user, if it exists + * @returns The primary user and the self signature + */ + getPrimaryUser(date: Date, userId: object): Promise<{ user: User, selfCertification: packet.Signature }>; + + /** + * Update key with new components from specified key with same key ID: + * users, subkeys, certificates are merged into the destination key, + * duplicates and expired signatures are ignored. + * If the specified key is a private key and the destination key is public, + * the destination key is transformed to a private key. + * @param key Source key to merge + * @returns + */ + update(key: Key): Promise; + + /** + * Revokes the key + * @param reasonForRevocation optional, object indicating the reason for revocation + * @param reasonForRevocation.flag optional, flag indicating the reason for revocation + * @param reasonForRevocation.string optional, string explaining the reason for revocation + * @param date optional, override the creationtime of the revocation signature + * @returns new key with revocation signature + */ + revoke(reasonForRevocation: revoke_reasonForRevocation, date: Date): Promise; + + /** + * Get revocation certificate from a revoked key. + * (To get a revocation certificate for an unrevoked key, call revoke() first.) + * @returns armored revocation certificate + */ + getRevocationCertificate(): Promise; + + /** + * Applies a revocation certificate to a key + * This adds the first signature packet in the armored text to the key, + * if it is a valid revocation signature. + * @param revocationCertificate armored revocation certificate + * @returns new revoked key + */ + applyRevocationCertificate(revocationCertificate: string): Promise; + + /** + * Signs primary user of key + * @param privateKey decrypted private keys for signing + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID to get instead of the primary user, if it exists + * @returns new public key with new certificate signature + */ + signPrimaryUser(privateKey: any[], date: Date, userId: object): Promise; + + /** + * Signs all users of key + * @param privateKeys decrypted private keys for signing + * @returns new public key with new certificate signature + */ + signAllUsers(privateKeys: any[]): Promise; + + /** + * Verifies primary user of key + * - if no arguments are given, verifies the self certificates; + * - otherwise, verifies all certificates signed with given keys. + * @param keys array of keys to verify certificate signatures + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID to get instead of the primary user, if it exists + * @returns List of signer's keyid and validity of signature + */ + verifyPrimaryUser(keys: any[], date: Date, userId: object): Promise>; + + /** + * Verifies all users of key + * - if no arguments are given, verifies the self certificates; + * - otherwise, verifies all certificates signed with given keys. + * @param keys array of keys to verify certificate signatures + * @returns list of userid, signer's keyid and validity of signature + */ + verifyAllUsers(keys: any[]): Promise>; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + } + + /** + * Returns the valid and non-expired signature that has the latest creation date, while ignoring signatures created in the future. + * @param signatures List of signatures + * @param date Use the given date instead of the current time + * @returns The latest valid signature + */ + function getLatestValidSignature(signatures: any[], date: Date): Promise; + + /** + * Class that represents an user ID or attribute packet and the relevant signatures. + */ + class User { + constructor(); + + /** + * Transforms structured user data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Signs user + * @param primaryKey The primary key packet + * @param privateKeys Decrypted private keys for signing + * @returns New user with new certificate signatures + */ + sign(primaryKey: packet.SecretKey | packet.PublicKey, privateKeys: any[]): Promise; + + /** + * Checks if a given certificate of the user is revoked + * @param primaryKey The primary key packet + * @param certificate The certificate to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the certificate is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verifies the user certificate + * @param primaryKey The primary key packet + * @param certificate A certificate of this user + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns status of the certificate + */ + verifyCertificate(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, keys: any[], date: Date): Promise; + + /** + * Verifies all user certificates + * @param primaryKey The primary key packet + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns List of signer's keyid and validity of signature + */ + verifyAllCertifications(primaryKey: packet.SecretKey | packet.PublicKey, keys: any[], date: Date): Promise>; + + /** + * Verify User. Checks for existence of self signatures, revocation signatures + * and validity of self signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns Status of user + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update user with new components from specified user + * @param user Source user to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(user: User, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; + } + + /** + * Create signature packet + * @param dataToSign Contains packets to be signed + * @param signingKeyPacket secret key packet for signing + * @param signatureProperties (optional) properties to write on the signature packet before signing + * @param date (optional) override the creationtime of the signature + * @param userId (optional) user ID + * @returns signature packet + */ + function createSignaturePacket(dataToSign: object, signingKeyPacket: packet.SecretKey | packet.SecretSubkey, signatureProperties: object, date: Date, userId: object): packet.Signature; + + /** + * Class that represents a subkey packet and the relevant signatures. + */ + class SubKey { + constructor(); + + /** + * Transforms structured subkey data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Checks if a binding signature of a subkey is revoked + * @param primaryKey The primary key packet + * @param signature The binding signature to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the binding signature is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, signature: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verify subkey. Checks for revocation signatures, expiration time + * and valid binding signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns The status of the subkey + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Returns the expiration time of the subkey or Infinity if key does not expire + * Returns null if the subkey is invalid. + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns + */ + getExpirationTime(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update subkey with new components from specified subkey + * @param subKey Source subkey to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(subKey: SubKey, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; + + /** + * Revokes the subkey + * @param primaryKey decrypted private primary key for revocation + * @param reasonForRevocation optional, object indicating the reason for revocation + * @param reasonForRevocation.flag optional, flag indicating the reason for revocation + * @param reasonForRevocation.string optional, string explaining the reason for revocation + * @param date optional, override the creationtime of the revocation signature + * @returns new subkey with revocation signature + */ + revoke(primaryKey: packet.SecretKey, reasonForRevocation: revoke_reasonForRevocation, date: Date): Promise; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + } + + /** + * Reads an unarmored OpenPGP key list and returns one or multiple key objects + * @param data to be parsed + * @returns result object with key and error arrays + */ + function read(data: Uint8Array): Promise<{ keys: Array, err: Array | null }>; + + interface KeyResult { keys: Array, err: Array | null } + + /** + * Reads an OpenPGP armored text and returns one or multiple key objects + * @param armoredText text to be parsed + * @returns result object with key and error arrays + */ + function readArmored(armoredText: string | ReadableStream): Promise; + + /** + * Generates a new OpenPGP key. Supports RSA and ECC keys. + * Primary and subkey will be of same type. + * @param options.keyType To indicate what type of key to make. + * RSA is 1. See {@link https://tools.ietf.org/html/rfc4880#section-9.1} + * @param options.numBits number of bits for the key creation. + * @param options.userIds Assumes already in form of "User Name " + * If array is used, the first userId is set as primary user Id + * @param options.passphrase The passphrase used to encrypt the resulting private key + * @param options.keyExpirationTime The number of seconds after the key creation time that the key expires + * @param curve (optional) elliptic curve for ECC keys + * @param date Override the creation date of the key and the key signatures + * @param subkeys (optional) options for each subkey, default to main key options. e.g. [ {sign: true, passphrase: '123'}] + * sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt + * @returns + */ + function generate(options: KeyOptions): Promise; + + /** + * Reformats and signs an OpenPGP key with a given User ID. Currently only supports RSA keys. + * @param options.privateKey The private key to reformat + * @param options.keyType + * @param options.userIds Assumes already in form of "User Name " + * If array is used, the first userId is set as primary user Id + * @param options.passphrase The passphrase used to encrypt the resulting private key + * @param options.keyExpirationTime The number of seconds after the key creation time that the key expires + * @param date Override the creation date of the key and the key signatures + * @param subkeys (optional) options for each subkey, default to main key options. e.g. [ {sign: true, passphrase: '123'}] + * @returns + */ + function reformat(date: Date, subkeys: any[]): Promise; + + /** + * Checks if a given certificate or binding signature is revoked + * @param primaryKey The primary key packet + * @param dataToVerify The data to check + * @param revocations The revocation signatures to check + * @param signature The certificate or signature to check + * @param key, optional The key packet to check the signature + * @param date Use the given date instead of the current time + * @returns True if the signature revokes the data + */ + function isDataRevoked(primaryKey: packet.SecretKey | packet.PublicKey, dataToVerify: object, revocations: any[], signature: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Check if signature has revocation key sub packet (not supported by OpenPGP.js) + * and throw error if found + * @param signature The certificate or signature to check + * @param keyId Check only certificates or signatures from a certain issuer key ID + */ + function checkRevocationKey(signature: packet.Signature, keyId: type.keyid.Keyid): void; + + /** + * Returns the preferred signature hash algorithm of a key + * @param key (optional) the key to get preferences from + * @param keyPacket key packet used for signing + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID + * @returns + */ + function getPreferredHashAlgo(key: Key, keyPacket: packet.SecretKey | packet.SecretSubkey, date: Date, userId: object): Promise; + + /** + * Returns the preferred symmetric/aead algorithm for a set of keys + * @param {symmetric | aead} type Type of preference to return + * @param keys Set of keys + * @param date (optional) use the given date for verification instead of the current time + * @param userIds (optional) user IDs + * @returns Preferred symmetric algorithm + */ + function getPreferredAlgo(type: any, keys: any[], date: Date, userIds: any[]): Promise; + + /** + * Returns whether aead is supported by all keys in the set + * @param keys Set of keys + * @param date (optional) use the given date for verification instead of the current time + * @param userIds (optional) user IDs + * @returns + */ + function isAeadSupported(keys: any[], date: Date, userIds: any[]): Promise; } -export interface Signature { - keyid: Keyid, - valid: boolean, - verified?: boolean +export interface revoke_reasonForRevocation { + /** + * optional, flag indicating the reason for revocation + */ + flag: enums.reasonForRevocation; + /** + * optional, string explaining the reason for revocation + */ + string: string; } -export interface VerifyOptions { - message: message.Message, - publicKeys: key.Key | key.Key[], - streaming?: 'web' | 'node' | false, - signature?: Signature, - date?: Date +/** + * Class that represents an user ID or attribute packet and the relevant signatures. + */ +export class User { + constructor(); + + /** + * Transforms structured user data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Signs user + * @param primaryKey The primary key packet + * @param privateKeys Decrypted private keys for signing + * @returns New user with new certificate signatures + */ + sign(primaryKey: packet.SecretKey | packet.PublicKey, privateKeys: any[]): Promise; + + /** + * Checks if a given certificate of the user is revoked + * @param primaryKey The primary key packet + * @param certificate The certificate to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the certificate is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verifies the user certificate + * @param primaryKey The primary key packet + * @param certificate A certificate of this user + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns status of the certificate + */ + verifyCertificate(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, keys: any[], date: Date): Promise; + + /** + * Verifies all user certificates + * @param primaryKey The primary key packet + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns List of signer's keyid and validity of signature + */ + verifyAllCertifications(primaryKey: packet.SecretKey | packet.PublicKey, keys: any[], date: Date): Promise>; + + /** + * Verify User. Checks for existence of self signatures, revocation signatures + * and validity of self signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns Status of user + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update user with new components from specified user + * @param user Source user to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(user: key.User, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; } -export interface VerifiedMessage { - data: Uint8Array | string | ReadableStream, // TODO add NodeStream - signatures: Array, +/** + * Class that represents a subkey packet and the relevant signatures. + */ +export class SubKey { + constructor(); + + /** + * Transforms structured subkey data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Checks if a binding signature of a subkey is revoked + * @param primaryKey The primary key packet + * @param signature The binding signature to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the binding signature is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, signature: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verify subkey. Checks for revocation signatures, expiration time + * and valid binding signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns The status of the subkey + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Returns the expiration time of the subkey or Infinity if key does not expire + * Returns null if the subkey is invalid. + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns + */ + getExpirationTime(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update subkey with new components from specified subkey + * @param subKey Source subkey to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(subKey: key.SubKey, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; + + /** + * Revokes the subkey + * @param primaryKey decrypted private primary key for revocation + * @param reasonForRevocation optional, object indicating the reason for revocation + * @param reasonForRevocation.flag optional, flag indicating the reason for revocation + * @param reasonForRevocation.string optional, string explaining the reason for revocation + * @param date optional, override the creationtime of the revocation signature + * @returns new subkey with revocation signature + */ + revoke(primaryKey: packet.SecretKey, reasonForRevocation: revoke_reasonForRevocation, date: Date): Promise; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; } -export interface DecryptedMessage { - data: Uint8Array | string | ReadableStream, // TODO add NodeStream - signatures: Array, - filename: string +/** + * @see module:keyring/keyring + * @see module:keyring/localstore + */ +export namespace keyring { + namespace keyring { + class Keyring { + /** + * Initialization routine for the keyring. + * @param storeHandler class implementing loadPublic(), loadPrivate(), storePublic(), and storePrivate() methods + */ + constructor(storeHandler?: localstore.LocalStore); + + /** + * Calls the storeHandler to load the keys + */ + load(): void; + + /** + * Calls the storeHandler to save the keys + */ + store(): void; + + /** + * Clear the keyring - erase all the keys + */ + clear(): void; + + /** + * Searches the keyring for keys having the specified key id + * @param keyId provided as string of lowercase hex number + * withouth 0x prefix (can be 16-character key ID or fingerprint) + * @param deep if true search also in subkeys + * @returns keys found or null + */ + getKeysForId(keyId: string, deep: boolean): any[] | null; + + /** + * Removes keys having the specified key id from the keyring + * @param keyId provided as string of lowercase hex number + * withouth 0x prefix (can be 16-character key ID or fingerprint) + * @returns keys found or null + */ + removeKeysForId(keyId: string): any[] | null; + + /** + * Get all public and private keys + * @returns all keys + */ + getAllKeys(): any[]; + } + + /** + * Array of keys + * @param keys The keys to store in this array + */ + function KeyArray(keys: any[]): void; + } + + namespace localstore { + class LocalStore { + /** + * The class that deals with storage of the keyring. + * Currently the only option is to use HTML5 local storage. + * @param prefix prefix for itemnames in localstore + */ + constructor(prefix: string); + + /** + * Load the public keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPublic(): any[]; + + /** + * Load the private keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPrivate(): any[]; + + /** + * Saves the current state of the public keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePublic(keys: any[]): void; + + /** + * Saves the current state of the private keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePrivate(keys: any[]): void; + } + } } -export interface OpenPGPWorker { - randomCallback(): void; - configure(config: any): void; - seedRandom(buffer: ArrayBuffer): void; - delegate(id: number, method: string, options: any): void; - response(event: any): void; +export class LocalStore { + /** + * The class that deals with storage of the keyring. + * Currently the only option is to use HTML5 local storage. + * @param prefix prefix for itemnames in localstore + */ + constructor(prefix: string); + + /** + * Load the public keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPublic(): any[]; + + /** + * Load the private keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPrivate(): any[]; + + /** + * Saves the current state of the public keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePublic(keys: any[]): void; + + /** + * Saves the current state of the private keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePrivate(keys: any[]): void; } -export interface WorkerOptions { - path?: string, - n?: number, - workers?: OpenPGPWorker[], - config?: any +export namespace message { + /** + * Class that represents an OpenPGP message. + * Can be an encrypted message, signed message, compressed message or literal message + */ + class Message { + packets: packet.List; + + /** + * @param packetlist The packets that form this message + * See {@link https://tools.ietf.org/html/rfc4880#section-11.3} + */ + constructor(packetlist: packet.List); + + /** + * Returns the key IDs of the keys to which the session key is encrypted + * @returns array of keyid objects + */ + getEncryptionKeyIds(): any[]; + + /** + * Returns the key IDs of the keys that signed the message + * @returns array of keyid objects + */ + getSigningKeyIds(): any[]; + + /** + * Decrypt the message. Either a private key, a session key, or a password must be specified. + * @param privateKeys (optional) private keys with decrypted secret data + * @param passwords (optional) passwords used to decrypt + * @param sessionKeys (optional) session keys in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } + * @param streaming (optional) whether to process data as a stream + * @returns new message with decrypted content + */ + decrypt(privateKeys?: any[], passwords?: any[], sessionKeys?: any[], streaming?: boolean): Promise; + + /** + * Decrypt encrypted session keys either with private keys or passwords. + * @param privateKeys (optional) private keys with decrypted secret data + * @param passwords (optional) passwords used to decrypt + * @returns array of object with potential sessionKey, algorithm pairs + */ + decryptSessionKeys(privateKeys?: any[], passwords?: any[]): Promise>; + + /** + * Get literal data that is the body of the message + * @returns literal body of the message as Uint8Array + */ + getLiteralData(): Uint8Array | null; + + /** + * Get filename from literal data packet + * @returns filename of literal data packet as string + */ + getFilename(): string | null; + + /** + * Get literal data as text + * @returns literal body of the message interpreted as text + */ + getText(): string | null; + + /** + * Encrypt the message either with public keys, passwords, or both at once. + * @param keys (optional) public key(s) for message encryption + * @param passwords (optional) password(s) for message encryption + * @param sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } + * @param wildcard (optional) use a key ID of 0 instead of the public key IDs + * @param date (optional) override the creation date of the literal package + * @param userIds (optional) user IDs to encrypt for, e.g. [ { name:'Robert Receiver', email:'robert@openpgp.org' }] + * @param streaming (optional) whether to process data as a stream + * @returns new message with encrypted content + */ + encrypt(keys?: any[], passwords?: any[], sessionKey?: object, wildcard?: boolean, date?: Date, userIds?: any[], streaming?: boolean): Promise; + + /** + * Sign the message (the literal data packet of the message) + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature to add to the message + * @param date (optional) override the creation time of the signature + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new message with signed content + */ + sign(privateKeys: any[], signature?: signature.Signature, date?: Date, userIds?: any[]): Promise; + + /** + * Compresses the message (the literal and -if signed- signature data packets of the message) + * @param compression compression algorithm to be used + * @returns new message with compressed content + */ + compress(compression: enums.compression): Message; + + /** + * Create a detached signature for the message (the literal data packet of the message) + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature + * @param date (optional) override the creation time of the signature + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new detached signature of message content + */ + signDetached(privateKeys: any[], signature?: signature.Signature, date?: Date, userIds?: any[]): Promise; + + /** + * Verify message signatures + * @param keys array of keys to verify signatures + * @param date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @param streaming (optional) whether to process data as a stream + * @returns list of signer's keyid and validity of signature + */ + verify(keys: any[], date?: Date, streaming?: boolean): Promise>; + + /** + * Verify detached message signature + * @param keys array of keys to verify signatures + * @param signature + * @param date Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + verifyDetached(keys: any[], signature: signature.Signature, date?: Date): Promise>; + + /** + * Unwrap compressed message + * @returns message Content of compressed message + */ + unwrapCompressed(): Message; + + /** + * Append signature to unencrypted message object + * @param detachedSignature The detached ASCII-armored or Uint8Array PGP signature + */ + appendSignature(detachedSignature: string | Uint8Array): void; + + /** + * Returns ASCII armored text of message + * @returns ASCII armor + */ + armor(): ReadableStream; + } + + /** + * Encrypt a session key either with public keys, passwords, or both at once. + * @param sessionKey session key for encryption + * @param symAlgo session key algorithm + * @param aeadAlgo (optional) aead algorithm, e.g. 'eax' or 'ocb' + * @param publicKeys (optional) public key(s) for message encryption + * @param passwords (optional) for message encryption + * @param wildcard (optional) use a key ID of 0 instead of the public key IDs + * @param date (optional) override the date + * @param userIds (optional) user IDs to encrypt for, e.g. [ { name:'Robert Receiver', email:'robert@openpgp.org' }] + * @returns new message with encrypted content + */ + function encryptSessionKey(sessionKey: Uint8Array, symAlgo: string, aeadAlgo: string, publicKeys: any[], passwords: any[], wildcard: boolean, date: Date, userIds: any[]): Promise; + + /** + * Create signature packets for the message + * @param literalDataPacket the literal data packet to sign + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature to append + * @param date (optional) override the creationtime of the signature + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns list of signature packets + */ + function createSignaturePackets(literalDataPacket: packet.Literal, privateKeys: any[], signature: signature.Signature, date: Date, userIds: any[]): Promise; + + /** + * Create object containing signer's keyid and validity of signature + * @param signature signature packets + * @param literalDataList array of literal data packets + * @param keys array of keys to verify signatures + * @param date Verify the signature against the given date, + * i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + function createVerificationObject(signature: packet.Signature, literalDataList: any[], keys: any[], date: Date): Promise>; + + /** + * Create list of objects containing signer's keyid and validity of signature + * @param signatureList array of signature packets + * @param literalDataList array of literal data packets + * @param keys array of keys to verify signatures + * @param date Verify the signature against the given date, + * i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + function createVerificationObjects(signatureList: any[], literalDataList: any[], keys: any[], date: Date): Promise>; + + /** + * reads an OpenPGP armored message and returns a message object + * @param armoredText text to be parsed + * @returns new message object + */ + function readArmored(armoredText: string | ReadableStream): Promise; + + /** + * reads an OpenPGP message as byte array and returns a message object + * @param input binary message + * @param fromStream whether the message was created from a Stream + * @returns new message object + */ + function read(input: Uint8Array | ReadableStream, fromStream?: boolean): Promise; + + /** + * creates new message object from text + * @param text + * @param filename (optional) + * @param date (optional) + * @param {utf8 | binary | text | mime} type (optional) data packet type + * @returns new message object + */ + function fromText(text: string | ReadableStream, filename?: string, date?: Date, type?: any): Message; + + /** + * creates new message object from binary data + * @param bytes + * @param filename (optional) + * @param date (optional) + * @param {utf8 | binary | text | mime} type (optional) data packet type + * @returns new message object + */ + function fromBinary(bytes: Uint8Array | ReadableStream, filename?: string, date?: Date, type?: any): Message; } -export class AsyncProxy { - constructor(options: WorkerOptions); - getId(): number; - seedRandom(workerId: number, size: number): Promise; - terminate(): void; - delegate(method: string, options: any): void; - - workers: OpenPGPWorker[]; +export interface revokeKey_reasonForRevocation { + /** + * (optional) flag indicating the reason for revocation + */ + flag: enums.reasonForRevocation; + /** + * (optional) string explaining the reason for revocation + */ + string: string; } +/** + * @see module:packet/all_packets + * @see module:packet/clone + * @see module:packet.List + */ +export namespace packet { + /** + * Allocate a new packet + * @param tag property name from {@link module:enums.packet} + * @returns new packet object with type based on tag + */ + function newPacketFromTag(tag: string): object; + + /** + * Allocate a new packet from structured packet clone + * @see + * @param packetClone packet clone + * @returns new packet object with data from packet clone + */ + function fromStructuredClone(packetClone: object): object; + + class Compressed { + /** + * Implementation of the Compressed Data Packet (Tag 8) + * {@link https://tools.ietf.org/html/rfc4880#section-5.6|RFC4880 5.6}: + * The Compressed Data packet contains compressed data. Typically, + * this packet is found as the contents of an encrypted packet, or following + * a Signature or One-Pass Signature packet, and contains a literal data packet. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * List of packets + */ + packets: List; + + /** + * Compression algorithm + * @type {compression} + */ + algorithm: any; + + /** + * Compressed packet data + */ + compressed: Uint8Array | ReadableStream; + + /** + * Parsing function for the packet. + * @param bytes Payload of a tag 8 packet + */ + read(bytes: Uint8Array | ReadableStream): void; + + /** + * Return the compressed packet. + * @returns binary compressed packet + */ + write(): Uint8Array | ReadableStream; + + /** + * Decompression method for decompressing the compressed data + * read by read_packet + */ + decompress(): void; + + /** + * Compress the packet data (member decompressedData) + */ + compress(): void; + } + + class Literal { + /** + * Implementation of the Literal Data Packet (Tag 11) + * {@link https://tools.ietf.org/html/rfc4880#section-5.9|RFC4880 5.9}: + * A Literal Data packet contains the body of a message; data that is not to be + * further interpreted. + * @param date the creation date of the literal package + */ + constructor(date: Date); + + /** + * Set the packet data to a javascript native string, end of line + * will be normalized to \r\n and by default text is converted to UTF8 + * @param text Any native javascript string + * @param {utf8 | binary | text | mime} format (optional) The format of the string of bytes + */ + setText(text: string | ReadableStream, format: any): void; + + /** + * Returns literal data packets as native JavaScript string + * with normalized end of line to \n + * @param clone (optional) Whether to return a clone so that getBytes/getText can be called again + * @returns literal data as text + */ + getText(clone: boolean): string | ReadableStream; + + /** + * Set the packet data to value represented by the provided string of bytes. + * @param bytes The string of bytes + * @param {utf8 | binary | text | mime} format The format of the string of bytes + */ + setBytes(bytes: Uint8Array | ReadableStream, format: any): void; + + /** + * Get the byte sequence representing the literal packet data + * @param clone (optional) Whether to return a clone so that getBytes/getText can be called again + * @returns A sequence of bytes + */ + getBytes(clone: boolean): Uint8Array | ReadableStream; + + /** + * Sets the filename of the literal packet data + * @param filename Any native javascript string + */ + setFilename(filename: string): void; + + /** + * Get the filename of the literal packet data + * @returns filename + */ + getFilename(): string; + + /** + * Parsing function for a literal data packet (tag 11). + * @param input Payload of a tag 11 packet + * @returns object representation + */ + read(input: Uint8Array | ReadableStream): Literal; + + /** + * Creates a string representation of the packet + * @returns Uint8Array representation of the packet + */ + write(): Uint8Array | ReadableStream; + } + + class Marker { + /** + * Implementation of the strange "Marker packet" (Tag 10) + * {@link https://tools.ietf.org/html/rfc4880#section-5.8|RFC4880 5.8}: + * An experimental version of PGP used this packet as the Literal + * packet, but no released version of PGP generated Literal packets with this + * tag. With PGP 5.x, this packet has been reassigned and is reserved for use as + * the Marker packet. + * Such a packet MUST be ignored when received. + */ + constructor(); + + /** + * Parsing function for a literal data packet (tag 10). + * @param input Payload of a tag 10 packet + * @param position Position to start reading from the input string + * @param len Length of the packet or the remaining length of + * input at position + * @returns Object representation + */ + read(input: string, position: Integer, len: Integer): Marker; + } + + class OnePassSignature { + /** + * Implementation of the One-Pass Signature Packets (Tag 4) + * {@link https://tools.ietf.org/html/rfc4880#section-5.4|RFC4880 5.4}: + * The One-Pass Signature packet precedes the signed data and contains + * enough information to allow the receiver to begin calculating any + * hashes needed to verify the signature. It allows the Signature + * packet to be placed at the end of the message, so that the signer + * can compute the entire signed message in one pass. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * A one-octet version number. The current version is 3. + */ + version: any; + + /** + * A one-octet signature type. + * Signature types are described in + * {@link https://tools.ietf.org/html/rfc4880#section-5.2.1|RFC4880 Section 5.2.1}. + */ + signatureType: any; + + /** + * A one-octet number describing the hash algorithm used. + * @see + */ + hashAlgorithm: any; + + /** + * A one-octet number describing the public-key algorithm used. + * @see + */ + publicKeyAlgorithm: any; + + /** + * An eight-octet number holding the Key ID of the signing key. + */ + issuerKeyId: any; + + /** + * A one-octet number holding a flag showing whether the signature is nested. + * A zero value indicates that the next packet is another One-Pass Signature packet + * that describes another signature to be applied to the same message data. + */ + flags: any; + + /** + * parsing function for a one-pass signature packet (tag 4). + * @param bytes payload of a tag 4 packet + * @returns object representation + */ + read(bytes: Uint8Array): OnePassSignature; + + /** + * creates a string representation of a one-pass signature packet + * @returns a Uint8Array representation of a one-pass signature packet + */ + write(): Uint8Array; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class List { + /** + * This class represents a list of openpgp packets. + * Take care when iterating over it - the packets themselves + * are stored as numerical indices. + */ + constructor(); + + /** + * The number of packets contained within the list. + */ + readonly length: Integer; + + /** + * Reads a stream of binary data and interprents it as a list of packets. + * @param A Uint8Array of bytes. + */ + read(A: Uint8Array | ReadableStream): void; + + /** + * Creates a binary representation of openpgp objects contained within the + * class instance. + * @returns A Uint8Array containing valid openpgp packets. + */ + write(): Uint8Array; + + /** + * Adds a packet to the list. This is the only supported method of doing so; + * writing to packetlist[i] directly will result in an error. + * @param packet Packet to push + */ + push(packet: object): void; + + /** + * Creates a new PacketList with all packets from the given types + */ + filterByTag(): void; + + /** + * Traverses packet tree and returns first matching packet + * @param type The packet type + * @returns + */ + findPacket(type: enums.packet): List | undefined; + + /** + * Returns array of found indices by tag + */ + indexOfTag(): void; + + /** + * Concatenates packetlist or array of packets + */ + concat(): void; + + /** + * Allocate a new packetlist from structured packetlist clone + * See {@link https://w3c.github.io/html/infrastructure.html#safe-passing-of-structured-data} + * @param packetClone packetlist clone + * @returns new packetlist object with data from packetlist clone + */ + static fromStructuredClone(packetClone: object): object; + } + + class PublicKey { + /** + * Implementation of the Key Material Packet (Tag 5,6,7,14) + * {@link https://tools.ietf.org/html/rfc4880#section-5.5|RFC4480 5.5}: + * A key material packet contains all the information about a public or + * private key. There are four variants of this packet type, and two + * major versions. + * A Public-Key packet starts a series of packets that forms an OpenPGP + * key (sometimes called an OpenPGP certificate). + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Internal Parser for public keys as specified in {@link https://tools.ietf.org/html/rfc4880#section-5.5.2|RFC 4880 section 5.5.2 Public-Key Packet Formats} + * called by read_tag<num> + * @param bytes Input array to read the packet from + * @returns This object with attributes set by the parser + */ + read(bytes: Uint8Array): object; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Same as write_private_key, but has less information because of + * public key. + * @returns OpenPGP packet body contents, + */ + write(): Uint8Array; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class PublicKeyEncryptedSessionKey { + /** + * Public-Key Encrypted Session Key Packets (Tag 1) + * {@link https://tools.ietf.org/html/rfc4880#section-5.1|RFC4880 5.1}: + * A Public-Key Encrypted Session Key packet holds the session key + * used to encrypt a message. Zero or more Public-Key Encrypted Session Key + * packets and/or Symmetric-Key Encrypted Session Key packets may precede a + * Symmetrically Encrypted Data Packet, which holds an encrypted message. The + * message is encrypted with the session key, and the session key is itself + * encrypted and stored in the Encrypted Session Key packet(s). The + * Symmetrically Encrypted Data Packet is preceded by one Public-Key Encrypted + * Session Key packet for each OpenPGP key to which the message is encrypted. + * The recipient of the message finds a session key that is encrypted to their + * public key, decrypts the session key, and then uses the session key to + * decrypt the message. + */ + constructor(); + + encrypted: any[]; + + /** + * Parsing function for a publickey encrypted session key packet (tag 1). + * @param input Payload of a tag 1 packet + * @param position Position to start reading from the input string + * @param len Length of the packet or the remaining length of + * input at position + * @returns Object representation + */ + read(input: Uint8Array, position: Integer, len: Integer): PublicKeyEncryptedSessionKey + + /** + * Create a string representation of a tag 1 packet + * @returns The Uint8Array representation + */ + write(): Uint8Array; + + /** + * Encrypt session key packet + * @param key Public key + * @returns + */ + encrypt(key: PublicKey): Promise; + + /** + * Decrypts the session key (only for public key encrypted session key + * packets (tag 1) + * @param key Private key with secret params unlocked + * @returns + */ + decrypt(key: SecretKey): Promise; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class PublicSubkey { + /** + * A Public-Subkey packet (tag 14) has exactly the same format as a + * Public-Key packet, but denotes a subkey. One or more subkeys may be + * associated with a top-level key. By convention, the top-level key + * provides signature services, and the subkeys provide encryption + * services. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Internal Parser for public keys as specified in {@link https://tools.ietf.org/html/rfc4880#section-5.5.2|RFC 4880 section 5.5.2 Public-Key Packet Formats} + * called by read_tag<num> + * @param bytes Input array to read the packet from + * @returns This object with attributes set by the parser + */ + read(bytes: Uint8Array): object; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Same as write_private_key, but has less information because of + * public key. + * @returns OpenPGP packet body contents, + */ + write(): Uint8Array; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class SecretKey { + /** + * A Secret-Key packet contains all the information that is found in a + * Public-Key packet, including the public-key material, but also + * includes the secret-key material after all the public-key fields. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Encrypted secret-key data + */ + encrypted: any; + + /** + * Indicator if secret-key data is encrypted. `this.isEncrypted === false` means data is available in decrypted form. + */ + isEncrypted: any; + + /** + * Internal parser for private keys as specified in + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-5.5.3|RFC4880bis-04 section 5.5.3} + * @param bytes Input string to read the packet from + */ + read(bytes: string): void; + + /** + * Creates an OpenPGP key packet for the given key. + * @returns A string of bytes containing the secret key OpenPGP packet + */ + write(): string; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Encrypt the payload. By default, we use aes256 and iterated, salted string + * to key specifier. If the key is in a decrypted state (isEncrypted === false) + * and the passphrase is empty or undefined, the key will be set as not encrypted. + * This can be used to remove passphrase protection after calling decrypt(). + * @param passphrase + * @returns + */ + encrypt(passphrase: string): Promise; + + /** + * Decrypts the private key params which are needed to use the key. + * {@link module:packet.SecretKey.isDecrypted} should be false, as + * otherwise calls to this function will throw an error. + * @param passphrase The passphrase for this private key as string + * @returns + */ + decrypt(passphrase: string): Promise; + + /** + * Clear private params, return to initial state + */ + clearPrivateParams(): void; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + } + + class SecretSubkey { + /** + * A Secret-Subkey packet (tag 7) is the subkey analog of the Secret + * Key packet and has exactly the same format. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Encrypted secret-key data + */ + encrypted: any; + + /** + * Indicator if secret-key data is encrypted. `this.isEncrypted === false` means data is available in decrypted form. + */ + isEncrypted: any; + + /** + * Internal parser for private keys as specified in + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-5.5.3|RFC4880bis-04 section 5.5.3} + * @param bytes Input string to read the packet from + */ + read(bytes: string): void; + + /** + * Creates an OpenPGP key packet for the given key. + * @returns A string of bytes containing the secret key OpenPGP packet + */ + write(): string; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Encrypt the payload. By default, we use aes256 and iterated, salted string + * to key specifier. If the key is in a decrypted state (isEncrypted === false) + * and the passphrase is empty or undefined, the key will be set as not encrypted. + * This can be used to remove passphrase protection after calling decrypt(). + * @param passphrase + * @returns + */ + encrypt(passphrase: string): Promise; + + /** + * Decrypts the private key params which are needed to use the key. + * {@link module:packet.SecretKey.isDecrypted} should be false, as + * otherwise calls to this function will throw an error. + * @param passphrase The passphrase for this private key as string + * @returns + */ + decrypt(passphrase: string): Promise; + + /** + * Clear private params, return to initial state + */ + clearPrivateParams(): void; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + } + + class Signature { + /** + * Implementation of the Signature Packet (Tag 2) + * {@link https://tools.ietf.org/html/rfc4880#section-5.2|RFC4480 5.2}: + * A Signature packet describes a binding between some public key and + * some data. The most common signatures are a signature of a file or a + * block of text, and a signature that is a certification of a User ID. + * @param date the creation date of the signature + */ + constructor(date: Date); + + /** + * parsing function for a signature packet (tag 2). + * @param bytes payload of a tag 2 packet + * @param position position to start reading from the bytes string + * @param len length of the packet or the remaining length of bytes at position + * @returns object representation + */ + read(bytes: string, position: Integer, len: Integer): Signature; + + /** + * Signs provided data. This needs to be done prior to serialization. + * @param key private key used to sign the message. + * @param data Contains packets to be signed. + * @returns + */ + sign(key: SecretKey, data: object): Promise; + + /** + * Creates Uint8Array of bytes of all subpacket data except Issuer and Embedded Signature subpackets + * @returns subpacket data + */ + write_hashed_sub_packets(): Uint8Array; + + /** + * Creates Uint8Array of bytes of Issuer and Embedded Signature subpackets + * @returns subpacket data + */ + write_unhashed_sub_packets(): Uint8Array; + + /** + * verifys the signature packet. Note: not signature types are implemented + * @param key the public key to verify the signature + * @param signatureType expected signature type + * @param data data which on the signature applies + * @returns True if message is verified, else false. + */ + verify(key: PublicSubkey | PublicKey | SecretSubkey | SecretKey, signatureType: enums.signature, data: string | object): Promise; + + /** + * Verifies signature expiration date + * @param date (optional) use the given date for verification instead of the current time + * @returns true if expired + */ + isExpired(date: Date): boolean; + + /** + * Returns the expiration time of the signature or Infinity if signature does not expire + * @returns expiration time + */ + getExpirationTime(): Date; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class SymEncryptedAEADProtected { + /** + * Implementation of the Symmetrically Encrypted Authenticated Encryption with + * Additional Data (AEAD) Protected Data Packet + * {@link https://tools.ietf.org/html/draft-ford-openpgp-format-00#section-2.1}: + * AEAD Protected Data Packet + */ + constructor(); + + /** + * Parse an encrypted payload of bytes in the order: version, IV, ciphertext (see specification) + * @param bytes + */ + read(bytes: Uint8Array | ReadableStream): void; + + /** + * Write the encrypted payload of bytes in the order: version, IV, ciphertext (see specification) + * @returns The encrypted payload + */ + write(): Uint8Array | ReadableStream; + + /** + * Decrypt the encrypted payload. + * @param sessionKeyAlgorithm The session key's cipher algorithm e.g. 'aes128' + * @param key The session key used to encrypt the payload + * @param streaming Whether the top-level function will return a stream + * @returns + */ + decrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): boolean; + + /** + * Encrypt the packet list payload. + * @param sessionKeyAlgorithm The session key's cipher algorithm e.g. 'aes128' + * @param key The session key used to encrypt the payload + * @param streaming Whether the top-level function will return a stream + */ + encrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): void; + + /** + * En/decrypt the payload. + * @param {encrypt | decrypt} fn Whether to encrypt or decrypt + * @param key The session key used to en/decrypt the payload + * @param data The data to en/decrypt + * @param streaming Whether the top-level function will return a stream + * @returns + */ + crypt(fn: any, key: Uint8Array, data: Uint8Array | ReadableStream, streaming: boolean): Uint8Array | ReadableStream; + } + + class SymEncryptedIntegrityProtected { + /** + * Implementation of the Sym. Encrypted Integrity Protected Data Packet (Tag 18) + * {@link https://tools.ietf.org/html/rfc4880#section-5.13|RFC4880 5.13}: + * The Symmetrically Encrypted Integrity Protected Data packet is + * a variant of the Symmetrically Encrypted Data packet. It is a new feature + * created for OpenPGP that addresses the problem of detecting a modification to + * encrypted data. It is used in combination with a Modification Detection Code + * packet. + */ + constructor(); + + /** + * The encrypted payload. + */ + encrypted: any; + + /** + * If after decrypting the packet this is set to true, + * a modification has been detected and thus the contents + * should be discarded. + */ + modification: boolean; + + /** + * Encrypt the payload in the packet. + * @param sessionKeyAlgorithm The selected symmetric encryption algorithm to be used e.g. 'aes128' + * @param key The key of cipher blocksize length to be used + * @param streaming Whether to set this.encrypted to a stream + * @returns + */ + encrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): Promise; + + /** + * Decrypts the encrypted data contained in the packet. + * @param sessionKeyAlgorithm The selected symmetric encryption algorithm to be used e.g. 'aes128' + * @param key The key of cipher blocksize length to be used + * @param streaming Whether to read this.encrypted as a stream + * @returns + */ + decrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): Promise; + } + + class SymEncryptedSessionKey { + /** + * Public-Key Encrypted Session Key Packets (Tag 1) + * {@link https://tools.ietf.org/html/rfc4880#section-5.1|RFC4880 5.1}: + * A Public-Key Encrypted Session Key packet holds the session key + * used to encrypt a message. Zero or more Public-Key Encrypted Session Key + * packets and/or Symmetric-Key Encrypted Session Key packets may precede a + * Symmetrically Encrypted Data Packet, which holds an encrypted message. The + * message is encrypted with the session key, and the session key is itself + * encrypted and stored in the Encrypted Session Key packet(s). The + * Symmetrically Encrypted Data Packet is preceded by one Public-Key Encrypted + * Session Key packet for each OpenPGP key to which the message is encrypted. + * The recipient of the message finds a session key that is encrypted to their + * public key, decrypts the session key, and then uses the session key to + * decrypt the message. + */ + constructor(); + + /** + * Parsing function for a symmetric encrypted session key packet (tag 3). + * @param input Payload of a tag 1 packet + * @param position Position to start reading from the input string + * @param len Length of the packet or the remaining length of + * input at position + * @returns Object representation + */ + read(input: Uint8Array, position: Integer, len: Integer): SymEncryptedSessionKey; + + /** + * Decrypts the session key + * @param passphrase The passphrase in string form + * @returns + */ + decrypt(passphrase: string): Promise; + + /** + * Encrypts the session key + * @param passphrase The passphrase in string form + * @returns + */ + encrypt(passphrase: string): Promise; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class SymmetricallyEncrypted { + /** + * Implementation of the Symmetrically Encrypted Data Packet (Tag 9) + * {@link https://tools.ietf.org/html/rfc4880#section-5.7|RFC4880 5.7}: + * The Symmetrically Encrypted Data packet contains data encrypted with a + * symmetric-key algorithm. When it has been decrypted, it contains other + * packets (usually a literal data packet or compressed data packet, but in + * theory other Symmetrically Encrypted Data packets or sequences of packets + * that form whole OpenPGP messages). + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Encrypted secret-key data + */ + encrypted: any; + + /** + * Decrypted packets contained within. + */ + packets: List; + + /** + * When true, decrypt fails if message is not integrity protected + * @see module:config.ignore_mdc_error + */ + ignore_mdc_error: any; + + /** + * Decrypt the symmetrically-encrypted packet data + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param sessionKeyAlgorithm Symmetric key algorithm to use + * @param key The key of cipher blocksize length to be used + * @returns + */ + decrypt(sessionKeyAlgorithm: enums.symmetric, key: Uint8Array): Promise; + + /** + * Encrypt the symmetrically-encrypted packet data + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param sessionKeyAlgorithm Symmetric key algorithm to use + * @param key The key of cipher blocksize length to be used + * @returns + */ + encrypt(sessionKeyAlgorithm: enums.symmetric, key: Uint8Array): Promise; + } + + class Trust { + /** + * Implementation of the Trust Packet (Tag 12) + * {@link https://tools.ietf.org/html/rfc4880#section-5.10|RFC4880 5.10}: + * The Trust packet is used only within keyrings and is not normally + * exported. Trust packets contain data that record the user's + * specifications of which key holders are trustworthy introducers, + * along with other information that implementing software uses for + * trust information. The format of Trust packets is defined by a given + * implementation. + * Trust packets SHOULD NOT be emitted to output streams that are + * transferred to other users, and they SHOULD be ignored on any input + * other than local keyring files. + */ + constructor(); + + /** + * Parsing function for a trust packet (tag 12). + * Currently not implemented as we ignore trust packets + * @param byptes payload of a tag 12 packet + */ + read(byptes: string): void; + } + + class UserAttribute { + /** + * Implementation of the User Attribute Packet (Tag 17) + * The User Attribute packet is a variation of the User ID packet. It + * is capable of storing more types of data than the User ID packet, + * which is limited to text. Like the User ID packet, a User Attribute + * packet may be certified by the key owner ("self-signed") or any other + * key owner who cares to certify it. Except as noted, a User Attribute + * packet may be used anywhere that a User ID packet may be used. + * While User Attribute packets are not a required part of the OpenPGP + * standard, implementations SHOULD provide at least enough + * compatibility to properly handle a certification signature on the + * User Attribute packet. A simple way to do this is by treating the + * User Attribute packet as a User ID packet with opaque contents, but + * an implementation may use any method desired. + */ + constructor(); + + /** + * parsing function for a user attribute packet (tag 17). + * @param input payload of a tag 17 packet + */ + read(input: Uint8Array): void; + + /** + * Creates a binary representation of the user attribute packet + * @returns string representation + */ + write(): Uint8Array; + + /** + * Compare for equality + * @param usrAttr + * @returns true if equal + */ + equals(usrAttr: UserAttribute): boolean; + } + + class Userid { + /** + * Implementation of the User ID Packet (Tag 13) + * A User ID packet consists of UTF-8 text that is intended to represent + * the name and email address of the key holder. By convention, it + * includes an RFC 2822 [RFC2822] mail name-addr, but there are no + * restrictions on its content. The packet length in the header + * specifies the length of the User ID. + */ + constructor(); + + /** + * A string containing the user id. Usually in the form + * John Doe + */ + userid: string; + + /** + * Parsing function for a user id packet (tag 13). + * @param input payload of a tag 13 packet + */ + read(input: Uint8Array): void; + + /** + * Parse userid string, e.g. 'John Doe ' + */ + parse(): void; + + /** + * Creates a binary representation of the user id packet + * @returns binary representation + */ + write(): Uint8Array; + + /** + * Set userid string from object, e.g. { name:'Phil Zimmermann', email:'phil@openpgp.org' } + */ + format(): void; + } + + namespace all_packets { + /** + * @see module:packet.Compressed + */ + var Compressed: any; + + /** + * @see module:packet.SymEncryptedIntegrityProtected + */ + var SymEncryptedIntegrityProtected: any; + + /** + * @see module:packet.SymEncryptedAEADProtected + */ + var SymEncryptedAEADProtected: any; + + /** + * @see module:packet.PublicKeyEncryptedSessionKey + */ + var PublicKeyEncryptedSessionKey: any; + + /** + * @see module:packet.SymEncryptedSessionKey + */ + var SymEncryptedSessionKey: any; + + /** + * @see module:packet.Literal + */ + var Literal: any; + + /** + * @see module:packet.PublicKey + */ + var PublicKey: any; + + /** + * @see module:packet.SymmetricallyEncrypted + */ + var SymmetricallyEncrypted: any; + + /** + * @see module:packet.Marker + */ + var Marker: any; + + /** + * @see module:packet.PublicSubkey + */ + var PublicSubkey: any; + + /** + * @see module:packet.UserAttribute + */ + var UserAttribute: any; + + /** + * @see module:packet.OnePassSignature + */ + var OnePassSignature: any; + + /** + * @see module:packet.SecretKey + */ + var SecretKey: any; + + /** + * @see module:packet.Userid + */ + var Userid: any; + + /** + * @see module:packet.SecretSubkey + */ + var SecretSubkey: any; + + /** + * @see module:packet.Signature + */ + var Signature: any; + + /** + * @see module:packet.Trust + */ + var Trust: any; + } + + namespace clone { + /** + * Create a packetlist from the correspoding object types. + * @param options the object passed to and from the web worker + * @returns a mutated version of the options optject + */ + function clonePackets(options: object): object; + + /** + * Creates an object with the correct prototype from a corresponding packetlist. + * @param options the object passed to and from the web worker + * @param method the public api function name to be delegated to the worker + * @returns a mutated version of the options optject + */ + function parseClonedPackets(options: object, method: string): object; + } + + namespace packet { + /** + * Encodes a given integer of length to the openpgp length specifier to a + * string + * @param length The length to encode + * @returns String with openpgp length representation + */ + function writeSimpleLength(length: Integer): Uint8Array; + + /** + * Writes a packet header version 4 with the given tag_type and length to a + * string + * @param tag_type Tag type + * @param length Length of the payload + * @returns String of the header + */ + function writeHeader(tag_type: Integer, length: Integer): string; + + /** + * Writes a packet header Version 3 with the given tag_type and length to a + * string + * @param tag_type Tag type + * @param length Length of the payload + * @returns String of the header + */ + function writeOldHeader(tag_type: Integer, length: Integer): string; + + /** + * Whether the packet type supports partial lengths per RFC4880 + * @param tag_type Tag type + * @returns String of the header + */ + function supportsStreaming(tag_type: Integer): boolean; + + /** + * Generic static Packet Parser function + * @param input Input stream as string + * @param callback Function to call with the parsed packet + * @returns Returns false if the stream was empty and parsing is done, and true otherwise. + */ + function read(input: Uint8Array | ReadableStream, callback: Function): boolean; + } +} + + +export namespace polyfills { +} + +export namespace signature { + /** + * Class that represents an OpenPGP signature. + */ + class Signature { + /** + * @param packetlist The signature packets + */ + constructor(packetlist: packet.List); + + /** + * Returns ASCII armored text of signature + * @returns ASCII armor + */ + armor(): ReadableStream; + } + + /** + * reads an OpenPGP armored signature and returns a signature object + * @param armoredText text to be parsed + * @returns new signature object + */ + function readArmored(armoredText: string | ReadableStream): Signature; + + /** + * reads an OpenPGP signature as byte array and returns a signature object + * @param input binary signature + * @returns new signature object + */ + function read(input: Uint8Array | ReadableStream): Signature; +} + +export namespace type { + /** + * Encoded symmetric key for ECDH + */ + namespace ecdh_symkey { + class ECDHSymmetricKey { + constructor(); + + /** + * Read an ECDHSymmetricKey from an Uint8Array + * @param input Where to read the encoded symmetric key from + * @returns Number of read bytes + */ + read(input: Uint8Array): number; + + /** + * Write an ECDHSymmetricKey as an Uint8Array + * @returns An array containing the value + */ + write(): Uint8Array; + } + } + + /** + * Implementation of type KDF parameters + * {@link https://tools.ietf.org/html/rfc6637#section-7|RFC 6637 7}: + * A key derivation function (KDF) is necessary to implement the EC + * encryption. The Concatenation Key Derivation Function (Approved + * Alternative 1) [NIST-SP800-56A] with the KDF hash function that is + * SHA2-256 [FIPS-180-3] or stronger is REQUIRED. + */ + namespace kdf_params { + class KDFParams { + /** + * @param hash Hash algorithm + * @param cipher Symmetric algorithm + */ + constructor(hash: enums.hash, cipher: enums.symmetric); + + /** + * Read KDFParams from an Uint8Array + * @param input Where to read the KDFParams from + * @returns Number of read bytes + */ + read(input: Uint8Array): number; + + /** + * Write KDFParams to an Uint8Array + * @returns Array with the KDFParams value + */ + write(): Uint8Array; + } + } + + /** + * Implementation of type key id + * {@link https://tools.ietf.org/html/rfc4880#section-3.3|RFC4880 3.3}: + * A Key ID is an eight-octet scalar that identifies a key. + * Implementations SHOULD NOT assume that Key IDs are unique. The + * section "Enhanced Key Formats" below describes how Key IDs are + * formed. + */ + namespace keyid { + class Keyid { + constructor(); + + /** + * Parsing method for a key id + * @param input Input to read the key id from + */ + read(input: Uint8Array): void; + + /** + * Checks equality of Key ID's + * @param keyid + * @param matchWildcard Indicates whether to check if either keyid is a wildcard + */ + equals(keyid: Keyid, matchWildcard: boolean): void; + } + } + + /** + * Implementation of type MPI ( {@link https://tools.ietf.org/html/rfc4880#section-3.2|RFC4880 3.2}) + * Multiprecision integers (also called MPIs) are unsigned integers used + * to hold large integers such as the ones used in cryptographic + * calculations. + * An MPI consists of two pieces: a two-octet scalar that is the length + * of the MPI in bits followed by a string of octets that contain the + * actual integer. + */ + namespace mpi { + class MPI { + constructor(); + + /** + * Parsing function for a MPI ( {@link https://tools.ietf.org/html/rfc4880#section-3.2|RFC 4880 3.2}). + * @param input Payload of MPI data + * @param endian Endianness of the data; 'be' for big-endian or 'le' for little-endian + * @returns Length of data read + */ + read(input: Uint8Array, endian: string): Integer; + + /** + * Converts the mpi object to a bytes as specified in + * {@link https://tools.ietf.org/html/rfc4880#section-3.2|RFC4880 3.2} + * @param endian Endianness of the payload; 'be' for big-endian or 'le' for little-endian + * @param length Length of the data part of the MPI + * @returns mpi Byte representation + */ + write(endian: string, length: Integer): Uint8Array; + } + } + + /** + * Wrapper to an OID value + * {@link https://tools.ietf.org/html/rfc6637#section-11|RFC6637, section 11}: + * The sequence of octets in the third column is the result of applying + * the Distinguished Encoding Rules (DER) to the ASN.1 Object Identifier + * with subsequent truncation. The truncation removes the two fields of + * encoded Object Identifier. The first omitted field is one octet + * representing the Object Identifier tag, and the second omitted field + * is the length of the Object Identifier body. For example, the + * complete ASN.1 DER encoding for the NIST P-256 curve OID is "06 08 2A + * 86 48 CE 3D 03 01 07", from which the first entry in the table above + * is constructed by omitting the first two octets. Only the truncated + * sequence of octets is the valid representation of a curve OID. + */ + namespace oid { + class OID { + constructor(); + + /** + * Method to read an OID object + * @param input Where to read the OID from + * @returns Number of read bytes + */ + read(input: Uint8Array): number; + + /** + * Serialize an OID object + * @returns Array with the serialized value the OID + */ + write(): Uint8Array; + + /** + * Serialize an OID object as a hex string + * @returns String with the hex value of the OID + */ + toHex(): string; + + /** + * If a known curve object identifier, return the canonical name of the curve + * @returns String with the canonical name of the curve + */ + getName(): string; + } + } + + /** + * Implementation of the String-to-key specifier + * {@link https://tools.ietf.org/html/rfc4880#section-3.7|RFC4880 3.7}: + * String-to-key (S2K) specifiers are used to convert passphrase strings + * into symmetric-key encryption/decryption keys. They are used in two + * places, currently: to encrypt the secret part of private keys in the + * private keyring, and to convert passphrases to encryption keys for + * symmetrically encrypted messages. + */ + namespace s2k { + class S2K { + constructor(); + + algorithm: enums.hash; + + type: enums.s2k; + + c: Integer; + + /** + * Eight bytes of salt in a binary string. + */ + salt: string; + + /** + * Parsing function for a string-to-key specifier ( {@link https://tools.ietf.org/html/rfc4880#section-3.7|RFC 4880 3.7}). + * @param input Payload of string-to-key specifier + * @returns Actual length of the object + */ + read(input: string): Integer; + + /** + * Serializes s2k information + * @returns binary representation of s2k + */ + write(): Uint8Array; + + /** + * Produces a key using the specified passphrase and the defined + * hashAlgorithm + * @param passphrase Passphrase containing user input + * @returns Produced key with a length corresponding to + * hashAlgorithm hash length + */ + produce_key(passphrase: string): Uint8Array; + } + } +} + +/** + * This object contains utility functions + */ +export namespace util { + /** + * Get transferable objects to pass buffers with zero copy (similar to "pass by reference" in C++) + * See: https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage + * Also, convert ReadableStreams to MessagePorts + * @param obj the options object to be passed to the web worker + * @returns an array of binary data to be passed + */ + function getTransferables(obj: object): any[]; + + /** + * Convert MessagePorts back to ReadableStreams + * @param obj + * @returns + */ + function restoreStreams(obj: object): object; + + /** + * Create hex string from a binary + * @param str String to convert + * @returns String containing the hexadecimal values + */ + function str_to_hex(str: string): string; + + /** + * Create binary string from a hex encoded string + * @param str Hex string to convert + * @returns + */ + function hex_to_str(str: string): string; + + /** + * Convert a Uint8Array to an MPI-formatted Uint8Array. + * Note: the output is **not** an MPI object. + * @see + * @see + * @param bin An array of 8-bit integers to convert + * @returns MPI-formatted Uint8Array + */ + function Uint8Array_to_MPI(bin: Uint8Array): Uint8Array; + + /** + * Convert a Base-64 encoded string an array of 8-bit integer + * Note: accepts both Radix-64 and URL-safe strings + * @param base64 Base-64 encoded string to convert + * @returns An array of 8-bit integers + */ + function b64_to_Uint8Array(base64: string): Uint8Array; + + /** + * Convert an array of 8-bit integer to a Base-64 encoded string + * @param bytes An array of 8-bit integers to convert + * @param url If true, output is URL-safe + * @returns Base-64 encoded string + */ + function Uint8Array_to_b64(bytes: Uint8Array, url: boolean): string; + + /** + * Convert a hex string to an array of 8-bit integers + * @param hex A hex string to convert + * @returns An array of 8-bit integers + */ + function hex_to_Uint8Array(hex: string): Uint8Array; + + /** + * Convert an array of 8-bit integers to a hex string + * @param bytes Array of 8-bit integers to convert + * @returns Hexadecimal representation of the array + */ + function Uint8Array_to_hex(bytes: Uint8Array): string; + + /** + * Convert a string to an array of 8-bit integers + * @param str String to convert + * @returns An array of 8-bit integers + */ + function str_to_Uint8Array(str: string): Uint8Array; + + /** + * Convert an array of 8-bit integers to a string + * @param bytes An array of 8-bit integers to convert + * @returns String representation of the array + */ + function Uint8Array_to_str(bytes: Uint8Array): string; + + /** + * Convert a native javascript string to a Uint8Array of utf8 bytes + * @param str The string to convert + * @returns A valid squence of utf8 bytes + */ + function encode_utf8(str: string | ReadableStream): Uint8Array | ReadableStream; + + /** + * Convert a Uint8Array of utf8 bytes to a native javascript string + * @param utf8 A valid squence of utf8 bytes + * @returns A native javascript string + */ + function decode_utf8(utf8: Uint8Array | ReadableStream): string | ReadableStream; + + /** + * Concat a list of Uint8Arrays, Strings or Streams + * The caller must not mix Uint8Arrays with Strings, but may mix Streams with non-Streams. + * @param Array of Uint8Arrays/Strings/Streams to concatenate + * @returns Concatenated array + */ + var concat: any; + + /** + * Concat Uint8Arrays + * @param Array of Uint8Arrays to concatenate + * @returns Concatenated array + */ + var concatUint8Array: any; + + /** + * Check Uint8Array equality + * @param first array + * @param second array + * @returns equality + */ + function equalsUint8Array(first: Uint8Array, second: Uint8Array): boolean; + + /** + * Calculates a 16bit sum of a Uint8Array by adding each character + * codes modulus 65535 + * @param Uint8Array to create a sum of + * @returns 2 bytes containing the sum of all charcodes % 65535 + */ + function write_checksum(Uint8Array: Uint8Array): Uint8Array; + + /** + * Helper function to print a debug message. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug(str: string): void; + + /** + * Helper function to print a debug message. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug_hexarray_dump(str: string): void; + + /** + * Helper function to print a debug message. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug_hexstr_dump(str: string): void; + + /** + * Helper function to print a debug error. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug_error(str: string): void; + + /** + * Read a stream to the end and print it to the console when it's closed. + * @param str String of the debug message + * @param input Stream to print + * @param concat Function to concatenate chunks of the stream (defaults to util.concat). + */ + function print_entire_stream(str: string, input: ReadableStream | Uint8Array | string, concat: Function): void; + + /** + * If S[1] == 0, then double(S) == (S[2..128] || 0); + * otherwise, double(S) == (S[2..128] || 0) xor + * (zeros(120) || 10000111). + * Both OCB and EAX (through CMAC) require this function to be constant-time. + * @param data + */ + /* Illegal function name 'double' can't be used here + function double(data: Uint8Array): void; + */ + + /** + * Shift a Uint8Array to the right by n bits + * @param array The array to shift + * @param bits Amount of bits to shift (MUST be smaller + * than 8) + * @returns Resulting array. + */ + function shiftRight(array: Uint8Array, bits: Integer): string; + + /** + * Get native Web Cryptography api, only the current version of the spec. + * The default configuration is to use the api when available. But it can + * be deactivated with config.use_native + * @returns The SubtleCrypto api or 'undefined' + */ + function getWebCrypto(): object; + + /** + * Get native Web Cryptography api for all browsers, including legacy + * implementations of the spec e.g IE11 and Safari 8/9. The default + * configuration is to use the api when available. But it can be deactivated + * with config.use_native + * @returns The SubtleCrypto api or 'undefined' + */ + function getWebCryptoAll(): object; + + /** + * Detect Node.js runtime. + */ + function detectNode(): void; + + /** + * Get native Node.js module + * @param The module to require + * @returns The required module or 'undefined' + */ + function nodeRequire(The: string): object; + + /** + * Get native Node.js crypto api. The default configuration is to use + * the api when available. But it can also be deactivated with config.use_native + * @returns The crypto module or 'undefined' + */ + function getNodeCrypto(): object; + + /** + * Get native Node.js Buffer constructor. This should be used since + * Buffer is not available under browserify. + * @returns The Buffer constructor or 'undefined' + */ + function getNodeBuffer(): Function; + + /** + * Format user id for internal use. + */ + function formatUserId(): void; + + /** + * Parse user id. + */ + function parseUserId(): void; + + /** + * Normalize line endings to \r\n + */ + function canonicalizeEOL(): void; + + /** + * Convert line endings from canonicalized \r\n to native \n + */ + function nativeEOL(): void; + + /** + * Remove trailing spaces and tabs from each line + */ + function removeTrailingSpaces(): void; + + /** + * Encode input buffer using Z-Base32 encoding. + * See: https://tools.ietf.org/html/rfc6189#section-5.1.6 + * @param data The binary data to encode + * @returns Binary data encoded using Z-Base32 + */ + function encodeZBase32(data: Uint8Array): string; +} + +export namespace wkd { + class WKD { + /** + * Initialize the WKD client + */ + constructor(); + + /** + * Search for a public key using Web Key Directory protocol. + * @param options.email User's email. + * @param options.rawBytes Returns Uint8Array instead of parsed key. + * @returns The public key. + */ + lookup(): Promise, err: Array | null }>; + } +} + +export namespace worker { + /** + * @see module:openpgp.initWorker + * @see module:openpgp.getWorker + * @see module:openpgp.destroyWorker + * @see module:worker/worker + */ + namespace async_proxy { + class AsyncProxy { + /** + * Initializes a new proxy and loads the web worker + * @param path The path to the worker or 'openpgp.worker.js' by default + * @param n number of workers to initialize if path given + * @param config config The worker configuration + * @param worker alternative to path parameter: web worker initialized with 'openpgp.worker.js' + */ + constructor(path: string, n: number, config: object, worker: any[]); + + /** + * Message handling + */ + handleMessage(): void; + + /** + * Get new request ID + * @returns New unique request ID + */ + getID(): Integer; + + /** + * Send message to worker with random data + * @param size Number of bytes to send + */ + seedRandom(size: Integer): void; + + /** + * Terminates the workers + */ + terminate(): void; + + /** + * Generic proxy function that handles all commands from the public api. + * @param method the public api function to be delegated to the worker thread + * @param options the api function's options + * @returns see the corresponding public api functions for their return types + */ + delegate(method: string, options: object): Promise; + } + } + + /** + * @see module:openpgp.initWorker + * @see module:openpgp.getWorker + * @see module:openpgp.destroyWorker + * @see module:worker/async_proxy + */ + namespace worker { + /** + * Handle random buffer exhaustion by requesting more random bytes from the main window + * @returns Empty Promise whose resolution indicates that the buffer has been refilled + */ + function randomCallback(): Promise; + + /** + * Set config from main context to worker context. + * @param config The openpgp configuration + */ + function configure(config: object): void; + + /** + * Seed the library with entropy gathered window.crypto.getRandomValues + * as this api is only avalible in the main window. + * @param buffer Some random bytes + */ + function seedRandom(buffer: any[]): void; + + /** + * Generic proxy function that handles all commands from the public api. + * @param method The public api function to be delegated to the worker thread + * @param options The api function's options + */ + function delegate(method: string, options: object): void; + + /** + * Respond to the main window. + * @param event Contains event type and data + */ + function response(event: object): void; + } +} + + /** * Set the path for the web worker script and create an instance of the async proxy - * @param {String} path relative path to the worker scripts, default: 'openpgp.worker.js' - * @param {Number} n number of workers to initialize - * @param {Array} workers alternative to path parameter: web workers initialized with 'openpgp.worker.js' + * @param path relative path to the worker scripts, default: 'openpgp.worker.js' + * @param n number of workers to initialize + * @param workers alternative to path parameter: web workers initialized with 'openpgp.worker.js' */ -export function initWorker(options: WorkerOptions): boolean; +export function initWorker(path: string, n?: number, workers?: any[]): void; /** * Returns a reference to the async proxy if the worker was initialized with openpgp.initWorker() - * @returns {module:worker/async_proxy.AsyncProxy|null} the async proxy or null if not initialized + * @returns the async proxy or null if not initialized */ -export function getWorker(): AsyncProxy; +export function getWorker(): worker.async_proxy.AsyncProxy | null; /** * Cleanup the current instance of the web worker. */ export function destroyWorker(): void; -/** - * Encrypts message text/data with public keys, passwords or both at once. At least either public keys or passwords - * must be specified. If private keys are specified, those will be used to sign the message. - * @param {Message} message message to be encrypted as created by openpgp.message.fromText or openpgp.message.fromBinary - * @param {Key|Array} publicKeys (optional) array of keys or single key, used to encrypt the message - * @param {Key|Array} privateKeys (optional) private keys for signing. If omitted message will not be signed - * @param {String|Array} passwords (optional) array of passwords or a single password to encrypt the message - * @param {Object} sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String } - * @param {module:enums.compression} compression (optional) which compression algorithm to compress the message with, defaults to what is specified in config - * @param {Boolean} armor (optional) if the return values should be ascii armored or the message/signature objects - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Boolean} detached (optional) if the signature should be detached (if true, signature will be added to returned object) - * @param {Signature} signature (optional) a detached signature to add to the encrypted message - * @param {Boolean} returnSessionKey (optional) if the unencrypted session key should be added to returned object - * @param {Boolean} wildcard (optional) use a key ID of 0 instead of the public key IDs - * @param {Date} date (optional) override the creation date of the message signature - * @param {Object} fromUserId (optional) user ID to sign with, e.g. { name:'Steve Sender', email:'steve@openpgp.org' } - * @param {Object} toUserId (optional) user ID to encrypt for, e.g. { name:'Robert Receiver', email:'robert@openpgp.org' } - * @returns {Promise} Object containing encrypted (and optionally signed) message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if `armor` was true, the default) - * message: Message, (if `armor` was false) - * signature: String|ReadableStream|NodeStream, (if `detached` was true and `armor` was true) - * signature: Signature (if `detached` was true and `armor` was false) - * sessionKey: { data, algorithm, aeadAlgorithm } (if `returnSessionKey` was true) - * } - * @async - * @static - */ -export function encrypt(options: EncryptOptions): Promise; +export interface UserID { + name: string; + email: string; +} -/** - * Decrypts a message with the user's private key, a session key or a password. Either a private key, - * a session key or a password must be specified. - * @param {Message} message the message object with the encrypted data - * @param {Key|Array} privateKeys (optional) private keys with decrypted secret key data or session key - * @param {String|Array} passwords (optional) passwords to decrypt the message - * @param {Object|Array} sessionKeys (optional) session keys in the form: { data:Uint8Array, algorithm:String } - * @param {Key|Array} publicKeys (optional) array of public keys or single key, to verify signatures - * @param {String} format (optional) return data format either as 'utf8' or 'binary' - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Signature} signature (optional) detached signature for verification - * @param {Date} date (optional) use the given date for verification instead of the current time - * @returns {Promise} Object containing decrypted and verified message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if format was 'utf8', the default) - * data: Uint8Array|ReadableStream|NodeStream, (if format was 'binary') - * filename: String, - * signatures: [ - * { - * keyid: module:type/keyid, - * verified: Promise, - * valid: Boolean (if streaming was false) - * }, ... - * ] - * } - * @async - * @static - */ -export function decrypt(options: DecryptOptions): Promise; - -/** - * Signs a cleartext message. - * @param {CleartextMessage|Message} message (cleartext) message to be signed - * @param {Key|Array} privateKeys array of keys or single key with decrypted secret key data to sign cleartext - * @param {Boolean} armor (optional) if the return value should be ascii armored or the message object - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Boolean} detached (optional) if the return value should contain a detached signature - * @param {Date} date (optional) override the creation date of the signature - * @param {Array} fromUserIds (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @returns {Promise} Object containing signed message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if `armor` was true, the default) - * message: Message (if `armor` was false) - * } - * - * Or, if `detached` was true: - * - * { - * signature: String|ReadableStream|NodeStream, (if `armor` was true, the default) - * signature: Signature (if `armor` was false) - * } - * @async - * @static - */ -export function sign(options: SignOptions): Promise; - -/** - * Verifies signatures of cleartext signed message - * @param {Key|Array} publicKeys array of publicKeys or single key, to verify signatures - * @param {CleartextMessage|Message} message (cleartext) message object with signatures - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Signature} signature (optional) detached signature for verification - * @param {Date} date (optional) use the given date for verification instead of the current time - * @returns {Promise} Object containing verified message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if `message` was a CleartextMessage) - * data: Uint8Array|ReadableStream|NodeStream, (if `message` was a Message) - * signatures: [ - * { - * keyid: module:type/keyid, - * verified: Promise, - * valid: Boolean (if `streaming` was false) - * }, ... - * ] - * } - * @async - * @static - */ -export function verify(options: VerifyOptions): Promise; +export interface KeyOptions { + /** + * array of user IDs e.g. [ { name:'Phil Zimmermann', email:'phil@openpgp.org' }] + */ + userIds: UserID[]; + /** + * (optional) The passphrase used to encrypt the resulting private key + */ + passphrase?: string; + /** + * (optional) number of bits for RSA keys: 2048 or 4096. + */ + numBits?: number; + /** + * (optional) The number of seconds after the key creation time that the key expires + */ + keyExpirationTime?: number; + /** + * (optional) elliptic curve for ECC keys: elliptic curve for ECC keys: + * curve25519, p256, p384, p521, secp256k1, + * brainpoolP256r1, brainpoolP384r1, or brainpoolP512r1. + */ + curve?: string; + /** + * (optional) override the creation date of the key and the key signatures + */ + date?: Date; + /** + * (optional) options for each subkey, default to main key options. e.g. [ {sign: true, passphrase: '123'}] + * sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt + */ + subkeys?: { sign: true, passphrase: "string" }[]; +} /** * Generates a new OpenPGP key pair. Supports RSA and ECC keys. Primary and subkey will be of same type. - * @param {Array} userIds array of user IDs e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }] - * @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key - * @param {Number} numBits (optional) number of bits for RSA keys: 2048 or 4096. - * @param {Number} keyExpirationTime (optional) The number of seconds after the key creation time that the key expires - * @param {String} curve (optional) elliptic curve for ECC keys: - * curve25519, p256, p384, p521, secp256k1, - * brainpoolP256r1, brainpoolP384r1, or brainpoolP512r1. - * @param {Date} date (optional) override the creation date of the key and the key signatures - * @param {Array} subkeys (optional) options for each subkey, default to main key options. e.g. [{sign: true, passphrase: '123'}] - * sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt - * @returns {Promise} The generated key object in the form: - * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } - * @async - * @static + * @param options + * @returns The generated key object in the form: + * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } */ -export function generateKey(options: KeyOptions): Promise; +export function generateKey(option: KeyOptions): Promise<{ key: key.Key, privateKeyArmored: string, publicKeyArmored: string, revocationCertificate: string }>; /** * Reformats signature packets for a key and rewraps key object. - * @param {Key} privateKey private key to reformat - * @param {Array} userIds array of user IDs e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }] - * @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key - * @param {Number} keyExpirationTime (optional) The number of seconds after the key creation time that the key expires - * @param {Boolean} revocationCertificate (optional) Whether the returned object should include a revocation certificate to revoke the public key - * @returns {Promise} The generated key object in the form: - * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } - * @async - * @static + * @param privateKey private key to reformat + * @param userIds array of user IDs e.g. [ { name:'Phil Zimmermann', email:'phil@openpgp.org' }] + * @param passphrase (optional) The passphrase used to encrypt the resulting private key + * @param keyExpirationTime (optional) The number of seconds after the key creation time that the key expires + * @param revocationCertificate (optional) Whether the returned object should include a revocation certificate to revoke the public key + * @returns The generated key object in the form: + * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } */ -export function reformatKey(options: { - privateKey: key.Key, - userIds?: UserId[], - passphrase?: string, - keyExpirationTime?: number, - revocationCertificate?: boolean -}): Promise; +export function reformatKey(privateKey: key.Key, userIds: any[], passphrase?: string, keyExpirationTime?: number, revocationCertificate?: boolean): Promise; /** * Revokes a key. Requires either a private key or a revocation certificate. - * If a revocation certificate is passed, the reasonForRevocation parameters will be ignored. - * @param {Key} key (optional) public or private key to revoke - * @param {String} revocationCertificate (optional) revocation certificate to revoke the key with - * @param {Object} reasonForRevocation (optional) object indicating the reason for revocation - * @param {module:enums.reasonForRevocation} reasonForRevocation.flag (optional) flag indicating the reason for revocation - * @param {String} reasonForRevocation.string (optional) string explaining the reason for revocation - * @returns {Promise} The revoked key object in the form: - * { privateKey:Key, privateKeyArmored:String, publicKey:Key, publicKeyArmored:String } - * (if private key is passed) or { publicKey:Key, publicKeyArmored:String } (otherwise) - * @static + * If a revocation certificate is passed, the reasonForRevocation parameters will be ignored. + * @param key (optional) public or private key to revoke + * @param revocationCertificate (optional) revocation certificate to revoke the key with + * @param reasonForRevocation (optional) object indicating the reason for revocation + * @param reasonForRevocation.flag (optional) flag indicating the reason for revocation + * @param reasonForRevocation.string (optional) string explaining the reason for revocation + * @returns The revoked key object in the form: + * { privateKey:Key, privateKeyArmored:String, publicKey:Key, publicKeyArmored:String } + * (if private key is passed) or { publicKey:Key, publicKeyArmored:String } (otherwise) */ -export function revokeKey(options: { - key?: key.Key, - revocationCertificate?: string - reasonForRevocation?: { - flag: enums.reasonForRevocation, - 'string': string - }, -}): Promise; +export function revokeKey(key?: key.Key, revocationCertificate?: string, reasonForRevocation?: revokeKey_reasonForRevocation): Promise<{ + privateKey: key.Key, + privateKeyArmored: string, + publicKey: key.Key, + publicKeyArmored: string +} | { + publicKey: key.Key, + publicKeyArmored: string +}>; /** * Unlock a private key with your passphrase. - * @param {Key} privateKey the private key that is to be decrypted - * @param {String|Array} passphrase the user's passphrase(s) chosen during key generation - * @returns {Promise} the unlocked key object in the form: { key:Key } - * @async + * @param privateKey the private key that is to be decrypted + * @param passphrase the user's passphrase(s) chosen during key generation + * @returns the unlocked key object in the form: { key:Key } */ -export function decryptKey(options: { - privateKey: key.Key, - passphrase?: string | string[], -}): Promise; +export function decryptKey(privateKey: key.Key, passphrase: string | any[]): Promise<{ key: key.Key }>; /** * Lock a private key with your passphrase. - * @param {Key} privateKey the private key that is to be decrypted - * @param {String|Array} passphrase the user's passphrase(s) chosen during key generation - * @returns {Promise} the locked key object in the form: { key:Key } - * @async + * @param privateKey the private key that is to be decrypted + * @param passphrase the user's passphrase(s) chosen during key generation + * @returns the locked key object in the form: { key:Key } */ -export function encryptKey(options: { - privateKey: key.Key, - passphrase?: string | string[], -}): Promise; - -// TODO add typings for encryptSessionKey and decryptSessionKeys - -export namespace armor { - /** Armor an OpenPGP binary packet block - - @param messagetype type of the message - @param body - @param partindex - @param parttotal - */ - function armor(messagetype: enums.armor, body: Object, partindex: number, parttotal: number): string; - - /** DeArmor an OpenPGP armored message; verify the checksum and return the encoded bytes - - @param text OpenPGP armored message - */ - function dearmor(text: string): Object; -} - -export namespace cleartext { - /** Class that represents an OpenPGP cleartext signed message. - */ - interface CleartextMessage { - /** Returns ASCII armored text of cleartext signed message - */ - armor(): string; - - /** Returns the key IDs of the keys that signed the cleartext message - */ - getSigningKeyIds(): Array; - - /** Get cleartext - */ - getText(): string; - - /** Sign the cleartext message - @param privateKeys private keys with decrypted secret key data for signing - */ - sign(privateKeys: Array): void; - - /** Verify signatures of cleartext signed message - @param keys array of keys to verify signatures - */ - verify(keys: Array): Array; - } - - /** creates new message object from text - @param text - */ - function fromText(text: string): CleartextMessage; - - function readArmored(armoredText: string): Promise; -} - -export namespace config { - var prefer_hash_algorithm: enums.hash; - var encryption_cipher: enums.symmetric; - var compression: enums.compression; - var show_version: boolean; - var show_comment: boolean; - var integrity_protect: boolean; - var keyserver: string; - var debug: boolean; -} - -export namespace crypto { - interface Mpi { - data: number, - read(input: string): number, - write(): string, - } - - /** Generating a session key for the specified symmetric algorithm - @param algo Algorithm to use - */ - function generateSessionKey(algo: enums.symmetric): string; - - /** generate random byte prefix as string for the specified algorithm - @param algo Algorithm to use - */ - function getPrefixRandom(algo: enums.symmetric): string; - - /** Returns the number of integers comprising the private key of an algorithm - @param algo The public key algorithm - */ - function getPrivateMpiCount(algo: enums.symmetric): number; - - /** Decrypts data using the specified public key multiprecision integers of the private key, the specified secretMPIs of the private key and the specified algorithm. - @param algo Algorithm to be used - @param publicMPIs Algorithm dependent multiprecision integers of the public key part of the private key - @param secretMPIs Algorithm dependent multiprecision integers of the private key used - @param data Data to be encrypted as MPI - */ - function publicKeyDecrypt(algo: enums.publicKey, publicMPIs: Array, secretMPIs: Array, data: Mpi): Mpi; - - /** Encrypts data using the specified public key multiprecision integers and the specified algorithm. - @param algo Algorithm to be used - @param publicMPIs Algorithm dependent multiprecision integers - @param data Data to be encrypted as MPI - */ - function publicKeyEncrypt(algo: enums.publicKey, publicMPIs: Array, data: Mpi): Array; - - - namespace cfb { - /** This function decrypts a given plaintext using the specified blockcipher to decrypt a message - @param cipherfn the algorithm cipher class to decrypt data in one block_size encryption - @param key binary string representation of key to be used to decrypt the ciphertext. This will be passed to the cipherfn - @param ciphertext to be decrypted provided as a string - @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Decryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - */ - function decrypt(cipherfn: string, key: string, ciphertext: string, resync: boolean): string; - - /** This function encrypts a given with the specified prefixrandom using the specified blockcipher to encrypt a message - @param prefixrandom random bytes of block_size length provided as a string to be used in prefixing the data - @param cipherfn the algorithm cipher class to encrypt data in one block_size encryption - @param plaintext data to be encrypted provided as a string - @param key binary string representation of key to be used to encrypt the plaintext. This will be passed to the cipherfn - @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Encryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - */ - function encrypt(prefixrandom: string, cipherfn: string, plaintext: string, key: string, resync: boolean): string; - - /** Decrypts the prefixed data for the Modification Detection Code (MDC) computation - @param cipherfn cipherfn.encrypt Cipher function to use - @param key binary string representation of key to be used to check the mdc This will be passed to the cipherfn - @param ciphertext The encrypted data - */ - function mdc(cipherfn: Object, key: string, ciphertext: string): string; - } - - namespace hash { - /** Create a hash on the specified data using the specified algorithm - @param algo Hash algorithm type - @param data Data to be hashed - */ - function digest(algo: enums.hash, data: string): string; - - /** Returns the hash size in bytes of the specified hash algorithm type - @param algo Hash algorithm type - */ - function getHashByteLength(algo: enums.hash): number; - } - - namespace random { - /** Create a secure random big integer of bits length - @param bits Bit length of the MPI to create - */ - function getRandomBigInteger(bits: number): number; - - /** Retrieve secure random byte string of the specified length - @param length Length in bytes to generate - */ - function getRandomBytes(length: number): string; - - /** Helper routine which calls platform specific crypto random generator - @param buf - */ - function getRandomValues(buf: Uint8Array): void; - - /** Return a secure random number in the specified range - @param from Min of the random number - @param to Max of the random number (max 32bit) - */ - function getSecureRandom(from: number, to: number): number; - } - - namespace signature { - /** Create a signature on data using the specified algorithm - @param hash_algo hash Algorithm to use - @param algo Asymmetric cipher algorithm to use - @param publicMPIs Public key multiprecision integers of the private key - @param secretMPIs Private key multiprecision integers which is used to sign the data - @param data Data to be signed - */ - function sign(hash_algo: enums.hash, algo: enums.publicKey, publicMPIs: Array, secretMPIs: Array, data: string): Mpi; - - /** - @param algo public Key algorithm - @param hash_algo Hash algorithm - @param msg_MPIs Signature multiprecision integers - @param publickey_MPIs Public key multiprecision integers - @param data Data on where the signature was computed on - */ - function verify(algo: enums.publicKey, hash_algo: enums.hash, msg_MPIs: Array, publickey_MPIs: Array, data: string): boolean; - } -} - -export namespace enums { - enum armor { - multipart_section, - multipart_last, - signed, - message, - public_key, - private_key - } - - enum compression { - uncompressed, - zip, - zlib, - bzip2 - } - - enum hash { - md5, - sha1, - ripemd, - sha256, - sha384, - sha512, - sha224 - } - - enum packet { - publicKeyEncryptedSessionKey, - signature, - symEncryptedSessionKey, - onePassSignature, - secretKey, - publicKey, - secretSubkey, - compressed, - symmetricallyEncrypted, - marker, - literal, - trust, - userid, - publicSubkey, - userAttribute, - symEncryptedIntegrityProtected, - modificationDetectionCode, - } - - enum publicKey { - rsa_encrypt_sign, - rsa_encrypt, - rsa_sign, - elgamal, - dsa - } - - enum symmetric { - plaintext, - idea, - tripledes, - cast5, - blowfish, - aes128, - aes192, - aes256, - twofish - } - - enum keyStatus { - invalid, - expired, - revoked, - valid, - no_self_cert - } - - enum reasonForRevocation { - no_reason, - key_superseded, - key_compromised, - key_retired, - userid_invalid - } -} - -export namespace key { - interface KeyResult { - keys: Array, - err: Array - } - - /** Class that represents an OpenPGP key. Must contain a primary key. Can contain additional subkeys, signatures, user ids, user attributes. - */ - interface Key { - armor(): string, - decrypt(passphrase: string): boolean; - getExpirationTime(): Date; - getKeyIds(): Array; - getPreferredHashAlgorithm(): string; - getPrimaryUser(): any; - getUserIds(): Array; - isPrivate(): boolean; - isPublic(): boolean; - primaryKey: packet.PublicKey; - toPublic(): Key; - update(key: Key): void; - verifyPrimaryKey(): enums.keyStatus; - } - - /** Generates a new OpenPGP key. Currently only supports RSA keys. Primary and subkey will be of same type. - - @param options - */ - function generate(options: KeyOptions): Key; - - /** Reads an OpenPGP armored text and returns one or multiple key objects - - @param armoredText text to be parsed - */ - function readArmored(armoredText: string): Promise; -} - -export namespace message { - /** Class that represents an OpenPGP message. Can be an encrypted message, signed message, compressed message or literal message - */ - interface Message { - /** Returns ASCII armored text of message - */ - armor(): string, - - /** Decrypt the message - @param privateKey private key with decrypted secret data - */ - decrypt(privateKey: key.Key): Array, - - /** Encrypt the message - @param keys array of keys, used to encrypt the message - */ - encrypt(keys: Array): Array, - - /** Returns the key IDs of the keys to which the session key is encrypted - */ - getEncryptionKeyIds(): Array, - - /** Get literal data that is the body of the message - */ - getLiteralData(): string, - - /** Returns the key IDs of the keys that signed the message - */ - getSigningKeyIds(): Array, - - /** Get literal data as text - */ - getText(): string, - - /** Sign the message (the literal data packet of the message) - @param privateKey private keys with decrypted secret key data for signing - */ - sign(privateKey: Array): Message, - - /** Unwrap compressed message - */ - unwrapCompressed(): Message, - - /** Verify message signatures - @param keys array of keys to verify signatures - */ - verify(keys: Array): Array, - - packets: { - write(): Uint8Array, - }, - } - - /** creates new message object from binary data - @param bytes - */ - function fromBinary(bytes: Uint8Array | ReadableStream): Message; - - /** creates new message object from text - @param text - */ - function fromText(text: string): Message; - - /** reads an OpenPGP armored message and returns a message object - - @param armoredText text to be parsed - */ - function readArmored(armoredText: string): Promise; +export function encryptKey(privateKey: key.Key, passphrase: string | any[]): Promise<{ key: key.Key }>; +export interface EncryptOptions { /** - * reads an OpenPGP message as byte array and returns a message object - * @param {Uint8Array} input binary message - * @returns {Message} new message object - * @static + * message to be encrypted as created by openpgp.message.fromText or openpgp.message.fromBinary */ - function read(data: Uint8Array): Promise; + message: message.Message; + /** + * (optional) array of keys or single key, used to encrypt the message + */ + publicKeys?: key.Key | any[]; + /** + * (optional) private keys for signing. If omitted message will not be signed + */ + privateKeys?: key.Key | any[]; + /** + * (optional) array of passwords or a single password to encrypt the message + */ + passwords?: string | any[]; + /** + * (optional) session key in the form: { data:Uint8Array, algorithm:String } + */ + sessionKey?: { data: Uint8Array, algorithm: string }; + /** + * (optional) which compression algorithm to compress the message with, defaults to what is specified in config + */ + compression?: enums.compression; + /** + * (optional) if the return values should be ascii armored or the message/signature objects + */ + armor?: boolean; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + */ + streaming?: 'web' | 'node' | false; + /** + * (optional) if the signature should be detached (if true, signature will be added to returned object) + */ + detached?: boolean; + /** + * (optional) a detached signature to add to the encrypted message + */ + signature?: signature.Signature; + /** + * (optional) if the unencrypted session key should be added to returned object + */ + returnSessionKey?: boolean; + /** + * (optional) use a key ID of 0 instead of the public key IDs + */ + wildcard?: boolean; + /** + * (optional) override the creation date of the message signature + */ + date?: Date; + /** + * (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + */ + fromUserIds?: UserID[]; + /** + * (optional) array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [ { name:'Robert Receiver', email:'robert@openpgp.org' }] + */ + toUserIds?: UserID[] } -export namespace packet { - interface PublicKey { - algorithm: enums.publicKey; - created: Date; - fingerprint: string; - - getBitSize(): number; - getFingerprint(): string; - getKeyId(): string; - read(input: string): any; - write(): any; - } - - interface SecretKey extends PublicKey { - read(bytes: string): void; - write(): string; - clearPrivateMPIs(str_passphrase: string): boolean; - encrypt(passphrase: string): void; - } - - /** Allocate a new packet from structured packet clone - @param packetClone packet clone - */ - function fromStructuredClone(packetClone: Object): Object - - /** Allocate a new packet - @param property name from enums.packet - */ - function newPacketFromTag(tag: string): Object; +export interface EncryptResult { + data: string | ReadableStream; + message: message.Message; + signature: string | ReadableStream | signature.Signature; + sessionKey: { data: Uint8Array, algorithm: string, aeadAlgorithm: string }; } -export namespace util { - /** Convert an array of integers(0.255) to a string - @param bin An array of (binary) integers to convert - */ - function bin2str(bin: Array): string; +/** + * Encrypts message text/data with public keys, passwords or both at once. At least either public keys or passwords + * must be specified. If private keys are specified, those will be used to sign the message. + * @param options + * @returns Object containing encrypted (and optionally signed) message in the form: + * { + * data: string|ReadableStream|NodeStream, (if `armor` was true, the default) + * message: Message, (if `armor` was false) + * signature: string|ReadableStream|NodeStream, (if `detached` was true and `armor` was true) + * signature: Signature (if `detached` was true and `armor` was false) + * sessionKey: { data, algorithm, aeadAlgorithm } (if `returnSessionKey` was true) + * } + */ +export function encrypt(options: EncryptOptions): Promise; - /** Calculates a 16bit sum of a string by adding each character codes modulus 65535 - @param text string to create a sum of +export interface DecryptOptions { + /** + * the message object with the encrypted data */ - function calc_checksum(text: string): number; - - /** Convert a string of utf8 bytes to a native javascript string - @param utf8 A valid squence of utf8 bytes + message: message.Message; + /** + * (optional) private keys with decrypted secret key data or session key */ - function decode_utf8(utf8: string): string - - /** Convert a native javascript string to a string of utf8 bytes - param str The string to convert + privateKeys?: key.Key | key.Key[]; + /** + * (optional) passwords to decrypt the message */ - function encode_utf8(str: string): string - - /** Return the algorithm type as string + passwords?: string | string[]; + /** + * (optional) session keys in the form: { data:Uint8Array, algorithm:String } */ - function get_hashAlgorithmString(): string - - /** Get native Web Cryptography api. The default configuration is to use the api when available. But it can also be deactivated with config.useWebCrypto + sessionKeys?: { data: Uint8Array, algorithm: string } | { data: Uint8Array, algorithm: string }[]; + /** + * (optional) array of public keys or single key, to verify signatures */ - function getWebCrypto(): Object - - /** Create binary string from a hex encoded string - @param str Hex string to convert + publicKeys?: key.Key | key.Key[]; + /** + * (optional) whether to return data as a string(Stream) or Uint8Array(Stream). If 'utf8' (the default), also normalize newlines. */ - function hex2bin(str: string): string; - - /** Creating a hex string from an binary array of integers (0..255) - @param str Array of bytes to convert + format?: 'utf8' | 'binary'; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. */ - function hexidump(str: string): string; - - /** Create hexstring from a binary - @param str string to convert + streaming?: 'web' | 'node' | false; + /** + * (optional) detached signature for verification */ - function hexstrdump(str: string): string; - - /** Helper function to print a debug message. Debug messages are only printed if - @param str string of the debug message + signature?: signature.Signature; + /** + * (optional) use the given date for verification instead of the current time */ - function print_debug(str: string): void; - - /** Helper function to print a debug message. Debug messages are only printed if - @param str string of the debug message - */ - function print_debug_hexstr_dump(str: string): void; - - /** Shifting a string to n bits right - @param value The string to shift - @param bitcount Amount of bits to shift (MUST be smaller than 9) - */ - function shiftRight(value: string, bitcount: number): string; - - /** Convert a string to an array of integers(0.255) - @param str string to convert - */ - function str2bin(str: string): Array; - - /** Convert a string to a Uint8Array - @param str string to convert - */ - function str2Uint8Array(str: string): Uint8Array; - - /** Convert a Uint8Array to a string. This currently functions the same as bin2str. - @param bin An array of (binary) integers to convert - */ - function Uint8Array2str(bin: Uint8Array): string; + date?: Date } + +export interface DecryptResult { + data: string | ReadableStream | NodeStream | Uint8Array | ReadableStream, + filename: string, + signatures: { + keyid: type.keyid.Keyid, + verified: Promise, + valid: boolean + }[] +} + +/** + * Decrypts a message with the user's private key, a session key or a password. Either a private key, + * a session key or a password must be specified. + * @param options + * @returns Object containing decrypted and verified message in the form: + * { + * data: string|ReadableStream|NodeStream, (if format was 'utf8', the default) + * data: Uint8Array|ReadableStream|NodeStream, (if format was 'binary') + * filename: string, + * signatures: [ + * { + * keyid: module:type/keyid, + * verified: Promise, + * valid: boolean (if streaming was false) + * }, ... + * ] + * } + */ +export function decrypt(options: DecryptOptions): Promise; + +export interface SignOptions { + /** + * (cleartext) message to be signed + */ + message: cleartext.CleartextMessage | message.Message; + /** + * array of keys or single key with decrypted secret key data to sign cleartext + */ + privateKeys: key.Key | any[]; + /** + * (optional) if the return value should be ascii armored or the message object + */ + armor?: boolean; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + */ + streaming?: 'web' | 'node' | false; + /** + * (optional) if the return value should contain a detached signature + */ + detached?: boolean; + /** + * (optional) override the creation date of the signature + */ + date?: Date; + /** + * (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + */ + fromUserIds?: UserID[] +} + +export interface SignResult { + data: string | ReadableStream | NodeStream, + message: message.Message, + signature: string | ReadableStream | NodeStream | signature.Signature +} + +/** + * Signs a cleartext message. + * @param options + * @returns Object containing signed message in the form: + * { + * data: string|ReadableStream|NodeStream, (if `armor` was true, the default) + * message: Message (if `armor` was false) + * } + * Or, if `detached` was true: + * { + * signature: string|ReadableStream|NodeStream, (if `armor` was true, the default) + * signature: Signature (if `armor` was false) + * } + */ +export function sign(options: SignOptions): Promise; + +export interface VerifyOptions { + /** + * array of publicKeys or single key, to verify signatures + */ + publicKeys: key.Key | any[]; + /** + * (cleartext) message object with signatures + */ + message: cleartext.CleartextMessage | message.Message; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + */ + streaming?: 'web' | 'node' | false; + /** + * (optional) detached signature for verification + */ + signature?: signature.Signature; + /** + * (optional) use the given date for verification instead of the current time + */ + date?: Date +} + +export interface VerifyResult { + data: string | ReadableStream | NodeStream | Uint8Array | ReadableStream | NodeStream, + signatures: { + keyid: type.keyid.Keyid, + verified: Promise, + valid: boolean + }[] +} + +/** + * Verifies signatures of cleartext signed message + * @param options + * @returns Object containing verified message in the form: + * { + * data: string|ReadableStream|NodeStream, (if `message` was a CleartextMessage) + * data: Uint8Array|ReadableStream|NodeStream, (if `message` was a Message) + * signatures: [ + * { + * keyid: module:type/keyid, + * verified: Promise, + * valid: boolean (if `streaming` was false) + * }, ... + * ] + * } + */ +export function verify(options: VerifyOptions): Promise; + +/** + * Encrypt a symmetric session key with public keys, passwords, or both at once. At least either public keys + * or passwords must be specified. + * @param data the session key to be encrypted e.g. 16 random bytes (for aes128) + * @param algorithm algorithm of the symmetric session key e.g. 'aes128' or 'aes256' + * @param aeadAlgorithm (optional) aead algorithm, e.g. 'eax' or 'ocb' + * @param publicKeys (optional) array of public keys or single key, used to encrypt the key + * @param passwords (optional) passwords for the message + * @param wildcard (optional) use a key ID of 0 instead of the public key IDs + * @param date (optional) override the date + * @param toUserIds (optional) array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [ { name:'Phil Zimmermann', email:'phil@openpgp.org' }] + * @returns the encrypted session key packets contained in a message object + */ +export function encryptSessionKey(data: Uint8Array, algorithm: string, aeadAlgorithm?: string, publicKeys?: key.Key | key.Key[], passwords?: string | string[], wildcard?: boolean, date?: Date, toUserIds?: any[]): Promise; + +/** + * Decrypt symmetric session keys with a private key or password. Either a private key or + * a password must be specified. + * @param message a message object containing the encrypted session key packets + * @param privateKeys (optional) private keys with decrypted secret key data + * @param passwords (optional) passwords to decrypt the session key + * @returns Array of decrypted session key, algorithm pairs in form: + * { data:Uint8Array, algorithm:String } + * or 'undefined' if no key packets found + */ +export function decryptSessionKeys(message: message.Message, privateKeys?: key.Key | key.Key[], passwords?: string | string[]): Promise<{ data: Uint8Array, algorithm: string }[] | undefined>; + +/** + * Input validation + */ +export function checkString(): void; + +/** + * Normalize parameter to an array if it is not undefined. + * @param param the parameter to be normalized + * @returns the resulting array or undefined + */ +export function toArray(param: object): any[] | undefined; + +/** + * Convert data to or from Stream + * @param data the data to convert + * @param streaming (optional) whether to return a ReadableStream + * @returns the data in the respective format + */ +export function convertStream(data: object, streaming?: 'web' | 'node' | false): object; + +/** + * Convert object properties from Stream + * @param obj the data to convert + * @param streaming (optional) whether to return ReadableStreams + * @param keys (optional) which keys to return as streams, if possible + * @returns the data in the respective format + */ +export function convertStreams(obj: object, streaming: 'web' | 'node' | false, keys: any[]): object; + +/** + * Link result.data to the message stream for cancellation. + * Also, forward errors in the message to result.data. + * @param result the data to convert + * @param message message object + * @param erroringStream (optional) stream which either errors or gets closed without data + * @returns + */ +export function linkStreams(result: object, message: message.Message, erroringStream: ReadableStream): object; + +/** + * Wait until signature objects have been verified + * @param signatures list of signatures + */ +export function prepareSignatures(signatures: object): void; + +/** + * Global error handler that logs the stack trace and rethrows a high lvl error message. + * @param message A human readable high level error Message + * @param error The internal error that caused the failure + */ +export function onError(message: string, error: Error): void; + +/** + * Check for native AEAD support and configuration by the user. Only + * browsers that implement the current WebCrypto specification support + * native GCM. Native EAX is built on CTR and CBC, which current + * browsers support. OCB and CFB are not natively supported. + * @returns If authenticated encryption should be used + */ +export function nativeAEAD(): boolean; diff --git a/types/openpgp/openpgp-tests.ts b/types/openpgp/openpgp-tests.ts index 19e305cb26..45a69aad1f 100644 --- a/types/openpgp/openpgp-tests.ts +++ b/types/openpgp/openpgp-tests.ts @@ -1,6 +1,8 @@ +import openpgp from "openpgp" + // Open PGP Sample codes -var options: openpgp.KeyOptions = { +const options: openpgp.KeyOptions = { numBits: 2048, userIds: [{ name: 'Jon Smith', @@ -8,53 +10,51 @@ var options: openpgp.KeyOptions = { }], passphrase: 'super long and hard to guess secret' }; - -openpgp.generateKey(options).then(function (keypair) { +openpgp.generateKey(options).then((keypair) => { // success - var privkey = keypair.privateKeyArmored; - var pubkey = keypair.publicKeyArmored; -}).catch(function (error) { + const privkey = keypair.privateKeyArmored; + const pubkey = keypair.publicKeyArmored; +}).catch((error) => { // failure }); - -var spubkey = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----'; +const spubkey = '-----BEGIN PGP PUBLIC KEY BLOCK ... END PGP PUBLIC KEY BLOCK-----'; openpgp.key.readArmored(spubkey) - .then(function (publicKey) { + .then((publicKey) => { return { message: openpgp.message.fromText('Hello, World!'), publicKeys: publicKey.keys }; }) .then(openpgp.encrypt) - .then(function (pgpMessage) { + .then((pgpMessage) => { // success }) - .catch(function (error) { + .catch((error) => { // failure }); -var sprivkey = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----'; -var pgpMessageStr = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'; +const sprivkey = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----'; +const pgpMessageStr = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'; -openpgp.message.readArmored(pgpMessageStr).then(function(pgpMessage) { +openpgp.message.readArmored(pgpMessageStr).then((pgpMessage) => { const options = { message: pgpMessage }; return openpgp.decrypt(options); -}).then(function (plaintext) { +}).then((plaintext) => { // success -}).catch(function (error) { +}).catch((error) => { // failure }); -const promises: [Promise, Promise] = [ +const promises: [Promise<{ keys: openpgp.key.Key[], err: Error[] | null }>, Promise] = [ openpgp.key.readArmored(sprivkey), openpgp.message.readArmored(pgpMessageStr) ]; -Promise.all(promises).then(function (values) { +Promise.all(promises).then((values) => { const keyObject: openpgp.key.KeyResult = values[0]; const pgpMessage: openpgp.message.Message = values[1]; const privateKey = keyObject.keys[0]; @@ -64,13 +64,13 @@ Promise.all(promises).then(function (values) { message: pgpMessage }; return openpgp.decrypt(options); -}).then(function (plaintext) { +}).then((plaintext) => { // success -}).catch(function (error) { +}).catch((error) => { // failure }); -openpgp.initWorker({ path:'openpgp.worker.js' }); +openpgp.initWorker('openpgp.worker.js'); (async () => { let msgOptions: openpgp.EncryptOptions; @@ -81,10 +81,10 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); armor: false, }; - let cipher = await openpgp.encrypt(msgOptions); - let encrypted = cipher.message.packets.write(); // get raw encrypted packets as Uint8Array + const cipher = await openpgp.encrypt(msgOptions); + const encrypted = cipher.message.packets.write(); // get raw encrypted packets as Uint8Array - let plain = await openpgp.decrypt({ + const plain = await openpgp.decrypt({ message: await openpgp.message.read(encrypted), passwords: ['secret stuff'], format: 'binary' @@ -94,14 +94,14 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); })(); (async () => { - let cipher = await openpgp.encrypt({ + const cipher = await openpgp.encrypt({ message: openpgp.message.fromText('hello world'), passwords: 'super secure', armor: true, }); - let encrypted = cipher.data; + const encrypted = cipher.data; - let plain = await openpgp.decrypt({ + const plain = await openpgp.decrypt({ message: await openpgp.message.readArmored(encrypted), passwords: 'super secure', }); @@ -109,10 +109,9 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); return plain.data; })(); - (async () => { - const publicKey = (await openpgp.key.readArmored(spubkey)) - const privateKey = (await openpgp.key.readArmored(sprivkey)) + const publicKey = (await openpgp.key.readArmored(spubkey)); + const privateKey = (await openpgp.key.readArmored(sprivkey)); const signOptions: openpgp.SignOptions = { message: openpgp.message.fromText('hello world'), privateKeys: privateKey.keys, @@ -121,7 +120,7 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); const signed = await openpgp.sign(signOptions); - const signature = signed.signature as openpgp.Signature; + const signature = signed.signature as openpgp.signature.Signature; const message = signed.message; const verifyOptions: openpgp.VerifyOptions = { @@ -130,43 +129,46 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); publicKeys: publicKey.keys }; - let verified = await openpgp.verify(verifyOptions); + const verified = await openpgp.verify(verifyOptions); return verified.signatures[0].valid; })(); // Open PGP Tests +const keyoptions: openpgp.KeyOptions = null; +const mpi: openpgp.type.mpi.MPI = null; +const mpis: openpgp.type.mpi.MPI[] = []; -var keyoptions: openpgp.KeyOptions; -var mpi: openpgp.crypto.Mpi; -var mpis: Array; - -openpgp.armor.armor(openpgp.enums.armor.message, {}, 0, 1); -openpgp.armor.dearmor(""); +openpgp.encoding.armor.armor(openpgp.enums.armor.message, {}, 0, 1); +openpgp.encoding.armor.dearmor(""); openpgp.cleartext.readArmored(""); -openpgp.crypto.generateSessionKey(openpgp.enums.symmetric.aes128); -openpgp.crypto.getPrefixRandom(openpgp.enums.symmetric.aes128); -openpgp.crypto.getPrivateMpiCount(openpgp.enums.symmetric.aes128); -openpgp.crypto.publicKeyDecrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpis, mpi); -openpgp.crypto.publicKeyEncrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpi); +openpgp.crypto.crypto.generateSessionKey(openpgp.enums.symmetric.aes128); +openpgp.crypto.crypto.getPrefixRandom(openpgp.enums.symmetric.aes128); +// openpgp.crypto.crypto.getPrivateMpiCount(openpgp.enums.symmetric.aes128); +openpgp.crypto.crypto.publicKeyDecrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpis, ""); +openpgp.crypto.crypto.publicKeyEncrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpi, ""); +openpgp.crypto; +// API update with no documentation openpgp.crypto.cfb.decrypt("", "", "", true); -openpgp.crypto.cfb.encrypt("", "", "", "", true); -openpgp.crypto.cfb.mdc({}, "", ""); +openpgp.crypto.cfb.encrypt("", "", "", true); +// Function removed from openpgp.crypto.cfb +// openpgp.crypto.cfb.mdc({}, "", ""); -openpgp.crypto.hash.digest(openpgp.enums.hash.md5, ""); +openpgp.crypto.hash.digest(openpgp.enums.hash.md5, new Uint8Array([0, 1])); openpgp.crypto.hash.getHashByteLength(openpgp.enums.hash.md5); -openpgp.crypto.random.getRandomBigInteger(0); +openpgp.crypto.random.getRandomBN(mpi, mpi); openpgp.crypto.random.getRandomBytes(0); -openpgp.crypto.random.getRandomValues(openpgp.util.str2Uint8Array("")); -openpgp.crypto.random.getSecureRandom(0, 1); +// function removed from openpgp.crypto.random +// openpgp.crypto.random.getRandomValues(openpgp.util.str_to_Uint8Array("")); +// openpgp.crypto.random.getSecureRandom(0, 1); -openpgp.crypto.signature.sign(openpgp.enums.hash.md5, openpgp.enums.publicKey.rsa_encrypt, mpis, mpis, ""); -openpgp.crypto.signature.verify(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, mpis, ""); +openpgp.crypto.signature.sign(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, new Uint8Array([0, 1]), new Uint8Array([0, 1])); +openpgp.crypto.signature.verify(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, mpis, new Uint8Array([0, 1]), new Uint8Array([0, 1])); openpgp.key.generate(keyoptions); openpgp.key.readArmored(""); @@ -178,18 +180,15 @@ openpgp.message.readArmored(""); openpgp.packet.fromStructuredClone({}); openpgp.packet.newPacketFromTag(""); -openpgp.util.bin2str([0, 1]); -openpgp.util.calc_checksum(""); -openpgp.util.decode_utf8(""); +openpgp.util.Uint8Array_to_str(new Uint8Array([1, 0])); +openpgp.util.decode_utf8(new Uint8Array([1, 0])); openpgp.util.encode_utf8(""); -openpgp.util.get_hashAlgorithmString(); openpgp.util.getWebCrypto(); -openpgp.util.hex2bin(""); -openpgp.util.hexidump(""); -openpgp.util.hexstrdump(""); +openpgp.util.hex_to_Uint8Array(""); +openpgp.util.print_debug_hexarray_dump(""); +openpgp.util.print_debug_hexstr_dump(""); openpgp.util.print_debug(""); openpgp.util.print_debug_hexstr_dump(""); -openpgp.util.shiftRight("", 1); -openpgp.util.str2bin(""); -openpgp.util.str2Uint8Array(""); -openpgp.util.Uint8Array2str(openpgp.util.str2Uint8Array("")); +openpgp.util.shiftRight(new Uint8Array([1, 0]), 1); +openpgp.util.str_to_Uint8Array(""); +openpgp.util.Uint8Array_to_str(openpgp.util.str_to_Uint8Array("")); diff --git a/types/openpgp/package.json b/types/openpgp/package.json index d27d838dc6..cda6cc6dc8 100644 --- a/types/openpgp/package.json +++ b/types/openpgp/package.json @@ -2,6 +2,10 @@ "private": true, "types": "index", "typesVersions": { - ">=3.2.0-0": { "*": ["ts3.2/*"] } + ">=3.2.0-0": { + "*": [ + "ts3.2/*" + ] + } } } diff --git a/types/openpgp/ts3.2/index.d.ts b/types/openpgp/ts3.2/index.d.ts index 428f785dbe..442a458ccd 100644 --- a/types/openpgp/ts3.2/index.d.ts +++ b/types/openpgp/ts3.2/index.d.ts @@ -1,858 +1,5233 @@ -// Type definitions for openpgp 4.0.1 -// Project: http://openpgpjs.org/ +// Type definitions for openpgp v4.4.10 +// Project: https://openpgpjs.org // Definitions by: Guillaume Lacasa // Errietta Kostala // Daniel Montesinos // Carlos Villavicencio // Eric Camellini +// SardineFIsh // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export as namespace openpgp; +import BN = require("bn.js") +import stream = require("stream") -export interface UserId { - name?: string, - email?: string, +export {} +type NodeStream = stream; +type Integer = number; +type Infinity = any; + +export namespace cleartext { + /** + * Class that represents an OpenPGP cleartext signed message. + * See {@link https://tools.ietf.org/html/rfc4880#section-7} + */ + class CleartextMessage { + /** + * @param text The cleartext of the signed message + * @param signature The detached signature or an empty signature for unsigned messages + */ + constructor(text: string, signature: signature.Signature); + + /** + * Returns the key IDs of the keys that signed the cleartext message + * @returns array of keyid objects + */ + getSigningKeyIds(): any[]; + + /** + * Sign the cleartext message + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature + * @param date (optional) The creation time of the signature that should be created + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new cleartext message with signed content + */ + sign(privateKeys: any[], signature: signature.Signature, date: Date, userIds: any[]): Promise; + + /** + * Sign the cleartext message + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature + * @param date (optional) The creation time of the signature that should be created + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new detached signature of message content + */ + signDetached(privateKeys: any[], signature: signature.Signature, date: Date, userIds: any[]): Promise; + + /** + * Verify signatures of cleartext signed message + * @param keys array of keys to verify signatures + * @param date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + verify(keys: any[], date: Date): Promise>; + + /** + * Verify signatures of cleartext signed message + * @param keys array of keys to verify signatures + * @param date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + verifyDetached(keys: any[], date: Date): Promise>; + + /** + * Get cleartext + * @returns cleartext of message + */ + getText(): string; + + /** + * Returns ASCII armored text of cleartext signed message + * @returns ASCII armor + */ + armor(): string | ReadableStream; + } + + /** + * reads an OpenPGP cleartext signed message and returns a CleartextMessage object + * @param armoredText text to be parsed + * @returns new cleartext message object + */ + function readArmored(armoredText: string | ReadableStream): CleartextMessage; + + /** + * Creates a new CleartextMessage object from text + * @param text + */ + function fromText(text: string): void; } -export interface SessionKey { - data: Uint8Array, - algorithm: string +/** + * @see module:config/config + */ +export namespace config { + var prefer_hash_algorithm: any; + + var encryption_cipher: any; + + var compression: any; + + var deflate_level: any; + + /** + * Use Authenticated Encryption with Additional Data (AEAD) protection for symmetric encryption. + * **NOT INTEROPERABLE WITH OTHER OPENPGP IMPLEMENTATIONS** + * **FUTURE OPENPGP.JS VERSIONS MAY BREAK COMPATIBILITY WHEN USING THIS OPTION** + */ + var aead_protect: any; + + /** + * Use Authenticated Encryption with Additional Data (AEAD) protection for symmetric encryption. + * 0 means we implement a variant of {@link https://tools.ietf.org/html/draft-ford-openpgp-format-00|this IETF draft}. + * 4 means we implement {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04|RFC4880bis-04}. + * Note that this determines how AEAD packets are parsed even when aead_protect is set to false + */ + var aead_protect_version: any; + + /** + * Default Authenticated Encryption with Additional Data (AEAD) encryption mode + * Only has an effect when aead_protect is set to true. + */ + var aead_mode: any; + + /** + * Chunk Size Byte for Authenticated Encryption with Additional Data (AEAD) mode + * Only has an effect when aead_protect is set to true. + * Must be an integer value from 0 to 56. + */ + var aead_chunk_size_byte: any; + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-3.7.1.3|RFC4880 3.7.1.3}: + * Iteration Count Byte for S2K (String to Key) + */ + var s2k_iteration_count_byte: any; + + /** + * Use integrity protection for symmetric encryption + */ + var integrity_protect: any; + + var ignore_mdc_error: any; + + var allow_unauthenticated_stream: any; + + var checksum_required: any; + + var rsa_blinding: any; + + /** + * Work-around for rare GPG decryption bug when encrypting with multiple passwords. + * **Slower and slightly less secure** + */ + var password_collision_check: any; + + var revocations_expire: any; + + var use_native: any; + + var min_bytes_for_web_crypto: any; + + var zero_copy: any; + + var debug: any; + + var tolerant: any; + + var show_version: any; + + var show_comment: any; + + var versionstring: any; + + var commentstring: any; + + var keyserver: any; + + var node_store: any; + + /** + * Max userid string length (used for parsing) + */ + var max_userid_length: any; + + namespace localStorage { + class LocalStorage { + /** + * This object is used for storing and retrieving configuration from HTML5 local storage. + */ + constructor(); + + /** + * Reads the config out of the HTML5 local storage + * and initializes the object config. + * if config is null the default config will be used + */ + read(): void; + + /** + * Writes the config to HTML5 local storage + */ + write(): void; + } + } } -export interface EncryptOptions { - message: message.Message - publicKeys?: key.Key | key.Key[], - privateKeys?: key.Key | key.Key[], - passwords?: string | string[], - sessionKey?: SessionKey, - compression?: enums.compression, - armor?: boolean, - streaming?: 'web' | 'node' | false - detached?: boolean, - signature?: Signature, - returnSessionKey?: boolean, - wildcard?: boolean, - date?: Date, - fromUserId?: UserId, - toUserId?: UserId, +export class LocalStorage { + /** + * This object is used for storing and retrieving configuration from HTML5 local storage. + */ + constructor(); + + /** + * Reads the config out of the HTML5 local storage + * and initializes the object config. + * if config is null the default config will be used + */ + read(): void; + + /** + * Writes the config to HTML5 local storage + */ + write(): void; } -export interface EncryptedMessage { - data?: string, - message?: message.Message, - signature?: string | ReadableStream | Signature // TODO add NodeStream - sessionKey?: SessionKey + + +/** + * @see module:crypto/crypto + * @see module:crypto/signature + * @see module:crypto/public_key + * @see module:crypto/cipher + * @see module:crypto/random + * @see module:crypto/hash + */ +export namespace crypto { + /** + * @see module:crypto/public_key/elliptic/ecdh + */ + namespace aes_kw { + /** + * AES key wrap + * @param key + * @param data + * @returns + */ + function wrap(key: string, data: string): Uint8Array; + + /** + * AES key unwrap + * @param key + * @param data + * @returns + * @throws + */ + function unwrap(key: string, data: string): Uint8Array; + } + + namespace cfb { + function encrypt(algo: any, key: any, plaintext: any, iv: any): any + function decrypt(algo: any, key: any, ciphertext: any, iv: any): Promise + } + + namespace cipher { + /** + * AES-128 encryption and decryption (ID 7) + * @param key 128-bit key + * @see + * @see + * @returns + */ + function aes128(key: string): object; + + /** + * AES-128 Block Cipher (ID 8) + * @param key 192-bit key + * @see + * @see + * @returns + */ + function aes192(key: string): object; + + /** + * AES-128 Block Cipher (ID 9) + * @param key 256-bit key + * @see + * @see + * @returns + */ + function aes256(key: string): object; + + /** + * Triple DES Block Cipher (ID 2) + * @param key 192-bit key + * @see + * @returns + */ + function tripledes(key: string): object; + + /** + * CAST-128 Block Cipher (ID 3) + * @param key 128-bit key + * @see + * @returns + */ + function cast5(key: string): object; + + /** + * Twofish Block Cipher (ID 10) + * @param key 256-bit key + * @see + * @returns + */ + function twofish(key: string): object; + + /** + * Blowfish Block Cipher (ID 4) + * @param key 128-bit key + * @see + * @returns + */ + function blowfish(key: string): object; + + /** + * Not implemented + * @throws + */ + function idea(): void; + } + + namespace cmac { + /** + * This implementation of CMAC is based on the description of OMAC in + * http://web.cs.ucdavis.edu/~rogaway/papers/eax.pdf. As per that + * document: + * We have made a small modification to the OMAC algorithm as it was + * originally presented, changing one of its two constants. + * Specifically, the constant 4 at line 85 was the constant 1/2 (the + * multiplicative inverse of 2) in the original definition of OMAC [14]. + * The OMAC authors indicate that they will promulgate this modification + * [15], which slightly simplifies implementations. + */ + const blockLength: any; + + /** + * xor `padding` into the end of `data`. This function implements "the + * operation xor→ [which] xors the shorter string into the end of longer + * one". Since data is always as least as long as padding, we can + * simplify the implementation. + * @param data + * @param padding + */ + function rightXorMut(data: Uint8Array, padding: Uint8Array): void; + } + + namespace crypto { + /** + * Encrypts data using specified algorithm and public key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} for public key algorithms. + * @param algo Public key algorithm + * @param pub_params Algorithm-specific public key parameters + * @param data Data to be encrypted as MPI + * @param fingerprint Recipient fingerprint + * @returns encrypted session key parameters + */ + function publicKeyEncrypt(algo: enums.publicKey, pub_params: Array, data: type.mpi.MPI, fingerprint: string): any[]; + + /** + * Decrypts data using specified algorithm and private key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} for public key algorithms. + * @param algo Public key algorithm + * @param key_params Algorithm-specific public, private key parameters + * @param data_params encrypted session key parameters + * @param fingerprint Recipient fingerprint + * @returns An MPI containing the decrypted data + */ + function publicKeyDecrypt(algo: enums.publicKey, key_params: Array, data_params: Array, fingerprint: string): type.mpi.MPI; + + /** + * Returns the types comprising the private key of an algorithm + * @param algo The public key algorithm + * @returns The array of types + */ + function getPrivKeyParamTypes(algo: string): any[]; + + /** + * Returns the types comprising the public key of an algorithm + * @param algo The public key algorithm + * @returns The array of types + */ + function getPubKeyParamTypes(algo: string): any[]; + + /** + * Returns the types comprising the encrypted session key of an algorithm + * @param algo The public key algorithm + * @returns The array of types + */ + function getEncSessionKeyParamTypes(algo: string): any[]; + + /** + * Generate algorithm-specific key parameters + * @param algo The public key algorithm + * @param bits Bit length for RSA keys + * @param oid Object identifier for ECC keys + * @returns The array of parameters + */ + function generateParams(algo: string, bits: Integer, oid: type.oid.OID): any[]; + + /** + * Generates a random byte prefix for the specified algorithm + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param algo Symmetric encryption algorithm + * @returns Random bytes with length equal to the block size of the cipher, plus the last two bytes repeated. + */ + function getPrefixRandom(algo: enums.symmetric): Uint8Array; + + /** + * Generating a session key for the specified symmetric algorithm + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param algo Symmetric encryption algorithm + * @returns Random bytes as a string to be used as a key + */ + function generateSessionKey(algo: enums.symmetric): Uint8Array; + } + + namespace eax { + /** + * Class to en/decrypt using EAX mode. + * @param cipher The symmetric cipher algorithm to use e.g. 'aes128' + * @param key The encryption key + */ + function EAX(cipher: string, key: Uint8Array): void; + + /** + * Encrypt plaintext input. + * @param plaintext The cleartext input to be encrypted + * @param nonce The nonce (16 bytes) + * @param adata Associated data to sign + * @returns The ciphertext output + */ + function encrypt(plaintext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + + /** + * Decrypt ciphertext input. + * @param ciphertext The ciphertext input to be decrypted + * @param nonce The nonce (16 bytes) + * @param adata Associated data to verify + * @returns The plaintext output + */ + function decrypt(ciphertext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + } + + namespace gcm { + /** + * Class to en/decrypt using GCM mode. + * @param cipher The symmetric cipher algorithm to use e.g. 'aes128' + * @param key The encryption key + */ + function GCM(cipher: string, key: Uint8Array): void; + } + + /** + * @see + * @see + */ + namespace hash { + /** + * @see module:md5 + */ + var md5: any; + + /** + * @see asmCrypto + */ + var sha1: any; + + /** + * @see hash.js + */ + var sha224: any; + + /** + * @see asmCrypto + */ + var sha256: any; + + /** + * @see hash.js + */ + var sha384: any; + + /** + * @see asmCrypto + */ + var sha512: any; + + /** + * @see hash.js + */ + var ripemd: any; + + /** + * Create a hash on the specified data using the specified algorithm + * @param algo Hash algorithm type (see {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4}) + * @param data Data to be hashed + * @returns hash value + */ + function digest(algo: enums.hash, data: Uint8Array): Promise; + + /** + * Returns the hash size in bytes of the specified hash algorithm type + * @param algo Hash algorithm type (See {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4}) + * @returns Size in bytes of the resulting hash + */ + function getHashByteLength(algo: enums.hash): Integer; + } + + /** + * @see module:packet.PublicKeyEncryptedSessionKey + */ + namespace pkcs5 { + /** + * Add pkcs5 padding to a text. + * @param msg Text to add padding + * @returns Text with padding added + */ + function encode(msg: string): string; + + /** + * Remove pkcs5 padding from a string. + * @param msg Text to remove padding from + * @returns Text with padding removed + */ + function decode(msg: string): string; + } + + namespace ocb { + /** + * Class to en/decrypt using OCB mode. + * @param cipher The symmetric cipher algorithm to use e.g. 'aes128' + * @param key The encryption key + */ + function OCB(cipher: string, key: Uint8Array): void; + + /** + * Encrypt plaintext input. + * @param plaintext The cleartext input to be encrypted + * @param nonce The nonce (15 bytes) + * @param adata Associated data to sign + * @returns The ciphertext output + */ + function encrypt(plaintext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + + /** + * Decrypt ciphertext input. + * @param ciphertext The ciphertext input to be decrypted + * @param nonce The nonce (15 bytes) + * @param adata Associated data to sign + * @returns The ciphertext output + */ + function decrypt(ciphertext: Uint8Array, nonce: Uint8Array, adata: Uint8Array): Promise; + } + + /** + * @see module:crypto/public_key/rsa + * @see module:crypto/public_key/elliptic/ecdh + * @see module:packet.PublicKeyEncryptedSessionKey + */ + namespace pkcs1 { + namespace eme { + /** + * Create a EME-PKCS1-v1_5 padded message + * @see + * @param M message to be encoded + * @param k the length in octets of the key modulus + * @returns EME-PKCS1 padded message + */ + function encode(M: string, k: Integer): Promise; + + /** + * Decode a EME-PKCS1-v1_5 padded message + * @see + * @param EM encoded message, an octet string + * @returns message, an octet string + */ + function decode(EM: string): string; + } + + namespace emsa { + /** + * Create a EMSA-PKCS1-v1_5 padded message + * @see + * @param algo Hash algorithm type used + * @param hashed message to be encoded + * @param emLen intended length in octets of the encoded message + * @returns encoded message + */ + function encode(algo: Integer, hashed: Uint8Array, emLen: Integer): string; + } + + /** + * ASN1 object identifiers for hashes + * @see + */ + const hash_headers: any; + } + + namespace public_key { + namespace dsa { + /** + * DSA Sign function + * @param hash_algo + * @param hashed + * @param g + * @param p + * @param q + * @param x + * @returns + */ + function sign(hash_algo: Integer, hashed: Uint8Array, g: BN, p: BN, q: BN, x: BN): object; + + /** + * DSA Verify function + * @param hash_algo + * @param r + * @param s + * @param hashed + * @param g + * @param p + * @param q + * @param y + * @returns BN + */ + function verify(hash_algo: Integer, r: BN, s: BN, hashed: Uint8Array, g: BN, p: BN, q: BN, y: BN): any; + } + + namespace elgamal { + /** + * ElGamal Encryption function + * @param m + * @param p + * @param g + * @param y + * @returns + */ + function encrypt(m: BN, p: BN, g: BN, y: BN): object; + + /** + * ElGamal Encryption function + * @param c1 + * @param c2 + * @param p + * @param x + * @returns BN + */ + function decrypt(c1: BN, c2: BN, p: BN, x: BN): any; + } + + /** + * @see module:crypto/public_key/elliptic/curve + * @see module:crypto/public_key/elliptic/ecdh + * @see module:crypto/public_key/elliptic/ecdsa + * @see module:crypto/public_key/elliptic/eddsa + */ + namespace elliptic { + namespace curve { + class Curve { + } + } + + namespace ecdh { + /** + * Generate ECDHE ephemeral key and secret from public key + * @param curve Elliptic curve object + * @param Q Recipient public key + * @returns Returns public part of ephemeral key and generated ephemeral secret + */ + function genPublicEphemeralKey(curve: curve.Curve, Q: Uint8Array): Promise<{ V: Uint8Array, S: BN }>; + + /** + * Encrypt and wrap a session key + * @param oid Elliptic curve object identifier + * @param cipher_algo Symmetric cipher to use + * @param hash_algo Hash algorithm to use + * @param m Value derived from session key (RFC 6637) + * @param Q Recipient public key + * @param fingerprint Recipient fingerprint + * @returns Returns public part of ephemeral key and encoded session key + */ + function encrypt(oid: type.oid.OID, cipher_algo: enums.symmetric, hash_algo: enums.hash, m: type.mpi.MPI, Q: Uint8Array, fingerprint: string): Promise<{ V: BN, C: BN }>; + + /** + * Generate ECDHE secret from private key and public part of ephemeral key + * @param curve Elliptic curve object + * @param V Public part of ephemeral key + * @param d Recipient private key + * @returns Generated ephemeral secret + */ + function genPrivateEphemeralKey(curve: curve.Curve, V: Uint8Array, d: Uint8Array): Promise; + + /** + * Decrypt and unwrap the value derived from session key + * @param oid Elliptic curve object identifier + * @param cipher_algo Symmetric cipher to use + * @param hash_algo Hash algorithm to use + * @param V Public part of ephemeral key + * @param C Encrypted and wrapped value derived from session key + * @param d Recipient private key + * @param fingerprint Recipient fingerprint + * @returns Value derived from session + */ + function decrypt(oid: type.oid.OID, cipher_algo: enums.symmetric, hash_algo: enums.hash, V: Uint8Array, C: Uint8Array, d: Uint8Array, fingerprint: string): Promise; + } + + namespace ecdsa { + /** + * Sign a message using the provided key + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used to sign + * @param m Message to sign + * @param d Private key used to sign the message + * @param hashed The hashed message + * @returns Signature of the message + */ + function sign(oid: type.oid.OID, hash_algo: enums.hash, m: Uint8Array, d: Uint8Array, hashed: Uint8Array): object; + + /** + * Verifies if a signature is valid for a message + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used in the signature + * @param signature Signature to verify + * @param m Message to verify + * @param Q Public key used to verify the message + * @param hashed The hashed message + * @returns + */ + function verify(oid: type.oid.OID, hash_algo: enums.hash, signature: object, m: Uint8Array, Q: Uint8Array, hashed: Uint8Array): boolean; + } + + namespace eddsa { + /** + * Sign a message using the provided keygit + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used to sign + * @param m Message to sign + * @param d Private key used to sign + * @param hashed The hashed message + * @returns Signature of the message + */ + function sign(oid: type.oid.OID, hash_algo: enums.hash, m: Uint8Array, d: Uint8Array, hashed: Uint8Array): object; + + /** + * Verifies if a signature is valid for a message + * @param oid Elliptic curve object identifier + * @param hash_algo Hash algorithm used in the signature + * @param signature Signature to verify the message + * @param m Message to verify + * @param Q Public key used to verify the message + * @param hashed The hashed message + * @returns + */ + function verify(oid: type.oid.OID, hash_algo: enums.hash, signature: object, m: Uint8Array, Q: Uint8Array, hashed: Uint8Array): boolean; + } + + namespace key { + class KeyPair { + } + } + } + + namespace prime { + /** + * Probabilistic random number generator + * @param bits Bit length of the prime + * @param e Optional RSA exponent to check against the prime + * @param k Optional number of iterations of Miller-Rabin test + * @returns BN + */ + function randomProbablePrime(bits: Integer, e: BN, k: Integer): any; + + /** + * Probabilistic primality testing + * @param n Number to test + * @param e Optional RSA exponent to check against the prime + * @param k Optional number of iterations of Miller-Rabin test + * @returns + */ + function isProbablePrime(n: BN, e: BN, k: Integer): boolean; + + /** + * Tests whether n is probably prime or not using Fermat's test with b = 2. + * Fails if b^(n-1) mod n === 1. + * @param n Number to test + * @param b Optional Fermat test base + * @returns + */ + function fermat(n: BN, b: Integer): boolean; + + /** + * Tests whether n is probably prime or not using the Miller-Rabin test. + * See HAC Remark 4.28. + * @param n Number to test + * @param k Optional number of iterations of Miller-Rabin test + * @param rand Optional function to generate potential witnesses + * @returns + */ + function millerRabin(n: BN, k: Integer, rand: Function): boolean; + } + + namespace rsa { + /** + * Create signature + * @param m message + * @param n RSA public modulus + * @param e RSA public exponent + * @param d RSA private exponent + * @returns RSA Signature + */ + function sign(m: BN, n: BN, e: BN, d: BN): BN; + + /** + * Verify signature + * @param s signature + * @param n RSA public modulus + * @param e RSA public exponent + * @returns + */ + function verify(s: BN, n: BN, e: BN): BN; + + /** + * Encrypt message + * @param m message + * @param n RSA public modulus + * @param e RSA public exponent + * @returns RSA Ciphertext + */ + function encrypt(m: BN, n: BN, e: BN): BN; + + /** + * Decrypt RSA message + * @param m message + * @param n RSA public modulus + * @param e RSA public exponent + * @param d RSA private exponent + * @param p RSA private prime p + * @param q RSA private prime q + * @param u RSA private inverse of prime q + * @returns RSA Plaintext + */ + function decrypt(m: BN, n: BN, e: BN, d: BN, p: BN, q: BN, u: BN): BN; + + /** + * Generate a new random private key B bits long with public exponent E. + * When possible, webCrypto is used. Otherwise, primes are generated using + * 40 rounds of the Miller-Rabin probabilistic random prime generation algorithm. + * @see module:crypto/public_key/prime + * @param B RSA bit length + * @param E RSA public exponent in hex string + * @returns RSA public modulus, RSA public exponent, RSA private exponent, + * RSA private prime p, RSA private prime q, u = q ** -1 mod p + */ + function generate(B: Integer, E: string): object; + } + } + + namespace random { + /** + * Retrieve secure random byte array of the specified length + * @param length Length in bytes to generate + * @returns Random byte array + */ + function getRandomBytes(length: Integer): Uint8Array; + + /** + * Create a secure random MPI that is greater than or equal to min and less than max. + * @param min Lower bound, included + * @param max Upper bound, excluded + * @returns Random MPI + */ + function getRandomBN(min: type.mpi.MPI, max: type.mpi.MPI): BN; + + /** + * Buffer for secure random numbers + */ + function RandomBuffer(): void; + } + + namespace signature { + /** + * Verifies the signature provided for data using specified algorithms and public key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} + * and {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4} + * for public key and hash algorithms. + * @param algo Public key algorithm + * @param hash_algo Hash algorithm + * @param msg_MPIs Algorithm-specific signature parameters + * @param pub_MPIs Algorithm-specific public key parameters + * @param data Data for which the signature was created + * @param hashed The hashed data + * @returns True if signature is valid + */ + function verify(algo: enums.publicKey, hash_algo: enums.hash, msg_MPIs: type.mpi.MPI[], pub_MPIs: type.mpi.MPI[], data: Uint8Array, hashed: Uint8Array): boolean; + + /** + * Creates a signature on data using specified algorithms and private key parameters. + * See {@link https://tools.ietf.org/html/rfc4880#section-9.1|RFC 4880 9.1} + * and {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC 4880 9.4} + * for public key and hash algorithms. + * @param algo Public key algorithm + * @param hash_algo Hash algorithm + * @param key_params Algorithm-specific public and private key parameters + * @param data Data to be signed + * @param hashed The hashed data + * @returns Signature + */ + function sign(algo: enums.publicKey, hash_algo: enums.hash, key_params: type.mpi.MPI[], data: Uint8Array, hashed: Uint8Array): Uint8Array; + } } -export interface DecryptOptions { - message: message.Message, - privateKeys?: key.Key | key.Key[], - passwords?: string | string[], - sessionKeys?: SessionKey | SessionKey[], - publicKeys?: key.Key | key.Key[], - format?: string, - streaming?: 'web' | 'node' | false, - signature?: Signature, - date?: Date, +export namespace eme { + /** + * Create a EME-PKCS1-v1_5 padded message + * @see + * @param M message to be encoded + * @param k the length in octets of the key modulus + * @returns EME-PKCS1 padded message + */ + function encode(M: string, k: Integer): Promise; + + /** + * Decode a EME-PKCS1-v1_5 padded message + * @see + * @param EM encoded message, an octet string + * @returns message, an octet string + */ + function decode(EM: string): string; } -export interface SignOptions { - message: message.Message, - privateKeys?: key.Key | key.Key[], - armor?: boolean, - streaming?: 'web' | 'node' | false, - detached?: boolean - date?: Date, - fromUserIds?: UserId[] +export namespace emsa { + /** + * Create a EMSA-PKCS1-v1_5 padded message + * @see + * @param algo Hash algorithm type used + * @param hashed message to be encoded + * @param emLen intended length in octets of the encoded message + * @returns encoded message + */ + function encode(algo: Integer, hashed: Uint8Array, emLen: Integer): string; } -export interface SignedMessage { - signature?: string | ReadableStream | Signature, // TODO add NodeStream - data?: string | ReadableStream, // TODO add NodeStream - message?: message.Message +export namespace encoding { + namespace armor { + /** + * Add additional information to the armor version of an OpenPGP binary + * packet block. + * @author Alex + * @version 2011-12-16 + * @param customComment (optional) additional comment to add to the armored string + * @returns The header information + */ + function addheader(customComment: string): string; + + /** + * Calculates a checksum over the given data and returns it base64 encoded + * @param data Data to create a CRC-24 checksum for + * @returns Base64 encoded checksum + */ + function getCheckSum(data: string | ReadableStream): string | ReadableStream; + + /** + * Internal function to calculate a CRC-24 checksum over a given string (data) + * @param data Data to create a CRC-24 checksum for + * @returns The CRC-24 checksum + */ + function createcrc24(data: string | ReadableStream): Uint8Array | ReadableStream; + + /** + * Splits a message into two parts, the body and the checksum. This is an internal function + * @param text OpenPGP armored message part + * @returns An object with attribute "body" containing the body + * and an attribute "checksum" containing the checksum. + */ + function splitChecksum(text: string): object; + + /** + * DeArmor an OpenPGP armored message; verify the checksum and return + * the encoded bytes + * @param text OpenPGP armored message + * @returns An object with attribute "text" containing the message text, + * an attribute "data" containing a stream of bytes and "type" for the ASCII armor type + */ + function dearmor(text: string): Promise; + + /** + * Armor an OpenPGP binary packet block + * @param messagetype type of the message + * @param body + * @param partindex + * @param parttotal + * @param customComment (optional) additional comment to add to the armored string + * @returns Armored text + */ + function armor(messagetype: Integer, body: any, partindex: Integer, parttotal: Integer, customComment?: string): string | ReadableStream; + } + + namespace base64 { + /** + * Convert binary array to radix-64 + * @param t Uint8Array to convert + * @param u if true, output is URL-safe + * @returns radix-64 version of input string + */ + function s2r(t: Uint8Array | ReadableStream, u?: boolean): string | ReadableStream; + + /** + * Convert radix-64 to binary array + * @param t radix-64 string to convert + * @param u if true, input is interpreted as URL-safe + * @returns binary array version of input string + */ + function r2s(t: string | ReadableStream, u: boolean): Uint8Array | ReadableStream; + } } -export interface KeyContainer { - key: key.Key, +export namespace enums { + /** + * Maps curve names under various standards to one + * @see + */ + enum curve { + /** + * NIST P-256 Curve + */ + p256 = "p256", + "P-256" = "p256", + secp256r1 = "p256", + prime256v1 = "p256", + "1.2.840.10045.3.1.7" = "p256", + "2a8648ce3d030107" = "p256", + "2A8648CE3D030107" = "p256", + /** + * NIST P-384 Curve + */ + p384 = "p384", + "P-384" = "p384", + secp384r1 = "p384", + "1.3.132.0.34" = "p384", + "2b81040022" = "p384", + "2B81040022" = "p384", + /** + * NIST P-521 Curve + */ + p521 = "p521", + "P-521" = "p521", + secp521r1 = "p521", + "1.3.132.0.35" = "p521", + "2b81040023" = "p521", + "2B81040023" = "p521", + /** + * SECG SECP256k1 Curve + */ + secp256k1 = "secp256k1", + "1.3.132.0.10" = "secp256k1", + "2b8104000a" = "secp256k1", + "2B8104000A" = "secp256k1", + /** + * Ed25519 + */ + ED25519 = "ed25519", + ed25519 = "ed25519", + Ed25519 = "ed25519", + "1.3.6.1.4.1.11591.15.1" = "ed25519", + "2b06010401da470f01" = "ed25519", + "2B06010401DA470F01" = "ed25519", + /** + * Curve25519 + */ + X25519 = "curve25519", + cv25519 = "curve25519", + curve25519 = "curve25519", + Curve25519 = "curve25519", + "1.3.6.1.4.1.3029.1.5.1" = "curve25519", + "2b060104019755010501" = "curve25519", + "2B060104019755010501" = "curve25519", + /** + * BrainpoolP256r1 Curve + */ + brainpoolP256r1 = "brainpoolP256r1", + "1.3.36.3.3.2.8.1.1.7" = "brainpoolP256r1", + "2b2403030208010107" = "brainpoolP256r1", + "2B2403030208010107" = "brainpoolP256r1", + /** + * BrainpoolP384r1 Curve + */ + brainpoolP384r1 = "brainpoolP384r1", + "1.3.36.3.3.2.8.1.1.11" = "brainpoolP384r1", + "2b240303020801010b" = "brainpoolP384r1", + "2B240303020801010B" = "brainpoolP384r1", + /** + * BrainpoolP512r1 Curve + */ + brainpoolP512r1 = "brainpoolP512r1", + "1.3.36.3.3.2.8.1.1.13" = "brainpoolP512r1", + "2b240303020801010d" = "brainpoolP512r1", + "2B240303020801010D" = "brainpoolP512r1", + } + + /** + * A string to key specifier type + */ + enum s2k { + simple = 0, + salted = 1, + iterated = 3, + gnu = 101, + } + + /** + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-9.1|RFC4880bis-04, section 9.1} + */ + enum publicKey { + /** + * RSA (Encrypt or Sign) [HAC] + */ + rsa_encrypt_sign = 1, + /** + * RSA (Encrypt only) [HAC] + */ + rsa_encrypt = 2, + /** + * RSA (Sign only) [HAC] + */ + rsa_sign = 3, + /** + * Elgamal (Encrypt only) [ELGAMAL] [HAC] + */ + elgamal = 16, + /** + * DSA (Sign only) [FIPS186] [HAC] + */ + dsa = 17, + /** + * ECDH (Encrypt only) [RFC6637] + */ + ecdh = 18, + /** + * ECDSA (Sign only) [RFC6637] + */ + ecdsa = 19, + /** + * EdDSA (Sign only) + * [ {@link https://tools.ietf.org/html/draft-koch-eddsa-for-openpgp-04|Draft RFC}] + */ + eddsa = 22, + /** + * Reserved for AEDH + */ + aedh = 23, + /** + * Reserved for AEDSA + */ + aedsa = 24, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC4880, section 9.2} + */ + enum symmetric { + plaintext = 0, + /** + * Not implemented! + */ + idea = 1, + "3des" = 2, + tripledes = 2, + cast5 = 3, + blowfish = 4, + aes128 = 7, + aes192 = 8, + aes256 = 9, + twofish = 10, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-9.3|RFC4880, section 9.3} + */ + enum compression { + uncompressed = 0, + /** + * RFC1951 + */ + zip = 1, + /** + * RFC1950 + */ + zlib = 2, + bzip2 = 3, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-9.4|RFC4880, section 9.4} + */ + enum hash { + md5 = 1, + sha1 = 2, + ripemd = 3, + sha256 = 8, + sha384 = 9, + sha512 = 10, + sha224 = 11, + } + + /** + * A list of hash names as accepted by webCrypto functions. + * {@link https://developer.mozilla.org/en-US/docs/Web/API/SubtleCrypto/digest|Parameters, algo} + */ + enum webHash { + "SHA-1" = 2, + "SHA-256" = 8, + "SHA-384" = 9, + "SHA-512" = 10, + } + + /** + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-9.6|RFC4880bis-04, section 9.6} + */ + enum aead { + eax = 1, + ocb = 2, + experimental_gcm = 100, + } + + /** + * A list of packet types and numeric tags associated with them. + */ + enum packet { + publicKeyEncryptedSessionKey = 1, + signature = 2, + symEncryptedSessionKey = 3, + onePassSignature = 4, + secretKey = 5, + publicKey = 6, + secretSubkey = 7, + compressed = 8, + symmetricallyEncrypted = 9, + marker = 10, + literal = 11, + trust = 12, + userid = 13, + publicSubkey = 14, + userAttribute = 17, + symEncryptedIntegrityProtected = 18, + modificationDetectionCode = 19, + symEncryptedAEADProtected = 20, + } + + /** + * Data types in the literal packet + */ + enum literal { + /** + * Binary data 'b' + */ + binary = "", + /** + * Text data 't' + */ + text = "", + /** + * Utf8 data 'u' + */ + utf8 = "", + /** + * MIME message body part 'm' + */ + mime = "", + } + + /** + * One pass signature packet type + */ + enum signature { + /** + * 0x00: Signature of a binary document. + */ + binary = 0, + /** + * 0x01: Signature of a canonical text document. + * Canonicalyzing the document by converting line endings. + */ + text = 1, + /** + * 0x02: Standalone signature. + * This signature is a signature of only its own subpacket contents. + * It is calculated identically to a signature over a zero-lengh + * binary document. Note that it doesn't make sense to have a V3 + * standalone signature. + */ + standalone = 2, + /** + * 0x10: Generic certification of a User ID and Public-Key packet. + * The issuer of this certification does not make any particular + * assertion as to how well the certifier has checked that the owner + * of the key is in fact the person described by the User ID. + */ + cert_generic = 16, + /** + * 0x11: Persona certification of a User ID and Public-Key packet. + * The issuer of this certification has not done any verification of + * the claim that the owner of this key is the User ID specified. + */ + cert_persona = 17, + /** + * 0x12: Casual certification of a User ID and Public-Key packet. + * The issuer of this certification has done some casual + * verification of the claim of identity. + */ + cert_casual = 18, + /** + * 0x13: Positive certification of a User ID and Public-Key packet. + * The issuer of this certification has done substantial + * verification of the claim of identity. + * Most OpenPGP implementations make their "key signatures" as 0x10 + * certifications. Some implementations can issue 0x11-0x13 + * certifications, but few differentiate between the types. + */ + cert_positive = 19, + /** + * 0x30: Certification revocation signature + * This signature revokes an earlier User ID certification signature + * (signature class 0x10 through 0x13) or direct-key signature + * (0x1F). It should be issued by the same key that issued the + * revoked signature or an authorized revocation key. The signature + * is computed over the same data as the certificate that it + * revokes, and should have a later creation date than that + * certificate. + */ + cert_revocation = 48, + /** + * 0x18: Subkey Binding Signature + * This signature is a statement by the top-level signing key that + * indicates that it owns the subkey. This signature is calculated + * directly on the primary key and subkey, and not on any User ID or + * other packets. A signature that binds a signing subkey MUST have + * an Embedded Signature subpacket in this binding signature that + * contains a 0x19 signature made by the signing subkey on the + * primary key and subkey. + */ + subkey_binding = 24, + /** + * 0x19: Primary Key Binding Signature + * This signature is a statement by a signing subkey, indicating + * that it is owned by the primary key and subkey. This signature + * is calculated the same way as a 0x18 signature: directly on the + * primary key and subkey, and not on any User ID or other packets. + * When a signature is made over a key, the hash data starts with the + * octet 0x99, followed by a two-octet length of the key, and then body + * of the key packet. (Note that this is an old-style packet header for + * a key packet with two-octet length.) A subkey binding signature + * (type 0x18) or primary key binding signature (type 0x19) then hashes + * the subkey using the same format as the main key (also using 0x99 as + * the first octet). + */ + key_binding = 25, + /** + * 0x1F: Signature directly on a key + * This signature is calculated directly on a key. It binds the + * information in the Signature subpackets to the key, and is + * appropriate to be used for subpackets that provide information + * about the key, such as the Revocation Key subpacket. It is also + * appropriate for statements that non-self certifiers want to make + * about the key itself, rather than the binding between a key and a + * name. + */ + key = 31, + /** + * 0x20: Key revocation signature + * The signature is calculated directly on the key being revoked. A + * revoked key is not to be used. Only revocation signatures by the + * key being revoked, or by an authorized revocation key, should be + * considered valid revocation signatures.a + */ + key_revocation = 32, + /** + * 0x28: Subkey revocation signature + * The signature is calculated directly on the subkey being revoked. + * A revoked subkey is not to be used. Only revocation signatures + * by the top-level signature key that is bound to this subkey, or + * by an authorized revocation key, should be considered valid + * revocation signatures. + * Key revocation signatures (types 0x20 and 0x28) + * hash only the key being revoked. + */ + subkey_revocation = 40, + /** + * 0x40: Timestamp signature. + * This signature is only meaningful for the timestamp contained in + * it. + */ + timestamp = 64, + /** + * 0x50: Third-Party Confirmation signature. + * This signature is a signature over some other OpenPGP Signature + * packet(s). It is analogous to a notary seal on the signed data. + * A third-party signature SHOULD include Signature Target + * subpacket(s) to give easy identification. Note that we really do + * mean SHOULD. There are plausible uses for this (such as a blind + * party that only sees the signature, not the key or source + * document) that cannot include a target subpacket. + */ + third_party = 80, + } + + /** + * Signature subpacket type + */ + enum signatureSubpacket { + signature_creation_time = 2, + signature_expiration_time = 3, + exportable_certification = 4, + trust_signature = 5, + regular_expression = 6, + revocable = 7, + key_expiration_time = 9, + placeholder_backwards_compatibility = 10, + preferred_symmetric_algorithms = 11, + revocation_key = 12, + issuer = 16, + notation_data = 20, + preferred_hash_algorithms = 21, + preferred_compression_algorithms = 22, + key_server_preferences = 23, + preferred_key_server = 24, + primary_user_id = 25, + policy_uri = 26, + key_flags = 27, + signers_user_id = 28, + reason_for_revocation = 29, + features = 30, + signature_target = 31, + embedded_signature = 32, + issuer_fingerprint = 33, + preferred_aead_algorithms = 34, + } + + /** + * Key flags + */ + enum keyFlags { + /** + * 0x01 - This key may be used to certify other keys. + */ + certify_keys = 1, + /** + * 0x02 - This key may be used to sign data. + */ + sign_data = 2, + /** + * 0x04 - This key may be used to encrypt communications. + */ + encrypt_communication = 4, + /** + * 0x08 - This key may be used to encrypt storage. + */ + encrypt_storage = 8, + /** + * 0x10 - The private component of this key may have been split + * by a secret-sharing mechanism. + */ + split_private_key = 16, + /** + * 0x20 - This key may be used for authentication. + */ + authentication = 32, + /** + * 0x80 - The private component of this key may be in the + * possession of more than one person. + */ + shared_private_key = 128, + } + + /** + * Key status + */ + enum keyStatus { + invalid = 0, + expired = 1, + revoked = 2, + valid = 3, + no_self_cert = 4, + } + + /** + * Armor type + */ + enum armor { + multipart_section = 0, + multipart_last = 1, + signed = 2, + message = 3, + public_key = 4, + private_key = 5, + signature = 6, + } + + /** + * {@link https://tools.ietf.org/html/rfc4880#section-5.2.3.23|RFC4880, section 5.2.3.23} + */ + enum reasonForRevocation { + /** + * No reason specified (key revocations or cert revocations) + */ + no_reason = 0, + /** + * Key is superseded (key revocations) + */ + key_superseded = 1, + /** + * Key material has been comPromised (key revocations) + */ + key_comPromised = 2, + /** + * Key is retired and no longer used (key revocations) + */ + key_retired = 3, + /** + * User ID information is no longer valid (cert revocations) + */ + userid_invalid = 32, + } + + /** + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-5.2.3.25|RFC4880bis-04, section 5.2.3.25} + */ + enum features { + /** + * 0x01 - Modification Detection (packets 18 and 19) + */ + modification_detection = 1, + /** + * 0x02 - AEAD Encrypted Data Packet (packet 20) and version 5 + * Symmetric-Key Encrypted Session Key Packets (packet 3) + */ + aead = 2, + /** + * 0x04 - Version 5 Public-Key Packet format and corresponding new + * fingerprint format + */ + v5_keys = 4, + } + + /** + * Asserts validity and converts from string/integer to integer. + */ + function write(): void; + + /** + * Converts from an integer to string. + */ + function read(): void; } -export interface KeyPair extends KeyContainer { - privateKeyArmored: string, - publicKeyArmored: string, - revocationCertificate: string +export namespace hkp { + class HKP { + /** + * Initialize the HKP client and configure it with the key server url and fetch function. + * @param keyServerBaseUrl (optional) The HKP key server base url including + * the protocol to use, e.g. 'https://pgp.mit.edu'; defaults to + * openpgp.config.keyserver (https://keyserver.ubuntu.com) + */ + constructor(keyServerBaseUrl: string); + + /** + * Search for a public key on the key server either by key ID or part of the user ID. + * @param options.keyID The long public key ID. + * @param options.query This can be any part of the key user ID such as name + * or email address. + * @returns The ascii armored public key. + */ + lookup(): Promise; + + /** + * Upload a public key to the server. + * @param publicKeyArmored An ascii armored public key to be uploaded. + * @returns + */ + upload(publicKeyArmored: string): Promise; + } } -export interface KeyOptions { - userIds?: UserId[], - passphrase?: string, - numBits?: number, - keyExpirationTime?: number, - curve?: string, - date?: Date, - subkeys?: KeyOptions[] +export class HKP { + /** + * Initialize the HKP client and configure it with the key server url and fetch function. + * @param keyServerBaseUrl (optional) The HKP key server base url including + * the protocol to use, e.g. 'https://pgp.mit.edu'; defaults to + * openpgp.config.keyserver (https://keyserver.ubuntu.com) + */ + constructor(keyServerBaseUrl: string); + + /** + * Search for a public key on the key server either by key ID or part of the user ID. + * @param options.keyID The long public key ID. + * @param options.query This can be any part of the key user ID such as name + * or email address. + * @returns The ascii armored public key. + */ + lookup(): Promise; + + /** + * Upload a public key to the server. + * @param publicKeyArmored An ascii armored public key to be uploaded. + * @returns + */ + upload(publicKeyArmored: string): Promise; } -export interface Keyid { - bytes: string, +export namespace key { + /** + * Class that represents an OpenPGP key. Must contain a primary key. + * Can contain additional subkeys, signatures, user ids, user attributes. + */ + class Key { + /** + * @param packetlist The packets that form this key + */ + constructor(packetlist: packet.List); + + /** + * Transforms packetlist to structured key data + * @param packetlist The packets that form a key + */ + packetlist2structure(packetlist: packet.List): void; + + /** + * Transforms structured key data to packetlist + * @returns The packets that form a key + */ + toPacketlist(): packet.List; + + /** + * Returns an array containing all public or private subkeys matching keyId; + * If keyId is not present, returns all subkeys. + * @param keyId + * @returns + */ + getSubkeys(keyId: type.keyid.Keyid): any[]; + + /** + * Returns an array containing all public or private keys matching keyId. + * If keyId is not present, returns all keys starting with the primary key. + * @param keyId + * @returns + */ + getKeys(keyId: type.keyid.Keyid): any[]; + + /** + * Returns key IDs of all keys + * @returns + */ + getKeyIds(): any[]; + + /** + * Returns userids + * @returns array of userids + */ + getUserIds(): any[]; + + /** + * Returns true if this is a public key + * @returns + */ + isPublic(): boolean; + + /** + * Returns true if this is a private key + * @returns + */ + isPrivate(): boolean; + + /** + * Returns key as public key (shallow copy) + * @returns new public Key + */ + toPublic(): Key; + + /** + * Returns ASCII armored text of key + * @returns ASCII armor + */ + armor(): ReadableStream; + + /** + * Returns last created key or key by given keyId that is available for signing and verification + * @param keyId, optional + * @param date (optional) use the given date for verification instead of the current time + * @param userId, optional user ID + * @returns key or null if no signing key has been found + */ + getSigningKey(keyId: type.keyid.Keyid, date?: Date, userId?: object): Promise; + + /** + * Returns last created key or key by given keyId that is available for encryption or decryption + * @param keyId, optional + * @param date, optional + * @param userId, optional + * @returns key or null if no encryption key has been found + */ + getEncryptionKey(keyId?: type.keyid.Keyid, date?: Date, userId?: string): Promise; + + /** + * Encrypts all secret key and subkey packets matching keyId + * @param passphrases - if multiple passphrases, then should be in same order as packets each should encrypt + * @param keyId + * @returns + */ + encrypt(passphrases: string | any[], keyId?: type.keyid.Keyid): Promise>; + + /** + * Decrypts all secret key and subkey packets matching keyId + * @param passphrases + * @param keyId + * @returns true if all matching key and subkey packets decrypted successfully + */ + decrypt(passphrases: string | string[], keyId?: type.keyid.Keyid): Promise; + + /** + * Checks if a signature on a key is revoked + * @param + * @param signature The signature to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the certificate is revoked + */ + isRevoked(signature: packet.Signature, key?: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date?: Date): Promise; + + /** + * Verify primary key. Checks for revocation signatures, expiration time + * and valid self signature + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID + * @returns The status of the primary key + */ + verifyPrimaryKey(date?: Date, userId?: object): Promise; + + /** + * Returns the latest date when the key can be used for encrypting, signing, or both, depending on the `capabilities` paramater. + * When `capabilities` is null, defaults to returning the expiry date of the primary key. + * Returns null if `capabilities` is passed and the key does not have the specified capabilities or is revoked or invalid. + * Returns Infinity if the key doesn't expire. + * @param {encrypt | sign | encrypt_sign} capabilities, optional + * @param keyId, optional + * @param userId, optional user ID + * @returns + */ + getExpirationTime(capabilities: any, keyId: type.keyid.Keyid, userId: object): Promise; + + /** + * Returns primary user and most significant (latest valid) self signature + * - if multiple primary users exist, returns the one with the latest self signature + * - otherwise, returns the user with the latest self signature + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID to get instead of the primary user, if it exists + * @returns The primary user and the self signature + */ + getPrimaryUser(date: Date, userId: object): Promise<{ user: User, selfCertification: packet.Signature }>; + + /** + * Update key with new components from specified key with same key ID: + * users, subkeys, certificates are merged into the destination key, + * duplicates and expired signatures are ignored. + * If the specified key is a private key and the destination key is public, + * the destination key is transformed to a private key. + * @param key Source key to merge + * @returns + */ + update(key: Key): Promise; + + /** + * Revokes the key + * @param reasonForRevocation optional, object indicating the reason for revocation + * @param reasonForRevocation.flag optional, flag indicating the reason for revocation + * @param reasonForRevocation.string optional, string explaining the reason for revocation + * @param date optional, override the creationtime of the revocation signature + * @returns new key with revocation signature + */ + revoke(reasonForRevocation: revoke_reasonForRevocation, date: Date): Promise; + + /** + * Get revocation certificate from a revoked key. + * (To get a revocation certificate for an unrevoked key, call revoke() first.) + * @returns armored revocation certificate + */ + getRevocationCertificate(): Promise; + + /** + * Applies a revocation certificate to a key + * This adds the first signature packet in the armored text to the key, + * if it is a valid revocation signature. + * @param revocationCertificate armored revocation certificate + * @returns new revoked key + */ + applyRevocationCertificate(revocationCertificate: string): Promise; + + /** + * Signs primary user of key + * @param privateKey decrypted private keys for signing + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID to get instead of the primary user, if it exists + * @returns new public key with new certificate signature + */ + signPrimaryUser(privateKey: any[], date: Date, userId: object): Promise; + + /** + * Signs all users of key + * @param privateKeys decrypted private keys for signing + * @returns new public key with new certificate signature + */ + signAllUsers(privateKeys: any[]): Promise; + + /** + * Verifies primary user of key + * - if no arguments are given, verifies the self certificates; + * - otherwise, verifies all certificates signed with given keys. + * @param keys array of keys to verify certificate signatures + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID to get instead of the primary user, if it exists + * @returns List of signer's keyid and validity of signature + */ + verifyPrimaryUser(keys: any[], date: Date, userId: object): Promise>; + + /** + * Verifies all users of key + * - if no arguments are given, verifies the self certificates; + * - otherwise, verifies all certificates signed with given keys. + * @param keys array of keys to verify certificate signatures + * @returns list of userid, signer's keyid and validity of signature + */ + verifyAllUsers(keys: any[]): Promise>; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + } + + /** + * Returns the valid and non-expired signature that has the latest creation date, while ignoring signatures created in the future. + * @param signatures List of signatures + * @param date Use the given date instead of the current time + * @returns The latest valid signature + */ + function getLatestValidSignature(signatures: any[], date: Date): Promise; + + /** + * Class that represents an user ID or attribute packet and the relevant signatures. + */ + class User { + constructor(); + + /** + * Transforms structured user data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Signs user + * @param primaryKey The primary key packet + * @param privateKeys Decrypted private keys for signing + * @returns New user with new certificate signatures + */ + sign(primaryKey: packet.SecretKey | packet.PublicKey, privateKeys: any[]): Promise; + + /** + * Checks if a given certificate of the user is revoked + * @param primaryKey The primary key packet + * @param certificate The certificate to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the certificate is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verifies the user certificate + * @param primaryKey The primary key packet + * @param certificate A certificate of this user + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns status of the certificate + */ + verifyCertificate(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, keys: any[], date: Date): Promise; + + /** + * Verifies all user certificates + * @param primaryKey The primary key packet + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns List of signer's keyid and validity of signature + */ + verifyAllCertifications(primaryKey: packet.SecretKey | packet.PublicKey, keys: any[], date: Date): Promise>; + + /** + * Verify User. Checks for existence of self signatures, revocation signatures + * and validity of self signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns Status of user + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update user with new components from specified user + * @param user Source user to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(user: User, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; + } + + /** + * Create signature packet + * @param dataToSign Contains packets to be signed + * @param signingKeyPacket secret key packet for signing + * @param signatureProperties (optional) properties to write on the signature packet before signing + * @param date (optional) override the creationtime of the signature + * @param userId (optional) user ID + * @returns signature packet + */ + function createSignaturePacket(dataToSign: object, signingKeyPacket: packet.SecretKey | packet.SecretSubkey, signatureProperties: object, date: Date, userId: object): packet.Signature; + + /** + * Class that represents a subkey packet and the relevant signatures. + */ + class SubKey { + constructor(); + + /** + * Transforms structured subkey data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Checks if a binding signature of a subkey is revoked + * @param primaryKey The primary key packet + * @param signature The binding signature to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the binding signature is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, signature: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verify subkey. Checks for revocation signatures, expiration time + * and valid binding signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns The status of the subkey + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Returns the expiration time of the subkey or Infinity if key does not expire + * Returns null if the subkey is invalid. + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns + */ + getExpirationTime(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update subkey with new components from specified subkey + * @param subKey Source subkey to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(subKey: SubKey, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; + + /** + * Revokes the subkey + * @param primaryKey decrypted private primary key for revocation + * @param reasonForRevocation optional, object indicating the reason for revocation + * @param reasonForRevocation.flag optional, flag indicating the reason for revocation + * @param reasonForRevocation.string optional, string explaining the reason for revocation + * @param date optional, override the creationtime of the revocation signature + * @returns new subkey with revocation signature + */ + revoke(primaryKey: packet.SecretKey, reasonForRevocation: revoke_reasonForRevocation, date: Date): Promise; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + } + + /** + * Reads an unarmored OpenPGP key list and returns one or multiple key objects + * @param data to be parsed + * @returns result object with key and error arrays + */ + function read(data: Uint8Array): Promise<{ keys: Array, err: Array | null }>; + + interface KeyResult { keys: Array, err: Array | null } + + /** + * Reads an OpenPGP armored text and returns one or multiple key objects + * @param armoredText text to be parsed + * @returns result object with key and error arrays + */ + function readArmored(armoredText: string | ReadableStream): Promise; + + /** + * Generates a new OpenPGP key. Supports RSA and ECC keys. + * Primary and subkey will be of same type. + * @param options.keyType To indicate what type of key to make. + * RSA is 1. See {@link https://tools.ietf.org/html/rfc4880#section-9.1} + * @param options.numBits number of bits for the key creation. + * @param options.userIds Assumes already in form of "User Name " + * If array is used, the first userId is set as primary user Id + * @param options.passphrase The passphrase used to encrypt the resulting private key + * @param options.keyExpirationTime The number of seconds after the key creation time that the key expires + * @param curve (optional) elliptic curve for ECC keys + * @param date Override the creation date of the key and the key signatures + * @param subkeys (optional) options for each subkey, default to main key options. e.g. [ {sign: true, passphrase: '123'}] + * sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt + * @returns + */ + function generate(options: KeyOptions): Promise; + + /** + * Reformats and signs an OpenPGP key with a given User ID. Currently only supports RSA keys. + * @param options.privateKey The private key to reformat + * @param options.keyType + * @param options.userIds Assumes already in form of "User Name " + * If array is used, the first userId is set as primary user Id + * @param options.passphrase The passphrase used to encrypt the resulting private key + * @param options.keyExpirationTime The number of seconds after the key creation time that the key expires + * @param date Override the creation date of the key and the key signatures + * @param subkeys (optional) options for each subkey, default to main key options. e.g. [ {sign: true, passphrase: '123'}] + * @returns + */ + function reformat(date: Date, subkeys: any[]): Promise; + + /** + * Checks if a given certificate or binding signature is revoked + * @param primaryKey The primary key packet + * @param dataToVerify The data to check + * @param revocations The revocation signatures to check + * @param signature The certificate or signature to check + * @param key, optional The key packet to check the signature + * @param date Use the given date instead of the current time + * @returns True if the signature revokes the data + */ + function isDataRevoked(primaryKey: packet.SecretKey | packet.PublicKey, dataToVerify: object, revocations: any[], signature: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Check if signature has revocation key sub packet (not supported by OpenPGP.js) + * and throw error if found + * @param signature The certificate or signature to check + * @param keyId Check only certificates or signatures from a certain issuer key ID + */ + function checkRevocationKey(signature: packet.Signature, keyId: type.keyid.Keyid): void; + + /** + * Returns the preferred signature hash algorithm of a key + * @param key (optional) the key to get preferences from + * @param keyPacket key packet used for signing + * @param date (optional) use the given date for verification instead of the current time + * @param userId (optional) user ID + * @returns + */ + function getPreferredHashAlgo(key: Key, keyPacket: packet.SecretKey | packet.SecretSubkey, date: Date, userId: object): Promise; + + /** + * Returns the preferred symmetric/aead algorithm for a set of keys + * @param {symmetric | aead} type Type of preference to return + * @param keys Set of keys + * @param date (optional) use the given date for verification instead of the current time + * @param userIds (optional) user IDs + * @returns Preferred symmetric algorithm + */ + function getPreferredAlgo(type: any, keys: any[], date: Date, userIds: any[]): Promise; + + /** + * Returns whether aead is supported by all keys in the set + * @param keys Set of keys + * @param date (optional) use the given date for verification instead of the current time + * @param userIds (optional) user IDs + * @returns + */ + function isAeadSupported(keys: any[], date: Date, userIds: any[]): Promise; } -export interface Signature { - keyid: Keyid, - valid: boolean, - verified?: boolean +export interface revoke_reasonForRevocation { + /** + * optional, flag indicating the reason for revocation + */ + flag: enums.reasonForRevocation; + /** + * optional, string explaining the reason for revocation + */ + string: string; } -export interface VerifyOptions { - message: message.Message, - publicKeys: key.Key | key.Key[], - streaming?: 'web' | 'node' | false, - signature?: Signature, - date?: Date +/** + * Class that represents an user ID or attribute packet and the relevant signatures. + */ +export class User { + constructor(); + + /** + * Transforms structured user data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Signs user + * @param primaryKey The primary key packet + * @param privateKeys Decrypted private keys for signing + * @returns New user with new certificate signatures + */ + sign(primaryKey: packet.SecretKey | packet.PublicKey, privateKeys: any[]): Promise; + + /** + * Checks if a given certificate of the user is revoked + * @param primaryKey The primary key packet + * @param certificate The certificate to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the certificate is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verifies the user certificate + * @param primaryKey The primary key packet + * @param certificate A certificate of this user + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns status of the certificate + */ + verifyCertificate(primaryKey: packet.SecretKey | packet.PublicKey, certificate: packet.Signature, keys: any[], date: Date): Promise; + + /** + * Verifies all user certificates + * @param primaryKey The primary key packet + * @param keys Array of keys to verify certificate signatures + * @param date Use the given date instead of the current time + * @returns List of signer's keyid and validity of signature + */ + verifyAllCertifications(primaryKey: packet.SecretKey | packet.PublicKey, keys: any[], date: Date): Promise>; + + /** + * Verify User. Checks for existence of self signatures, revocation signatures + * and validity of self signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns Status of user + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update user with new components from specified user + * @param user Source user to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(user: key.User, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; } -export interface VerifiedMessage { - data: Uint8Array | string | ReadableStream | ReadableStream, // TODO add NodeStream - signatures: Array, +/** + * Class that represents a subkey packet and the relevant signatures. + */ +export class SubKey { + constructor(); + + /** + * Transforms structured subkey data to packetlist + * @returns + */ + toPacketlist(): packet.List; + + /** + * Checks if a binding signature of a subkey is revoked + * @param primaryKey The primary key packet + * @param signature The binding signature to verify + * @param key, optional The key to verify the signature + * @param date Use the given date instead of the current time + * @returns True if the binding signature is revoked + */ + isRevoked(primaryKey: packet.SecretKey | packet.PublicKey, signature: packet.Signature, key: packet.PublicSubkey | packet.SecretSubkey | packet.PublicKey | packet.SecretKey, date: Date): Promise; + + /** + * Verify subkey. Checks for revocation signatures, expiration time + * and valid binding signature + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns The status of the subkey + */ + verify(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Returns the expiration time of the subkey or Infinity if key does not expire + * Returns null if the subkey is invalid. + * @param primaryKey The primary key packet + * @param date Use the given date instead of the current time + * @returns + */ + getExpirationTime(primaryKey: packet.SecretKey | packet.PublicKey, date: Date): Promise; + + /** + * Update subkey with new components from specified subkey + * @param subKey Source subkey to merge + * @param primaryKey primary key used for validation + * @returns + */ + update(subKey: key.SubKey, primaryKey: packet.SecretKey | packet.SecretSubkey): Promise; + + /** + * Revokes the subkey + * @param primaryKey decrypted private primary key for revocation + * @param reasonForRevocation optional, object indicating the reason for revocation + * @param reasonForRevocation.flag optional, flag indicating the reason for revocation + * @param reasonForRevocation.string optional, string explaining the reason for revocation + * @param date optional, override the creationtime of the revocation signature + * @returns new subkey with revocation signature + */ + revoke(primaryKey: packet.SecretKey, reasonForRevocation: revoke_reasonForRevocation, date: Date): Promise; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; } -export interface DecryptedMessage { - data: Uint8Array | string | ReadableStream | ReadableStream, // TODO add NodeStream - signatures: Array, - filename: string +/** + * @see module:keyring/keyring + * @see module:keyring/localstore + */ +export namespace keyring { + namespace keyring { + class Keyring { + /** + * Initialization routine for the keyring. + * @param storeHandler class implementing loadPublic(), loadPrivate(), storePublic(), and storePrivate() methods + */ + constructor(storeHandler?: localstore.LocalStore); + + /** + * Calls the storeHandler to load the keys + */ + load(): void; + + /** + * Calls the storeHandler to save the keys + */ + store(): void; + + /** + * Clear the keyring - erase all the keys + */ + clear(): void; + + /** + * Searches the keyring for keys having the specified key id + * @param keyId provided as string of lowercase hex number + * withouth 0x prefix (can be 16-character key ID or fingerprint) + * @param deep if true search also in subkeys + * @returns keys found or null + */ + getKeysForId(keyId: string, deep: boolean): any[] | null; + + /** + * Removes keys having the specified key id from the keyring + * @param keyId provided as string of lowercase hex number + * withouth 0x prefix (can be 16-character key ID or fingerprint) + * @returns keys found or null + */ + removeKeysForId(keyId: string): any[] | null; + + /** + * Get all public and private keys + * @returns all keys + */ + getAllKeys(): any[]; + } + + /** + * Array of keys + * @param keys The keys to store in this array + */ + function KeyArray(keys: any[]): void; + } + + namespace localstore { + class LocalStore { + /** + * The class that deals with storage of the keyring. + * Currently the only option is to use HTML5 local storage. + * @param prefix prefix for itemnames in localstore + */ + constructor(prefix: string); + + /** + * Load the public keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPublic(): any[]; + + /** + * Load the private keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPrivate(): any[]; + + /** + * Saves the current state of the public keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePublic(keys: any[]): void; + + /** + * Saves the current state of the private keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePrivate(keys: any[]): void; + } + } } -export interface OpenPGPWorker { - randomCallback(): void; - configure(config: any): void; - seedRandom(buffer: ArrayBuffer): void; - delegate(id: number, method: string, options: any): void; - response(event: any): void; +export class LocalStore { + /** + * The class that deals with storage of the keyring. + * Currently the only option is to use HTML5 local storage. + * @param prefix prefix for itemnames in localstore + */ + constructor(prefix: string); + + /** + * Load the public keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPublic(): any[]; + + /** + * Load the private keys from HTML5 local storage. + * @returns array of keys retrieved from localstore + */ + loadPrivate(): any[]; + + /** + * Saves the current state of the public keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePublic(keys: any[]): void; + + /** + * Saves the current state of the private keys to HTML5 local storage. + * The key array gets stringified using JSON + * @param keys array of keys to save in localstore + */ + storePrivate(keys: any[]): void; } -export interface WorkerOptions { - path?: string, - n?: number, - workers?: OpenPGPWorker[], - config?: any +export namespace message { + /** + * Class that represents an OpenPGP message. + * Can be an encrypted message, signed message, compressed message or literal message + */ + class Message { + packets: packet.List; + + /** + * @param packetlist The packets that form this message + * See {@link https://tools.ietf.org/html/rfc4880#section-11.3} + */ + constructor(packetlist: packet.List); + + /** + * Returns the key IDs of the keys to which the session key is encrypted + * @returns array of keyid objects + */ + getEncryptionKeyIds(): any[]; + + /** + * Returns the key IDs of the keys that signed the message + * @returns array of keyid objects + */ + getSigningKeyIds(): any[]; + + /** + * Decrypt the message. Either a private key, a session key, or a password must be specified. + * @param privateKeys (optional) private keys with decrypted secret data + * @param passwords (optional) passwords used to decrypt + * @param sessionKeys (optional) session keys in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } + * @param streaming (optional) whether to process data as a stream + * @returns new message with decrypted content + */ + decrypt(privateKeys?: any[], passwords?: any[], sessionKeys?: any[], streaming?: boolean): Promise; + + /** + * Decrypt encrypted session keys either with private keys or passwords. + * @param privateKeys (optional) private keys with decrypted secret data + * @param passwords (optional) passwords used to decrypt + * @returns array of object with potential sessionKey, algorithm pairs + */ + decryptSessionKeys(privateKeys?: any[], passwords?: any[]): Promise>; + + /** + * Get literal data that is the body of the message + * @returns literal body of the message as Uint8Array + */ + getLiteralData(): Uint8Array | null; + + /** + * Get filename from literal data packet + * @returns filename of literal data packet as string + */ + getFilename(): string | null; + + /** + * Get literal data as text + * @returns literal body of the message interpreted as text + */ + getText(): string | null; + + /** + * Encrypt the message either with public keys, passwords, or both at once. + * @param keys (optional) public key(s) for message encryption + * @param passwords (optional) password(s) for message encryption + * @param sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String, [aeadAlgorithm:String] } + * @param wildcard (optional) use a key ID of 0 instead of the public key IDs + * @param date (optional) override the creation date of the literal package + * @param userIds (optional) user IDs to encrypt for, e.g. [ { name:'Robert Receiver', email:'robert@openpgp.org' }] + * @param streaming (optional) whether to process data as a stream + * @returns new message with encrypted content + */ + encrypt(keys?: any[], passwords?: any[], sessionKey?: object, wildcard?: boolean, date?: Date, userIds?: any[], streaming?: boolean): Promise; + + /** + * Sign the message (the literal data packet of the message) + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature to add to the message + * @param date (optional) override the creation time of the signature + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new message with signed content + */ + sign(privateKeys: any[], signature?: signature.Signature, date?: Date, userIds?: any[]): Promise; + + /** + * Compresses the message (the literal and -if signed- signature data packets of the message) + * @param compression compression algorithm to be used + * @returns new message with compressed content + */ + compress(compression: enums.compression): Message; + + /** + * Create a detached signature for the message (the literal data packet of the message) + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature + * @param date (optional) override the creation time of the signature + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns new detached signature of message content + */ + signDetached(privateKeys: any[], signature?: signature.Signature, date?: Date, userIds?: any[]): Promise; + + /** + * Verify message signatures + * @param keys array of keys to verify signatures + * @param date (optional) Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @param streaming (optional) whether to process data as a stream + * @returns list of signer's keyid and validity of signature + */ + verify(keys: any[], date?: Date, streaming?: boolean): Promise>; + + /** + * Verify detached message signature + * @param keys array of keys to verify signatures + * @param signature + * @param date Verify the signature against the given date, i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + verifyDetached(keys: any[], signature: signature.Signature, date?: Date): Promise>; + + /** + * Unwrap compressed message + * @returns message Content of compressed message + */ + unwrapCompressed(): Message; + + /** + * Append signature to unencrypted message object + * @param detachedSignature The detached ASCII-armored or Uint8Array PGP signature + */ + appendSignature(detachedSignature: string | Uint8Array): void; + + /** + * Returns ASCII armored text of message + * @returns ASCII armor + */ + armor(): ReadableStream; + } + + /** + * Encrypt a session key either with public keys, passwords, or both at once. + * @param sessionKey session key for encryption + * @param symAlgo session key algorithm + * @param aeadAlgo (optional) aead algorithm, e.g. 'eax' or 'ocb' + * @param publicKeys (optional) public key(s) for message encryption + * @param passwords (optional) for message encryption + * @param wildcard (optional) use a key ID of 0 instead of the public key IDs + * @param date (optional) override the date + * @param userIds (optional) user IDs to encrypt for, e.g. [ { name:'Robert Receiver', email:'robert@openpgp.org' }] + * @returns new message with encrypted content + */ + function encryptSessionKey(sessionKey: Uint8Array, symAlgo: string, aeadAlgo: string, publicKeys: any[], passwords: any[], wildcard: boolean, date: Date, userIds: any[]): Promise; + + /** + * Create signature packets for the message + * @param literalDataPacket the literal data packet to sign + * @param privateKeys private keys with decrypted secret key data for signing + * @param signature (optional) any existing detached signature to append + * @param date (optional) override the creationtime of the signature + * @param userIds (optional) user IDs to sign with, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + * @returns list of signature packets + */ + function createSignaturePackets(literalDataPacket: packet.Literal, privateKeys: any[], signature: signature.Signature, date: Date, userIds: any[]): Promise; + + /** + * Create object containing signer's keyid and validity of signature + * @param signature signature packets + * @param literalDataList array of literal data packets + * @param keys array of keys to verify signatures + * @param date Verify the signature against the given date, + * i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + function createVerificationObject(signature: packet.Signature, literalDataList: any[], keys: any[], date: Date): Promise>; + + /** + * Create list of objects containing signer's keyid and validity of signature + * @param signatureList array of signature packets + * @param literalDataList array of literal data packets + * @param keys array of keys to verify signatures + * @param date Verify the signature against the given date, + * i.e. check signature creation time < date < expiration time + * @returns list of signer's keyid and validity of signature + */ + function createVerificationObjects(signatureList: any[], literalDataList: any[], keys: any[], date: Date): Promise>; + + /** + * reads an OpenPGP armored message and returns a message object + * @param armoredText text to be parsed + * @returns new message object + */ + function readArmored(armoredText: string | ReadableStream): Promise; + + /** + * reads an OpenPGP message as byte array and returns a message object + * @param input binary message + * @param fromStream whether the message was created from a Stream + * @returns new message object + */ + function read(input: Uint8Array | ReadableStream, fromStream?: boolean): Promise; + + /** + * creates new message object from text + * @param text + * @param filename (optional) + * @param date (optional) + * @param {utf8 | binary | text | mime} type (optional) data packet type + * @returns new message object + */ + function fromText(text: string | ReadableStream, filename?: string, date?: Date, type?: any): Message; + + /** + * creates new message object from binary data + * @param bytes + * @param filename (optional) + * @param date (optional) + * @param {utf8 | binary | text | mime} type (optional) data packet type + * @returns new message object + */ + function fromBinary(bytes: Uint8Array | ReadableStream, filename?: string, date?: Date, type?: any): Message; } -export class AsyncProxy { - constructor(options: WorkerOptions); - getId(): number; - seedRandom(workerId: number, size: number): Promise; - terminate(): void; - delegate(method: string, options: any): void; - - workers: OpenPGPWorker[]; +export interface revokeKey_reasonForRevocation { + /** + * (optional) flag indicating the reason for revocation + */ + flag: enums.reasonForRevocation; + /** + * (optional) string explaining the reason for revocation + */ + string: string; } +/** + * @see module:packet/all_packets + * @see module:packet/clone + * @see module:packet.List + */ +export namespace packet { + /** + * Allocate a new packet + * @param tag property name from {@link module:enums.packet} + * @returns new packet object with type based on tag + */ + function newPacketFromTag(tag: string): object; + + /** + * Allocate a new packet from structured packet clone + * @see + * @param packetClone packet clone + * @returns new packet object with data from packet clone + */ + function fromStructuredClone(packetClone: object): object; + + class Compressed { + /** + * Implementation of the Compressed Data Packet (Tag 8) + * {@link https://tools.ietf.org/html/rfc4880#section-5.6|RFC4880 5.6}: + * The Compressed Data packet contains compressed data. Typically, + * this packet is found as the contents of an encrypted packet, or following + * a Signature or One-Pass Signature packet, and contains a literal data packet. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * List of packets + */ + packets: List; + + /** + * Compression algorithm + * @type {compression} + */ + algorithm: any; + + /** + * Compressed packet data + */ + compressed: Uint8Array | ReadableStream; + + /** + * Parsing function for the packet. + * @param bytes Payload of a tag 8 packet + */ + read(bytes: Uint8Array | ReadableStream): void; + + /** + * Return the compressed packet. + * @returns binary compressed packet + */ + write(): Uint8Array | ReadableStream; + + /** + * Decompression method for decompressing the compressed data + * read by read_packet + */ + decompress(): void; + + /** + * Compress the packet data (member decompressedData) + */ + compress(): void; + } + + class Literal { + /** + * Implementation of the Literal Data Packet (Tag 11) + * {@link https://tools.ietf.org/html/rfc4880#section-5.9|RFC4880 5.9}: + * A Literal Data packet contains the body of a message; data that is not to be + * further interpreted. + * @param date the creation date of the literal package + */ + constructor(date: Date); + + /** + * Set the packet data to a javascript native string, end of line + * will be normalized to \r\n and by default text is converted to UTF8 + * @param text Any native javascript string + * @param {utf8 | binary | text | mime} format (optional) The format of the string of bytes + */ + setText(text: string | ReadableStream, format: any): void; + + /** + * Returns literal data packets as native JavaScript string + * with normalized end of line to \n + * @param clone (optional) Whether to return a clone so that getBytes/getText can be called again + * @returns literal data as text + */ + getText(clone: boolean): string | ReadableStream; + + /** + * Set the packet data to value represented by the provided string of bytes. + * @param bytes The string of bytes + * @param {utf8 | binary | text | mime} format The format of the string of bytes + */ + setBytes(bytes: Uint8Array | ReadableStream, format: any): void; + + /** + * Get the byte sequence representing the literal packet data + * @param clone (optional) Whether to return a clone so that getBytes/getText can be called again + * @returns A sequence of bytes + */ + getBytes(clone: boolean): Uint8Array | ReadableStream; + + /** + * Sets the filename of the literal packet data + * @param filename Any native javascript string + */ + setFilename(filename: string): void; + + /** + * Get the filename of the literal packet data + * @returns filename + */ + getFilename(): string; + + /** + * Parsing function for a literal data packet (tag 11). + * @param input Payload of a tag 11 packet + * @returns object representation + */ + read(input: Uint8Array | ReadableStream): Literal; + + /** + * Creates a string representation of the packet + * @returns Uint8Array representation of the packet + */ + write(): Uint8Array | ReadableStream; + } + + class Marker { + /** + * Implementation of the strange "Marker packet" (Tag 10) + * {@link https://tools.ietf.org/html/rfc4880#section-5.8|RFC4880 5.8}: + * An experimental version of PGP used this packet as the Literal + * packet, but no released version of PGP generated Literal packets with this + * tag. With PGP 5.x, this packet has been reassigned and is reserved for use as + * the Marker packet. + * Such a packet MUST be ignored when received. + */ + constructor(); + + /** + * Parsing function for a literal data packet (tag 10). + * @param input Payload of a tag 10 packet + * @param position Position to start reading from the input string + * @param len Length of the packet or the remaining length of + * input at position + * @returns Object representation + */ + read(input: string, position: Integer, len: Integer): Marker; + } + + class OnePassSignature { + /** + * Implementation of the One-Pass Signature Packets (Tag 4) + * {@link https://tools.ietf.org/html/rfc4880#section-5.4|RFC4880 5.4}: + * The One-Pass Signature packet precedes the signed data and contains + * enough information to allow the receiver to begin calculating any + * hashes needed to verify the signature. It allows the Signature + * packet to be placed at the end of the message, so that the signer + * can compute the entire signed message in one pass. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * A one-octet version number. The current version is 3. + */ + version: any; + + /** + * A one-octet signature type. + * Signature types are described in + * {@link https://tools.ietf.org/html/rfc4880#section-5.2.1|RFC4880 Section 5.2.1}. + */ + signatureType: any; + + /** + * A one-octet number describing the hash algorithm used. + * @see + */ + hashAlgorithm: any; + + /** + * A one-octet number describing the public-key algorithm used. + * @see + */ + publicKeyAlgorithm: any; + + /** + * An eight-octet number holding the Key ID of the signing key. + */ + issuerKeyId: any; + + /** + * A one-octet number holding a flag showing whether the signature is nested. + * A zero value indicates that the next packet is another One-Pass Signature packet + * that describes another signature to be applied to the same message data. + */ + flags: any; + + /** + * parsing function for a one-pass signature packet (tag 4). + * @param bytes payload of a tag 4 packet + * @returns object representation + */ + read(bytes: Uint8Array): OnePassSignature; + + /** + * creates a string representation of a one-pass signature packet + * @returns a Uint8Array representation of a one-pass signature packet + */ + write(): Uint8Array; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class List { + /** + * This class represents a list of openpgp packets. + * Take care when iterating over it - the packets themselves + * are stored as numerical indices. + */ + constructor(); + + /** + * The number of packets contained within the list. + */ + readonly length: Integer; + + /** + * Reads a stream of binary data and interprents it as a list of packets. + * @param A Uint8Array of bytes. + */ + read(A: Uint8Array | ReadableStream): void; + + /** + * Creates a binary representation of openpgp objects contained within the + * class instance. + * @returns A Uint8Array containing valid openpgp packets. + */ + write(): Uint8Array; + + /** + * Adds a packet to the list. This is the only supported method of doing so; + * writing to packetlist[i] directly will result in an error. + * @param packet Packet to push + */ + push(packet: object): void; + + /** + * Creates a new PacketList with all packets from the given types + */ + filterByTag(): void; + + /** + * Traverses packet tree and returns first matching packet + * @param type The packet type + * @returns + */ + findPacket(type: enums.packet): List | undefined; + + /** + * Returns array of found indices by tag + */ + indexOfTag(): void; + + /** + * Concatenates packetlist or array of packets + */ + concat(): void; + + /** + * Allocate a new packetlist from structured packetlist clone + * See {@link https://w3c.github.io/html/infrastructure.html#safe-passing-of-structured-data} + * @param packetClone packetlist clone + * @returns new packetlist object with data from packetlist clone + */ + static fromStructuredClone(packetClone: object): object; + } + + class PublicKey { + /** + * Implementation of the Key Material Packet (Tag 5,6,7,14) + * {@link https://tools.ietf.org/html/rfc4880#section-5.5|RFC4480 5.5}: + * A key material packet contains all the information about a public or + * private key. There are four variants of this packet type, and two + * major versions. + * A Public-Key packet starts a series of packets that forms an OpenPGP + * key (sometimes called an OpenPGP certificate). + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Internal Parser for public keys as specified in {@link https://tools.ietf.org/html/rfc4880#section-5.5.2|RFC 4880 section 5.5.2 Public-Key Packet Formats} + * called by read_tag<num> + * @param bytes Input array to read the packet from + * @returns This object with attributes set by the parser + */ + read(bytes: Uint8Array): object; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Same as write_private_key, but has less information because of + * public key. + * @returns OpenPGP packet body contents, + */ + write(): Uint8Array; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class PublicKeyEncryptedSessionKey { + /** + * Public-Key Encrypted Session Key Packets (Tag 1) + * {@link https://tools.ietf.org/html/rfc4880#section-5.1|RFC4880 5.1}: + * A Public-Key Encrypted Session Key packet holds the session key + * used to encrypt a message. Zero or more Public-Key Encrypted Session Key + * packets and/or Symmetric-Key Encrypted Session Key packets may precede a + * Symmetrically Encrypted Data Packet, which holds an encrypted message. The + * message is encrypted with the session key, and the session key is itself + * encrypted and stored in the Encrypted Session Key packet(s). The + * Symmetrically Encrypted Data Packet is preceded by one Public-Key Encrypted + * Session Key packet for each OpenPGP key to which the message is encrypted. + * The recipient of the message finds a session key that is encrypted to their + * public key, decrypts the session key, and then uses the session key to + * decrypt the message. + */ + constructor(); + + encrypted: any[]; + + /** + * Parsing function for a publickey encrypted session key packet (tag 1). + * @param input Payload of a tag 1 packet + * @param position Position to start reading from the input string + * @param len Length of the packet or the remaining length of + * input at position + * @returns Object representation + */ + read(input: Uint8Array, position: Integer, len: Integer): PublicKeyEncryptedSessionKey + + /** + * Create a string representation of a tag 1 packet + * @returns The Uint8Array representation + */ + write(): Uint8Array; + + /** + * Encrypt session key packet + * @param key Public key + * @returns + */ + encrypt(key: PublicKey): Promise; + + /** + * Decrypts the session key (only for public key encrypted session key + * packets (tag 1) + * @param key Private key with secret params unlocked + * @returns + */ + decrypt(key: SecretKey): Promise; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class PublicSubkey { + /** + * A Public-Subkey packet (tag 14) has exactly the same format as a + * Public-Key packet, but denotes a subkey. One or more subkeys may be + * associated with a top-level key. By convention, the top-level key + * provides signature services, and the subkeys provide encryption + * services. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Internal Parser for public keys as specified in {@link https://tools.ietf.org/html/rfc4880#section-5.5.2|RFC 4880 section 5.5.2 Public-Key Packet Formats} + * called by read_tag<num> + * @param bytes Input array to read the packet from + * @returns This object with attributes set by the parser + */ + read(bytes: Uint8Array): object; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Same as write_private_key, but has less information because of + * public key. + * @returns OpenPGP packet body contents, + */ + write(): Uint8Array; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class SecretKey { + /** + * A Secret-Key packet contains all the information that is found in a + * Public-Key packet, including the public-key material, but also + * includes the secret-key material after all the public-key fields. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Encrypted secret-key data + */ + encrypted: any; + + /** + * Indicator if secret-key data is encrypted. `this.isEncrypted === false` means data is available in decrypted form. + */ + isEncrypted: any; + + /** + * Internal parser for private keys as specified in + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-5.5.3|RFC4880bis-04 section 5.5.3} + * @param bytes Input string to read the packet from + */ + read(bytes: string): void; + + /** + * Creates an OpenPGP key packet for the given key. + * @returns A string of bytes containing the secret key OpenPGP packet + */ + write(): string; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Encrypt the payload. By default, we use aes256 and iterated, salted string + * to key specifier. If the key is in a decrypted state (isEncrypted === false) + * and the passphrase is empty or undefined, the key will be set as not encrypted. + * This can be used to remove passphrase protection after calling decrypt(). + * @param passphrase + * @returns + */ + encrypt(passphrase: string): Promise; + + /** + * Decrypts the private key params which are needed to use the key. + * {@link module:packet.SecretKey.isDecrypted} should be false, as + * otherwise calls to this function will throw an error. + * @param passphrase The passphrase for this private key as string + * @returns + */ + decrypt(passphrase: string): Promise; + + /** + * Clear private params, return to initial state + */ + clearPrivateParams(): void; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + } + + class SecretSubkey { + /** + * A Secret-Subkey packet (tag 7) is the subkey analog of the Secret + * Key packet and has exactly the same format. + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Encrypted secret-key data + */ + encrypted: any; + + /** + * Indicator if secret-key data is encrypted. `this.isEncrypted === false` means data is available in decrypted form. + */ + isEncrypted: any; + + /** + * Internal parser for private keys as specified in + * {@link https://tools.ietf.org/html/draft-ietf-openpgp-rfc4880bis-04#section-5.5.3|RFC4880bis-04 section 5.5.3} + * @param bytes Input string to read the packet from + */ + read(bytes: string): void; + + /** + * Creates an OpenPGP key packet for the given key. + * @returns A string of bytes containing the secret key OpenPGP packet + */ + write(): string; + + /** + * Check whether secret-key data is available in decrypted form. Returns null for public keys. + * @returns + */ + isDecrypted(): boolean | null; + + /** + * Encrypt the payload. By default, we use aes256 and iterated, salted string + * to key specifier. If the key is in a decrypted state (isEncrypted === false) + * and the passphrase is empty or undefined, the key will be set as not encrypted. + * This can be used to remove passphrase protection after calling decrypt(). + * @param passphrase + * @returns + */ + encrypt(passphrase: string): Promise; + + /** + * Decrypts the private key params which are needed to use the key. + * {@link module:packet.SecretKey.isDecrypted} should be false, as + * otherwise calls to this function will throw an error. + * @param passphrase The passphrase for this private key as string + * @returns + */ + decrypt(passphrase: string): Promise; + + /** + * Clear private params, return to initial state + */ + clearPrivateParams(): void; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + + /** + * Packet version + */ + version: Integer; + + /** + * Key creation date. + */ + created: Date; + + /** + * Public key algorithm. + */ + algorithm: string; + + /** + * Algorithm specific params + */ + params: object[]; + + /** + * Time until expiration in days (V3 only) + */ + expirationTimeV3: Integer; + + /** + * Fingerprint in lowercase hex + */ + fingerprint: string; + + /** + * Keyid + */ + keyid: type.keyid.Keyid; + + /** + * Alias of read() + * @see module:packet.PublicKey#read + */ + readPublicKey: any; + + /** + * Alias of write() + * @see module:packet.PublicKey#write + */ + writePublicKey: any; + + /** + * Write an old version packet - it's used by some of the internal routines. + */ + writeOld(): void; + + /** + * Returns the creation time of the key + * @returns + */ + getCreationTime(): Date; + + /** + * Calculates the key id of the key + * @returns A 8 byte key id + */ + getKeyId(): string; + + /** + * Calculates the fingerprint of the key + * @returns A Uint8Array containing the fingerprint + */ + getFingerprintBytes(): Uint8Array; + + /** + * Calculates the fingerprint of the key + * @returns A string containing the fingerprint in lowercase hex + */ + getFingerprint(): string; + + /** + * Calculates whether two keys have the same fingerprint without actually calculating the fingerprint + * @returns Whether the two keys have the same version and public key data + */ + hasSameFingerprintAs(): boolean; + + /** + * Returns algorithm information + * @returns An object of the form {algorithm: string, bits:int, curve:String} + */ + getAlgorithmInfo(): object; + } + + class Signature { + /** + * Implementation of the Signature Packet (Tag 2) + * {@link https://tools.ietf.org/html/rfc4880#section-5.2|RFC4480 5.2}: + * A Signature packet describes a binding between some public key and + * some data. The most common signatures are a signature of a file or a + * block of text, and a signature that is a certification of a User ID. + * @param date the creation date of the signature + */ + constructor(date: Date); + + /** + * parsing function for a signature packet (tag 2). + * @param bytes payload of a tag 2 packet + * @param position position to start reading from the bytes string + * @param len length of the packet or the remaining length of bytes at position + * @returns object representation + */ + read(bytes: string, position: Integer, len: Integer): Signature; + + /** + * Signs provided data. This needs to be done prior to serialization. + * @param key private key used to sign the message. + * @param data Contains packets to be signed. + * @returns + */ + sign(key: SecretKey, data: object): Promise; + + /** + * Creates Uint8Array of bytes of all subpacket data except Issuer and Embedded Signature subpackets + * @returns subpacket data + */ + write_hashed_sub_packets(): Uint8Array; + + /** + * Creates Uint8Array of bytes of Issuer and Embedded Signature subpackets + * @returns subpacket data + */ + write_unhashed_sub_packets(): Uint8Array; + + /** + * verifys the signature packet. Note: not signature types are implemented + * @param key the public key to verify the signature + * @param signatureType expected signature type + * @param data data which on the signature applies + * @returns True if message is verified, else false. + */ + verify(key: PublicSubkey | PublicKey | SecretSubkey | SecretKey, signatureType: enums.signature, data: string | object): Promise; + + /** + * Verifies signature expiration date + * @param date (optional) use the given date for verification instead of the current time + * @returns true if expired + */ + isExpired(date: Date): boolean; + + /** + * Returns the expiration time of the signature or Infinity if signature does not expire + * @returns expiration time + */ + getExpirationTime(): Date; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class SymEncryptedAEADProtected { + /** + * Implementation of the Symmetrically Encrypted Authenticated Encryption with + * Additional Data (AEAD) Protected Data Packet + * {@link https://tools.ietf.org/html/draft-ford-openpgp-format-00#section-2.1}: + * AEAD Protected Data Packet + */ + constructor(); + + /** + * Parse an encrypted payload of bytes in the order: version, IV, ciphertext (see specification) + * @param bytes + */ + read(bytes: Uint8Array | ReadableStream): void; + + /** + * Write the encrypted payload of bytes in the order: version, IV, ciphertext (see specification) + * @returns The encrypted payload + */ + write(): Uint8Array | ReadableStream; + + /** + * Decrypt the encrypted payload. + * @param sessionKeyAlgorithm The session key's cipher algorithm e.g. 'aes128' + * @param key The session key used to encrypt the payload + * @param streaming Whether the top-level function will return a stream + * @returns + */ + decrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): boolean; + + /** + * Encrypt the packet list payload. + * @param sessionKeyAlgorithm The session key's cipher algorithm e.g. 'aes128' + * @param key The session key used to encrypt the payload + * @param streaming Whether the top-level function will return a stream + */ + encrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): void; + + /** + * En/decrypt the payload. + * @param {encrypt | decrypt} fn Whether to encrypt or decrypt + * @param key The session key used to en/decrypt the payload + * @param data The data to en/decrypt + * @param streaming Whether the top-level function will return a stream + * @returns + */ + crypt(fn: any, key: Uint8Array, data: Uint8Array | ReadableStream, streaming: boolean): Uint8Array | ReadableStream; + } + + class SymEncryptedIntegrityProtected { + /** + * Implementation of the Sym. Encrypted Integrity Protected Data Packet (Tag 18) + * {@link https://tools.ietf.org/html/rfc4880#section-5.13|RFC4880 5.13}: + * The Symmetrically Encrypted Integrity Protected Data packet is + * a variant of the Symmetrically Encrypted Data packet. It is a new feature + * created for OpenPGP that addresses the problem of detecting a modification to + * encrypted data. It is used in combination with a Modification Detection Code + * packet. + */ + constructor(); + + /** + * The encrypted payload. + */ + encrypted: any; + + /** + * If after decrypting the packet this is set to true, + * a modification has been detected and thus the contents + * should be discarded. + */ + modification: boolean; + + /** + * Encrypt the payload in the packet. + * @param sessionKeyAlgorithm The selected symmetric encryption algorithm to be used e.g. 'aes128' + * @param key The key of cipher blocksize length to be used + * @param streaming Whether to set this.encrypted to a stream + * @returns + */ + encrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): Promise; + + /** + * Decrypts the encrypted data contained in the packet. + * @param sessionKeyAlgorithm The selected symmetric encryption algorithm to be used e.g. 'aes128' + * @param key The key of cipher blocksize length to be used + * @param streaming Whether to read this.encrypted as a stream + * @returns + */ + decrypt(sessionKeyAlgorithm: string, key: Uint8Array, streaming: boolean): Promise; + } + + class SymEncryptedSessionKey { + /** + * Public-Key Encrypted Session Key Packets (Tag 1) + * {@link https://tools.ietf.org/html/rfc4880#section-5.1|RFC4880 5.1}: + * A Public-Key Encrypted Session Key packet holds the session key + * used to encrypt a message. Zero or more Public-Key Encrypted Session Key + * packets and/or Symmetric-Key Encrypted Session Key packets may precede a + * Symmetrically Encrypted Data Packet, which holds an encrypted message. The + * message is encrypted with the session key, and the session key is itself + * encrypted and stored in the Encrypted Session Key packet(s). The + * Symmetrically Encrypted Data Packet is preceded by one Public-Key Encrypted + * Session Key packet for each OpenPGP key to which the message is encrypted. + * The recipient of the message finds a session key that is encrypted to their + * public key, decrypts the session key, and then uses the session key to + * decrypt the message. + */ + constructor(); + + /** + * Parsing function for a symmetric encrypted session key packet (tag 3). + * @param input Payload of a tag 1 packet + * @param position Position to start reading from the input string + * @param len Length of the packet or the remaining length of + * input at position + * @returns Object representation + */ + read(input: Uint8Array, position: Integer, len: Integer): SymEncryptedSessionKey; + + /** + * Decrypts the session key + * @param passphrase The passphrase in string form + * @returns + */ + decrypt(passphrase: string): Promise; + + /** + * Encrypts the session key + * @param passphrase The passphrase in string form + * @returns + */ + encrypt(passphrase: string): Promise; + + /** + * Fix custom types after cloning + */ + postCloneTypeFix(): void; + } + + class SymmetricallyEncrypted { + /** + * Implementation of the Symmetrically Encrypted Data Packet (Tag 9) + * {@link https://tools.ietf.org/html/rfc4880#section-5.7|RFC4880 5.7}: + * The Symmetrically Encrypted Data packet contains data encrypted with a + * symmetric-key algorithm. When it has been decrypted, it contains other + * packets (usually a literal data packet or compressed data packet, but in + * theory other Symmetrically Encrypted Data packets or sequences of packets + * that form whole OpenPGP messages). + */ + constructor(); + + /** + * Packet type + */ + tag: enums.packet; + + /** + * Encrypted secret-key data + */ + encrypted: any; + + /** + * Decrypted packets contained within. + */ + packets: List; + + /** + * When true, decrypt fails if message is not integrity protected + * @see module:config.ignore_mdc_error + */ + ignore_mdc_error: any; + + /** + * Decrypt the symmetrically-encrypted packet data + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param sessionKeyAlgorithm Symmetric key algorithm to use + * @param key The key of cipher blocksize length to be used + * @returns + */ + decrypt(sessionKeyAlgorithm: enums.symmetric, key: Uint8Array): Promise; + + /** + * Encrypt the symmetrically-encrypted packet data + * See {@link https://tools.ietf.org/html/rfc4880#section-9.2|RFC 4880 9.2} for algorithms. + * @param sessionKeyAlgorithm Symmetric key algorithm to use + * @param key The key of cipher blocksize length to be used + * @returns + */ + encrypt(sessionKeyAlgorithm: enums.symmetric, key: Uint8Array): Promise; + } + + class Trust { + /** + * Implementation of the Trust Packet (Tag 12) + * {@link https://tools.ietf.org/html/rfc4880#section-5.10|RFC4880 5.10}: + * The Trust packet is used only within keyrings and is not normally + * exported. Trust packets contain data that record the user's + * specifications of which key holders are trustworthy introducers, + * along with other information that implementing software uses for + * trust information. The format of Trust packets is defined by a given + * implementation. + * Trust packets SHOULD NOT be emitted to output streams that are + * transferred to other users, and they SHOULD be ignored on any input + * other than local keyring files. + */ + constructor(); + + /** + * Parsing function for a trust packet (tag 12). + * Currently not implemented as we ignore trust packets + * @param byptes payload of a tag 12 packet + */ + read(byptes: string): void; + } + + class UserAttribute { + /** + * Implementation of the User Attribute Packet (Tag 17) + * The User Attribute packet is a variation of the User ID packet. It + * is capable of storing more types of data than the User ID packet, + * which is limited to text. Like the User ID packet, a User Attribute + * packet may be certified by the key owner ("self-signed") or any other + * key owner who cares to certify it. Except as noted, a User Attribute + * packet may be used anywhere that a User ID packet may be used. + * While User Attribute packets are not a required part of the OpenPGP + * standard, implementations SHOULD provide at least enough + * compatibility to properly handle a certification signature on the + * User Attribute packet. A simple way to do this is by treating the + * User Attribute packet as a User ID packet with opaque contents, but + * an implementation may use any method desired. + */ + constructor(); + + /** + * parsing function for a user attribute packet (tag 17). + * @param input payload of a tag 17 packet + */ + read(input: Uint8Array): void; + + /** + * Creates a binary representation of the user attribute packet + * @returns string representation + */ + write(): Uint8Array; + + /** + * Compare for equality + * @param usrAttr + * @returns true if equal + */ + equals(usrAttr: UserAttribute): boolean; + } + + class Userid { + /** + * Implementation of the User ID Packet (Tag 13) + * A User ID packet consists of UTF-8 text that is intended to represent + * the name and email address of the key holder. By convention, it + * includes an RFC 2822 [RFC2822] mail name-addr, but there are no + * restrictions on its content. The packet length in the header + * specifies the length of the User ID. + */ + constructor(); + + /** + * A string containing the user id. Usually in the form + * John Doe + */ + userid: string; + + /** + * Parsing function for a user id packet (tag 13). + * @param input payload of a tag 13 packet + */ + read(input: Uint8Array): void; + + /** + * Parse userid string, e.g. 'John Doe ' + */ + parse(): void; + + /** + * Creates a binary representation of the user id packet + * @returns binary representation + */ + write(): Uint8Array; + + /** + * Set userid string from object, e.g. { name:'Phil Zimmermann', email:'phil@openpgp.org' } + */ + format(): void; + } + + namespace all_packets { + /** + * @see module:packet.Compressed + */ + var Compressed: any; + + /** + * @see module:packet.SymEncryptedIntegrityProtected + */ + var SymEncryptedIntegrityProtected: any; + + /** + * @see module:packet.SymEncryptedAEADProtected + */ + var SymEncryptedAEADProtected: any; + + /** + * @see module:packet.PublicKeyEncryptedSessionKey + */ + var PublicKeyEncryptedSessionKey: any; + + /** + * @see module:packet.SymEncryptedSessionKey + */ + var SymEncryptedSessionKey: any; + + /** + * @see module:packet.Literal + */ + var Literal: any; + + /** + * @see module:packet.PublicKey + */ + var PublicKey: any; + + /** + * @see module:packet.SymmetricallyEncrypted + */ + var SymmetricallyEncrypted: any; + + /** + * @see module:packet.Marker + */ + var Marker: any; + + /** + * @see module:packet.PublicSubkey + */ + var PublicSubkey: any; + + /** + * @see module:packet.UserAttribute + */ + var UserAttribute: any; + + /** + * @see module:packet.OnePassSignature + */ + var OnePassSignature: any; + + /** + * @see module:packet.SecretKey + */ + var SecretKey: any; + + /** + * @see module:packet.Userid + */ + var Userid: any; + + /** + * @see module:packet.SecretSubkey + */ + var SecretSubkey: any; + + /** + * @see module:packet.Signature + */ + var Signature: any; + + /** + * @see module:packet.Trust + */ + var Trust: any; + } + + namespace clone { + /** + * Create a packetlist from the correspoding object types. + * @param options the object passed to and from the web worker + * @returns a mutated version of the options optject + */ + function clonePackets(options: object): object; + + /** + * Creates an object with the correct prototype from a corresponding packetlist. + * @param options the object passed to and from the web worker + * @param method the public api function name to be delegated to the worker + * @returns a mutated version of the options optject + */ + function parseClonedPackets(options: object, method: string): object; + } + + namespace packet { + /** + * Encodes a given integer of length to the openpgp length specifier to a + * string + * @param length The length to encode + * @returns String with openpgp length representation + */ + function writeSimpleLength(length: Integer): Uint8Array; + + /** + * Writes a packet header version 4 with the given tag_type and length to a + * string + * @param tag_type Tag type + * @param length Length of the payload + * @returns String of the header + */ + function writeHeader(tag_type: Integer, length: Integer): string; + + /** + * Writes a packet header Version 3 with the given tag_type and length to a + * string + * @param tag_type Tag type + * @param length Length of the payload + * @returns String of the header + */ + function writeOldHeader(tag_type: Integer, length: Integer): string; + + /** + * Whether the packet type supports partial lengths per RFC4880 + * @param tag_type Tag type + * @returns String of the header + */ + function supportsStreaming(tag_type: Integer): boolean; + + /** + * Generic static Packet Parser function + * @param input Input stream as string + * @param callback Function to call with the parsed packet + * @returns Returns false if the stream was empty and parsing is done, and true otherwise. + */ + function read(input: Uint8Array | ReadableStream, callback: Function): boolean; + } +} + + +export namespace polyfills { +} + +export namespace signature { + /** + * Class that represents an OpenPGP signature. + */ + class Signature { + /** + * @param packetlist The signature packets + */ + constructor(packetlist: packet.List); + + /** + * Returns ASCII armored text of signature + * @returns ASCII armor + */ + armor(): ReadableStream; + + packets: packet.List; + } + + /** + * reads an OpenPGP armored signature and returns a signature object + * @param armoredText text to be parsed + * @returns new signature object + */ + function readArmored(armoredText: string | ReadableStream): Signature; + + /** + * reads an OpenPGP signature as byte array and returns a signature object + * @param input binary signature + * @returns new signature object + */ + function read(input: Uint8Array | ReadableStream): Signature; +} + +export namespace type { + /** + * Encoded symmetric key for ECDH + */ + namespace ecdh_symkey { + class ECDHSymmetricKey { + constructor(); + + /** + * Read an ECDHSymmetricKey from an Uint8Array + * @param input Where to read the encoded symmetric key from + * @returns Number of read bytes + */ + read(input: Uint8Array): number; + + /** + * Write an ECDHSymmetricKey as an Uint8Array + * @returns An array containing the value + */ + write(): Uint8Array; + } + } + + /** + * Implementation of type KDF parameters + * {@link https://tools.ietf.org/html/rfc6637#section-7|RFC 6637 7}: + * A key derivation function (KDF) is necessary to implement the EC + * encryption. The Concatenation Key Derivation Function (Approved + * Alternative 1) [NIST-SP800-56A] with the KDF hash function that is + * SHA2-256 [FIPS-180-3] or stronger is REQUIRED. + */ + namespace kdf_params { + class KDFParams { + /** + * @param hash Hash algorithm + * @param cipher Symmetric algorithm + */ + constructor(hash: enums.hash, cipher: enums.symmetric); + + /** + * Read KDFParams from an Uint8Array + * @param input Where to read the KDFParams from + * @returns Number of read bytes + */ + read(input: Uint8Array): number; + + /** + * Write KDFParams to an Uint8Array + * @returns Array with the KDFParams value + */ + write(): Uint8Array; + } + } + + /** + * Implementation of type key id + * {@link https://tools.ietf.org/html/rfc4880#section-3.3|RFC4880 3.3}: + * A Key ID is an eight-octet scalar that identifies a key. + * Implementations SHOULD NOT assume that Key IDs are unique. The + * section "Enhanced Key Formats" below describes how Key IDs are + * formed. + */ + namespace keyid { + class Keyid { + constructor(); + + /** + * Parsing method for a key id + * @param input Input to read the key id from + */ + read(input: Uint8Array): void; + + /** + * Checks equality of Key ID's + * @param keyid + * @param matchWildcard Indicates whether to check if either keyid is a wildcard + */ + equals(keyid: Keyid, matchWildcard: boolean): void; + } + } + + /** + * Implementation of type MPI ( {@link https://tools.ietf.org/html/rfc4880#section-3.2|RFC4880 3.2}) + * Multiprecision integers (also called MPIs) are unsigned integers used + * to hold large integers such as the ones used in cryptographic + * calculations. + * An MPI consists of two pieces: a two-octet scalar that is the length + * of the MPI in bits followed by a string of octets that contain the + * actual integer. + */ + namespace mpi { + class MPI { + constructor(); + + /** + * Parsing function for a MPI ( {@link https://tools.ietf.org/html/rfc4880#section-3.2|RFC 4880 3.2}). + * @param input Payload of MPI data + * @param endian Endianness of the data; 'be' for big-endian or 'le' for little-endian + * @returns Length of data read + */ + read(input: Uint8Array, endian: string): Integer; + + /** + * Converts the mpi object to a bytes as specified in + * {@link https://tools.ietf.org/html/rfc4880#section-3.2|RFC4880 3.2} + * @param endian Endianness of the payload; 'be' for big-endian or 'le' for little-endian + * @param length Length of the data part of the MPI + * @returns mpi Byte representation + */ + write(endian: string, length: Integer): Uint8Array; + } + } + + /** + * Wrapper to an OID value + * {@link https://tools.ietf.org/html/rfc6637#section-11|RFC6637, section 11}: + * The sequence of octets in the third column is the result of applying + * the Distinguished Encoding Rules (DER) to the ASN.1 Object Identifier + * with subsequent truncation. The truncation removes the two fields of + * encoded Object Identifier. The first omitted field is one octet + * representing the Object Identifier tag, and the second omitted field + * is the length of the Object Identifier body. For example, the + * complete ASN.1 DER encoding for the NIST P-256 curve OID is "06 08 2A + * 86 48 CE 3D 03 01 07", from which the first entry in the table above + * is constructed by omitting the first two octets. Only the truncated + * sequence of octets is the valid representation of a curve OID. + */ + namespace oid { + class OID { + constructor(); + + /** + * Method to read an OID object + * @param input Where to read the OID from + * @returns Number of read bytes + */ + read(input: Uint8Array): number; + + /** + * Serialize an OID object + * @returns Array with the serialized value the OID + */ + write(): Uint8Array; + + /** + * Serialize an OID object as a hex string + * @returns String with the hex value of the OID + */ + toHex(): string; + + /** + * If a known curve object identifier, return the canonical name of the curve + * @returns String with the canonical name of the curve + */ + getName(): string; + } + } + + /** + * Implementation of the String-to-key specifier + * {@link https://tools.ietf.org/html/rfc4880#section-3.7|RFC4880 3.7}: + * String-to-key (S2K) specifiers are used to convert passphrase strings + * into symmetric-key encryption/decryption keys. They are used in two + * places, currently: to encrypt the secret part of private keys in the + * private keyring, and to convert passphrases to encryption keys for + * symmetrically encrypted messages. + */ + namespace s2k { + class S2K { + constructor(); + + algorithm: enums.hash; + + type: enums.s2k; + + c: Integer; + + /** + * Eight bytes of salt in a binary string. + */ + salt: string; + + /** + * Parsing function for a string-to-key specifier ( {@link https://tools.ietf.org/html/rfc4880#section-3.7|RFC 4880 3.7}). + * @param input Payload of string-to-key specifier + * @returns Actual length of the object + */ + read(input: string): Integer; + + /** + * Serializes s2k information + * @returns binary representation of s2k + */ + write(): Uint8Array; + + /** + * Produces a key using the specified passphrase and the defined + * hashAlgorithm + * @param passphrase Passphrase containing user input + * @returns Produced key with a length corresponding to + * hashAlgorithm hash length + */ + produce_key(passphrase: string): Uint8Array; + } + } +} + +/** + * This object contains utility functions + */ +export namespace util { + /** + * Get transferable objects to pass buffers with zero copy (similar to "pass by reference" in C++) + * See: https://developer.mozilla.org/en-US/docs/Web/API/Worker/postMessage + * Also, convert ReadableStreams to MessagePorts + * @param obj the options object to be passed to the web worker + * @returns an array of binary data to be passed + */ + function getTransferables(obj: object): any[]; + + /** + * Convert MessagePorts back to ReadableStreams + * @param obj + * @returns + */ + function restoreStreams(obj: object): object; + + /** + * Create hex string from a binary + * @param str String to convert + * @returns String containing the hexadecimal values + */ + function str_to_hex(str: string): string; + + /** + * Create binary string from a hex encoded string + * @param str Hex string to convert + * @returns + */ + function hex_to_str(str: string): string; + + /** + * Convert a Uint8Array to an MPI-formatted Uint8Array. + * Note: the output is **not** an MPI object. + * @see + * @see + * @param bin An array of 8-bit integers to convert + * @returns MPI-formatted Uint8Array + */ + function Uint8Array_to_MPI(bin: Uint8Array): Uint8Array; + + /** + * Convert a Base-64 encoded string an array of 8-bit integer + * Note: accepts both Radix-64 and URL-safe strings + * @param base64 Base-64 encoded string to convert + * @returns An array of 8-bit integers + */ + function b64_to_Uint8Array(base64: string): Uint8Array; + + /** + * Convert an array of 8-bit integer to a Base-64 encoded string + * @param bytes An array of 8-bit integers to convert + * @param url If true, output is URL-safe + * @returns Base-64 encoded string + */ + function Uint8Array_to_b64(bytes: Uint8Array, url: boolean): string; + + /** + * Convert a hex string to an array of 8-bit integers + * @param hex A hex string to convert + * @returns An array of 8-bit integers + */ + function hex_to_Uint8Array(hex: string): Uint8Array; + + /** + * Convert an array of 8-bit integers to a hex string + * @param bytes Array of 8-bit integers to convert + * @returns Hexadecimal representation of the array + */ + function Uint8Array_to_hex(bytes: Uint8Array): string; + + /** + * Convert a string to an array of 8-bit integers + * @param str String to convert + * @returns An array of 8-bit integers + */ + function str_to_Uint8Array(str: string): Uint8Array; + + /** + * Convert an array of 8-bit integers to a string + * @param bytes An array of 8-bit integers to convert + * @returns String representation of the array + */ + function Uint8Array_to_str(bytes: Uint8Array): string; + + /** + * Convert a native javascript string to a Uint8Array of utf8 bytes + * @param str The string to convert + * @returns A valid squence of utf8 bytes + */ + function encode_utf8(str: string | ReadableStream): Uint8Array | ReadableStream; + + /** + * Convert a Uint8Array of utf8 bytes to a native javascript string + * @param utf8 A valid squence of utf8 bytes + * @returns A native javascript string + */ + function decode_utf8(utf8: Uint8Array | ReadableStream): string | ReadableStream; + + /** + * Concat a list of Uint8Arrays, Strings or Streams + * The caller must not mix Uint8Arrays with Strings, but may mix Streams with non-Streams. + * @param Array of Uint8Arrays/Strings/Streams to concatenate + * @returns Concatenated array + */ + var concat: any; + + /** + * Concat Uint8Arrays + * @param Array of Uint8Arrays to concatenate + * @returns Concatenated array + */ + var concatUint8Array: any; + + /** + * Check Uint8Array equality + * @param first array + * @param second array + * @returns equality + */ + function equalsUint8Array(first: Uint8Array, second: Uint8Array): boolean; + + /** + * Calculates a 16bit sum of a Uint8Array by adding each character + * codes modulus 65535 + * @param Uint8Array to create a sum of + * @returns 2 bytes containing the sum of all charcodes % 65535 + */ + function write_checksum(Uint8Array: Uint8Array): Uint8Array; + + /** + * Helper function to print a debug message. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug(str: string): void; + + /** + * Helper function to print a debug message. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug_hexarray_dump(str: string): void; + + /** + * Helper function to print a debug message. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug_hexstr_dump(str: string): void; + + /** + * Helper function to print a debug error. Debug + * messages are only printed if + * @param str String of the debug message + */ + function print_debug_error(str: string): void; + + /** + * Read a stream to the end and print it to the console when it's closed. + * @param str String of the debug message + * @param input Stream to print + * @param concat Function to concatenate chunks of the stream (defaults to util.concat). + */ + function print_entire_stream(str: string, input: ReadableStream | Uint8Array | string, concat: Function): void; + + /** + * If S[1] == 0, then double(S) == (S[2..128] || 0); + * otherwise, double(S) == (S[2..128] || 0) xor + * (zeros(120) || 10000111). + * Both OCB and EAX (through CMAC) require this function to be constant-time. + * @param data + */ + /* Illegal function name 'double' can't be used here + function double(data: Uint8Array): void; + */ + + /** + * Shift a Uint8Array to the right by n bits + * @param array The array to shift + * @param bits Amount of bits to shift (MUST be smaller + * than 8) + * @returns Resulting array. + */ + function shiftRight(array: Uint8Array, bits: Integer): string; + + /** + * Get native Web Cryptography api, only the current version of the spec. + * The default configuration is to use the api when available. But it can + * be deactivated with config.use_native + * @returns The SubtleCrypto api or 'undefined' + */ + function getWebCrypto(): object; + + /** + * Get native Web Cryptography api for all browsers, including legacy + * implementations of the spec e.g IE11 and Safari 8/9. The default + * configuration is to use the api when available. But it can be deactivated + * with config.use_native + * @returns The SubtleCrypto api or 'undefined' + */ + function getWebCryptoAll(): object; + + /** + * Detect Node.js runtime. + */ + function detectNode(): void; + + /** + * Get native Node.js module + * @param The module to require + * @returns The required module or 'undefined' + */ + function nodeRequire(The: string): object; + + /** + * Get native Node.js crypto api. The default configuration is to use + * the api when available. But it can also be deactivated with config.use_native + * @returns The crypto module or 'undefined' + */ + function getNodeCrypto(): object; + + /** + * Get native Node.js Buffer constructor. This should be used since + * Buffer is not available under browserify. + * @returns The Buffer constructor or 'undefined' + */ + function getNodeBuffer(): Function; + + /** + * Format user id for internal use. + */ + function formatUserId(): void; + + /** + * Parse user id. + */ + function parseUserId(): void; + + /** + * Normalize line endings to \r\n + */ + function canonicalizeEOL(): void; + + /** + * Convert line endings from canonicalized \r\n to native \n + */ + function nativeEOL(): void; + + /** + * Remove trailing spaces and tabs from each line + */ + function removeTrailingSpaces(): void; + + /** + * Encode input buffer using Z-Base32 encoding. + * See: https://tools.ietf.org/html/rfc6189#section-5.1.6 + * @param data The binary data to encode + * @returns Binary data encoded using Z-Base32 + */ + function encodeZBase32(data: Uint8Array): string; +} + +export namespace wkd { + class WKD { + /** + * Initialize the WKD client + */ + constructor(); + + /** + * Search for a public key using Web Key Directory protocol. + * @param options.email User's email. + * @param options.rawBytes Returns Uint8Array instead of parsed key. + * @returns The public key. + */ + lookup(): Promise, err: Array | null }>; + } +} + +export namespace worker { + /** + * @see module:openpgp.initWorker + * @see module:openpgp.getWorker + * @see module:openpgp.destroyWorker + * @see module:worker/worker + */ + namespace async_proxy { + class AsyncProxy { + /** + * Initializes a new proxy and loads the web worker + * @param path The path to the worker or 'openpgp.worker.js' by default + * @param n number of workers to initialize if path given + * @param config config The worker configuration + * @param worker alternative to path parameter: web worker initialized with 'openpgp.worker.js' + */ + constructor(path: string, n: number, config: object, worker: any[]); + + /** + * Message handling + */ + handleMessage(): void; + + /** + * Get new request ID + * @returns New unique request ID + */ + getID(): Integer; + + /** + * Send message to worker with random data + * @param size Number of bytes to send + */ + seedRandom(size: Integer): void; + + /** + * Terminates the workers + */ + terminate(): void; + + /** + * Generic proxy function that handles all commands from the public api. + * @param method the public api function to be delegated to the worker thread + * @param options the api function's options + * @returns see the corresponding public api functions for their return types + */ + delegate(method: string, options: object): Promise; + } + } + + /** + * @see module:openpgp.initWorker + * @see module:openpgp.getWorker + * @see module:openpgp.destroyWorker + * @see module:worker/async_proxy + */ + namespace worker { + /** + * Handle random buffer exhaustion by requesting more random bytes from the main window + * @returns Empty Promise whose resolution indicates that the buffer has been refilled + */ + function randomCallback(): Promise; + + /** + * Set config from main context to worker context. + * @param config The openpgp configuration + */ + function configure(config: object): void; + + /** + * Seed the library with entropy gathered window.crypto.getRandomValues + * as this api is only avalible in the main window. + * @param buffer Some random bytes + */ + function seedRandom(buffer: any[]): void; + + /** + * Generic proxy function that handles all commands from the public api. + * @param method The public api function to be delegated to the worker thread + * @param options The api function's options + */ + function delegate(method: string, options: object): void; + + /** + * Respond to the main window. + * @param event Contains event type and data + */ + function response(event: object): void; + } +} + + /** * Set the path for the web worker script and create an instance of the async proxy - * @param {String} path relative path to the worker scripts, default: 'openpgp.worker.js' - * @param {Number} n number of workers to initialize - * @param {Array} workers alternative to path parameter: web workers initialized with 'openpgp.worker.js' + * @param path relative path to the worker scripts, default: 'openpgp.worker.js' + * @param n number of workers to initialize + * @param workers alternative to path parameter: web workers initialized with 'openpgp.worker.js' */ -export function initWorker(options: WorkerOptions): boolean; +export function initWorker(path: string, n?: number, workers?: any[]): void; /** * Returns a reference to the async proxy if the worker was initialized with openpgp.initWorker() - * @returns {module:worker/async_proxy.AsyncProxy|null} the async proxy or null if not initialized + * @returns the async proxy or null if not initialized */ -export function getWorker(): AsyncProxy; +export function getWorker(): worker.async_proxy.AsyncProxy | null; /** * Cleanup the current instance of the web worker. */ export function destroyWorker(): void; -/** - * Encrypts message text/data with public keys, passwords or both at once. At least either public keys or passwords - * must be specified. If private keys are specified, those will be used to sign the message. - * @param {Message} message message to be encrypted as created by openpgp.message.fromText or openpgp.message.fromBinary - * @param {Key|Array} publicKeys (optional) array of keys or single key, used to encrypt the message - * @param {Key|Array} privateKeys (optional) private keys for signing. If omitted message will not be signed - * @param {String|Array} passwords (optional) array of passwords or a single password to encrypt the message - * @param {Object} sessionKey (optional) session key in the form: { data:Uint8Array, algorithm:String } - * @param {module:enums.compression} compression (optional) which compression algorithm to compress the message with, defaults to what is specified in config - * @param {Boolean} armor (optional) if the return values should be ascii armored or the message/signature objects - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Boolean} detached (optional) if the signature should be detached (if true, signature will be added to returned object) - * @param {Signature} signature (optional) a detached signature to add to the encrypted message - * @param {Boolean} returnSessionKey (optional) if the unencrypted session key should be added to returned object - * @param {Boolean} wildcard (optional) use a key ID of 0 instead of the public key IDs - * @param {Date} date (optional) override the creation date of the message signature - * @param {Object} fromUserId (optional) user ID to sign with, e.g. { name:'Steve Sender', email:'steve@openpgp.org' } - * @param {Object} toUserId (optional) user ID to encrypt for, e.g. { name:'Robert Receiver', email:'robert@openpgp.org' } - * @returns {Promise} Object containing encrypted (and optionally signed) message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if `armor` was true, the default) - * message: Message, (if `armor` was false) - * signature: String|ReadableStream|NodeStream, (if `detached` was true and `armor` was true) - * signature: Signature (if `detached` was true and `armor` was false) - * sessionKey: { data, algorithm, aeadAlgorithm } (if `returnSessionKey` was true) - * } - * @async - * @static - */ -export function encrypt(options: EncryptOptions): Promise; +export interface UserID { + name: string; + email: string; +} -/** - * Decrypts a message with the user's private key, a session key or a password. Either a private key, - * a session key or a password must be specified. - * @param {Message} message the message object with the encrypted data - * @param {Key|Array} privateKeys (optional) private keys with decrypted secret key data or session key - * @param {String|Array} passwords (optional) passwords to decrypt the message - * @param {Object|Array} sessionKeys (optional) session keys in the form: { data:Uint8Array, algorithm:String } - * @param {Key|Array} publicKeys (optional) array of public keys or single key, to verify signatures - * @param {String} format (optional) return data format either as 'utf8' or 'binary' - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Signature} signature (optional) detached signature for verification - * @param {Date} date (optional) use the given date for verification instead of the current time - * @returns {Promise} Object containing decrypted and verified message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if format was 'utf8', the default) - * data: Uint8Array|ReadableStream|NodeStream, (if format was 'binary') - * filename: String, - * signatures: [ - * { - * keyid: module:type/keyid, - * verified: Promise, - * valid: Boolean (if streaming was false) - * }, ... - * ] - * } - * @async - * @static - */ -export function decrypt(options: DecryptOptions): Promise; - -/** - * Signs a cleartext message. - * @param {CleartextMessage|Message} message (cleartext) message to be signed - * @param {Key|Array} privateKeys array of keys or single key with decrypted secret key data to sign cleartext - * @param {Boolean} armor (optional) if the return value should be ascii armored or the message object - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Boolean} detached (optional) if the return value should contain a detached signature - * @param {Date} date (optional) override the creation date of the signature - * @param {Array} fromUserIds (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [{ name:'Steve Sender', email:'steve@openpgp.org' }] - * @returns {Promise} Object containing signed message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if `armor` was true, the default) - * message: Message (if `armor` was false) - * } - * - * Or, if `detached` was true: - * - * { - * signature: String|ReadableStream|NodeStream, (if `armor` was true, the default) - * signature: Signature (if `armor` was false) - * } - * @async - * @static - */ -export function sign(options: SignOptions): Promise; - -/** - * Verifies signatures of cleartext signed message - * @param {Key|Array} publicKeys array of publicKeys or single key, to verify signatures - * @param {CleartextMessage|Message} message (cleartext) message object with signatures - * @param {'web'|'node'|false} streaming (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. - * @param {Signature} signature (optional) detached signature for verification - * @param {Date} date (optional) use the given date for verification instead of the current time - * @returns {Promise} Object containing verified message in the form: - * - * { - * data: String|ReadableStream|NodeStream, (if `message` was a CleartextMessage) - * data: Uint8Array|ReadableStream|NodeStream, (if `message` was a Message) - * signatures: [ - * { - * keyid: module:type/keyid, - * verified: Promise, - * valid: Boolean (if `streaming` was false) - * }, ... - * ] - * } - * @async - * @static - */ -export function verify(options: VerifyOptions): Promise; +export interface KeyOptions { + /** + * array of user IDs e.g. [ { name:'Phil Zimmermann', email:'phil@openpgp.org' }] + */ + userIds: UserID[]; + /** + * (optional) The passphrase used to encrypt the resulting private key + */ + passphrase?: string; + /** + * (optional) number of bits for RSA keys: 2048 or 4096. + */ + numBits?: number; + /** + * (optional) The number of seconds after the key creation time that the key expires + */ + keyExpirationTime?: number; + /** + * (optional) elliptic curve for ECC keys: elliptic curve for ECC keys: + * curve25519, p256, p384, p521, secp256k1, + * brainpoolP256r1, brainpoolP384r1, or brainpoolP512r1. + */ + curve?: string; + /** + * (optional) override the creation date of the key and the key signatures + */ + date?: Date; + /** + * (optional) options for each subkey, default to main key options. e.g. [ {sign: true, passphrase: '123'}] + * sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt + */ + subkeys?: { sign: true, passphrase: "string" }[]; +} /** * Generates a new OpenPGP key pair. Supports RSA and ECC keys. Primary and subkey will be of same type. - * @param {Array} userIds array of user IDs e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }] - * @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key - * @param {Number} numBits (optional) number of bits for RSA keys: 2048 or 4096. - * @param {Number} keyExpirationTime (optional) The number of seconds after the key creation time that the key expires - * @param {String} curve (optional) elliptic curve for ECC keys: - * curve25519, p256, p384, p521, secp256k1, - * brainpoolP256r1, brainpoolP384r1, or brainpoolP512r1. - * @param {Date} date (optional) override the creation date of the key and the key signatures - * @param {Array} subkeys (optional) options for each subkey, default to main key options. e.g. [{sign: true, passphrase: '123'}] - * sign parameter defaults to false, and indicates whether the subkey should sign rather than encrypt - * @returns {Promise} The generated key object in the form: - * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } - * @async - * @static + * @param options + * @returns The generated key object in the form: + * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } */ -export function generateKey(options: KeyOptions): Promise; +export function generateKey(option: KeyOptions): Promise<{ key: key.Key, privateKeyArmored: string, publicKeyArmored: string, revocationCertificate: string }>; /** * Reformats signature packets for a key and rewraps key object. - * @param {Key} privateKey private key to reformat - * @param {Array} userIds array of user IDs e.g. [{ name:'Phil Zimmermann', email:'phil@openpgp.org' }] - * @param {String} passphrase (optional) The passphrase used to encrypt the resulting private key - * @param {Number} keyExpirationTime (optional) The number of seconds after the key creation time that the key expires - * @param {Boolean} revocationCertificate (optional) Whether the returned object should include a revocation certificate to revoke the public key - * @returns {Promise} The generated key object in the form: - * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } - * @async - * @static + * @param privateKey private key to reformat + * @param userIds array of user IDs e.g. [ { name:'Phil Zimmermann', email:'phil@openpgp.org' }] + * @param passphrase (optional) The passphrase used to encrypt the resulting private key + * @param keyExpirationTime (optional) The number of seconds after the key creation time that the key expires + * @param revocationCertificate (optional) Whether the returned object should include a revocation certificate to revoke the public key + * @returns The generated key object in the form: + * { key:Key, privateKeyArmored:String, publicKeyArmored:String, revocationCertificate:String } */ -export function reformatKey(options: { - privateKey: key.Key, - userIds?: UserId[], - passphrase?: string, - keyExpirationTime?: number, - revocationCertificate?: boolean -}): Promise; +export function reformatKey(privateKey: key.Key, userIds: any[], passphrase?: string, keyExpirationTime?: number, revocationCertificate?: boolean): Promise; /** * Revokes a key. Requires either a private key or a revocation certificate. - * If a revocation certificate is passed, the reasonForRevocation parameters will be ignored. - * @param {Key} key (optional) public or private key to revoke - * @param {String} revocationCertificate (optional) revocation certificate to revoke the key with - * @param {Object} reasonForRevocation (optional) object indicating the reason for revocation - * @param {module:enums.reasonForRevocation} reasonForRevocation.flag (optional) flag indicating the reason for revocation - * @param {String} reasonForRevocation.string (optional) string explaining the reason for revocation - * @returns {Promise} The revoked key object in the form: - * { privateKey:Key, privateKeyArmored:String, publicKey:Key, publicKeyArmored:String } - * (if private key is passed) or { publicKey:Key, publicKeyArmored:String } (otherwise) - * @static + * If a revocation certificate is passed, the reasonForRevocation parameters will be ignored. + * @param key (optional) public or private key to revoke + * @param revocationCertificate (optional) revocation certificate to revoke the key with + * @param reasonForRevocation (optional) object indicating the reason for revocation + * @param reasonForRevocation.flag (optional) flag indicating the reason for revocation + * @param reasonForRevocation.string (optional) string explaining the reason for revocation + * @returns The revoked key object in the form: + * { privateKey:Key, privateKeyArmored:String, publicKey:Key, publicKeyArmored:String } + * (if private key is passed) or { publicKey:Key, publicKeyArmored:String } (otherwise) */ -export function revokeKey(options: { - key?: key.Key, - revocationCertificate?: string - reasonForRevocation?: { - flag: enums.reasonForRevocation, - 'string': string - }, -}): Promise; +export function revokeKey(key?: key.Key, revocationCertificate?: string, reasonForRevocation?: revokeKey_reasonForRevocation): Promise<{ + privateKey: key.Key, + privateKeyArmored: string, + publicKey: key.Key, + publicKeyArmored: string +} | { + publicKey: key.Key, + publicKeyArmored: string +}>; /** * Unlock a private key with your passphrase. - * @param {Key} privateKey the private key that is to be decrypted - * @param {String|Array} passphrase the user's passphrase(s) chosen during key generation - * @returns {Promise} the unlocked key object in the form: { key:Key } - * @async + * @param privateKey the private key that is to be decrypted + * @param passphrase the user's passphrase(s) chosen during key generation + * @returns the unlocked key object in the form: { key:Key } */ -export function decryptKey(options: { - privateKey: key.Key, - passphrase?: string | string[], -}): Promise; +export function decryptKey(privateKey: key.Key, passphrase: string | any[]): Promise<{ key: key.Key }>; /** * Lock a private key with your passphrase. - * @param {Key} privateKey the private key that is to be decrypted - * @param {String|Array} passphrase the user's passphrase(s) chosen during key generation - * @returns {Promise} the locked key object in the form: { key:Key } - * @async + * @param privateKey the private key that is to be decrypted + * @param passphrase the user's passphrase(s) chosen during key generation + * @returns the locked key object in the form: { key:Key } */ -export function encryptKey(options: { - privateKey: key.Key, - passphrase?: string | string[], -}): Promise; - -// TODO add typings for encryptSessionKey and decryptSessionKeys - -export namespace armor { - /** Armor an OpenPGP binary packet block - - @param messagetype type of the message - @param body - @param partindex - @param parttotal - */ - function armor(messagetype: enums.armor, body: Object, partindex: number, parttotal: number): string; - - /** DeArmor an OpenPGP armored message; verify the checksum and return the encoded bytes - - @param text OpenPGP armored message - */ - function dearmor(text: string): Object; -} - -export namespace cleartext { - /** Class that represents an OpenPGP cleartext signed message. - */ - interface CleartextMessage { - /** Returns ASCII armored text of cleartext signed message - */ - armor(): string; - - /** Returns the key IDs of the keys that signed the cleartext message - */ - getSigningKeyIds(): Array; - - /** Get cleartext - */ - getText(): string; - - /** Sign the cleartext message - @param privateKeys private keys with decrypted secret key data for signing - */ - sign(privateKeys: Array): void; - - /** Verify signatures of cleartext signed message - @param keys array of keys to verify signatures - */ - verify(keys: Array): Array; - } - - /** creates new message object from text - @param text - */ - function fromText(text: string): CleartextMessage; - - function readArmored(armoredText: string): Promise; -} - -export namespace config { - var prefer_hash_algorithm: enums.hash; - var encryption_cipher: enums.symmetric; - var compression: enums.compression; - var show_version: boolean; - var show_comment: boolean; - var integrity_protect: boolean; - var keyserver: string; - var debug: boolean; -} - -export namespace crypto { - interface Mpi { - data: number, - read(input: string): number, - write(): string, - } - - /** Generating a session key for the specified symmetric algorithm - @param algo Algorithm to use - */ - function generateSessionKey(algo: enums.symmetric): string; - - /** generate random byte prefix as string for the specified algorithm - @param algo Algorithm to use - */ - function getPrefixRandom(algo: enums.symmetric): string; - - /** Returns the number of integers comprising the private key of an algorithm - @param algo The public key algorithm - */ - function getPrivateMpiCount(algo: enums.symmetric): number; - - /** Decrypts data using the specified public key multiprecision integers of the private key, the specified secretMPIs of the private key and the specified algorithm. - @param algo Algorithm to be used - @param publicMPIs Algorithm dependent multiprecision integers of the public key part of the private key - @param secretMPIs Algorithm dependent multiprecision integers of the private key used - @param data Data to be encrypted as MPI - */ - function publicKeyDecrypt(algo: enums.publicKey, publicMPIs: Array, secretMPIs: Array, data: Mpi): Mpi; - - /** Encrypts data using the specified public key multiprecision integers and the specified algorithm. - @param algo Algorithm to be used - @param publicMPIs Algorithm dependent multiprecision integers - @param data Data to be encrypted as MPI - */ - function publicKeyEncrypt(algo: enums.publicKey, publicMPIs: Array, data: Mpi): Array; - - - namespace cfb { - /** This function decrypts a given plaintext using the specified blockcipher to decrypt a message - @param cipherfn the algorithm cipher class to decrypt data in one block_size encryption - @param key binary string representation of key to be used to decrypt the ciphertext. This will be passed to the cipherfn - @param ciphertext to be decrypted provided as a string - @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Decryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - */ - function decrypt(cipherfn: string, key: string, ciphertext: string, resync: boolean): string; - - /** This function encrypts a given with the specified prefixrandom using the specified blockcipher to encrypt a message - @param prefixrandom random bytes of block_size length provided as a string to be used in prefixing the data - @param cipherfn the algorithm cipher class to encrypt data in one block_size encryption - @param plaintext data to be encrypted provided as a string - @param key binary string representation of key to be used to encrypt the plaintext. This will be passed to the cipherfn - @param resync a boolean value specifying if a resync of the IV should be used or not. The encrypteddatapacket uses the "old" style with a resync. Encryption within an encryptedintegrityprotecteddata packet is not resyncing the IV. - */ - function encrypt(prefixrandom: string, cipherfn: string, plaintext: string, key: string, resync: boolean): string; - - /** Decrypts the prefixed data for the Modification Detection Code (MDC) computation - @param cipherfn cipherfn.encrypt Cipher function to use - @param key binary string representation of key to be used to check the mdc This will be passed to the cipherfn - @param ciphertext The encrypted data - */ - function mdc(cipherfn: Object, key: string, ciphertext: string): string; - } - - namespace hash { - /** Create a hash on the specified data using the specified algorithm - @param algo Hash algorithm type - @param data Data to be hashed - */ - function digest(algo: enums.hash, data: string): string; - - /** Returns the hash size in bytes of the specified hash algorithm type - @param algo Hash algorithm type - */ - function getHashByteLength(algo: enums.hash): number; - } - - namespace random { - /** Create a secure random big integer of bits length - @param bits Bit length of the MPI to create - */ - function getRandomBigInteger(bits: number): number; - - /** Retrieve secure random byte string of the specified length - @param length Length in bytes to generate - */ - function getRandomBytes(length: number): string; - - /** Helper routine which calls platform specific crypto random generator - @param buf - */ - function getRandomValues(buf: Uint8Array): void; - - /** Return a secure random number in the specified range - @param from Min of the random number - @param to Max of the random number (max 32bit) - */ - function getSecureRandom(from: number, to: number): number; - } - - namespace signature { - /** Create a signature on data using the specified algorithm - @param hash_algo hash Algorithm to use - @param algo Asymmetric cipher algorithm to use - @param publicMPIs Public key multiprecision integers of the private key - @param secretMPIs Private key multiprecision integers which is used to sign the data - @param data Data to be signed - */ - function sign(hash_algo: enums.hash, algo: enums.publicKey, publicMPIs: Array, secretMPIs: Array, data: string): Mpi; - - /** - @param algo public Key algorithm - @param hash_algo Hash algorithm - @param msg_MPIs Signature multiprecision integers - @param publickey_MPIs Public key multiprecision integers - @param data Data on where the signature was computed on - */ - function verify(algo: enums.publicKey, hash_algo: enums.hash, msg_MPIs: Array, publickey_MPIs: Array, data: string): boolean; - } -} - -export namespace enums { - enum armor { - multipart_section, - multipart_last, - signed, - message, - public_key, - private_key - } - - enum compression { - uncompressed, - zip, - zlib, - bzip2 - } - - enum hash { - md5, - sha1, - ripemd, - sha256, - sha384, - sha512, - sha224 - } - - enum packet { - publicKeyEncryptedSessionKey, - signature, - symEncryptedSessionKey, - onePassSignature, - secretKey, - publicKey, - secretSubkey, - compressed, - symmetricallyEncrypted, - marker, - literal, - trust, - userid, - publicSubkey, - userAttribute, - symEncryptedIntegrityProtected, - modificationDetectionCode, - } - - enum publicKey { - rsa_encrypt_sign, - rsa_encrypt, - rsa_sign, - elgamal, - dsa - } - - enum symmetric { - plaintext, - idea, - tripledes, - cast5, - blowfish, - aes128, - aes192, - aes256, - twofish - } - - enum keyStatus { - invalid, - expired, - revoked, - valid, - no_self_cert - } - - enum reasonForRevocation { - no_reason, - key_superseded, - key_compromised, - key_retired, - userid_invalid - } -} - -export namespace key { - interface KeyResult { - keys: Array, - err: Array - } - - /** Class that represents an OpenPGP key. Must contain a primary key. Can contain additional subkeys, signatures, user ids, user attributes. - */ - interface Key { - armor(): string, - decrypt(passphrase: string): boolean; - getExpirationTime(): Date; - getKeyIds(): Array; - getPreferredHashAlgorithm(): string; - getPrimaryUser(): any; - getUserIds(): Array; - isPrivate(): boolean; - isPublic(): boolean; - primaryKey: packet.PublicKey; - toPublic(): Key; - update(key: Key): void; - verifyPrimaryKey(): enums.keyStatus; - } - - /** Generates a new OpenPGP key. Currently only supports RSA keys. Primary and subkey will be of same type. - - @param options - */ - function generate(options: KeyOptions): Key; - - /** Reads an OpenPGP armored text and returns one or multiple key objects - - @param armoredText text to be parsed - */ - function readArmored(armoredText: string): Promise; -} - -export namespace message { - /** Class that represents an OpenPGP message. Can be an encrypted message, signed message, compressed message or literal message - */ - interface Message { - /** Returns ASCII armored text of message - */ - armor(): string, - - /** Decrypt the message - @param privateKey private key with decrypted secret data - */ - decrypt(privateKey: key.Key): Array, - - /** Encrypt the message - @param keys array of keys, used to encrypt the message - */ - encrypt(keys: Array): Array, - - /** Returns the key IDs of the keys to which the session key is encrypted - */ - getEncryptionKeyIds(): Array, - - /** Get literal data that is the body of the message - */ - getLiteralData(): string, - - /** Returns the key IDs of the keys that signed the message - */ - getSigningKeyIds(): Array, - - /** Get literal data as text - */ - getText(): string, - - /** Sign the message (the literal data packet of the message) - @param privateKey private keys with decrypted secret key data for signing - */ - sign(privateKey: Array): Message, - - /** Unwrap compressed message - */ - unwrapCompressed(): Message, - - /** Verify message signatures - @param keys array of keys to verify signatures - */ - verify(keys: Array): Array, - - packets: { - write(): Uint8Array, - }, - } - - /** creates new message object from binary data - @param bytes - */ - function fromBinary(bytes: Uint8Array | ReadableStream): Message; - - /** creates new message object from text - @param text - */ - function fromText(text: string): Message; - - /** reads an OpenPGP armored message and returns a message object - - @param armoredText text to be parsed - */ - function readArmored(armoredText: string): Promise; +export function encryptKey(privateKey: key.Key, passphrase: string | any[]): Promise<{ key: key.Key }>; +export interface EncryptOptions { /** - * reads an OpenPGP message as byte array and returns a message object - * @param {Uint8Array} input binary message - * @returns {Message} new message object - * @static + * message to be encrypted as created by openpgp.message.fromText or openpgp.message.fromBinary */ - function read(data: Uint8Array): Promise; + message: message.Message; + /** + * (optional) array of keys or single key, used to encrypt the message + */ + publicKeys?: key.Key | any[]; + /** + * (optional) private keys for signing. If omitted message will not be signed + */ + privateKeys?: key.Key | any[]; + /** + * (optional) array of passwords or a single password to encrypt the message + */ + passwords?: string | any[]; + /** + * (optional) session key in the form: { data:Uint8Array, algorithm:String } + */ + sessionKey?: { data: Uint8Array, algorithm: string }; + /** + * (optional) which compression algorithm to compress the message with, defaults to what is specified in config + */ + compression?: enums.compression; + /** + * (optional) if the return values should be ascii armored or the message/signature objects + */ + armor?: boolean; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + */ + streaming?: 'web' | 'node' | false; + /** + * (optional) if the signature should be detached (if true, signature will be added to returned object) + */ + detached?: boolean; + /** + * (optional) a detached signature to add to the encrypted message + */ + signature?: signature.Signature; + /** + * (optional) if the unencrypted session key should be added to returned object + */ + returnSessionKey?: boolean; + /** + * (optional) use a key ID of 0 instead of the public key IDs + */ + wildcard?: boolean; + /** + * (optional) override the creation date of the message signature + */ + date?: Date; + /** + * (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + */ + fromUserIds?: UserID[]; + /** + * (optional) array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [ { name:'Robert Receiver', email:'robert@openpgp.org' }] + */ + toUserIds?: UserID[] } -export namespace packet { - interface PublicKey { - algorithm: enums.publicKey; - created: Date; - fingerprint: string; - - getBitSize(): number; - getFingerprint(): string; - getKeyId(): string; - read(input: string): any; - write(): any; - } - - interface SecretKey extends PublicKey { - read(bytes: string): void; - write(): string; - clearPrivateMPIs(str_passphrase: string): boolean; - encrypt(passphrase: string): void; - } - - /** Allocate a new packet from structured packet clone - @param packetClone packet clone - */ - function fromStructuredClone(packetClone: Object): Object - - /** Allocate a new packet - @param property name from enums.packet - */ - function newPacketFromTag(tag: string): Object; +export interface EncryptResult { + data: string | ReadableStream; + message: message.Message; + signature: string | ReadableStream | signature.Signature; + sessionKey: { data: Uint8Array, algorithm: string, aeadAlgorithm: string }; } -export namespace util { - /** Convert an array of integers(0.255) to a string - @param bin An array of (binary) integers to convert - */ - function bin2str(bin: Array): string; +/** + * Encrypts message text/data with public keys, passwords or both at once. At least either public keys or passwords + * must be specified. If private keys are specified, those will be used to sign the message. + * @param options + * @returns Object containing encrypted (and optionally signed) message in the form: + * { + * data: string|ReadableStream|NodeStream, (if `armor` was true, the default) + * message: Message, (if `armor` was false) + * signature: string|ReadableStream|NodeStream, (if `detached` was true and `armor` was true) + * signature: Signature (if `detached` was true and `armor` was false) + * sessionKey: { data, algorithm, aeadAlgorithm } (if `returnSessionKey` was true) + * } + */ +export function encrypt(options: EncryptOptions): Promise; - /** Calculates a 16bit sum of a string by adding each character codes modulus 65535 - @param text string to create a sum of +export interface DecryptOptions { + /** + * the message object with the encrypted data */ - function calc_checksum(text: string): number; - - /** Convert a string of utf8 bytes to a native javascript string - @param utf8 A valid squence of utf8 bytes + message: message.Message; + /** + * (optional) private keys with decrypted secret key data or session key */ - function decode_utf8(utf8: string): string - - /** Convert a native javascript string to a string of utf8 bytes - param str The string to convert + privateKeys?: key.Key | key.Key[]; + /** + * (optional) passwords to decrypt the message */ - function encode_utf8(str: string): string - - /** Return the algorithm type as string + passwords?: string | string[]; + /** + * (optional) session keys in the form: { data:Uint8Array, algorithm:String } */ - function get_hashAlgorithmString(): string - - /** Get native Web Cryptography api. The default configuration is to use the api when available. But it can also be deactivated with config.useWebCrypto + sessionKeys?: { data: Uint8Array, algorithm: string } | { data: Uint8Array, algorithm: string }[]; + /** + * (optional) array of public keys or single key, to verify signatures */ - function getWebCrypto(): Object - - /** Create binary string from a hex encoded string - @param str Hex string to convert + publicKeys?: key.Key | key.Key[]; + /** + * (optional) whether to return data as a string(Stream) or Uint8Array(Stream). If 'utf8' (the default), also normalize newlines. */ - function hex2bin(str: string): string; - - /** Creating a hex string from an binary array of integers (0..255) - @param str Array of bytes to convert + format?: 'utf8' | 'binary'; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. */ - function hexidump(str: string): string; - - /** Create hexstring from a binary - @param str string to convert + streaming?: 'web' | 'node' | false; + /** + * (optional) detached signature for verification */ - function hexstrdump(str: string): string; - - /** Helper function to print a debug message. Debug messages are only printed if - @param str string of the debug message + signature?: signature.Signature; + /** + * (optional) use the given date for verification instead of the current time */ - function print_debug(str: string): void; - - /** Helper function to print a debug message. Debug messages are only printed if - @param str string of the debug message - */ - function print_debug_hexstr_dump(str: string): void; - - /** Shifting a string to n bits right - @param value The string to shift - @param bitcount Amount of bits to shift (MUST be smaller than 9) - */ - function shiftRight(value: string, bitcount: number): string; - - /** Convert a string to an array of integers(0.255) - @param str string to convert - */ - function str2bin(str: string): Array; - - /** Convert a string to a Uint8Array - @param str string to convert - */ - function str2Uint8Array(str: string): Uint8Array; - - /** Convert a Uint8Array to a string. This currently functions the same as bin2str. - @param bin An array of (binary) integers to convert - */ - function Uint8Array2str(bin: Uint8Array): string; + date?: Date } + +export interface DecryptResult { + data: string | ReadableStream | NodeStream | Uint8Array | ReadableStream, + filename: string, + signatures: { + keyid: type.keyid.Keyid, + verified: Promise, + valid: boolean + }[] +} + +/** + * Decrypts a message with the user's private key, a session key or a password. Either a private key, + * a session key or a password must be specified. + * @param options + * @returns Object containing decrypted and verified message in the form: + * { + * data: string|ReadableStream|NodeStream, (if format was 'utf8', the default) + * data: Uint8Array|ReadableStream|NodeStream, (if format was 'binary') + * filename: string, + * signatures: [ + * { + * keyid: module:type/keyid, + * verified: Promise, + * valid: boolean (if streaming was false) + * }, ... + * ] + * } + */ +export function decrypt(options: DecryptOptions): Promise; + +export interface SignOptions { + /** + * (cleartext) message to be signed + */ + message: cleartext.CleartextMessage | message.Message; + /** + * array of keys or single key with decrypted secret key data to sign cleartext + */ + privateKeys: key.Key | any[]; + /** + * (optional) if the return value should be ascii armored or the message object + */ + armor?: boolean; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + */ + streaming?: 'web' | 'node' | false; + /** + * (optional) if the return value should contain a detached signature + */ + detached?: boolean; + /** + * (optional) override the creation date of the signature + */ + date?: Date; + /** + * (optional) array of user IDs to sign with, one per key in `privateKeys`, e.g. [ { name:'Steve Sender', email:'steve@openpgp.org' }] + */ + fromUserIds?: UserID[] +} + +export interface SignResult { + data: string | ReadableStream | NodeStream, + message: message.Message, + signature: string | ReadableStream | NodeStream | signature.Signature +} + +/** + * Signs a cleartext message. + * @param options + * @returns Object containing signed message in the form: + * { + * data: string|ReadableStream|NodeStream, (if `armor` was true, the default) + * message: Message (if `armor` was false) + * } + * Or, if `detached` was true: + * { + * signature: string|ReadableStream|NodeStream, (if `armor` was true, the default) + * signature: Signature (if `armor` was false) + * } + */ +export function sign(options: SignOptions): Promise; + +export interface VerifyOptions { + /** + * array of publicKeys or single key, to verify signatures + */ + publicKeys: key.Key | any[]; + /** + * (cleartext) message object with signatures + */ + message: cleartext.CleartextMessage | message.Message; + /** + * (optional) whether to return data as a stream. Defaults to the type of stream `message` was created from, if any. + */ + streaming?: 'web' | 'node' | false; + /** + * (optional) detached signature for verification + */ + signature?: signature.Signature; + /** + * (optional) use the given date for verification instead of the current time + */ + date?: Date +} + +export interface VerifyResult { + data: string | ReadableStream | NodeStream | Uint8Array | ReadableStream | NodeStream, + signatures: { + keyid: type.keyid.Keyid, + verified: Promise, + valid: boolean + }[] +} + +/** + * Verifies signatures of cleartext signed message + * @param options + * @returns Object containing verified message in the form: + * { + * data: string|ReadableStream|NodeStream, (if `message` was a CleartextMessage) + * data: Uint8Array|ReadableStream|NodeStream, (if `message` was a Message) + * signatures: [ + * { + * keyid: module:type/keyid, + * verified: Promise, + * valid: boolean (if `streaming` was false) + * }, ... + * ] + * } + */ +export function verify(options: VerifyOptions): Promise; + +/** + * Encrypt a symmetric session key with public keys, passwords, or both at once. At least either public keys + * or passwords must be specified. + * @param data the session key to be encrypted e.g. 16 random bytes (for aes128) + * @param algorithm algorithm of the symmetric session key e.g. 'aes128' or 'aes256' + * @param aeadAlgorithm (optional) aead algorithm, e.g. 'eax' or 'ocb' + * @param publicKeys (optional) array of public keys or single key, used to encrypt the key + * @param passwords (optional) passwords for the message + * @param wildcard (optional) use a key ID of 0 instead of the public key IDs + * @param date (optional) override the date + * @param toUserIds (optional) array of user IDs to encrypt for, one per key in `publicKeys`, e.g. [ { name:'Phil Zimmermann', email:'phil@openpgp.org' }] + * @returns the encrypted session key packets contained in a message object + */ +export function encryptSessionKey(data: Uint8Array, algorithm: string, aeadAlgorithm?: string, publicKeys?: key.Key | key.Key[], passwords?: string | string[], wildcard?: boolean, date?: Date, toUserIds?: any[]): Promise; + +/** + * Decrypt symmetric session keys with a private key or password. Either a private key or + * a password must be specified. + * @param message a message object containing the encrypted session key packets + * @param privateKeys (optional) private keys with decrypted secret key data + * @param passwords (optional) passwords to decrypt the session key + * @returns Array of decrypted session key, algorithm pairs in form: + * { data:Uint8Array, algorithm:String } + * or 'undefined' if no key packets found + */ +export function decryptSessionKeys(message: message.Message, privateKeys?: key.Key | key.Key[], passwords?: string | string[]): Promise<{ data: Uint8Array, algorithm: string }[] | undefined>; + +/** + * Input validation + */ +export function checkString(): void; + +/** + * Normalize parameter to an array if it is not undefined. + * @param param the parameter to be normalized + * @returns the resulting array or undefined + */ +export function toArray(param: object): any[] | undefined; + +/** + * Convert data to or from Stream + * @param data the data to convert + * @param streaming (optional) whether to return a ReadableStream + * @returns the data in the respective format + */ +export function convertStream(data: object, streaming?: 'web' | 'node' | false): object; + +/** + * Convert object properties from Stream + * @param obj the data to convert + * @param streaming (optional) whether to return ReadableStreams + * @param keys (optional) which keys to return as streams, if possible + * @returns the data in the respective format + */ +export function convertStreams(obj: object, streaming: 'web' | 'node' | false, keys: any[]): object; + +/** + * Link result.data to the message stream for cancellation. + * Also, forward errors in the message to result.data. + * @param result the data to convert + * @param message message object + * @param erroringStream (optional) stream which either errors or gets closed without data + * @returns + */ +export function linkStreams(result: object, message: message.Message, erroringStream: ReadableStream): object; + +/** + * Wait until signature objects have been verified + * @param signatures list of signatures + */ +export function prepareSignatures(signatures: object): void; + +/** + * Global error handler that logs the stack trace and rethrows a high lvl error message. + * @param message A human readable high level error Message + * @param error The internal error that caused the failure + */ +export function onError(message: string, error: Error): void; + +/** + * Check for native AEAD support and configuration by the user. Only + * browsers that implement the current WebCrypto specification support + * native GCM. Native EAX is built on CTR and CBC, which current + * browsers support. OCB and CFB are not natively supported. + * @returns If authenticated encryption should be used + */ +export function nativeAEAD(): boolean; diff --git a/types/openpgp/ts3.2/openpgp-tests.ts b/types/openpgp/ts3.2/openpgp-tests.ts index 7dffc0109b..62e580fd4b 100644 --- a/types/openpgp/ts3.2/openpgp-tests.ts +++ b/types/openpgp/ts3.2/openpgp-tests.ts @@ -1,3 +1,5 @@ +import openpgp from "openpgp"; + // Open PGP Sample codes var options: openpgp.KeyOptions = { @@ -8,7 +10,6 @@ var options: openpgp.KeyOptions = { }], passphrase: 'super long and hard to guess secret' }; - openpgp.generateKey(options).then(function (keypair) { // success var privkey = keypair.privateKeyArmored; @@ -38,7 +39,7 @@ openpgp.key.readArmored(spubkey) var sprivkey = '-----BEGIN PGP PRIVATE KEY BLOCK ... END PGP PRIVATE KEY BLOCK-----'; var pgpMessageStr = '-----BEGIN PGP MESSAGE ... END PGP MESSAGE-----'; -openpgp.message.readArmored(pgpMessageStr).then(function(pgpMessage) { +openpgp.message.readArmored(pgpMessageStr).then(function (pgpMessage) { const options = { message: pgpMessage }; @@ -49,11 +50,12 @@ openpgp.message.readArmored(pgpMessageStr).then(function(pgpMessage) { // failure }); -const promises: [Promise, Promise] = [ +const promises: [Promise<{ keys: Array, err: Array | null }>, Promise] = [ openpgp.key.readArmored(sprivkey), openpgp.message.readArmored(pgpMessageStr) ]; + Promise.all(promises).then(function (values) { const keyObject: openpgp.key.KeyResult = values[0]; const pgpMessage: openpgp.message.Message = values[1]; @@ -70,7 +72,7 @@ Promise.all(promises).then(function (values) { // failure }); -openpgp.initWorker({ path:'openpgp.worker.js' }); +openpgp.initWorker('openpgp.worker.js'); (async () => { let msgOptions: openpgp.EncryptOptions; @@ -120,7 +122,7 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); const signed = await openpgp.sign(signOptions); - const signature = signed.signature as openpgp.Signature; + const signature = signed.signature as openpgp.signature.Signature; const message = signed.message; const verifyOptions: openpgp.VerifyOptions = { @@ -138,34 +140,38 @@ openpgp.initWorker({ path:'openpgp.worker.js' }); var keyoptions: openpgp.KeyOptions; -var mpi: openpgp.crypto.Mpi; -var mpis: Array; +var mpi: openpgp.type.mpi.MPI; +var mpis: Array; -openpgp.armor.armor(openpgp.enums.armor.message, {}, 0, 1); -openpgp.armor.dearmor(""); +openpgp.encoding.armor.armor(openpgp.enums.armor.message, {}, 0, 1); +openpgp.encoding.armor.dearmor(""); openpgp.cleartext.readArmored(""); -openpgp.crypto.generateSessionKey(openpgp.enums.symmetric.aes128); -openpgp.crypto.getPrefixRandom(openpgp.enums.symmetric.aes128); -openpgp.crypto.getPrivateMpiCount(openpgp.enums.symmetric.aes128); -openpgp.crypto.publicKeyDecrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpis, mpi); -openpgp.crypto.publicKeyEncrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpi); +openpgp.crypto.crypto.generateSessionKey(openpgp.enums.symmetric.aes128); +openpgp.crypto.crypto.getPrefixRandom(openpgp.enums.symmetric.aes128); +// openpgp.crypto.crypto.getPrivateMpiCount(openpgp.enums.symmetric.aes128); +openpgp.crypto.crypto.publicKeyDecrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpis, ""); +openpgp.crypto.crypto.publicKeyEncrypt(openpgp.enums.publicKey.rsa_encrypt, mpis, mpi, ""); +openpgp.crypto +// API update with no documentation openpgp.crypto.cfb.decrypt("", "", "", true); -openpgp.crypto.cfb.encrypt("", "", "", "", true); -openpgp.crypto.cfb.mdc({}, "", ""); +openpgp.crypto.cfb.encrypt("", "", "", true); +// Function removed from openpgp.crypto.cfb +// openpgp.crypto.cfb.mdc({}, "", ""); -openpgp.crypto.hash.digest(openpgp.enums.hash.md5, ""); +openpgp.crypto.hash.digest(openpgp.enums.hash.md5, new Uint8Array([0, 1])); openpgp.crypto.hash.getHashByteLength(openpgp.enums.hash.md5); -openpgp.crypto.random.getRandomBigInteger(0); +openpgp.crypto.random.getRandomBN(mpi, mpi); openpgp.crypto.random.getRandomBytes(0); -openpgp.crypto.random.getRandomValues(openpgp.util.str2Uint8Array("")); -openpgp.crypto.random.getSecureRandom(0, 1); +// function removed from openpgp.crypto.random +// openpgp.crypto.random.getRandomValues(openpgp.util.str_to_Uint8Array("")); +// openpgp.crypto.random.getSecureRandom(0, 1); -openpgp.crypto.signature.sign(openpgp.enums.hash.md5, openpgp.enums.publicKey.rsa_encrypt, mpis, mpis, ""); -openpgp.crypto.signature.verify(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, mpis, ""); +openpgp.crypto.signature.sign(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, new Uint8Array([0, 1]), new Uint8Array([0, 1])); +openpgp.crypto.signature.verify(openpgp.enums.publicKey.rsa_encrypt, openpgp.enums.hash.md5, mpis, mpis, new Uint8Array([0, 1]), new Uint8Array([0, 1])); openpgp.key.generate(keyoptions); openpgp.key.readArmored(""); @@ -177,18 +183,15 @@ openpgp.message.readArmored(""); openpgp.packet.fromStructuredClone({}); openpgp.packet.newPacketFromTag(""); -openpgp.util.bin2str([0, 1]); -openpgp.util.calc_checksum(""); -openpgp.util.decode_utf8(""); +openpgp.util.Uint8Array_to_str(new Uint8Array([1, 0])); +openpgp.util.decode_utf8(new Uint8Array([1, 0])); openpgp.util.encode_utf8(""); -openpgp.util.get_hashAlgorithmString(); openpgp.util.getWebCrypto(); -openpgp.util.hex2bin(""); -openpgp.util.hexidump(""); -openpgp.util.hexstrdump(""); +openpgp.util.hex_to_Uint8Array(""); +openpgp.util.print_debug_hexarray_dump(""); +openpgp.util.print_debug_hexstr_dump(""); openpgp.util.print_debug(""); openpgp.util.print_debug_hexstr_dump(""); -openpgp.util.shiftRight("", 1); -openpgp.util.str2bin(""); -openpgp.util.str2Uint8Array(""); -openpgp.util.Uint8Array2str(openpgp.util.str2Uint8Array("")); +openpgp.util.shiftRight(new Uint8Array([1, 0]), 1); +openpgp.util.str_to_Uint8Array(""); +openpgp.util.Uint8Array_to_str(openpgp.util.str_to_Uint8Array("")); diff --git a/types/openpgp/ts3.2/tsconfig.json b/types/openpgp/ts3.2/tsconfig.json index 9267c27cd0..5819fdf2ca 100644 --- a/types/openpgp/ts3.2/tsconfig.json +++ b/types/openpgp/ts3.2/tsconfig.json @@ -4,6 +4,7 @@ "lib": [ "es6", "dom" ], + "esModuleInterop": true, "noImplicitAny": true, "noImplicitThis": true, "strictNullChecks": false, diff --git a/types/openpgp/tsconfig.json b/types/openpgp/tsconfig.json index e9ff22b4ce..0f0960782b 100644 --- a/types/openpgp/tsconfig.json +++ b/types/openpgp/tsconfig.json @@ -6,8 +6,9 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, "strictFunctionTypes": true, + "strictNullChecks": false, + "allowSyntheticDefaultImports": true, "baseUrl": "../", "typeRoots": [ "../" diff --git a/types/openpgp/tslint.json b/types/openpgp/tslint.json index 3242154128..4e740106cc 100644 --- a/types/openpgp/tslint.json +++ b/types/openpgp/tslint.json @@ -5,6 +5,7 @@ "array-type": false, "ban-types": false, "dt-header": false, + "npm-naming": false, "jsdoc-format": false, "max-line-length": false, "no-consecutive-blank-lines": false, @@ -17,6 +18,7 @@ "space-before-function-paren": false, "typedef-whitespace": false, "unified-signatures": false, - "whitespace": false + "whitespace": false, + "no-trailing-whitespace": false } } \ No newline at end of file diff --git a/types/opentok/index.d.ts b/types/opentok/index.d.ts index 85b9794316..58fdfaa7ba 100644 --- a/types/opentok/index.d.ts +++ b/types/opentok/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/opentok/opentok-node // Definitions by: Seth Westphal // Anthony Messerschmidt +// Andrej Mihajlov // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare module 'opentok' { @@ -81,13 +82,13 @@ declare module 'opentok' { class OpenTok { constructor(apiKey: string, apiSecret: string); - public createSession(options: OpenTok.SessionOptions, callback: (err: Error, session: OpenTok.Session) => void): void; + public createSession(options: OpenTok.SessionOptions, callback: (error: Error | null, session?: OpenTok.Session) => void): void; public generateToken(sessionId: string, options: OpenTok.TokenOptions): OpenTok.Token; - public startArchive(sessionId: string, options: OpenTok.ArchiveOptions, callback: (err: Error, archive: OpenTok.Archive) => void): void; - public stopArchive(archiveId: string, callback: (err: Error, archive: OpenTok.Archive) => void): void; - public getArchive(archiveId: string, callback: (err: Error, archive: OpenTok.Archive) => void): void; - public deleteArchive(archiveId: string, callback: (err: Error) => void): void; - public listArchives(options: OpenTok.ListArchivesOptions, callback: (err: Error, archives: OpenTok.Archive[], totalCount: number) => void): void; + public startArchive(sessionId: string, options: OpenTok.ArchiveOptions, callback: (error: Error | null, archive?: OpenTok.Archive) => void): void; + public stopArchive(archiveId: string, callback: (error: Error | null, archive?: OpenTok.Archive) => void): void; + public getArchive(archiveId: string, callback: (error: Error | null, archive?: OpenTok.Archive) => void): void; + public deleteArchive(archiveId: string, callback: (error: Error | null) => void): void; + public listArchives(options: OpenTok.ListArchivesOptions, callback: (error: Error | null, archives?: OpenTok.Archive[], totalCount?: number) => void): void; } export = OpenTok; diff --git a/types/opentok/tslint.json b/types/opentok/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/opentok/tslint.json +++ b/types/opentok/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/openui5/tslint.json b/types/openui5/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/openui5/tslint.json +++ b/types/openui5/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/optimist/tslint.json b/types/optimist/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/optimist/tslint.json +++ b/types/optimist/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ora/index.d.ts b/types/ora/index.d.ts deleted file mode 100644 index 13104b0b5c..0000000000 --- a/types/ora/index.d.ts +++ /dev/null @@ -1,290 +0,0 @@ -// Type definitions for ora 3.1 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed -// Christian Rackerseder -// BendingBender -// Aleh Zasypkin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -/// - -export = ora; - -/** - * Elegant terminal spinner. - * - * @param options If a string is provided, it is treated as a shortcut for `options.text`. - */ -declare function ora(options?: ora.Options | string): ora.Ora; - -declare namespace ora { - /** - * Starts a spinner for a promise. The spinner is stopped with `.succeed()` if the promise fulfills - * or with `.fail()` if it rejects. - * - * @param action - * @param options If a string is provided, it is treated as a shortcut for `options.text`. - * @returns The spinner instance. - */ - function promise(action: PromiseLike, options?: Options | string): Ora; - - interface Ora { - /** - * A boolean of whether the instance is currently spinning. - */ - readonly isSpinning: boolean; - - /** - * Change the text. - */ - text: string; - - /** - * Change the spinner color. - */ - color: Color; - - /** - * Change the spinner. - */ - spinner: SpinnerName | Spinner; - - /** - * Change the spinner indent. - */ - indent: number; - - /** - * Start the spinner. - * - * @param text Set the current text. - * @returns The spinner instance. - */ - start(text?: string): Ora; - - /** - * Stop and clear the spinner. - * - * @returns The spinner instance. - */ - stop(): Ora; - - /** - * Stop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - succeed(text?: string): Ora; - - /** - * Stop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - fail(text?: string): Ora; - - /** - * Stop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - warn(text?: string): Ora; - - /** - * Stop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. - * - * @param text will persist text if provided - * @returns The spinner instance. - */ - info(text?: string): Ora; - - /** - * Stop the spinner and change the symbol or text. - * - * @param options - * @returns The spinner instance. - */ - stopAndPersist(options?: PersistOptions): Ora; - - /** - * Clear the spinner. - * @returns The spinner instance. - */ - clear(): Ora; - - /** - * Manually render a new frame. - * @returns The spinner instance. - */ - render(): Ora; - - /** - * Get a new frame. - * @returns The spinner instance. - */ - frame(): Ora; - } - - interface Options { - /** - * Text to display after the spinner. - */ - text?: string; - /** - * Name of one of the provided spinners. See `example.js` in this repo if you want to test out different spinners. - * On Windows, it will always use the line spinner as the Windows command-line doesn't have proper Unicode support. - * - * Or an object like: - * - * @example - * { - * interval: 80, // optional - * frames: ['-', '+', '-'] - * } - * - * @default 'dots' - */ - spinner?: SpinnerName | Spinner; - /** - * Color of the spinner. - * @default 'cyan' - */ - color?: Color; - /** - * Set to `false` to stop Ora from hiding the cursor. - * @default true - */ - hideCursor?: boolean; - /** - * Indent the spinner with the given number of spaces. - * @default 0 - */ - indent?: number; - /** - * Interval between each frame. - * - * Spinners provide their own recommended interval, so you don't really need to specify this. - * @default Provided by the spinner or 100 - */ - interval?: number; - /** - * Stream to write the output. - * - * You could for example set this to `process.stdout` instead. - * @default process.stderr - */ - stream?: NodeJS.WritableStream; - /** - * Force enable/disable the spinner. If not specified, the spinner will be enabled - * if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment. - * - * Note that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, - * colors, and other ansi escape codes. It will still log text. - */ - isEnabled?: boolean; - } - - interface PersistOptions { - /** - * Symbol to replace the spinner with. - * @default ' ' - */ - symbol?: string; - /** - * Text to be persisted. - * @default Current text - */ - text?: string; - } - - interface Spinner { - interval?: number; - frames: string[]; - } - - type SpinnerName = - | 'dots' - | 'dots2' - | 'dots3' - | 'dots4' - | 'dots5' - | 'dots6' - | 'dots7' - | 'dots8' - | 'dots9' - | 'dots10' - | 'dots11' - | 'dots12' - | 'line' - | 'line2' - | 'pipe' - | 'simpleDots' - | 'simpleDotsScrolling' - | 'star' - | 'star2' - | 'flip' - | 'hamburger' - | 'growVertical' - | 'growHorizontal' - | 'balloon' - | 'balloon2' - | 'noise' - | 'bounce' - | 'boxBounce' - | 'boxBounce2' - | 'triangle' - | 'arc' - | 'circle' - | 'squareCorners' - | 'circleQuarters' - | 'circleHalves' - | 'squish' - | 'toggle' - | 'toggle2' - | 'toggle3' - | 'toggle4' - | 'toggle5' - | 'toggle6' - | 'toggle7' - | 'toggle8' - | 'toggle9' - | 'toggle10' - | 'toggle11' - | 'toggle12' - | 'toggle13' - | 'arrow' - | 'arrow2' - | 'arrow3' - | 'bouncingBar' - | 'bouncingBall' - | 'smiley' - | 'monkey' - | 'hearts' - | 'clock' - | 'earth' - | 'moon' - | 'runner' - | 'pong' - | 'shark' - | 'dqpb' - | 'weather' - | 'christmas' - | 'grenade' - | 'point' - | 'layer'; - - type Color = - | 'black' - | 'red' - | 'green' - | 'yellow' - | 'blue' - | 'magenta' - | 'cyan' - | 'white' - | 'gray'; -} diff --git a/types/ora/ora-tests.ts b/types/ora/ora-tests.ts deleted file mode 100644 index 4e06c11248..0000000000 --- a/types/ora/ora-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { PassThrough } from 'stream'; -import ora = require('ora'); - -const spinner = ora('Loading unicorns'); -ora({ text: 'Loading unicorns' }); -ora({ spinner: 'squish' }); -ora({ spinner: { frames: ['-', '+', '-'] } }); -ora({ spinner: { interval: 80, frames: ['-', '+', '-'] } }); -ora({ color: 'cyan' }); -ora({ color: 'foo' }); // $ExpectError -ora({ hideCursor: true }); -ora({ indent: 1 }); -ora({ interval: 80 }); -ora({ stream: new PassThrough() }); -ora({ isEnabled: true }); - -spinner.color = 'yellow'; -spinner.text = 'Loading rainbows'; -spinner.isSpinning; // $ExpectType boolean -spinner.isSpinning = true; // $ExpectError -spinner.spinner = 'dots'; -spinner.indent = 5; - -spinner.start(); -spinner.start('Test text'); -spinner.stop(); -spinner.succeed(); -spinner.succeed('fooed'); -spinner.fail(); -spinner.fail('failed to foo'); -spinner.warn(); -spinner.warn('warn foo'); -spinner.info(); -spinner.info('info foo'); -spinner.stopAndPersist(); -spinner.stopAndPersist({ text: 'all done' }); -spinner.stopAndPersist({ symbol: '@', text: 'all done' }); -spinner.clear(); -spinner.render(); -spinner.frame(); - -const resolves = Promise.resolve(1); -ora.promise(resolves, 'foo'); -ora.promise(resolves, { - stream: new PassThrough(), - text: 'foo', - color: 'blue', - isEnabled: true, -}); diff --git a/types/ora/v0/index.d.ts b/types/ora/v0/index.d.ts deleted file mode 100644 index 771f6beef6..0000000000 --- a/types/ora/v0/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for ora 0.3 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed , Christian Rackerseder -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; -interface Options { - text?: string; - spinner?: string | Spinner; - color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; -} -interface Spinner { - interval?: number; - frames: string[]; -} -interface Instance { - start(): Instance; - stop(): Instance; - succeed(): Instance; - fail(): Instance; - stopAndPersist(symbol?: string): Instance; - clear(): Instance; - render(): Instance; - frame(): Instance; - text: string; - color: Color; -} -declare function ora(options: Options | string): Instance; -export = ora; diff --git a/types/ora/v0/ora-tests.ts b/types/ora/v0/ora-tests.ts deleted file mode 100644 index b6e2a671dc..0000000000 --- a/types/ora/v0/ora-tests.ts +++ /dev/null @@ -1,8 +0,0 @@ -import ora = require('ora'); - -const spinner = ora('Loading unicorns').start(); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); diff --git a/types/ora/v0/tsconfig.json b/types/ora/v0/tsconfig.json deleted file mode 100644 index b614f6cbc4..0000000000 --- a/types/ora/v0/tsconfig.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "ora": [ - "ora/v0" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "ora-tests.ts" - ] -} \ No newline at end of file diff --git a/types/ora/v1/index.d.ts b/types/ora/v1/index.d.ts deleted file mode 100644 index a3099f6cd9..0000000000 --- a/types/ora/v1/index.d.ts +++ /dev/null @@ -1,137 +0,0 @@ -// Type definitions for ora 1.3 -// Project: https://github.com/sindresorhus/ora -// Definitions by: Basarat Ali Syed -// Christian Rackerseder -// BendingBender -// Aleh Zasypkin -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -type SpinnerName = - 'dots' - | 'dots2' - | 'dots3' - | 'dots4' - | 'dots5' - | 'dots6' - | 'dots7' - | 'dots8' - | 'dots9' - | 'dots10' - | 'dots11' - | 'dots12' - | 'line' - | 'line2' - | 'pipe' - | 'simpleDots' - | 'simpleDotsScrolling' - | 'star' - | 'star2' - | 'flip' - | 'hamburger' - | 'growVertical' - | 'growHorizontal' - | 'balloon' - | 'balloon2' - | 'noise' - | 'bounce' - | 'boxBounce' - | 'boxBounce2' - | 'triangle' - | 'arc' - | 'circle' - | 'squareCorners' - | 'circleQuarters' - | 'circleHalves' - | 'squish' - | 'toggle' - | 'toggle2' - | 'toggle3' - | 'toggle4' - | 'toggle5' - | 'toggle6' - | 'toggle7' - | 'toggle8' - | 'toggle9' - | 'toggle10' - | 'toggle11' - | 'toggle12' - | 'toggle13' - | 'arrow' - | 'arrow2' - | 'arrow3' - | 'bouncingBar' - | 'bouncingBall' - | 'smiley' - | 'monkey' - | 'hearts' - | 'clock' - | 'earth' - | 'moon' - | 'runner' - | 'pong' - | 'shark' - | 'dqpb'; - -type Color = 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'; - -interface Options { - text?: string; - spinner?: SpinnerName | Spinner; - color?: Color; - interval?: number; - stream?: NodeJS.WritableStream; - enabled?: boolean; - hideCursor?: boolean; -} - -interface PersistOptions { - symbol?: string; - text?: string; -} - -interface Spinner { - interval?: number; - frames: string[]; -} - -declare class Ora { - start(text?: string): Ora; - - stop(): Ora; - - succeed(text?: string): Ora; - - fail(text?: string): Ora; - - warn(text?: string): Ora; - - info(text?: string): Ora; - - stopAndPersist(options?: PersistOptions | string): Ora; - - clear(): Ora; - - render(): Ora; - - frame(): Ora; - - text: string; - - color: Color; - - frameIndex: number; -} - -interface oraFactory { - (options?: Options | string): Ora; - - new (options?: Options | string): Ora; - - promise(action: PromiseLike, options?: Options | string): Ora; -} - -declare const ora: oraFactory; - -export = ora; diff --git a/types/ora/v1/ora-tests.ts b/types/ora/v1/ora-tests.ts deleted file mode 100644 index 56a0d498c3..0000000000 --- a/types/ora/v1/ora-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import { PassThrough } from 'stream'; -import Ora = require('ora'); - -const spinner = Ora('Loading unicorns').start(); - -const spinnerNothing = Ora().start(); - -const spinnerNew = new Ora({ - text: 'Loading unicorns', - spinner: 'squish' -}); - -const spinnerNew2 = new Ora({ - stream: new PassThrough(), - text: 'foo', - color: 'cyan', - enabled: true -}); - -spinner.start(); -spinner.start('Test text'); - -setTimeout(() => { - spinner.color = 'yellow'; - spinner.text = 'Loading rainbows'; -}, 1000); - -setTimeout(() => { - spinner.succeed(); -}, 2000); - -spinner.succeed(); -spinner.succeed('fooed'); -spinner.fail(); -spinner.fail('failed to foo'); -spinner.warn(); -spinner.info(); -spinner.stopAndPersist(); -spinner.stopAndPersist('@'); -spinner.stopAndPersist({text: 'all done'}); -spinner.stopAndPersist({symbol: '@', text: 'all done'}); - -const resolves = Promise.resolve(1); -Ora.promise(resolves, { - stream: new PassThrough(), - text: 'foo', - color: 'blue', - enabled: true -}); diff --git a/types/oracledb/tslint.json b/types/oracledb/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/oracledb/tslint.json +++ b/types/oracledb/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/orchestrator/tslint.json b/types/orchestrator/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/orchestrator/tslint.json +++ b/types/orchestrator/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/osmtogeojson/tslint.json b/types/osmtogeojson/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/osmtogeojson/tslint.json +++ b/types/osmtogeojson/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/owlcarousel/tslint.json b/types/owlcarousel/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/owlcarousel/tslint.json +++ b/types/owlcarousel/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/p-any/index.d.ts b/types/p-any/index.d.ts deleted file mode 100644 index 8b4df3504c..0000000000 --- a/types/p-any/index.d.ts +++ /dev/null @@ -1,41 +0,0 @@ -// Type definitions for p-any 1.1 -// Project: https://github.com/sindresorhus/p-any#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import AggregateErrorModule = require('aggregate-error'); - -export = pAny; - -declare function pAny( - values: [Value, Value, Value, Value, Value, Value, Value, Value, Value, Value], - options?: pAny.Options): Promise; -declare function pAny( - values: [Value, Value, Value, Value, Value, Value, Value, Value, Value], - options?: pAny.Options): Promise; -declare function pAny( - values: [Value, Value, Value, Value, Value, Value, Value, Value], - options?: pAny.Options): Promise; -declare function pAny( - values: [Value, Value, Value, Value, Value, Value, Value], - options?: pAny.Options): Promise; -declare function pAny(values: [Value, Value, Value, Value, Value, Value], - options?: pAny.Options): Promise; -declare function pAny(values: [Value, Value, Value, Value, Value], - options?: pAny.Options): Promise; -declare function pAny(values: [Value, Value, Value, Value], - options?: pAny.Options): Promise; -declare function pAny(values: [Value, Value, Value], options?: pAny.Options): Promise; -declare function pAny(values: [Value, Value], options?: pAny.Options): Promise; -declare function pAny(values: Iterable> | Array>, options?: pAny.Options): Promise; - -type Value = T | PromiseLike; - -declare namespace pAny { - interface Options { - filter?(value: T): boolean; - } - - const AggregateError: typeof AggregateErrorModule; -} diff --git a/types/p-any/p-any-tests.ts b/types/p-any/p-any-tests.ts deleted file mode 100644 index 9e5e6520b9..0000000000 --- a/types/p-any/p-any-tests.ts +++ /dev/null @@ -1,24 +0,0 @@ -import got = require('got'); -import pAny = require('p-any'); - -pAny([ - got.head('github.com').then(() => 'github'), - got.head('google.com').then(() => 'google'), - got.head('twitter.com').then(() => 'twitter'), -]).then(first => { - const str: string = first; -}); - -pAny(new Set([ - got.head('github.com').then(() => 'github'), - got.head('google.com').then(() => 'google'), - got.head('twitter.com').then(() => 'twitter'), -]), { - filter(str: string) { - return true; - } -}).then(first => { - const str: string = first; -}); - -throw new pAny.AggregateError([]); diff --git a/types/p-any/tsconfig.json b/types/p-any/tsconfig.json deleted file mode 100644 index 67d983361a..0000000000 --- a/types/p-any/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-any-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-cancelable/index.d.ts b/types/p-cancelable/index.d.ts deleted file mode 100644 index 8375149e32..0000000000 --- a/types/p-cancelable/index.d.ts +++ /dev/null @@ -1,70 +0,0 @@ -// Type definitions for p-cancelable 1.0 -// Project: https://github.com/sindresorhus/p-cancelable#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = PCancelable; - -declare const PCancelable: PCancelableConstructor; - -interface PCancelableConstructor extends PromiseConstructor { - readonly prototype: PCancelable.PCancelable; - readonly CancelError: PCancelable.CancelErrorConstructor; - - new ( - executor: ( - resolve: (value?: T | PromiseLike) => void, - reject: (reason?: any) => void, - onCancel: PCancelable.OnCancelFn - ) => void - ): PCancelable.PCancelable; - - fn( - userFn: (onCancel: PCancelable.OnCancelFn) => PromiseLike - ): () => PCancelable.PCancelable; - fn( - userFn: (param1: T1, onCancel: PCancelable.OnCancelFn) => PromiseLike - ): (param1: T1) => PCancelable.PCancelable; - fn( - userFn: (param1: T1, param2: T2, onCancel: PCancelable.OnCancelFn) => PromiseLike - ): (param1: T1, param2: T2) => PCancelable.PCancelable; - fn( - userFn: ( - param1: T1, - param2: T2, - param3: T3, - onCancel: PCancelable.OnCancelFn - ) => PromiseLike - ): (param1: T1, param2: T2, param3: T3) => PCancelable.PCancelable; - fn( - userFn: ( - param1: T1, - param2: T2, - param3: T3, - param4: T4, - onCancel: PCancelable.OnCancelFn - ) => PromiseLike - ): (param1: T1, param2: T2, param3: T3, param4: T4) => PCancelable.PCancelable; - fn(userFn: (...args: any[]) => PromiseLike): (args: any[]) => PCancelable.PCancelable; -} - -declare namespace PCancelable { - interface PCancelable extends Promise { - readonly isCanceled: boolean; - cancel(reason?: string): void; - } - - interface OnCancelFn { - (cancelHandler: () => void): void; - shouldReject: boolean; - } - - interface CancelErrorConstructor extends ErrorConstructor { - new (reason?: string): CancelError; - } - - interface CancelError extends Error { - readonly name: 'CancelError'; - readonly isCanceled: boolean; - } -} diff --git a/types/p-cancelable/p-cancelable-tests.ts b/types/p-cancelable/p-cancelable-tests.ts deleted file mode 100644 index 3e15c7d1f8..0000000000 --- a/types/p-cancelable/p-cancelable-tests.ts +++ /dev/null @@ -1,88 +0,0 @@ -/// - -import PCancelable = require('p-cancelable'); -import { EventEmitter } from 'events'; - -const cancelablePromise: PCancelable.PCancelable<{}> = new PCancelable( - (resolve, reject, onCancel) => { - class Worker extends EventEmitter { - close() {} - } - - const worker = new Worker(); - - onCancel.shouldReject = false; - onCancel(() => { - worker.close(); - }); - - worker.on('finish', resolve); - worker.on('error', reject); - } -); - -cancelablePromise - .then(value => { - console.log('Operation finished successfully:', value); - }) - .catch(reason => { - if (cancelablePromise.isCanceled) { - // Handle the cancelation here - console.log('Operation was canceled'); - return; - } - - throw reason; - }); - -setTimeout(() => { - cancelablePromise.cancel(); - cancelablePromise.cancel('foo'); -}, 10000); - -const fn0 = PCancelable.fn(onCancel => { - // $ExpectType OnCancelFn - onCancel; - - return Promise.resolve(10); -}); -// $ExpectType () => PCancelable -fn0; - -const fn1 = PCancelable.fn((p1: string, onCancel: PCancelable.OnCancelFn) => { - return Promise.resolve(10); -}); -// $ExpectType (param1: string) => PCancelable -fn1; - -const fn2 = PCancelable.fn((p1: string, p2: boolean, onCancel: PCancelable.OnCancelFn) => { - return Promise.resolve(10); -}); -// $ExpectType (param1: string, param2: boolean) => PCancelable -fn2; - -const fn3 = PCancelable.fn( - (p1: string, p2: boolean, p3: number, onCancel: PCancelable.OnCancelFn) => { - return Promise.resolve(10); - } -); -// $ExpectType (param1: string, param2: boolean, param3: number) => PCancelable -fn3; - -const fn4 = PCancelable.fn( - (p1: string, p2: boolean, p3: number, p4: null, onCancel: PCancelable.OnCancelFn) => { - return Promise.resolve(10); - } -); -// $ExpectType (param1: string, param2: boolean, param3: number, param4: null) => PCancelable -fn4; - -const promise = fn0(); -let num: number; -promise.then(innum => (num = innum)); -if (!promise.isCanceled) { - promise.cancel(); -} - -const err: PCancelable.CancelError = new PCancelable.CancelError(); -throw err; diff --git a/types/p-cancelable/tsconfig.json b/types/p-cancelable/tsconfig.json deleted file mode 100644 index 504511081d..0000000000 --- a/types/p-cancelable/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-cancelable-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-catch-if/index.d.ts b/types/p-catch-if/index.d.ts deleted file mode 100644 index a832b88534..0000000000 --- a/types/p-catch-if/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Type definitions for p-catch-if 1.0 -// Project: https://github.com/sindresorhus/p-catch-if#readme -// Definitions by: Linus Unnebäck -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -declare namespace pCatchIf { - type Predicate = ErrorConstructor | ReadonlyArray | boolean | ((err: Error) => boolean | PromiseLike); -} - -declare function pCatchIf(predicate: pCatchIf.Predicate, fn: (err: Error) => T): (err: Error) => T; - -export = pCatchIf; diff --git a/types/p-catch-if/p-catch-if-tests.ts b/types/p-catch-if/p-catch-if-tests.ts deleted file mode 100644 index f42679cce6..0000000000 --- a/types/p-catch-if/p-catch-if-tests.ts +++ /dev/null @@ -1,39 +0,0 @@ -import pCatchIf = require('p-catch-if'); - -/**** Setup "fake" environemt ****/ - -declare function getData(): Promise<{}>; -declare function retry(fn: () => T): T; -declare function recordError(err: Error): undefined; -declare function isProduction(): boolean; -declare function sendError(err: Error): Promise; -declare function checkResults(): Promise; - -declare const TimeoutError: ErrorConstructor; -declare const NetworkError: ErrorConstructor; -declare const UnicornError: ErrorConstructor; - -declare const console: { error(): undefined }; - -/**** Use examples from the official library's readme.md ****/ - -// error constructor -getData().catch(pCatchIf(TimeoutError, () => retry(getData))); - -// multiple error constructors -getData().catch(pCatchIf([NetworkError, TimeoutError], () => retry(getData))); - -// boolean -getData().catch(pCatchIf(isProduction, recordError)); - -// function -const hasUnicornMessage = (err: Error) => err.message.includes('unicorn'); -getData().catch(pCatchIf(hasUnicornMessage, console.error)); - -// promise-returning function -const handler = (err: Error) => sendError(err).then(checkResults); -getData().catch(pCatchIf(handler, console.error)); - -// can also be nested -const validateMessage = (err: Error) => err.message === 'Too many rainbows'; -getData().catch(pCatchIf(UnicornError, pCatchIf(validateMessage, console.error))); diff --git a/types/p-catch-if/tsconfig.json b/types/p-catch-if/tsconfig.json deleted file mode 100644 index bdabef2511..0000000000 --- a/types/p-catch-if/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-catch-if-tests.ts" - ] -} diff --git a/types/p-debounce/index.d.ts b/types/p-debounce/index.d.ts deleted file mode 100644 index 4a18903762..0000000000 --- a/types/p-debounce/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -// Type definitions for p-debounce 1.0 -// Project: https://github.com/sindresorhus/p-debounce#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pDebounce; - -declare function pDebounce(fn: () => PromiseLike | R, wait: number, options?: pDebounce.Options): (() => Promise) & { abort(): void; }; -declare function pDebounce(fn: (arg1: T1) => PromiseLike | R, wait: number, options?: pDebounce.Options): ((arg1: T1) => Promise) & { abort(): void; }; -declare function pDebounce(fn: (arg1: T1, arg2: T2) => PromiseLike | R, wait: number, options?: pDebounce.Options): ((arg1: T1, arg2: T2) => Promise) & { abort(): void; }; -declare function pDebounce(fn: (arg1: T1, arg2: T2, arg3: T3) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3) => Promise) & { abort(): void; }; -declare function pDebounce(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise) & { abort(): void; }; -declare function pDebounce(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise) & { abort(): void; }; -declare function pDebounce(fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise) & { abort(): void; }; -declare function pDebounce( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7) => Promise) & { abort(): void; }; -declare function pDebounce( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8) => Promise) & { abort(): void; }; -declare function pDebounce( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9) => Promise) & { abort(): void; }; -declare function pDebounce( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => PromiseLike | R, - wait: number, - options?: pDebounce.Options): ((arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6, arg7: T7, arg8: T8, arg9: T9, arg10: T10) => Promise) & { abort(): void; }; -declare function pDebounce(fn: (...args: any[]) => PromiseLike | R, wait: number, options?: pDebounce.Options): ((...args: any[]) => Promise) & { abort(): void; }; - -declare namespace pDebounce { - interface Options { - leading?: boolean; - } -} diff --git a/types/p-debounce/p-debounce-tests.ts b/types/p-debounce/p-debounce-tests.ts deleted file mode 100644 index 5e7b7a49ac..0000000000 --- a/types/p-debounce/p-debounce-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -import pDebounce = require('p-debounce'); - -const expensiveCall = (input: number) => Promise.resolve(input); - -const debouncedFn = pDebounce(expensiveCall, 200); -const debouncedFn2 = pDebounce(expensiveCall, 200, {leading: true}); - -for (const i of [1, 2, 3]) { - debouncedFn(i).then(i => { - const num: number = i; - }); -} - -pDebounce(() => true, 2)(); -pDebounce((n: number, s: string) => true, 2)(1, 's'); -pDebounce((n: number, s: string, b: boolean) => true, 2)(1, 's', true); -pDebounce((n: number, s: string, b: boolean, n2: number) => true, 2)(1, 's', true, 1); -pDebounce((n: number, s: string, b: boolean, n2: number, s2: string) => true, 2)(1, 's', true, 1, 's'); -pDebounce((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean) => true, 2)(1, 's', true, 1, 's', false); -pDebounce((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number) => true, 2)(1, 's', true, 1, 's', false, 1); -pDebounce((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number) => true, 2)(1, 's', true, 1, 's', false, 1, 2); -pDebounce((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number) => true, 2)(1, 's', true, 1, 's', false, 1, 2, 3); -pDebounce((n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number) => true, 2)(1, 's', true, 1, 's', false, 1, 2, 3, 4); -pDebounce( - (n: number, s: string, b: boolean, n2: number, s2: string, b2: boolean, n3: number, n4: number, n5: number, n6: number, s3: string) => true, - 2)(1, 's', true, 1, 's', false, 1, 2, 3, 4, 'as'); diff --git a/types/p-debounce/tsconfig.json b/types/p-debounce/tsconfig.json deleted file mode 100644 index 4de0f115d8..0000000000 --- a/types/p-debounce/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-debounce-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-each-series/index.d.ts b/types/p-each-series/index.d.ts deleted file mode 100644 index 7cf91112b8..0000000000 --- a/types/p-each-series/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for p-each-series 1.0 -// Project: https://github.com/sindresorhus/p-each-series#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pEachSeries; - -declare function pEachSeries(input: Iterable | T>, iterator: (element: T, index: number) => any): Promise; diff --git a/types/p-each-series/p-each-series-tests.ts b/types/p-each-series/p-each-series-tests.ts deleted file mode 100644 index 3766842e81..0000000000 --- a/types/p-each-series/p-each-series-tests.ts +++ /dev/null @@ -1,19 +0,0 @@ -import pEachSeries = require('p-each-series'); - -const keywords = [ - Promise.resolve('foo'), - 'rainbow', - 'pony' -]; - -const keywordSet = new Set(keywords); - -pEachSeries(keywords, el => Promise.resolve(el)).then(result => { - result; // $ExpectType string[] - const str: string = result[0]; -}); - -pEachSeries(keywordSet, (el, idx) => Promise.resolve(idx)).then(result => { - result; // $ExpectType string[] - const str: string = result[0]; -}); diff --git a/types/p-each-series/tsconfig.json b/types/p-each-series/tsconfig.json deleted file mode 100644 index e8cd900d05..0000000000 --- a/types/p-each-series/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-each-series-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-event/index.d.ts b/types/p-event/index.d.ts deleted file mode 100644 index 6f76b75748..0000000000 --- a/types/p-event/index.d.ts +++ /dev/null @@ -1,205 +0,0 @@ -// Type definitions for p-event 2.3 -// Project: https://github.com/sindresorhus/p-event#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { PCancelable } from 'p-cancelable'; - -export = pEvent; - -/** - * Promisify an event by waiting for it to be emitted. - * - * Returns a `Promise` that is fulfilled when emitter emits an event matching `event`, or rejects if emitter emits - * any of the events defined in the `rejectionEvents` option. - * - * **Note**: `event` is a string for a single event type, for example, `'data'`. To listen on multiple - * events, pass an array of strings, such as `['started', 'stopped']`. - * - * The returned promise has a `.cancel()` method, which when called, removes the event listeners and causes the promise to never be settled. - * - * @param emitter Event emitter object. Should have either a `.on()`/`.addListener()`/`.addEventListener()` and - * `.off()`/`.removeListener()`/`.removeEventListener()` method, like the [Node.js `EventEmitter`](https://nodejs.org/api/events.html) and - * [DOM events](https://developer.mozilla.org/en-US/docs/Web/Events). - * @param event Name of the event or events to listen to. If the same event is defined both here and in - * `rejectionEvents`, this one takes priority. - */ -declare function pEvent( - emitter: pEvent.Emitter, - event: string | symbol | Array, - options: pEvent.MultiArgsOptions -): PCancelable>; -declare function pEvent( - emitter: pEvent.Emitter, - event: string | symbol | Array, - filter: pEvent.FilterFn -): PCancelable; -declare function pEvent( - emitter: pEvent.Emitter, - event: string | symbol | Array, - options?: pEvent.Options -): PCancelable; - -declare namespace pEvent { - /** - * Wait for multiple event emissions. Returns an array. - */ - function multiple( - emitter: Emitter, - event: string | symbol | Array, - options: MultipleMultiArgsOptions - ): PCancelable>>; - function multiple( - emitter: Emitter, - event: string | symbol | Array, - options: MultipleOptions - ): PCancelable; - - /** - * Returns an [async iterator](http://2ality.com/2016/10/asynchronous-iteration.html) that lets you asynchronously - * iterate over events of `event` emitted from `emitter`. The iterator ends when `emitter` emits an event matching - * any of the events defined in `resolutionEvents`, or rejects if `emitter` emits any of the events defined in - * the `rejectionEvents` option. - */ - function iterator( - emitter: Emitter, - event: string | symbol | Array, - options: IteratorMultiArgsOptions - ): AsyncIterableIterator>; - function iterator( - emitter: Emitter, - event: string | symbol | Array, - filter: FilterFn - ): AsyncIterableIterator; - function iterator( - emitter: Emitter, - event: string | symbol | Array, - options?: IteratorOptions - ): AsyncIterableIterator; - - interface Emitter { - on?: AddRmListenerFn; - addListener?: AddRmListenerFn; - addEventListener?: AddRmListenerFn; - off?: AddRmListenerFn; - removeListener?: AddRmListenerFn; - removeEventListener?: AddRmListenerFn; - } - - type FilterFn = (el: T) => boolean; - - interface Options { - /** - * Events that will reject the promise. - * @default ['error'] - */ - rejectionEvents?: Array; - /** - * By default, the promisified function will only return the first argument from the event callback, - * which works fine for most APIs. This option can be useful for APIs that return multiple arguments - * in the callback. Turning this on will make it return an array of all arguments from the callback, - * instead of just the first argument. This also applies to rejections. - * - * @example - * const pEvent = require('p-event'); - * const emitter = require('./some-event-emitter'); - * - * (async () => { - * const [foo, bar] = await pEvent(emitter, 'finish', {multiArgs: true}); - * })(); - * - * @default false - */ - multiArgs?: boolean; - /** - * Time in milliseconds before timing out. - * @default Infinity - */ - timeout?: number; - /** - * Filter function for accepting an event. - * - * @example - * const pEvent = require('p-event'); - * const emitter = require('./some-event-emitter'); - * - * (async () => { - * const result = await pEvent(emitter, '🦄', value => value > 3); - * // Do something with first 🦄 event with a value greater than 3 - * })(); - */ - filter?: FilterFn; - } - - interface MultiArgsOptions extends Options { - multiArgs: true; - } - - interface MultipleOptions extends Options { - /** - * The number of times the event needs to be emitted before the promise resolves. - */ - count: number; - /** - * Whether to resolve the promise immediately. Emitting one of the `rejectionEvents` won't throw an error. - * - * **Note**: The returned array will be mutated when an event is emitted. - * - * @example - * const emitter = new EventEmitter(); - * - * const promise = pEvent.multiple(emitter, 'hello', { - * resolveImmediately: true, - * count: Infinity - * }); - * - * const result = await promise; - * console.log(result); - * //=> [] - * - * emitter.emit('hello', 'Jack'); - * console.log(result); - * //=> ['Jack'] - * - * emitter.emit('hello', 'Mark'); - * console.log(result); - * //=> ['Jack', 'Mark'] - * - * // Stops listening - * emitter.emit('error', new Error('😿')); - * - * emitter.emit('hello', 'John'); - * console.log(result); - * //=> ['Jack', 'Mark'] - */ - resolveImmediately?: boolean; - } - - interface MultipleMultiArgsOptions extends MultipleOptions { - multiArgs: true; - } - - interface IteratorOptions extends Options { - /** - * Maximum number of events for the iterator before it ends. When the limit is reached, the iterator will be - * marked as `done`. This option is useful to paginate events, for example, fetching 10 events per page. - * @default Infinity - */ - limit?: number; - /** - * Events that will end the iterator. - * @default [] - */ - resolutionEvents?: Array; - } - - interface IteratorMultiArgsOptions extends IteratorOptions { - multiArgs: true; - } -} - -type AddRmListenerFn = ( - event: string | symbol, - listener: (arg1: T, ...args: TRest[]) => void -) => void; diff --git a/types/p-event/p-event-tests.ts b/types/p-event/p-event-tests.ts deleted file mode 100644 index dbbe50eee7..0000000000 --- a/types/p-event/p-event-tests.ts +++ /dev/null @@ -1,110 +0,0 @@ -/// - -import pEvent = require('p-event'); -import { EventEmitter } from 'events'; -import * as fs from 'fs'; - -class NodeEmitter extends EventEmitter { - on(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - addListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - addEventListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - off(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - removeListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } - removeEventListener(event: 'finish', listener: (num: number, str: string) => void) { - return this; - } -} - -class DomEmitter implements EventTarget { - addEventListener( - type: 'foo', - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions - ): void {} - - dispatchEvent(event: Event): boolean { - return false; - } - - removeEventListener( - type: 'foo', - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions - ): void {} -} - -pEvent(new NodeEmitter(), 'finish'); // $ExpectType PCancelable -pEvent(new NodeEmitter(), '🦄', value => value > 3); // $ExpectType PCancelable -pEvent(new DomEmitter(), 'finish'); // $ExpectType PCancelable -pEvent(document, 'DOMContentLoaded'); // $ExpectType PCancelable - -pEvent(new NodeEmitter(), 'finish', { rejectionEvents: ['error'] }); // $ExpectType PCancelable -pEvent(new NodeEmitter(), 'finish', { timeout: 1 }); // $ExpectType PCancelable -pEvent(new NodeEmitter(), 'finish', { filter: value => value > 3 }); // $ExpectType PCancelable -pEvent(new NodeEmitter(), 'finish', { multiArgs: true }); // $ExpectType PCancelable<(string | number)[]> - -pEvent(new NodeEmitter(), 'finish').cancel(); - -// $ExpectType PCancelable -pEvent.multiple(new NodeEmitter(), 'hello', { - count: Infinity, -}); -// $ExpectType PCancelable -pEvent.multiple(new NodeEmitter(), 'hello', { - resolveImmediately: true, - count: Infinity, -}); -// $ExpectType PCancelable<(string | number)[][]> -pEvent.multiple(new NodeEmitter(), 'hello', { - count: Infinity, - multiArgs: true, -}); -// $ExpectError -pEvent.multiple(new NodeEmitter(), 'hello', {}); -// $ExpectError -pEvent.multiple(new NodeEmitter(), 'hello'); - -pEvent.iterator(new NodeEmitter(), 'finish'); // $ExpectType AsyncIterableIterator -pEvent.iterator(new NodeEmitter(), '🦄', value => value > 3); // $ExpectType AsyncIterableIterator - -pEvent.iterator(new NodeEmitter(), 'finish', { limit: 1 }); // $ExpectType AsyncIterableIterator -pEvent.iterator(new NodeEmitter(), 'finish', { resolutionEvents: ['finish'] }); // $ExpectType AsyncIterableIterator -pEvent.iterator(new NodeEmitter(), 'finish', { multiArgs: true }); // $ExpectType AsyncIterableIterator<(string | number)[]> - -async function getOpenReadStream(file: string) { - const stream = fs.createReadStream(file); - await pEvent(stream, 'open'); - return stream; -} - -(async () => { - const stream = await getOpenReadStream('unicorn.txt'); - stream.pipe(process.stdout); -})().catch(console.error); - -(async () => { - try { - const result = await pEvent(new NodeEmitter(), 'finish'); - - if (result === 1) { - throw new Error('Emitter finished with an error'); - } - - // `emitter` emitted a `finish` event with an acceptable value - console.log(result); - } catch (error) { - // `emitter` emitted an `error` event or - // emitted a `finish` with 'unwanted result' - console.error(error); - } -})(); diff --git a/types/p-event/v1/index.d.ts b/types/p-event/v1/index.d.ts deleted file mode 100644 index 0fde40d140..0000000000 --- a/types/p-event/v1/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -// Type definitions for p-event 1.3 -// Project: https://github.com/sindresorhus/p-event#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = pEvent; - -declare function pEvent(emitter: pEvent.Emitter, event: string | symbol, options: MultiArgsOptions): Promise>; -declare function pEvent(emitter: pEvent.Emitter, event: string | symbol, filter: FilterFn): Promise; -declare function pEvent(emitter: pEvent.Emitter, event: string | symbol, options?: pEvent.Options): Promise; - -declare namespace pEvent { - interface Emitter { - on?: AddRmListenerFn; - addListener?: AddRmListenerFn; - addEventListener?: AddRmListenerFn; - off?: AddRmListenerFn; - removeListener?: AddRmListenerFn; - removeEventListener?: AddRmListenerFn; - } - - interface Options { - rejectionEvents?: string[]; - multiArgs?: boolean; - timeout?: number; - filter?: FilterFn; - } -} - -type AddRmListenerFn = (event: string | symbol, listener: (arg1: T, ...args: TRest[]) => void) => void; -type FilterFn = (el: T) => boolean; - -interface MultiArgsOptions extends pEvent.Options { - multiArgs: true; -} diff --git a/types/p-event/v1/p-event-tests.ts b/types/p-event/v1/p-event-tests.ts deleted file mode 100644 index 0295cdb34b..0000000000 --- a/types/p-event/v1/p-event-tests.ts +++ /dev/null @@ -1,61 +0,0 @@ -/// - -import pEvent = require('p-event'); -import * as events from 'events'; -import * as fs from 'fs'; - -class MyEmitter extends events.EventEmitter { -} - -class MyDomEmitter implements EventTarget { - addEventListener(type: 'foo', listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void { - } - - dispatchEvent(event: Event): boolean { - return false; - } - - removeEventListener(type: 'foo', listener: EventListenerOrEventListenerObject, options?: boolean | AddEventListenerOptions): void { - } -} - -pEvent(new MyEmitter(), 'finish') - .then(result => { - console.log(result); - }) - .catch(error => { - console.error(error); - }); - -pEvent(new MyEmitter(), 'finish').then(result => { - const str: string = result; -}); - -pEvent(new MyDomEmitter(), 'finish').then(result => { - const e: Event | undefined = result; -}); - -pEvent(document, 'DOMContentLoaded').then(() => { - console.log('😎'); -}); - -pEvent(new MyEmitter(), 'finish', {multiArgs: true}).then(result => { - const strArr: string[] = result; -}); - -pEvent(new MyEmitter(), '🦄', value => value > 3).then(result => { - const num: number = result; -}); - -async function getOpenReadStream(file: string) { - const stream = fs.createReadStream(file); - await pEvent(stream, 'open'); - return stream; -} - -getOpenReadStream('unicorn.txt') - .then(stream => { - console.log('Is readable:', stream.readable); - stream.pipe(process.stdout); - }) - .catch(console.error); diff --git a/types/p-event/v1/tsconfig.json b/types/p-event/v1/tsconfig.json deleted file mode 100644 index e8374c9b9e..0000000000 --- a/types/p-event/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6", - "dom" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": false, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "p-event": [ - "p-event/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-event-tests.ts" - ] -} diff --git a/types/p-every/index.d.ts b/types/p-every/index.d.ts deleted file mode 100644 index 57b41f0a4e..0000000000 --- a/types/p-every/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Type definitions for p-every 1.0 -// Project: https://github.com/kevva/p-every#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pEvery; - -declare function pEvery(input: Iterable | T>, - testFn: (element: T, index: number) => boolean | Promise, - options?: pEvery.Options): Promise; - -declare namespace pEvery { - interface Options { - concurrency?: number; - } -} diff --git a/types/p-every/p-every-tests.ts b/types/p-every/p-every-tests.ts deleted file mode 100644 index df06fdf899..0000000000 --- a/types/p-every/p-every-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -import pEvery = require('p-every'); - -const places = [ - Promise.resolve('Norway'), - 'Bangkok, Thailand', - 'Berlin, Germany', - 'Tokyo, Japan' -]; - -pEvery(places, x => Promise.resolve(true)).then(result => { - const bool: boolean = result; -}); - -const places2 = [ - Promise.resolve('Norway'), - 'Bangkok, Thailand', - 'Berlin, Germany', - 5 -]; - -pEvery(places2, x => { - const strnum: string | number = x; - return Promise.resolve(true); -}, {concurrency: 2}).then(result => { - const bool: boolean = result; -}); diff --git a/types/p-every/tsconfig.json b/types/p-every/tsconfig.json deleted file mode 100644 index 979927093f..0000000000 --- a/types/p-every/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-every-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-limit/index.d.ts b/types/p-limit/index.d.ts deleted file mode 100644 index de7b0a07d9..0000000000 --- a/types/p-limit/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -// Type definitions for p-limit 2.1 -// Project: https://github.com/sindresorhus/p-limit#readme -// Definitions by: BendingBender -// Linus Unnebäck -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 3.0 - -export = pLimit; - -/** - * Run multiple promise-returning & async functions with limited concurrency. - * @param concurrency Concurrency limit. Minimum: `1`. - * @returns A `limit` function. - */ -declare function pLimit(concurrency: number): pLimit.Limit; - -declare namespace pLimit { - interface Limit { - /** - * Returns the promise returned by calling `fn(...args)`. - * - * @param fn Promise-returning/async function. - * @param args Any arguments to pass through to `fn`. - * Support for passing arguments on to the `fn` is provided in order to be able to avoid - * creating unnecessary closures. You probably don't need this optimization unless you're - * pushing a lot of functions. - */ - ( - fn: (...args: TArgs) => PromiseLike | R, - ...args: TArgs - ): Promise; - - /** - * The number of promises that are currently running. - */ - readonly activeCount: number; - - /** - * The number of promises that are waiting to run (i.e. their internal `fn` was not called yet). - */ - readonly pendingCount: number; - } -} diff --git a/types/p-limit/p-limit-tests.ts b/types/p-limit/p-limit-tests.ts deleted file mode 100644 index 3f9fb51083..0000000000 --- a/types/p-limit/p-limit-tests.ts +++ /dev/null @@ -1,23 +0,0 @@ -import pLimit = require('p-limit'); - -const limit = pLimit(1); - -const input = [ - limit(() => Promise.resolve('foo')), - limit(() => Promise.resolve('bar')), - limit(() => Promise.resolve(undefined)), -]; - -Promise.all(input); // $ExpectType Promise<(string | undefined)[]> - -limit((a: string) => '', 'test').then(v => { - v; // $ExpectType string -}); -limit((a: string, b: number) => Promise.resolve(''), 'test', 1).then(v => { - v; // $ExpectType string -}); - -limit.activeCount; // $ExpectType number -limit.activeCount = 1; // $ExpectError -limit.pendingCount; // $ExpectType number -limit.pendingCount = 1; // $ExpectError diff --git a/types/p-limit/tsconfig.json b/types/p-limit/tsconfig.json deleted file mode 100644 index 4634bf6300..0000000000 --- a/types/p-limit/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-limit-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-locate/index.d.ts b/types/p-locate/index.d.ts deleted file mode 100644 index 9ddc11197c..0000000000 --- a/types/p-locate/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Type definitions for p-locate 2.0 -// Project: https://github.com/sindresorhus/p-locate#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pLocate; - -declare function pLocate(input: Iterable | T>, tester: (element: T) => Promise | boolean, options?: pLocate.Options): Promise; - -declare namespace pLocate { - interface Options { - concurrency?: number; - preserveOrder?: boolean; - } -} diff --git a/types/p-locate/p-locate-tests.ts b/types/p-locate/p-locate-tests.ts deleted file mode 100644 index acceb0376a..0000000000 --- a/types/p-locate/p-locate-tests.ts +++ /dev/null @@ -1,14 +0,0 @@ -import pLocate = require('p-locate'); - -const files = [ - 'unicorn.png', - 'rainbow.png', - 'pony.png' -]; - -let str: string | undefined; -pLocate(files, file => Promise.resolve(file === 'rainbow.png')).then(foundPath => { - str = foundPath; -}); - -pLocate(files, file => Promise.resolve(file === 'rainbow.png'), {concurrency: 2, preserveOrder: false}); diff --git a/types/p-locate/tsconfig.json b/types/p-locate/tsconfig.json deleted file mode 100644 index 1f3e8a7711..0000000000 --- a/types/p-locate/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-locate-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-log/index.d.ts b/types/p-log/index.d.ts deleted file mode 100644 index 66fe1ceace..0000000000 --- a/types/p-log/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Type definitions for p-log 1.0 -// Project: https://github.com/sindresorhus/p-log#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pLog; - -declare const pLog: pLog; - -interface pLog { - (): (value: T) => Promise; - catch(): (value: any) => Promise; -} diff --git a/types/p-log/p-log-tests.ts b/types/p-log/p-log-tests.ts deleted file mode 100644 index 58e9aa17d7..0000000000 --- a/types/p-log/p-log-tests.ts +++ /dev/null @@ -1,15 +0,0 @@ -import pLog = require('p-log'); - -Promise.resolve('unicorn') - .then(pLog()) - .then(val => { - val; // $ExpectType string - }); - -Promise.resolve() - .then(() => { - throw new Error('pony'); - }) - .catch(pLog.catch()) - .catch(error => { - }); diff --git a/types/p-log/tsconfig.json b/types/p-log/tsconfig.json deleted file mode 100644 index 891d94fce3..0000000000 --- a/types/p-log/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-log-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-map-series/index.d.ts b/types/p-map-series/index.d.ts deleted file mode 100644 index d7767278f5..0000000000 --- a/types/p-map-series/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for p-map-series 1.0 -// Project: https://github.com/sindresorhus/p-map-series#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = pMapSeries; - -declare function pMapSeries(input: Iterable | T>, mapper: (element: T, index: number) => PromiseLike | U): Promise; diff --git a/types/p-map-series/p-map-series-tests.ts b/types/p-map-series/p-map-series-tests.ts deleted file mode 100644 index c9c2831b0f..0000000000 --- a/types/p-map-series/p-map-series-tests.ts +++ /dev/null @@ -1,19 +0,0 @@ -import pMapSeries = require('p-map-series'); - -const keywords = [ - Promise.resolve('foo'), - 'rainbow', - 'pony' -]; - -const keywordSet = new Set(keywords); - -pMapSeries(keywords, (keyword, idx) => Promise.resolve({keyword, idx})).then(result => { - result; // $ExpectType { keyword: string; idx: number; }[] - const res1: { keyword: string; idx: number; } = result[0]; -}); - -pMapSeries(keywordSet, (keyword) => Promise.resolve({keyword})).then(result => { - result; // $ExpectType { keyword: string; }[] - const res1: { keyword: string; } = result[0]; -}); diff --git a/types/p-map-series/tsconfig.json b/types/p-map-series/tsconfig.json deleted file mode 100644 index b06e222983..0000000000 --- a/types/p-map-series/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-map-series-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-memoize/index.d.ts b/types/p-memoize/index.d.ts deleted file mode 100644 index 0b997b4b19..0000000000 --- a/types/p-memoize/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -// Type definitions for p-memoize 1.0 -// Project: https://github.com/sindresorhus/p-memoize#readme -// Definitions by: forabi -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -interface MemOptions { - /** - * Milliseconds until the cache expires. - * @default Infinity - */ - maxAge?: number; - - /** - * Determines the cache key for storing the result based on the - * function arguments. By default, if there's only one argument and - * it's a primitive, it's used directly as a key, otherwise it's all - * the function arguments JSON stringified as an array. - * - * You could for example change it to only cache on the first argument - * `x => JSON.stringify(x)`. - */ - cacheKey?: (...args: any[]) => string; - - /** - * Use a different cache storage. - * Must implement the following methods: - * `.has(key)`, `.get(key)`, `.set(key, value)`, `.delete(key)`, and optionally `.clear()` - * You could for example use a `WeakMap` instead or `quick-lru` for a LRU cache. - * - * @default new Map() - */ - cache?: pMemoize.Cache; - - /** Cache rejected promises. */ - cachePromiseRejection?: boolean; -} - -type PMemoize = any>( - f: T, - memoizeOptions?: MemOptions -) => T; - -declare const pMemoize: PMemoize; - -declare namespace pMemoize { - interface Cache { - get(key: K): V; - set(key: K, value: V): void; - has(key: K): boolean; - delete(key: K): void; - clear?(): void; - } -} - -export = pMemoize; diff --git a/types/p-memoize/p-memoize-tests.ts b/types/p-memoize/p-memoize-tests.ts deleted file mode 100644 index 8626482dab..0000000000 --- a/types/p-memoize/p-memoize-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import pMemoize = require('p-memoize'); -import { Cache } from 'p-memoize'; - -const a = pMemoize(async () => Promise.resolve('Hello world!')); - -const b = pMemoize(async () => Promise.resolve(1), { - maxAge: 1000, - cache: new Map() -}); - -a(); - -b(); diff --git a/types/p-one/index.d.ts b/types/p-one/index.d.ts deleted file mode 100644 index 14408b4cd7..0000000000 --- a/types/p-one/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Type definitions for p-one 1.0 -// Project: https://github.com/kevva/p-one#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pOne; - -declare function pOne(input: Iterable | T>, - testFn: (element: T, index: number) => boolean | Promise, - options?: pOne.Options): Promise; - -declare namespace pOne { - interface Options { - concurrency?: number; - } -} diff --git a/types/p-one/p-one-tests.ts b/types/p-one/p-one-tests.ts deleted file mode 100644 index 99c2536dec..0000000000 --- a/types/p-one/p-one-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -import pOne = require('p-one'); - -const places = [ - Promise.resolve('Norway'), - 'Bangkok, Thailand', - 'Berlin, Germany', - 'Tokyo, Japan' -]; - -pOne(places, x => Promise.resolve(true)).then(result => { - const bool: boolean = result; -}); - -const places2 = [ - Promise.resolve('Norway'), - 'Bangkok, Thailand', - 'Berlin, Germany', - 5 -]; - -pOne(places2, x => { - const strnum: string | number = x; - return Promise.resolve(true); -}, {concurrency: 2}).then(result => { - const bool: boolean = result; -}); diff --git a/types/p-one/tsconfig.json b/types/p-one/tsconfig.json deleted file mode 100644 index 27a6a05ac7..0000000000 --- a/types/p-one/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-one-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-progress/index.d.ts b/types/p-progress/index.d.ts deleted file mode 100644 index 8eb745683c..0000000000 --- a/types/p-progress/index.d.ts +++ /dev/null @@ -1,175 +0,0 @@ -// Type definitions for p-progress 0.2 -// Project: https://github.com/sindresorhus/p-progress#readme -// Definitions by: icopp -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -declare namespace pProgress { - interface Options { - /** - * Number of concurrently pending promises. - * - * To run the promises in series, set it to 1. - * - * When this option is set, the first argument must be an array of - * promise-returning functions. - * - * Minimum 1. - * - * @default {Infinity} - */ - concurrency?: number; - } -} - -type PromiseFactory = () => Promise | PromiseLike; - -declare class PProgress extends Promise { - /** - * The current progress percentage of the promise as a number between 0 and - * 1. - */ - progress: number; - - /** - * Convenience method to run multiple promises and get a total progress of - * all of them. It counts normal promises with progress `0` when pending and - * progress `1` when resolved. For PProgress type promises, it listens to - * their onProgress() method for more fine grained progress reporting. You - * can mix and match normal promises and PProgress promises. - * - * @param promises Array of promises or promise-returning functions. - * @throws {TypeError} - */ - static all( - promises: [ - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory - ], - options?: pProgress.Options - ): PProgress<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>; - static all( - promises: [ - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory - ], - options?: pProgress.Options - ): PProgress<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>; - static all( - promises: [ - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory - ], - options?: pProgress.Options - ): PProgress<[T1, T2, T3, T4, T5, T6, T7, T8]>; - static all( - promises: [ - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory - ], - options?: pProgress.Options - ): PProgress<[T1, T2, T3, T4, T5, T6, T7]>; - static all( - promises: [ - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory - ], - options?: pProgress.Options - ): PProgress<[T1, T2, T3, T4, T5, T6]>; - static all( - promises: [ - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory - ], - options?: pProgress.Options - ): PProgress<[T1, T2, T3, T4, T5]>; - static all( - promises: [ - PromiseFactory, - PromiseFactory, - PromiseFactory, - PromiseFactory - ], - options?: pProgress.Options - ): PProgress<[T1, T2, T3, T4]>; - static all( - promises: [PromiseFactory, PromiseFactory, PromiseFactory], - options?: pProgress.Options - ): PProgress<[T1, T2, T3]>; - static all( - promises: [PromiseFactory, PromiseFactory], - options?: pProgress.Options - ): PProgress<[T1, T2]>; - static all( - promises: [PromiseFactory], - options?: pProgress.Options - ): PProgress<[T1]>; - static all( - promises: Array>, - options?: pProgress.Options - ): PProgress; - - /** - * Same as the Promise constructor, but with an appended `progress` - * parameter in `executor`. - * - * @param progress - * Call this with progress updates. It expects a number between 0 and 1. - * - * Multiple calls with the same number will result in only one - * `onProgress()` event. - * - * Progress percentage `1` is reported for you when the promise resolves. - * If you set it yourself, it will simply be ignored. - */ - constructor( - executor: ( - resolve: (value?: T | PromiseLike) => void, - reject: (reason?: any) => void, - progress: (progress: number) => void - ) => void - ); - - /** - * Accepts a function that gets `instance.progress` as an argument and is - * called for every progress event. - * - * @throws {TypeError} - */ - onProgress(cb: (progress: number) => void): void; -} - -export = PProgress; diff --git a/types/p-progress/p-progress-tests.ts b/types/p-progress/p-progress-tests.ts deleted file mode 100644 index eb70dec355..0000000000 --- a/types/p-progress/p-progress-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ -import PProgress = require("p-progress"); - -new PProgress(async (resolve, reject, progress) => { - try { - await Promise.resolve("sindresorhus.com"); - progress(0.5); - - await Promise.resolve("ava.li"); - progress(1); - - resolve(); - } catch (e) { - reject(e); - } -}).onProgress(progress => { - progress; -}); - -PProgress.all( - [ - () => Promise.resolve("sindresorhus.com"), - () => Promise.resolve("ava.li"), - () => Promise.resolve(), - () => Promise.resolve(1) - ], - { concurrency: 2 } -).then(result => { - const str: string = result[0]; - const str2: string = result[1]; - const num: number = result[3]; -}); diff --git a/types/p-props/index.d.ts b/types/p-props/index.d.ts deleted file mode 100644 index 3fa293ef69..0000000000 --- a/types/p-props/index.d.ts +++ /dev/null @@ -1,10 +0,0 @@ -// Type definitions for p-props 1.0 -// Project: https://github.com/sindresorhus/p-props#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = pProps; - -declare function pProps | V }>(input: M): Promise>; -declare function pProps(input: Map | V>): Promise>; diff --git a/types/p-props/p-props-tests.ts b/types/p-props/p-props-tests.ts deleted file mode 100644 index 651d613193..0000000000 --- a/types/p-props/p-props-tests.ts +++ /dev/null @@ -1,21 +0,0 @@ -import pProps = require('p-props'); -import got = require('got'); - -const fetch = (url: string): Promise => got(url).then(res => res.body); - -const sites = { - ava: fetch('ava.li'), - todomvc: fetch('todomvc.com'), - github: fetch('github.com'), - foo: 'bar' -}; - -pProps(sites).then(result => { - const str: string = result.github; -}); - -const map = new Map>([[1, Promise.resolve('1')], [2, '2']]); - -pProps(map).then(result => { - const str: string | undefined = result.get(1); -}); diff --git a/types/p-props/tsconfig.json b/types/p-props/tsconfig.json deleted file mode 100644 index 8ef73ae141..0000000000 --- a/types/p-props/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-props-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-props/tslint.json b/types/p-props/tslint.json deleted file mode 100644 index 71ee04c4e1..0000000000 --- a/types/p-props/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-unnecessary-generics": false - } -} diff --git a/types/p-queue/index.d.ts b/types/p-queue/index.d.ts deleted file mode 100644 index 96fda8426a..0000000000 --- a/types/p-queue/index.d.ts +++ /dev/null @@ -1,160 +0,0 @@ -// Type definitions for p-queue 3.1 -// Project: https://github.com/sindresorhus/p-queue#readme -// Definitions by: BendingBender -// Evan Shortiss -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.4 - -/// - -import { EventEmitter } from 'events'; - -export = PQueue; - -/** - * Promise queue with concurrency control. - */ -declare class PQueue< - TEnqueueOptions extends PQueue.QueueAddOptions = PQueue.DefaultAddOptions -> extends EventEmitter { - /** - * Size of the queue. - */ - readonly size: number; - - /** - * Number of pending promises. - */ - readonly pending: number; - - /** - * Whether the queue is currently paused. - */ - readonly isPaused: boolean; - - constructor(opts?: PQueue.Options); - - /** - * Adds a sync or async task to the queue. Always returns a promise. - * @param fn Promise-returning/async function. - * @param opts - */ - add(fn: PQueue.Task, opts?: TEnqueueOptions): Promise; - - /** - * Same as `.add()`, but accepts an array of sync or async functions - * and returns a promise that resolves when all functions are resolved. - * @param fn Array of Promise-returning/async functions. - */ - addAll(fns: Array>, opts?: TEnqueueOptions): Promise; - - /** - * Returns a promise that settles when the queue becomes empty. - * - * Can be called multiple times. Useful if you for example add - * additional items at a later time. - */ - onEmpty(): Promise; - - /** - * Returns a promise that settles when the queue becomes empty, and all - * promises have completed; `queue.size === 0 && queue.pending === 0`. - * - * The difference with `.onEmpty` is that `.onIdle` guarantees that all work - * from the queue has finished. `.onEmpty` merely signals that the queue is - * empty, but it could mean that some promises haven't completed yet. - */ - onIdle(): Promise; - - /** - * Start (or resume) executing enqueued tasks within concurrency limit. - * No need to call this if queue is not paused - * (via `options.autoStart = false` or by `.pause()` method.) - */ - start(): void; - - /** - * Clear the queue. - */ - clear(): void; - - /** - * Put queue execution on hold. - */ - pause(): void; - - addListener(event: 'active', listener: () => void): this; - on(event: 'active', listener: () => void): this; - once(event: 'active', listener: () => void): this; - prependListener(event: 'active', listener: () => void): this; - prependOnceListener(event: 'active', listener: () => void): this; - removeListener(event: 'active', listener: () => void): this; - off(event: 'active', listener: () => void): this; - removeAllListeners(event?: 'active'): this; - listeners(event: 'active'): Array<() => void>; - rawListeners(event: 'active'): Array<() => void>; - emit(event: 'active'): boolean; - eventNames(): Array<'active'>; - listenerCount(type: 'active'): number; -} - -declare namespace PQueue { - interface QueueAddOptions { - [key: string]: any; - } - - interface QueueClassConstructor { - new (): QueueClass; - } - - interface QueueClass { - size: number; - - enqueue(run: () => void, options?: TEnqueueOptions): void; - - dequeue(): (() => void) | undefined; - } - - interface Options { - /** - * Concurrency limit. Minimum: `1`. - * @default Infinity - */ - concurrency?: number; - /** - * Whether queue tasks within concurrency limit, are auto-executed as soon as they're added. - * @default true - */ - autoStart?: boolean; - /** - * Class with a `enqueue` and `dequeue` method, and a `size` getter. See the - * [Custom QueueClass](https://github.com/sindresorhus/p-queue#custom-queueclass) section. - */ - queueClass?: QueueClassConstructor; - /** - * The max number of runs in the given interval of time. Minimum: `1`. - * @default Infinity - */ - intervalCap?: number; - /** - * The length of time in milliseconds before the interval count resets. Must be finite. Minimum: `0`. - * @default 0 - */ - interval?: number; - /** - * Whether the task must finish in the given interval or will be carried over into the next interval count. - * @default false - */ - carryoverConcurrencyCount?: boolean; - } - - interface DefaultAddOptions { - /** - * Priority of operation. Operations with greater priority will be scheduled first. - * @default 0 - */ - priority?: number; - } - - type Task = (() => PromiseLike) | (() => T); -} diff --git a/types/p-queue/p-queue-tests.ts b/types/p-queue/p-queue-tests.ts deleted file mode 100644 index 4ce6fbb13e..0000000000 --- a/types/p-queue/p-queue-tests.ts +++ /dev/null @@ -1,49 +0,0 @@ -import PQueue = require('p-queue'); - -const queue = new PQueue({ concurrency: 1 }); -new PQueue({ autoStart: false }); -new PQueue({ intervalCap: 1 }); -new PQueue({ interval: 0 }); -new PQueue({ carryoverConcurrencyCount: true }); - -queue.add(() => Promise.resolve('sindresorhus.com')); // $ExpectType Promise -queue.add(() => 'sindresorhus.com'); // $ExpectType Promise -queue.add(() => 'sindresorhus.com', { priority: 1 }); // $ExpectType Promise - -queue.addAll([() => Promise.resolve('oh'), () => 'hi']); // $ExpectType Promise -queue.addAll([() => Promise.resolve('oh'), () => 1]); // $ExpectType Promise<(string | number)[]> -queue.addAll([() => Promise.resolve('oh'), () => 'hi'], { priority: 1 }); // $ExpectType Promise - -queue.onEmpty(); // $ExpectType Promise -queue.onIdle(); // $ExpectType Promise -queue.start(); -queue.pause(); -queue.clear(); - -queue.size; // $ExpectType number -queue.size = 1; // $ExpectError -queue.pending; // $ExpectType number -queue.pending = 5; // $ExpectError -queue.isPaused; // $ExpectType boolean -queue.isPaused = true; // $ExpectError - -class QueueClass implements PQueue.QueueClass<{ any: string }> { - private readonly queue: Array<() => void>; - - size = 0; - - constructor() { - this.queue = []; - } - - enqueue(run: () => void, options: { any: string }) { - this.queue.push(run); - } - - dequeue() { - return this.queue.shift(); - } -} - -const queue2 = new PQueue({ queueClass: QueueClass }); -queue2.add(() => Promise.resolve(), { any: 'hi' }); diff --git a/types/p-queue/tsconfig.json b/types/p-queue/tsconfig.json deleted file mode 100644 index b3dd5e5314..0000000000 --- a/types/p-queue/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-queue-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-queue/v2/index.d.ts b/types/p-queue/v2/index.d.ts deleted file mode 100644 index 568de0ca1d..0000000000 --- a/types/p-queue/v2/index.d.ts +++ /dev/null @@ -1,103 +0,0 @@ -// Type definitions for p-queue 2.3 -// Project: https://github.com/sindresorhus/p-queue#readme -// Definitions by: BendingBender -// Evan Shortiss -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = PQueue; - -declare class PQueue { - /** - * Size of the queue. - */ - size: number; - - /** - * Number of pending promises. - */ - pending: number; - - /** - * Whether the queue is currently paused. - */ - isPaused: boolean; - - constructor(opts?: PQueue.Options); - - /** - * Returns the promise returned by calling fn. - * @param fn Promise-returning/async function. - */ - add(fn: PQueue.Task, opts?: O): Promise; - - /** - * Same as .add(), but accepts an array of async functions and - * returns a promise that resolves when all async functions are resolved. - * @param fn Array of Promise-returning/async functions. - */ - addAll(fns: Array>, opts?: O): Promise; - - /** - * Returns a promise that settles when the queue becomes empty. - * Can be called multiple times. Useful if you for example add - * additional items at a later time. - */ - onEmpty(): Promise; - - /** - * Returns a promise that settles when the queue becomes empty, and all - * promises have completed; queue.size === 0 && queue.pending === 0. - * The difference with .onEmpty is that .onIdle guarantees that all work - * from the queue has finished. .onEmpty merely signals that the queue is - * empty, but it could mean that some promises haven't completed yet. - */ - onIdle(): Promise; - - /** - * Start (or resume) executing enqueued tasks within concurrency limit. - * No need to call this if queue is not paused (via options.autoStart = false - * or by .pause() method.) - */ - start(): void; - - /** - * Clear the queue. - */ - clear(): void; - - /** - * Put queue execution on hold. - */ - pause(): void; -} - -declare namespace PQueue { - interface QueueAddOptions { - [key: string]: any; - } - - interface QueueClassConstructor { - new(): QueueClass; - } - - interface QueueClass { - size: number; - - enqueue(run: () => void, options?: O): void; - - dequeue(): (() => void) | undefined; - } - - interface Options { - concurrency?: number; - autoStart?: boolean; - queueClass?: QueueClassConstructor; - } - - interface DefaultAddOptions { - priority?: number; - } - - type Task = () => Promise; -} diff --git a/types/p-queue/v2/p-queue-tests.ts b/types/p-queue/v2/p-queue-tests.ts deleted file mode 100644 index fcd48c852d..0000000000 --- a/types/p-queue/v2/p-queue-tests.ts +++ /dev/null @@ -1,51 +0,0 @@ -import PQueue = require("p-queue"); - -const queue = new PQueue({ concurrency: 1 }); - -queue - .add(() => Promise.resolve("sindresorhus.com")) - .then(sindre => { - const str: string = sindre; - }); - -queue.addAll([() => Promise.resolve("oh"), () => Promise.resolve("hi")]).then(r => { - r.indexOf("h"); -}); - -Promise.resolve((): Promise => Promise.resolve("unicorn")) - .then(task => queue.add(task, { priority: 5 })) - .then(unicorn => { - const str: string = unicorn; - }); - -queue.onEmpty().then(() => {}); -queue.onIdle().then(() => {}); -queue.start(); -queue.pause(); -queue.clear(); - -let num: number; -num = queue.size; -num = queue.pending; -const paused = queue.isPaused; - -class QueueClass implements PQueue.QueueClass<{ any: string }> { - private readonly queue: Array<() => void>; - - size = 0; - - constructor() { - this.queue = []; - } - - enqueue(run: () => void, options: { any: string }) { - this.queue.push(run); - } - - dequeue() { - return this.queue.shift(); - } -} - -const queue2 = new PQueue({ queueClass: QueueClass }); -queue2.add(() => Promise.resolve(), { any: "hi" }); diff --git a/types/p-reduce/index.d.ts b/types/p-reduce/index.d.ts deleted file mode 100644 index 6434eda06a..0000000000 --- a/types/p-reduce/index.d.ts +++ /dev/null @@ -1,11 +0,0 @@ -// Type definitions for p-reduce 1.0 -// Project: https://github.com/sindresorhus/p-reduce#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = pReduce; - -declare function pReduce(input: Iterable | T>, - reducer: (previousValue: U, currentValue: T, index: number) => Promise | U, - initialValue?: U): Promise; diff --git a/types/p-reduce/p-reduce-tests.ts b/types/p-reduce/p-reduce-tests.ts deleted file mode 100644 index 113b6040fc..0000000000 --- a/types/p-reduce/p-reduce-tests.ts +++ /dev/null @@ -1,27 +0,0 @@ -import pReduce = require('p-reduce'); - -const names = [ - Promise.resolve('sindresorhus'), - 'Addy Osmani', - 'Pascal Hartig', - 'Stephen Sawchuk' -]; - -pReduce(names, (total, name) => { - return Promise.resolve(total + 1); -}, 0).then(count => { - const num: number = count; -}); - -const names2 = [ - Promise.resolve('sindresorhus'), - 'Addy Osmani', - 'Pascal Hartig', - 5 -]; - -pReduce(names2, (allNames, name) => { - return Promise.resolve(`${allNames},${name}`); -}, '').then(allNames => { - const str: string = allNames; -}); diff --git a/types/p-reduce/tsconfig.json b/types/p-reduce/tsconfig.json deleted file mode 100644 index d06d04e5e7..0000000000 --- a/types/p-reduce/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-reduce-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-retry/index.d.ts b/types/p-retry/index.d.ts deleted file mode 100644 index b2c9100b68..0000000000 --- a/types/p-retry/index.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -// Type definitions for p-retry 3.0 -// Project: https://github.com/sindresorhus/p-retry#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import { OperationOptions } from 'retry'; - -export = pRetry; - -declare function pRetry(input: (attemptCount: number) => PromiseLike | T, options?: pRetry.Options): Promise; - -declare namespace pRetry { - class AbortError extends Error { - readonly name: 'AbortError'; - readonly originalError: Error; - constructor(message: string | Error); - } - - interface FailedAttemptError extends Error { - attemptNumber: number; - retriesLeft: number; - } - - interface Options extends OperationOptions { - onFailedAttempt?: (error: FailedAttemptError) => void; - } -} diff --git a/types/p-retry/p-retry-tests.ts b/types/p-retry/p-retry-tests.ts deleted file mode 100644 index 19d3fbbfef..0000000000 --- a/types/p-retry/p-retry-tests.ts +++ /dev/null @@ -1,20 +0,0 @@ -import pRetry = require('p-retry'); -import fetch from 'node-fetch'; - -const run = () => fetch('https://sindresorhus.com/unicorn') - .then(response => { - // abort retrying if the resource doesn't exist - if (response.status === 404) { - throw new pRetry.AbortError(response.statusText); - } - return response.text(); - }); - -pRetry(run, { - retries: 5, - onFailedAttempt: error => { - console.log(`Attempt ${error.attemptNumber} failed. There are ${error.retriesLeft} attempts left.`); - } -}).then(result => { - const str: string = result; -}); diff --git a/types/p-retry/tsconfig.json b/types/p-retry/tsconfig.json deleted file mode 100644 index 8bd6ddd6b5..0000000000 --- a/types/p-retry/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-retry-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-series/index.d.ts b/types/p-series/index.d.ts deleted file mode 100644 index ecc7b19cd8..0000000000 --- a/types/p-series/index.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -// Type definitions for p-series 1.0 -// Project: https://github.com/sindresorhus/p-series#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -export = pSeries; - -declare function pSeries(tasks: Iterable<() => Promise | T>): Promise; diff --git a/types/p-series/p-series-tests.ts b/types/p-series/p-series-tests.ts deleted file mode 100644 index 1b97ca3a48..0000000000 --- a/types/p-series/p-series-tests.ts +++ /dev/null @@ -1,18 +0,0 @@ -import pSeries = require('p-series'); -import got = require('got'); - -pSeries | number | boolean>([ - () => got('sindresorhus.com'), - () => Promise.resolve(1), - () => true -]).then(result => { - result[0]; // $ExpectType number | boolean | Response -}); - -pSeries | number | boolean>(new Set<(() => Promise>) | (() => Promise) | (() => Promise)>([ - () => got('sindresorhus.com'), - () => Promise.resolve(1), - () => Promise.resolve(true) -])).then(result => { - result[0]; // $ExpectType number | boolean | Response -}); diff --git a/types/p-series/tsconfig.json b/types/p-series/tsconfig.json deleted file mode 100644 index 7ac0ed4d4c..0000000000 --- a/types/p-series/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-series-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-some/index.d.ts b/types/p-some/index.d.ts deleted file mode 100644 index e22fd8d7ea..0000000000 --- a/types/p-some/index.d.ts +++ /dev/null @@ -1,22 +0,0 @@ -// Type definitions for p-some 2.0 -// Project: https://github.com/sindresorhus/p-some#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 - -import AggregateErrorModule = require('aggregate-error'); - -export = pSome; - -declare function pSome(values: Array> | Iterable>, options: pSome.Options): Promise; - -type Value = T | PromiseLike; - -declare namespace pSome { - interface Options { - count: number; - filter?(value: T): boolean; - } - - const AggregateError: typeof AggregateErrorModule; -} diff --git a/types/p-some/p-some-tests.ts b/types/p-some/p-some-tests.ts deleted file mode 100644 index d3ea9aa3b0..0000000000 --- a/types/p-some/p-some-tests.ts +++ /dev/null @@ -1,34 +0,0 @@ -import got = require('got'); -import pSome = require('p-some'); - -pSome([ - got.head('github.com').then(() => 'github'), - got.head('google.com').then(() => 'google'), - got.head('twitter.com').then(() => 'twitter'), - got.head('medium.com').then(() => 'medium') -], {count: 2}).then(([first, second]) => { - console.log(first, second); -}); - -pSome([ - got.head('github.com').then(() => 1), - got.head('google.com').then(() => 'google'), -], {count: 2}).then(([first, second]) => { - const str: string | number = first; -}); - -pSome(new Set([ - got.head('github.com').then(() => 'github'), - got.head('google.com').then(() => 'google'), - got.head('twitter.com').then(() => 'twitter'), - got.head('medium.com').then(() => 'medium') -]), { - count: 3, - filter(str: string) { - return false; - } -}).then(first => { - const str: string[] = first; -}); - -throw new pSome.AggregateError([]); diff --git a/types/p-some/tsconfig.json b/types/p-some/tsconfig.json deleted file mode 100644 index d8bca7e13a..0000000000 --- a/types/p-some/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-some-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-tap/index.d.ts b/types/p-tap/index.d.ts deleted file mode 100644 index 38996963fc..0000000000 --- a/types/p-tap/index.d.ts +++ /dev/null @@ -1,13 +0,0 @@ -// Type definitions for p-tap 1.0 -// Project: https://github.com/sindresorhus/p-tap#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pTap; - -declare const pTap: pTap; - -interface pTap { - (fn: (value: T) => any): (value: T) => Promise; - catch(fn: (value: any) => any): (value: any) => Promise; -} diff --git a/types/p-tap/p-tap-tests.ts b/types/p-tap/p-tap-tests.ts deleted file mode 100644 index c0db33e3cc..0000000000 --- a/types/p-tap/p-tap-tests.ts +++ /dev/null @@ -1,26 +0,0 @@ -import pTap = require('p-tap'); - -Promise.resolve('unicorn') - .then(pTap(val => { - const str: string = val; - return 1; - })) - .then(val => { - const str: string = val; - }); - -Promise.resolve('unicorn') - .then(pTap(val => { - const str: string = val; - return Promise.resolve(1); - })) - .then(val => { - const str: string = val; - }); - -Promise.reject(new Error()) - .catch(pTap.catch(val => { - const num: number = val; - })) - .then(() => 1) - .catch(() => {}); diff --git a/types/p-tap/tsconfig.json b/types/p-tap/tsconfig.json deleted file mode 100644 index 1d4042647f..0000000000 --- a/types/p-tap/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-tap-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p-timeout/index.d.ts b/types/p-timeout/index.d.ts deleted file mode 100644 index 40e1dc6410..0000000000 --- a/types/p-timeout/index.d.ts +++ /dev/null @@ -1,16 +0,0 @@ -// Type definitions for p-timeout 1.2 -// Project: https://github.com/sindresorhus/p-timeout#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pTimeout; - -declare function pTimeout(input: PromiseLike, ms: number, message?: string | pTimeout.TimeoutError): Promise; -declare function pTimeout(input: PromiseLike, ms: number, fallback: () => R | Promise): Promise; - -declare namespace pTimeout { - class TimeoutError extends Error { - readonly name: 'TimeoutError'; - constructor(message?: string); - } -} diff --git a/types/p-timeout/p-timeout-tests.ts b/types/p-timeout/p-timeout-tests.ts deleted file mode 100644 index 455ed2204f..0000000000 --- a/types/p-timeout/p-timeout-tests.ts +++ /dev/null @@ -1,29 +0,0 @@ -/// - -import pTimeout = require('p-timeout'); - -const delayedPromise: () => Promise = () => new Promise(resolve => setTimeout(() => resolve('foo'), 200)); - -let str: string; -let num: number; -pTimeout(delayedPromise(), 50).then(() => 'foo'); -pTimeout(delayedPromise(), 50, () => { - return pTimeout(delayedPromise(), 300); -}); -pTimeout(delayedPromise(), 50).then(res => str = res); -pTimeout(delayedPromise(), 50, 'error').then(res => str = res); -pTimeout(delayedPromise(), 50, new pTimeout.TimeoutError('error')).then(res => str = res); -pTimeout(delayedPromise(), 50, () => Promise.resolve(10)).then(res => { - if (typeof res === 'string') { - str = res; - } else { - num = res; - } -}); -pTimeout(delayedPromise(), 50, () => 10).then(res => { - if (typeof res === 'string') { - str = res; - } else { - num = res; - } -}); diff --git a/types/p-timeout/tsconfig.json b/types/p-timeout/tsconfig.json deleted file mode 100644 index d16042504a..0000000000 --- a/types/p-timeout/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "p-timeout-tests.ts" - ] -} \ No newline at end of file diff --git a/types/p2/tslint.json b/types/p2/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/p2/tslint.json +++ b/types/p2/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/package-json/index.d.ts b/types/package-json/index.d.ts deleted file mode 100644 index 9089b19d0a..0000000000 --- a/types/package-json/index.d.ts +++ /dev/null @@ -1,77 +0,0 @@ -// Type definitions for package-json 5.0 -// Project: https://github.com/sindresorhus/package-json#readme -// Definitions by: Jinwoo Lee -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = packageJson; - -/** - * Get metadata of a package from the npm registry. - * - * @param name Name of the package. - */ -declare function packageJson( - name: string, - options?: packageJson.Options -): Promise; - -declare namespace packageJson { - interface Options { - /** - * Package version such as `1.0.0` or a [dist tag](https://docs.npmjs.com/cli/dist-tag) such as `latest`. - * - * The version can also be in any format supported by the [semver](https://github.com/npm/node-semver) module. - * For example: - * - `1` - Get the latest `1.x.x` - * - `1.2` - Get the latest `1.2.x` - * - `^1.2.3` - Get the latest `1.x.x` but at least `1.2.3` - * - `~1.2.3` - Get the latest `1.2.x` but at least `1.2.3` - * - * @default 'latest' - */ - version?: string; - /** - * By default, only an abbreviated metadata object is returned for performance reasons. - * [Read more.](https://github.com/npm/registry/blob/master/docs/responses/package-metadata.md) - * @default false - */ - fullMetadata?: boolean; - /** - * Return the [main entry](https://registry.npmjs.org/ava) containing all versions. - * @default false - */ - allVersions?: boolean; - } - - interface PackageJson { - [k: string]: any; - name?: string; - version?: string; - files?: string[]; - bin?: { [k: string]: string }; - man?: string[]; - keywords?: string[]; - author?: Person; - maintainers?: Person[]; - contributors?: Person[]; - bundleDependencies?: { [name: string]: string }; - dependencies?: { [name: string]: string }; - devDependencies?: { [name: string]: string }; - optionalDependencies?: { [name: string]: string }; - description?: string; - engines?: { [type: string]: string }; - license?: string; - repository?: { type: string; url: string }; - bugs?: { url: string; email?: string } | { url?: string; email: string }; - homepage?: string; - scripts?: { [k: string]: string }; - readme?: string; - } - - interface Person { - name?: string; - email?: string; - url?: string; - } -} diff --git a/types/package-json/package-json-tests.ts b/types/package-json/package-json-tests.ts deleted file mode 100644 index 7255351933..0000000000 --- a/types/package-json/package-json-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -import packageJson = require('package-json'); - -packageJson('package-json'); // $ExpectType Promise -packageJson('package-json', { version: '1.2.3' }); // $ExpectType Promise -packageJson('package-json', { fullMetadata: true }); // $ExpectType Promise -packageJson('package-json', { allVersions: true }); // $ExpectType Promise diff --git a/types/package-json/tsconfig.json b/types/package-json/tsconfig.json deleted file mode 100644 index 7bca217f58..0000000000 --- a/types/package-json/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictFunctionTypes": true, - "strictNullChecks": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "package-json-tests.ts" - ] -} \ No newline at end of file diff --git a/types/packery/tslint.json b/types/packery/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/packery/tslint.json +++ b/types/packery/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/page-icon/tslint.json b/types/page-icon/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/page-icon/tslint.json +++ b/types/page-icon/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/page/tslint.json b/types/page/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/page/tslint.json +++ b/types/page/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pako/index.d.ts b/types/pako/index.d.ts index 7f9b31f2b9..b89a4866d4 100644 --- a/types/pako/index.d.ts +++ b/types/pako/index.d.ts @@ -1,84 +1,148 @@ -// Type definitions for pako 1.0.4 +// Type definitions for pako 1.0 // Project: https://github.com/nodeca/pako -// Definitions by: Denis Cappellin , Caleb Eggensperger +// Definitions by: Denis Cappellin +// Caleb Eggensperger +// Muhammet Öztürk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export = Pako; export as namespace pako; declare namespace Pako { - export interface DeflateOptions { - level?: number; - windowBits?: number; - memLevel?: number; - strategy?: number; - dictionary?: any; - raw?: boolean; - to?: 'string'; - } + enum FlushValues { + Z_NO_FLUSH = 0, + Z_PARTIAL_FLUSH = 1, + Z_SYNC_FLUSH = 2, + Z_FULL_FLUSH = 3, + Z_FINISH = 4, + Z_BLOCK = 5, + Z_TREES = 6, + } - export interface InflateOptions { - windowBits?: number; - raw?: boolean; - to?: 'string'; - } + enum StrategyValues { + Z_FILTERED = 1, + Z_HUFFMAN_ONLY = 2, + Z_RLE = 3, + Z_FIXED = 4, + Z_DEFAULT_STRATEGY = 0, + } - export type Data = Uint8Array | Array | string; + enum ReturnCodes { + Z_OK = 0, + Z_STREAM_END = 1, + Z_NEED_DICT = 2, + Z_ERRNO = -1, + Z_STREAM_ERROR = -2, + Z_DATA_ERROR = -3, + Z_BUF_ERROR = -5, + } - /** - * Compress data with deflate algorithm and options. - */ - export function deflate( data: Data, options: DeflateOptions & {to: 'string'} ): string; - export function deflate( data: Data, options?: DeflateOptions ): Uint8Array; + interface DeflateOptions { + level?: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; + windowBits?: number; + memLevel?: number; + strategy?: StrategyValues; + dictionary?: any; + raw?: boolean; + to?: 'string'; + chunkSize?: number; + gzip?: boolean; + header?: Header; + } - /** - * The same as deflate, but creates raw data, without wrapper (header and adler32 crc). - */ - export function deflateRaw( data: Data, options: DeflateOptions & {to: 'string'} ): string; - export function deflateRaw( data: Data, options?: DeflateOptions ): Uint8Array; + interface DeflateFunctionOptions { + level?: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9; + windowBits?: number; + memLevel?: number; + strategy?: StrategyValues; + dictionary?: any; + raw?: boolean; + to?: 'string'; + } - /** - * The same as deflate, but create gzip wrapper instead of deflate one. - */ - export function gzip( data: Data, options: DeflateOptions & {to: 'string'} ): string; - export function gzip( data: Data, options?: DeflateOptions ): Uint8Array; + interface InflateOptions { + windowBits?: number; + dictionary?: any; + raw?: boolean; + to?: 'string'; + chunkSize?: number; + } - /** - * Decompress data with inflate/ungzip and options. Autodetect format via wrapper header - * by default. That's why we don't provide separate ungzip method. - */ - export function inflate( data: Data, options: InflateOptions & {to: 'string'} ): string; - export function inflate( data: Data, options?: InflateOptions ): Uint8Array; + interface InflateFunctionOptions { + windowBits?: number; + raw?: boolean; + to?: 'string'; + } - /** - * The same as inflate, but creates raw data, without wrapper (header and adler32 crc). - */ - export function inflateRaw( data: Data, options: InflateOptions & {to: 'string'} ): string; - export function inflateRaw( data: Data, options?: InflateOptions ): Uint8Array; + interface Header { + text?: boolean; + time?: number; + os?: number; + extra?: number[]; + name?: string; + comment?: string; + hcrc?: boolean; + } - /** - * Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. - */ - export function ungzip( data: Data, options: InflateOptions & {to: 'string'} ): string; - export function ungzip( data: Data, options?: InflateOptions ): Uint8Array; + type Data = Uint8Array | number[] | string; - export class Deflate { - constructor( options?: DeflateOptions ); - err: number; - msg: string; - result: Uint8Array | Array; - onData( chunk: Data ): void; - onEnd( status: number ): void; - push( data: Data | ArrayBuffer, mode?: number | boolean ): boolean; - } + /** + * Compress data with deflate algorithm and options. + */ + function deflate(data: Data, options: DeflateFunctionOptions & { to: 'string' }): string; + function deflate(data: Data, options?: DeflateFunctionOptions): Uint8Array; - export class Inflate { - constructor( options?: InflateOptions ); - err: number; - msg: string; - result: Data; - onData( chunk: Data ): void; - onEnd( status: number ): void; - push( data: Data | ArrayBuffer, mode?: number | boolean ): boolean; - } + /** + * The same as deflate, but creates raw data, without wrapper (header and adler32 crc). + */ + function deflateRaw(data: Data, options: DeflateFunctionOptions & { to: 'string' }): string; + function deflateRaw(data: Data, options?: DeflateFunctionOptions): Uint8Array; + + /** + * The same as deflate, but create gzip wrapper instead of deflate one. + */ + function gzip(data: Data, options: DeflateFunctionOptions & { to: 'string' }): string; + function gzip(data: Data, options?: DeflateFunctionOptions): Uint8Array; + + /** + * Decompress data with inflate/ungzip and options. Autodetect format via wrapper header + * by default. That's why we don't provide separate ungzip method. + */ + function inflate(data: Data, options: InflateFunctionOptions & { to: 'string' }): string; + function inflate(data: Data, options?: InflateFunctionOptions): Uint8Array; + + /** + * The same as inflate, but creates raw data, without wrapper (header and adler32 crc). + */ + function inflateRaw(data: Data, options: InflateFunctionOptions & { to: 'string' }): string; + function inflateRaw(data: Data, options?: InflateFunctionOptions): Uint8Array; + + /** + * Just shortcut to inflate, because it autodetects format by header.content. Done for convenience. + */ + function ungzip(data: Data, options: InflateFunctionOptions & { to: 'string' }): string; + function ungzip(data: Data, options?: InflateFunctionOptions): Uint8Array; + + // https://github.com/nodeca/pako/blob/893381abcafa10fa2081ce60dae7d4d8e873a658/lib/deflate.js + class Deflate { + constructor(options?: DeflateOptions); + err: ReturnCodes; + msg: string; + result: Uint8Array | number[]; + onData(chunk: Data): void; + onEnd(status: number): void; + push(data: Data | ArrayBuffer, mode?: FlushValues | boolean): boolean; + } + + // https://github.com/nodeca/pako/blob/893381abcafa10fa2081ce60dae7d4d8e873a658/lib/inflate.js + class Inflate { + constructor(options?: InflateOptions); + header?: Header; + err: ReturnCodes; + msg: string; + result: Data; + onData(chunk: Data): void; + onEnd(status: number): void; + push(data: Data | ArrayBuffer, mode?: FlushValues | boolean): boolean; + } } diff --git a/types/pako/pako-tests.ts b/types/pako/pako-tests.ts index 5e5a6c3eef..b77bcfb69f 100644 --- a/types/pako/pako-tests.ts +++ b/types/pako/pako-tests.ts @@ -1,24 +1,50 @@ - - import pako = require("pako"); +import * as assert from "assert"; -var chunk1 = new Uint8Array([1,2,3,4,5,6,7,8,9]) -var chunk2 = new Uint8Array([10,11,12,13,14,15,16,17,18,19]); +const chunk1 = new Uint8Array([1, 2, 3, 4, 5, 6, 7, 8, 9]); +const chunk2 = new Uint8Array([10, 11, 12, 13, 14, 15, 16, 17, 18, 19]); +const chunk3 = new Uint8Array([101, 111, 121, 131, 141, 151, 161, 171, 181, 191]); -var deflate = new pako.Deflate({ level: 3 }); +const deflate = new pako.Deflate({level: 3, strategy : pako.StrategyValues.Z_HUFFMAN_ONLY}); deflate.push(chunk1, false); +deflate.push(chunk3, pako.FlushValues.Z_PARTIAL_FLUSH); deflate.push(chunk2, true); // true -> last chunk -if (deflate.err) { - throw new Error( deflate.err.toString() ); +if (deflate.err !== pako.ReturnCodes.Z_OK) { + throw new Error(deflate.err.toString()); } console.log(deflate.result); -let str: string = pako.deflate('1234', {to: 'string'}); -let arr: Uint8Array = pako.deflate('1234'); +const str: string = pako.deflate('1234', {to: 'string'}); +const arr: Uint8Array = pako.deflate('1234'); -let str2: string = pako.inflate('1234', {to: 'string'}); -let arr2: Uint8Array = pako.inflate('1234'); +const str2: string = pako.inflate('1234', {to: 'string'}); +const arr2: Uint8Array = pako.inflate('1234'); +const data = ' '; + +const deflator = new pako.Deflate({ + gzip: true, + header: { + hcrc: true, + time: 1234567, + os: 15, + name: 'test name', + comment: 'test comment', + extra: [ 4, 5, 6 ] + } +}); +deflator.push(data, true); + +const inflator = new pako.Inflate({ to: 'string' }); +inflator.push(deflator.result, true); + +assert.equal(inflator.err, 0); +assert.equal(inflator.result, data); + +const header = inflator.header; +assert.equal(header.time, 1234567); +assert.equal(header.os, 15); +assert.equal(header.name, 'test name'); diff --git a/types/pako/tsconfig.json b/types/pako/tsconfig.json index 011a39c83c..4b4abb5711 100644 --- a/types/pako/tsconfig.json +++ b/types/pako/tsconfig.json @@ -21,4 +21,4 @@ "index.d.ts", "pako-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/pako/tslint.json b/types/pako/tslint.json index a41bf5d19a..adaee1b55f 100644 --- a/types/pako/tslint.json +++ b/types/pako/tslint.json @@ -1,79 +1,6 @@ { "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 + "export-just-namespace": false } } diff --git a/types/palx/index.d.ts b/types/palx/index.d.ts index 0f4804b48f..46f2bb5e55 100644 --- a/types/palx/index.d.ts +++ b/types/palx/index.d.ts @@ -3,23 +3,25 @@ // Definitions by: Mike Fowler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function palx(hex: string, options?: {}): PalxPalette; - -export interface PalxPalette { - [name: string]: string | string[]; - base: string; - black: string; - blue: string[]; - cyan: string[]; - fuschia: string[]; - gray: string[]; - green: string[]; - indigo: string[]; - lime: string[]; - orange: string[]; - pink: string[]; - red: string[]; - teal: string[]; - violet: string[]; - yellow: string[]; +export = palx; +declare function palx(hex: string, options?: {}): palx.PalxPalette; +declare namespace palx { + interface PalxPalette { + [name: string]: string | string[]; + base: string; + black: string; + blue: string[]; + cyan: string[]; + fuschia: string[]; + gray: string[]; + green: string[]; + indigo: string[]; + lime: string[]; + orange: string[]; + pink: string[]; + red: string[]; + teal: string[]; + violet: string[]; + yellow: string[]; + } } diff --git a/types/palx/palx-tests.ts b/types/palx/palx-tests.ts index eec99070d1..be054b2078 100644 --- a/types/palx/palx-tests.ts +++ b/types/palx/palx-tests.ts @@ -1,3 +1,3 @@ -import * as palx from 'palx'; +import palx = require('palx'); -palx.default('#b4da55'); // $ExpectType PalxPalette +palx('#b4da55'); // $ExpectType PalxPalette diff --git a/types/papaparse/tslint.json b/types/papaparse/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/papaparse/tslint.json +++ b/types/papaparse/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/paper/tslint.json b/types/paper/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/paper/tslint.json +++ b/types/paper/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/paralleljs/tslint.json b/types/paralleljs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/paralleljs/tslint.json +++ b/types/paralleljs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/parcel-env/tslint.json b/types/parcel-env/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/parcel-env/tslint.json +++ b/types/parcel-env/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/parse-glob/tslint.json b/types/parse-glob/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/parse-glob/tslint.json +++ b/types/parse-glob/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/parse-mockdb/tslint.json b/types/parse-mockdb/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/parse-mockdb/tslint.json +++ b/types/parse-mockdb/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/parse-ms/index.d.ts b/types/parse-ms/index.d.ts index 1a8a63d4a2..62087873d4 100644 --- a/types/parse-ms/index.d.ts +++ b/types/parse-ms/index.d.ts @@ -3,7 +3,8 @@ // Definitions by: Giles Roadnight // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export default function parseMs(ms: number): { +export = parseMs; +declare function parseMs(ms: number): { days: number; hours: number; minutes: number; diff --git a/types/parse-ms/parse-ms-tests.ts b/types/parse-ms/parse-ms-tests.ts index 2b747ad5a8..dbb4640518 100644 --- a/types/parse-ms/parse-ms-tests.ts +++ b/types/parse-ms/parse-ms-tests.ts @@ -1,3 +1,3 @@ -import parseMs from "parse-ms"; +import parseMs = require("parse-ms"); const { days, hours, milliseconds, minutes, seconds } = parseMs(3000); diff --git a/types/parse/index.d.ts b/types/parse/index.d.ts index b87a9f5f56..ba3d546ca5 100644 --- a/types/parse/index.d.ts +++ b/types/parse/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for parse 2.1.0 +// Type definitions for parse 2.2.1 // Project: https://parseplatform.org/ // Definitions by: Ullisen Media Group // David Poetzsch-Heffter @@ -8,6 +8,8 @@ // Otherwise SAS // Andrew Goldis // Alexandre Hétu Rivard +// Diamond Lewis +// Jong Eun Lee // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 @@ -22,6 +24,10 @@ declare namespace Parse { let liveQueryServerURL: string; let VERSION: string; + interface BatchSizeOption { + batchSize?: number; + } + interface SuccessOption { success?: Function; } @@ -30,6 +36,24 @@ declare namespace Parse { error?: Function; } + interface FullOptions { + success?: Function; + error?: Function; + useMasterKey?: boolean; + sessionToken?: string; + installationId?: string; + progress?: Function; + } + + interface RequestOptions { + useMasterKey?: boolean; + sessionToken?: string; + installationId?: string; + batchSize?: number; + include?: string | string[]; + progress?: Function; + } + interface SuccessFailureOptions extends SuccessOption, ErrorOption { } @@ -264,19 +288,26 @@ declare namespace Parse { constructor(className?: string, options?: any); constructor(attributes?: string[], options?: any); - static extend(className: string, protoProps?: any, classProps?: any): any; - static fromJSON(json: any, override: boolean): any; - + static createWithoutData(id: string): T; + static destroyAll(list: T[], options?: Object.DestroyAllOptions): Promise; + static extend(className: string | { className: string }, protoProps?: any, classProps?: any): any; static fetchAll(list: T[], options: Object.FetchAllOptions): Promise; static fetchAllIfNeeded(list: T[], options: Object.FetchAllOptions): Promise; - static destroyAll(list: T[], options?: Object.DestroyAllOptions): Promise; - static saveAll(list: T[], options?: Object.SaveAllOptions): Promise; + static fetchAllWithInclude(list: T[], keys: string | Array>, options: RequestOptions): Promise; + static fromJSON(json: any, override: boolean): any; + static pinAll(objects: Object[]): Promise; + static pinAllWithName(name: string, objects: Object[]): Promise; static registerSubclass(className: string, clazz: new (options?: any) => T): void; - static createWithoutData(id: string): T; + static saveAll(list: T[], options?: Object.SaveAllOptions): Promise; + static unPinAll(objects: Object[]): Promise; + static unPinAllObjects(): Promise; + static unPinAllObjectsWithName(name: string): Promise; + static unPinAllWithName(name: string, objects: Object[]): Promise; - initialize(): void; - add(attr: string, item: any): this; - addUnique(attr: string, item: any): any; + add(attr: string, item: any): this | boolean; + addAll(attr: string, items: any[]): this | boolean; + addAllUnique(attr: string, items: any[]): this | boolean; + addUnique(attr: string, item: any): this | boolean; change(options: any): this; changedAttributes(diff: any): boolean; clear(options: any): any; @@ -284,21 +315,29 @@ declare namespace Parse { destroy(options?: Object.DestroyOptions): Promise; dirty(attr?: string): boolean; dirtyKeys(): string[]; + equals(other: any): boolean; escape(attr: string): string; existed(): boolean; fetch(options?: Object.FetchOptions): Promise; + fetchFromLocalDatastore(): Promise | void; + fetchWithInclude(keys: string | Array>, options?: RequestOptions): Promise; get(attr: string): any | undefined; getACL(): ACL | undefined; has(attr: string): boolean; hasChanged(attr: string): boolean; increment(attr: string, amount?: number): any; + initialize(): void; isNew(): boolean; + isPinned(): Promise; isValid(): boolean; op(attr: string): any; + pin(): Promise; + pinWithName(name: string): Promise; previous(attr: string): any; previousAttributes(): any; relation(attr: string): Relation; - remove(attr: string, item: any): any; + remove(attr: string, item: any): this | boolean; + removeAll(attr: string, items: any): this | boolean; revert(): void; save(attrs?: { [key: string]: any } | null, options?: Object.SaveOptions): Promise; save(key: string, value: any, options?: Object.SaveOptions): Promise; @@ -307,6 +346,8 @@ declare namespace Parse { set(attrs: object, options?: Object.SetOptions): boolean; setACL(acl: ACL, options?: SuccessFailureOptions): boolean; toPointer(): Pointer; + unPin(): Promise; + unPinWithName(name: string): Promise; unset(attr: string, options?: any): any; validate(attrs: any, options?: SuccessFailureOptions): boolean; } @@ -314,7 +355,7 @@ declare namespace Parse { namespace Object { interface DestroyOptions extends SuccessFailureOptions, WaitOption, ScopeOptions { } - interface DestroyAllOptions extends SuccessFailureOptions, ScopeOptions { } + interface DestroyAllOptions extends BatchSizeOption, ScopeOptions { } interface FetchAllOptions extends SuccessFailureOptions, ScopeOptions { } @@ -322,13 +363,18 @@ declare namespace Parse { interface SaveOptions extends SuccessFailureOptions, SilentOption, ScopeOptions, WaitOption { } - interface SaveAllOptions extends SuccessFailureOptions, ScopeOptions { } + interface SaveAllOptions extends BatchSizeOption, ScopeOptions { } interface SetOptions extends ErrorOption, SilentOption { promise?: any; } } + class Polygon extends BaseObject { + constructor(arg1: GeoPoint[] | number[][]); + containsPoint(point: GeoPoint): boolean; + equals(other: Polygon | any): boolean; + } /** * Every Parse application installed on a device registered for * push notifications has an associated Installation object. @@ -413,18 +459,23 @@ declare namespace Parse { constructor(objectClass: string); constructor(objectClass: new (...args: any[]) => T); + static and(...args: Query[]): Query; + static fromJSON(className: string, json: any): Query; + static nor(...args: Query[]): Query; static or(...var_args: Query[]): Query; - aggregate(pipeline: Query.AggregationOptions|Query.AggregationOptions[]): Query; addAscending(key: string): Query; addAscending(key: string[]): Query; addDescending(key: string): Query; addDescending(key: string[]): Query; ascending(key: string): Query; ascending(key: string[]): Query; + aggregate(pipeline: Query.AggregationOptions|Query.AggregationOptions[]): Query; + containedBy(key: string, values: any[]): Query; containedIn(key: string, values: any[]): Query; contains(key: string, substring: string): Query; containsAll(key: string, values: any[]): Query; + containsAllStartingWith(key: string, values: any[]): Query; count(options?: Query.CountOptions): Promise; descending(key: string): Query; descending(key: string[]): Query; @@ -438,12 +489,16 @@ declare namespace Parse { exists(key: string): Query; find(options?: Query.FindOptions): Promise; first(options?: Query.FirstOptions): Promise; + fromLocalDatastore(): void; + fromPin(): void; + fromPinWithName(name: string): void; fullText(key: string, value: string, options?: Query.FullTextOptions): Query; get(objectId: string, options?: Query.GetOptions): Promise; greaterThan(key: string, value: any): Query; greaterThanOrEqualTo(key: string, value: any): Query; include(key: string): Query; include(keys: string[]): Query; + includeAll(): Query; lessThan(key: string, value: any): Query; lessThanOrEqualTo(key: string, value: any): Query; limit(n: number): Query; @@ -453,13 +508,17 @@ declare namespace Parse { near(key: string, point: GeoPoint): Query; notContainedIn(key: string, values: any[]): Query; notEqualTo(key: string, value: any): Query; + polygonContains(key: string, point: GeoPoint): Query; select(...keys: string[]): Query; skip(n: number): Query; + sortByTextScore(): this; startsWith(key: string, prefix: string): Query; subscribe(): LiveQuerySubscription; + withJSON(json: any): this; withinGeoBox(key: string, southwest: GeoPoint, northeast: GeoPoint): Query; withinKilometers(key: string, point: GeoPoint, maxDistance: number): Query; withinMiles(key: string, point: GeoPoint, maxDistance: number): Query; + withinPolygon(key: string, points: GeoPoint[]): Query; withinRadians(key: string, point: GeoPoint, maxDistance: number): Query; } @@ -597,6 +656,7 @@ subscription.on('close', () => {}); class Config extends Object { static get(options?: SuccessFailureOptions): Promise; static current(): Config; + static save(attr: any): Promise; get(attr: string): any; escape(attr: string): any; @@ -620,14 +680,16 @@ subscription.on('close', () => {}); */ class User extends Object { + static allowCustomUserClass(isAllowed: boolean): void; + static become(sessionToken: string, options?: UseMasterKeyOption): Promise; static current(): User | undefined; + static currentAsync(): Promise; static signUp(username: string, password: string, attrs: any, options?: SignUpOptions): Promise; static logIn(username: string, password: string, options?: SuccessFailureOptions): Promise; static logOut(): Promise; - static allowCustomUserClass(isAllowed: boolean): void; - static become(sessionToken: string, options?: SuccessFailureOptions): Promise; static requestPasswordReset(email: string, options?: SuccessFailureOptions): Promise; static extend(protoProps?: any, classProps?: any): any; + static hydrate(userJSON: any): Promise; signUp(attrs: any, options?: SignUpOptions): Promise; logIn(options?: SuccessFailureOptions): Promise; @@ -959,6 +1021,23 @@ subscription.on('close', () => {}); */ function setAsyncStorage(AsyncStorage: any): void; + /** + * Gets all contents from Local Datastore. + */ + function dumpLocalDatastore(): Promise<{ [key: string]: any }>; + + /** + * Enable pinning in your application. + * This must be called before your application can use pinning. + */ + function enableLocalDatastore(): void; + + /** + * Flag that indicates whether Local Datastore is enabled. + */ + function isLocalDatastoreEnabled(): boolean; + + function setLocalDatastoreController(controller: any): void; } declare module "parse/node" { diff --git a/types/parse/parse-tests.ts b/types/parse/parse-tests.ts index cb80764cd4..1b91772746 100644 --- a/types/parse/parse-tests.ts +++ b/types/parse/parse-tests.ts @@ -14,6 +14,10 @@ class Game extends Parse.Object { } } +function test_config() { + Parse.Config.save({ foo: 'bar' }); +} + function test_object() { const game = new Game(); @@ -51,10 +55,18 @@ function test_object() { gameScore.increment("score"); gameScore.addUnique("skills", "flying"); gameScore.addUnique("skills", "kungfu"); - + gameScore.addAll("skills", ["kungfu"]); + gameScore.addAllUnique("skills", ["kungfu"]); + gameScore.remove('skills', 'flying'); + gameScore.removeAll('skills', ["kungFu"]); game.set("gameScore", gameScore); const gameCopy = Game.fromJSON(JSON.parse(JSON.stringify(game)), true); + + const object = new Parse.Object('TestObject'); + object.equals(gameScore); + object.fetchWithInclude(['key1', 'key2']); + } function test_query() { @@ -87,6 +99,7 @@ function test_query() { // Restricts to wins >= 50 query.greaterThanOrEqualTo("wins", 50); + query.containedBy('place', ['1', '2']); // Finds scores from any of Jonathan, Dario, or Shawn query.containedIn("playerName", ["Jonathan Walsh", "Dario Wunsch", "Shawn Simon"]); @@ -109,13 +122,15 @@ function test_query() { // Find objects where the array in arrayKey contains all of the elements 2, 3, and 4. query.containsAll("arrayKey", [2, 3, 4]); + query.containsAllStartingWith("arrayKey", [2, 3, 4]); query.startsWith("name", "Big Daddy's"); query.equalTo("score", gameScore); query.exists("score"); query.include("score"); query.include(["score.team"]); - + query.includeAll(); + query.sortByTextScore(); // Find objects that match the aggregation pipeline query.aggregate({ group:{ @@ -222,6 +237,15 @@ function test_user() { user.signUp(null, { useMasterKey: true }); } +async function test_user_currentAsync() { + const asyncUser = await Parse.User.currentAsync(); + if (asyncUser) { + asyncUser.set('email', 'email@example.com'); + } else if (asyncUser === null) { + Parse.User.logIn('email@example.com', 'my pass'); + } +} + function test_user_acl_roles() { const user = new Parse.User(); @@ -245,6 +269,12 @@ function test_user_acl_roles() { // The token could not be validated. }); + Parse.User.hydrate({}).then(function (user) { + // The current user is now set to user. + }, function (error) { + // The token could not be validated. + }); + const game = new Game(); game.set("score", new GameScore()); game.setACL(new Parse.ACL(Parse.User.current())); @@ -508,3 +538,47 @@ function test_query_subscribe() { // unsubscribe subscription.unsubscribe(); } + +function test_serverURL() { + Parse.serverURL = 'http://localhost:1337/parse'; +} +function test_polygon() { + const point = new Parse.GeoPoint(1,2); + const polygon1 = new Parse.Polygon([[0,0], [1,0], [1,1], [0,1]]); + const polygon2 = new Parse.Polygon([point, point, point]); + polygon1.equals(polygon2); + polygon1.containsPoint(point); + + const query = new Parse.Query('TestObject'); + query.polygonContains('key', point); + query.withinPolygon('key', [point, point, point]); +} + +async function test_local_datastore() { + Parse.enableLocalDatastore(); + const name = 'test_pin'; + const obj = new Parse.Object('TestObject'); + await obj.pin(); + await obj.unPin(); + await obj.isPinned(); + await obj.pinWithName(name); + await obj.unPinWithName(name); + await obj.fetchFromLocalDatastore(); + + await Parse.Object.pinAll([obj]); + await Parse.Object.unPinAll([obj]); + await Parse.Object.pinAllWithName(name, [obj]); + await Parse.Object.unPinAllWithName(name, [obj]); + await Parse.Object.unPinAllObjects(); + await Parse.Object.unPinAllObjectsWithName(name); + + const flag = Parse.isLocalDatastoreEnabled(); + const LDS = await Parse.dumpLocalDatastore(); + + const query = new Parse.Query('TestObject'); + query.fromPin(); + query.fromPinWithName(name); + query.fromLocalDatastore(); + + Parse.setLocalDatastoreController({}); +} diff --git a/types/parse/tslint.json b/types/parse/tslint.json index e2172b7f24..158db48e64 100644 --- a/types/parse/tslint.json +++ b/types/parse/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/parse5-html-rewriting-stream/index.d.ts b/types/parse5-html-rewriting-stream/index.d.ts index cb905c3162..4722f7d096 100644 --- a/types/parse5-html-rewriting-stream/index.d.ts +++ b/types/parse5-html-rewriting-stream/index.d.ts @@ -14,7 +14,7 @@ import * as stream from 'stream'; * not affected by parser error-recovery mechanisms as in the classical * parsing-serialization roundtrip. */ -export default class RewritingStream extends stream.Transform { +declare class RewritingStream extends stream.Transform { on(event: string, listener: (...args: any[]) => void): this; /** @@ -78,3 +78,4 @@ export default class RewritingStream extends stream.Transform { */ emitRaw(html: string): void; } +export = RewritingStream; diff --git a/types/parse5-html-rewriting-stream/parse5-html-rewriting-stream-tests.ts b/types/parse5-html-rewriting-stream/parse5-html-rewriting-stream-tests.ts index f134e4807b..25e0a4aec6 100644 --- a/types/parse5-html-rewriting-stream/parse5-html-rewriting-stream-tests.ts +++ b/types/parse5-html-rewriting-stream/parse5-html-rewriting-stream-tests.ts @@ -1,4 +1,4 @@ -import RewritingStream from 'parse5-html-rewriting-stream'; +import RewritingStream = require('parse5-html-rewriting-stream'); const rewritingStream = new RewritingStream(); rewritingStream.on('startTag', (startTag, rawHtml) => { diff --git a/types/passport-beam/tslint.json b/types/passport-beam/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-beam/tslint.json +++ b/types/passport-beam/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-github2/index.d.ts b/types/passport-github2/index.d.ts index 0048cfd901..a938e8c36b 100644 --- a/types/passport-github2/index.d.ts +++ b/types/passport-github2/index.d.ts @@ -29,6 +29,7 @@ export interface StrategyOption extends passport.AuthenticateOptions { scopeSeparator?: string; customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; + userEmailURL?: string; } export type OAuth2StrategyOptionsWithoutRequiredURLs = Pick< @@ -50,6 +51,7 @@ export interface _StrategyOptionsBase extends OAuth2StrategyOptionsWithoutRequir scopeSeparator?: string; customHeaders?: OutgoingHttpHeaders; userProfileURL?: string; + userEmailURL?: string; } export interface StrategyOptions extends _StrategyOptionsBase { diff --git a/types/passport-google-oauth/tslint.json b/types/passport-google-oauth/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-google-oauth/tslint.json +++ b/types/passport-google-oauth/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-http-bearer/tslint.json b/types/passport-http-bearer/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-http-bearer/tslint.json +++ b/types/passport-http-bearer/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-jwt/tslint.json b/types/passport-jwt/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-jwt/tslint.json +++ b/types/passport-jwt/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-local-mongoose/tslint.json b/types/passport-local-mongoose/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/passport-local-mongoose/tslint.json +++ b/types/passport-local-mongoose/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-local/tslint.json b/types/passport-local/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-local/tslint.json +++ b/types/passport-local/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-oauth2-client-password/passport-oauth2-client-password-tests.ts b/types/passport-oauth2-client-password/passport-oauth2-client-password-tests.ts index 69e03cd6d4..84d7da4431 100644 --- a/types/passport-oauth2-client-password/passport-oauth2-client-password-tests.ts +++ b/types/passport-oauth2-client-password/passport-oauth2-client-password-tests.ts @@ -17,7 +17,7 @@ class Client implements IClient { public clientSecret: string; static findOne(client: IClient, callback: (err: any, client: Client) => void): void { - callback(null, new this); + callback(null, new Client); } } //#endregion diff --git a/types/passport-oauth2-client-password/tslint.json b/types/passport-oauth2-client-password/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-oauth2-client-password/tslint.json +++ b/types/passport-oauth2-client-password/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-saml/index.d.ts b/types/passport-saml/index.d.ts index 24f0effa71..874b84ed7f 100644 --- a/types/passport-saml/index.d.ts +++ b/types/passport-saml/index.d.ts @@ -3,8 +3,9 @@ // Definitions by: Chris Barth // Damian Assennato // Karol Samborski +// Jose Colella // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.3 +// TypeScript Version: 3.0 import passport = require('passport'); import express = require('express'); @@ -20,9 +21,9 @@ export interface CacheProvider { remove(key: string, callback: (err: Error | null, key: string) => void | null): void; } -export type VerifiedCallback = (err: Error | null, user: object, info: object) => void; +export type VerifiedCallback = (err: Error | null, user?: object, info?: object) => void; -export type VerifyWithRequest = (req: express.Request, profile: object, done: VerifiedCallback) => void; +export type VerifyWithRequest = (req: express.Request, profile: Profile, done: VerifiedCallback) => void; export type VerifyWithoutRequest = (profile: object, done: VerifiedCallback) => void; @@ -41,8 +42,8 @@ export interface SamlConfig { path?: string; protocol?: string; host?: string; - entryPoint: string; - issuer: string; + entryPoint?: string; + issuer?: string; privateCert?: string; cert?: string | string[] | CertCallback; decryptionPvk?: string; @@ -82,3 +83,20 @@ export interface AuthenticateOptions extends passport.AuthenticateOptions { export interface AuthorizeOptions extends AuthenticateOptions { samlFallback?: string; } + +export type Profile = { + issuer?: string; + sessionIndex?: string; + nameID?: string; + nameIDFormat?: string; + nameQualifier?: string; + spNameQualifier?: string; + ID?: string; + mail?: string; // InCommon Attribute urn:oid:0.9.2342.19200300.100.1.3 + email?: string; // `mail` if not present in the assertion + getAssertionXml(): string; // get the raw assertion XML + getAssertion(): object; // get the assertion XML parsed as a JavaScript object + getSamlResponseXml(): string; // get the raw SAML response XML +} & { + [attributeName: string]: unknown; // arbitrary `AttributeValue`s +}; diff --git a/types/passport-saml/multiSamlStrategy.d.ts b/types/passport-saml/multiSamlStrategy.d.ts index 405c7264dc..c9d8568aad 100644 --- a/types/passport-saml/multiSamlStrategy.d.ts +++ b/types/passport-saml/multiSamlStrategy.d.ts @@ -1,10 +1,16 @@ import express = require('express'); import { Strategy, SamlConfig, VerifyWithRequest, VerifyWithoutRequest } from './index'; -export interface MultiSamlConfig extends SamlConfig { - getSamlOptions(req: express.Request, callback: (err: Error | null, samlOptions: SamlConfig) => void): void; +declare namespace MultiSamlStrategy { + type SamlOptionsCallback = (err: Error | null, samlOptions?: SamlConfig) => void; + + interface MultiSamlConfig extends SamlConfig { + getSamlOptions(req: express.Request, callback: SamlOptionsCallback): void; + } } -export class MultiSamlStrategy extends Strategy { - constructor(config: MultiSamlConfig, verify: VerifyWithRequest | VerifyWithoutRequest); +declare class MultiSamlStrategy extends Strategy { + constructor(config: MultiSamlStrategy.MultiSamlConfig, verify: VerifyWithRequest | VerifyWithoutRequest); } + +export = MultiSamlStrategy; diff --git a/types/passport-saml/passport-saml-tests.ts b/types/passport-saml/passport-saml-tests.ts index b22421fe81..04901e52a1 100644 --- a/types/passport-saml/passport-saml-tests.ts +++ b/types/passport-saml/passport-saml-tests.ts @@ -35,24 +35,26 @@ passport.authenticate('samlCustomName', {failureRedirect: '/', failureFlash: tru const metadata = samlStrategy.generateServiceProviderMetadata("decryptionCert"); -const multiSamlStrategy = new MultiSamlStrategy.MultiSamlStrategy( +const multiSamlStrategy = new MultiSamlStrategy( { name: 'samlCustomName', path: '/login/callback', entryPoint: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php', issuer: 'passport-saml', - getSamlOptions(req: express.Request, callback: (err: Error | null, samlOptions: SamlStrategy.SamlConfig) => void) { + getSamlOptions(req: express.Request, callback: MultiSamlStrategy.SamlOptionsCallback) { callback(null, { name: 'samlCustomName', path: '/login/callback2', entryPoint: 'https://openidp.feide.no/simplesaml/saml2/idp/SSOService.php', issuer: 'passport-saml', - }); + }); + callback(new Error("SAML Options Error")); } }, - (profile: {}, done: (err: Error | null, user: {}, info?: {}) => void) => { + (profile: {}, done: (err: Error | null, user?: {}, info?: {}) => void) => { const user = {}; done(null, user); + done(new Error("Verify Request Error")); } ); diff --git a/types/passport-strategy/tslint.json b/types/passport-strategy/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-strategy/tslint.json +++ b/types/passport-strategy/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/passport-twitter/tslint.json b/types/passport-twitter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/passport-twitter/tslint.json +++ b/types/passport-twitter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/password-hash/tslint.json b/types/password-hash/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/password-hash/tslint.json +++ b/types/password-hash/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/path-key/index.d.ts b/types/path-key/index.d.ts deleted file mode 100644 index e93e334248..0000000000 --- a/types/path-key/index.d.ts +++ /dev/null @@ -1,17 +0,0 @@ -// Type definitions for path-key 2.0 -// Project: https://github.com/sindresorhus/path-key#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export = pathKey; - -declare function pathKey(options?: pathKey.Options): string; - -declare namespace pathKey { - interface Options { - env?: { [key: string]: any }; - platform?: NodeJS.Platform; - } -} diff --git a/types/path-key/path-key-tests.ts b/types/path-key/path-key-tests.ts deleted file mode 100644 index 820a8431de..0000000000 --- a/types/path-key/path-key-tests.ts +++ /dev/null @@ -1,5 +0,0 @@ -import pathKey = require('path-key'); - -pathKey(); // $ExpectType string -pathKey({ env: {} }); // $ExpectType string -pathKey({ platform: 'win32' }); // $ExpectType string diff --git a/types/path-key/tsconfig.json b/types/path-key/tsconfig.json deleted file mode 100644 index 3e1f0bf50f..0000000000 --- a/types/path-key/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "path-key-tests.ts" - ] -} diff --git a/types/path-parse/tslint.json b/types/path-parse/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/path-parse/tslint.json +++ b/types/path-parse/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/path-type/index.d.ts b/types/path-type/index.d.ts deleted file mode 100644 index d67856f85e..0000000000 --- a/types/path-type/index.d.ts +++ /dev/null @@ -1,15 +0,0 @@ -// Type definitions for path-type 3.0 -// Project: https://github.com/sindresorhus/path-type#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export const file: PathTypeFn; -export const dir: PathTypeFn; -export const symlink: PathTypeFn; - -export const fileSync: PathTypeSyncFn; -export const dirSync: PathTypeSyncFn; -export const symlinkSync: PathTypeSyncFn; - -export type PathTypeFn = (path: string) => Promise; -export type PathTypeSyncFn = (path: string) => boolean; diff --git a/types/path-type/path-type-tests.ts b/types/path-type/path-type-tests.ts deleted file mode 100644 index d070731523..0000000000 --- a/types/path-type/path-type-tests.ts +++ /dev/null @@ -1,15 +0,0 @@ -import pathType = require('path-type'); - -// $ExpectType Promise -pathType.file('package.json'); -// $ExpectType Promise -pathType.dir('package.json'); -// $ExpectType Promise -pathType.symlink('package.json'); - -// $ExpectType boolean -pathType.fileSync('package.json'); -// $ExpectType boolean -pathType.dirSync('package.json'); -// $ExpectType boolean -pathType.symlinkSync('package.json'); diff --git a/types/path-type/tsconfig.json b/types/path-type/tsconfig.json deleted file mode 100644 index f2c7533a5d..0000000000 --- a/types/path-type/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "path-type-tests.ts" - ] -} diff --git a/types/pathfinding/tslint.json b/types/pathfinding/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pathfinding/tslint.json +++ b/types/pathfinding/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pathjs/tslint.json b/types/pathjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pathjs/tslint.json +++ b/types/pathjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/paypal-cordova-plugin/tslint.json b/types/paypal-cordova-plugin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/paypal-cordova-plugin/tslint.json +++ b/types/paypal-cordova-plugin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pdfjs-dist/index.d.ts b/types/pdfjs-dist/index.d.ts index 81de4624f9..84d40e926a 100644 --- a/types/pdfjs-dist/index.d.ts +++ b/types/pdfjs-dist/index.d.ts @@ -1,487 +1,471 @@ -// Type definitions for PDF.js v0.1.0 +// Type definitions for PDF.js v2.0 // Project: https://github.com/mozilla/pdf.js -// Definitions by: Josh Baldwin +// Definitions by: Josh Baldwin , Dmitrii Sorin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 -/* -Copyright (c) 2013 Josh Baldwin https://github.com/jbaldwin/pdf.d.ts - -Permission is hereby granted, free of charge, to any person -obtaining a copy of this software and associated documentation -files (the "Software"), to deal in the Software without -restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -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. -*/ +/// interface PDFPromise { - isResolved(): boolean; - isRejected(): boolean; - resolve(value: T): void; - reject(reason: string): void; - then(onResolve: (promise: T) => U, onReject?: (reason: string) => void): 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[]; + 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 + 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; + parse(): void; + get(name: string): string; + has(name: string): boolean; } interface PDFSource { - url?: string; - data?: Uint8Array; - httpHeaders?: any; - password?: string; + url?: string; + data?: Uint8Array; + httpHeaders?: any; + password?: string; } interface PDFProgressData { - loaded: number; - total: number; + loaded: number; + total: number; } interface PDFDocumentProxy { - /** - * Total number of pages the PDF contains. - **/ - numPages: number; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * @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; + /** + * 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 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 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 }>; + /** + * 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; + /** + * Is the PDF encrypted? + **/ + isEncrypted(): PDFPromise; - /** - * A promise that is resolved with Uint8Array that has the raw PDF data. - **/ - getData(): 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; + /** + * TODO: return type of Promise + * A promise that is resolved when the document's data is loaded. + **/ + dataLoaded(): PDFPromise; - /** - * - **/ - destroy(): void; + /** + * + **/ + destroy(): void; } interface PDFRef { - num: number; - gen: any; // todo + num: number; + gen: any; // todo } interface PDFPageViewportOptions { - viewBox: any; - scale: number; - rotation: number; - offsetX: number; - offsetY: number; - dontFlip: boolean; + viewBox: any; + scale: number; + rotation: number; + offsetX: number; + offsetY: number; + dontFlip: boolean; } interface PDFPageViewport { - width: number; - height: number; - fontScale: number; - transforms: number[]; + 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] + 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; + 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 + 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; + beginLayout(): void; + endLayout(): void; + appendText(): void; } interface PDFRenderImageLayer { - beginLayout(): void; - endLayout(): void; - appendImage(): void; + beginLayout(): void; + endLayout(): void; + appendImage(): void; } interface PDFRenderParams { - canvasContext: CanvasRenderingContext2D; - viewport?: PDFPageViewport; - textLayer?: PDFRenderTextLayer; - imageLayer?: PDFRenderImageLayer; - continueCallback?: (_continue: () => void) => void; + canvasContext: CanvasRenderingContext2D; + viewport?: PDFPageViewport; + textLayer?: PDFRenderTextLayer; + imageLayer?: PDFRenderImageLayer; + continueCallback?: (_continue: () => void) => void; } interface PDFViewerParams { - container: HTMLElement; - viewer?: HTMLElement; + container: HTMLElement; + viewer?: HTMLElement; } /** * RenderTask is basically a promise but adds a cancel function to termiate it. **/ -interface PDFRenderTask extends PDFPromise { +interface PDFRenderTask extends PDFLoadingTask { - /** - * 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; + /** + * 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; + /** + * Page number of the page. First page is 1. + **/ + pageNumber: number; - /** - * The number of degrees the page is rotated clockwise. - **/ - rotate: number; + /** + * The number of degrees the page is rotated clockwise. + **/ + rotate: number; - /** - * The reference that points to this page. - **/ - ref: PDFRef; + /** + * 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[]; + /** + * @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; + /** + * @param scale The desired scale of the viewport. + * @param rotate Degrees to rotate the viewport. If omitted this defaults to the page rotation. + * @param dontFlip + * @return + **/ + getViewport(scale: number, rotate?: number, dontFlip?: boolean): PDFPageViewport; - /** - * A promise that is resolved with an array of the annotation objects. - **/ - getAnnotations(): PDFPromise; + /** + * 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; + /** + * 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; + /** + * A promise that is resolved with the string that is the text content frm the page. + **/ + getTextContent(): PDFPromise; - /** - * marked as future feature - **/ - //getOperationList(): PDFPromise<>; + /** + * marked as future feature + **/ + //getOperationList(): PDFPromise<>; - /** - * Destroyes resources allocated by the page. - **/ - destroy(): void; + /** + * 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 + 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; + 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; + 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[]; + /** + * 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 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; + /** + * The url of where the predefined Adobe CMaps are located. Include trailing + * slash. + */ + cMapUrl: string; - /** - * Specifies if CMaps are binary packed. - */ - cMapPacked: boolean; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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 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 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; + /** + * 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 special hooks for debugging PDF.js. + */ + pdfBug: boolean; - /** - * Enables transfer usage in postMessage for ArrayBuffers. - */ - postMessageTransfers: boolean; + /** + * Enables transfer usage in postMessage for ArrayBuffers. + */ + postMessageTransfers: boolean; - /** - * Disables URL.createObjectURL usage. - */ - disableCreateObjectURL: boolean; + /** + * Disables URL.createObjectURL usage. + */ + disableCreateObjectURL: boolean; - /** - * Disables WebGL usage. - */ - disableWebGL: boolean; + /** + * Disables WebGL usage. + */ + disableWebGL: boolean; - /** - * Disables fullscreen support, and by extension Presentation Mode, - * in browsers which support the fullscreen API. - */ - disableFullscreen: 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; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; + /** + * 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; + 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; } + +interface PDFLoadingTask { + promise: PDFPromise; +} + +declare const 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. + **/ +declare function getDocument( + source: string, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; + +declare function getDocument( + source: Uint8Array, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; + +declare function getDocument( + source: PDFSource, + pdfDataRangeTransport?: any, + passwordCallback?: (fn: (password: string) => void, reason: string) => string, + progressCallback?: (progressData: PDFProgressData) => void +): PDFLoadingTask; diff --git a/types/pdfjs-dist/pdfjs-dist-tests.ts b/types/pdfjs-dist/pdfjs-dist-tests.ts index ef569b2fda..cb7be752af 100644 --- a/types/pdfjs-dist/pdfjs-dist-tests.ts +++ b/types/pdfjs-dist/pdfjs-dist-tests.ts @@ -1,4 +1,4 @@ -import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; +import { getDocument, PDFDocumentProxy, PDFPromise, Util } from 'pdfjs-dist'; // // Fetch the PDF document from the URL using promises @@ -6,7 +6,7 @@ import { PDFJS, PDFDocumentProxy, PDFPromise } from 'pdfjs-dist'; var pdfDoc: PDFDocumentProxy; var pageNum: number; -PDFJS.getDocument('helloworld.pdf').then(function (pdf) { +getDocument('helloworld.pdf').promise.then(function (pdf) { // Using promise to fetch the page pdfDoc = pdf; pageNum = 1; @@ -32,7 +32,7 @@ function renderPage(pageNum: number) { // https://github.com/mozilla/pdf.js/blob/master/examples/acroforms/forms.js // const rect = viewport.convertToViewportRectangle([100,100,0,0]); - const normalizedRect = PDFJS.Util.normalizeRect(rect); + const normalizedRect = Util.normalizeRect(rect); const point = viewport.convertToViewportPoint(100, 100); const pdfPoint = viewport.convertToPdfPoint(100, 100); @@ -57,6 +57,6 @@ function goNext() { // // Test PDFPromise allows return value mutation // -var promise: PDFPromise = PDFJS.getDocument('helloworld.pdf').then(pdf => { +var promise: PDFPromise = getDocument('helloworld.pdf').promise.then(pdf => { return "arbitrary string"; -}); \ No newline at end of file +}); diff --git a/types/pdfjs-dist/tslint.json b/types/pdfjs-dist/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/pdfjs-dist/tslint.json +++ b/types/pdfjs-dist/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pdfkit/tslint.json b/types/pdfkit/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pdfkit/tslint.json +++ b/types/pdfkit/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pdfobject/tslint.json b/types/pdfobject/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pdfobject/tslint.json +++ b/types/pdfobject/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pebblekitjs/tslint.json b/types/pebblekitjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pebblekitjs/tslint.json +++ b/types/pebblekitjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/peerjs/tslint.json b/types/peerjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/peerjs/tslint.json +++ b/types/peerjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pegjs/tslint.json b/types/pegjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pegjs/tslint.json +++ b/types/pegjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pendo-io-browser/index.d.ts b/types/pendo-io-browser/index.d.ts new file mode 100644 index 0000000000..2b8e0082b7 --- /dev/null +++ b/types/pendo-io-browser/index.d.ts @@ -0,0 +1,165 @@ +// Type definitions for non-npm package Pendo.io Agent 2.16 +// Project: https://www.pendo.io/ +// Definitions by: Aaron Beall +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +declare namespace pendo { + interface Identity { + visitor: Visitor; + account?: Account; + } + + interface Metadata { + [key: string]: string | number | boolean | Date | string[] | number[]; + } + + type Visitor = { id: string; } & Metadata; + + type Account = { id?: string; } & Metadata; + + interface InitOptions extends Identity { + apiKey?: string; + excludeAllText?: boolean; + excludeTitle?: boolean; + disablePersistence?: boolean; + guides?: { + delay?: boolean; + disable?: boolean; + timeout?: number; + tooltip?: { + arrowSize?: number; + } + }; + events?: EventCallbacks; + } + + interface EventCallbacks { + ready?(): void; + guidesLoaded?(): void; + guidesFailed?(): void; + } + + interface Pendo { + // Initialization and Identification + initialize(options: InitOptions): void; + identify(visitorId: string, accountId?: string): void; + identify(identity: Identity): void; + isReady(): boolean; + flushNow(): Promise; + updateOptions(options: Identity): void; + getVersion(): string; + getVisitorId(): string; + getAccountId(): string; + getCurrentUrl(): string; + + // Guides and Guide Center + findGuideByName(name: string): Guide | void; + findGuideById(id: string): Guide | void; + showGuideByName(name: string): void; + showGuideById(id: string): void; + toggleLauncher(): void; + removeLauncher(): void; + + // Troubleshooting + loadGuides(): void; + startGuides(): void; + stopGuides(): void; + + // Debugging + enableDebugging(): void; + disableDebugging(): void; + isDebuggingEnabled(coerce?: false): "Yes" | "No"; + isDebuggingEnabled(coerce: true): boolean; + debugging: Debugging; + + // Events + events: Events; + track(trackType: string, metadata?: Metadata): void; + + // Guide Events + onGuideAdvanced(step?: GuideStep): void; + onGuideAdvanced(steps: { steps: number }): void; + onGuidePrevious(step?: GuideStep): void; + onGuideDismissed(step?: GuideStep): void; + onGuideDismissed(until: { until: "reload" }): void; + + // Other + validateInstall(): void; + dom(input: any): HTMLElement; // TODO + } + + interface Debugging { + getEventCache(): any[]; // TODO + getAllGuides(): Guide[]; + getAutoGuides(): { auto: Guide[]; override: Guide[] }; + getBadgeGuides(): Guide[]; + getLauncherGuides(): Guide[]; + } + + type Events = { + [K in keyof EventCallbacks]-?: (callback: EventCallbacks[K]) => Events; + }; + + interface Guide { + createdByUser: User; + createdAt: number; + lastUpdatedByUser: User; + lastUpdatedAt: number; + kind: string; + rootVersionId: string; + stableVersionId: string; + id: string; + name: string; + state: "published" | "staged" | "draft" | "disabled"; + launchMethod: "api" | "automatic" | "badge" | "dom" | "launcher"; + isMultiStep: boolean; + steps: GuideStep[]; + attributes: { + type: string; + device: { desktop: boolean; mobile: boolean; type: "desktop" | "mobile" }; + badge: any; // TODO + priority: number; + launcher: { keywords: string[] }; + }; + audience: any[]; // TODO + audienceUiHint: { filters: any[] }; // TODO + resetAt: number; + publishedAt: number; + } + + interface User { + id: string; + username: string; + first: string; + last: string; + role: number; + userType: string; + } + + interface GuideStep { + id: string; + guideId: string; + type: string; + elementPathRule: string; + contentType: string; + contentUrl?: string; + contentUrlCss?: string; + contentUrlJs?: string; + rank: number; + advanceMethod: "button" | "programatic" /* sic */ | "element"; + thumbnailUrls?: string; + attributes: { + height: number; + width: number; + autoHeight: boolean; + position: string; + css: string; + variables: any; + }; + lastUpdatedAt: number; + resetAt: number; + } +} + +declare const pendo: pendo.Pendo; diff --git a/types/pendo-io-browser/pendo-io-browser-tests.ts b/types/pendo-io-browser/pendo-io-browser-tests.ts new file mode 100644 index 0000000000..ebc4dc931f --- /dev/null +++ b/types/pendo-io-browser/pendo-io-browser-tests.ts @@ -0,0 +1,88 @@ +// Examples from: https://developers.pendo.io/docs/?bash#agent-api + +pendo.initialize({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.identify( + "PUT_VISITOR_ID_HERE", + "PUT_ACCOUNT_ID_HERE" +); + +pendo.identify({ + visitor: { + id: "PUT_VISITOR_ID_HERE", + name: "Neo", + email: "neo@thematrix.io", + role: "godlike" + }, + account: { + id: "PUT_ACCOUNT_ID_HERE", + name: "CorpSchmorp" + } +}); + +pendo.updateOptions({ + visitor: { + id: 'foo' + }, + account: { + id: 'bar', + TypeOfBusiness: 'brokers', + dollarPerStop: 'true' + } +}); + +pendo.debugging.getEventCache(); + +pendo.events + .ready(() => { + // Do something once `pendo.isReady()` would return `true` + }) + .guidesLoaded(() => { + // Do something when Guides load + }) + .guidesFailed(() => { + // Do something when Guides fail to load + }); + +pendo.initialize({ + apiKey: 'YOUR_API_KEY', + visitor: { id: "" }, + account: { id: "" }, + events: { + ready() { + // Do something when pendo is initialized + } + } +}); + +pendo.track("User Registered", { + userId: "user.id", + plan: "user.plan", + accountType: "Facebook" +}); + +try { + throw new Error(); +} catch (error) { + pendo.track("JIRA-12345--error-tripped", { + message: error.message, + stack: error.stack + }); +} + +pendo.dom("").closest('._pendo-guide-next_'); + +pendo.onGuideAdvanced(); +pendo.onGuideAdvanced({ steps: 2 }); +pendo.onGuideDismissed(); diff --git a/types/pendo-io-browser/tsconfig.json b/types/pendo-io-browser/tsconfig.json new file mode 100644 index 0000000000..e5b8fc4c3f --- /dev/null +++ b/types/pendo-io-browser/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", + "pendo-io-browser-tests.ts" + ] +} diff --git a/types/npm-run-path/tslint.json b/types/pendo-io-browser/tslint.json similarity index 100% rename from types/npm-run-path/tslint.json rename to types/pendo-io-browser/tslint.json diff --git a/types/permit/index.d.ts b/types/permit/index.d.ts index b0c2db9b42..961aee845b 100644 --- a/types/permit/index.d.ts +++ b/types/permit/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for permit 0.2 // Project: https://github.com/ianstormtaylor/permit#readme -// Definitions by: My Self +// Definitions by: Jannik Keye // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// diff --git a/types/persona/tslint.json b/types/persona/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/persona/tslint.json +++ b/types/persona/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pet-finder-api/index.d.ts b/types/pet-finder-api/index.d.ts index e438bda1c2..39855aab1a 100644 --- a/types/pet-finder-api/index.d.ts +++ b/types/pet-finder-api/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for pet-finder-api 1.0 // Project: https://github.com/drlukeangel/Pet-Finder-API-Javascript-Library -// Definitions by: My Self +// Definitions by: ncipollina // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare function petFinder(api_key: string, api_secret: string, options?: any): petFinder.PetFinder; diff --git a/types/pg-pool/tslint.json b/types/pg-pool/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pg-pool/tslint.json +++ b/types/pg-pool/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pg/index.d.ts b/types/pg/index.d.ts index 35ef7801b4..081213eb86 100644 --- a/types/pg/index.d.ts +++ b/types/pg/index.d.ts @@ -29,10 +29,10 @@ export interface Defaults extends ConnectionConfig { parseInt8?: boolean; } -import { TlsOptions } from "tls"; +import { ConnectionOptions } from "tls"; export interface ClientConfig extends ConnectionConfig { - ssl?: boolean | TlsOptions; + ssl?: boolean | ConnectionOptions; } export interface PoolConfig extends ClientConfig { diff --git a/types/pgwmodal/tslint.json b/types/pgwmodal/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pgwmodal/tslint.json +++ b/types/pgwmodal/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phantom/tslint.json b/types/phantom/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/phantom/tslint.json +++ b/types/phantom/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phantomcss/tslint.json b/types/phantomcss/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/phantomcss/tslint.json +++ b/types/phantomcss/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phantomjs/tslint.json b/types/phantomjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/phantomjs/tslint.json +++ b/types/phantomjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phin/index.d.ts b/types/phin/index.d.ts new file mode 100644 index 0000000000..00130597e5 --- /dev/null +++ b/types/phin/index.d.ts @@ -0,0 +1,123 @@ +// Type definitions for phin 3.3 +// Project: https://github.com/ethanent/phin +// Definitions by: Tony Wooster +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/// + +import { ClientRequestArgs, IncomingMessage } from 'http'; +import { URL } from 'url'; +import { Response as CentraResponse } from 'centra'; + +type Options = Phin.Options; +type BufferResponse = Phin.BufferResponse; +type StreamResponse = Phin.StreamResponse; +type JsonResponse = Phin.JsonResponse; +type DefaultOpts = Phin.DefaultOpts; +type BatchResponse = JsonResponse | BufferResponse; +type AnyResponse = BatchResponse | StreamResponse; + +interface PhinFactory { + (optsOrUrl: (Options & { parse?: 'none', stream?: false }) | string): Promise; + (optsOrUrl: Options & { parse: 'json', stream?: false }): Promise; + (optsOrUrl: Options & { stream: true }): Promise; + (optsOrUrl: Options): Promise; + + promisified(optsOrUrl: (Options & { parse?: 'none', stream?: false }) | string): Promise; + promisified(optsOrUrl: Options & { parse: 'json', stream?: false }): Promise; + promisified(optsOrUrl: Options & { stream: true }): Promise; + promisified(optsOrUrl: Options): Promise; + + unpromisified(optsOrUrl: (Options & { parse?: 'none', stream?: false }) | string, cb: (err: unknown, resp: BufferResponse) => unknown): void; + unpromisified(optsOrUrl: Options & { parse: 'json', stream?: false }, cb: (err: unknown, resp: JsonResponse) => unknown): void; + unpromisified(optsOrUrl: Options & { stream: true }, cb: (err: unknown, resp: StreamResponse) => unknown): void; + unpromisified(optsOrUrl: Options, cb: (err: unknown, resp: AnyResponse) => unknown): void; + + defaults(defaultOpts: DefaultOpts & { parse: 'json', stream?: false }): + { + (optsOrUrl: Options & { stream: true }): Promise + (optsOrUrl: Options & { parse: 'none', stream?: false }): Promise + (optsOrUrl: (Options & { parse?: 'json', stream?: false }) | string): Promise + (optsOrUrl: Options): Promise + }; + + defaults(defaultOpts: DefaultOpts & { parse?: 'none', stream?: false }): + { + (optsOrUrl: Options & { stream: true }): Promise + (optsOrUrl: Options & { parse: 'json', stream?: false }): Promise + (optsOrUrl: (Options & { parse?: 'none', stream?: false }) | string): Promise + (optsOrUrl: Options): Promise + }; + + defaults(defaultOpts: DefaultOpts & { parse: 'json', stream: true }): + { + (optsOrUrl: Options & { parse: 'none', stream: false }): Promise + (optsOrUrl: Options & { parse?: 'json', stream: false }): Promise + (optsOrUrl: (Options & { stream?: true }) | string): Promise + (optsOrUrl: Options | string): Promise + }; + + defaults(defaultOpts: DefaultOpts & { parse?: 'none', stream: true }): + { + (opts: Options & { parse: 'json', stream: false }): Promise + (opts: Options & { parse?: 'none', stream: false }): Promise + (opts: (Options & { stream?: true }) | string): Promise + (opts: Options): Promise + }; + + defaults(defaultOpts: DefaultOpts): + { + (optsOrUrl: Options & { stream: true }): Promise + (optsOrUrl: Options & { parse: 'json', stream: false }): Promise + (optsOrUrl: Options & { parse: 'none', stream: false }): Promise + (optsOrUrl: Options | string): Promise + }; +} + +declare const Phin: PhinFactory; + +declare namespace Phin { + interface DefaultOpts { + url?: string; + method?: string; + data?: any; + form?: { [k: string]: string }; + headers?: { [k: string]: string }; + core?: ClientRequestArgs; + parse?: 'none' | 'json'; + followRedirects?: boolean; + compression?: boolean; + timeout?: number | null; + hostname?: string; + port?: number; + path?: string; + stream?: boolean; + } + + interface Options extends DefaultOpts { + url: string; + } + + interface BatchOptions extends Options { + stream: false; + } + + interface StreamOptions extends Options { + stream: true; + } + + interface StreamResponse extends IncomingMessage { + stream: StreamResponse; + } + + interface BufferResponse extends IncomingMessage { + body: Buffer; + } + + interface JsonResponse extends IncomingMessage { + body: any; + } +} + +export = Phin; diff --git a/types/phin/phin-tests.ts b/types/phin/phin-tests.ts new file mode 100644 index 0000000000..9c42e2e128 --- /dev/null +++ b/types/phin/phin-tests.ts @@ -0,0 +1,172 @@ +import phin = require('phin'); + +export function typeTests() { + function testParseNoneStreamFalse(o: { url: string, parse?: 'none', stream?: false } | string) { + phin(o); // $ExpectType Promise + } + + function testParseJsonStreamFalse(o: { url: string, parse: 'json', stream?: false }) { + phin(o); // $ExpectType Promise + } + + function testStreamTrue(o: { url: string, parse?: 'json' | 'none', stream: true }) { + phin(o); // $ExpectType Promise + } + + function testCallbackParseNoneStreamFalse(o: { url: string, parse?: 'none', stream?: false } | string) { + phin.unpromisified(o, (_err, r) => { + r; // $ExpectType BufferResponse + }); + } + + function testCallbackParseJsonStreamFalse(o: { url: string, parse: 'json', stream?: false }) { + phin.unpromisified(o, (_err, r) => { + r; // $ExpectType JsonResponse + }); + } + + function testCallbackStreamTrue(o: { url: string, parse?: 'json' | 'none', stream: true }) { + phin.unpromisified(o, (_err, r) => { + r; // $ExpectType StreamResponse + }); + } + + function testCallbackAny(o: { url: string, parse?: 'json' | 'none', stream?: boolean }) { + phin.unpromisified(o, (_err, r) => { + r; // $ExpectType AnyResponse + }); + } + + function testDefaultsParseNoneStreamFalse(d: { parse?: 'none', stream?: false }) { + const p = phin.defaults(d); + return { + testSame(o: phin.Options & { parse?: 'none', stream?: false } | string) { + p(o); // $ExpectType Promise + }, + + testJson(o: phin.Options & { parse: 'json', stream?: false }) { + p(o); // $ExpectType Promise + }, + + testStream(o: phin.Options & { stream: true }) { + p(o); // $ExpectType Promise + }, + + testOthers(o: phin.Options) { + p(o); // $ExpectType Promise + } + }; + } + + function testDefaultsParseJsonStreamFalse(d: { parse: 'json', stream?: false }) { + const p = phin.defaults(d); + return { + testSame(o: phin.Options & { parse: 'none', stream?: false }) { + p(o); // $ExpectType Promise + }, + + testJson(o: phin.Options & { parse?: 'json', stream?: false } | string) { + p(o); // $ExpectType Promise + }, + + testStream(o: phin.Options & { stream: true }) { + p(o); // $ExpectType Promise + }, + + testOthers(o: phin.Options) { + p(o); // $ExpectType Promise + } + }; + } + + function testDefaultsParseJsonStreamTrue(d: { parse: 'json', stream: true }) { + const p = phin.defaults(d); + return { + testSame(o: phin.Options & { parse: 'none', stream: false }) { + p(o); // $ExpectType Promise + }, + + testJson(o: phin.Options & { parse?: 'json', stream: false }) { + p(o); // $ExpectType Promise + }, + + testStream(o: phin.Options & { stream?: true } | string) { + p(o); // $ExpectType Promise + }, + + testOthers(o: phin.Options) { + p(o); // $ExpectType Promise + } + }; + } + + function testDefaultsParseNoneStreamTrue(d: { parse?: 'none', stream: true }) { + const p = phin.defaults(d); + return { + testSame(o: phin.Options & { parse?: 'none', stream: false }) { + p(o); // $ExpectType Promise + }, + + testJson(o: phin.Options & { parse: 'json', stream: false }) { + p(o); // $ExpectType Promise + }, + + testStream(o: phin.Options & { stream?: true } | string) { + p(o); // $ExpectType Promise + }, + + testOthers(o: phin.Options) { + p(o); // $ExpectType Promise + } + }; + } + + function testDefaultsAny(d: { parse?: 'none' | 'json', stream?: boolean }) { + const p = phin.defaults(d); + return { + testSame(o: phin.Options & { parse: 'none', stream: false }) { + p(o); // $ExpectType Promise + }, + + testJson(o: phin.Options & { parse: 'json', stream: false }) { + p(o); // $ExpectType Promise + }, + + testStream(o: phin.Options & { stream: true }) { + p(o); // $ExpectType Promise + }, + + testOthers(o: phin.Options | string) { + p(o); // $ExpectType Promise + } + }; + } +} + +async function functionalTests() { + await phin('http://example.com').then(r => { + if (!Buffer.isBuffer(r.body)) { throw new Error('Not a buffer?'); } + }); + + await phin('http://placekitten.com/50/50').then(r => { + if (r.headers['content-type'] !== 'image/jpeg') { + throw new Error('expected a jpeg'); + } + }); + + await phin({ url: 'https://jsonplaceholder.typicode.com/todos/1', parse: 'json' }).then(r => { + if (typeof r.body === 'string') { + throw new Error('Did not parse json'); + } + + if (typeof r.body.userId !== 'number') { + throw new Error('Did not get userId'); + } + }); + + await phin({ url: 'https://jsonplaceholder.typicode.com/todos/1', stream: true }).then(r => { + r.on('end', () => {}); + }); +} + +functionalTests(); diff --git a/types/boxen/tsconfig.json b/types/phin/tsconfig.json similarity index 94% rename from types/boxen/tsconfig.json rename to types/phin/tsconfig.json index 6d34147e83..3d4214514a 100644 --- a/types/boxen/tsconfig.json +++ b/types/phin/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "boxen-tests.ts" + "phin-tests.ts" ] } diff --git a/types/npm-user/tslint.json b/types/phin/tslint.json similarity index 100% rename from types/npm-user/tslint.json rename to types/phin/tslint.json diff --git a/types/phoenix/index.d.ts b/types/phoenix/index.d.ts index 8b0e6574d8..daff513651 100644 --- a/types/phoenix/index.d.ts +++ b/types/phoenix/index.d.ts @@ -1,22 +1,26 @@ -// Type definitions for phoenix +// Type definitions for phoenix 1.4 // Project: https://github.com/phoenixframework/phoenix -// Definitions by: Mirosław Ciastek , John Goff +// Definitions by: Mirosław Ciastek , John Goff , Po Chen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.4 -declare module "phoenix" { +declare module 'phoenix' { class Push { - constructor(channel: Channel, event: string, payload: any, timeout: number); + constructor( + channel: Channel, + event: string, + payload: object, + timeout: number, + ); - resend(timeout: number): void; send(): void; + resend(timeout: number): void; - receive(status: string, callback: (response?: any) => void): Push; + receive(status: string, callback: (response?: any) => any): this; } - export class Channel { - constructor(topic: string, params?: Object, socket?: Socket); - - rejoinUntilConnected(): void; + class Channel { + constructor(topic: string, params?: object | Function, socket?: Socket); join(timeout?: number): Push; leave(timeout?: number): Push; @@ -28,50 +32,50 @@ declare module "phoenix" { on(event: string, callback: (response?: any) => void): void; off(event: string): void; - canPush(): boolean; - - push(event: string, payload: Object, timeout?: number): Push; + push(event: string, payload: object, timeout?: number): Push; } - export class Socket { - constructor(endPoint: string, opts?: Object); + type ConnectionState = 'connecting' | 'open' | 'closing' | 'closed'; + + interface SocketConnectOption { + params: object | Function; + transport: any; + timeout: number; + heartbeatIntervalMs: number; + reconnectAfterMs: number; + longpollernumber: number; + encode: (payload: object, callback: Function) => any; + decode: (payload: string, callback: Function) => any; + logger: (kind: string, message: string, data: any) => void; + } + + class Socket { + constructor(endPoint: string, opts?: Partial); protocol(): string; endPointURL(): string; - disconnect(callback?: Function, code?: string, reason?: any): void; connect(params?: any): void; + disconnect(callback?: Function, code?: number, reason?: string): void; + connectionState(): ConnectionState; + isConnected(): boolean; - log(kind: string, msg: string, data: any): void; + remove(channel: Channel): void; + channel(topic: string, chanParams?: object): Channel; + push(data: object): void; + + log(kind: string, message: string, data: object): void; + hasLogger(): boolean; onOpen(callback: Function): void; onClose(callback: Function): void; onError(callback: Function): void; onMessage(callback: Function): void; - onConnOpen(): void; - onConnClose(event: any): void; - onConnError(error: any): void; - - triggerChanError(): void; - - connectionState(): string; - - isConnected(): boolean; - - remove(channel: Channel): void; - channel(topic: string, chanParams?: Object): Channel; - - push(data: any): void; - makeRef(): string; - sendHeartbeat(): void; - flushSendBuffer(): void; - - onConnMessage(rawMessage: any): void; } - export class LongPoll { + class LongPoll { constructor(endPoint: string); normalizeEndpoint(endPoint: string): string; @@ -86,8 +90,10 @@ declare module "phoenix" { close(code?: any, reason?: any): void; } - export class Ajax { - request( + class Ajax { + static states: {[state: string]: number}; + + static request( method: string, endPoint: string, accept: string, @@ -97,7 +103,7 @@ declare module "phoenix" { callback?: (response?: any) => void ): void; - xdomainRequest( + static xdomainRequest( req: any, method: string, endPoint: string, @@ -107,7 +113,7 @@ declare module "phoenix" { callback?: (response?: any) => void ): void; - xhrRequest( + static xhrRequest( req: any, method: string, endPoint: string, @@ -118,28 +124,37 @@ declare module "phoenix" { callback?: (response?: any) => void ): void; - parseJSON(resp: string): JSON; - serialize(obj: any, parentKey: string): string; - appendParams(url: string, params: any): string; + static parseJSON(resp: string): JSON; + static serialize(obj: any, parentKey: string): string; + static appendParams(url: string, params: any): string; } - export class Presence { - constructor(channel: Channel, opts?: Object); + class Presence { + constructor(channel: Channel, opts?: object); + + onJoin(callback: Function): void; + onLeave(callback: Function): void; + onSync(callback: Function): void; + list(chooser?: (key: string, presence: any) => T): T[]; + inPendingSyncState(): boolean; static syncState( - currentState: any, - newState: any, + currentState: object, + newState: object, onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void, onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void ): any; static syncDiff( - currentState: any, - newState: any, + currentState: object, + diff: {joins: object; leaves: object}, onJoin?: (key?: string, currentPresence?: any, newPresence?: any) => void, onLeave?: (key?: string, currentPresence?: any, newPresence?: any) => void ): any; - static list(presences: Object, chooser?: Function): any; + static list( + presences: object, + chooser?: (key: string, presence: any) => T, + ): T[]; } } diff --git a/types/phoenix/phoenix-tests.ts b/types/phoenix/phoenix-tests.ts index 1e7641fc91..6e34b5c50c 100644 --- a/types/phoenix/phoenix-tests.ts +++ b/types/phoenix/phoenix-tests.ts @@ -1,46 +1,46 @@ import { Socket, Channel, Presence } from 'phoenix'; function test_socket() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); socket.connect(); } function test_channel() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); socket.connect(); - const channel = socket.channel("room:123", {token: '123'}); + const channel = socket.channel('room:123', {token: '123'}); - channel.on("new_msg", msg => console.log("Got message", msg)); + channel.on('new_msg', msg => console.log('Got message', msg)); - channel.push("new_msg", {body: 'some value'}, 10000) - .receive("ok", (msg) => console.log("created message", msg)) - .receive("error", (reasons) => console.log("create failed", reasons)) - .receive("timeout", () => console.log("Networking issue...")); + channel.push('new_msg', {body: 'some value'}, 10000) + .receive('ok', (msg) => console.log('created message', msg)) + .receive('error', (reasons) => console.log('create failed', reasons)) + .receive('timeout', () => console.log('Networking issue...')); channel.join() - .receive("ok", ({messages}) => console.log("catching up", messages)) - .receive("error", ({reason}) => console.log("failed join", reason)) - .receive("timeout", () => console.log("Networking issue. Still waiting...")); + .receive('ok', ({messages}) => console.log('catching up', messages)) + .receive('error', ({reason}) => console.log('failed join', reason)) + .receive('timeout', () => console.log('Networking issue. Still waiting...')); } function test_hooks() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); socket.connect(); - socket.onError(() => console.log("there was an error with the connection!")); - socket.onClose(() => console.log("the connection dropped")); + socket.onError(() => console.log('there was an error with the connection!')); + socket.onClose(() => console.log('the connection dropped')); - const channel = socket.channel("room:123", {token: '123'}); + const channel = socket.channel('room:123', {token: '123'}); - channel.onError(() => console.log("there was an error!")); - channel.onClose(() => console.log("the channel has gone away gracefully")) + channel.onError(() => console.log('there was an error!')); + channel.onClose(() => console.log('the channel has gone away gracefully')); } function test_presence() { - const socket = new Socket("/ws", {params: {userToken: "123"}}); + const socket = new Socket('/ws', {params: {userToken: '123'}}); - const channel = socket.channel("room:123", {token: '123'}); + const channel = socket.channel('room:123', {token: '123'}); const presence = new Presence(channel); let presenceState = {}; @@ -49,12 +49,12 @@ function test_presence() { Presence.list(state, (id: string) => id).forEach(console.log); }; - channel.on("presence_state", (state) => { + channel.on('presence_state', (state) => { presenceState = Presence.syncState(presenceState, state); logState(presenceState); }); - channel.on("presence_diff", (diff) => { + channel.on('presence_diff', (diff) => { presenceState = Presence.syncState(presenceState, diff); logState(presenceState); }); diff --git a/types/phoenix/tslint.json b/types/phoenix/tslint.json index a41bf5d19a..6fca40ff8d 100644 --- a/types/phoenix/tslint.json +++ b/types/phoenix/tslint.json @@ -1,79 +1,117 @@ { - "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", + "rules": { + "arrow-return-shorthand": true, + "ban-types": false, + "callable-types": true, + "class-name": true, + "comment-format": [ + true, + "check-space" + ], + "curly": true, + "deprecation": { + "severity": "warn" + }, + "eofline": true, + "forin": true, + "import-spacing": false, + "indent": [ + true, + "spaces" + ], + "interface-over-type-literal": true, + "label-position": true, + "max-line-length": false, + "member-access": false, + "member-ordering": false, + "no-arg": true, + "no-bitwise": true, + "no-console": [ + true, + "debug", + "info", + "time", + "timeEnd", + "trace" + ], + "no-construct": true, + "no-debugger": true, + "no-declare-current-package": false, + "no-duplicate-super": true, + "no-empty": false, + "no-empty-interface": true, + "no-eval": true, + "no-inferrable-types": [ + true, + "ignore-params" + ], + "no-misused-new": true, + "no-non-null-assertion": true, + "no-redundant-jsdoc": true, + "no-single-declare-module": false, + "no-shadowed-variable": true, + "no-string-literal": false, + "no-string-throw": true, + "no-switch-case-fall-through": true, + "no-trailing-whitespace": true, + "no-unnecessary-class": false, + "no-unnecessary-initializer": true, + "no-unused-expression": true, + "no-use-before-declare": true, + "no-var-keyword": true, + "object-literal-sort-keys": false, + "one-line": [ + true, + "check-open-brace", + "check-catch", + "check-else", + "check-whitespace" + ], + "prefer-const": true, + "quotemark": [ + true, + "single" + ], + "radix": true, + "semicolon": [ + true, + "always" + ], + "triple-equals": [ + true, + "allow-null-check" + ], + "typedef-whitespace": [ + true, + { + "call-signature": "nospace", + "index-signature": "nospace", + "parameter": "nospace", + "property-declaration": "nospace", + "variable-declaration": "nospace" + } + ], + "unified-signatures": true, + "variable-name": false, + "whitespace": [ + true, + "check-branch", + "check-decl", + "check-operator", + "check-separator", + "check-type" + ], + "no-output-on-prefix": true, + "use-input-property-decorator": true, + "use-output-property-decorator": true, + "use-host-property-decorator": true, + "no-input-rename": true, + "no-output-rename": true, + "use-life-cycle-interface": true, + "use-pipe-transform-interface": true, + "component-class-suffix": true, + "directive-class-suffix": true + } } + diff --git a/types/phone-formatter/tslint.json b/types/phone-formatter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/phone-formatter/tslint.json +++ b/types/phone-formatter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phone/tslint.json b/types/phone/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/phone/tslint.json +++ b/types/phone/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phonegap-facebook-plugin/tslint.json b/types/phonegap-facebook-plugin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/phonegap-facebook-plugin/tslint.json +++ b/types/phonegap-facebook-plugin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phonegap-nfc/tslint.json b/types/phonegap-nfc/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/phonegap-nfc/tslint.json +++ b/types/phonegap-nfc/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phonegap-plugin-barcodescanner/tslint.json b/types/phonegap-plugin-barcodescanner/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/phonegap-plugin-barcodescanner/tslint.json +++ b/types/phonegap-plugin-barcodescanner/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/phonegap/tslint.json b/types/phonegap/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/phonegap/tslint.json +++ b/types/phonegap/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/photonui/tslint.json b/types/photonui/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/photonui/tslint.json +++ b/types/photonui/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/photoswipe/tslint.json b/types/photoswipe/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/photoswipe/tslint.json +++ b/types/photoswipe/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/physijs/tslint.json b/types/physijs/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/physijs/tslint.json +++ b/types/physijs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pi-spi/tslint.json b/types/pi-spi/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pi-spi/tslint.json +++ b/types/pi-spi/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pickadate/tslint.json b/types/pickadate/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pickadate/tslint.json +++ b/types/pickadate/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pify/tslint.json b/types/pify/tslint.json index 7f51cc6e38..f0468d52dc 100644 --- a/types/pify/tslint.json +++ b/types/pify/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pinkyswear/tslint.json b/types/pinkyswear/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pinkyswear/tslint.json +++ b/types/pinkyswear/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pino/index.d.ts b/types/pino/index.d.ts index 610ae076ee..ff4ba1f77c 100644 --- a/types/pino/index.d.ts +++ b/types/pino/index.d.ts @@ -444,6 +444,11 @@ declare namespace P { * Flushes the content of the buffer in extreme mode. It has no effect if extreme mode is not enabled. */ flush(): void; + + /** + * A utility method for determining if a given log level will write to the destination. + */ + isLevelEnabled(level: LevelWithSilent | string): boolean; } type LevelChangeEventListener = (lvl: LevelWithSilent | string, val: number, prevLvl: LevelWithSilent | string, prevVal: number) => void; diff --git a/types/pino/pino-tests.ts b/types/pino/pino-tests.ts index 3a6283c3e4..1a64f11d99 100644 --- a/types/pino/pino-tests.ts +++ b/types/pino/pino-tests.ts @@ -91,6 +91,7 @@ logstderr.error('on stderr instead of stdout'); log.useLevelLabels = true; log.info('lol'); log.level === 'info'; +const isEnabled: boolean = log.isLevelEnabled('info'); const extremeDest = pino.extreme(); const logExtreme = pino(extremeDest); diff --git a/types/pinterest-sdk/tslint.json b/types/pinterest-sdk/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pinterest-sdk/tslint.json +++ b/types/pinterest-sdk/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/piwik-tracker/tslint.json b/types/piwik-tracker/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/piwik-tracker/tslint.json +++ b/types/piwik-tracker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pixi.js/tslint.json b/types/pixi.js/tslint.json index 01be0cd9ee..b55a78498f 100644 --- a/types/pixi.js/tslint.json +++ b/types/pixi.js/tslint.json @@ -4,6 +4,7 @@ // TODOs "ban-types": false, "dt-header": false, + "npm-naming": false, "interface-name": false, "no-any-union": false, "no-declare-current-package": false, diff --git a/types/pkg-conf/index.d.ts b/types/pkg-conf/index.d.ts deleted file mode 100644 index 6a783c1891..0000000000 --- a/types/pkg-conf/index.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -// Type definitions for pkg-conf 2.1 -// Project: https://github.com/sindresorhus/pkg-conf#readme -// Definitions by: Jorge Gonzalez -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -declare namespace pkgConf { - type AnyJson = boolean | number | string | null | JsonArray | JsonMap; - interface JsonArray extends Array { } - interface JsonMap { - [key: string]: AnyJson; - } - - interface Options { - // Directory to start looking up for a package.json file. - // Default: process.cwd() - cwd?: string; - // Default config. - defaults?: object; - // Skip package.json files that have the namespaced config explicitly set to false. - skipOnFalse?: boolean; - } - - // Returns the config. - function sync(namespace: string, options?: Options): JsonMap; - // Pass in the config returned from any of the above methods. - // Returns the filepath to the package.json file or null when not found. - function filepath(config: JsonMap): string | null; -} - -// Returns a Promise for the config. -declare function pkgConf(namespace: string, options?: pkgConf.Options): Promise; - -export = pkgConf; diff --git a/types/pkg-conf/pkg-conf-tests.ts b/types/pkg-conf/pkg-conf-tests.ts deleted file mode 100644 index bf2dee1e2f..0000000000 --- a/types/pkg-conf/pkg-conf-tests.ts +++ /dev/null @@ -1,6 +0,0 @@ -import pkgConf = require('pkg-conf'); - -pkgConf('name'); // $ExpectType Promise -const config = pkgConf.sync('bugs'); // $ExpectType JsonMap -pkgConf.filepath(config); // $ExpectType string | null -config.url; // $ExpectType AnyJson diff --git a/types/pkg-conf/tsconfig.json b/types/pkg-conf/tsconfig.json deleted file mode 100644 index 449922d19e..0000000000 --- a/types/pkg-conf/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "pkg-conf-tests.ts" - ] -} diff --git a/types/pkg-dir/index.d.ts b/types/pkg-dir/index.d.ts deleted file mode 100644 index 7d8b714f0b..0000000000 --- a/types/pkg-dir/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -// Type definitions for pkg-dir 2.0 -// Project: https://github.com/sindresorhus/pkg-dir#readme -// Definitions by: NK-WEB-Git -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pkgDir; - -declare function pkgDir(cwd?: string): Promise; - -declare namespace pkgDir { - function sync(cwd?: string): string | null; -} diff --git a/types/pkg-dir/pkg-dir-tests.ts b/types/pkg-dir/pkg-dir-tests.ts deleted file mode 100644 index 487310a6a2..0000000000 --- a/types/pkg-dir/pkg-dir-tests.ts +++ /dev/null @@ -1,11 +0,0 @@ -import pkgDir = require('pkg-dir'); - -pkgDir('/Users/project/pkg-dir').then(rootDir => { - rootDir; // $ExpectType string | null -}); - -pkgDir().then(rootDir => { - rootDir; -}); - -pkgDir.sync('/Users/project/pkg-dir'); // $ExpectType string | null diff --git a/types/pkg-dir/tsconfig.json b/types/pkg-dir/tsconfig.json deleted file mode 100644 index a5647ed0eb..0000000000 --- a/types/pkg-dir/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "pkg-dir-tests.ts" - ] -} \ No newline at end of file diff --git a/types/pkg-versions/index.d.ts b/types/pkg-versions/index.d.ts deleted file mode 100644 index a271a57485..0000000000 --- a/types/pkg-versions/index.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -// Type definitions for pkg-versions 1.1 -// Project: https://github.com/sindresorhus/pkg-versions#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = pkgVersions; - -declare function pkgVersions(name: string): Promise>; diff --git a/types/pkg-versions/pkg-versions-tests.ts b/types/pkg-versions/pkg-versions-tests.ts deleted file mode 100644 index f0b963b998..0000000000 --- a/types/pkg-versions/pkg-versions-tests.ts +++ /dev/null @@ -1,3 +0,0 @@ -import pkgVersions = require('pkg-versions'); - -pkgVersions('ava'); // $ExpectType Promise> diff --git a/types/pkg-versions/tsconfig.json b/types/pkg-versions/tsconfig.json deleted file mode 100644 index cc9bffbcd4..0000000000 --- a/types/pkg-versions/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "pkg-versions-tests.ts" - ] -} diff --git a/types/pkg-versions/tslint.json b/types/pkg-versions/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/pkg-versions/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/pkijs/tslint.json b/types/pkijs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pkijs/tslint.json +++ b/types/pkijs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/platform/tslint.json b/types/platform/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/platform/tslint.json +++ b/types/platform/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/playerframework/tslint.json b/types/playerframework/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/playerframework/tslint.json +++ b/types/playerframework/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pleasejs/tslint.json b/types/pleasejs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pleasejs/tslint.json +++ b/types/pleasejs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/plupload/tslint.json b/types/plupload/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/plupload/tslint.json +++ b/types/plupload/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pluralize/tslint.json b/types/pluralize/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pluralize/tslint.json +++ b/types/pluralize/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/plurals-cldr/index.d.ts b/types/plurals-cldr/index.d.ts new file mode 100644 index 0000000000..a65fc4e2c8 --- /dev/null +++ b/types/plurals-cldr/index.d.ts @@ -0,0 +1,53 @@ +// Type definitions for plurals-cldr 1.0 +// Project: https://github.com/nodeca/plurals-cldr +// Definitions by: Joel Spadin +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +type Form = 'zero' | 'one' | 'two' | 'few' | 'many' | 'other'; + +interface Plural { + /** + * Returns the form name for a given number. If the locale is not + * supported, returns `null`. + * + * @param locale The locale code. + * @param number The number to check. May be passed as a string to keep + * trailing zeroes. + */ + (locale: string, number: number | string): Form | null; + + /** + * Returns an array of available forms for the given locale. If the + * locale is not supported, returns `null`. + * + * @param locale The locale code. + */ + forms(locale: string): Form[] | null; + + /** + * Returns the index of the form for a given number. If the locale is + * not supported, returns `-1`. + * + * This is convenient for implementing a lookup from a compact, ordered + * list. The order of forms for all locales is `zero`, `one`, `two`, + * `few`, `many`, `other`. Remove the forms not used by a locale to get + * the indices of each. + * + * @param locale The locale code. + * @param number The number to check. May be passed as a string to keep + * trailing zeroes. + */ + indexOf(locale: string, number: number | string): number; +} + +/** + * Gets the CLDR cardinal plural forms for numbers in different locales. + */ +declare const plural: Plural & { + /** + * Gets the CLDR ordinal plural forms for numbers in different locales. + */ + ordinal: Plural; +}; + +export = plural; diff --git a/types/plurals-cldr/plurals-cldr-tests.ts b/types/plurals-cldr/plurals-cldr-tests.ts new file mode 100644 index 0000000000..7927afe761 --- /dev/null +++ b/types/plurals-cldr/plurals-cldr-tests.ts @@ -0,0 +1,15 @@ +import plural = require('plurals-cldr'); + +plural('en', 0); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null +plural('en', ''); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null + +plural.forms('en'); // $ExpectType Form[] | null +plural.indexOf('en', 0); // $ExpectType number +plural.indexOf('en', ''); // $ExpectType number + +plural.ordinal('en', 0); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null +plural.ordinal('en', ''); // $ExpectType "zero" | "one" | "two" | "few" | "many" | "other" | null + +plural.ordinal.forms('en'); // $ExpectType Form[] | null +plural.ordinal.indexOf('en', 0); // $ExpectType number +plural.ordinal.indexOf('en', ''); // $ExpectType number diff --git a/types/plurals-cldr/tsconfig.json b/types/plurals-cldr/tsconfig.json new file mode 100644 index 0000000000..593fbd1545 --- /dev/null +++ b/types/plurals-cldr/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", + "plurals-cldr-tests.ts" + ] +} diff --git a/types/on-change/tslint.json b/types/plurals-cldr/tslint.json similarity index 100% rename from types/on-change/tslint.json rename to types/plurals-cldr/tslint.json diff --git a/types/png-async/index.d.ts b/types/png-async/index.d.ts deleted file mode 100644 index cef8207ae2..0000000000 --- a/types/png-async/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Type definitions for png-async -// Project: https://github.com/kanreisa/node-png-async -// Definitions by: Yuki KAN -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - - -import stream = require('stream'); - -export interface IImageOptions { - width?: number; - height?: number; - fill?: boolean; - checkCRC?: boolean; - deflateChunkSize?: number; - deflateLevel?: number; - deflateStrategy?: EDeflateStrategy; - filterType?: EFilterType; -} - -export declare enum EDeflateStrategy { - DEFAULT_STRATEGY = 0, - FILTERED = 1, - HUFFMAN_ONLY = 2, - RLE = 3, - FIXED = 4, -} - -export declare enum EFilterType { - Auto = -1, - None = 0, - Sub = 1, - Up = 2, - Average = 3, - Paeth = 4, -} - -export declare function createImage(option?: IImageOptions): Image; - -export declare class Image extends stream.Duplex { - width: number; - height: number; - gamma: number; - data: Buffer; - constructor(option?: IImageOptions); - pack(): Image; - parse(data: Buffer, callback?: (err: Error, image: Image) => void): Image; - write(data: any, cb?: any): boolean; - end(data?: any): void; - bitblt(dst: Image, sx: number, sy: number, w: number, h: number, dx: number, dy: number): Image; -} diff --git a/types/png-async/png-async-tests.ts b/types/png-async/png-async-tests.ts deleted file mode 100644 index f108fe66b8..0000000000 --- a/types/png-async/png-async-tests.ts +++ /dev/null @@ -1,31 +0,0 @@ - -import fs = require('fs'); -import png = require('png-async'); - -var devnull = process.platform === 'win32' ? 'nul' : '/dev/null'; - -// stream test -var img = new png.Image({ - width: 1, - height: 1, - fill: true -}) - .pack() - .pipe(png.createImage({ - deflateStrategy: png.EDeflateStrategy.FIXED, - filterType: png.EFilterType.Auto - }) - .on('parsed', function () { - - if (this.data[0] !== 0) { - throw new Error('invalid data'); - } - - this.data[0] = 255; - this.data[3] = 255; - - this.pack().pipe(fs.createWriteStream(devnull)).on('finish', () => { - console.log('done'); - }); - }) - ); diff --git a/types/png-async/tsconfig.json b/types/png-async/tsconfig.json deleted file mode 100644 index 181b899496..0000000000 --- a/types/png-async/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": false, - "strictNullChecks": false, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "png-async-tests.ts" - ] -} \ No newline at end of file diff --git a/types/png-async/tslint.json b/types/png-async/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/png-async/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/pngjs2/tslint.json b/types/pngjs2/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pngjs2/tslint.json +++ b/types/pngjs2/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/podcast/tslint.json b/types/podcast/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/podcast/tslint.json +++ b/types/podcast/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/podium/tslint.json b/types/podium/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/podium/tslint.json +++ b/types/podium/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/polygon/index.d.ts b/types/polygon/index.d.ts new file mode 100644 index 0000000000..c5e7adb827 --- /dev/null +++ b/types/polygon/index.d.ts @@ -0,0 +1,190 @@ +// Type definitions for polygon 1.0 +// Project: https://github.com/tmpvar/polygon.js#readme +// Definitions by: Konrad Klockgether +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/* tslint:disable:array-type */ // cause contradictory error messages + +import Vec2 = require('vec2'); + +/** + * Create a new polygon: + * + * ```javascript + * var p = new Polygon([ + * Vec2(0, 0), + * Vec2(10, 0), + * Vec2(0, 10) + * ]); + * + * ``` + * + * You can pass an array of `Vec2`s, arrays `[x, y]`, or objects `{ x: 10, y: 20 }` + * + * **Stuff to Note**: most of the Vec2's methods take a `returnNew` as the last parameter. + * If passed a truthy value, a new vector will be returned to you. + * Otherwise the operation will be applied to `this` and `this` will be returned. + */ +declare class Polygon { + readonly points: Vec2[]; + + /** + * Returns the number of points in this polygon + */ + readonly length: number; + + constructor(points: Vec2[] | number[][] | { x: number, y: number }[]); + + /** + * Something like Array.forEach on points + */ + each(fn: (prev: Vec2, current: Vec2, next: Vec2, idx: number) => any): Polygon; + + /** + * Returns the point at index `idx`. note: this will wrap in both directions + */ + point(idx: number): Vec2; + + /** + * Ensure all of the points are unique + */ + dedupe(returnNew?: boolean): Polygon; + + /** + * Insert `vec2` at the specified index + */ + insert(vec2: Vec2, index: number): void; + + /** + * Remove the specified `vec2` or numeric index from this polygon + */ + remove(vecOrIndex: Vec2 | number): Polygon; + + /** + * Removes contiguous points that are the same + */ + clean(returnNew?: boolean): Polygon; + + /** + * Returns the direction in which a polygon is wound (true === clockwise) + */ + winding(): boolean; + + /** + * Rewinds the polygon in the specified direction (true === clockwise) + */ + rewind(cw: boolean): Polygon; + + /** + * Computes the area of the polygon + */ + area(): number; + + /** + * Finds the closest point in this polygon to `vec2` + */ + closestPointTo(vec2: Vec2): Vec2; + + /** + * Returns a `Vec2` at the center of the AABB + */ + center(): Vec2; + + /** + * Scales this polygon around `origin` (default is `this.center()`) and will return a new polygon if requested with `returnNew` + */ + scale(amount: number, origin: Vec2, returnNew?: boolean): Polygon; + + /** + * Returns true if `vec2` is inside the polygon + */ + containsPoint(vec2: Vec2): boolean; + + /** + * Returns true if `poly` is completely contained in this polygon + */ + containsPolygon(poly: Polygon): boolean; + + /** + * Returns an object `{x:_, y:_, w:_, h:_}` representing the axis-aligned bounding box of this polygyon + */ + aabb(): { x: number, y: number, w: number, h: number }; + + /** + * Performs an offset/buffering operation on this polygon and returns a new one + */ + offset(amount: number): Polygon; + + /** + * Return an array `[startpoint, endpoint]` representing the line at the specified `index` + */ + line(index: number): [Vec2, Vec2]; + + /** + * Iterate over the lines in this polygon + */ + lines(fn: (start: Vec2, end: Vec2, index: number) => any): Polygon; + + /** + * Find self-intersections and return them as a new polygon + */ + selfIntersections(): Polygon; + + /** + * Remove self intersections from this polygon. returns an array of polygons + */ + pruneSelfIntersections(): Polygon[]; + + /** + * Return a new instance of this polygon + */ + clone(): Polygon; + + /** + * Rotate by origin `vec2` (default `this.center()`) by radians `rads` and return a clone if `returnNew` is specified + */ + rotate(rads: number, vec2: Vec2, returnNew?: boolean): Polygon; + + /** + * Translate by `vec2` and return a clone if `returnNew` is specified + */ + translate(vec2: Vec2, returnNew?: boolean): Polygon; + + /** + * Return true if this polygon has the same components and the incoming `poly` + */ + equal(poly: Polygon): boolean; + + /** + * Works with an array of vec2's, + * an object containing a `.position` and `.radius`, + * an object populated with x1,y1,x2,y2, + * an object populated with x,y,w,h, + * and an object populated with x,y,width,height. + * See the tests for more info + */ + contains( + thing: Vec2[] + | { position: Vec2, radius: number } + | { x1: number, y1: number, x2: number, y2: number } + | { x: number, y: number, w: number, h: number } + | { x: number, y: number, width: number, height: number } + ): boolean; + + /** + * Returns a new polygon representing the boolean union of `this` and the incoming `polygon` + */ + union(polygon: Polygon): Polygon; + + /** + * Returns a new polygon representing the boolean cut of `polygon` from `this` + */ + cut(polygon: Polygon): Polygon; + + /** + * Convert this polygon into an array of arrays (`[[x, y]]`) + */ + toArray(): number[][]; +} + +export = Polygon; diff --git a/types/polygon/polygon-tests.ts b/types/polygon/polygon-tests.ts new file mode 100644 index 0000000000..13ea7c08c1 --- /dev/null +++ b/types/polygon/polygon-tests.ts @@ -0,0 +1,16 @@ +// no tests yet +import Polygon = require('polygon'); + +const polygon1 = new Polygon([ + [0, 0], + [5, 0], + [5, 5], + [0, 5], + [0, 0], +]); +const shouldBeTrue = polygon1.contains({ + x: 3, + y: 3, + w: 4, + h: 3, +}); diff --git a/types/polygon/tsconfig.json b/types/polygon/tsconfig.json new file mode 100644 index 0000000000..516af96426 --- /dev/null +++ b/types/polygon/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "polygon-tests.ts" + ] +} diff --git a/types/polygon/tslint.json b/types/polygon/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/polygon/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/polygons-intersect/index.d.ts b/types/polygons-intersect/index.d.ts new file mode 100644 index 0000000000..87fd174e69 --- /dev/null +++ b/types/polygons-intersect/index.d.ts @@ -0,0 +1,14 @@ +// Type definitions for polygons-intersect 1.0 +// Project: https://github.com/DudaGod/polygons-intersect#readme +// Definitions by: Konrad Klockgether +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Finds all points where the polygons intersect each other. + */ +declare function intersection( + poly1: Array<{ x: number, y: number }>, + poly2: Array<{ x: number, y: number }> +): Array<{ x: number, y: number }>; + +export = intersection; diff --git a/types/polygons-intersect/polygons-intersect-tests.ts b/types/polygons-intersect/polygons-intersect-tests.ts new file mode 100644 index 0000000000..104c93c788 --- /dev/null +++ b/types/polygons-intersect/polygons-intersect-tests.ts @@ -0,0 +1,5 @@ +import polygonsIntersect = require('polygons-intersect'); + +const poly1 = [{x: 10, y: 10}, {x: 10, y: 30}, {x: 30, y: 30}, {x: 30, y: 10}]; +const poly2 = [{x: 20, y: 20}, {x: 20, y: 40}, {x: 40, y: 40}, {x: 40, y: 20}]; +polygonsIntersect(poly1, poly2); diff --git a/types/polygons-intersect/tsconfig.json b/types/polygons-intersect/tsconfig.json new file mode 100644 index 0000000000..20c8856f07 --- /dev/null +++ b/types/polygons-intersect/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "polygons-intersect-tests.ts" + ] +} diff --git a/types/ora/tslint.json b/types/polygons-intersect/tslint.json similarity index 100% rename from types/ora/tslint.json rename to types/polygons-intersect/tslint.json diff --git a/types/polyline/tslint.json b/types/polyline/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/polyline/tslint.json +++ b/types/polyline/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/polymer-ts/tslint.json b/types/polymer-ts/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/polymer-ts/tslint.json +++ b/types/polymer-ts/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/polymer/tslint.json b/types/polymer/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/polymer/tslint.json +++ b/types/polymer/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/popcorn/tslint.json b/types/popcorn/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/popcorn/tslint.json +++ b/types/popcorn/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/postal/tslint.json b/types/postal/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/postal/tslint.json +++ b/types/postal/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/power-assert-formatter/tslint.json b/types/power-assert-formatter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/power-assert-formatter/tslint.json +++ b/types/power-assert-formatter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/power-assert/tslint.json b/types/power-assert/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/power-assert/tslint.json +++ b/types/power-assert/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/powerapps-component-framework/componentframework.d.ts b/types/powerapps-component-framework/componentframework.d.ts new file mode 100644 index 0000000000..742e7d506b --- /dev/null +++ b/types/powerapps-component-framework/componentframework.d.ts @@ -0,0 +1,1986 @@ +declare namespace ComponentFramework { + /** + * Interface for the PowerApps Controls (Standard) + */ + interface StandardControl { + /** + * Used to initialize the control instance. Controls can kick off remote server calls and other initialization actions here. + * Data-set values are not initialized here, use updateView. + * @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped + * to property names defined in the manifest, as well as utility functions. + * @param notifyOutputChanged A callback method to alert the framework that the control has new outputs ready to be retrieved asynchronously. + * @param state A piece of data that persists in one session for a single user. Can be set at any point in a controls life cycle by calling + * 'setControlState' in the Mode interface. + * @param container If a control is marked control-type='standard', it will receive an empty div element within which it can render its content. + */ + init(context: Context, notifyOutputChanged?: () => void, state?: Dictionary, container?: HTMLDivElement): void; + + /** + * Called when any value in the property bag has changed. This includes field values, data-sets, global values such as container height and width, + * offline status, control metadata values such as label, visible, etc. + * @param context The entire property bag available to control via Context Object; It contains values as set up by the customizer mapped to names + * defined in the manifest, as well as utility functions + */ + updateView(context: Context): void; + + /** + * Called when the control is to be removed from the DOM tree. Controls should use this call for cleanup. + * i.e. cancelling any pending remote calls, removing listeners, etc. + */ + destroy(): void; + + /** + * It is called by the framework prior to a control receiving new data. + * @returns an object based on nomenclature defined in manifest, expecting object[s] for property marked as "bound" or "output" + */ + getOutputs?(): TOutputs; + } + + /** + * The entire property bag interface available to control via Context Object + */ + interface Context { + client: Client; + device: Device; + factory: Factory; + formatting: Formatting; + mode: Mode; + navigation: Navigation; + resources: Resources; + userSettings: UserSettings; + utils: Utility; + webAPI: WebApi; + parameters: TInputs; + updatedProperties: string[]; + } + + /** + * The interface for the context.client + */ + interface Client { + /** + * Whether this control should disable its scrolling capabilities. + */ + disableScroll: boolean; + + /** + * Device form factor. + * Unknown = 0 + * Desktop = 1 + * Tablet = 2 + * Phone = 3 + */ + getFormFactor(): number; + + /** + * Returns a value to indicate which client the script is executing in. + * Web: Web application, or Unified Interface + * Outlook: Outlook + * Mobile: Mobile app + */ + getClient(): string; + + /** + * Returns information whether the server is online or offline. + */ + isOffline(): boolean; + } + + /** + * The interface for the context.device + */ + interface Device { + /** + * Invokes the device microphone to record audio. + */ + captureAudio(): Promise; + + /** + * Invokes the device camera to capture an image. + */ + captureImage(options?: DeviceApi.CaptureImageOptions): Promise; + + /** + * Invokes the device camera to record video. + */ + captureVideo(): Promise; + + /** + * Invokes the device camera to scan the barcode information, such as a product number. + */ + getBarcodeValue(): Promise; + + /** + * Returns the current location using the device geolocation capability. + */ + getCurrentPosition(): Promise; + + /** + * Opens a dialog box to select files from your computer (web client) or mobile device (mobile clients). + */ + pickFile(options?: DeviceApi.PickFileOptions): Promise; + } + + /** + * The interface for the context.factory + */ + interface Factory { + /** + * Gets the popup service which help create Popup and manage Popup easily + */ + getPopupService(): FactoryApi.Popup.PopupService; + + /** + * Requests re-rendering of the control with updated data. + */ + requestRender(): void; + } + + /** + * The interface for the context.formatting + */ + interface Formatting { + /** + * Returns a formatted string that represents the currency value after being formatted. + * @param value A value object to be formatted. + * @param precision The number of digits after decimal point. + * @param symbol The currency symbol/code to be added with currency value. + */ + formatCurrency(value: number, precision?: number, symbol?: string): string; + + /** + * Returns a formatted string that represents the decimal value after being formatted. + * @param value A value object to be formatted. + * @param precision The number of digits after decimal point. + */ + formatDecimal(value: number, precision?: number): string; + + /** + * Returns a formatted string that represents a date in a YYYY-MM-DD standard UTC format. + * Result pattern is based on Standard UTC format. + * @param value The date to be formatted. + * @param includeTime If time component should be included in the return value. + */ + formatDateAsFilterStringInUTC(value: Date, includeTime?: boolean): string; + + /** + * Returns a formatted string that represents a date in the long form. + * Result pattern is based on culture. In USA it's "Day of week, Month dd, yyyy"in USA + * @param value Date to format. + */ + formatDateLong(value: Date): string; + + /** + * Returns a formatted string that represents a date in the long form using abbreviations. + * Result pattern is based on culture. In USA it's "Abbreviated Day of week, Month dd, yyyy" in USA + * @param value Date to format. + */ + formatDateLongAbbreviated(value: Date): string; + + /** + * Returns a string represents the datetime value after being formatted. + * Result pattern is based on culture. In USA it's 'MM/DD/YYYY' in USA + * @param value Date to format. + * @param includeTime Whether to show time in formatted value. + */ + formatDateShort(value: Date, includeTime?: boolean): string; + + /** + * Returns a formatted string that represents a date in the year month format. + * @param value Date to format. + */ + formatDateYearMonth(value: Date): string; + + /** + * Returns a formatted string represents a given integer value. + * @param value A number primitive to be formatted. + */ + formatInteger(value: number): string; + + /** + * Returns a formatted string that represents a given language + * @param input A language code to be formatted. Reference: https://go.microsoft.com/fwlink/?linkid=122128 + * @returns A formatted string represents a given language value. + */ + formatLanguage(value: number): string; + + /** + * Returns a formatted string that represents the datetime value after being formatted. + * @param value The date to be formatted. + * @param behavior The behavior of the datetime object to be formatted. + * None = 0, + * UserLocal = 1, + * TimeZoneIndependent = 3 + */ + formatTime(value: Date, behavior: FormattingApi.DateTimeFieldBehavior): string; + + /** + * Gets the ISO week number of the year for a given date. Range 1-53 + * @param value The DateTime to convert. + */ + getWeekOfYear(value: Date): number; + } + + /** + * The interface for the context.mode + */ + interface Mode { + /** + * Height in pixels allocated to the control. If it's -1, then there is no limit on height + */ + allocatedHeight: number; + + /** + * Width in pixels allocated to the control. + */ + allocatedWidth: number; + + /** + * Is the control in 'Read-only' mode. + */ + isControlDisabled: boolean; + + /** + * Is the control in 'Visible' mode. + */ + isVisible: boolean; + + /** + * The defined control label + */ + label: string; + + /** + * set control state so that it will be stored in one session + */ + setControlState(state: Dictionary): boolean; + + /** + * Make the control full screen. + * @param value True if control needs to autosize to full screen. False if control needs to autosize to allocated width. + */ + setFullScreen(value: boolean): void; + + /** + * API to determine container sizing if control needs to react. Control will get allocatedWidth/allocatedHeight if input is 'true' + * @param value True if controls needs to track container size, control will get allocatedWidth/allocatedHeight + */ + trackContainerResize(value: boolean): void; + } + + /** + * The navigation interface of context.navigation + */ + interface Navigation { + /** + * Opens Alert Dialog + * @param alertStrings Strings to be used in alert dialog + * @param options Dialog options + * @returns promise defining success or failure of operation + */ + openAlertDialog(alertStrings: NavigationApi.AlertDialogStrings, options?: NavigationApi.AlertDialogOptions): Promise; + + /** + * Opens Confirm Dialog + * @param confirmStrings String which will be used in the dialog + * @param options Options for the dialog + * @returns promise defining success or failure of operation. the success case returns a boolean specifying whether yes or no button was pressed + */ + openConfirmDialog(confirmStrings: NavigationApi.ConfirmDialogStrings, options?: NavigationApi.ConfirmDialogOptions): Promise; + + /** + * Opens an Error Dialog. + * @param options Error Dialog options. + * @returns promise defining success or failure of operation. + */ + openErrorDialog(options: NavigationApi.ErrorDialogOptions): Promise; + + /** + * Open a file + * @param file An object describing the file to open + * @param options Options for openFile. OpenMode field in the options allows to save file instead opening. + * @returns promise defining success or failure of operation. + */ + openFile(file: FileObject, options?: NavigationApi.OpenFileOptions): Promise; + + /** + * Opens an entity form or quick create form. + * @param options entity form options. + * @param parameters entity form parameters. + * @returns promise defining success or failure of operation + */ + openForm(options: NavigationApi.EntityFormOptions, parameters?: {[key: string]: string}): Promise; + + /** + * Open url, including file urls. + * @param url url to be opened. + * @param options window options for the url. + */ + openUrl(url: string, options?: NavigationApi.OpenUrlOptions): void; + + /** + * Opens an HTML web resource. + * @param name The name of the HTML web resource to open. + * @param options Window options for the web resource. + * @param data Data to be passed into the data parameter. + */ + openWebResource(name: string, options?: NavigationApi.OpenWebResourceOptions, data?: string): void; + } + + /** + * The resource interface of context.resources + */ + interface Resources { + /** + * Gets a resource referenced by the control manifest. + * @param id The resource string identifier. + * @param success The success callback. Resource data is returned in base 64 encoded format. + * @param failure The failure callback. + */ + getResource(id: string, success: (data: string) => void, failure: () => void): void; + + /** + * Get the localized string for the given identifier. + * @param id name of resource in the control manifest. + */ + getString(id: string): string; + } + + /** + * The interface for context.userSettings + */ + interface UserSettings { + /** + * Date formatting information as retrieved from the server. + */ + dateFormattingInfo: UserSettingApi.DateFormattingInfo; + + /** + * Returns true if the language is right to left + */ + isRTL: boolean; + + /** + * Current user's language id + * + */ + languageId: number; + + /** + * Number formatting information as retrieved from the server. + */ + numberFormattingInfo: UserSettingApi.NumberFormattingInfo; + + /** + * Current user roles + */ + securityRoles: string[]; + + /** + * The id of the current user + */ + userId: string; + + /** + * The username of the current user + */ + userName: string; + + /** + * Gets the offset in minutes from UTC for the given date + * @param date date to get the offset from utc for + */ + getTimeZoneOffsetMinutes(date?: Date): number; + } + + /** + * The interface for context.utils + */ + interface Utility { + /** + * Gets the entity metadata for the specified entity. + * @param entityType The logical name of the entity. + * @param attributes The attributes to get metadata for. + */ + getEntityMetadata(entityName: string, attributes?: string[]): Promise; + + /** + * Function to return if the user has Privilege for one specific entity + * @entityTypeName entity type name + * @privilegeType privilege type i.e. Create, Read, Write etc. + * @privilegeDepth privilege depth i.e. basic, Global etc. + */ + hasEntityPrivilege(entityTypeName: string, privilegeType: PropertyHelper.PrivilegeType, privilegeDepth: PropertyHelper.PrivilegeDepth): boolean; + + /** + * Opens a lookup dialog allowing the user to select one or more entities. + * @param lookupOptions Options for opening the lookup dialog. + */ + lookupObjects(lookupOptions: UtilityApi.LookupOptions): Promise; + } + + /** + * The interface for context.webApi + */ + interface WebApi { + /** + * Creates an entity record. + * @param entityType logical name of the entity type record to create + * @param data dictionary with attribute schema name and value + * @returns The deferred object for the result of the operation. The created record object will be resolved if successful. + */ + createRecord(entityType: string, data: WebApi.Entity): Promise; + + /** + * Deletes an entity record. + * @param id GUID of the entity record you want to delete. + * @param entityType logical name of the entity type record to delete + * @returns The deferred object for the result of the operation. The deleted record object will be resolved if successful. + */ + deleteRecord(entityType: string, id: string): Promise; + + /** + * Updates an entity record. + * @param id GUID of the entity record you want to update. + * @param data dictionary containing to-change attributes with schema name and value + * @param entityType logical name of the entity type record to update + * @returns The deferred object for the result of the operation. The updated record object will be resolved if successful. + */ + updateRecord(entityType: string, id: string, data: WebApi.Entity): Promise; + + /** + * Retrieves a collection of entity records. + * @param entityType logical name of the entity type record to retrieve + * @param options OData system query options or FetchXML query to retrieve your data. + * For support options, please refer to https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrievemultiplerecords + * @param maxPageSize Max number of records to be retrieved per page + * @returns The deferred object for the result of the operation. An object with interface RetrieveMultipleResponse will be resolved if successful. + */ + retrieveMultipleRecords(entityType: string, options?: string, maxPageSize?: number): Promise; + + /** + * Retrieves an entity record. + * @param id GUID of the entity record you want to retrieve. + * @param entityType logical name of the entity type record to retrieve + * @param options OData system query options, $select and $expand, to retrieve your data. + * For support options, please refer to https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-webapi/retrieverecord + * @returns The deferred object for the result of the operation. A JSON object with the retrieved properties and values will be resolved if successful. + */ + retrieveRecord(entityType: string, id: string, options?: string): Promise; + } + + //////////////// Define namespace of each context first-level child interface's helper //////////////// + + interface Dictionary { + [key: string]: any; + } + + /** + * Helper of Device API interface + */ + namespace DeviceApi { + /** + * Interface of input argument 'options' in context.device.captureImage + */ + interface CaptureImageOptions { + /** + * Indicates whether to edit the image before saving. + */ + allowEdit: boolean; + + /** + * Height of the image to capture. + */ + height: number; + + /** + * Indicates whether to capture image using the front camera of the device. + */ + preferFrontCamera: boolean; + + /** + * Quality of the image file in percentage. + */ + quality: number; + + /** + * Width of the image to capture. + */ + width: number; + } + + /** + * Interface of return geological information in context.device.getCurrentPosition + */ + interface Position { + /** + * Contains a set of geographic coordinates along with associated accuracy as well as a set of other optional attributes such as altitude and speed. + */ + coords: Dictionary; + + /** + * Represents the time when the object was acquired and is represented as DOMTimeStamp. + */ + timestamp: Date; + } + + /** + * Interface of input argument 'pickupFileOption' in context.device.pickupFile + */ + interface PickFileOptions { + /** + * Image file types to select. Valid values are "audio", "video", or "image". + */ + accept: string; + + /** + * Indicates whether to allow selecting multiple files. + */ + allowMultipleFiles: boolean; + + /** + * Maximum size of the files(s) to be selected. + */ + maximumAllowedFileSize: number; + } + } + + /** + * Helper of Factory Pop API interface + */ + namespace FactoryApi.Popup { + interface PopupService { + /** + * Create a new popup element + * @param props The popup properties object, see Popup interface for more + */ + createPopup(props: Popup): void; + + /** + * Open an existing popup in the service with the given name. Does nothing if popup does not exist yet. + * @param name the name of the popup you're trying to open + */ + openPopup(name: string): void; + + /** + * Close an existing popup in the service with the given name. Does nothing if popup does not exist yet. + * @param name the name of the popup you're trying to close + */ + closePopup(name: string): void; + + /** + * Update an existing popup in the service with the given name, patching new content to the same popup element. Does nothing if popup does not exist yet. + * @param name the name of the popup you're trying to update + * @param newProps the updated properties to give to the popup. + */ + updatePopup(name: string, newProps: Popup): void; + + /** + * Remove the referenced popup from the popupService, unregister the service + * @param name The name of the popup to remove + */ + deletePopup(name: string): void; + + /** + * Sets the ID (on the DOM and in the system) for the root popup element. + * @param id The string to set as the id + */ + setPopupsId(id: string): void; + + /** + * Gets the currently set popup Id + */ + getPopupsId(): string; + } + + enum PopupType { + /** + * Root popup in the popup stack + */ + Root = 1, + + /** + * Not root popup in the popup stack + */ + Nested, + } + + interface Popup { + /** + * The id to be set to the anchor control if any. + */ + id?: string; + + /** + * The name of the Popup. Used as the reference to open Popups. + */ + name: string; + + /** + * Indicates whether popup close on an outside mouse click. + * When it's false, the popup will not be closed on an outside mouse click. + */ + closeOnOutsideClick?: boolean; + + /** + * The name of Popup which should be opened. + * Should be defined ONLY in a Root Popup. + * To open nested Popups, should be provided string like "rootName.nestedName.[allOtherNestedNames]". + * To close Popups, should be provided empty string. + * This prop will be automatically propagated to children. + */ + popupToOpen?: string; + + /** + * The type of Popup, which is described in PopupType enum. Should be only one "root" Popup for each set of Popups. + */ + type: PopupType; + + /** + * Static DOM element to be inserted + */ + content: HTMLElement; + } + } + + /** + * Helper of Formatting API interface + */ + namespace FormattingApi { + /** + * DateTime Field Behavior options + */ + enum DateTimeFieldBehavior { + /** + * Unknown DateTime Behavior + */ + None = 0, + + /** + * Respect user local time. Dates stored as UTC + */ + UserLocal = 1, + + /** + * Dates and time stored without conversion to UTC + */ + TimeZoneIndependent = 3, + } + } + + /** + * Helper of Navigation API interface + */ + namespace NavigationApi { + /** + * Interface for alert dialog options. + */ + interface AlertDialogOptions { + /** + * Height of the alert dialog in pixels. + */ + height?: number; + + /** + * Width of the alert dialog pixels. + */ + width?: number; + } + + /** + * Represents the String parameters for Alert Dialog. + */ + interface AlertDialogStrings { + /** + * The message to be displyed in the alert dialog. + */ + text: string; + + /** + * The confirm button label. If you do not specify the button label, OK (in user's preferred language) is used as the button label. + */ + confirmButtonLabel?: string; + } + + /** + * Interface for confirm dialog options. + */ + interface ConfirmDialogOptions { + /** + * Height of the confirmation dialog in pixels. + */ + height?: number; + + /** + * Width of the confirmation dialog pixels. + */ + width?: number; + } + + /** + * Represents the String parameters for Confirm Dialog. + */ + interface ConfirmDialogStrings { + /** + * Confirm Dialog Title. + */ + title?: string; + + /** + * Confirm Dialog Subtitle + */ + subtitle?: string; + + /** + * Confirm Dialog Text\Message. + */ + text: string; + + /** + * The confirm button label. If you do not specify the button label, OK (in user's preferred language) is used as the button label. + */ + confirmButtonLabel?: string; + + /** + * Cancel Button label. + */ + cancelButtonLabel?: string; + } + + /** + * An object with the confirmed (Boolean) attribute is passed that indicates whether the confirm button was clicked to close the dialog. + */ + interface ConfirmDialogResponse { + /** + * confirmed (Boolean) attribute is passed that indicates whether the confirm button was clicked to close the dialog. + */ + confirmed: boolean; + } + + /** + * Interface for entity form options. + */ + interface EntityFormOptions { + /** + * Designates a record that will provide default values based on mapped attribute values. The lookup object has the following String properties: entityType, id, and name + */ + createFromEntity?: EntityReference; + + /** + * ID of the entity record to display the form for. + */ + entityId?: string; + + /** + * Logical name of the entity to display the form for. + */ + entityName: string; + + /** + * ID of the form instance to be displayed. + */ + formId?: string; + + /** + * Height of the form window to be displayed in pixels. + */ + height?: number; + + /** + * Indicates whether to display form in a new window. + */ + openInNewWindow?: boolean; + + /** + * Indicates whether to open a quick create form. If you do not specify this, by default false is passed. + */ + useQuickCreateForm?: boolean; + + /** + * Width of the form window to be displayed in pixels. + */ + width?: number; + + /** + * Specify one of the following values for the window position of the form on the screen: + * 1:center + * 2:side + */ + windowPosition?: number; + } + + /** + * Interface for error dialog options. + * You must set either the errorCode or message attribute. + */ + interface ErrorDialogOptions { + /** + * Details about the error. When you specify this, the Download Log File button is available in the error message, and clicking it will let users download a text file with + * the content specified in this attribute. + */ + details?: string; + + /** + * If you just set errorCode, the message for the error code is automatically retrieved from the server and displayed in the error dialog. If you specify an errorCode value, + * an error dialog with a default error message is displyed. + */ + errorCode?: number; + + /** + * The message to be displayed in the error dialog. + */ + message?: string; + } + + /** + * The options for openFile mode. + */ + enum OpenFileMode { + /** + * default. mode open + */ + open = 1, + + /** + * mode save + */ + save = 2, + } + + /** + * Interface for open file options. + */ + interface OpenFileOptions { + /** + * Specify whether to open or save the file + * Values: + * 1 open + * 2 save + */ + openMode: OpenFileMode; + } + + /** + * The object returned when a save is successful for open form. + */ + interface OpenFormSuccessResponse { + savedEntityReference: EntityReference[]; + } + + /** + * Interface for OpenUrl options. + */ + interface OpenUrlOptions { + /** + * Height of the window to display the resultant page in pixels. + */ + height?: number; + + /** + * Width of the window to display the resultant page in pixels. + */ + width?: number; + } + + /** + * Interface for OpenWebResource options. + */ + interface OpenWebResourceOptions { + /** + * Height of the window to display the resultant page in pixels. + */ + height?: number; + + /** + * Indicates whether to open the web resource in a new window. + */ + openInNewWindow: boolean; + + /** + * Width of the window to display the resultant page in pixels. + */ + width?: number; + } + } + + /** + * Helper of UserSettings API interface + */ + namespace UserSettingApi { + /** + * Day Of Week Enum + */ + enum DayOfWeek { + Sunday = 0, + Monday = 1, + Tuesday = 2, + Wednesday = 3, + Thursday = 4, + Friday = 5, + Saturday = 6 + } + + /** + * The interface for Org Date Format Info exposed to a custom control + * Result pattern is based on culture,examples are for 'USA' area + */ + interface DateFormattingInfo { + /** + * @example "AM" + */ + amDesignator: string; + + /** + * @example { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" } + */ + abbreviatedDayNames: string[]; + + /** + * @example { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "" } + */ + abbreviatedMonthGenitiveNames: string[]; + + /** + * @example { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", "" } + */ + abbreviatedMonthNames: string[]; + + /** + * @example 0 + */ + calendarWeekRule: number; + + /** + * @example See interface Calendar + */ + calendar: Calendar; + + /** + * @example "/" + */ + dateSeparator: string; + + /** + * @example { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" } + */ + dayNames: string[]; + + /** + * @example See interface DayOfWeek + */ + firstDayOfWeek: DayOfWeek; + + /** + * @example "dddd, MMMM d, yyyy h:mm:ss tt" + */ + fullDateTimePattern: string; + + /** + * @example "dddd, MMMM d, yyyy" + */ + longDatePattern: string; + + /** + * @example "hh:mm:ss tt" + */ + longTimePattern: string; + + /** + * @example "MMMM dd" + */ + monthDayPattern: string; + + /** + * @example { "January", "February", "March", ... "December", "" } + */ + monthGenitiveNames: string[]; + + /** + * @example { "January", "February", "March", ... "December", "" } + */ + monthNames: string[]; + + /** + * @example "PM" + */ + pmDesignator: string; + + /** + * @example "M/d/yyyy" + */ + shortDatePattern: string; + + /** + * @example "h:mm tt" + */ + shortTimePattern: string; + + /** + * @example { "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa" } + */ + shortestDayNames: string[]; + + /** + * @example "yyyy'-'MM'-'dd'T'HH':'mm':'ss" + */ + sortableDateTimePattern: string; + + /** + * @example ":" + */ + timeSeparator: string; + + /** + * @example "yyyy'-'MM'-'dd HH':'mm':'ss'Z'" + */ + universalSortableDateTimePattern: string; + + /** + * @example "MMMM yyyy" + */ + yearMonthPattern: string; + } + + /** + * The interface for the Org System Settings Number Format Info exposed to a custom control + * Comments indicate example values + */ + interface NumberFormattingInfo { + /** + * @example 2 + */ + currencyDecimalDigits: number; + + /** + * @example "." + */ + currencyDecimalSeparator: string; + + /** + * @example "," + */ + currencyGroupSeparator: string; + + /** + * @example [ 3 ] + */ + currencyGroupSizes: number[]; + + /** + * @example 0 + */ + currencyNegativePattern: number; + + /** + * @example 0 + */ + currencyPositivePattern: number; + + /** + * @example "$" + */ + currencySymbol: string; + + /** + * @example "NaN" + */ + nanSymbol: string; + + /** + * @example { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9"} + */ + nativeDigits: string[]; + + /** + * @example "-Infinity" + */ + negativeInfinitySymbol: string; + + /** + * @example "-" + */ + negativeSign: string; + + /** + * @example 2 + */ + numberDecimalDigits: number; + + /** + * @example "." + */ + numberDecimalSeparator: string; + + /** + * @example "," + */ + numberGroupSeparator: string; + + /** + * @example [3] + */ + numberGroupSizes: number[]; + + /** + * @example 1 + */ + numberNegativePattern: number; + + /** + * @example "" + */ + perMilleSymbol: string; + + /** + * @example 2 + */ + percentDecimalDigits: number; + + /** + * @example "." + */ + percentDecimalSeparator: string; + + /** + * @example "," + */ + percentGroupSeparator: string; + + /** + * @example [3] + */ + percentGroupSizes: number[]; + + /** + * @example 0 + */ + percentNegativePattern: number; + + /** + * @example 0 + */ + percentPositivePattern: number; + + /** + * @example "%" + */ + percentSymbol: string; + + /** + * @example "Infinity" + */ + positiveInfinitySymbol: string; + + /** + * @example "+" + */ + positiveSign: string; + } + + /** + * The interface for the Calendar exposed in DateFormattingInfo + */ + interface Calendar { + /** + * @example "/Date(-62135568000000)/" + */ + minSupportedDateTime: Date; + + /** + * @example "/Date(253402300799999)/" + */ + maxSupportedDateTime: Date; + + /** + * @example 1 + */ + algorithmType: number; + + /** + * @example 1 + */ + calendarType: number; + + /** + * @example 2029 + */ + twoDigitYearMax: number; + } + } + + /** + * Helper of Utils API interface + */ + namespace UtilityApi { + /** + * Options used when opening a lookup dialog. + */ + interface LookupOptions { + /** + * Whether the lookup allows more than one item to be selected. + */ + allowMultiSelect: boolean; + + /** + * The default entity type. + */ + defaultEntityType: string; + + /** + * The default view to use. + */ + defaultViewId: string; + + /** + * The entity types to display. + */ + entityTypes: string[]; + + /** + * The views to be available in the view picker. Only System views are supported (not user views). + */ + viewIds: string[]; + } + } + + /** + * Objects related to interacting with the Web API. + */ + namespace WebApi { + /** + * Interface that describes an entity sent or received from the SDK through the Web API. + */ + interface Entity { + [key: string]: any; + } + + interface RetrieveMultipleResponse { + /** + * An array of JSON objects, where each object represents the retrieved entity record containing attributes and their values + */ + entities: Entity[]; + + /** + * If the number of records being retrieved is more than the value specified in the 'maxPageSize' parameter in the request, this attribute returns the URL to return next set of records. + */ + nextLink: string; + } + } + + /** + * An object that encapsulates an Entity Reference as a plain object suitable for storing in the state tree + */ + interface EntityReference { + /** + * The record id. Read-only. + */ + id: string; + + /** + * The entity logical name. Read-only. + */ + entityType?: string; + + /** + * The name of the entity reference. Read-only. + */ + name: string; + } + + /** + * Interface of one file object + */ + interface FileObject { + /** + * Contents of the file. + */ + fileContent: string; + + /** + * Name of the file. + */ + fileName: string; + + /** + * Size of the file in KB. + */ + fileSize: number; + + /** + * File MIME type. + */ + mimeType: string; + } + +///////////////////// Parameter //////////////////////// + + namespace PropertyTypes { + /** + * Interface for context.parameters.[property_key] + */ + interface Property { + error: boolean; + errorMessage: string; + formatted?: string; + security?: PropertyHelper.SecurityValues; + raw: any; + type: string; + attribute?: PropertyHelper.FieldPropertyMetadata.Metadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is Whole.None|FP|Decimal + */ + interface NumberProperty extends Property { + raw: number; + attributes?: PropertyHelper.FieldPropertyMetadata.NumberMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is Decimal + */ + interface DecimalNumberProperty extends NumberProperty { + attributes?: PropertyHelper.FieldPropertyMetadata.DecimalNumberMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is FP + */ + interface FloatingNumberProperty extends NumberProperty { + attributes?: PropertyHelper.FieldPropertyMetadata.FloatingNumberMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is Whole.None + */ + interface WholeNumberProperty extends NumberProperty { + attributes?: PropertyHelper.FieldPropertyMetadata.WholeNumberMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type starts from DateTime + */ + interface DateTimeProperty extends Property { + raw: Date; + attributes?: PropertyHelper.FieldPropertyMetadata.DateTimeMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type starts from SingleLine + */ + interface StringProperty extends Property { + raw: string; + attributes?: PropertyHelper.FieldPropertyMetadata.StringMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is Enum + */ + interface EnumProperty { + type: string; + raw: EnumType; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is OptionSet + */ + interface OptionSetProperty extends Property { + raw: number; + attributes?: PropertyHelper.FieldPropertyMetadata.OptionSetMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is MultiSelectOptionSet + */ + interface MultiSelectOptionSetProperty extends Property { + raw: number[]; + attributes?: PropertyHelper.FieldPropertyMetadata.OptionSetMetadata; + } + + /** + * Property Interface for context.parameters.[property_key], when property manifest type is TwoOptions + */ + interface TwoOptionsProperty extends Property { + raw: boolean; + attributes?: PropertyHelper.FieldPropertyMetadata.TwoOptionMetadata; + } + + /** + * The structure returned by getCellImageInfo and propagated down to the control to display conditional images. + */ + interface ImageInfo { + /** + * The Url of the conditional image. + */ + Url: string; + + /** + * The tooltip associated with that image. + */ + Tooltip: string; + } + + /** + * The structure of a dataset property as it would be passed to a control + */ + interface DataSet { + /** + * Adds column to the columnset + * @param name column name to be added to the columnset + * @param entityAlias entity alias for which the column name needs to be added + */ + addColumn?: (name: string, entityAlias?: string) => void; + + /** + * Set of columns available in this dataset. + */ + columns: PropertyHelper.DataSetApi.Column[]; + + /** + * True if encountered error while data retrieval + */ + error: boolean; + + /** + * The error message associated with the last encountered error, if applicable + */ + errorMessage: string; + + /** + * The column filtering for the current query. + */ + filtering: PropertyHelper.DataSetApi.Filtering; + + /** + * Related entity info + */ + linking: PropertyHelper.DataSetApi.Linking; + + /** + * Indicate if the dataset property is in loading state or not + */ + loading: boolean; + + /** + * Pagination status and actions. + */ + paging: PropertyHelper.DataSetApi.Paging; + + /** + * Map of IDs to the full record object + */ + records: { + [id: string]: PropertyHelper.DataSetApi.EntityRecord; + }; + + /** + * IDs of the records in the dataset, order by the query response result + */ + sortedRecordIds: string[]; + + /** + * The sorting status for the current query. + */ + sorting: PropertyHelper.DataSetApi.SortStatus[]; + + /** + * Clear selected record ids list + */ + clearSelectedRecordIds(): void; + + /** + * Retrieves all selected record ids + */ + getSelectedRecordIds(): string[]; + + /** + * Get DataSet target entity logical name + */ + getTargetEntityType(): string; + + /** + * Retrieves the view display name used by the dataset property + */ + getTitle(): string; + + /** + * Gets Id of view used by the dataset property + */ + getViewId(): string; + + /** + * Open dataSet item for a given EntityReference. It will check if there is a command with command button id "Mscrm.OpenRecordItem". + * If there is, it will execute the command, otherwise it will just navigate to the associated form of the entityReference + * @param entityReference entity reference + */ + openDatasetItem(entityReference: EntityReference): void; + + /** + * Refreshes the dataset based on filters, sorting, linking, new column. New data will be pushed to control in another 'updateView' cycle. + */ + refresh(): void; + + /** + * Set the ids of the selected records + * @ids List of recordId's + */ + setSelectedRecordIds(ids: string[]): void; + } + } + + namespace PropertyHelper { + /** + * Ime Mode + */ + enum ImeMode { + Auto = 0, + Inactive = 1, + Active = 2, + Disabled = 3, + } + + /** + * Entity privilege types. + */ + enum PrivilegeType { + None = 0, + Create = 1, + Read = 2, + Write = 3, + Delete = 4, + Assign = 5, + Share = 6, + Append = 7, + AppendTo = 8, + } + + /** + * Entity Priviledge Depth + */ + enum PrivilegeDepth { + None = -1, + Basic = 0, + Local = 1, + Deep = 2, + Global = 3, + } + + /** + * Attribute required level + */ + enum RequiredLevel { + Unknown = -1, + None = 0, + SystemRequired = 1, + ApplicationRequired = 2, + Recommended = 3, + } + + /** + * Entity metadata refer to online documentation + * https://docs.microsoft.com/en-us/dynamics365/customer-engagement/developer/clientapi/reference/xrm-utility/getentitymetadata + */ + interface EntityMetadata { + [key: string]: any; + } + + /** + * Option Item Metadata + */ + interface OptionMetadata { + Label: string; + Value: number; + Color: string; + } + + /** + * Entity metadata security privileges. + */ + interface SecurityPrivilegeMetadata { + CanBeBasic: boolean; + CanBeDeep: boolean; + CanBeGlobal: boolean; + CanBeLocal: boolean; + CanBeEntityReference: boolean; + CanBeParentEntityReference: boolean; + Name: string; + PrivilegeId: string; + PrivilegeType: PrivilegeType; + } + + /** + * Entity metadata security values + */ + interface SecurityValues { + editable: boolean; + readable: boolean; + secured: boolean; + } + + namespace FieldPropertyMetadata { + interface Metadata { + DisplayName: string; + LogicalName: string; + RequiredLevel: RequiredLevel; + IsSecured: boolean; + SourceType: number; + Description: string; + } + + interface NumberMetadata extends Metadata { + MinValue: number; + MaxValue: number; + ImeMode: ImeMode; + } + + interface StringMetadata extends Metadata { + MaxLength: number; + ImeMode: ImeMode; + } + + interface FloatingNumberMetadata extends NumberMetadata { + Precision: number; + } + + interface DecimalNumberMetadata extends NumberMetadata { + Precision: number; + } + + interface WholeNumberMetadata extends NumberMetadata { + Format: string; + LanguageByCode?: Dictionary; + TimeZoneByCode?: Dictionary; + } + + interface DateTimeMetadata extends Metadata { + Behavior: FormattingApi.DateTimeFieldBehavior; + Format: string; + ImeMode: ImeMode; + } + + interface LookupMetadata extends Metadata { + Targets: string[]; + } + + interface StringMetadata extends Metadata { + Format: string; + } + + interface OptionSetMetadata extends Metadata { + Options: OptionMetadata[]; + DefaultValue: number; + } + + interface TwoOptionMetadata extends Metadata { + Options: [OptionMetadata, OptionMetadata]; + DefaultValue: boolean; + } + } + + namespace DataSetApi { + /** + * Supported Condition Operator for filtering expression condition + * This is subset of full condition operators list defined in https://docs.microsoft.com/en-us/dotnet/api/microsoft.xrm.sdk.query.conditionoperator + */ + enum ConditionOperator { + None = -1, + Equal = 0, + NotEqual = 1, + GreaterThan = 2, + LessThan = 3, + GreaterEqual = 4, + LessEqual = 5, + Like = 6, + In = 8, + Null = 12, + Yesterday = 14, + Today = 15, + Tomorrow = 16, + Last7Days = 17, + Next7Days = 18, + LastWeek = 19, + ThisWeek = 20, + LastMonth = 22, + ThisMonth = 23, + On = 25, + OnOrBefore = 26, + OnOrAfter = 27, + LastYear = 28, + ThisYear = 29, + LastXDays = 33, + NextXDays = 34, + LastXMonths = 37, + NextXMonths = 38, + Contains = 49, + InFiscalPeriodAndYear = 70, + Above = 75, + Under = 76, + NotUnder = 77, + AboveOrEqual = 78, + UnderOrEqual = 79, + ContainValues = 87 + } + + /** + * An expression used to represent a filter condition. + */ + interface ConditionExpression { + /** + * The name of the data-set column to apply the filter on. + */ + attributeName: string; + + /** + * The value evaluated by the condition + */ + conditionOperator: ConditionOperator; + + /** + * The value evaluated by the condition. + */ + value: string | string[]; + + /** + * Entity alias name so filtering can be used on linked entities. + */ + entityAliasName?: string; + } + + /** + * Supported Filter Operator for filtering expression linkage + */ + enum FilterOperator { + And = 0, + Or = 1 + } + + /** + * An expression used to represent a filter. + */ + interface FilterExpression { + /** + * The set of conditions associated with this filter. + */ + conditions: ConditionExpression[]; + + /** + * The operator used to combine conditions in this filter. + */ + filterOperator: FilterOperator; + + /** + * Any child filters that should be evaluated after evaluating this filter. + */ + filters?: FilterExpression[]; + } + + /** + * Filter state for a dataset. + */ + interface Filtering { + /** + * Returns the top-most filter associated with the data-set + */ + getFilter(): FilterExpression; + + /** + * Sets the top-most filter associated with the data-set + * @expression filter expression to be set + */ + setFilter(expression: FilterExpression): void; + + /** + * Clears the filter associated with the data-set. + */ + clearFilter(): void; + } + + /** + * Metadata about a column in a dataset + */ + interface Column { + /** + * Name of the column, unique in this dataset + */ + name: string; + + /** + * Localized display name for the column + */ + displayName: string; + + /** + * The manifest type of this column's values. + */ + dataType: string; + + /** + * The alias of this column. + */ + alias: string; + + /** + * The column order for the layout + */ + order: number; + + /** + * Customized column width ratios + */ + visualSizeFactor: number; + + /** + * The column visibility state. + */ + isHidden?: boolean; + + /** + * Is specific column the primary attrribute of the view's entity + */ + isPrimary?: boolean; + + /** + * Prevents the UI from making the column sortable. + */ + disableSorting?: boolean; + } + + /** + * Base interface for dataset record result. Supports value retrival by column name. + */ + interface EntityRecord { + /** + * Get the current formatted value of this record column. + * @param columnName Column name of the record + */ + getFormattedValue(columnName: string): string; + + /** + * Get the record ID + */ + getRecordId(): string; + + /** + * Get the raw value of the record's column + * @param columnName Column name of the record + */ + getValue(columnName: string): string | Date | number | number[] | boolean | EntityReference | EntityReference[]; + + /** + * Get the object that encapsulates an Entity Reference as a plain object + */ + getNamedReference(): EntityReference; + } + + /** + * Column Sort Direction + */ + enum SortDirection { + None = -1, + Ascending = 0, + Descending = 1 + } + + /** + * Current sort status of a dataset column + */ + interface SortStatus { + /** + * The name of the column + */ + name: string; + + /** + * The current sort direction for the column. + */ + sortDirection: SortDirection; + } + + /** + * Paging state for a dataset + */ + interface Paging { + /** + * Total number of results on the server for the current query. + */ + totalResultCount: number; + + /** + * Whether the result set can be paged forwards. + */ + hasNextPage: boolean; + + /** + * Whether the result set can be paged backwards. + */ + hasPreviousPage: boolean; + + /** + * Request the next page of results to be loaded. New data will be pushed to control in another 'updateView' cycle. + */ + loadNextPage(): void; + + /** + * Request the previous page of results to be loaded. New data will be pushed to control in another 'updateView' cycle. + */ + loadPreviousPage(): void; + + /** + * Reload the results from the server, and reset to page 1. + */ + reset(): void; + + /** + * Sets the number of results to return per page on the next data refresh. + * @pageSize pageSize to be set. + */ + setPageSize(pageSize: number): void; + } + + /** + * Dataset entity linking. + */ + interface Linking { + /** + * Returns all the linked entities information + */ + getLinkedEntities(): LinkEntityExposedExpression[]; + + /** + * Add a new linked entity relationship with the existed query primary entity + */ + addLinkedEntity(expression: LinkEntityExposedExpression): void; + } + + /** + * Entity linking expression + */ + interface LinkEntityExposedExpression { + /** + * The 'name' of the entity to link to + */ + name: string; + + /** + * The 'from' attribute in the link-entity relationship + */ + from: string; + + /** + * The 'to' attribute in the link-entity relationship + */ + to: string; + + /** + * The 'type' of the link, referred by the link-entity attribute + */ + linkType: string; + + /** + * The 'alias' for the link-entity relationship + */ + alias: string; + } + } + } +} diff --git a/types/powerapps-component-framework/index.d.ts b/types/powerapps-component-framework/index.d.ts new file mode 100644 index 0000000000..f4ba8718d0 --- /dev/null +++ b/types/powerapps-component-framework/index.d.ts @@ -0,0 +1,7 @@ +// Type definitions for non-npm package PowerApps Component Framework 1.0 +// Project: https://powerapps.microsoft.com +// Definitions by: Joseph Pursley +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +/// diff --git a/types/powerapps-component-framework/powerapps-component-framework-tests.ts b/types/powerapps-component-framework/powerapps-component-framework-tests.ts new file mode 100644 index 0000000000..de727aff7e --- /dev/null +++ b/types/powerapps-component-framework/powerapps-component-framework-tests.ts @@ -0,0 +1,87 @@ +interface TInputs { inputString?: string; } +interface TOutputs { testString: string; } + +class TestControl implements ComponentFramework.StandardControl { + init(context: ComponentFramework.Context, notifyOutputChanged?: () => void, state?: ComponentFramework.Dictionary, container?: HTMLDivElement) { + } + updateView(context: ComponentFramework.Context) { + } + destroy() { + } + getOutputs() { + return { + testString: '', + }; + } +} + +const clientTest: ComponentFramework.Client = { + disableScroll: false, + getFormFactor: () => 1, + getClient: () => '', + isOffline: () => false +}; + +const tmpFile: ComponentFramework.FileObject = { fileContent: '', fileName: '', fileSize: 0, mimeType: '' }; +const deviceTest: ComponentFramework.Device = { + captureAudio: () => Promise.resolve(tmpFile), + captureImage: () => Promise.resolve(tmpFile), + captureVideo: () => Promise.resolve(tmpFile), + getBarcodeValue: () => Promise.resolve(''), + getCurrentPosition: () => Promise.resolve({coords: {}, timestamp: new Date(0)}), + pickFile: () => Promise.resolve([tmpFile]) +}; + +const formattingTest: ComponentFramework.Formatting = { + formatCurrency: (value: number) => value.toString(), + formatDecimal: (value: number) => value.toString(), + formatDateAsFilterStringInUTC: (value: Date) => value.toString(), + formatDateLong: (value: Date) => value.toString(), + formatDateLongAbbreviated: (value: Date) => value.toString(), + formatDateShort: (value: Date) => value.toString(), + formatDateYearMonth: (value: Date) => value.toString(), + formatInteger: (value: number) => value.toString(), + formatLanguage: (value: number) => value.toString(), + formatTime: (value: Date, behavior: ComponentFramework.FormattingApi.DateTimeFieldBehavior) => value.toString(), + getWeekOfYear: (value: Date) => 0, +}; + +const modeTest: ComponentFramework.Mode = { + allocatedHeight: -1, + allocatedWidth: -1, + isControlDisabled: false, + isVisible: true, + label: '', + setControlState: (state: ComponentFramework.Dictionary) => false, + setFullScreen: (value: boolean) => null, + trackContainerResize: (value: boolean) => null +}; + +const resourcesTest: ComponentFramework.Resources = { + getResource: (id: string, success: (data: string) => void, failure: () => void) => {}, + getString: (id: string) => '' +}; + +const dictionary: ComponentFramework.Dictionary = { testKey: '' }; + +const imeModeAuto: ComponentFramework.PropertyHelper.ImeMode = ComponentFramework.PropertyHelper.ImeMode.Auto; + +const dataSetApiColumn: ComponentFramework.PropertyHelper.DataSetApi.Column = { + name: '', + displayName: '', + dataType: '', + alias: '', + order: 1, + visualSizeFactor: 1, + isHidden: false, + isPrimary: true, + disableSorting: false +}; + +const linkEntityExposeExpression: ComponentFramework.PropertyHelper.DataSetApi.LinkEntityExposedExpression = { + name: '', + from: '', + to: '', + linkType: '', + alias: '' +}; diff --git a/types/powerapps-component-framework/tsconfig.json b/types/powerapps-component-framework/tsconfig.json new file mode 100644 index 0000000000..57d0f82863 --- /dev/null +++ b/types/powerapps-component-framework/tsconfig.json @@ -0,0 +1,22 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true, + "noEmit": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [] + }, + "files": [ + "index.d.ts", + "powerapps-component-framework-tests.ts" + ] +} diff --git a/types/powerapps-component-framework/tslint.json b/types/powerapps-component-framework/tslint.json new file mode 100644 index 0000000000..b4b47a0378 --- /dev/null +++ b/types/powerapps-component-framework/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/powerbi-visuals-tools/index.d.ts b/types/powerbi-visuals-tools/index.d.ts index 0b7fcf2192..7d137c6605 100644 --- a/types/powerbi-visuals-tools/index.d.ts +++ b/types/powerbi-visuals-tools/index.d.ts @@ -1342,5 +1342,5 @@ declare namespace powerbi.extensibility.visual { host: IVisualHost; } } - -export default powerbi; +// tslint:disable-next-line:export-just-namespace +export = powerbi; diff --git a/types/powerbi-visuals-tools/powerbi-visuals-tools-tests.ts b/types/powerbi-visuals-tools/powerbi-visuals-tools-tests.ts index d6bce0acea..8a40786d34 100644 --- a/types/powerbi-visuals-tools/powerbi-visuals-tools-tests.ts +++ b/types/powerbi-visuals-tools/powerbi-visuals-tools-tests.ts @@ -1,4 +1,4 @@ -import powerbi from './index'; +import powerbi = require('./index'); import IVisualPlugin = powerbi.visuals.plugins.IVisualPlugin; import IVisual = powerbi.extensibility.visual.IVisual; diff --git a/types/preact-i18n/index.d.ts b/types/preact-i18n/index.d.ts new file mode 100644 index 0000000000..a4bbb38c4c --- /dev/null +++ b/types/preact-i18n/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for preact-i18n 1.2 +// Project: https://github.com/synacor/preact-i18n +// Definitions by: Lukas Tetzlaff +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import { h, Component, VNode, ComponentChild, ComponentChildren } from "preact"; + +export class TextComponent extends Component<{ + id: string + fields?: {} + plural?: number +}> { + render(): TextComponent; +} + +export class IntlProvider extends Component<{ + scope?: any + mark?: boolean + definition?: {} +}> { + render(): IntlProvider; +} +export class Text extends TextComponent {} +export class MarkupText extends TextComponent {} +export class Localizer extends Component<{ children: ComponentChildren }> { + render(): Localizer; +} + +// tslint:disable-next-line:no-unnecessary-generics +export function withText(mapping: {}): (Child: ComponentChild) => new (props?: Props, context?: Context) => any; + +export default function intl( + Child: Component, + options?: { scope?: any; definition?: {} } +): VNode; diff --git a/types/preact-i18n/package.json b/types/preact-i18n/package.json new file mode 100644 index 0000000000..b0137e3b05 --- /dev/null +++ b/types/preact-i18n/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "preact": "^8.4.2" + } +} diff --git a/types/preact-i18n/preact-i18n-tests.tsx b/types/preact-i18n/preact-i18n-tests.tsx new file mode 100644 index 0000000000..a374a15286 --- /dev/null +++ b/types/preact-i18n/preact-i18n-tests.tsx @@ -0,0 +1,19 @@ +import { IntlProvider, Text, withText } from "preact-i18n"; +import { h, render, Component } from "preact"; + +interface P { + foo: string; +} + +@withText

({ exampleText2: "someText2" }) +class Example extends Component

{ + render({ }: P) { + return +

+ fallbackText +

+ ; + } +} + +render(, document); diff --git a/types/preact-i18n/tsconfig.json b/types/preact-i18n/tsconfig.json new file mode 100644 index 0000000000..45cea53d00 --- /dev/null +++ b/types/preact-i18n/tsconfig.json @@ -0,0 +1,26 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "jsx": "preserve", + "experimentalDecorators": true, + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "preact-i18n-tests.tsx" + ] +} diff --git a/types/preact-i18n/tslint.json b/types/preact-i18n/tslint.json new file mode 100644 index 0000000000..f93cf8562a --- /dev/null +++ b/types/preact-i18n/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} diff --git a/types/precise/tslint.json b/types/precise/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/precise/tslint.json +++ b/types/precise/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/precond/tslint.json b/types/precond/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/precond/tslint.json +++ b/types/precond/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/preloadjs/tslint.json b/types/preloadjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/preloadjs/tslint.json +++ b/types/preloadjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/prelude-ls/tslint.json b/types/prelude-ls/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/prelude-ls/tslint.json +++ b/types/prelude-ls/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pretty-time/index.d.ts b/types/pretty-time/index.d.ts new file mode 100644 index 0000000000..0dadc88091 --- /dev/null +++ b/types/pretty-time/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for pretty-time 1.1 +// Project: https://github.com/jonschlinkert/pretty-time +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +type Increment = + | 'ns' + | 'nano' + | 'nanosecond' + | 'nanoseconds' + | 'μs' + | 'micro' + | 'microsecond' + | 'microseconds' + | 'ms' + | 'milli' + | 'millisecond' + | 'milliseconds' + | 's' + | 'sec' + | 'second' + | 'seconds' + | 'm' + | 'min' + | 'minute' + | 'minutes' + | 'h' + | 'hr' + | 'hour' + | 'hours' + | 'd' + | 'day' + | 'days' + | 'w' + | 'wk' + | 'week' + | 'weeks'; + +declare function prettyTime(time: number[], smallest?: Increment, digits?: number): string; + +export = prettyTime; diff --git a/types/pretty-time/pretty-time-tests.ts b/types/pretty-time/pretty-time-tests.ts new file mode 100644 index 0000000000..895042ecd1 --- /dev/null +++ b/types/pretty-time/pretty-time-tests.ts @@ -0,0 +1,13 @@ +import DateTime = require("pretty-time"); + +DateTime([1200708, 795428088]); + +DateTime([0, 795428088]); + +DateTime([0, 795428088], 'h'); + +DateTime([0, 795428088], 'm'); + +DateTime([0, 795428088], 'μs', 2); + +DateTime([0, 795428088], 'ms', 1); diff --git a/types/pretty-time/tsconfig.json b/types/pretty-time/tsconfig.json new file mode 100644 index 0000000000..d18e4b1fa1 --- /dev/null +++ b/types/pretty-time/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "pretty-time-tests.ts" + ] +} diff --git a/types/pretty-time/tslint.json b/types/pretty-time/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/pretty-time/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/prettyjson/tslint.json b/types/prettyjson/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/prettyjson/tslint.json +++ b/types/prettyjson/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/priorityqueuejs/tslint.json b/types/priorityqueuejs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/priorityqueuejs/tslint.json +++ b/types/priorityqueuejs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/progress/tslint.json b/types/progress/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/progress/tslint.json +++ b/types/progress/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/progressjs/tslint.json b/types/progressjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/progressjs/tslint.json +++ b/types/progressjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/project-oxford/tslint.json b/types/project-oxford/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/project-oxford/tslint.json +++ b/types/project-oxford/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/promise-pg/tslint.json b/types/promise-pg/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/promise-pg/tslint.json +++ b/types/promise-pg/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/promise-polyfill/index.d.ts b/types/promise-polyfill/index.d.ts index 5708cd05c4..e6f11521dd 100644 --- a/types/promise-polyfill/index.d.ts +++ b/types/promise-polyfill/index.d.ts @@ -4,10 +4,12 @@ // Daniel Cassidy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface PromisePolyfillConstructor extends PromiseConstructor { - _immediateFn?: (handler: (() => void) | string) => void; +declare namespace Promise { + interface PromisePolyfillConstructor extends PromiseConstructor { + _immediateFn?: (handler: (() => void) | string) => void; + } } -declare const Promise: PromisePolyfillConstructor; +declare const Promise: Promise.PromisePolyfillConstructor; -export default Promise; +export = Promise; diff --git a/types/promise-polyfill/promise-polyfill-tests.ts b/types/promise-polyfill/promise-polyfill-tests.ts index cfdd803126..ff21a0714c 100644 --- a/types/promise-polyfill/promise-polyfill-tests.ts +++ b/types/promise-polyfill/promise-polyfill-tests.ts @@ -1,4 +1,4 @@ -import Promise from "promise-polyfill"; +import Promise = require("promise-polyfill"); const prom1 = new Promise((resolve, reject) => { resolve(12); diff --git a/types/promise-pool/tslint.json b/types/promise-pool/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/promise-pool/tslint.json +++ b/types/promise-pool/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/promised-temp/index.d.ts b/types/promised-temp/index.d.ts index e7dc2556b7..8269c12949 100644 --- a/types/promised-temp/index.d.ts +++ b/types/promised-temp/index.d.ts @@ -6,8 +6,9 @@ /// import * as fs from 'fs'; -import { AffixOptions, OpenFile, Stats } from "temp"; -export { AffixOptions, OpenFile, Stats } from "temp"; +import { AffixOptions, AffixOptions as _A, + OpenFile, OpenFile as _O, + Stats, Stats as _S } from "temp"; interface TempStatic { dir: string; @@ -19,6 +20,11 @@ interface TempStatic { cleanup(): Promise; createWriteStream(affixes?: string | AffixOptions): Promise; } +declare namespace PromisedTemp { + type AffixOptions = _A; + type OpenFile = _O; + type Stats = _S; +} declare var PromisedTemp: TempStatic; -export default PromisedTemp; +export = PromisedTemp; diff --git a/types/promised-temp/promised-temp-tests.ts b/types/promised-temp/promised-temp-tests.ts index 24f0b73fa2..9bf7ca6fa0 100644 --- a/types/promised-temp/promised-temp-tests.ts +++ b/types/promised-temp/promised-temp-tests.ts @@ -1,8 +1,8 @@ import * as fs from "fs"; -import temp, { AffixOptions, OpenFile, Stats } from "promised-temp"; +import temp = require("promised-temp"); function testCleanup() { - temp.cleanup().then((result: boolean | Stats) => { + temp.cleanup().then((result: boolean | temp.Stats) => { if (typeof result === "boolean") { const x = result; } else { @@ -13,13 +13,13 @@ function testCleanup() { } function testOpen() { - temp.open({ dir: "tempDir", prefix: "pref", suffix: "suff" }).then((result: OpenFile) => { + temp.open({ dir: "tempDir", prefix: "pref", suffix: "suff" }).then((result: temp.OpenFile) => { const { path, fd } = result; path.length; fd.toPrecision(5); }); - temp.open("strPrefix").then((result: OpenFile) => { + temp.open("strPrefix").then((result: temp.OpenFile) => { const { path, fd } = result; path.length; fd.toPrecision(5); diff --git a/types/promisify-node/tslint.json b/types/promisify-node/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/promisify-node/tslint.json +++ b/types/promisify-node/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/promisify-supertest/tslint.json b/types/promisify-supertest/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/promisify-supertest/tslint.json +++ b/types/promisify-supertest/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/prompt-sync-history/tslint.json b/types/prompt-sync-history/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/prompt-sync-history/tslint.json +++ b/types/prompt-sync-history/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/prompt-sync/tslint.json b/types/prompt-sync/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/prompt-sync/tslint.json +++ b/types/prompt-sync/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/promptly/tslint.json b/types/promptly/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/promptly/tslint.json +++ b/types/promptly/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/prosemirror-test-builder/index.d.ts b/types/prosemirror-test-builder/index.d.ts index f6c01420c4..246f674035 100644 --- a/types/prosemirror-test-builder/index.d.ts +++ b/types/prosemirror-test-builder/index.d.ts @@ -6,23 +6,6 @@ import { Node as ProsemirrorNode, Schema } from 'prosemirror-model'; -export interface NodeTypeAttributes extends Record { - nodeType: string; -} - -export interface MarkTypeAttributes extends Record { - markType: string; -} - -export interface TaggedFlatObject { - tag: Record; - flat: Array | TaggedFlatObject>; -} - -export interface TaggedProsemirrorNode - extends TaggedFlatObject, - ProsemirrorNode {} - type TestNodesUnion = | 'p' | 'pre' @@ -49,78 +32,97 @@ type TestNodesUnion = | 'hard_break'; type TestMarksUnion = 'a' | 'link' | 'em' | 'strong' | 'code'; -export type TestSchema = Schema; - -type Args = Array; +type Args = Array; type NodeBuilderMethod = ( ...args: Args -) => TaggedProsemirrorNode; +) => prosemirrorTestBuilder.TaggedProsemirrorNode; type MarkBuilderMethod = ( ...args: Args -) => TaggedFlatObject; +) => prosemirrorTestBuilder.TaggedFlatObject; -export interface EqMethod { - eq(param: EqMethod): boolean; -} +declare namespace prosemirrorTestBuilder { + interface NodeTypeAttributes extends Record { + nodeType: string; + } -export type Builder = < - Obj extends Record< + interface MarkTypeAttributes extends Record { + markType: string; + } + + interface TaggedFlatObject { + tag: Record; + flat: Array | TaggedFlatObject>; + } + + interface TaggedProsemirrorNode + extends TaggedFlatObject, + ProsemirrorNode {} + + type TestSchema = Schema; + + interface EqMethod { + eq(param: EqMethod): boolean; + } + + type Builder = < + Obj extends Record< string, - NodeTypeAttributes | MarkTypeAttributes - > = Record, + NodeTypeAttributes | MarkTypeAttributes + > = Record, N extends string = string, M extends string = string ->( - testSchema: Schema, - names: Obj, -) => Record>> & - Record>> & - { - [P in keyof Obj]: Obj[P] extends NodeTypeAttributes - ? NodeBuilderMethod> - : MarkBuilderMethod> - }; + >( + testSchema: Schema, + names: Obj, + ) => Record>> & + Record>> & + { + [P in keyof Obj]: Obj[P] extends NodeTypeAttributes + ? NodeBuilderMethod> + : MarkBuilderMethod> + }; -export interface ProsemirrorTestBuilder { - schema: TestSchema; - builders: Builder; - eq(a: EqMethod, b: EqMethod): boolean; - p: NodeBuilderMethod; - pre: NodeBuilderMethod; - h1: NodeBuilderMethod; - h2: NodeBuilderMethod; - h3: NodeBuilderMethod; - li: NodeBuilderMethod; - ul: NodeBuilderMethod; - ol: NodeBuilderMethod; - br: NodeBuilderMethod; - img: NodeBuilderMethod; - hr: NodeBuilderMethod; - a: MarkBuilderMethod; + interface ProsemirrorTestBuilder { + schema: TestSchema; + builders: Builder; + eq(a: EqMethod, b: EqMethod): boolean; + p: NodeBuilderMethod; + pre: NodeBuilderMethod; + h1: NodeBuilderMethod; + h2: NodeBuilderMethod; + h3: NodeBuilderMethod; + li: NodeBuilderMethod; + ul: NodeBuilderMethod; + ol: NodeBuilderMethod; + br: NodeBuilderMethod; + img: NodeBuilderMethod; + hr: NodeBuilderMethod; + a: MarkBuilderMethod; - // From schema list - ordered_list: NodeBuilderMethod; - bullet_list: NodeBuilderMethod; - list_item: NodeBuilderMethod; - doc: NodeBuilderMethod; + // From schema list + ordered_list: NodeBuilderMethod; + bullet_list: NodeBuilderMethod; + list_item: NodeBuilderMethod; + doc: NodeBuilderMethod; - // From schema basic - paragraph: NodeBuilderMethod; - blockquote: NodeBuilderMethod; - horizontal_rule: NodeBuilderMethod; - heading: NodeBuilderMethod; - code_block: NodeBuilderMethod; - text: NodeBuilderMethod; - image: NodeBuilderMethod; - hard_break: NodeBuilderMethod; - link: MarkBuilderMethod; - em: MarkBuilderMethod; - strong: MarkBuilderMethod; - code: MarkBuilderMethod; + // From schema basic + paragraph: NodeBuilderMethod; + blockquote: NodeBuilderMethod; + horizontal_rule: NodeBuilderMethod; + heading: NodeBuilderMethod; + code_block: NodeBuilderMethod; + text: NodeBuilderMethod; + image: NodeBuilderMethod; + hard_break: NodeBuilderMethod; + link: MarkBuilderMethod; + em: MarkBuilderMethod; + strong: MarkBuilderMethod; + code: MarkBuilderMethod; + } } -declare const prosemirrorTestBuilder: ProsemirrorTestBuilder; +declare const prosemirrorTestBuilder: prosemirrorTestBuilder.ProsemirrorTestBuilder; -export default prosemirrorTestBuilder; +export = prosemirrorTestBuilder; diff --git a/types/prosemirror-test-builder/prosemirror-test-builder-tests.ts b/types/prosemirror-test-builder/prosemirror-test-builder-tests.ts index dd5aa0c345..8257e51748 100644 --- a/types/prosemirror-test-builder/prosemirror-test-builder-tests.ts +++ b/types/prosemirror-test-builder/prosemirror-test-builder-tests.ts @@ -6,7 +6,7 @@ import { TextSelection, Transaction, } from 'prosemirror-state'; -import pm, { TaggedProsemirrorNode } from 'prosemirror-test-builder'; +import pm = require('prosemirror-test-builder'); export type DispatchFunction = (tr: Transaction) => void; export type CommandFunction = ( @@ -14,7 +14,7 @@ export type CommandFunction = ( dispatch?: DispatchFunction, ) => boolean; -function selectionFor(docNode: TaggedProsemirrorNode) { +function selectionFor(docNode: pm.TaggedProsemirrorNode) { const aTag = docNode.tag.a; if (aTag != null) { const $aTag = docNode.resolve(aTag); @@ -32,20 +32,20 @@ function selectionFor(docNode: TaggedProsemirrorNode) { return Selection.atStart(docNode); } -function createState(d: TaggedProsemirrorNode) { +function createState(d: pm.TaggedProsemirrorNode) { return EditorState.create({ doc: d, selection: selectionFor(d) }); } export function apply( - docNode: TaggedProsemirrorNode, + docNode: pm.TaggedProsemirrorNode, command: CommandFunction, - result?: TaggedProsemirrorNode, -): [boolean, TaggedProsemirrorNode] { + result?: pm.TaggedProsemirrorNode, +): [boolean, pm.TaggedProsemirrorNode] { let state = createState(docNode); command(state, tr => (state = state.apply(tr))); if (!pm.eq(state.doc, result || docNode)) { - return [false, state.doc as TaggedProsemirrorNode]; + return [false, state.doc as pm.TaggedProsemirrorNode]; } if (result && result.tag.a != null) { @@ -54,7 +54,7 @@ export function apply( result || docNode, ]; } - return [true, state.doc as TaggedProsemirrorNode]; + return [true, state.doc as pm.TaggedProsemirrorNode]; } const { p, doc, builders } = pm; diff --git a/types/protoc-plugin/index.d.ts b/types/protoc-plugin/index.d.ts new file mode 100644 index 0000000000..c9d420c9e8 --- /dev/null +++ b/types/protoc-plugin/index.d.ts @@ -0,0 +1,27 @@ +// Type definitions for protoc-plugin 0.0 +// Project: https://github.com/konsumer/node-protoc-plugin/ +// Definitions by: Jonny Reeves +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/// + +import * as stream from "stream"; +import { + CodeGeneratorRequest as pb_CodeGeneratorRequest, + CodeGeneratorResponse as pb_CodeGeneratorResponse +} from "google-protobuf/google/protobuf/compiler/plugin_pb"; +import { FileDescriptorProto, SourceCodeInfo } from "google-protobuf/google/protobuf/descriptor_pb"; +import Location = SourceCodeInfo.Location; + +type OutputFiles = pb_CodeGeneratorResponse.File.AsObject[]; +type SimplePluginCallback = (filesToGenerate: ReadonlyArray) => (OutputFiles | Promise); + +declare function simplePlugin(cb: SimplePluginCallback): Promise; +declare namespace simplePlugin { + function CodeGeneratorRequest(stdin?: stream.Readable): Promise; + function CodeGeneratorResponse(stdout?: stream.Writable): (files: OutputFiles) => void; + function CodeGeneratorResponseError(stdout?: stream.Writable): (err: Error) => void; + function findCommentByPath(path: number[], locationList: Location.AsObject[]): string; +} + +export = simplePlugin; diff --git a/types/protoc-plugin/protoc-plugin-tests.ts b/types/protoc-plugin/protoc-plugin-tests.ts new file mode 100644 index 0000000000..856a2c9dbd --- /dev/null +++ b/types/protoc-plugin/protoc-plugin-tests.ts @@ -0,0 +1,26 @@ +import protocPlugin = require('protoc-plugin'); +import { + CodeGeneratorResponse as pb_CodeGeneratorResponse +} from "google-protobuf/google/protobuf/compiler/plugin_pb"; +import FileObject = pb_CodeGeneratorResponse.File.AsObject; + +const { + CodeGeneratorRequest, + CodeGeneratorResponse, + CodeGeneratorResponseError +} = protocPlugin; + +protocPlugin(filesToGenerate => { + const files: FileObject[] = []; + files.push({ name: "my_file.ts.d", content: "example" }); + return files; +}); + +CodeGeneratorRequest() + .then(req => { + const files: FileObject[] = []; + files.push({ name: "my_file.ts.d", content: "example" }); + return files; + }) + .then(CodeGeneratorResponse()) + .catch(CodeGeneratorResponseError()); diff --git a/types/protoc-plugin/tsconfig.json b/types/protoc-plugin/tsconfig.json new file mode 100644 index 0000000000..741baad643 --- /dev/null +++ b/types/protoc-plugin/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", + "protoc-plugin-tests.ts" + ] +} \ No newline at end of file diff --git a/types/ora/v0/tslint.json b/types/protoc-plugin/tslint.json similarity index 100% rename from types/ora/v0/tslint.json rename to types/protoc-plugin/tslint.json diff --git a/types/protocol-buffers-schema/index.d.ts b/types/protocol-buffers-schema/index.d.ts new file mode 100644 index 0000000000..2d80831cf1 --- /dev/null +++ b/types/protocol-buffers-schema/index.d.ts @@ -0,0 +1,17 @@ +// Type definitions for protocol-buffers-schema 3.3 +// Project: https://github.com/mafintosh/protocol-buffers-schema +// Definitions by: Claas Ahlrichs +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +/// + +import { Schema } from "./types"; +declare namespace parse { + function parse(buffer: string | Buffer): Schema; + function stringify(schema: Schema): string; +} + +declare function parse(buffer: string | Buffer): Schema; + +export = parse; diff --git a/types/protocol-buffers-schema/parse.d.ts b/types/protocol-buffers-schema/parse.d.ts new file mode 100644 index 0000000000..3bf80fa1cf --- /dev/null +++ b/types/protocol-buffers-schema/parse.d.ts @@ -0,0 +1,9 @@ +import { Schema } from "./types"; +declare namespace parse { + function parse(buffer: string | Buffer): Schema; + function stringify(schema: Schema): string; +} + +declare function parse(buffer: string | Buffer): Schema; + +export = parse; diff --git a/types/protocol-buffers-schema/protocol-buffers-schema-tests.ts b/types/protocol-buffers-schema/protocol-buffers-schema-tests.ts new file mode 100644 index 0000000000..7b68e9bab0 --- /dev/null +++ b/types/protocol-buffers-schema/protocol-buffers-schema-tests.ts @@ -0,0 +1,21 @@ +import schema from "protocol-buffers-schema"; + +const proto = `syntax = "proto2"; + +message Point { + required int32 x = 1; + required int32 y=2; + optional string label = 3; +} + +message Line { + required Point start = 1; + required Point end = 2; + optional string label = 3; +}`; + +// pass a buffer or string to schema.parse +const sch = schema.parse(proto); + +// will print out the schema as a javascript object +console.log(sch); diff --git a/types/protocol-buffers-schema/stringify.d.ts b/types/protocol-buffers-schema/stringify.d.ts new file mode 100644 index 0000000000..708a4ff394 --- /dev/null +++ b/types/protocol-buffers-schema/stringify.d.ts @@ -0,0 +1,5 @@ +import { Schema } from "./types"; + +declare function stringify(schema: Schema): string; + +export = stringify; diff --git a/types/protocol-buffers-schema/tokenize.d.ts b/types/protocol-buffers-schema/tokenize.d.ts new file mode 100644 index 0000000000..dfe51a143c --- /dev/null +++ b/types/protocol-buffers-schema/tokenize.d.ts @@ -0,0 +1,5 @@ +import { Schema } from "./types"; + +declare function tokenize(schema: Schema): string[]; + +export = tokenize; diff --git a/types/protocol-buffers-schema/tsconfig.json b/types/protocol-buffers-schema/tsconfig.json new file mode 100644 index 0000000000..76e4087db4 --- /dev/null +++ b/types/protocol-buffers-schema/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "esModuleInterop": true + }, + "files": [ + "index.d.ts", + "parse.d.ts", + "stringify.d.ts", + "tokenize.d.ts", + "protocol-buffers-schema-tests.ts" + ] +} diff --git a/types/ora/v1/tslint.json b/types/protocol-buffers-schema/tslint.json similarity index 100% rename from types/ora/v1/tslint.json rename to types/protocol-buffers-schema/tslint.json diff --git a/types/protocol-buffers-schema/types.d.ts b/types/protocol-buffers-schema/types.d.ts new file mode 100644 index 0000000000..12a0a3bdf5 --- /dev/null +++ b/types/protocol-buffers-schema/types.d.ts @@ -0,0 +1,81 @@ +export interface Option { + [key: string]: string | boolean; +} + +export interface Options { + [key: string]: string | boolean | Option | Option[]; +} + +export interface Enum { + name: string; + values: { + [key: string]: { + value: number; + options: Options; + }; + }; + options: Options; +} + +export interface FieldOptions { + [key: string]: string; +} + +export interface Field { + name: string; + type: string; + tag: number; + map: { + from: string; + to: string; + }; + oneof: null | string; + required: boolean; + repeated: boolean; + options: FieldOptions; +} + +export interface Message { + name: string; + enums: Enum[]; + extends: Extend[]; + extensions: Extension[]; + messages: Message[]; + fields: Field[]; +} + +export interface Extend { + name: string; + message: Message; +} + +export interface Extension { + from: number; + to: number; +} + +export interface Service { + name: string; + methods: Method[]; + options: Options; +} + +export interface Method { + name: string; + input_type: string; + output_type: string; + client_streaming: boolean; + server_streaming: boolean; + options: Options; +} + +export interface Schema { + syntax: number; + package: null | string; + imports: string[]; + enums: Enum[]; + messages: Message[]; + options: Options; + extends: Extend[]; + service?: Service[]; +} diff --git a/types/protractor-browser-logs/index.d.ts b/types/protractor-browser-logs/index.d.ts index a75b3eb0ec..354579df4e 100644 --- a/types/protractor-browser-logs/index.d.ts +++ b/types/protractor-browser-logs/index.d.ts @@ -8,26 +8,29 @@ import * as webdriver from 'selenium-webdriver'; import Entry = webdriver.logging.Entry; import { ProtractorBrowser } from 'protractor/built'; -export interface BrowserLogOptions { - reporters?: Array<(entries: Entry[]) => void>; +declare namespace browserLogs { + interface BrowserLogOptions { + reporters?: Array<(entries: Entry[]) => void>; + } + + type matchPredicateFunction = (entry: Entry) => boolean; + type matchPredicate = string | RegExp | matchPredicateFunction; + interface BrowserLogs { + ERROR: matchPredicateFunction; + WARNING: matchPredicateFunction; + DEBUG: matchPredicateFunction; + INFO: matchPredicateFunction; + LOG: matchPredicateFunction; + + or(a: matchPredicateFunction, b: matchPredicateFunction): matchPredicateFunction; + and(a: matchPredicateFunction, b: matchPredicateFunction): matchPredicateFunction; + reset(): void; + logs(): Entry[]; + verify(): void; + ignore(... matches: matchPredicate[]): matchPredicateFunction[]; + expect(... matches: matchPredicate[]): matchPredicateFunction[]; + } } -export type matchPredicateFunction = (entry: Entry) => boolean; -export type matchPredicate = string | RegExp | matchPredicateFunction; -export interface BrowserLogs { - ERROR: matchPredicateFunction; - WARNING: matchPredicateFunction; - DEBUG: matchPredicateFunction; - INFO: matchPredicateFunction; - LOG: matchPredicateFunction; - - or(a: matchPredicateFunction, b: matchPredicateFunction): matchPredicateFunction; - and(a: matchPredicateFunction, b: matchPredicateFunction): matchPredicateFunction; - reset(): void; - logs(): Entry[]; - verify(): void; - ignore(... matches: matchPredicate[]): matchPredicateFunction[]; - expect(... matches: matchPredicate[]): matchPredicateFunction[]; -} - -export default function browserLogs(browser: ProtractorBrowser, options?: BrowserLogOptions): BrowserLogs; +export = browserLogs; +declare function browserLogs(browser: ProtractorBrowser, options?: browserLogs.BrowserLogOptions): browserLogs.BrowserLogs; diff --git a/types/protractor-browser-logs/protractor-browser-logs-tests.ts b/types/protractor-browser-logs/protractor-browser-logs-tests.ts index 82da49b580..12a255a5a4 100644 --- a/types/protractor-browser-logs/protractor-browser-logs-tests.ts +++ b/types/protractor-browser-logs/protractor-browser-logs-tests.ts @@ -1,5 +1,5 @@ import { browser } from 'protractor/built'; -import browserLogs from 'protractor-browser-logs'; +import browserLogs = require('protractor-browser-logs'); import * as webdriver from 'selenium-webdriver'; import Entry = webdriver.logging.Entry; diff --git a/types/protractor-helpers/tslint.json b/types/protractor-helpers/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/protractor-helpers/tslint.json +++ b/types/protractor-helpers/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/protractor-http-mock/tslint.json b/types/protractor-http-mock/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/protractor-http-mock/tslint.json +++ b/types/protractor-http-mock/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/provinces/index.d.ts b/types/provinces/index.d.ts index 2601d14da4..17d59ee03d 100644 --- a/types/provinces/index.d.ts +++ b/types/provinces/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for provinces 1.11 // Project: https://github.com/substack/provinces -// Definitions by: My Self +// Definitions by: William Lohan // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare global { diff --git a/types/proxyquire/tslint.json b/types/proxyquire/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/proxyquire/tslint.json +++ b/types/proxyquire/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ps-list/index.d.ts b/types/ps-list/index.d.ts deleted file mode 100644 index 2ace498667..0000000000 --- a/types/ps-list/index.d.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Type definitions for ps-list 6.0 -// Project: https://github.com/sindresorhus/ps-list#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.1 - -export = psList; - -declare function psList(options?: psList.Options): Promise; - -declare namespace psList { - interface Options { - all?: boolean; - } - - interface ProcessDescriptor { - pid: number; - name: string; - ppid: number; - cmd?: string; - cpu?: number; - memory?: number; - } -} diff --git a/types/ps-list/ps-list-tests.ts b/types/ps-list/ps-list-tests.ts deleted file mode 100644 index 17ecffe4ff..0000000000 --- a/types/ps-list/ps-list-tests.ts +++ /dev/null @@ -1,13 +0,0 @@ -import psList = require('ps-list'); - -(async () => { - const processes: psList.ProcessDescriptor[] = await psList(); - psList({ all: false }); - - processes[0].pid; // $ExpectType number - processes[0].name; // $ExpectType string - processes[0].ppid; // $ExpectType number - processes[0].cmd; // $ExpectType string | undefined - processes[0].cpu; // $ExpectType number | undefined - processes[0].memory; // $ExpectType number | undefined -})(); diff --git a/types/ps-list/tslint.json b/types/ps-list/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/ps-list/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/pty.js/tslint.json b/types/pty.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pty.js/tslint.json +++ b/types/pty.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pubsub-js/tslint.json b/types/pubsub-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pubsub-js/tslint.json +++ b/types/pubsub-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pug/tslint.json b/types/pug/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pug/tslint.json +++ b/types/pug/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/puppeteer/index.d.ts b/types/puppeteer/index.d.ts index 1b9428392a..6d18282804 100644 --- a/types/puppeteer/index.d.ts +++ b/types/puppeteer/index.d.ts @@ -4,6 +4,7 @@ // Christopher Deutsch // Konstantin Simon Maria Möllers // Simon Schick +// Serban Ghita // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -31,6 +32,8 @@ export interface JSONObject { } export type SerializableOrJSHandle = Serializable | JSHandle; +export type Platform = "mac" | "win32" | "win64" | "linux"; + /** Defines `$eval` and `$$eval` for Page, Frame and ElementHandle. */ export interface Evalable { /** @@ -1071,6 +1074,19 @@ export interface RemoteInfo { port: number; } +export interface SecurityDetails { + /** A string with the name of issuer of the certificate. (e.g. "Let's Encrypt Authority X3"). */ + issuer(): string; + /** String with the security protocol (e.g. TLS 1.2). */ + protocol(): string; + /** Name of the subject to which the certificate was issued to (e.g. "www.example.com"). */ + subjectName(): string; + /** Timestamp stating the start of validity of the certificate. */ + validFrom(): number; + /** Timestamp stating the end of validity of the certificate. */ + validTo(): number; +} + /** Response class represents responses which are received by page. */ export interface Response { /** Promise which resolves to a buffer with response body. */ @@ -1092,6 +1108,8 @@ export interface Response { ok(): boolean; /** Returns remote connection info */ remoteAddress(): RemoteInfo; + /** Returns an object with security details associated with the response. */ + securityDetails(): SecurityDetails | null; /** A matching Request object. */ request(): Request; /** Contains the status code of the response (e.g., 200 for a success). */ @@ -2187,6 +2205,40 @@ export interface CoverageEntry { ranges: Array<{start: number, end: number}>; } +/** BrowserFetcher can download and manage different versions of Chromium. */ +export interface BrowserFetcher { + /** The method initiates a HEAD request to check if the revision is available. */ + canDownload(revision: string): Promise; + /** The method initiates a GET request to download the revision from the host. */ + download(revision: string, progressCallback?: (downloadBytes: number, totalBytes: number) => void): Promise; + localRevisions(): Promise; + platform(): Platform; + remove(revision: string): Promise; + revisionInfo(revision: string): RevisionInfo; +} + +export interface RevisionInfo { + /** The revision the info was created from */ + revision: string; + /** Path to the extracted revision folder */ + folderPath: string; + /** Path to the revision executable */ + executablePath: string; + /** URL this revision can be downloaded from */ + url: string; + /** whether the revision is locally available on disk */ + local: boolean; +} + +export interface FetcherOptions { + /** A download host to be used. Defaults to `https://storage.googleapis.com`. */ + host?: string; + /** A path for the downloads folder. Defaults to `/.local-chromium`, where `` is puppeteer's package root. */ + path?: string; + /** Possible values are: `mac`, `win32`, `win64`, `linux`. Defaults to the current platform. */ + platform?: Platform; +} + /** Attaches Puppeteer to an existing Chromium instance */ export function connect(options?: ConnectOptions): Promise; /** The default flags that Chromium will be launched with */ @@ -2195,3 +2247,5 @@ export function defaultArgs(options?: ChromeArgOptions): string[]; export function executablePath(): string; /** The method launches a browser instance with given arguments. The browser will be closed when the parent node.js process is closed. */ export function launch(options?: LaunchOptions): Promise; +/** This methods attaches Puppeteer to an existing Chromium instance. */ +export function createBrowserFetcher(options?: FetcherOptions): BrowserFetcher; diff --git a/types/puppeteer/puppeteer-tests.ts b/types/puppeteer/puppeteer-tests.ts index e5c287b6ee..90006c77d4 100644 --- a/types/puppeteer/puppeteer-tests.ts +++ b/types/puppeteer/puppeteer-tests.ts @@ -618,3 +618,28 @@ puppeteer.launch().then(async browser => { ); console.log('there are', numMatchingEls, 'banana paragaphs'); }); + +(async () => { + const rev = '630727'; + const defaultFetcher = puppeteer.createBrowserFetcher(); + const options: puppeteer.FetcherOptions = { + host: 'https://storage.googleapis.com', + path: '/tmp/.local-chromium', + platform: 'linux', + }; + const browserFetcher = puppeteer.createBrowserFetcher(options); + const canDownload = await browserFetcher.canDownload(rev); + if (canDownload) { + const revisionInfo = await browserFetcher.download(rev); + const localRevisions = await browserFetcher.localRevisions(); + const browser = await puppeteer.launch({executablePath: revisionInfo.executablePath}); + browser.close(); + if (localRevisions.includes(rev)) { + await browserFetcher.remove(rev); + } + await browserFetcher.download(rev, (download, total) => { + console.log('downloadBytes:', download, 'totalBytes:', total); + }); + await browserFetcher.remove(rev); + } +}); diff --git a/types/pure-render-decorator/tslint.json b/types/pure-render-decorator/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pure-render-decorator/tslint.json +++ b/types/pure-render-decorator/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/purl/tslint.json b/types/purl/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/purl/tslint.json +++ b/types/purl/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/pvutils/tslint.json b/types/pvutils/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/pvutils/tslint.json +++ b/types/pvutils/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/q-io/tslint.json b/types/q-io/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/q-io/tslint.json +++ b/types/q-io/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/q-retry/tslint.json b/types/q-retry/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/q-retry/tslint.json +++ b/types/q-retry/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/q/index.d.ts b/types/q/index.d.ts index 7926965cf8..5dc94f67d2 100644 --- a/types/q/index.d.ts +++ b/types/q/index.d.ts @@ -331,7 +331,7 @@ declare namespace Q { /** * Alias for fcall() */ - export {fcall as try}; + export { fcall as try }; /** * Returns a promise for the result of calling the named method of an object with the given variadic arguments. diff --git a/types/qrcode/index.d.ts b/types/qrcode/index.d.ts index 54d53e7b1c..817943693d 100644 --- a/types/qrcode/index.d.ts +++ b/types/qrcode/index.d.ts @@ -102,7 +102,7 @@ export interface QRCodeRenderersOptions extends QRCodeOptions { export interface QRCodeSegment { data: string; - mode: 'alphanumeric' | 'numeric'; + mode: 'alphanumeric' | 'numeric' | 'kanji' | 'byte'; } export interface QRCode { diff --git a/types/qrcode/qrcode-tests.ts b/types/qrcode/qrcode-tests.ts index 363367cc28..01dc9ca194 100644 --- a/types/qrcode/qrcode-tests.ts +++ b/types/qrcode/qrcode-tests.ts @@ -21,7 +21,9 @@ QRCode.toDataURL('some text', { version: 2 }, (err, url) => { QRCode.toDataURL([ { data: 'ABCDEFG', mode: 'alphanumeric' }, - { data: '0123456', mode: 'numeric' } + { data: '0123456', mode: 'numeric' }, + { data: '\x87\x90', mode: 'kanji' }, + { data: 'abc\ndef?', mode: 'byte' } ], (err, url) => { console.log(url); }); diff --git a/types/qs/tslint.json b/types/qs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/qs/tslint.json +++ b/types/qs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/qtip2/tslint.json b/types/qtip2/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/qtip2/tslint.json +++ b/types/qtip2/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/query-string/index.d.ts b/types/query-string/index.d.ts deleted file mode 100644 index 3eaf34c159..0000000000 --- a/types/query-string/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -// Type definitions for query-string 6.2 -// Project: https://github.com/sindresorhus/query-string -// Definitions by: Sam Verschueren -// Tanguy Krotoff -// HuHuanming -// Madara Uchiha -// Josh Holmer -// Simon Van den Broeck -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.2 - -export interface ParseOptions { - arrayFormat?: 'bracket' | 'index' | 'none'; - decode?: boolean; -} - -export interface InputParams { - [key: string]: any; -} - -export interface OutputParams { - [key: string]: string | string[] | undefined; -} - -/** - * Parse a query string into an object. - * Leading ? or # are ignored, so you can pass location.search or location.hash directly. - */ -export function parse(str: string, options?: ParseOptions): OutputParams; - -export function parseUrl(str: string, options?: ParseOptions): {url: string, query: OutputParams}; - -export interface StringifyOptions { - strict?: boolean; - encode?: boolean; - arrayFormat?: 'bracket' | 'index' | 'none'; - sort?: ((m: string, n: string) => boolean) | boolean; -} - -/** - * Stringify an object into a query string, sorting the keys. - */ -export function stringify(obj: InputParams, options?: StringifyOptions): string; - -/** - * Extract a query string from a URL that can be passed into .parse(). - */ -export function extract(str: string): string; diff --git a/types/query-string/query-string-tests.ts b/types/query-string/query-string-tests.ts deleted file mode 100644 index 33152ce445..0000000000 --- a/types/query-string/query-string-tests.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as queryString from 'query-string'; - -// stringify -{ - let result: string; - // test obj - result = queryString.stringify({ - str: 'bar', - strArray: ['baz'], - num: 123, - numArray: [456], - bool: true, - boolArray: [false] - }); - - // test options - result = queryString.stringify({ foo: 'bar' }, { strict: false }); - result = queryString.stringify({ foo: 'bar' }, { encode: false }); - result = queryString.stringify({ foo: 'bar' }, { strict: false, encode: false }); -} - -// For each section below, the second line ensures the real answer is of the declared -// type. You can find the real answer by running the first line of each section. - -// parse -{ - let fooBar = queryString.parse('?foo=bar'); - fooBar = {foo: "bar"}; - - let fooBarBaz1 = queryString.parse('&foo=bar&foo=baz'); - fooBarBaz1 = { foo: [ 'bar', 'baz' ] }; - - let fooBarBaz2 = queryString.parse('&foo[]=bar&foo[]=baz', {arrayFormat: 'bracket'}); - fooBarBaz2 = { foo: [ 'bar', 'baz' ] }; -} - -// extract -{ - let result1 = queryString.extract('http://foo.bar/?abc=def&hij=klm'); - result1 = 'abc=def&hij=klm'; - - let result2 = queryString.extract('http://foo.bar/?foo=bar'); - result2 = 'foo=bar'; -} diff --git a/types/query-string/tsconfig.json b/types/query-string/tsconfig.json deleted file mode 100644 index 83d5a52072..0000000000 --- a/types/query-string/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "query-string-tests.ts" - ] -} \ No newline at end of file diff --git a/types/query-string/tslint.json b/types/query-string/tslint.json deleted file mode 100644 index e765bc9e16..0000000000 --- a/types/query-string/tslint.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "no-single-declare-module": false - } -} diff --git a/types/quick-lru/index.d.ts b/types/quick-lru/index.d.ts deleted file mode 100644 index 65e15c60a4..0000000000 --- a/types/quick-lru/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Type definitions for quick-lru 2.0 -// Project: https://github.com/sindresorhus/quick-lru#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = QuickLRU; - -declare class QuickLRU implements Iterable<[K, V]> { - readonly size: number; - constructor(options: QuickLRU.Options); - [Symbol.iterator](): Iterator<[K, V]>; - set(key: K, value: V): this; - get(key: K): V | undefined; - has(key: K): boolean; - peek(key: K): V | undefined; - delete(key: K): boolean; - clear(): void; - keys(): Iterable; - values(): Iterable; -} - -declare namespace QuickLRU { - interface Options { - maxSize: number; - } -} diff --git a/types/quick-lru/quick-lru-tests.ts b/types/quick-lru/quick-lru-tests.ts deleted file mode 100644 index 5a3c5fb8f8..0000000000 --- a/types/quick-lru/quick-lru-tests.ts +++ /dev/null @@ -1,25 +0,0 @@ -import QuickLRU = require('quick-lru'); - -const lru = new QuickLRU({ maxSize: 1000 }); -new QuickLRU(); // $ExpectError - -lru.set('🦄', 1).set('🌈', 2); // $ExpectType QuickLRU -lru.get('🦄'); // $ExpectType number | undefined -lru.has('🦄'); // $ExpectType boolean -lru.peek('🦄'); // $ExpectType number | undefined -lru.delete('🦄'); // $ExpectType boolean -lru.clear(); // $ExpectType void -lru.size; // $ExpectType number - -for (const [key, value] of lru) { - key; // $ExpectType string - value; // $ExpectType number -} - -for (const key of lru.keys()) { - key; // $ExpectType string -} - -for (const value of lru.values()) { - value; // $ExpectType number -} diff --git a/types/quick-lru/tsconfig.json b/types/quick-lru/tsconfig.json deleted file mode 100644 index 788f560163..0000000000 --- a/types/quick-lru/tsconfig.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es2015", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "quick-lru-tests.ts" - ] -} diff --git a/types/quick-lru/tslint.json b/types/quick-lru/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/quick-lru/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/quick-lru/v1/index.d.ts b/types/quick-lru/v1/index.d.ts deleted file mode 100644 index 7ce12e397c..0000000000 --- a/types/quick-lru/v1/index.d.ts +++ /dev/null @@ -1,26 +0,0 @@ -// Type definitions for quick-lru 1.1 -// Project: https://github.com/sindresorhus/quick-lru#readme -// Definitions by: BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -export = QuickLRU; - -declare class QuickLRU implements Iterable<[K, V]> { - readonly size: number; - constructor(options?: QuickLRU.Options); - [Symbol.iterator](): Iterator<[K, V]>; - set(key: K, value: V): this; - get(key: K): V | undefined; - has(key: K): boolean; - peek(key: K): V | undefined; - delete(key: K): void; - clear(): void; - keys(): Iterable; - values(): Iterable; -} - -declare namespace QuickLRU { - interface Options { - maxSize: number; - } -} diff --git a/types/quick-lru/v1/quick-lru-tests.ts b/types/quick-lru/v1/quick-lru-tests.ts deleted file mode 100644 index 140e25bcd8..0000000000 --- a/types/quick-lru/v1/quick-lru-tests.ts +++ /dev/null @@ -1,29 +0,0 @@ -import QuickLRU = require('quick-lru'); - -let num: number; -let numu: number | undefined; -let str: string; -let bool: boolean; - -const lru = new QuickLRU({maxSize: 1000}); - -lru.set('🦄', 1).set('🌈', 2); -numu = lru.get('🦄'); -bool = lru.has('🦄'); -numu = lru.peek('🦄'); -lru.delete('🦄'); -lru.clear(); -num = lru.size; - -for (const [key, value] of lru) { - str = key; - num = value; -} - -for (const key of lru.keys()) { - str = key; -} - -for (const value of lru.values()) { - num = value; -} diff --git a/types/quick-lru/v1/tsconfig.json b/types/quick-lru/v1/tsconfig.json deleted file mode 100644 index ae4a2956c7..0000000000 --- a/types/quick-lru/v1/tsconfig.json +++ /dev/null @@ -1,29 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "target": "es2015", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../../", - "typeRoots": [ - "../../" - ], - "paths": { - "quick-lru": [ - "quick-lru/v1" - ] - }, - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "quick-lru-tests.ts" - ] -} diff --git a/types/quick-lru/v1/tslint.json b/types/quick-lru/v1/tslint.json deleted file mode 100644 index 3db14f85ea..0000000000 --- a/types/quick-lru/v1/tslint.json +++ /dev/null @@ -1 +0,0 @@ -{ "extends": "dtslint/dt.json" } diff --git a/types/quixote/tslint.json b/types/quixote/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/quixote/tslint.json +++ b/types/quixote/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/qunit/tslint.json b/types/qunit/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/qunit/tslint.json +++ b/types/qunit/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/quoted-printable/tslint.json b/types/quoted-printable/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/quoted-printable/tslint.json +++ b/types/quoted-printable/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/qwest/tslint.json b/types/qwest/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/qwest/tslint.json +++ b/types/qwest/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rabbit.js/tslint.json b/types/rabbit.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rabbit.js/tslint.json +++ b/types/rabbit.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ractive/tslint.json b/types/ractive/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ractive/tslint.json +++ b/types/ractive/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/radium/tslint.json b/types/radium/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/radium/tslint.json +++ b/types/radium/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/radius/tslint.json b/types/radius/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/radius/tslint.json +++ b/types/radius/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ramda/es/composeWith.d.ts b/types/ramda/es/composeWith.d.ts new file mode 100644 index 0000000000..fbde7d67ad --- /dev/null +++ b/types/ramda/es/composeWith.d.ts @@ -0,0 +1,2 @@ +import { composeWith } from '../index'; +export default composeWith; diff --git a/types/ramda/es/dropRepeats.d.ts b/types/ramda/es/dropRepeats.d.ts new file mode 100644 index 0000000000..dc88dea52e --- /dev/null +++ b/types/ramda/es/dropRepeats.d.ts @@ -0,0 +1,2 @@ +import { dropRepeats } from '../index'; +export default dropRepeats; diff --git a/types/ramda/es/dropRepeatsWith.d.ts b/types/ramda/es/dropRepeatsWith.d.ts new file mode 100644 index 0000000000..c6fb6c4883 --- /dev/null +++ b/types/ramda/es/dropRepeatsWith.d.ts @@ -0,0 +1,2 @@ +import { dropRepeatsWith } from '../index'; +export default dropRepeatsWith; diff --git a/types/ramda/es/hasPath.d.ts b/types/ramda/es/hasPath.d.ts new file mode 100644 index 0000000000..0654145350 --- /dev/null +++ b/types/ramda/es/hasPath.d.ts @@ -0,0 +1,2 @@ +import { hasPath } from '../index'; +export default hasPath; diff --git a/types/ramda/es/memoize.d.ts b/types/ramda/es/memoize.d.ts deleted file mode 100644 index a32d4d0016..0000000000 --- a/types/ramda/es/memoize.d.ts +++ /dev/null @@ -1,2 +0,0 @@ -import { memoize } from '../index'; -export default memoize; diff --git a/types/ramda/es/mergeLeft.d.ts b/types/ramda/es/mergeLeft.d.ts new file mode 100644 index 0000000000..8af61d3d19 --- /dev/null +++ b/types/ramda/es/mergeLeft.d.ts @@ -0,0 +1,2 @@ +import { mergeLeft } from '../index'; +export default mergeLeft; diff --git a/types/ramda/es/mergeRight.d.ts b/types/ramda/es/mergeRight.d.ts new file mode 100644 index 0000000000..884165f20f --- /dev/null +++ b/types/ramda/es/mergeRight.d.ts @@ -0,0 +1,2 @@ +import { mergeRight } from '../index'; +export default mergeRight; diff --git a/types/ramda/es/otherwise.d.ts b/types/ramda/es/otherwise.d.ts new file mode 100644 index 0000000000..bbe0539f15 --- /dev/null +++ b/types/ramda/es/otherwise.d.ts @@ -0,0 +1,2 @@ +import { otherwise } from '../index'; +export default otherwise; diff --git a/types/ramda/es/pipeWith.d.ts b/types/ramda/es/pipeWith.d.ts new file mode 100644 index 0000000000..84715cc5b4 --- /dev/null +++ b/types/ramda/es/pipeWith.d.ts @@ -0,0 +1,2 @@ +import { pipeWith } from '../index'; +export default pipeWith; diff --git a/types/ramda/es/then.d.ts b/types/ramda/es/then.d.ts new file mode 100644 index 0000000000..24f6f87504 --- /dev/null +++ b/types/ramda/es/then.d.ts @@ -0,0 +1,2 @@ +import { then } from '../index'; +export default then; diff --git a/types/ramda/es/thunkify.d.ts b/types/ramda/es/thunkify.d.ts new file mode 100644 index 0000000000..9c2fba33de --- /dev/null +++ b/types/ramda/es/thunkify.d.ts @@ -0,0 +1,2 @@ +import { thunkify } from '../index'; +export default thunkify; diff --git a/types/ramda/index.d.ts b/types/ramda/index.d.ts index e1b1f21334..17588e9a88 100644 --- a/types/ramda/index.d.ts +++ b/types/ramda/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for ramda 0.25 +// Type definitions for ramda 0.26 // Project: https://github.com/donnut/typescript-ramda, https://ramdajs.com // Definitions by: Erwin Poeze // Tycho Grouwstra @@ -27,8 +27,9 @@ // John Ottenlips // Nitesh Phadatare // Krantisinh Deshmukh +// Pierre-Antoine Mills // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.8 +// TypeScript Version: 3.3 /// /// @@ -60,6 +61,7 @@ /// /// /// +/// /// /// /// @@ -80,6 +82,8 @@ /// /// /// +/// +/// /// /// /// @@ -104,6 +108,7 @@ /// /// /// +/// /// /// /// @@ -151,13 +156,14 @@ /// /// /// -/// /// /// /// /// /// /// +/// +/// /// /// /// @@ -178,6 +184,7 @@ /// /// /// +/// /// /// /// @@ -192,6 +199,7 @@ /// /// /// +/// /// /// /// @@ -236,6 +244,8 @@ /// /// /// +/// +/// /// /// /// @@ -275,12 +285,272 @@ /// /// /// +/// + +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// declare let R: R.Static; declare namespace R { type Omit = Pick>; + type CommonKeys = keyof T1 & keyof T2; + type PropsThatAreObjects = K extends keyof T ? T[K] extends object ? K : never : never; + type CommonPropsThatAreObjects = PropsThatAreObjects & PropsThatAreObjects; + type Ord = number | string | boolean | Date; type Path = ReadonlyArray<(number | string)>; @@ -361,81 +631,13 @@ declare namespace R { // Represents all objects evolvable with Evolver E type Evolvable = { - [P in keyof E]?: E[P] extends (value: infer V) => any ? V : - E[P] extends Evolver ? Evolvable : - never + [P in keyof E]?: Evolved; }; - // @see https://gist.github.com/donnut/fd56232da58d25ceecf1, comment by @albrow - interface CurriedTypeGuard2 { - (t1: T1): (t2: T2) => t2 is R; - (t1: T1, t2: T2): t2 is R; - } - - interface CurriedTypeGuard3 { - (t1: T1): CurriedTypeGuard2; - (t1: T1, t2: T2): (t3: T3) => t3 is R; - (t1: T1, t2: T2, t3: T3): t3 is R; - } - - interface CurriedTypeGuard4 { - (t1: T1): CurriedTypeGuard3; - (t1: T1, t2: T2): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3): (t4: T4) => t4 is R; - (t1: T1, t2: T2, t3: T3, t4: T4): t4 is R; - } - - interface CurriedTypeGuard5 { - (t1: T1): CurriedTypeGuard4; - (t1: T1, t2: T2): CurriedTypeGuard3; - (t1: T1, t2: T2, t3: T3): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3, t4: T4): (t5: T5) => t5 is R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): t5 is R; - } - - interface CurriedTypeGuard6 { - (t1: T1): CurriedTypeGuard5; - (t1: T1, t2: T2): CurriedTypeGuard4; - (t1: T1, t2: T2, t3: T3): CurriedTypeGuard3; - (t1: T1, t2: T2, t3: T3, t4: T4): CurriedTypeGuard2; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): (t6: T6) => t6 is R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): t6 is R; - } - - interface CurriedFunction2 { - (t1: T1): (t2: T2) => R; - (t1: T1, t2: T2): R; - } - - interface CurriedFunction3 { - (t1: T1): CurriedFunction2; - (t1: T1, t2: T2): (t3: T3) => R; - (t1: T1, t2: T2, t3: T3): R; - } - - interface CurriedFunction4 { - (t1: T1): CurriedFunction3; - (t1: T1, t2: T2): CurriedFunction2; - (t1: T1, t2: T2, t3: T3): (t4: T4) => R; - (t1: T1, t2: T2, t3: T3, t4: T4): R; - } - - interface CurriedFunction5 { - (t1: T1): CurriedFunction4; - (t1: T1, t2: T2): CurriedFunction3; - (t1: T1, t2: T2, t3: T3): CurriedFunction2; - (t1: T1, t2: T2, t3: T3, t4: T4): (t5: T5) => R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): R; - } - - interface CurriedFunction6 { - (t1: T1): CurriedFunction5; - (t1: T1, t2: T2): CurriedFunction4; - (t1: T1, t2: T2, t3: T3): CurriedFunction3; - (t1: T1, t2: T2, t3: T3, t4: T4): CurriedFunction2; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5): (t6: T6) => R; - (t1: T1, t2: T2, t3: T3, t4: T4, t5: T5, t6: T6): R; - } + type Evolved = + T extends (value: infer V) => any ? V : + T extends Evolver ? Evolvable : + never; interface Placeholder { __isRamdaPlaceholder__: true; } @@ -444,6 +646,145 @@ declare namespace R { '@@transducer/reduced': true; } + type PipeWithFns = [ + (x0: V0) => T, + ] | [ + (x0: V0) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => T, + ] | [ + (x0: V0) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => T, + ]; + + type ComposeWithFns = [ + (x0: V0) => T, + ] | [ + (x: any) => T, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: any) => any, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: V0) => any, + ] | [ + (x: any) => T, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: any) => any, + (x: V0) => any, + ]; + + type Merge = { [K in keyof Primary]: Primary[K] } & { [K in Exclude>]: Secondary[K] }; + type MergeDeep = { [K in CommonPropsThatAreObjects]: MergeDeep } & + { [K in Exclude>]: Primary[K] } & + { [K in Exclude>]: Secondary[K] }; + interface Static { /** * Placeholder. When used with functions like curry, or op, the second argument is applied to the second @@ -463,11 +804,11 @@ declare namespace R { * Creates a new list iteration function from an existing one by adding two new parameters to its callback * function: the current index, and the entire list. */ - addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): CurriedFunction2<(item: T, idx: number, list?: T[]) => U, ReadonlyArray, U[]>; + addIndex(fn: (f: (item: T) => U, list: T[]) => U[]): Curry.Curry<(a: (item: T, idx: number, list?: T[]) => U, b: ReadonlyArray) => U[]>; /* Special case for forEach */ - addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): CurriedFunction2<(item: T, idx: number, list?: T[]) => void, ReadonlyArray, T[]>; + addIndex(fn: (f: (item: T) => void, list: T[]) => T[]): Curry.Curry<(a: (item: T, idx: number, list?: T[]) => void, b: ReadonlyArray) => T[]>; /* Special case for reduce */ - addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): CurriedFunction3<(acc: U, item: T, idx: number, list?: T[]) => U, U, ReadonlyArray, U>; + addIndex(fn: (f: (acc: U, item: T) => U, aci: U, list: T[]) => U): Curry.Curry<(a: (acc: U, item: T, idx: number, list?: T[]) => U, b: U, c: ReadonlyArray) => U>; /** * Applies a function to the value at the given index of an array, returning a new copy of the array with the @@ -583,7 +924,7 @@ declare namespace R { assocPath(path: Path, __: Placeholder, obj: U): (val: T) => U; assocPath(path: Path, val: T, obj: U): U; assocPath(path: Path, val: T): (obj: U) => U; - assocPath(path: Path): CurriedFunction2; + assocPath(path: Path): Curry.Curry<(a: T, b: U) => U>; /** * Wraps a function of any arity (including nullary) in a function that accepts exactly 2 @@ -706,6 +1047,8 @@ declare namespace R { * The typings only support arrays for now. * All functions must be unary. * R.composeK(h, g, f) is equivalent to R.compose(R.chain(h), R.chain(g), f). + * + * @deprecated since 0.26 in favor of composeWith(chain) */ composeK( fn0: (x0: V0) => T1[]): (x0: V0) => T1[]; @@ -738,6 +1081,8 @@ declare namespace R { /** * Performs right-to-left composition of one or more Promise-returning functions. * All functions must be unary. + * + * @deprecated since 0.26 in favor of composeWith(then) */ composeP( fn0: (x0: V0) => Promise): (x0: V0) => Promise; @@ -769,6 +1114,13 @@ declare namespace R { fn0: (x: V0) => Promise): (x: V0) => Promise; + /** + * Performs right-to-left function composition using transforming function. + * With the current typings, all functions must be unary. + */ + composeWith(composer: (a: any) => any, fns: ComposeWithFns): (x0: V0) => T; + composeWith(composer: (a: any) => any): (fns: ComposeWithFns) => (x: V0) => T; + /** * Returns a new list consisting of the elements of the first list followed by the elements * of the second. @@ -803,6 +1155,8 @@ declare namespace R { /** * Returns `true` if the specified item is somewhere in the list, `false` otherwise. * Equivalent to `indexOf(a)(list) > -1`. Uses strict (`===`) equality checking. + * + * @deprecated since 0.26 in favor of includes */ contains(__: Placeholder, list: string): (a: string) => boolean; contains(__: Placeholder, list: T[]): (a: T) => boolean; @@ -835,17 +1189,7 @@ declare namespace R { * Returns a curried equivalent of the provided function. The curried function has two unusual capabilities. * First, its arguments needn't be provided one at a time. */ - curry(fn: (a: T1, b: T2) => b is TResult): CurriedTypeGuard2; - curry(fn: (a: T1, b: T2, c: T3) => c is TResult): CurriedTypeGuard3; - curry(fn: (a: T1, b: T2, c: T3, d: T4) => d is TResult): CurriedTypeGuard4; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => e is TResult): CurriedTypeGuard5; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => f is TResult): CurriedTypeGuard6; - curry(fn: (a: T1, b: T2) => TResult): CurriedFunction2; - curry(fn: (a: T1, b: T2, c: T3) => TResult): CurriedFunction3; - curry(fn: (a: T1, b: T2, c: T3, d: T4) => TResult): CurriedFunction4; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5) => TResult): CurriedFunction5; - curry(fn: (a: T1, b: T2, c: T3, d: T4, e: T5, f: T6) => TResult): CurriedFunction6; - curry(fn: (...a: any[]) => any): (...a: any[]) => any; + curry any>(f: F): Curry.Curry; /** * Returns a curried equivalent of the provided function, with the specified arity. The curried function has @@ -934,6 +1278,19 @@ declare namespace R { dropLastWhile(fn: (a: T) => boolean, list: ReadonlyArray): T[]; dropLastWhile(fn: (a: T) => boolean): (list: ReadonlyArray) => T[]; + /** + * Returns a new list without any consecutively repeating elements. R.equals is used to determine equality. + */ + dropRepeats(list: ReadonlyArray): T[]; + + /** + * Returns a new list without any consecutively repeating elements. + * Equality is determined by applying the supplied predicate to each pair of consecutive elements. + * The first element in a series of equal elements will be preserved. + */ + dropRepeatsWith(predicate: (left: T, right: T) => boolean, list: ReadonlyArray): T[]; + dropRepeatsWith(predicate: (left: T, right: T) => boolean): (list: ReadonlyArray) => T[]; + /** * Returns a new list containing the last n elements of a given list, passing each value to the supplied * predicate function, skipping elements while the predicate function returns true. @@ -970,7 +1327,7 @@ declare namespace R { */ eqBy(fn: (a: T) => U, a: T, b: T): boolean; eqBy(fn: (a: T) => U, a: T): (b: T) => boolean; - eqBy(fn: (a: T) => U): CurriedFunction2; + eqBy(fn: (a: T) => U): Curry.Curry<(a: T, b: T) => boolean>; /** * Reports whether two functions have the same value for the specified property. @@ -1108,6 +1465,12 @@ declare namespace R { hasIn(s: string, obj: T): boolean; hasIn(s: string): (obj: T) => boolean; + /** + * Returns whether or not a path exists in an object. Only the object's own properties are checked. + */ + hasPath(list: ReadonlyArray, obj: T): boolean; + hasPath(list: ReadonlyArray): (obj: T) => boolean; + /** * Returns the first element in a list. * In some libraries this function is named `first`. @@ -1444,7 +1807,7 @@ declare namespace R { */ maxBy(keyFn: (a: T) => Ord, a: T, b: T): T; maxBy(keyFn: (a: T) => Ord, a: T): (b: T) => T; - maxBy(keyFn: (a: T) => Ord): CurriedFunction2; + maxBy(keyFn: (a: T) => Ord): Curry.Curry<(a: T, b: T) => T>; /** * Returns the mean of the given list of numbers. @@ -1457,35 +1820,28 @@ declare namespace R { median(list: ReadonlyArray): number; /** - * @deprecated since v0.25.0 - * - * Creates a new function that, when invoked, caches the result of calling fn for a given argument set and - * returns the result. Subsequent calls to the memoized fn with the same argument set will not result in an - * additional call to fn; instead, the cached result for that set of arguments will be returned. + * Creates a new function that, when invoked, caches the result of calling fn for a given argument set and returns the result. + * Subsequent calls to the memoized fn with the same argument set will not result in an additional call to fn; instead, the cached result for that set of arguments will be returned. */ - memoize any>(fn: T): T; - - /** - * A customisable version of R.memoize. memoizeWith takes an additional function that will be applied to a given - * argument set and used to create the cache key under which the results of the function to be memoized will be stored. - * Care must be taken when implementing key generation to avoid clashes that may overwrite previous entries erroneously. - */ - memoizeWith any>(keyFn: (...v: any[]) => string, fn: T): T; + memoizeWith any>(keyFn: (...v: Parameters) => string, fn: T): T; /** * Create a new object with the own properties of a * merged with the own properties of object b. * This function will *not* mutate passed-in objects. + * + * @deprecated since 0.26 in favor of mergeRight */ - merge(__: Placeholder, b: T2): (a: T1) => T1 & T2; - merge(__: Placeholder): (b: T2, a: T1) => T1 & T2; - merge(a: T1, b: T2): T1 & T2; - merge(a: T1): (b: T2) => T1 & T2; + merge(__: Placeholder, b: T2): (a: T1) => Merge; + merge(__: Placeholder): (b: T2, a: T1) => Merge; + merge(a: T1, b: T2): Merge; + merge(a: T1): (b: T2) => Merge; /** * Merges a list of objects together into one object. */ - mergeAll(list: ReadonlyArray): T; + mergeAll(list: ReadonlyArray): T; + mergeAll(list: ReadonlyArray): any; /** * Creates a new object with the own properties of the first object merged with the own properties of the second object. @@ -1493,8 +1849,8 @@ declare namespace R { * and both values are objects, the two values will be recursively merged * otherwise the value from the first object will be used. */ - mergeDeepLeft(a: T1, b: T2): T1 & T2; - mergeDeepLeft(a: T1): (b: T2) => T1 & T2; + mergeDeepLeft(a: T1, b: T2): MergeDeep; + mergeDeepLeft(a: T1): (b: T2) => MergeDeep; /** * Creates a new object with the own properties of the first object merged with the own properties of the second object. @@ -1502,8 +1858,8 @@ declare namespace R { * and both values are objects, the two values will be recursively merged * otherwise the value from the second object will be used. */ - mergeDeepRight(a: A, b: B): A & B; - mergeDeepRight(a: A): (b: B) => A & B; + mergeDeepRight(a: A, b: B): MergeDeep; + mergeDeepRight(a: A): (b: B) => MergeDeep; /** * Creates a new object with the own properties of the two provided objects. If a key exists in both objects: @@ -1511,9 +1867,9 @@ declare namespace R { * otherwise the provided function is applied to associated values using the resulting value as the new value * associated with the key. If a key only exists in one object, the value will be associated with the key of the resulting object. */ - mergeDeepWith(fn: (x: any, z: any) => any, a: T1, b: T2): T1 & T2; - mergeDeepWith(fn: (x: any, z: any) => any, a: T1): (b: T2) => T1 & T2; - mergeDeepWith(fn: (x: any, z: any) => any): (a: T1, b: T2) => T1 & T2; + mergeDeepWith(fn: (x: any, z: any) => any, a: T1, b: T2): any; + mergeDeepWith(fn: (x: any, z: any) => any, a: T1): (b: T2) => any; + mergeDeepWith(fn: (x: any, z: any) => any): (a: T1, b: T2) => any; /** * Creates a new object with the own properties of the two provided objects. If a key exists in both objects: @@ -1522,9 +1878,23 @@ declare namespace R { * the new value associated with the key. If a key only exists in one object, the value will be associated with * the key of the resulting object. */ - mergeDeepWithKey(fn: (k: string, x: any, z: any) => any, a: T1, b: T2): T1 & T2; - mergeDeepWithKey(fn: (k: string, x: any, z: any) => any, a: T1): (b: T2) => T1 & T2; - mergeDeepWithKey(fn: (k: string, x: any, z: any) => any): (a: T1, b: T2) => T1 & T2; + mergeDeepWithKey(fn: (k: string, x: any, z: any) => any, a: T1, b: T2): any; + mergeDeepWithKey(fn: (k: string, x: any, z: any) => any, a: T1): (b: T2) => any; + mergeDeepWithKey(fn: (k: string, x: any, z: any) => any): (a: T1, b: T2) => any; + + /** + * Create a new object with the own properties of the first object merged with the own properties of the second object. + * If a key exists in both objects, the value from the first object will be used. + */ + mergeLeft(a: T1, b: T2): Merge; + mergeLeft(a: T1): (b: T2) => Merge; + + /** + * Create a new object with the own properties of the first object merged with the own properties of the second object. + * If a key exists in both objects, the value from the second object will be used. + */ + mergeRight(a: T1, b: T2): Merge; + mergeRight(a: T1): (b: T2) => Merge; /** * Creates a new object with the own properties of the two provided objects. If a key exists in both objects, @@ -1532,9 +1902,9 @@ declare namespace R { * the value associated with the key in the returned object. The key will be excluded from the returned object if the * resulting value is undefined. */ - mergeWith(fn: (x: any, z: any) => any, a: U, b: V): U & V; - mergeWith(fn: (x: any, z: any) => any, a: U): (b: V) => U & V; - mergeWith(fn: (x: any, z: any) => any): (a: U, b: V) => U & V; + mergeWith(fn: (x: any, z: any) => any, a: U, b: V): any; + mergeWith(fn: (x: any, z: any) => any, a: U): (b: V) => any; + mergeWith(fn: (x: any, z: any) => any): (a: U, b: V) => any; /** * Creates a new object with the own properties of the two provided objects. If a key exists in both objects, @@ -1542,9 +1912,9 @@ declare namespace R { * result being used as the value associated with the key in the returned object. The key will be excluded from * the returned object if the resulting value is undefined. */ - mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U, b: V): U & V; - mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U): (b: V) => U & V; - mergeWithKey(fn: (str: string, x: any, z: any) => any): (a: U, b: V) => U & V; + mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U, b: V): any; + mergeWithKey(fn: (str: string, x: any, z: any) => any, a: U): (b: V) => any; + mergeWithKey(fn: (str: string, x: any, z: any) => any): (a: U, b: V) => any; /** * Returns the smaller of its two arguments. @@ -1558,7 +1928,7 @@ declare namespace R { */ minBy(keyFn: (a: T) => Ord, a: T, b: T): T; minBy(keyFn: (a: T) => Ord, a: T): (b: T) => T; - minBy(keyFn: (a: T) => Ord): CurriedFunction2; + minBy(keyFn: (a: T) => Ord): Curry.Curry<(a: T, b: T) => T>; /** * Divides the second parameter by the first and returns the remainder. @@ -1658,6 +2028,13 @@ declare namespace R { or any); }, U>(fn1: T, val2: U): T | U; or any); }>(fn1: T): (val2: U) => T | U; + /** + * Returns the result of applying the onFailure function to the value inside a failed promise. + * This is useful for handling rejected promises inside function compositions. + */ + otherwise(onError: (error: any) => B | Promise, promise: Promise): Promise; + otherwise(onError: (error: any) => B | Promise): (promise: Promise) => Promise; + /** * Returns the result of "setting" the portion of the given data structure * focused by the given lens to the given value. @@ -1727,7 +2104,7 @@ declare namespace R { */ pathEq(path: Path, val: any, obj: any): boolean; pathEq(path: Path, val: any): (obj: any) => boolean; - pathEq(path: Path): CurriedFunction2; + pathEq(path: Path): Curry.Curry<(a: any, b: any) => boolean>; /** * If the given, non-null object has a value at the given path, returns the value at that path. @@ -1735,14 +2112,14 @@ declare namespace R { */ pathOr(defaultValue: T, path: Path, obj: any): any; pathOr(defaultValue: T, path: Path): (obj: any) => any; - pathOr(defaultValue: T): CurriedFunction2; + pathOr(defaultValue: T): Curry.Curry<(a: Path, b: any) => any>; /** * Returns true if the specified object property at given path satisfies the given predicate; false otherwise. */ pathSatisfies(pred: (val: T) => boolean, path: Path, obj: U): boolean; pathSatisfies(pred: (val: T) => boolean, path: Path): (obj: U) => boolean; - pathSatisfies(pred: (val: T) => boolean): CurriedFunction2; + pathSatisfies(pred: (val: T) => boolean): Curry.Curry<(a: Path, b: U) => boolean>; /** * Returns a partial copy of an object containing only the keys specified. If the key does not exist, the @@ -1960,11 +2337,13 @@ declare namespace R { fn8: (x: T8) => T9, fn9: (x: T9) => T10): (x0: V0, x1: V1, x2: V2) => T10; - /* + /** * Returns the left-to-right Kleisli composition of the provided functions, each of which must return a value of a type supported by chain. * The typings currently support arrays only as return values. * All functions need to be unary. * R.pipeK(f, g, h) is equivalent to R.pipe(f, R.chain(g), R.chain(h)). + * + * @deprecated since 0.26 in favor of pipeWith(chain) */ pipeK( fn0: (x0: V0) => T1[]): (x0: V0) => T1[]; @@ -2032,9 +2411,11 @@ declare namespace R { fn8: (x: T8) => T9[], fn9: (x: T9) => T10[]): (x0: V0) => T10[]; - /* + /** * Performs left-to-right composition of one or more Promise-returning functions. * All functions need to be unary. + * + * @deprecated since 0.26 in favor of pipeWith(then) */ pipeP( fn0: (x0: V0) => Promise): (x0: V0) => Promise; @@ -2102,6 +2483,13 @@ declare namespace R { fn8: (x: T8) => Promise, fn9: (x: T9) => Promise): (x0: V0) => Promise; + /* + * Performs left-to-right function composition using transforming function. + * With the current typings, all functions must be unary. + */ + pipeWith(composer: (a: any) => any, fns: PipeWithFns): (x0: V0) => T; + pipeWith(composer: (a: any) => any): (fns: PipeWithFns) => (x0: V0) => T; + /** * Returns a new list by plucking the same named property off all objects in the list supplied. */ @@ -2180,7 +2568,7 @@ declare namespace R { */ propSatisfies(pred: (val: T) => boolean, name: string, obj: U): boolean; propSatisfies(pred: (val: T) => boolean, name: string): (obj: U) => boolean; - propSatisfies(pred: (val: T) => boolean): CurriedFunction2; + propSatisfies(pred: (val: T) => boolean): Curry.Curry<(a: string, b: U) => boolean>; /** * Returns a list of numbers from `from` (inclusive) to `to` @@ -2205,8 +2593,8 @@ declare namespace R { */ reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string, list: ReadonlyArray): { [index: string]: TResult }; reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult, keyFn: (elem: T) => string): (list: ReadonlyArray) => { [index: string]: TResult }; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): CurriedFunction2<(elem: T) => string, ReadonlyArray, { [index: string]: TResult }>; - reduceBy(valueFn: (acc: TResult, elem: T) => TResult): CurriedFunction3 string, ReadonlyArray, { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult, acc: TResult): Curry.Curry<(a: (elem: T) => string, b: ReadonlyArray) => { [index: string]: TResult }>; + reduceBy(valueFn: (acc: TResult, elem: T) => TResult): Curry.Curry<(a: TResult, b: (elem: T) => string, c: ReadonlyArray) => { [index: string]: TResult }>; /** * Returns a value wrapped to indicate that it is the final value of the reduce and @@ -2232,8 +2620,8 @@ declare namespace R { */ reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult, list: ReadonlyArray): TResult; reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult, acc: TResult): (list: ReadonlyArray) => TResult; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): CurriedFunction2, TResult>; - reduceWhile(predicate: (acc: TResult, elem: T) => boolean): CurriedFunction3<(acc: TResult, elem: T) => TResult, TResult, ReadonlyArray, TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean, fn: (acc: TResult, elem: T) => TResult): Curry.Curry<(a: TResult, b: ReadonlyArray) => TResult>; + reduceWhile(predicate: (acc: TResult, elem: T) => boolean): Curry.Curry<(a: (acc: TResult, elem: T) => TResult, b: TResult, c: ReadonlyArray) => TResult>; /** * Similar to `filter`, except that it keeps only values for which the given predicate @@ -2387,7 +2775,7 @@ declare namespace R { * Duplication is determined according to the value returned by applying the supplied predicate to two list elements. */ symmetricDifferenceWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - symmetricDifferenceWith(pred: (a: T, b: T) => boolean): CurriedFunction2, ReadonlyArray, T[]>; + symmetricDifferenceWith(pred: (a: T, b: T) => boolean): Curry.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; /** * A function that always returns true. Any passed in parameters are ignored. @@ -2451,6 +2839,18 @@ declare namespace R { test(regexp: RegExp, str: string): boolean; test(regexp: RegExp): (str: string) => boolean; + /** + * Returns the result of applying the onSuccess function to the value inside a successfully resolved promise. This is useful for working with promises inside function compositions. + */ + then(onSuccess: (a: A) => B | Promise, promise: Promise): Promise; + then(onSuccess: (a: A) => B | Promise): (promise: Promise) => Promise; + + /** + * Creates a thunk out of a function. + * A thunk delays a calculation until its result is needed, providing lazy evaluation of arguments. + */ + thunkify any>(fn: F): Curry.Curry<(...args: Parameters) => (() => ReturnType)>; + /** * Calls an input function `n` times, returning an array containing the results of those * function calls. @@ -2516,9 +2916,9 @@ declare namespace R { * sequence to transform the resulting Traversable of Applicative into * an Applicative of Traversable. */ - traverse(of: (a: U[]) => A, fn: (t: T) => U, list: ReadonlyArray): A; - traverse(of: (a: U[]) => A, fn: (t: T) => U): (list: ReadonlyArray) => A; - traverse(of: (a: U[]) => A): (fn: (t: T) => U, list: ReadonlyArray) => A; + traverse(of: (a: B) => ReadonlyArray, fn: (t: A) => ReadonlyArray, list: ReadonlyArray): B[][]; + traverse(of: (a: B) => ReadonlyArray, fn: (t: A) => ReadonlyArray): (list: ReadonlyArray) => B[][]; + traverse(of: (a: B) => ReadonlyArray): (fn: (t: A) => ReadonlyArray, list: ReadonlyArray) => B[][]; /** * Removes (strips) whitespace from both ends of the string. @@ -2581,7 +2981,7 @@ declare namespace R { * determined according to the value returned by applying the supplied predicate to two list elements. */ unionWith(pred: (a: T, b: T) => boolean, list1: ReadonlyArray, list2: ReadonlyArray): T[]; - unionWith(pred: (a: T, b: T) => boolean): CurriedFunction2, ReadonlyArray, T[]>; + unionWith(pred: (a: T, b: T) => boolean): Curry.Curry<(a: ReadonlyArray, b: ReadonlyArray) => T[]>; /** * Returns a new list containing only one copy of each element in the original list. diff --git a/types/ramda/ramda-tests.ts b/types/ramda/ramda-tests.ts index 16ba23d85b..8887c52c57 100644 --- a/types/ramda/ramda-tests.ts +++ b/types/ramda/ramda-tests.ts @@ -68,6 +68,10 @@ class F2 { return a + b + c + d; } + function addTenFixedNumbers(a: 0, b: 1, c: 2, d: 3, e: 4, f: 5, g: 6, h: 7, i: 8, k: 9, l: 10): number { + return a + b + c + d; + } + const x1: (a: number, b: number, c: number, d: number) => number = R.curry(addFourNumbers); // because of the current way of currying, the following call results in a type error // const x2: Function = R.curry(addFourNumbers)(1,2,4) @@ -76,6 +80,8 @@ class F2 { const y1: number = R.curry(addFourNumbers)(1)(2)(3)(4); const y2: number = R.curry(addFourNumbers)(1, 2)(3, 4); const y3: number = R.curry(addFourNumbers)(1, 2, 3)(4); + const y4: number = R.curry(addTenFixedNumbers)(R.__, 1, 2)(0)(3)(R.__, R.__)(R.__, 5)(4)(6, 7)(R.__)(8, R.__, R.__)(9, 10); + const y5: number = R.curry(addTenFixedNumbers)(R.__, 1, R.__)(R.__, 2)(0, 3)(R.__, 5)(4, R.__)(R.__)(6, R.__, 8, 9, 10)(7); R.nAry(0); R.nAry(0, takesNoArg); @@ -119,7 +125,8 @@ class F2 { const cars: Car[] = [{speed: 65}, {}]; for (const car of cars) { if (typeGuardCurried(1)(2)(3)(4)(5)(car)) { - drive(car); + drive(car); // $ExpectError + // Generic Curry solved a previously non reported issue } } }; @@ -263,6 +270,50 @@ class F2 { ); }; +() => { + const get = (prop: string) => (obj: any): any[] => { + const propVal = obj[prop]; + if (propVal) { + return [propVal]; + } else { + return []; + } + }; + + const getStateCode: (input: any) => any[] = R.composeWith( + R.chain, + [ + R.compose((val) => [val], R.toUpper), + get('state'), + get('address'), + get('user'), + ], + ); + getStateCode({ user: { address: { state: "ny" } } }); // => [] + getStateCode({}); // => [] + + const nextThree = (num: number): number[] => ([num, num + 1, num + 2]); + const onlyOverNine = (num: number): number[] => num > 9 ? [num] : []; + const toString = (input: any): string[] => [`${input}`]; + const split = (input: string): string[] => input.split(''); + + const composed: (num: number) => string[] = R.composeWith( + R.chain, + [ + split, + toString, + onlyOverNine, + nextThree, + ], + ); + const composed2: (num: number) => string[] = R.composeWith(R.chain)([ + split, + toString, + onlyOverNine, + nextThree, + ]); +}; + /* composeP */ () => { interface User { @@ -369,6 +420,31 @@ class F2 { const followersForUser: (userName: string) => Promise = R.pipeP(db.getUserById, db.getFollowers); }; +() => { + interface User { + followers: string[]; + name: string; + } + + const db = { + getUserById(userName: string): Promise { + return Promise.resolve({ + name: 'Jon', + followers: [ + 'Samwell', + 'Edd', + 'Grenn', + ], + }); + }, + getFollowers(user: User): Promise { + return Promise.resolve(user.followers); + }, + }; + const followersForUser: (userName: string) => Promise = R.pipeWith(R.then, [db.getUserById, db.getFollowers]); + const followersForUser2: (userName: string) => Promise = R.pipeWith(R.then)([db.getUserById, db.getFollowers]); +}; + () => { R.invoker(1, "slice")(6, "abcdefghijklm"); R.invoker(2, "slice")(6)(8, "abcdefghijklm"); @@ -449,34 +525,6 @@ R.times(i, 5); greetMsJaneJones("Hello"); // => 'Hello, Ms. Jane Jones!' })(); -(() => { - let numberOfCalls = 0; - - function trackedAdd(a: number, b: number) { - numberOfCalls += 1; - return a + b; - } - - const memoTrackedAdd = R.memoize(trackedAdd); - - memoTrackedAdd(1, 2); // => 3 - numberOfCalls; // => 1 - memoTrackedAdd(1, 2); // => 3 - numberOfCalls; // => 1 - memoTrackedAdd(2, 3); // => 5 - numberOfCalls; // => 2 - - // Note that argument order matters - memoTrackedAdd(2, 1); // => 3 - numberOfCalls; // => 3 - - function stringLength(str: string): number { - return str.length; - } - const memoStringLength = R.memoize(stringLength); - const isLong = memoStringLength('short') > 10; // false -})(); - (() => { interface Vector { x: number; @@ -493,7 +541,7 @@ R.times(i, 5); }; } - const memoVectorSum = R.memoizeWith(JSON.stringify, vectorSum); + const memoVectorSum = R.memoizeWith((a, b) => JSON.stringify([a, b]), vectorSum); memoVectorSum({ x: 1, y: 1 }, { x: 2, y: 2 }); // => { x: 3, y: 3 } numberOfCalls; // => 1 @@ -719,6 +767,15 @@ R.times(i, 5); R.dropLastWhile(lteThree, [1, 2, 3, 4, 3, 2, 1]); // => [1, 2, 3, 4] }); +(() => { + R.dropRepeats([1, 1, 1, 2, 3, 4, 4, 2, 2]); // => [1, 2, 3, 4, 2] +}); + +(() => { + const l = [1, -1, 1, 3, 4, -4, -4, -5, 5, 3, 3]; + const x: number[] = R.dropRepeatsWith(R.eqBy(Math.abs), l); // => [1, 3, 4, -5, 3] +}); + () => { function lteTwo(x: number) { return x <= 2; @@ -960,7 +1017,8 @@ interface Obj { } const list: Book[] = [{id: "xyz", title: "A"}, {id: "abc", title: "B"}]; const a1 = R.indexBy(R.prop("id"), list); - const a2 = R.indexBy(R.prop("id"))(list); + // Typescript 3.3 incorrectly gives `a2: {}`, 3.4 gives an error instead. + // const a2 = R.indexBy(R.prop("id"))(list); const a3 = R.indexBy<{ id: string }>(R.prop("id"))(list); const a4 = R.indexBy(R.prop<"id", string>("id"))(list); const a5 = R.indexBy<{ id: string }>(R.prop<"id", string>("id"))(list); @@ -1405,6 +1463,31 @@ type Pair = KeyValuePair; const b: boolean = R.test(/^y/)("xyz"); // => false }; +() => { + interface Person { id: number; firstName: string; lastName: string; } + const makeQuery = (email: string) => ({ query: { email }}); + const fetchMember = (query: any) => Promise.resolve({ id: 1, firstName: 'Jon', lastName: 'Snow' }); + const getTitleAsync = (person: Person) => person.firstName === 'Jon' && person.lastName === 'Snow' ? Promise.resolve('King in the North') : Promise.reject('Unknown'); + + const getMemberName: (email: string) => Promise<{ firstName: string, lastName: string }> = R.pipe( + makeQuery, + fetchMember, + R.then(R.pick(['firstName', 'lastName'])), + ); + + const getMemberTitle: (email: string) => Promise = R.pipe( + makeQuery, + fetchMember, + R.then(getTitleAsync), + ); +}; + +() => { + const x: number = R.thunkify(R.identity)(42)(); + const y: number = R.thunkify((a: number, b: number) => a + b)(25, 17)(); + const z: number = R.thunkify((a: number, b: number) => a + b)(25)(17)(); +}; + () => { const a1 = R.times(R.identity, 5); // => [0, 1, 2, 3, 4] const a2 = R.times(R.identity)(5); // => [0, 1, 2, 3, 4] @@ -1452,7 +1535,7 @@ type Pair = KeyValuePair; const list = [1, 2, 3]; R.traverse(of, fn, list); R.traverse(of, fn)(list); - R.traverse(of)(fn, list); + R.traverse(of)(fn, list); }; () => { @@ -1662,6 +1745,16 @@ class Rectangle { R.flip(R.hasIn)(square)("area"); // => true }; +() => { + R.hasPath(['a', 'b'], {a: {b: 2}}); // true + R.hasPath(['a', 'b'], {a: {b: undefined}}); // => true + R.hasPath(['a', 'b'], {a: {c: 2}}); // => false + R.hasPath(['a', 'b'], {}); // => false + + const hasPathCurried = R.hasPath(['a', 'b']); + hasPathCurried({a: {b: 2}}); // true +}; + () => { const raceResultsByFirstName = { first : "alice", @@ -1698,6 +1791,25 @@ class Rectangle { R.keysIn(f); // => ['x', 'y'] }; +() => { + interface Person { firstName: string; lastName: string; } + const failedFetch = (id: string): Promise => Promise.reject('bad ID'); + const useDefault = (): Person => ({ firstName: 'Bob', lastName: 'Loblaw' }); + const loadAlternative = (): Promise => Promise.resolve({ firstName: 'Saul', lastName: 'Goodman' }); + + const recoverFromFailure: (id: string) => Promise<{ firstName: string; lastName: string; }> = R.pipe( + failedFetch, + R.otherwise(useDefault), + R.then(R.pick(['firstName', 'lastName'])), + ); + + const recoverFromFailureByAlternative: (id: string) => Promise = R.pipe( + failedFetch, + R.otherwise(useDefault), + R.then(loadAlternative), + ); +}; + () => { const xLens = R.lens(R.prop("x"), R.assoc("x")); R.view(xLens, {x: 1, y: 2}); // => 1 @@ -1789,8 +1901,11 @@ class Rectangle { }; () => { + interface FBB { foo?: number; bar?: number; baz?: number; } const a = R.mergeAll([{foo: 1}, {bar: 2}, {baz: 3}]); // => {foo:1,bar:2,baz:3} const b = R.mergeAll([{foo: 1}, {foo: 2}, {bar: 2}]); // => {foo:2,bar:2} + const c = R.mergeAll([{foo: 1}, {bar: 2}, {baz: 3}]); // => {foo:1,bar:2,baz:3} + const d = R.mergeAll([{foo: 1}, {foo: 2}, {bar: 2}]); // => {foo:2,bar:2} }; () => { @@ -1817,6 +1932,20 @@ class Rectangle { ); // => { foo: { bar: [ 1, 2, 3, 4 ], userIds: [42] } } }; +() => { + R.mergeLeft({foo: {bar: 1}}, {foo: {bar: 2}}); // => {foo: {bar: 1}} + const curry1 = R.mergeLeft({foo: {bar: 1}}); + curry1({foo: {bar: 2}}); // => {foo: {bar: 1}} +}; + +() => { + R.mergeRight({ name: 'fred', age: 10 }, { age: 40 }); + // => { 'name': 'fred', 'age': 40 } + + const withDefaults = R.mergeRight({x: 0, y: 0}); + withDefaults({y: 2}); // => {x: 0, y: 2} +}; + () => { const a = R.mergeWith(R.concat, {a: true, values: [10, 20]}, @@ -2784,3 +2913,5 @@ class Why { () => { R.bind(console.log, console); }; + +// Curry tests diff --git a/types/ramda/src/F.d.ts b/types/ramda/src/F.d.ts new file mode 100644 index 0000000000..bdc0d570d9 --- /dev/null +++ b/types/ramda/src/F.d.ts @@ -0,0 +1,2 @@ +import { F } from '../index'; +export default F; diff --git a/types/ramda/src/T.d.ts b/types/ramda/src/T.d.ts new file mode 100644 index 0000000000..634808e684 --- /dev/null +++ b/types/ramda/src/T.d.ts @@ -0,0 +1,2 @@ +import { T } from '../index'; +export default T; diff --git a/types/ramda/src/add.d.ts b/types/ramda/src/add.d.ts new file mode 100644 index 0000000000..b7b3ee887c --- /dev/null +++ b/types/ramda/src/add.d.ts @@ -0,0 +1,2 @@ +import { add } from '../index'; +export default add; diff --git a/types/ramda/src/addIndex.d.ts b/types/ramda/src/addIndex.d.ts new file mode 100644 index 0000000000..9f27967dcb --- /dev/null +++ b/types/ramda/src/addIndex.d.ts @@ -0,0 +1,2 @@ +import { addIndex } from '../index'; +export default addIndex; diff --git a/types/ramda/src/adjust.d.ts b/types/ramda/src/adjust.d.ts new file mode 100644 index 0000000000..22b65ec38e --- /dev/null +++ b/types/ramda/src/adjust.d.ts @@ -0,0 +1,2 @@ +import { adjust } from '../index'; +export default adjust; diff --git a/types/ramda/src/all.d.ts b/types/ramda/src/all.d.ts new file mode 100644 index 0000000000..a2f6d934f9 --- /dev/null +++ b/types/ramda/src/all.d.ts @@ -0,0 +1,2 @@ +import { all } from '../index'; +export default all; diff --git a/types/ramda/src/allPass.d.ts b/types/ramda/src/allPass.d.ts new file mode 100644 index 0000000000..d44ac20e9d --- /dev/null +++ b/types/ramda/src/allPass.d.ts @@ -0,0 +1,2 @@ +import { allPass } from '../index'; +export default allPass; diff --git a/types/ramda/src/always.d.ts b/types/ramda/src/always.d.ts new file mode 100644 index 0000000000..aadc94983b --- /dev/null +++ b/types/ramda/src/always.d.ts @@ -0,0 +1,2 @@ +import { always } from '../index'; +export default always; diff --git a/types/ramda/src/and.d.ts b/types/ramda/src/and.d.ts new file mode 100644 index 0000000000..3d505f6ec3 --- /dev/null +++ b/types/ramda/src/and.d.ts @@ -0,0 +1,2 @@ +import { and } from '../index'; +export default and; diff --git a/types/ramda/src/any.d.ts b/types/ramda/src/any.d.ts new file mode 100644 index 0000000000..1e77e505e9 --- /dev/null +++ b/types/ramda/src/any.d.ts @@ -0,0 +1,2 @@ +import { any } from '../index'; +export default any; diff --git a/types/ramda/src/anyPass.d.ts b/types/ramda/src/anyPass.d.ts new file mode 100644 index 0000000000..d8e7fc8f0d --- /dev/null +++ b/types/ramda/src/anyPass.d.ts @@ -0,0 +1,2 @@ +import { anyPass } from '../index'; +export default anyPass; diff --git a/types/ramda/src/ap.d.ts b/types/ramda/src/ap.d.ts new file mode 100644 index 0000000000..5bf98d7fbd --- /dev/null +++ b/types/ramda/src/ap.d.ts @@ -0,0 +1,2 @@ +import { ap } from '../index'; +export default ap; diff --git a/types/ramda/src/aperture.d.ts b/types/ramda/src/aperture.d.ts new file mode 100644 index 0000000000..7536b091b8 --- /dev/null +++ b/types/ramda/src/aperture.d.ts @@ -0,0 +1,2 @@ +import { aperture } from '../index'; +export default aperture; diff --git a/types/ramda/src/append.d.ts b/types/ramda/src/append.d.ts new file mode 100644 index 0000000000..88a4e7cde2 --- /dev/null +++ b/types/ramda/src/append.d.ts @@ -0,0 +1,2 @@ +import { append } from '../index'; +export default append; diff --git a/types/ramda/src/apply.d.ts b/types/ramda/src/apply.d.ts new file mode 100644 index 0000000000..53d90689ed --- /dev/null +++ b/types/ramda/src/apply.d.ts @@ -0,0 +1,2 @@ +import { apply } from '../index'; +export default apply; diff --git a/types/ramda/src/applySpec.d.ts b/types/ramda/src/applySpec.d.ts new file mode 100644 index 0000000000..57e5b8018c --- /dev/null +++ b/types/ramda/src/applySpec.d.ts @@ -0,0 +1,2 @@ +import { applySpec } from '../index'; +export default applySpec; diff --git a/types/ramda/src/applyTo.d.ts b/types/ramda/src/applyTo.d.ts new file mode 100644 index 0000000000..30869542db --- /dev/null +++ b/types/ramda/src/applyTo.d.ts @@ -0,0 +1,2 @@ +import { applyTo } from '../index'; +export default applyTo; diff --git a/types/ramda/src/ascend.d.ts b/types/ramda/src/ascend.d.ts new file mode 100644 index 0000000000..e4c4e1199b --- /dev/null +++ b/types/ramda/src/ascend.d.ts @@ -0,0 +1,2 @@ +import { ascend } from '../index'; +export default ascend; diff --git a/types/ramda/src/assoc.d.ts b/types/ramda/src/assoc.d.ts new file mode 100644 index 0000000000..5acc97a0aa --- /dev/null +++ b/types/ramda/src/assoc.d.ts @@ -0,0 +1,2 @@ +import { assoc } from '../index'; +export default assoc; diff --git a/types/ramda/src/assocPath.d.ts b/types/ramda/src/assocPath.d.ts new file mode 100644 index 0000000000..040671bf38 --- /dev/null +++ b/types/ramda/src/assocPath.d.ts @@ -0,0 +1,2 @@ +import { assocPath } from '../index'; +export default assocPath; diff --git a/types/ramda/src/binary.d.ts b/types/ramda/src/binary.d.ts new file mode 100644 index 0000000000..259cb96e82 --- /dev/null +++ b/types/ramda/src/binary.d.ts @@ -0,0 +1,2 @@ +import { binary } from '../index'; +export default binary; diff --git a/types/ramda/src/bind.d.ts b/types/ramda/src/bind.d.ts new file mode 100644 index 0000000000..fe108f09a7 --- /dev/null +++ b/types/ramda/src/bind.d.ts @@ -0,0 +1,2 @@ +import { bind } from '../index'; +export default bind; diff --git a/types/ramda/src/both.d.ts b/types/ramda/src/both.d.ts new file mode 100644 index 0000000000..8061154cdd --- /dev/null +++ b/types/ramda/src/both.d.ts @@ -0,0 +1,2 @@ +import { both } from '../index'; +export default both; diff --git a/types/ramda/src/call.d.ts b/types/ramda/src/call.d.ts new file mode 100644 index 0000000000..35b6fda88c --- /dev/null +++ b/types/ramda/src/call.d.ts @@ -0,0 +1,2 @@ +import { call } from '../index'; +export default call; diff --git a/types/ramda/src/chain.d.ts b/types/ramda/src/chain.d.ts new file mode 100644 index 0000000000..53aafe210a --- /dev/null +++ b/types/ramda/src/chain.d.ts @@ -0,0 +1,2 @@ +import { chain } from '../index'; +export default chain; diff --git a/types/ramda/src/clamp.d.ts b/types/ramda/src/clamp.d.ts new file mode 100644 index 0000000000..1376643cbf --- /dev/null +++ b/types/ramda/src/clamp.d.ts @@ -0,0 +1,2 @@ +import { clamp } from '../index'; +export default clamp; diff --git a/types/ramda/src/clone.d.ts b/types/ramda/src/clone.d.ts new file mode 100644 index 0000000000..b95f842554 --- /dev/null +++ b/types/ramda/src/clone.d.ts @@ -0,0 +1,2 @@ +import { clone } from '../index'; +export default clone; diff --git a/types/ramda/src/comparator.d.ts b/types/ramda/src/comparator.d.ts new file mode 100644 index 0000000000..34023dea00 --- /dev/null +++ b/types/ramda/src/comparator.d.ts @@ -0,0 +1,2 @@ +import { comparator } from '../index'; +export default comparator; diff --git a/types/ramda/src/complement.d.ts b/types/ramda/src/complement.d.ts new file mode 100644 index 0000000000..b5d31fee50 --- /dev/null +++ b/types/ramda/src/complement.d.ts @@ -0,0 +1,2 @@ +import { complement } from '../index'; +export default complement; diff --git a/types/ramda/src/compose.d.ts b/types/ramda/src/compose.d.ts new file mode 100644 index 0000000000..dca4578840 --- /dev/null +++ b/types/ramda/src/compose.d.ts @@ -0,0 +1,2 @@ +import { compose } from '../index'; +export default compose; diff --git a/types/ramda/src/composeK.d.ts b/types/ramda/src/composeK.d.ts new file mode 100644 index 0000000000..646005a0b6 --- /dev/null +++ b/types/ramda/src/composeK.d.ts @@ -0,0 +1,2 @@ +import { composeK } from '../index'; +export default composeK; diff --git a/types/ramda/src/composeP.d.ts b/types/ramda/src/composeP.d.ts new file mode 100644 index 0000000000..ca0a96fb25 --- /dev/null +++ b/types/ramda/src/composeP.d.ts @@ -0,0 +1,2 @@ +import { composeP } from '../index'; +export default composeP; diff --git a/types/ramda/src/composeWith.d.ts b/types/ramda/src/composeWith.d.ts new file mode 100644 index 0000000000..fbde7d67ad --- /dev/null +++ b/types/ramda/src/composeWith.d.ts @@ -0,0 +1,2 @@ +import { composeWith } from '../index'; +export default composeWith; diff --git a/types/ramda/src/concat.d.ts b/types/ramda/src/concat.d.ts new file mode 100644 index 0000000000..9ae333cf95 --- /dev/null +++ b/types/ramda/src/concat.d.ts @@ -0,0 +1,2 @@ +import { concat } from '../index'; +export default concat; diff --git a/types/ramda/src/cond.d.ts b/types/ramda/src/cond.d.ts new file mode 100644 index 0000000000..0ab4930b0e --- /dev/null +++ b/types/ramda/src/cond.d.ts @@ -0,0 +1,2 @@ +import { cond } from '../index'; +export default cond; diff --git a/types/ramda/src/construct.d.ts b/types/ramda/src/construct.d.ts new file mode 100644 index 0000000000..736871cb61 --- /dev/null +++ b/types/ramda/src/construct.d.ts @@ -0,0 +1,2 @@ +import { construct } from '../index'; +export default construct; diff --git a/types/ramda/src/constructN.d.ts b/types/ramda/src/constructN.d.ts new file mode 100644 index 0000000000..d9efc76cf3 --- /dev/null +++ b/types/ramda/src/constructN.d.ts @@ -0,0 +1,2 @@ +import { constructN } from '../index'; +export default constructN; diff --git a/types/ramda/src/contains.d.ts b/types/ramda/src/contains.d.ts new file mode 100644 index 0000000000..d193bc6109 --- /dev/null +++ b/types/ramda/src/contains.d.ts @@ -0,0 +1,2 @@ +import { contains } from '../index'; +export default contains; diff --git a/types/ramda/src/converge.d.ts b/types/ramda/src/converge.d.ts new file mode 100644 index 0000000000..181c0bd7e9 --- /dev/null +++ b/types/ramda/src/converge.d.ts @@ -0,0 +1,2 @@ +import { converge } from '../index'; +export default converge; diff --git a/types/ramda/src/countBy.d.ts b/types/ramda/src/countBy.d.ts new file mode 100644 index 0000000000..03d46e23f0 --- /dev/null +++ b/types/ramda/src/countBy.d.ts @@ -0,0 +1,2 @@ +import { countBy } from '../index'; +export default countBy; diff --git a/types/ramda/src/curry.d.ts b/types/ramda/src/curry.d.ts new file mode 100644 index 0000000000..0d94abf560 --- /dev/null +++ b/types/ramda/src/curry.d.ts @@ -0,0 +1,2 @@ +import { curry } from '../index'; +export default curry; diff --git a/types/ramda/src/curryN.d.ts b/types/ramda/src/curryN.d.ts new file mode 100644 index 0000000000..dca634c3b8 --- /dev/null +++ b/types/ramda/src/curryN.d.ts @@ -0,0 +1,2 @@ +import { curryN } from '../index'; +export default curryN; diff --git a/types/ramda/src/dec.d.ts b/types/ramda/src/dec.d.ts new file mode 100644 index 0000000000..605681f0d8 --- /dev/null +++ b/types/ramda/src/dec.d.ts @@ -0,0 +1,2 @@ +import { dec } from '../index'; +export default dec; diff --git a/types/ramda/src/defaultTo.d.ts b/types/ramda/src/defaultTo.d.ts new file mode 100644 index 0000000000..9c61199544 --- /dev/null +++ b/types/ramda/src/defaultTo.d.ts @@ -0,0 +1,2 @@ +import { defaultTo } from '../index'; +export default defaultTo; diff --git a/types/ramda/src/descend.d.ts b/types/ramda/src/descend.d.ts new file mode 100644 index 0000000000..d0ff2b6d54 --- /dev/null +++ b/types/ramda/src/descend.d.ts @@ -0,0 +1,2 @@ +import { descend } from '../index'; +export default descend; diff --git a/types/ramda/src/difference.d.ts b/types/ramda/src/difference.d.ts new file mode 100644 index 0000000000..1ef0096735 --- /dev/null +++ b/types/ramda/src/difference.d.ts @@ -0,0 +1,2 @@ +import { difference } from '../index'; +export default difference; diff --git a/types/ramda/src/differenceWith.d.ts b/types/ramda/src/differenceWith.d.ts new file mode 100644 index 0000000000..5a2366f6e0 --- /dev/null +++ b/types/ramda/src/differenceWith.d.ts @@ -0,0 +1,2 @@ +import { differenceWith } from '../index'; +export default differenceWith; diff --git a/types/ramda/src/dissoc.d.ts b/types/ramda/src/dissoc.d.ts new file mode 100644 index 0000000000..0ed3e2def9 --- /dev/null +++ b/types/ramda/src/dissoc.d.ts @@ -0,0 +1,2 @@ +import { dissoc } from '../index'; +export default dissoc; diff --git a/types/ramda/src/dissocPath.d.ts b/types/ramda/src/dissocPath.d.ts new file mode 100644 index 0000000000..83c705d80f --- /dev/null +++ b/types/ramda/src/dissocPath.d.ts @@ -0,0 +1,2 @@ +import { dissocPath } from '../index'; +export default dissocPath; diff --git a/types/ramda/src/divide.d.ts b/types/ramda/src/divide.d.ts new file mode 100644 index 0000000000..45c27a4d21 --- /dev/null +++ b/types/ramda/src/divide.d.ts @@ -0,0 +1,2 @@ +import { divide } from '../index'; +export default divide; diff --git a/types/ramda/src/drop.d.ts b/types/ramda/src/drop.d.ts new file mode 100644 index 0000000000..fb89bef7f0 --- /dev/null +++ b/types/ramda/src/drop.d.ts @@ -0,0 +1,2 @@ +import { drop } from '../index'; +export default drop; diff --git a/types/ramda/src/dropLast.d.ts b/types/ramda/src/dropLast.d.ts new file mode 100644 index 0000000000..2402f890f1 --- /dev/null +++ b/types/ramda/src/dropLast.d.ts @@ -0,0 +1,2 @@ +import { dropLast } from '../index'; +export default dropLast; diff --git a/types/ramda/src/dropLastWhile.d.ts b/types/ramda/src/dropLastWhile.d.ts new file mode 100644 index 0000000000..82950dd98b --- /dev/null +++ b/types/ramda/src/dropLastWhile.d.ts @@ -0,0 +1,2 @@ +import { dropLastWhile } from '../index'; +export default dropLastWhile; diff --git a/types/ramda/src/dropRepeats.d.ts b/types/ramda/src/dropRepeats.d.ts new file mode 100644 index 0000000000..dc88dea52e --- /dev/null +++ b/types/ramda/src/dropRepeats.d.ts @@ -0,0 +1,2 @@ +import { dropRepeats } from '../index'; +export default dropRepeats; diff --git a/types/ramda/src/dropRepeatsWith.d.ts b/types/ramda/src/dropRepeatsWith.d.ts new file mode 100644 index 0000000000..c6fb6c4883 --- /dev/null +++ b/types/ramda/src/dropRepeatsWith.d.ts @@ -0,0 +1,2 @@ +import { dropRepeatsWith } from '../index'; +export default dropRepeatsWith; diff --git a/types/ramda/src/either.d.ts b/types/ramda/src/either.d.ts new file mode 100644 index 0000000000..130f0c4e7f --- /dev/null +++ b/types/ramda/src/either.d.ts @@ -0,0 +1,2 @@ +import { either } from '../index'; +export default either; diff --git a/types/ramda/src/empty.d.ts b/types/ramda/src/empty.d.ts new file mode 100644 index 0000000000..2cb6e8fade --- /dev/null +++ b/types/ramda/src/empty.d.ts @@ -0,0 +1,2 @@ +import { empty } from '../index'; +export default empty; diff --git a/types/ramda/src/endsWith.d.ts b/types/ramda/src/endsWith.d.ts new file mode 100644 index 0000000000..f23a961bbc --- /dev/null +++ b/types/ramda/src/endsWith.d.ts @@ -0,0 +1,2 @@ +import { endsWith } from '../index'; +export default endsWith; diff --git a/types/ramda/src/eqBy.d.ts b/types/ramda/src/eqBy.d.ts new file mode 100644 index 0000000000..3ed508587a --- /dev/null +++ b/types/ramda/src/eqBy.d.ts @@ -0,0 +1,2 @@ +import { eqBy } from '../index'; +export default eqBy; diff --git a/types/ramda/src/eqProps.d.ts b/types/ramda/src/eqProps.d.ts new file mode 100644 index 0000000000..e33b163311 --- /dev/null +++ b/types/ramda/src/eqProps.d.ts @@ -0,0 +1,2 @@ +import { eqProps } from '../index'; +export default eqProps; diff --git a/types/ramda/src/equals.d.ts b/types/ramda/src/equals.d.ts new file mode 100644 index 0000000000..6d4c8050e1 --- /dev/null +++ b/types/ramda/src/equals.d.ts @@ -0,0 +1,2 @@ +import { equals } from '../index'; +export default equals; diff --git a/types/ramda/src/evolve.d.ts b/types/ramda/src/evolve.d.ts new file mode 100644 index 0000000000..21ec9896a3 --- /dev/null +++ b/types/ramda/src/evolve.d.ts @@ -0,0 +1,2 @@ +import { evolve } from '../index'; +export default evolve; diff --git a/types/ramda/src/filter.d.ts b/types/ramda/src/filter.d.ts new file mode 100644 index 0000000000..a4f7133638 --- /dev/null +++ b/types/ramda/src/filter.d.ts @@ -0,0 +1,2 @@ +import { filter } from '../index'; +export default filter; diff --git a/types/ramda/src/find.d.ts b/types/ramda/src/find.d.ts new file mode 100644 index 0000000000..a8c2905bed --- /dev/null +++ b/types/ramda/src/find.d.ts @@ -0,0 +1,2 @@ +import { find } from '../index'; +export default find; diff --git a/types/ramda/src/findIndex.d.ts b/types/ramda/src/findIndex.d.ts new file mode 100644 index 0000000000..88c14e28fc --- /dev/null +++ b/types/ramda/src/findIndex.d.ts @@ -0,0 +1,2 @@ +import { findIndex } from '../index'; +export default findIndex; diff --git a/types/ramda/src/findLast.d.ts b/types/ramda/src/findLast.d.ts new file mode 100644 index 0000000000..3d8ad5c7fa --- /dev/null +++ b/types/ramda/src/findLast.d.ts @@ -0,0 +1,2 @@ +import { findLast } from '../index'; +export default findLast; diff --git a/types/ramda/src/findLastIndex.d.ts b/types/ramda/src/findLastIndex.d.ts new file mode 100644 index 0000000000..ae1edaeb14 --- /dev/null +++ b/types/ramda/src/findLastIndex.d.ts @@ -0,0 +1,2 @@ +import { findLastIndex } from '../index'; +export default findLastIndex; diff --git a/types/ramda/src/flatten.d.ts b/types/ramda/src/flatten.d.ts new file mode 100644 index 0000000000..75a19402dc --- /dev/null +++ b/types/ramda/src/flatten.d.ts @@ -0,0 +1,2 @@ +import { flatten } from '../index'; +export default flatten; diff --git a/types/ramda/src/flip.d.ts b/types/ramda/src/flip.d.ts new file mode 100644 index 0000000000..164e607f33 --- /dev/null +++ b/types/ramda/src/flip.d.ts @@ -0,0 +1,2 @@ +import { flip } from '../index'; +export default flip; diff --git a/types/ramda/src/forEach.d.ts b/types/ramda/src/forEach.d.ts new file mode 100644 index 0000000000..c5f7a57837 --- /dev/null +++ b/types/ramda/src/forEach.d.ts @@ -0,0 +1,2 @@ +import { forEach } from '../index'; +export default forEach; diff --git a/types/ramda/src/forEachObjIndexed.d.ts b/types/ramda/src/forEachObjIndexed.d.ts new file mode 100644 index 0000000000..a098026381 --- /dev/null +++ b/types/ramda/src/forEachObjIndexed.d.ts @@ -0,0 +1,2 @@ +import { forEachObjIndexed } from '../index'; +export default forEachObjIndexed; diff --git a/types/ramda/src/fromPairs.d.ts b/types/ramda/src/fromPairs.d.ts new file mode 100644 index 0000000000..0cb1778350 --- /dev/null +++ b/types/ramda/src/fromPairs.d.ts @@ -0,0 +1,2 @@ +import { fromPairs } from '../index'; +export default fromPairs; diff --git a/types/ramda/src/groupBy.d.ts b/types/ramda/src/groupBy.d.ts new file mode 100644 index 0000000000..af2b32083b --- /dev/null +++ b/types/ramda/src/groupBy.d.ts @@ -0,0 +1,2 @@ +import { groupBy } from '../index'; +export default groupBy; diff --git a/types/ramda/src/groupWith.d.ts b/types/ramda/src/groupWith.d.ts new file mode 100644 index 0000000000..f9dca6c16b --- /dev/null +++ b/types/ramda/src/groupWith.d.ts @@ -0,0 +1,2 @@ +import { groupWith } from '../index'; +export default groupWith; diff --git a/types/ramda/src/gt.d.ts b/types/ramda/src/gt.d.ts new file mode 100644 index 0000000000..4cdb70d336 --- /dev/null +++ b/types/ramda/src/gt.d.ts @@ -0,0 +1,2 @@ +import { gt } from '../index'; +export default gt; diff --git a/types/ramda/src/gte.d.ts b/types/ramda/src/gte.d.ts new file mode 100644 index 0000000000..2b878eabc6 --- /dev/null +++ b/types/ramda/src/gte.d.ts @@ -0,0 +1,2 @@ +import { gte } from '../index'; +export default gte; diff --git a/types/ramda/src/has.d.ts b/types/ramda/src/has.d.ts new file mode 100644 index 0000000000..88c79bfdb0 --- /dev/null +++ b/types/ramda/src/has.d.ts @@ -0,0 +1,2 @@ +import { has } from '../index'; +export default has; diff --git a/types/ramda/src/hasIn.d.ts b/types/ramda/src/hasIn.d.ts new file mode 100644 index 0000000000..4cad709e64 --- /dev/null +++ b/types/ramda/src/hasIn.d.ts @@ -0,0 +1,2 @@ +import { hasIn } from '../index'; +export default hasIn; diff --git a/types/ramda/src/hasPath.d.ts b/types/ramda/src/hasPath.d.ts new file mode 100644 index 0000000000..0654145350 --- /dev/null +++ b/types/ramda/src/hasPath.d.ts @@ -0,0 +1,2 @@ +import { hasPath } from '../index'; +export default hasPath; diff --git a/types/ramda/src/head.d.ts b/types/ramda/src/head.d.ts new file mode 100644 index 0000000000..bb1f3dd7b9 --- /dev/null +++ b/types/ramda/src/head.d.ts @@ -0,0 +1,2 @@ +import { head } from '../index'; +export default head; diff --git a/types/ramda/src/identical.d.ts b/types/ramda/src/identical.d.ts new file mode 100644 index 0000000000..6f2ccf4f94 --- /dev/null +++ b/types/ramda/src/identical.d.ts @@ -0,0 +1,2 @@ +import { identical } from '../index'; +export default identical; diff --git a/types/ramda/src/identity.d.ts b/types/ramda/src/identity.d.ts new file mode 100644 index 0000000000..ba0936116e --- /dev/null +++ b/types/ramda/src/identity.d.ts @@ -0,0 +1,2 @@ +import { identity } from '../index'; +export default identity; diff --git a/types/ramda/src/ifElse.d.ts b/types/ramda/src/ifElse.d.ts new file mode 100644 index 0000000000..46674829d7 --- /dev/null +++ b/types/ramda/src/ifElse.d.ts @@ -0,0 +1,2 @@ +import { ifElse } from '../index'; +export default ifElse; diff --git a/types/ramda/src/inc.d.ts b/types/ramda/src/inc.d.ts new file mode 100644 index 0000000000..c173b2dd8e --- /dev/null +++ b/types/ramda/src/inc.d.ts @@ -0,0 +1,2 @@ +import { inc } from '../index'; +export default inc; diff --git a/types/ramda/src/includes.d.ts b/types/ramda/src/includes.d.ts new file mode 100644 index 0000000000..b6b04d949f --- /dev/null +++ b/types/ramda/src/includes.d.ts @@ -0,0 +1,2 @@ +import { includes } from '../index'; +export default includes; diff --git a/types/ramda/src/indexBy.d.ts b/types/ramda/src/indexBy.d.ts new file mode 100644 index 0000000000..93b29ec7cd --- /dev/null +++ b/types/ramda/src/indexBy.d.ts @@ -0,0 +1,2 @@ +import { indexBy } from '../index'; +export default indexBy; diff --git a/types/ramda/src/indexOf.d.ts b/types/ramda/src/indexOf.d.ts new file mode 100644 index 0000000000..22aa4b44db --- /dev/null +++ b/types/ramda/src/indexOf.d.ts @@ -0,0 +1,2 @@ +import { indexOf } from '../index'; +export default indexOf; diff --git a/types/ramda/src/init.d.ts b/types/ramda/src/init.d.ts new file mode 100644 index 0000000000..03849db7b0 --- /dev/null +++ b/types/ramda/src/init.d.ts @@ -0,0 +1,2 @@ +import { init } from '../index'; +export default init; diff --git a/types/ramda/src/innerJoin.d.ts b/types/ramda/src/innerJoin.d.ts new file mode 100644 index 0000000000..de01332837 --- /dev/null +++ b/types/ramda/src/innerJoin.d.ts @@ -0,0 +1,2 @@ +import { innerJoin } from '../index'; +export default innerJoin; diff --git a/types/ramda/src/insert.d.ts b/types/ramda/src/insert.d.ts new file mode 100644 index 0000000000..3fdde857fa --- /dev/null +++ b/types/ramda/src/insert.d.ts @@ -0,0 +1,2 @@ +import { insert } from '../index'; +export default insert; diff --git a/types/ramda/src/insertAll.d.ts b/types/ramda/src/insertAll.d.ts new file mode 100644 index 0000000000..a9fd784995 --- /dev/null +++ b/types/ramda/src/insertAll.d.ts @@ -0,0 +1,2 @@ +import { insertAll } from '../index'; +export default insertAll; diff --git a/types/ramda/src/intersection.d.ts b/types/ramda/src/intersection.d.ts new file mode 100644 index 0000000000..1ec1aadbe4 --- /dev/null +++ b/types/ramda/src/intersection.d.ts @@ -0,0 +1,2 @@ +import { intersection } from '../index'; +export default intersection; diff --git a/types/ramda/src/intersectionWith.d.ts b/types/ramda/src/intersectionWith.d.ts new file mode 100644 index 0000000000..773c36acbe --- /dev/null +++ b/types/ramda/src/intersectionWith.d.ts @@ -0,0 +1,2 @@ +import { intersectionWith } from '../index'; +export default intersectionWith; diff --git a/types/ramda/src/intersperse.d.ts b/types/ramda/src/intersperse.d.ts new file mode 100644 index 0000000000..b4420de34a --- /dev/null +++ b/types/ramda/src/intersperse.d.ts @@ -0,0 +1,2 @@ +import { intersperse } from '../index'; +export default intersperse; diff --git a/types/ramda/src/into.d.ts b/types/ramda/src/into.d.ts new file mode 100644 index 0000000000..3daa53afdd --- /dev/null +++ b/types/ramda/src/into.d.ts @@ -0,0 +1,2 @@ +import { into } from '../index'; +export default into; diff --git a/types/ramda/src/invert.d.ts b/types/ramda/src/invert.d.ts new file mode 100644 index 0000000000..825773f5dc --- /dev/null +++ b/types/ramda/src/invert.d.ts @@ -0,0 +1,2 @@ +import { invert } from '../index'; +export default invert; diff --git a/types/ramda/src/invertObj.d.ts b/types/ramda/src/invertObj.d.ts new file mode 100644 index 0000000000..8fd0f1fe7d --- /dev/null +++ b/types/ramda/src/invertObj.d.ts @@ -0,0 +1,2 @@ +import { invertObj } from '../index'; +export default invertObj; diff --git a/types/ramda/src/invoker.d.ts b/types/ramda/src/invoker.d.ts new file mode 100644 index 0000000000..1930a78917 --- /dev/null +++ b/types/ramda/src/invoker.d.ts @@ -0,0 +1,2 @@ +import { invoker } from '../index'; +export default invoker; diff --git a/types/ramda/src/is.d.ts b/types/ramda/src/is.d.ts new file mode 100644 index 0000000000..262d14160d --- /dev/null +++ b/types/ramda/src/is.d.ts @@ -0,0 +1,2 @@ +import { is } from '../index'; +export default is; diff --git a/types/ramda/src/isArrayLike.d.ts b/types/ramda/src/isArrayLike.d.ts new file mode 100644 index 0000000000..04aa464805 --- /dev/null +++ b/types/ramda/src/isArrayLike.d.ts @@ -0,0 +1,2 @@ +import { isArrayLike } from '../index'; +export default isArrayLike; diff --git a/types/ramda/src/isEmpty.d.ts b/types/ramda/src/isEmpty.d.ts new file mode 100644 index 0000000000..bea7bb8d08 --- /dev/null +++ b/types/ramda/src/isEmpty.d.ts @@ -0,0 +1,2 @@ +import { isEmpty } from '../index'; +export default isEmpty; diff --git a/types/ramda/src/isNaN.d.ts b/types/ramda/src/isNaN.d.ts new file mode 100644 index 0000000000..5dbe28177a --- /dev/null +++ b/types/ramda/src/isNaN.d.ts @@ -0,0 +1,2 @@ +import { isNaN } from '../index'; +export default isNaN; diff --git a/types/ramda/src/isNil.d.ts b/types/ramda/src/isNil.d.ts new file mode 100644 index 0000000000..bce78e7c70 --- /dev/null +++ b/types/ramda/src/isNil.d.ts @@ -0,0 +1,2 @@ +import { isNil } from '../index'; +export default isNil; diff --git a/types/ramda/src/join.d.ts b/types/ramda/src/join.d.ts new file mode 100644 index 0000000000..7505b7e769 --- /dev/null +++ b/types/ramda/src/join.d.ts @@ -0,0 +1,2 @@ +import { join } from '../index'; +export default join; diff --git a/types/ramda/src/juxt.d.ts b/types/ramda/src/juxt.d.ts new file mode 100644 index 0000000000..23e342f53d --- /dev/null +++ b/types/ramda/src/juxt.d.ts @@ -0,0 +1,2 @@ +import { juxt } from '../index'; +export default juxt; diff --git a/types/ramda/src/keys.d.ts b/types/ramda/src/keys.d.ts new file mode 100644 index 0000000000..b44e894b7a --- /dev/null +++ b/types/ramda/src/keys.d.ts @@ -0,0 +1,2 @@ +import { keys } from '../index'; +export default keys; diff --git a/types/ramda/src/keysIn.d.ts b/types/ramda/src/keysIn.d.ts new file mode 100644 index 0000000000..a54fb92a6d --- /dev/null +++ b/types/ramda/src/keysIn.d.ts @@ -0,0 +1,2 @@ +import { keysIn } from '../index'; +export default keysIn; diff --git a/types/ramda/src/last.d.ts b/types/ramda/src/last.d.ts new file mode 100644 index 0000000000..f8ea740735 --- /dev/null +++ b/types/ramda/src/last.d.ts @@ -0,0 +1,2 @@ +import { last } from '../index'; +export default last; diff --git a/types/ramda/src/lastIndexOf.d.ts b/types/ramda/src/lastIndexOf.d.ts new file mode 100644 index 0000000000..c34fe55a03 --- /dev/null +++ b/types/ramda/src/lastIndexOf.d.ts @@ -0,0 +1,2 @@ +import { lastIndexOf } from '../index'; +export default lastIndexOf; diff --git a/types/ramda/src/length.d.ts b/types/ramda/src/length.d.ts new file mode 100644 index 0000000000..7ef1d90dd5 --- /dev/null +++ b/types/ramda/src/length.d.ts @@ -0,0 +1,2 @@ +import { length } from '../index'; +export default length; diff --git a/types/ramda/src/lens.d.ts b/types/ramda/src/lens.d.ts new file mode 100644 index 0000000000..03688e0c4f --- /dev/null +++ b/types/ramda/src/lens.d.ts @@ -0,0 +1,2 @@ +import { lens } from '../index'; +export default lens; diff --git a/types/ramda/src/lensIndex.d.ts b/types/ramda/src/lensIndex.d.ts new file mode 100644 index 0000000000..d85cd88c2f --- /dev/null +++ b/types/ramda/src/lensIndex.d.ts @@ -0,0 +1,2 @@ +import { lensIndex } from '../index'; +export default lensIndex; diff --git a/types/ramda/src/lensPath.d.ts b/types/ramda/src/lensPath.d.ts new file mode 100644 index 0000000000..67b60fbf3c --- /dev/null +++ b/types/ramda/src/lensPath.d.ts @@ -0,0 +1,2 @@ +import { lensPath } from '../index'; +export default lensPath; diff --git a/types/ramda/src/lensProp.d.ts b/types/ramda/src/lensProp.d.ts new file mode 100644 index 0000000000..fc8db9e32d --- /dev/null +++ b/types/ramda/src/lensProp.d.ts @@ -0,0 +1,2 @@ +import { lensProp } from '../index'; +export default lensProp; diff --git a/types/ramda/src/lift.d.ts b/types/ramda/src/lift.d.ts new file mode 100644 index 0000000000..73e4cba184 --- /dev/null +++ b/types/ramda/src/lift.d.ts @@ -0,0 +1,2 @@ +import { lift } from '../index'; +export default lift; diff --git a/types/ramda/src/lt.d.ts b/types/ramda/src/lt.d.ts new file mode 100644 index 0000000000..71360d1c43 --- /dev/null +++ b/types/ramda/src/lt.d.ts @@ -0,0 +1,2 @@ +import { lt } from '../index'; +export default lt; diff --git a/types/ramda/src/lte.d.ts b/types/ramda/src/lte.d.ts new file mode 100644 index 0000000000..980ef22037 --- /dev/null +++ b/types/ramda/src/lte.d.ts @@ -0,0 +1,2 @@ +import { lte } from '../index'; +export default lte; diff --git a/types/ramda/src/map.d.ts b/types/ramda/src/map.d.ts new file mode 100644 index 0000000000..6883cb62f6 --- /dev/null +++ b/types/ramda/src/map.d.ts @@ -0,0 +1,2 @@ +import { map } from '../index'; +export default map; diff --git a/types/ramda/src/mapAccum.d.ts b/types/ramda/src/mapAccum.d.ts new file mode 100644 index 0000000000..356c715787 --- /dev/null +++ b/types/ramda/src/mapAccum.d.ts @@ -0,0 +1,2 @@ +import { mapAccum } from '../index'; +export default mapAccum; diff --git a/types/ramda/src/mapAccumRight.d.ts b/types/ramda/src/mapAccumRight.d.ts new file mode 100644 index 0000000000..817e73bb97 --- /dev/null +++ b/types/ramda/src/mapAccumRight.d.ts @@ -0,0 +1,2 @@ +import { mapAccumRight } from '../index'; +export default mapAccumRight; diff --git a/types/ramda/src/mapObjIndexed.d.ts b/types/ramda/src/mapObjIndexed.d.ts new file mode 100644 index 0000000000..3ef1eca52d --- /dev/null +++ b/types/ramda/src/mapObjIndexed.d.ts @@ -0,0 +1,2 @@ +import { mapObjIndexed } from '../index'; +export default mapObjIndexed; diff --git a/types/ramda/src/match.d.ts b/types/ramda/src/match.d.ts new file mode 100644 index 0000000000..a24f0bd6d0 --- /dev/null +++ b/types/ramda/src/match.d.ts @@ -0,0 +1,2 @@ +import { match } from '../index'; +export default match; diff --git a/types/ramda/src/mathMod.d.ts b/types/ramda/src/mathMod.d.ts new file mode 100644 index 0000000000..0b0205c822 --- /dev/null +++ b/types/ramda/src/mathMod.d.ts @@ -0,0 +1,2 @@ +import { mathMod } from '../index'; +export default mathMod; diff --git a/types/ramda/src/max.d.ts b/types/ramda/src/max.d.ts new file mode 100644 index 0000000000..fcb09338c0 --- /dev/null +++ b/types/ramda/src/max.d.ts @@ -0,0 +1,2 @@ +import { max } from '../index'; +export default max; diff --git a/types/ramda/src/maxBy.d.ts b/types/ramda/src/maxBy.d.ts new file mode 100644 index 0000000000..4d00e7e572 --- /dev/null +++ b/types/ramda/src/maxBy.d.ts @@ -0,0 +1,2 @@ +import { maxBy } from '../index'; +export default maxBy; diff --git a/types/ramda/src/mean.d.ts b/types/ramda/src/mean.d.ts new file mode 100644 index 0000000000..8babcc3374 --- /dev/null +++ b/types/ramda/src/mean.d.ts @@ -0,0 +1,2 @@ +import { mean } from '../index'; +export default mean; diff --git a/types/ramda/src/median.d.ts b/types/ramda/src/median.d.ts new file mode 100644 index 0000000000..f7386692ff --- /dev/null +++ b/types/ramda/src/median.d.ts @@ -0,0 +1,2 @@ +import { median } from '../index'; +export default median; diff --git a/types/ramda/src/memoizeWith.d.ts b/types/ramda/src/memoizeWith.d.ts new file mode 100644 index 0000000000..8eb2abd416 --- /dev/null +++ b/types/ramda/src/memoizeWith.d.ts @@ -0,0 +1,2 @@ +import { memoizeWith } from '../index'; +export default memoizeWith; diff --git a/types/ramda/src/merge.d.ts b/types/ramda/src/merge.d.ts new file mode 100644 index 0000000000..9786c2b611 --- /dev/null +++ b/types/ramda/src/merge.d.ts @@ -0,0 +1,2 @@ +import { merge } from '../index'; +export default merge; diff --git a/types/ramda/src/mergeAll.d.ts b/types/ramda/src/mergeAll.d.ts new file mode 100644 index 0000000000..8bb141f82f --- /dev/null +++ b/types/ramda/src/mergeAll.d.ts @@ -0,0 +1,2 @@ +import { mergeAll } from '../index'; +export default mergeAll; diff --git a/types/ramda/src/mergeDeepLeft.d.ts b/types/ramda/src/mergeDeepLeft.d.ts new file mode 100644 index 0000000000..332df578d3 --- /dev/null +++ b/types/ramda/src/mergeDeepLeft.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepLeft } from '../index'; +export default mergeDeepLeft; diff --git a/types/ramda/src/mergeDeepRight.d.ts b/types/ramda/src/mergeDeepRight.d.ts new file mode 100644 index 0000000000..c589924ca5 --- /dev/null +++ b/types/ramda/src/mergeDeepRight.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepRight } from '../index'; +export default mergeDeepRight; diff --git a/types/ramda/src/mergeDeepWith.d.ts b/types/ramda/src/mergeDeepWith.d.ts new file mode 100644 index 0000000000..cd5523b224 --- /dev/null +++ b/types/ramda/src/mergeDeepWith.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepWith } from '../index'; +export default mergeDeepWith; diff --git a/types/ramda/src/mergeDeepWithKey.d.ts b/types/ramda/src/mergeDeepWithKey.d.ts new file mode 100644 index 0000000000..70f6ace1db --- /dev/null +++ b/types/ramda/src/mergeDeepWithKey.d.ts @@ -0,0 +1,2 @@ +import { mergeDeepWithKey } from '../index'; +export default mergeDeepWithKey; diff --git a/types/ramda/src/mergeLeft.d.ts b/types/ramda/src/mergeLeft.d.ts new file mode 100644 index 0000000000..8af61d3d19 --- /dev/null +++ b/types/ramda/src/mergeLeft.d.ts @@ -0,0 +1,2 @@ +import { mergeLeft } from '../index'; +export default mergeLeft; diff --git a/types/ramda/src/mergeRight.d.ts b/types/ramda/src/mergeRight.d.ts new file mode 100644 index 0000000000..884165f20f --- /dev/null +++ b/types/ramda/src/mergeRight.d.ts @@ -0,0 +1,2 @@ +import { mergeRight } from '../index'; +export default mergeRight; diff --git a/types/ramda/src/mergeWith.d.ts b/types/ramda/src/mergeWith.d.ts new file mode 100644 index 0000000000..0270c71977 --- /dev/null +++ b/types/ramda/src/mergeWith.d.ts @@ -0,0 +1,2 @@ +import { mergeWith } from '../index'; +export default mergeWith; diff --git a/types/ramda/src/mergeWithKey.d.ts b/types/ramda/src/mergeWithKey.d.ts new file mode 100644 index 0000000000..b32e625cfc --- /dev/null +++ b/types/ramda/src/mergeWithKey.d.ts @@ -0,0 +1,2 @@ +import { mergeWithKey } from '../index'; +export default mergeWithKey; diff --git a/types/ramda/src/min.d.ts b/types/ramda/src/min.d.ts new file mode 100644 index 0000000000..af0dca8faa --- /dev/null +++ b/types/ramda/src/min.d.ts @@ -0,0 +1,2 @@ +import { min } from '../index'; +export default min; diff --git a/types/ramda/src/minBy.d.ts b/types/ramda/src/minBy.d.ts new file mode 100644 index 0000000000..14377eea93 --- /dev/null +++ b/types/ramda/src/minBy.d.ts @@ -0,0 +1,2 @@ +import { minBy } from '../index'; +export default minBy; diff --git a/types/ramda/src/modulo.d.ts b/types/ramda/src/modulo.d.ts new file mode 100644 index 0000000000..4c32f3ce8f --- /dev/null +++ b/types/ramda/src/modulo.d.ts @@ -0,0 +1,2 @@ +import { modulo } from '../index'; +export default modulo; diff --git a/types/ramda/src/move.d.ts b/types/ramda/src/move.d.ts new file mode 100644 index 0000000000..3df4ee626e --- /dev/null +++ b/types/ramda/src/move.d.ts @@ -0,0 +1,2 @@ +import { move } from '../index'; +export default move; diff --git a/types/ramda/src/multiply.d.ts b/types/ramda/src/multiply.d.ts new file mode 100644 index 0000000000..56d3a59380 --- /dev/null +++ b/types/ramda/src/multiply.d.ts @@ -0,0 +1,2 @@ +import { multiply } from '../index'; +export default multiply; diff --git a/types/ramda/src/nAry.d.ts b/types/ramda/src/nAry.d.ts new file mode 100644 index 0000000000..a9bce85047 --- /dev/null +++ b/types/ramda/src/nAry.d.ts @@ -0,0 +1,2 @@ +import { nAry } from '../index'; +export default nAry; diff --git a/types/ramda/src/negate.d.ts b/types/ramda/src/negate.d.ts new file mode 100644 index 0000000000..8410d94a22 --- /dev/null +++ b/types/ramda/src/negate.d.ts @@ -0,0 +1,2 @@ +import { negate } from '../index'; +export default negate; diff --git a/types/ramda/src/none.d.ts b/types/ramda/src/none.d.ts new file mode 100644 index 0000000000..6c545e7261 --- /dev/null +++ b/types/ramda/src/none.d.ts @@ -0,0 +1,2 @@ +import { none } from '../index'; +export default none; diff --git a/types/ramda/src/not.d.ts b/types/ramda/src/not.d.ts new file mode 100644 index 0000000000..10c4c56cfc --- /dev/null +++ b/types/ramda/src/not.d.ts @@ -0,0 +1,2 @@ +import { not } from '../index'; +export default not; diff --git a/types/ramda/src/nth.d.ts b/types/ramda/src/nth.d.ts new file mode 100644 index 0000000000..b5cef1993a --- /dev/null +++ b/types/ramda/src/nth.d.ts @@ -0,0 +1,2 @@ +import { nth } from '../index'; +export default nth; diff --git a/types/ramda/src/nthArg.d.ts b/types/ramda/src/nthArg.d.ts new file mode 100644 index 0000000000..5d61bb24f6 --- /dev/null +++ b/types/ramda/src/nthArg.d.ts @@ -0,0 +1,2 @@ +import { nthArg } from '../index'; +export default nthArg; diff --git a/types/ramda/src/objOf.d.ts b/types/ramda/src/objOf.d.ts new file mode 100644 index 0000000000..0a2b7c3075 --- /dev/null +++ b/types/ramda/src/objOf.d.ts @@ -0,0 +1,2 @@ +import { objOf } from '../index'; +export default objOf; diff --git a/types/ramda/src/of.d.ts b/types/ramda/src/of.d.ts new file mode 100644 index 0000000000..252569b5e6 --- /dev/null +++ b/types/ramda/src/of.d.ts @@ -0,0 +1,2 @@ +import { of } from '../index'; +export default of; diff --git a/types/ramda/src/omit.d.ts b/types/ramda/src/omit.d.ts new file mode 100644 index 0000000000..e7e9f796e9 --- /dev/null +++ b/types/ramda/src/omit.d.ts @@ -0,0 +1,2 @@ +import { omit } from '../index'; +export default omit; diff --git a/types/ramda/src/once.d.ts b/types/ramda/src/once.d.ts new file mode 100644 index 0000000000..f49febf008 --- /dev/null +++ b/types/ramda/src/once.d.ts @@ -0,0 +1,2 @@ +import { once } from '../index'; +export default once; diff --git a/types/ramda/src/or.d.ts b/types/ramda/src/or.d.ts new file mode 100644 index 0000000000..933ca7b2d2 --- /dev/null +++ b/types/ramda/src/or.d.ts @@ -0,0 +1,2 @@ +import { or } from '../index'; +export default or; diff --git a/types/ramda/src/otherwise.d.ts b/types/ramda/src/otherwise.d.ts new file mode 100644 index 0000000000..bbe0539f15 --- /dev/null +++ b/types/ramda/src/otherwise.d.ts @@ -0,0 +1,2 @@ +import { otherwise } from '../index'; +export default otherwise; diff --git a/types/ramda/src/over.d.ts b/types/ramda/src/over.d.ts new file mode 100644 index 0000000000..deee3577da --- /dev/null +++ b/types/ramda/src/over.d.ts @@ -0,0 +1,2 @@ +import { over } from '../index'; +export default over; diff --git a/types/ramda/src/pair.d.ts b/types/ramda/src/pair.d.ts new file mode 100644 index 0000000000..2a1cea9de0 --- /dev/null +++ b/types/ramda/src/pair.d.ts @@ -0,0 +1,2 @@ +import { pair } from '../index'; +export default pair; diff --git a/types/ramda/src/partial.d.ts b/types/ramda/src/partial.d.ts new file mode 100644 index 0000000000..acbb16bac3 --- /dev/null +++ b/types/ramda/src/partial.d.ts @@ -0,0 +1,2 @@ +import { partial } from '../index'; +export default partial; diff --git a/types/ramda/src/partialRight.d.ts b/types/ramda/src/partialRight.d.ts new file mode 100644 index 0000000000..5b3bb4b0fa --- /dev/null +++ b/types/ramda/src/partialRight.d.ts @@ -0,0 +1,2 @@ +import { partialRight } from '../index'; +export default partialRight; diff --git a/types/ramda/src/partition.d.ts b/types/ramda/src/partition.d.ts new file mode 100644 index 0000000000..28086418d7 --- /dev/null +++ b/types/ramda/src/partition.d.ts @@ -0,0 +1,2 @@ +import { partition } from '../index'; +export default partition; diff --git a/types/ramda/src/path.d.ts b/types/ramda/src/path.d.ts new file mode 100644 index 0000000000..edf4fa57b0 --- /dev/null +++ b/types/ramda/src/path.d.ts @@ -0,0 +1,2 @@ +import { path } from '../index'; +export default path; diff --git a/types/ramda/src/pathEq.d.ts b/types/ramda/src/pathEq.d.ts new file mode 100644 index 0000000000..27856ca3bc --- /dev/null +++ b/types/ramda/src/pathEq.d.ts @@ -0,0 +1,2 @@ +import { pathEq } from '../index'; +export default pathEq; diff --git a/types/ramda/src/pathOr.d.ts b/types/ramda/src/pathOr.d.ts new file mode 100644 index 0000000000..1af55adc0c --- /dev/null +++ b/types/ramda/src/pathOr.d.ts @@ -0,0 +1,2 @@ +import { pathOr } from '../index'; +export default pathOr; diff --git a/types/ramda/src/pathSatisfies.d.ts b/types/ramda/src/pathSatisfies.d.ts new file mode 100644 index 0000000000..e2493400a2 --- /dev/null +++ b/types/ramda/src/pathSatisfies.d.ts @@ -0,0 +1,2 @@ +import { pathSatisfies } from '../index'; +export default pathSatisfies; diff --git a/types/ramda/src/pick.d.ts b/types/ramda/src/pick.d.ts new file mode 100644 index 0000000000..67b2477a48 --- /dev/null +++ b/types/ramda/src/pick.d.ts @@ -0,0 +1,2 @@ +import { pick } from '../index'; +export default pick; diff --git a/types/ramda/src/pickAll.d.ts b/types/ramda/src/pickAll.d.ts new file mode 100644 index 0000000000..d7e7719077 --- /dev/null +++ b/types/ramda/src/pickAll.d.ts @@ -0,0 +1,2 @@ +import { pickAll } from '../index'; +export default pickAll; diff --git a/types/ramda/src/pickBy.d.ts b/types/ramda/src/pickBy.d.ts new file mode 100644 index 0000000000..4a047dc4ab --- /dev/null +++ b/types/ramda/src/pickBy.d.ts @@ -0,0 +1,2 @@ +import { pickBy } from '../index'; +export default pickBy; diff --git a/types/ramda/src/pipe.d.ts b/types/ramda/src/pipe.d.ts new file mode 100644 index 0000000000..ef1d61098b --- /dev/null +++ b/types/ramda/src/pipe.d.ts @@ -0,0 +1,2 @@ +import { pipe } from '../index'; +export default pipe; diff --git a/types/ramda/src/pipeK.d.ts b/types/ramda/src/pipeK.d.ts new file mode 100644 index 0000000000..bca50e6fff --- /dev/null +++ b/types/ramda/src/pipeK.d.ts @@ -0,0 +1,2 @@ +import { pipeK } from '../index'; +export default pipeK; diff --git a/types/ramda/src/pipeP.d.ts b/types/ramda/src/pipeP.d.ts new file mode 100644 index 0000000000..c69b96d23c --- /dev/null +++ b/types/ramda/src/pipeP.d.ts @@ -0,0 +1,2 @@ +import { pipeP } from '../index'; +export default pipeP; diff --git a/types/ramda/src/pipeWith.d.ts b/types/ramda/src/pipeWith.d.ts new file mode 100644 index 0000000000..84715cc5b4 --- /dev/null +++ b/types/ramda/src/pipeWith.d.ts @@ -0,0 +1,2 @@ +import { pipeWith } from '../index'; +export default pipeWith; diff --git a/types/ramda/src/pluck.d.ts b/types/ramda/src/pluck.d.ts new file mode 100644 index 0000000000..8bdb4ccbe4 --- /dev/null +++ b/types/ramda/src/pluck.d.ts @@ -0,0 +1,2 @@ +import { pluck } from '../index'; +export default pluck; diff --git a/types/ramda/src/prepend.d.ts b/types/ramda/src/prepend.d.ts new file mode 100644 index 0000000000..9d3fde51b4 --- /dev/null +++ b/types/ramda/src/prepend.d.ts @@ -0,0 +1,2 @@ +import { prepend } from '../index'; +export default prepend; diff --git a/types/ramda/src/product.d.ts b/types/ramda/src/product.d.ts new file mode 100644 index 0000000000..32aed3c0ee --- /dev/null +++ b/types/ramda/src/product.d.ts @@ -0,0 +1,2 @@ +import { product } from '../index'; +export default product; diff --git a/types/ramda/src/project.d.ts b/types/ramda/src/project.d.ts new file mode 100644 index 0000000000..4c1b11c6ed --- /dev/null +++ b/types/ramda/src/project.d.ts @@ -0,0 +1,2 @@ +import { project } from '../index'; +export default project; diff --git a/types/ramda/src/prop.d.ts b/types/ramda/src/prop.d.ts new file mode 100644 index 0000000000..c990b9aca5 --- /dev/null +++ b/types/ramda/src/prop.d.ts @@ -0,0 +1,2 @@ +import { prop } from '../index'; +export default prop; diff --git a/types/ramda/src/propEq.d.ts b/types/ramda/src/propEq.d.ts new file mode 100644 index 0000000000..1e04cb564c --- /dev/null +++ b/types/ramda/src/propEq.d.ts @@ -0,0 +1,2 @@ +import { propEq } from '../index'; +export default propEq; diff --git a/types/ramda/src/propIs.d.ts b/types/ramda/src/propIs.d.ts new file mode 100644 index 0000000000..1be4e6bd04 --- /dev/null +++ b/types/ramda/src/propIs.d.ts @@ -0,0 +1,2 @@ +import { propIs } from '../index'; +export default propIs; diff --git a/types/ramda/src/propOr.d.ts b/types/ramda/src/propOr.d.ts new file mode 100644 index 0000000000..2935d077be --- /dev/null +++ b/types/ramda/src/propOr.d.ts @@ -0,0 +1,2 @@ +import { propOr } from '../index'; +export default propOr; diff --git a/types/ramda/src/propSatisfies.d.ts b/types/ramda/src/propSatisfies.d.ts new file mode 100644 index 0000000000..1b4ff52788 --- /dev/null +++ b/types/ramda/src/propSatisfies.d.ts @@ -0,0 +1,2 @@ +import { propSatisfies } from '../index'; +export default propSatisfies; diff --git a/types/ramda/src/props.d.ts b/types/ramda/src/props.d.ts new file mode 100644 index 0000000000..b856c60b00 --- /dev/null +++ b/types/ramda/src/props.d.ts @@ -0,0 +1,2 @@ +import { props } from '../index'; +export default props; diff --git a/types/ramda/src/range.d.ts b/types/ramda/src/range.d.ts new file mode 100644 index 0000000000..a507ebe4a9 --- /dev/null +++ b/types/ramda/src/range.d.ts @@ -0,0 +1,2 @@ +import { range } from '../index'; +export default range; diff --git a/types/ramda/src/reduce.d.ts b/types/ramda/src/reduce.d.ts new file mode 100644 index 0000000000..eb3b427d00 --- /dev/null +++ b/types/ramda/src/reduce.d.ts @@ -0,0 +1,2 @@ +import { reduce } from '../index'; +export default reduce; diff --git a/types/ramda/src/reduceBy.d.ts b/types/ramda/src/reduceBy.d.ts new file mode 100644 index 0000000000..655c96ef18 --- /dev/null +++ b/types/ramda/src/reduceBy.d.ts @@ -0,0 +1,2 @@ +import { reduceBy } from '../index'; +export default reduceBy; diff --git a/types/ramda/src/reduceRight.d.ts b/types/ramda/src/reduceRight.d.ts new file mode 100644 index 0000000000..3e72f7c309 --- /dev/null +++ b/types/ramda/src/reduceRight.d.ts @@ -0,0 +1,2 @@ +import { reduceRight } from '../index'; +export default reduceRight; diff --git a/types/ramda/src/reduceWhile.d.ts b/types/ramda/src/reduceWhile.d.ts new file mode 100644 index 0000000000..aaa836d38d --- /dev/null +++ b/types/ramda/src/reduceWhile.d.ts @@ -0,0 +1,2 @@ +import { reduceWhile } from '../index'; +export default reduceWhile; diff --git a/types/ramda/src/reduced.d.ts b/types/ramda/src/reduced.d.ts new file mode 100644 index 0000000000..f36739bbe2 --- /dev/null +++ b/types/ramda/src/reduced.d.ts @@ -0,0 +1,2 @@ +import { reduced } from '../index'; +export default reduced; diff --git a/types/ramda/src/reject.d.ts b/types/ramda/src/reject.d.ts new file mode 100644 index 0000000000..600c706f68 --- /dev/null +++ b/types/ramda/src/reject.d.ts @@ -0,0 +1,2 @@ +import { reject } from '../index'; +export default reject; diff --git a/types/ramda/src/remove.d.ts b/types/ramda/src/remove.d.ts new file mode 100644 index 0000000000..023edada47 --- /dev/null +++ b/types/ramda/src/remove.d.ts @@ -0,0 +1,2 @@ +import { remove } from '../index'; +export default remove; diff --git a/types/ramda/src/repeat.d.ts b/types/ramda/src/repeat.d.ts new file mode 100644 index 0000000000..3d8218a1a4 --- /dev/null +++ b/types/ramda/src/repeat.d.ts @@ -0,0 +1,2 @@ +import { repeat } from '../index'; +export default repeat; diff --git a/types/ramda/src/replace.d.ts b/types/ramda/src/replace.d.ts new file mode 100644 index 0000000000..dc735ab2cf --- /dev/null +++ b/types/ramda/src/replace.d.ts @@ -0,0 +1,2 @@ +import { replace } from '../index'; +export default replace; diff --git a/types/ramda/src/reverse.d.ts b/types/ramda/src/reverse.d.ts new file mode 100644 index 0000000000..2d1b2d9390 --- /dev/null +++ b/types/ramda/src/reverse.d.ts @@ -0,0 +1,2 @@ +import { reverse } from '../index'; +export default reverse; diff --git a/types/ramda/src/scan.d.ts b/types/ramda/src/scan.d.ts new file mode 100644 index 0000000000..8971cff9b7 --- /dev/null +++ b/types/ramda/src/scan.d.ts @@ -0,0 +1,2 @@ +import { scan } from '../index'; +export default scan; diff --git a/types/ramda/src/set.d.ts b/types/ramda/src/set.d.ts new file mode 100644 index 0000000000..5023a0b854 --- /dev/null +++ b/types/ramda/src/set.d.ts @@ -0,0 +1,2 @@ +import { set } from '../index'; +export default set; diff --git a/types/ramda/src/slice.d.ts b/types/ramda/src/slice.d.ts new file mode 100644 index 0000000000..6fdc54e59b --- /dev/null +++ b/types/ramda/src/slice.d.ts @@ -0,0 +1,2 @@ +import { slice } from '../index'; +export default slice; diff --git a/types/ramda/src/sort.d.ts b/types/ramda/src/sort.d.ts new file mode 100644 index 0000000000..9f4977e5c5 --- /dev/null +++ b/types/ramda/src/sort.d.ts @@ -0,0 +1,2 @@ +import { sort } from '../index'; +export default sort; diff --git a/types/ramda/src/sortBy.d.ts b/types/ramda/src/sortBy.d.ts new file mode 100644 index 0000000000..ff4eec72f4 --- /dev/null +++ b/types/ramda/src/sortBy.d.ts @@ -0,0 +1,2 @@ +import { sortBy } from '../index'; +export default sortBy; diff --git a/types/ramda/src/sortWith.d.ts b/types/ramda/src/sortWith.d.ts new file mode 100644 index 0000000000..e8e386a2fd --- /dev/null +++ b/types/ramda/src/sortWith.d.ts @@ -0,0 +1,2 @@ +import { sortWith } from '../index'; +export default sortWith; diff --git a/types/ramda/src/split.d.ts b/types/ramda/src/split.d.ts new file mode 100644 index 0000000000..c89a30372b --- /dev/null +++ b/types/ramda/src/split.d.ts @@ -0,0 +1,2 @@ +import { split } from '../index'; +export default split; diff --git a/types/ramda/src/splitAt.d.ts b/types/ramda/src/splitAt.d.ts new file mode 100644 index 0000000000..2f505a21e3 --- /dev/null +++ b/types/ramda/src/splitAt.d.ts @@ -0,0 +1,2 @@ +import { splitAt } from '../index'; +export default splitAt; diff --git a/types/ramda/src/splitEvery.d.ts b/types/ramda/src/splitEvery.d.ts new file mode 100644 index 0000000000..21329e9593 --- /dev/null +++ b/types/ramda/src/splitEvery.d.ts @@ -0,0 +1,2 @@ +import { splitEvery } from '../index'; +export default splitEvery; diff --git a/types/ramda/src/splitWhen.d.ts b/types/ramda/src/splitWhen.d.ts new file mode 100644 index 0000000000..fad94d5bfa --- /dev/null +++ b/types/ramda/src/splitWhen.d.ts @@ -0,0 +1,2 @@ +import { splitWhen } from '../index'; +export default splitWhen; diff --git a/types/ramda/src/startsWith.d.ts b/types/ramda/src/startsWith.d.ts new file mode 100644 index 0000000000..88811ae146 --- /dev/null +++ b/types/ramda/src/startsWith.d.ts @@ -0,0 +1,2 @@ +import { startsWith } from '../index'; +export default startsWith; diff --git a/types/ramda/src/subtract.d.ts b/types/ramda/src/subtract.d.ts new file mode 100644 index 0000000000..2bac6a6c9f --- /dev/null +++ b/types/ramda/src/subtract.d.ts @@ -0,0 +1,2 @@ +import { subtract } from '../index'; +export default subtract; diff --git a/types/ramda/src/sum.d.ts b/types/ramda/src/sum.d.ts new file mode 100644 index 0000000000..5aad66d4e2 --- /dev/null +++ b/types/ramda/src/sum.d.ts @@ -0,0 +1,2 @@ +import { sum } from '../index'; +export default sum; diff --git a/types/ramda/src/symmetricDifference.d.ts b/types/ramda/src/symmetricDifference.d.ts new file mode 100644 index 0000000000..d11802d977 --- /dev/null +++ b/types/ramda/src/symmetricDifference.d.ts @@ -0,0 +1,2 @@ +import { symmetricDifference } from '../index'; +export default symmetricDifference; diff --git a/types/ramda/src/symmetricDifferenceWith.d.ts b/types/ramda/src/symmetricDifferenceWith.d.ts new file mode 100644 index 0000000000..9ee8a2b855 --- /dev/null +++ b/types/ramda/src/symmetricDifferenceWith.d.ts @@ -0,0 +1,2 @@ +import { symmetricDifferenceWith } from '../index'; +export default symmetricDifferenceWith; diff --git a/types/ramda/src/tail.d.ts b/types/ramda/src/tail.d.ts new file mode 100644 index 0000000000..5a949add56 --- /dev/null +++ b/types/ramda/src/tail.d.ts @@ -0,0 +1,2 @@ +import { tail } from '../index'; +export default tail; diff --git a/types/ramda/src/take.d.ts b/types/ramda/src/take.d.ts new file mode 100644 index 0000000000..35806f3171 --- /dev/null +++ b/types/ramda/src/take.d.ts @@ -0,0 +1,2 @@ +import { take } from '../index'; +export default take; diff --git a/types/ramda/src/takeLast.d.ts b/types/ramda/src/takeLast.d.ts new file mode 100644 index 0000000000..145934b186 --- /dev/null +++ b/types/ramda/src/takeLast.d.ts @@ -0,0 +1,2 @@ +import { takeLast } from '../index'; +export default takeLast; diff --git a/types/ramda/src/takeLastWhile.d.ts b/types/ramda/src/takeLastWhile.d.ts new file mode 100644 index 0000000000..0d6f344445 --- /dev/null +++ b/types/ramda/src/takeLastWhile.d.ts @@ -0,0 +1,2 @@ +import { takeLastWhile } from '../index'; +export default takeLastWhile; diff --git a/types/ramda/src/takeWhile.d.ts b/types/ramda/src/takeWhile.d.ts new file mode 100644 index 0000000000..c3f71dd0fd --- /dev/null +++ b/types/ramda/src/takeWhile.d.ts @@ -0,0 +1,2 @@ +import { takeWhile } from '../index'; +export default takeWhile; diff --git a/types/ramda/src/tap.d.ts b/types/ramda/src/tap.d.ts new file mode 100644 index 0000000000..329108173e --- /dev/null +++ b/types/ramda/src/tap.d.ts @@ -0,0 +1,2 @@ +import { tap } from '../index'; +export default tap; diff --git a/types/ramda/src/test.d.ts b/types/ramda/src/test.d.ts new file mode 100644 index 0000000000..64a6289599 --- /dev/null +++ b/types/ramda/src/test.d.ts @@ -0,0 +1,2 @@ +import { test } from '../index'; +export default test; diff --git a/types/ramda/src/then.d.ts b/types/ramda/src/then.d.ts new file mode 100644 index 0000000000..24f6f87504 --- /dev/null +++ b/types/ramda/src/then.d.ts @@ -0,0 +1,2 @@ +import { then } from '../index'; +export default then; diff --git a/types/ramda/src/thunkify.d.ts b/types/ramda/src/thunkify.d.ts new file mode 100644 index 0000000000..9c2fba33de --- /dev/null +++ b/types/ramda/src/thunkify.d.ts @@ -0,0 +1,2 @@ +import { thunkify } from '../index'; +export default thunkify; diff --git a/types/ramda/src/times.d.ts b/types/ramda/src/times.d.ts new file mode 100644 index 0000000000..141c101e23 --- /dev/null +++ b/types/ramda/src/times.d.ts @@ -0,0 +1,2 @@ +import { times } from '../index'; +export default times; diff --git a/types/ramda/src/toLower.d.ts b/types/ramda/src/toLower.d.ts new file mode 100644 index 0000000000..4086a90f75 --- /dev/null +++ b/types/ramda/src/toLower.d.ts @@ -0,0 +1,2 @@ +import { toLower } from '../index'; +export default toLower; diff --git a/types/ramda/src/toPairs.d.ts b/types/ramda/src/toPairs.d.ts new file mode 100644 index 0000000000..5a6d3b24c2 --- /dev/null +++ b/types/ramda/src/toPairs.d.ts @@ -0,0 +1,2 @@ +import { toPairs } from '../index'; +export default toPairs; diff --git a/types/ramda/src/toPairsIn.d.ts b/types/ramda/src/toPairsIn.d.ts new file mode 100644 index 0000000000..70a879e200 --- /dev/null +++ b/types/ramda/src/toPairsIn.d.ts @@ -0,0 +1,2 @@ +import { toPairsIn } from '../index'; +export default toPairsIn; diff --git a/types/ramda/src/toString.d.ts b/types/ramda/src/toString.d.ts new file mode 100644 index 0000000000..c731b264be --- /dev/null +++ b/types/ramda/src/toString.d.ts @@ -0,0 +1,2 @@ +import { toString } from '../index'; +export default toString; diff --git a/types/ramda/src/toUpper.d.ts b/types/ramda/src/toUpper.d.ts new file mode 100644 index 0000000000..0a91bccfed --- /dev/null +++ b/types/ramda/src/toUpper.d.ts @@ -0,0 +1,2 @@ +import { toUpper } from '../index'; +export default toUpper; diff --git a/types/ramda/src/transduce.d.ts b/types/ramda/src/transduce.d.ts new file mode 100644 index 0000000000..de33a7380c --- /dev/null +++ b/types/ramda/src/transduce.d.ts @@ -0,0 +1,2 @@ +import { transduce } from '../index'; +export default transduce; diff --git a/types/ramda/src/transpose.d.ts b/types/ramda/src/transpose.d.ts new file mode 100644 index 0000000000..8ed6535fb2 --- /dev/null +++ b/types/ramda/src/transpose.d.ts @@ -0,0 +1,2 @@ +import { transpose } from '../index'; +export default transpose; diff --git a/types/ramda/src/traverse.d.ts b/types/ramda/src/traverse.d.ts new file mode 100644 index 0000000000..cb4fdc0b1e --- /dev/null +++ b/types/ramda/src/traverse.d.ts @@ -0,0 +1,2 @@ +import { traverse } from '../index'; +export default traverse; diff --git a/types/ramda/src/trim.d.ts b/types/ramda/src/trim.d.ts new file mode 100644 index 0000000000..f0000b80bb --- /dev/null +++ b/types/ramda/src/trim.d.ts @@ -0,0 +1,2 @@ +import { trim } from '../index'; +export default trim; diff --git a/types/ramda/src/tryCatch.d.ts b/types/ramda/src/tryCatch.d.ts new file mode 100644 index 0000000000..3c9edd9f79 --- /dev/null +++ b/types/ramda/src/tryCatch.d.ts @@ -0,0 +1,2 @@ +import { tryCatch } from '../index'; +export default tryCatch; diff --git a/types/ramda/src/type.d.ts b/types/ramda/src/type.d.ts new file mode 100644 index 0000000000..de115bb279 --- /dev/null +++ b/types/ramda/src/type.d.ts @@ -0,0 +1,2 @@ +import { type } from '../index'; +export default type; diff --git a/types/ramda/src/unapply.d.ts b/types/ramda/src/unapply.d.ts new file mode 100644 index 0000000000..7ad4b767e0 --- /dev/null +++ b/types/ramda/src/unapply.d.ts @@ -0,0 +1,2 @@ +import { unapply } from '../index'; +export default unapply; diff --git a/types/ramda/src/unary.d.ts b/types/ramda/src/unary.d.ts new file mode 100644 index 0000000000..c022aec354 --- /dev/null +++ b/types/ramda/src/unary.d.ts @@ -0,0 +1,2 @@ +import { unary } from '../index'; +export default unary; diff --git a/types/ramda/src/uncurryN.d.ts b/types/ramda/src/uncurryN.d.ts new file mode 100644 index 0000000000..b6962cc979 --- /dev/null +++ b/types/ramda/src/uncurryN.d.ts @@ -0,0 +1,2 @@ +import { uncurryN } from '../index'; +export default uncurryN; diff --git a/types/ramda/src/unfold.d.ts b/types/ramda/src/unfold.d.ts new file mode 100644 index 0000000000..2ebaff6fe5 --- /dev/null +++ b/types/ramda/src/unfold.d.ts @@ -0,0 +1,2 @@ +import { unfold } from '../index'; +export default unfold; diff --git a/types/ramda/src/union.d.ts b/types/ramda/src/union.d.ts new file mode 100644 index 0000000000..9fac243b43 --- /dev/null +++ b/types/ramda/src/union.d.ts @@ -0,0 +1,2 @@ +import { union } from '../index'; +export default union; diff --git a/types/ramda/src/unionWith.d.ts b/types/ramda/src/unionWith.d.ts new file mode 100644 index 0000000000..8bf20a51b7 --- /dev/null +++ b/types/ramda/src/unionWith.d.ts @@ -0,0 +1,2 @@ +import { unionWith } from '../index'; +export default unionWith; diff --git a/types/ramda/src/uniq.d.ts b/types/ramda/src/uniq.d.ts new file mode 100644 index 0000000000..be0a00aef0 --- /dev/null +++ b/types/ramda/src/uniq.d.ts @@ -0,0 +1,2 @@ +import { uniq } from '../index'; +export default uniq; diff --git a/types/ramda/src/uniqBy.d.ts b/types/ramda/src/uniqBy.d.ts new file mode 100644 index 0000000000..f85de9e4e0 --- /dev/null +++ b/types/ramda/src/uniqBy.d.ts @@ -0,0 +1,2 @@ +import { uniqBy } from '../index'; +export default uniqBy; diff --git a/types/ramda/src/uniqWith.d.ts b/types/ramda/src/uniqWith.d.ts new file mode 100644 index 0000000000..42442bffc3 --- /dev/null +++ b/types/ramda/src/uniqWith.d.ts @@ -0,0 +1,2 @@ +import { uniqWith } from '../index'; +export default uniqWith; diff --git a/types/ramda/src/unless.d.ts b/types/ramda/src/unless.d.ts new file mode 100644 index 0000000000..3727700625 --- /dev/null +++ b/types/ramda/src/unless.d.ts @@ -0,0 +1,2 @@ +import { unless } from '../index'; +export default unless; diff --git a/types/ramda/src/unnest.d.ts b/types/ramda/src/unnest.d.ts new file mode 100644 index 0000000000..ccbb4be0e8 --- /dev/null +++ b/types/ramda/src/unnest.d.ts @@ -0,0 +1,2 @@ +import { unnest } from '../index'; +export default unnest; diff --git a/types/ramda/src/until.d.ts b/types/ramda/src/until.d.ts new file mode 100644 index 0000000000..ab26247fea --- /dev/null +++ b/types/ramda/src/until.d.ts @@ -0,0 +1,2 @@ +import { until } from '../index'; +export default until; diff --git a/types/ramda/src/update.d.ts b/types/ramda/src/update.d.ts new file mode 100644 index 0000000000..c3eba99c72 --- /dev/null +++ b/types/ramda/src/update.d.ts @@ -0,0 +1,2 @@ +import { update } from '../index'; +export default update; diff --git a/types/ramda/src/useWith.d.ts b/types/ramda/src/useWith.d.ts new file mode 100644 index 0000000000..0d1f54e80f --- /dev/null +++ b/types/ramda/src/useWith.d.ts @@ -0,0 +1,2 @@ +import { useWith } from '../index'; +export default useWith; diff --git a/types/ramda/src/values.d.ts b/types/ramda/src/values.d.ts new file mode 100644 index 0000000000..8664d8cc67 --- /dev/null +++ b/types/ramda/src/values.d.ts @@ -0,0 +1,2 @@ +import { values } from '../index'; +export default values; diff --git a/types/ramda/src/valuesIn.d.ts b/types/ramda/src/valuesIn.d.ts new file mode 100644 index 0000000000..d80b32fc67 --- /dev/null +++ b/types/ramda/src/valuesIn.d.ts @@ -0,0 +1,2 @@ +import { valuesIn } from '../index'; +export default valuesIn; diff --git a/types/ramda/src/view.d.ts b/types/ramda/src/view.d.ts new file mode 100644 index 0000000000..3c11fa0ae9 --- /dev/null +++ b/types/ramda/src/view.d.ts @@ -0,0 +1,2 @@ +import { view } from '../index'; +export default view; diff --git a/types/ramda/src/when.d.ts b/types/ramda/src/when.d.ts new file mode 100644 index 0000000000..57de7e19a7 --- /dev/null +++ b/types/ramda/src/when.d.ts @@ -0,0 +1,2 @@ +import { when } from '../index'; +export default when; diff --git a/types/ramda/src/where.d.ts b/types/ramda/src/where.d.ts new file mode 100644 index 0000000000..4c49c2dc25 --- /dev/null +++ b/types/ramda/src/where.d.ts @@ -0,0 +1,2 @@ +import { where } from '../index'; +export default where; diff --git a/types/ramda/src/whereEq.d.ts b/types/ramda/src/whereEq.d.ts new file mode 100644 index 0000000000..4bdffa1d24 --- /dev/null +++ b/types/ramda/src/whereEq.d.ts @@ -0,0 +1,2 @@ +import { whereEq } from '../index'; +export default whereEq; diff --git a/types/ramda/src/without.d.ts b/types/ramda/src/without.d.ts new file mode 100644 index 0000000000..be9b8584ed --- /dev/null +++ b/types/ramda/src/without.d.ts @@ -0,0 +1,2 @@ +import { without } from '../index'; +export default without; diff --git a/types/ramda/src/wrap.d.ts b/types/ramda/src/wrap.d.ts new file mode 100644 index 0000000000..a855106989 --- /dev/null +++ b/types/ramda/src/wrap.d.ts @@ -0,0 +1,2 @@ +import { wrap } from '../index'; +export default wrap; diff --git a/types/ramda/src/xprod.d.ts b/types/ramda/src/xprod.d.ts new file mode 100644 index 0000000000..2e3fd865ea --- /dev/null +++ b/types/ramda/src/xprod.d.ts @@ -0,0 +1,2 @@ +import { xprod } from '../index'; +export default xprod; diff --git a/types/ramda/src/zip.d.ts b/types/ramda/src/zip.d.ts new file mode 100644 index 0000000000..609fe7bb29 --- /dev/null +++ b/types/ramda/src/zip.d.ts @@ -0,0 +1,2 @@ +import { zip } from '../index'; +export default zip; diff --git a/types/ramda/src/zipObj.d.ts b/types/ramda/src/zipObj.d.ts new file mode 100644 index 0000000000..dcc28311bc --- /dev/null +++ b/types/ramda/src/zipObj.d.ts @@ -0,0 +1,2 @@ +import { zipObj } from '../index'; +export default zipObj; diff --git a/types/ramda/src/zipWith.d.ts b/types/ramda/src/zipWith.d.ts new file mode 100644 index 0000000000..df6890c369 --- /dev/null +++ b/types/ramda/src/zipWith.d.ts @@ -0,0 +1,2 @@ +import { zipWith } from '../index'; +export default zipWith; diff --git a/types/ramda/tools.d.ts b/types/ramda/tools.d.ts new file mode 100644 index 0000000000..b6f814012b --- /dev/null +++ b/types/ramda/tools.d.ts @@ -0,0 +1,114 @@ +/// + +// All the following types are explained here: +// https://medium.freecodecamp.org/typescript-curry-ramda-types-f747e99744ab +// https://github.com/pirix-gh/medium/blob/master/types-curry-ramda/src/index.ts +declare namespace Tools { + type Head = + T extends [any, ...any[]] + ? T[0] + : never; + + type Tail = + ((...t: T) => any) extends ((_: any, ...tail: infer TT) => any) + ? TT + : []; + + type HasTail = + T extends ([] | [any]) + ? false + : true; + + type Last = { + 0: Last>; + 1: Head; + }[ + HasTail extends true + ? 0 + : 1 + ]; + + type Length = + T['length']; + + type Prepend = + ((head: E, ...args: T) => any) extends ((...args: infer U) => any) + ? U + : T; + + type Drop = { + 0: Drop, Prepend>; + 1: T; + }[ + Length extends N + ? 1 + : 0 + ]; + + type Cast = X extends Y ? X : Y; + + type Pos = + Length; + + type Next = + Prepend; + + type Prev = + Tail; + + type Iterator = { + 0: Iterator, Next>; + 1: From; + }[ + Pos extends Index + ? 1 + : 0 + ]; + + type Reverse = { + 0: Reverse], R>, Next>; + 1: R; + }[ + Pos extends Length + ? 1 + : 0 + ]; + + type Concat = + Reverse extends infer R ? Cast : never, T2>; + + type Append = + Concat; +} + +declare namespace Curry { + type GapOf = + T1[Tools.Pos] extends R.Placeholder + ? Tools.Append], TN> + : TN; + + type GapsOf = { + 0: GapsOf extends infer G ? Tools.Cast : never, Tools.Next>; + 1: Tools.Concat, T2> extends infer D ? Tools.Cast : never>; + }[ + Tools.Pos extends Tools.Length + ? 1 + : 0 + ]; + + type PartialGaps = { + [K in keyof T]?: T[K] | R.Placeholder + }; + + type CleanedGaps = { + [K in keyof T]: NonNullable + }; + + type Gaps = CleanedGaps>; + + type Curry any)> = + (...args: Tools.Cast>>, any[]>) => + GapsOf> extends [any, ...any[]] + ? Curry<(...args: GapsOf> extends infer G ? Tools.Cast : never) => ReturnType> + : ReturnType; +} diff --git a/types/ramda/tsconfig.json b/types/ramda/tsconfig.json index 4de4f10d8f..92fcdd531d 100644 --- a/types/ramda/tsconfig.json +++ b/types/ramda/tsconfig.json @@ -19,6 +19,7 @@ }, "files": [ "index.d.ts", + "tools.d.ts", "ramda-tests.ts" ] } \ No newline at end of file diff --git a/types/random-string/tslint.json b/types/random-string/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/random-string/tslint.json +++ b/types/random-string/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/randomcolor/tslint.json b/types/randomcolor/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/randomcolor/tslint.json +++ b/types/randomcolor/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/randomstring/tslint.json b/types/randomstring/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/randomstring/tslint.json +++ b/types/randomstring/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rangy/tslint.json b/types/rangy/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rangy/tslint.json +++ b/types/rangy/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rangyinputs/tslint.json b/types/rangyinputs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rangyinputs/tslint.json +++ b/types/rangyinputs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/raphael/tslint.json b/types/raphael/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/raphael/tslint.json +++ b/types/raphael/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ratelimiter/tslint.json b/types/ratelimiter/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ratelimiter/tslint.json +++ b/types/ratelimiter/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/raty/tslint.json b/types/raty/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/raty/tslint.json +++ b/types/raty/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rbush/tslint.json b/types/rbush/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rbush/tslint.json +++ b/types/rbush/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rc-select/tslint.json b/types/rc-select/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rc-select/tslint.json +++ b/types/rc-select/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rc-slider/index.d.ts b/types/rc-slider/index.d.ts index ba40bc0d7d..1f16fbe267 100644 --- a/types/rc-slider/index.d.ts +++ b/types/rc-slider/index.d.ts @@ -6,6 +6,7 @@ // Jacob Froman // Deanna Veale // Nick Maddren +// Roman Nevolin // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -204,6 +205,11 @@ export interface HandleProps extends CommonApiProps { * Styling option offset */ offset: number; + /** + * Set the tabIndex of the slider handle. + * @default 0 + */ + tabIndex?: number; } export interface WithTooltipProps { diff --git a/types/rc-slider/rc-slider-tests.tsx b/types/rc-slider/rc-slider-tests.tsx index 5b246dd7ab..15aea1ff4c 100644 --- a/types/rc-slider/rc-slider-tests.tsx +++ b/types/rc-slider/rc-slider-tests.tsx @@ -15,6 +15,7 @@ ReactDOM.render( className="bottom" vertical={true} offset={10} + tabIndex={-1} />, document.querySelector('.another-app') ); diff --git a/types/rcloader/tslint.json b/types/rcloader/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rcloader/tslint.json +++ b/types/rcloader/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-create-fragment/tslint.json b/types/react-addons-create-fragment/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-create-fragment/tslint.json +++ b/types/react-addons-create-fragment/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-css-transition-group/tslint.json b/types/react-addons-css-transition-group/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-css-transition-group/tslint.json +++ b/types/react-addons-css-transition-group/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-linked-state-mixin/tslint.json b/types/react-addons-linked-state-mixin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-linked-state-mixin/tslint.json +++ b/types/react-addons-linked-state-mixin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-perf/tslint.json b/types/react-addons-perf/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-perf/tslint.json +++ b/types/react-addons-perf/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-pure-render-mixin/tslint.json b/types/react-addons-pure-render-mixin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-pure-render-mixin/tslint.json +++ b/types/react-addons-pure-render-mixin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-shallow-compare/tslint.json b/types/react-addons-shallow-compare/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-shallow-compare/tslint.json +++ b/types/react-addons-shallow-compare/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-test-utils/tslint.json b/types/react-addons-test-utils/tslint.json index e3610fefae..89955128d5 100644 --- a/types/react-addons-test-utils/tslint.json +++ b/types/react-addons-test-utils/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-transition-group/tslint.json b/types/react-addons-transition-group/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-transition-group/tslint.json +++ b/types/react-addons-transition-group/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-addons-update/tslint.json b/types/react-addons-update/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-addons-update/tslint.json +++ b/types/react-addons-update/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-alert/index.d.ts b/types/react-alert/index.d.ts index 6c94da77b0..5334de3571 100644 --- a/types/react-alert/index.d.ts +++ b/types/react-alert/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-alert 4.0 +// Type definitions for react-alert 5.2 // Project: https://github.com/schiehll/react-alert // Definitions by: Yue Yang // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -8,16 +8,49 @@ import * as React from 'react'; export type AlertPosition = | 'top left' - | 'top right' | 'top center' + | 'top right' + | 'middle left' + | 'middle' + | 'middle right' | 'bottom left' - | 'bottom right' - | 'bottom center'; + | 'bottom center' + | 'bottom right'; + +export interface Positions { + TOP_LEFT: 'top left'; + TOP_CENTER: 'top center'; + TOP_RIGHT: 'top right'; + MIDDLE_LEFT: 'middle left'; + MIDDLE: 'middle'; + MIDDLE_RIGHT: 'middle right'; + BOTTOM_LEFT: 'bottom left'; + BOTTOM_CENTER: 'bottom center'; + BOTTOM_RIGHT: 'bottom right'; +} + +export const positions: Positions; export type AlertType = 'info' | 'success' | 'error'; + +export interface Types { + INFO: 'info'; + SUCCESS: 'success'; + ERROR: 'error'; +} + +export const types: Types; + export type AlertTransition = 'fade' | 'scale'; -export interface ProviderOptions { +export interface Transitions { + FADE: 'fade'; + SCALE: 'scale'; +} + +export const transitions: Transitions; + +export interface AlertProviderProps extends React.HTMLAttributes { /** * The margin of each alert * @@ -49,18 +82,33 @@ export interface ProviderOptions { */ transition?: AlertTransition; /** - * The z-index of alerts + * The style of the alert container * - * Default value: 100 + * Default z-index value: 100 */ - zIndex?: number; + containerStyle?: React.CSSProperties; + /** + * The alert component for each message + */ + template: React.ComponentType; + /** + * Custom context to separate alerts. + */ + context?: React.Context; } -export class Provider extends React.Component {} +export interface AlertComponentProps { + id: string; + message: React.ReactNode; + options: AlertCustomOptionsWithType; + close(): void; +} -export const Alert: React.Consumer; +export interface AlertComponentPropsWithStyle extends AlertComponentProps { + style: React.CSSProperties; +} + +export class Provider extends React.Component {} export interface AlertCustomOptions { /** @@ -70,28 +118,32 @@ export interface AlertCustomOptions { /** * Callback that will be executed after this alert open */ - onOpen?(): undefined; + onOpen?(): void; /** * Callback that will be executed after this alert is removed */ - onClose?(): undefined; + onClose?(): void; } export interface AlertCustomOptionsWithType extends AlertCustomOptions { type?: AlertType; } -export interface InjectedAlertProp { +export interface AlertManager { + root?: HTMLElement; + alerts: AlertComponentProps[]; show( - message?: string, + message?: React.ReactNode, options?: AlertCustomOptionsWithType - ): InjectedAlertProp; - remove(alert: InjectedAlertProp): undefined; - success(message?: string, options?: AlertCustomOptions): InjectedAlertProp; - error(message?: string, options?: AlertCustomOptions): InjectedAlertProp; - info(message?: string, options?: AlertCustomOptions): InjectedAlertProp; + ): AlertComponentProps; + remove(alert: AlertComponentProps): void; + success(message?: React.ReactNode, options?: AlertCustomOptions): AlertComponentProps; + error(message?: React.ReactNode, options?: AlertCustomOptions): AlertComponentProps; + info(message?: React.ReactNode, options?: AlertCustomOptions): AlertComponentProps; } -export function withAlert

( - c: React.ComponentType

-): React.ComponentType>>; +export function withAlert

(context?: React.Context): + (c: React.ComponentType

) => + React.ComponentType>>; + +export function useAlert(context?: React.Context): AlertManager; diff --git a/types/react-alert/react-alert-tests.tsx b/types/react-alert/react-alert-tests.tsx index c6088a52a8..64a4e5cf97 100644 --- a/types/react-alert/react-alert-tests.tsx +++ b/types/react-alert/react-alert-tests.tsx @@ -1,20 +1,28 @@ import * as React from 'react'; import { + AlertComponentPropsWithStyle, + AlertManager, Provider as AlertProvider, - Alert, + AlertProviderProps, + useAlert, withAlert, - AlertPosition, - AlertTransition, - ProviderOptions, - InjectedAlertProp } from 'react-alert'; -class AppWithoutAlert extends React.Component<{ alert: InjectedAlertProp }> { +class AppWithoutAlert extends React.Component<{ alert: AlertManager }> { render() { return ( - )} - - ); - } -} +const App = withAlert(customContext)(AppWithoutAlert); -class AlertTemplate extends React.Component { +const AlertHook = (): JSX.Element => { + const alert = useAlert(); + return ( + + ); +}; + +class AlertTemplate extends React.Component { render() { // the style contains only the margin given as offset // options contains all alert given options @@ -63,28 +76,25 @@ class AlertTemplate extends React.Component { } } -const options: ProviderOptions = { - position: 'bottom center' as AlertPosition, +const options: AlertProviderProps = { + position: 'bottom center', timeout: 5000, offset: '30px', - transition: 'scale' as AlertTransition + transition: 'scale', + context: customContext, + className: 'cssClass', + template: AlertTemplate, + containerStyle: { + margin: 5, + }, }; class Root extends React.Component { render() { return ( - + - - ); - } -} - -class RootAlert extends React.Component { - render() { - return ( - - + ); } diff --git a/types/react-beautiful-dnd/index.d.ts b/types/react-beautiful-dnd/index.d.ts index a743ce6f78..6c9334c670 100644 --- a/types/react-beautiful-dnd/index.d.ts +++ b/types/react-beautiful-dnd/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-beautiful-dnd 10.0 +// Type definitions for react-beautiful-dnd 10.1 // Project: https://github.com/atlassian/react-beautiful-dnd // Definitions by: varHarrie // Bradley Ayers @@ -6,6 +6,7 @@ // Mark Nelissen // Enrico Boccadifuoco // Taeheon Kim +// Kanitkorn Sujautra // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -104,13 +105,14 @@ export interface DroppableProvidedProps { } export interface DroppableProvided { innerRef(element: HTMLElement | null): any; - placeholder?: React.ReactElement | null; + placeholder?: React.ReactElement | null; droppableProps: DroppableProvidedProps; } export interface DroppableStateSnapshot { isDraggingOver: boolean; draggingOverWith?: DraggableId; + draggingFromThisWith?: DraggableId; } export interface DroppableProps { @@ -120,7 +122,7 @@ export interface DroppableProps { isDropDisabled?: boolean; isCombineEnabled?: boolean; direction?: 'vertical' | 'horizontal'; - children(provided: DroppableProvided, snapshot: DroppableStateSnapshot): React.ReactElement; + children(provided: DroppableProvided, snapshot: DroppableStateSnapshot): React.ReactElement; } export class Droppable extends React.Component { } @@ -174,7 +176,7 @@ export interface DraggableProvided { // will be removed after move to react 16 innerRef(element?: HTMLElement | null): any; - placeholder?: React.ReactElement | null; + placeholder?: React.ReactElement | null; } export interface DraggableStateSnapshot { @@ -203,8 +205,9 @@ export interface DraggableProps { index: number; isDragDisabled?: boolean; disableInteractiveElementBlocking?: boolean; - children(provided: DraggableProvided, snapshot: DraggableStateSnapshot): React.ReactElement; + children(provided: DraggableProvided, snapshot: DraggableStateSnapshot): React.ReactElement; type?: TypeId; + shouldRespectForceTouch?: boolean; } export class Draggable extends React.Component { } diff --git a/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx b/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx index ceb6757992..c169d8631a 100644 --- a/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx +++ b/types/react-beautiful-dnd/react-beautiful-dnd-tests.tsx @@ -1,6 +1,6 @@ import * as React from 'react'; import * as ReactDOM from 'react-dom'; -import { DragDropContext, Draggable, Droppable, DropResult, DragStart, DragUpdate, ResponderProvided } from 'react-beautiful-dnd'; +import { DragDropContext, Draggable, Droppable, DropResult, DragStart, DragUpdate, ResponderProvided, DroppableStateSnapshot } from 'react-beautiful-dnd'; interface Item { id: string; @@ -30,8 +30,8 @@ const getItemStyle = (isDragging: boolean, draggableStyle: any) => ({ ...draggableStyle }); -const getListStyle = (isDraggingOver: any) => ({ - background: isDraggingOver ? 'lightblue' : 'lightgrey', +const getListStyle = (snapshot: DroppableStateSnapshot) => ({ + background: snapshot.draggingFromThisWith ? 'lightpink' : snapshot.isDraggingOver ? 'lightblue' : 'lightgrey', width: 250 }); @@ -87,9 +87,9 @@ class App extends React.Component<{}, AppState> { {(provided, snapshot) => ( -

+
{this.state.items.map((item, index) => ( - + {(provided, snapshot) => (
// janb87 // Daniel Thorne +// Panagiotis Rikarnto Siavelis // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import { Validator } from 'prop-types'; @@ -113,13 +114,14 @@ export interface HeaderProps { localizer: DateLocalizer; } -export interface Components { - event?: React.ComponentType; - eventWrapper?: React.ComponentType; +export interface Components { + event?: React.ComponentType>; + eventWrapper?: React.ComponentType>; eventContainerWrapper?: 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; timeSlotWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; + timeGutterHeader?: React.SFC | React.Component | React.ComponentClass | JSX.Element; timeGutterWrapper?: React.SFC | React.Component | React.ComponentClass | JSX.Element; toolbar?: React.ComponentType; agenda?: { @@ -157,29 +159,29 @@ export interface ToolbarProps { children?: React.ReactNode; } -export interface EventProps { - event: T; +export interface EventProps { + event: TEvent; title: string; } -export interface EventWrapperProps { +export interface EventWrapperProps { // https://github.com/intljusticemission/react-big-calendar/blob/27a2656b40ac8729634d24376dff8ea781a66d50/src/TimeGridEvent.js#L28 style?: React.CSSProperties & { xOffset: number }; className: string; - event: T; + event: TEvent; isRtl: boolean; getters: { - eventProp?: EventPropGetter; + eventProp?: EventPropGetter; slotProp?: SlotPropGetter; dayProp?: DayPropGetter; }; onClick: (e: React.MouseEvent) => void; onDoubleClick: (e: React.MouseEvent) => void; accessors: { - title?: (event: T) => string; - tooltip?: (event: T) => string; - end?: (event: T) => Date; - start?: (event: T) => Date; + title?: (event: TEvent) => string; + tooltip?: (event: TEvent) => string; + end?: (event: TEvent) => Date; + start?: (event: TEvent) => Date; }; selected: boolean; label: string; @@ -203,6 +205,7 @@ export interface Messages { today?: string; agenda?: string; showMore?: (count: number) => string; + noEventsInRange?: string; } export type Culture = string | string[]; @@ -262,7 +265,7 @@ export interface BigCalendarProps; messages?: Messages; titleAccessor?: keyof TEvent | ((event: TEvent) => string); allDayAccessor?: keyof TEvent | ((event: TEvent) => boolean); @@ -292,7 +295,7 @@ export default class BigCalendar, }; /** * create DateLocalizer from globalize diff --git a/types/react-big-calendar/react-big-calendar-tests.tsx b/types/react-big-calendar/react-big-calendar-tests.tsx index 6b7c252f97..02652609b1 100644 --- a/types/react-big-calendar/react-big-calendar-tests.tsx +++ b/types/react-big-calendar/react-big-calendar-tests.tsx @@ -1,6 +1,6 @@ import * as React from "react"; import * as ReactDOM from "react-dom"; -import BigCalendar, { BigCalendarProps, Navigate, View, DateRange, DateLocalizer, ToolbarProps, EventWrapperProps } from "react-big-calendar"; +import BigCalendar, { BigCalendarProps, Navigate, View, DateRange, DateLocalizer, ToolbarProps, EventProps, EventWrapperProps } from "react-big-calendar"; import withDragAndDrop from "react-big-calendar/lib/addons/dragAndDrop"; // Don't want to add this as a dependency, because it is only used for tests. @@ -93,7 +93,7 @@ class CalendarResource { class FullAPIExample extends React.Component> { render() { return ( - new Date()} view={'day'} @@ -131,7 +131,24 @@ class CalendarResource { agendaDateFormat: (date: Date, culture?: string, localizer?: object) => "some-format", dayRangeHeaderFormat: (range: DateRange, culture?: string, localizer?: object) => "some-format" }} - messages={{}} + messages={{ + date: 'Date', + time: 'Time', + event: 'Event', + allDay: 'All Day', + week: 'Week', + work_week: 'Work Week', + day: 'Day', + month: 'Month', + previous: 'Back', + next: 'Next', + yesterday: 'Yesterday', + tomorrow: 'Tomorrow', + today: 'Today', + agenda: 'Agenda', + noEventsInRange: 'There are no events in this range.', + showMore: total => `+${total} more`, + }} timeslots={24} defaultView={'month'} className={'my-calendar'} @@ -217,24 +234,22 @@ const customSlotPropGetter = (date: Date) => { else return {}; }; -function Event(event: any) { +function Event(props: EventProps) { return ( - {event.title} - {event.desc && ': ' + event.desc} + {props.event.title} + {props.event.desc && ': ' + props.event.desc} ); } -class EventWrapper extends React.Component { - render() { - const { continuesEarlier, event, label, accessors = {}, style } = this.props; - return ( -
-
{continuesEarlier}-{label}-{accessors.title && event && accessors.title(event)}}
-
- ); - } +function EventWrapper(props: EventWrapperProps) { + const { continuesEarlier, event, label, accessors = {}, style } = props; + return ( +
+
{continuesEarlier}-{label}-{accessors.title && event && accessors.title(event)}}
+
+ ); } class Toolbar extends React.Component { diff --git a/types/react-blessed/index.d.ts b/types/react-blessed/index.d.ts index 33c9fe2790..46d0e7e495 100644 --- a/types/react-blessed/index.d.ts +++ b/types/react-blessed/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-blessed 0.3 // Project: https://github.com/yomguithereal/react-blessed#readme -// Definitions by: My Self +// Definitions by: Century Guo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-bootstrap-daterangepicker/tslint.json b/types/react-bootstrap-daterangepicker/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-bootstrap-daterangepicker/tslint.json +++ b/types/react-bootstrap-daterangepicker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-bootstrap-typeahead/index.d.ts b/types/react-bootstrap-typeahead/index.d.ts index 93fa2c9c6a..f916a4c293 100644 --- a/types/react-bootstrap-typeahead/index.d.ts +++ b/types/react-bootstrap-typeahead/index.d.ts @@ -5,6 +5,7 @@ // Paito Anderson // Andreas Richter // Dale Fenton +// Håkon Holhjem // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.9 @@ -126,7 +127,7 @@ export interface TypeaheadProps { 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; + allowNew?: boolean | ((results: T[], props: AllTypeaheadOwnAndInjectedProps) => boolean); /* Autofocus the input when the component initially mounts. */ autoFocus?: boolean; @@ -172,6 +173,9 @@ export interface TypeaheadProps { Does not work with allowNew. */ highlightOnlyResult?: boolean; + /* An html id attribute, required for assistive technologies such as screen readers. */ + id?: string | number; + /* Whether the filter should ignore accents and other diacritical marks. */ ignoreDiacritics?: boolean; @@ -198,7 +202,7 @@ export interface TypeaheadProps { so as not to render too many DOM nodes in the case of large data sets. */ maxResults?: number; - /* Id applied to the top-level menu element. Required for accessibility. */ + /* DEPRECATED. Id applied to the top-level menu element. Required for accessibility. */ menuId?: string; /* Number of input characters that must be entered before showing results. */ @@ -253,6 +257,10 @@ export interface TypeaheadProps { /* Placeholder text for the input. */ placeholder?: string; + /* Whether to use fixed positioning for the menu, which is useful when rendering inside a + container with overflow: hidden;. Uses absolute positioning by default. */ + positionFixed?: boolean; + /* Callback for custom menu rendering. */ renderMenu?: (results: Array>, menuProps: any) => React.ReactNode; diff --git a/types/react-breadcrumbs/tslint.json b/types/react-breadcrumbs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-breadcrumbs/tslint.json +++ b/types/react-breadcrumbs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-bytesize-icons/tslint.json b/types/react-bytesize-icons/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-bytesize-icons/tslint.json +++ b/types/react-bytesize-icons/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-calendar-timeline/tslint.json b/types/react-calendar-timeline/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-calendar-timeline/tslint.json +++ b/types/react-calendar-timeline/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-codemirror/tslint.json b/types/react-codemirror/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-codemirror/tslint.json +++ b/types/react-codemirror/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-color/index.d.ts b/types/react-color/index.d.ts index 25664870c8..9935814feb 100644 --- a/types/react-color/index.d.ts +++ b/types/react-color/index.d.ts @@ -1,6 +1,10 @@ -// Type definitions for react-color 2.14 +// Type definitions for react-color 2.17 // Project: https://github.com/casesandberg/react-color/, http://casesandberg.github.io/react-color -// Definitions by: Karol Janyst , Marks Polakovs , Matthieu Montaudouin , Nokogiri +// Definitions by: Karol Janyst , +// Marks Polakovs , +// Matthieu Montaudouin , +// Nokogiri , +// 0815Strohhut // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-color/lib/components/chrome/Chrome.d.ts b/types/react-color/lib/components/chrome/Chrome.d.ts index a078cb231e..3c8f4139a5 100644 --- a/types/react-color/lib/components/chrome/Chrome.d.ts +++ b/types/react-color/lib/components/chrome/Chrome.d.ts @@ -1,8 +1,37 @@ -import { Component } from "react"; +import { Component, CSSProperties } from "react"; import { ColorPickerProps } from "../../.."; +export interface ChromePickerDefaultStyles { + picker?: CSSProperties; + saturation?: CSSProperties; + Saturation?: CSSProperties; + body?: CSSProperties; + controls?: CSSProperties; + color?: CSSProperties; + swatch?: CSSProperties; + active?: CSSProperties; + toggles?: CSSProperties; + hue?: CSSProperties; + Hue?: CSSProperties; + alpha?: CSSProperties; + Alpha?: CSSProperties; +} + +export interface ChromePickerDisableAlphaStyles { + color?: CSSProperties; + alpha?: CSSProperties; + hue?: CSSProperties; + swatch?: CSSProperties; +} + +export interface ChromePickerStyles { + default?: ChromePickerDefaultStyles; + disableAlpha?: ChromePickerDisableAlphaStyles; +} + export interface ChromePickerProps extends ColorPickerProps { disableAlpha?: boolean; + styles?: ChromePickerStyles; } export default class ChromePicker extends Component {} diff --git a/types/react-color/react-color-tests.tsx b/types/react-color/react-color-tests.tsx index 71ed800375..631fb34839 100644 --- a/types/react-color/react-color-tests.tsx +++ b/types/react-color/react-color-tests.tsx @@ -35,7 +35,7 @@ const colors = ["#000", "#333"]; render(, document.getElementById("main")); render(, document.getElementById("main")); -render(, document.getElementById("main")); +render(, document.getElementById("main")); render(, document.getElementById("main")); render(, document.getElementById("main")); render(, document.getElementById("main")); diff --git a/types/react-credit-cards/index.d.ts b/types/react-credit-cards/index.d.ts index 4cbf2f9830..015334e1c3 100644 --- a/types/react-credit-cards/index.d.ts +++ b/types/react-credit-cards/index.d.ts @@ -1,14 +1,14 @@ -// Type definitions for react-credit-cards 0.7 +// Type definitions for react-credit-cards 0.8 // Project: https://github.com/amarofashion/react-credit-cards -// Definitions by: Vytautas Strimaitis , Ole Frank +// Definitions by: Vytautas Strimaitis , Ole Frank , zzanol // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from "react"; export interface CallbackArgument { - isValid: boolean; - type: { issuer: string; maxLength: number }; + issuer: string; + maxLength: number; } export type Focused = "name" | "number" | "expiry" | "cvc"; diff --git a/types/react-css-modules/tslint.json b/types/react-css-modules/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-css-modules/tslint.json +++ b/types/react-css-modules/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-css-transition-replace/tslint.json b/types/react-css-transition-replace/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-css-transition-replace/tslint.json +++ b/types/react-css-transition-replace/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-csv/components/CommonPropTypes.d.ts b/types/react-csv/components/CommonPropTypes.d.ts new file mode 100644 index 0000000000..4bad3dd766 --- /dev/null +++ b/types/react-csv/components/CommonPropTypes.d.ts @@ -0,0 +1,22 @@ +import { MouseEventHandler } from "react"; + +export interface LabelKeyObject { + label: string; + key: string; +} + +export type Data = object[]; +export type Headers = LabelKeyObject[] | string[]; +export type SyncClickHandler = (event: MouseEventHandler) => boolean | void; +export type AsyncClickHandler = (event: MouseEventHandler, done: (proceed?: boolean) => void) => void; + +export interface CommonPropTypes { + data: string | Data; + headers?: Headers; + enclosingCharacter?: string; + separator?: string; + filename?: string; + uFEFF?: boolean; + onClick?: SyncClickHandler | AsyncClickHandler; + asyncOnClick?: boolean; +} diff --git a/types/react-csv/components/Download.d.ts b/types/react-csv/components/Download.d.ts new file mode 100644 index 0000000000..282f41596a --- /dev/null +++ b/types/react-csv/components/Download.d.ts @@ -0,0 +1,9 @@ +import { Component } from "react"; +import { CommonPropTypes } from "./CommonPropTypes"; + +export interface DownloadPropTypes extends CommonPropTypes { + target?: string; +} + +export default class Download extends Component { +} diff --git a/types/react-csv/components/Link.d.ts b/types/react-csv/components/Link.d.ts new file mode 100644 index 0000000000..82194dea93 --- /dev/null +++ b/types/react-csv/components/Link.d.ts @@ -0,0 +1,16 @@ +import { Component } from "react"; +import { CommonPropTypes } from "./CommonPropTypes"; + +// tslint:disable-next-line strict-export-declare-modifiers +type Omit = Pick>; + +export interface LinkProps + extends CommonPropTypes, + Omit< + React.DetailedHTMLProps< + React.AnchorHTMLAttributes, + HTMLAnchorElement + >, + "onClick" + > {} +export default class Link extends Component {} diff --git a/types/react-csv/index.d.ts b/types/react-csv/index.d.ts new file mode 100644 index 0000000000..1390ce1361 --- /dev/null +++ b/types/react-csv/index.d.ts @@ -0,0 +1,8 @@ +// Type definitions for react-csv 1.1 +// Project: https://github.com/react-csv/react-csv +// Definitions by: Vincent Pizzo +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +export { default as CSVLink } from "./components/Link"; +export { default as CSVDownload } from "./components/Download"; diff --git a/types/react-csv/react-csv-tests.tsx b/types/react-csv/react-csv-tests.tsx new file mode 100644 index 0000000000..4153879fea --- /dev/null +++ b/types/react-csv/react-csv-tests.tsx @@ -0,0 +1,246 @@ +import * as React from "react"; +import { render } from "react-dom"; +import { CSVLink, CSVDownload } from "react-csv"; + +const headers = [ + { label: "First Name", key: "details.firstName" }, + { label: "Last Name", key: "details.lastName" }, + { label: "Job", key: "job" } +]; + +const headersStrings = ["foo", "bar"]; + +const data = [ + { details: { firstName: "Ahmed", lastName: "Tomi" }, job: "manager" }, + { details: { firstName: "John", lastName: "Jones" }, job: "developer" } +]; + +const dataString = `firstname,lastname +Ahmed,Tomi +Raed,Labes +Yezzi,Min l3b +`; + +const syncOnClickReturn = ( + event: React.MouseEventHandler +) => { + window.console.log(event); + return true; +}; +const syncOnClickVoid = (event: React.MouseEventHandler) => + window.console.log(event); +const asyncOnClickReturn = ( + event: React.MouseEventHandler, + done: (proceed?: boolean) => void +) => { + window.console.log(event); + done(true); +}; +const asyncOnClickVoid = ( + event: React.MouseEventHandler, + done: (proceed?: boolean) => void +) => { + window.console.log(event); + done(); +}; + +const node = document.getElementById("main"); + +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); + +render(, node); +render(, node); +render(, node); +render(, node); +render(, node); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); +render( + , + node +); diff --git a/types/react-csv/tsconfig.json b/types/react-csv/tsconfig.json new file mode 100644 index 0000000000..cc91fd7689 --- /dev/null +++ b/types/react-csv/tsconfig.json @@ -0,0 +1,30 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "noUnusedParameters": true, + "noUnusedLocals": true + }, + "files": [ + "index.d.ts", + "components/CommonPropTypes.d.ts", + "components/Download.d.ts", + "components/Link.d.ts", + "react-csv-tests.tsx" + ] +} diff --git a/types/react-csv/tslint.json b/types/react-csv/tslint.json new file mode 100644 index 0000000000..310959b38e --- /dev/null +++ b/types/react-csv/tslint.json @@ -0,0 +1,4 @@ +{ + "extends": "dtslint/dt.json", + "rules": { } +} diff --git a/types/react-custom-scrollbars/tslint.json b/types/react-custom-scrollbars/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-custom-scrollbars/tslint.json +++ b/types/react-custom-scrollbars/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-data-grid/tslint.json b/types/react-data-grid/tslint.json index 637071b426..592fc9bcaa 100644 --- a/types/react-data-grid/tslint.json +++ b/types/react-data-grid/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-datagrid/tslint.json b/types/react-datagrid/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-datagrid/tslint.json +++ b/types/react-datagrid/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-datepicker/index.d.ts b/types/react-datepicker/index.d.ts index ce7ebcfab9..522f1faaf9 100644 --- a/types/react-datepicker/index.d.ts +++ b/types/react-datepicker/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-datepicker 2.0 +// Type definitions for react-datepicker 2.2 // Project: https://github.com/Hacker0x01/react-datepicker // Definitions by: Rajab Shakirov , // Andrey Balokha , @@ -9,6 +9,8 @@ // Sean Kelley // Justin Grant // Jake Boone +// Roman Nuritdinov +// Avi Klaiman // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -41,7 +43,7 @@ export interface ReactDatePickerProps { disabled?: boolean; disabledKeyboardNavigation?: boolean; dropdownMode?: 'scroll' | 'select'; - endDate?: Date; + endDate?: Date | null; excludeDates?: Date[]; excludeTimes?: Date[]; filterDate?(date: Date): boolean; @@ -57,9 +59,9 @@ export interface ReactDatePickerProps { inline?: boolean; isClearable?: boolean; locale?: string; - maxDate?: Date; + maxDate?: Date | null; maxTime?: Date; - minDate?: Date; + minDate?: Date | null; minTime?: Date; monthsShown?: number; name?: string; @@ -112,7 +114,7 @@ export interface ReactDatePickerProps { showTimeSelectOnly?: boolean; showWeekNumbers?: boolean; showYearDropdown?: boolean; - startDate?: Date; + startDate?: Date | null; startOpen?: boolean; tabIndex?: number; timeCaption?: string; @@ -126,6 +128,10 @@ export interface ReactDatePickerProps { weekLabel?: string; withPortal?: boolean; yearDropdownItemNumber?: number; + timeInputLabel?: string; + inlineFocusSelectedMonth?: boolean; + onDayMouseEnter?: (date: Date) => void; + onMonthMouseLeave?: () => void; } declare class ReactDatePicker extends React.Component { diff --git a/types/react-datepicker/react-datepicker-tests.tsx b/types/react-datepicker/react-datepicker-tests.tsx index 9486d043eb..d7ea788bc7 100644 --- a/types/react-datepicker/react-datepicker-tests.tsx +++ b/types/react-datepicker/react-datepicker-tests.tsx @@ -116,11 +116,23 @@ const defaultLocale = getDefaultLocale(); weekLabel="" withPortal yearDropdownItemNumber={1} + timeInputLabel="" + inlineFocusSelectedMonth={false} + onDayMouseEnter={(date: Date) => {}} + onMonthMouseLeave={() => {}} >
; + null} +/>; + function handleRef(ref: DatePicker | null) { if (ref) { ref.setBlur(); diff --git a/types/react-datepicker/tsconfig.json b/types/react-datepicker/tsconfig.json index 39a236a343..a52b1ad104 100644 --- a/types/react-datepicker/tsconfig.json +++ b/types/react-datepicker/tsconfig.json @@ -7,7 +7,7 @@ ], "noImplicitAny": true, "noImplicitThis": false, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ @@ -22,4 +22,4 @@ "index.d.ts", "react-datepicker-tests.tsx" ] -} \ No newline at end of file +} diff --git a/types/react-dates/tslint.json b/types/react-dates/tslint.json index 01adabd8ca..1285fdffdc 100644 --- a/types/react-dates/tslint.json +++ b/types/react-dates/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "file-name-casing": false, diff --git a/types/react-dnd-multi-backend/index.d.ts b/types/react-dnd-multi-backend/index.d.ts index 36c161beb0..e0a152c610 100644 --- a/types/react-dnd-multi-backend/index.d.ts +++ b/types/react-dnd-multi-backend/index.d.ts @@ -2,6 +2,7 @@ // Project: https://github.com/LouisBrunner/react-dnd-multi-backend, https://louisbrunner.github.io/dnd-multi-backend/packages/react-dnd-multi-backend // Definitions by: Janeene Beeforth // Adam Haglund +// Rob Valentine // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -97,7 +98,10 @@ export interface PreviewProps { * This is frequently used with the Touch backend to provide a preview on mobile devices. */ export class Preview extends PureComponent {} - +/** + * Pre-existing/default react-dnd-multi-backend transition available to use. + */ + export const MouseTransition: Transition; /** * Pre-existing/default react-dnd-touch-backend transition available to use. * This transition has the setting for "enableMouseEvents" turned on. diff --git a/types/react-dom/test-utils/index.d.ts b/types/react-dom/test-utils/index.d.ts index c6f46edd36..ea61a9c858 100644 --- a/types/react-dom/test-utils/index.d.ts +++ b/types/react-dom/test-utils/index.d.ts @@ -29,7 +29,7 @@ export interface SyntheticEventData extends OptionalEventProperties { clientX?: number; clientY?: number; changedTouches?: TouchList; - charCode?: boolean; + charCode?: number; clipboardData?: DataTransfer; ctrlKey?: boolean; deltaMode?: number; diff --git a/types/react-dom/tslint.json b/types/react-dom/tslint.json index 8179a3659a..3dc65c7465 100644 --- a/types/react-dom/tslint.json +++ b/types/react-dom/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "no-unnecessary-generics": false, "no-unnecessary-type-assertion": false } diff --git a/types/react-dom/v15/react-dom-tests.ts b/types/react-dom/v15/react-dom-tests.ts index 5f5b149594..8d10405a86 100644 --- a/types/react-dom/v15/react-dom-tests.ts +++ b/types/react-dom/v15/react-dom-tests.ts @@ -61,7 +61,7 @@ describe('React dom test utils', () => { node.value = 'giraffe'; ReactTestUtils.Simulate.change(node); - ReactTestUtils.Simulate.keyDown(node, { key: "Enter", keyCode: 13, which: 13 }); + ReactTestUtils.Simulate.keyDown(node, { key: "Enter", charCode: 13, keyCode: 13, which: 13 }); }); it('renderIntoDocument', () => { diff --git a/types/react-dropzone/tslint.json b/types/react-dropzone/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-dropzone/tslint.json +++ b/types/react-dropzone/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-easy-chart/tslint.json b/types/react-easy-chart/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-easy-chart/tslint.json +++ b/types/react-easy-chart/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-file-input/tslint.json b/types/react-file-input/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-file-input/tslint.json +++ b/types/react-file-input/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-flex/tslint.json b/types/react-flex/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-flex/tslint.json +++ b/types/react-flex/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-flexr/tslint.json b/types/react-flexr/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-flexr/tslint.json +++ b/types/react-flexr/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-google-recaptcha/index.d.ts b/types/react-google-recaptcha/index.d.ts index 6636e6c5b6..6c557a79c6 100644 --- a/types/react-google-recaptcha/index.d.ts +++ b/types/react-google-recaptcha/index.d.ts @@ -1,6 +1,8 @@ -// Type definitions for React Google Recaptcha 0.10 +// Type definitions for React Google Recaptcha 1.0 // Project: https://github.com/dozoisch/react-google-recaptcha -// Definitions by: Koala Human , Tom Sturge +// Definitions by: Koala Human +// Tom Sturge +// Max Bo // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -66,6 +68,12 @@ export interface ReCAPTCHAProps { * Optional callback, called when a challenge expires and has to be redone by the user. */ onExpired?: () => void; + /** + * Optional callback, called when reCAPTCHA encounters an error (usually network connectivity) + * and cannot continue until connectivity is restored. If you specify a function here, you are + * responsible for informing the user that they should retry. + */ + onErrored?: () => void; /** * Optional set the stoken parameter, which allows the captcha to be used from different domains, * @see reCAPTCHA secure-token diff --git a/types/react-google-recaptcha/v0/index.d.ts b/types/react-google-recaptcha/v0/index.d.ts new file mode 100644 index 0000000000..6636e6c5b6 --- /dev/null +++ b/types/react-google-recaptcha/v0/index.d.ts @@ -0,0 +1,84 @@ +// Type definitions for React Google Recaptcha 0.10 +// Project: https://github.com/dozoisch/react-google-recaptcha +// Definitions by: Koala Human , Tom Sturge +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +export default ReCAPTCHA; + +declare class ReCAPTCHA extends React.Component { + /** + * Resets the reCAPTCHA widget + */ + reset(): void; + /** + * Programatically invoke the reCAPTCHA check. Used if the invisible reCAPTCHA is on a div instead of a button + */ + execute(): void; + + /** + * Gets the response for the reCAPTCHA widget. + * @return the response of the reCAPTCHA widget. + */ + getValue(): string | null; + + /** + * Gets the widgetId of reCAPTCHA widget + * @return widgetId | null + */ + getWidgetId(): number | null; +} + +type Theme = "light" | "dark"; +type Type = "image" | "audio"; +type Size = "compact" | "normal" | "invisible"; +type Badge = "bottomright" | "bottomleft" | "inline"; + +export interface ReCAPTCHAProps { + /** + * The API client key + */ + sitekey: string; + /** + * The function to be called when the user successfully completes the normal or compat captcha. + * It will also be called with null, when captcha expires + * @param token string or null + */ + onChange?: (token: string|null) => void; + /** + * Optional light or dark theme of the widget + * @default "light" + */ + theme?: Theme; + /** + * Optional image or audio The type of initial captcha + * @default "image" + */ + type?: Type; + /** + * Optional the tabindex of the element + * @default 0 + */ + tabindex?: number; + /** + * Optional callback, called when a challenge expires and has to be redone by the user. + */ + onExpired?: () => void; + /** + * Optional set the stoken parameter, which allows the captcha to be used from different domains, + * @see reCAPTCHA secure-token + */ + stoken?: string; + /** + * Optional compact, normal or invisible. This allows you to change the size or do an invisible captcha + */ + size?: Size; + /** + * Optional. The badge location for g-recaptcha with size of "invisible". + * + * @default "bottomright" + */ + badge?: Badge; +} diff --git a/types/react-google-recaptcha/v0/react-google-recaptcha-tests.tsx b/types/react-google-recaptcha/v0/react-google-recaptcha-tests.tsx new file mode 100644 index 0000000000..deb3eb3a66 --- /dev/null +++ b/types/react-google-recaptcha/v0/react-google-recaptcha-tests.tsx @@ -0,0 +1,15 @@ +import ReCAPTCHA from 'react-google-recaptcha'; +import * as React from 'react'; + +const basicRecapchta = a}/>; +const invisibleRecaptcha: React.SFC = () => { + const recaptchaRef = React.createRef(); + + return ( + + ); +}; diff --git a/types/p-queue/v2/tsconfig.json b/types/react-google-recaptcha/v0/tsconfig.json similarity index 73% rename from types/p-queue/v2/tsconfig.json rename to types/react-google-recaptcha/v0/tsconfig.json index 49d979aa06..cbcd80d948 100644 --- a/types/p-queue/v2/tsconfig.json +++ b/types/react-google-recaptcha/v0/tsconfig.json @@ -2,7 +2,8 @@ "compilerOptions": { "module": "commonjs", "lib": [ - "es6" + "es6", + "dom" ], "noImplicitAny": true, "noImplicitThis": true, @@ -13,14 +14,15 @@ "../../" ], "paths": { - "p-queue": [ "p-queue/v2" ] + "react-google-recaptcha": [ "react-google-recaptcha/v0" ] }, "types": [], + "jsx": "react", "noEmit": true, "forceConsistentCasingInFileNames": true }, "files": [ "index.d.ts", - "p-queue-tests.ts" + "react-google-recaptcha-tests.tsx" ] } diff --git a/types/p-any/tslint.json b/types/react-google-recaptcha/v0/tslint.json similarity index 100% rename from types/p-any/tslint.json rename to types/react-google-recaptcha/v0/tslint.json diff --git a/types/react-helmet/tslint.json b/types/react-helmet/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-helmet/tslint.json +++ b/types/react-helmet/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-highcharts/index.d.ts b/types/react-highcharts/index.d.ts index 26a74e28a9..b8f47af4fb 100644 --- a/types/react-highcharts/index.d.ts +++ b/types/react-highcharts/index.d.ts @@ -20,6 +20,11 @@ interface ReactHighchartsProps { * @param after-render callback. */ callback?(chart: Highcharts.ChartObject): void; + + /** + * Chart will not rerender if the config is referentially equal to previous and this property is true + */ + isPureConfig?: boolean; } /** diff --git a/types/react-highcharts/react-highcharts-tests.tsx b/types/react-highcharts/react-highcharts-tests.tsx index 7c0841e566..f3e31bd534 100644 --- a/types/react-highcharts/react-highcharts-tests.tsx +++ b/types/react-highcharts/react-highcharts-tests.tsx @@ -6,9 +6,12 @@ const config: Highcharts.Options = {}; function callback(chart: Highcharts.ChartObject): void {} +const isPureConfig = true; + export const _ = () => ( <> + ); diff --git a/types/react-holder/tslint.json b/types/react-holder/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-holder/tslint.json +++ b/types/react-holder/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-imageloader/tslint.json b/types/react-imageloader/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-imageloader/tslint.json +++ b/types/react-imageloader/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-infinite/tslint.json b/types/react-infinite/tslint.json index e3610fefae..89955128d5 100644 --- a/types/react-infinite/tslint.json +++ b/types/react-infinite/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-inlinesvg/index.d.ts b/types/react-inlinesvg/index.d.ts index e8e1f4095b..2dde329572 100644 --- a/types/react-inlinesvg/index.d.ts +++ b/types/react-inlinesvg/index.d.ts @@ -31,6 +31,7 @@ export interface Props { uniquifyIDs?: boolean; onError?(error: RequestError | InlineSVGError): void; onLoad?(src: URL | string, isCached: boolean): void; + processSVG?(svgText: string): string; supportTest?(): void; wrapper?(): ReactNode; } diff --git a/types/react-input-calendar/tslint.json b/types/react-input-calendar/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-input-calendar/tslint.json +++ b/types/react-input-calendar/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-instantsearch-core/index.d.ts b/types/react-instantsearch-core/index.d.ts index 0092feb370..ed0241ffad 100644 --- a/types/react-instantsearch-core/index.d.ts +++ b/types/react-instantsearch-core/index.d.ts @@ -333,7 +333,7 @@ interface HitsProvided { * https://community.algolia.com/react-instantsearch/connectors/connectHits.html */ // tslint:disable-next-line:no-unnecessary-generics -export function connectHits(stateless: React.StatelessComponent>): React.ComponentClass; +export function connectHits(stateless: React.StatelessComponent>): React.ComponentClass; export function connectHits, THit>(ctor: React.ComponentType): ConnectedComponentClass>; export function connectHitsPerPage(Composed: React.ComponentType): React.ComponentClass; diff --git a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx index 76cc26f2a4..3d0208707e 100644 --- a/types/react-instantsearch-core/react-instantsearch-core-tests.tsx +++ b/types/react-instantsearch-core/react-instantsearch-core-tests.tsx @@ -408,12 +408,14 @@ import { } const ConnectedCustomHighlight2 = connectHighlight(CustomHighlight2); - connectHits(({ hits }) => ( + const ConnectedStatelessHits = connectHits(({ hits }) => (

)); + + ; }; // https://github.com/algolia/react-instantsearch/blob/master/examples/autocomplete/src/App-Mentions.js diff --git a/types/react-intl-redux/tslint.json b/types/react-intl-redux/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-intl-redux/tslint.json +++ b/types/react-intl-redux/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-is-deprecated/tslint.json b/types/react-is-deprecated/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-is-deprecated/tslint.json +++ b/types/react-is-deprecated/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-jsonschema-form/index.d.ts b/types/react-jsonschema-form/index.d.ts index 403356a89a..fc4da16e0b 100644 --- a/types/react-jsonschema-form/index.d.ts +++ b/types/react-jsonschema-form/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-jsonschema-form 1.0.1 +// Type definitions for react-jsonschema-form 1.3 // Project: https://github.com/mozilla-services/react-jsonschema-form // Definitions by: Dan Fox // Ivan Jiang @@ -6,6 +6,7 @@ // Lucian Buzzo // Sylvain Thénault // Sebastian Busch +// Mehdi Lahlou // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -85,8 +86,9 @@ declare module "react-jsonschema-form" { onChange: (value: any) => void; options: object; formContext: any; - onBlur: (id: string, value: string) => void; - onFocus: (id: string, value: string) => void; + onBlur: (id: string, value: boolean | number | string | null) => void; + onFocus: (id: string, value: boolean | number | string | null) => void; + label: string; } export type Widget = diff --git a/types/react-jsonschema-form/react-jsonschema-form-tests.tsx b/types/react-jsonschema-form/react-jsonschema-form-tests.tsx index 90116127fd..419b21cce5 100644 --- a/types/react-jsonschema-form/react-jsonschema-form-tests.tsx +++ b/types/react-jsonschema-form/react-jsonschema-form-tests.tsx @@ -109,8 +109,26 @@ export class Example extends React.Component { } } -export const CustomWidget: React.SFC = (props) => +export const BooleanCustomWidget: React.SFC = (props) => + props.onFocus('id', true)} + onBlur={()=> props.onFocus('id', true)} + /> + +export const NumberCustomWidget: React.SFC = (props) => + props.onFocus('id', 0)} + onBlur={()=> props.onFocus('id', 0)} + /> + +export const StringCustomWidget: React.SFC = (props) => props.onFocus('id', 'value')} onBlur={()=> props.onFocus('id', 'value')} /> + +export const NullCustomWidget: React.SFC = (props) => + props.onFocus('id', null)} + onBlur={()=> props.onFocus('id', null)} + /> diff --git a/types/react-jsonschema-form/tslint.json b/types/react-jsonschema-form/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-jsonschema-form/tslint.json +++ b/types/react-jsonschema-form/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-lazyload/index.d.ts b/types/react-lazyload/index.d.ts index 3fd9b075e4..9d7453188a 100644 --- a/types/react-lazyload/index.d.ts +++ b/types/react-lazyload/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 -import { Component } from "react"; +import { Component, ReactNode } from "react"; export interface LazyLoadProps { once?: boolean; @@ -13,10 +13,10 @@ export interface LazyLoadProps { overflow?: boolean; resize?: boolean; scroll?: boolean; - children?: JSX.Element; + children?: ReactNode; throttle?: number | boolean; debounce?: number | boolean; - placeholder?: any; + placeholder?: ReactNode; unmountIfInvisible?: boolean; } diff --git a/types/react-leaflet/index.d.ts b/types/react-leaflet/index.d.ts index 04fe17a04f..0b997341ce 100644 --- a/types/react-leaflet/index.d.ts +++ b/types/react-leaflet/index.d.ts @@ -146,6 +146,8 @@ export interface MapProps extends MapEvents, Leaflet.MapOptions, Leaflet.LocateO useFlyTo?: boolean; viewport?: Viewport; whenReady?: () => void; + onViewportChange?: (viewport: Viewport) => void; + onViewportChanged?: (viewport: Viewport) => void; } export class Map

extends MapEvented { @@ -155,8 +157,8 @@ export class Map

void; - onViewportChanged: (viewport: Viewport | null) => void; + onViewportChange: () => void; + onViewportChanged: () => void; bindContainer(container: HTMLDivElement | null | undefined): void; shouldUpdateCenter(next: Leaflet.LatLngExpression, prev: Leaflet.LatLngExpression): boolean; shouldUpdateBounds(next: Leaflet.LatLngBoundsExpression, prev: Leaflet.LatLngBoundsExpression): boolean; @@ -276,6 +278,19 @@ export class ImageOverlay

extends MapLayer { + createLeafletElement(props: P): E; + updateLeafletElement(fromProps: P, toProps: P): void; +} + export class LayerGroup

extends MapLayer { createLeafletElement(props: P): E; } diff --git a/types/react-leaflet/react-leaflet-tests.tsx b/types/react-leaflet/react-leaflet-tests.tsx index 5d1fc2ce7e..2d7a6b1078 100644 --- a/types/react-leaflet/react-leaflet-tests.tsx +++ b/types/react-leaflet/react-leaflet-tests.tsx @@ -634,17 +634,18 @@ export class VectorLayersExample extends Component { } // viewport.js - -const viewportCenter: [number, number] = [51.505, -0.09]; - -const DEFAULT_VIEWPORT = { - center: viewportCenter, - zoom: 13 +const DEFAULT_VIEWPORT: Viewport = { + center: [51.505, -0.09], + zoom: 13, }; -export class ViewportExample extends Component { +interface ViewportExampleState { + viewport: Viewport; +} + +class ViewportExample extends Component { state = { - viewport: DEFAULT_VIEWPORT + viewport: DEFAULT_VIEWPORT, }; onClickReset = () => { @@ -657,15 +658,15 @@ export class ViewportExample extends Component - - + + + ); } } @@ -811,4 +812,4 @@ class CustomPolygon extends Path { ); } } -const leafletComponent = withLeaflet(CustomPolygon); +const leafletComponent = withLeaflet(CustomPolygon); diff --git a/types/react-leaflet/v1/index.d.ts b/types/react-leaflet/v1/index.d.ts index c362a1f23c..ac35e98a72 100644 --- a/types/react-leaflet/v1/index.d.ts +++ b/types/react-leaflet/v1/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-leaflet 1.1 +// Type definitions for react-leaflet 1.9 // Project: https://github.com/PaulLeCam/react-leaflet // Definitions by: Dave Leaver , David Schneider , Yui T. // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped @@ -12,6 +12,11 @@ import * as React from 'react'; export type Children = React.ReactNode | React.ReactNode[]; +export interface Viewport { + center: [number, number] | null | undefined; + zoom: number | null | undefined; +} + export interface MapEvents { onclick?(event: Leaflet.LeafletMouseEvent): void; ondblclick?(event: Leaflet.LeafletMouseEvent): void; @@ -140,18 +145,42 @@ export interface MapProps extends MapEvents, Leaflet.MapOptions, Leaflet.LocateO minZoom?: number; style?: React.CSSProperties; useFlyTo?: boolean; + viewport?: Viewport; + whenReady?: () => void; zoom?: number; + onViewportChange?: (viewport: Viewport) => void; + onViewportChanged?: (viewport: Viewport) => void; } export class Map

extends MapComponent { className?: string; container: HTMLDivElement; + viewport: Viewport; getChildContext(): { layerContainer: E, map: E }; createLeafletElement(props: P): E; updateLeafletElement(fromProps: P, toProps: P): void; bindContainer(container: HTMLDivElement): void; shouldUpdateCenter(next: Leaflet.LatLngExpression, prev: Leaflet.LatLngExpression): boolean; shouldUpdateBounds(next: Leaflet.LatLngBoundsExpression, prev: Leaflet.LatLngBoundsExpression): boolean; + onViewportChange: () => void; + onViewportChanged: () => void; +} + +export interface DivOverlayProps extends Leaflet.DivOverlayOptions { + children: Children; + onClose?: () => void; + onOpen?: () => void; +} + +export interface DivOverlayTypes extends Leaflet.Evented { + isOpen: () => boolean; + update: () => void; +} + +export class DivOverlay

extends MapComponent { + onClose: () => void; + onOpen: () => void; + onRender: () => void; } export interface PaneProps { @@ -213,6 +242,19 @@ export class ImageOverlay

extends MapLayer { + getChildContext(): { popupContainer: E }; +} + export interface LayerGroupProps { children?: Children; } @@ -284,10 +326,10 @@ export interface RectangleProps extends PathEvents, Leaflet.PolylineOptions { } export class Rectangle

extends Path { } -export interface PopupProps extends Leaflet.PopupOptions { - children?: Children; +export interface PopupProps extends DivOverlayProps, Leaflet.PopupOptions { position?: Leaflet.LatLngExpression; } + export class Popup

extends MapComponent { onPopupOpen(arg: { popup: E }): void; onPopupClose(arg: { popup: E }): void; @@ -295,9 +337,9 @@ export class Popup

extends MapComponent { onTooltipOpen(arg: { tooltip: E }): void; onTooltipClose(arg: { tooltip: E }): void; diff --git a/types/react-leaflet/v1/react-leaflet-tests.tsx b/types/react-leaflet/v1/react-leaflet-tests.tsx index fe9825c465..cc461d1097 100644 --- a/types/react-leaflet/v1/react-leaflet-tests.tsx +++ b/types/react-leaflet/v1/react-leaflet-tests.tsx @@ -24,6 +24,8 @@ import { Rectangle, TileLayer, Tooltip, + Viewport, + VideoOverlay, WMSTileLayer, ZoomControl } from 'react-leaflet'; @@ -628,6 +630,75 @@ export class VectorLayersExample extends Component { } } +// viewport.js +const DEFAULT_VIEWPORT: Viewport = { + center: [51.505, -0.09], + zoom: 13, +}; + +interface ViewportExampleState { + viewport: Viewport; +} + +export class ViewportExample extends Component { + state = { + viewport: DEFAULT_VIEWPORT, + }; + + onClickReset = () => { + this.setState({ viewport: DEFAULT_VIEWPORT }); + } + + onViewportChanged = (viewport: Viewport) => { + this.setState({ viewport }); + } + + render() { + return ( + + + + ); + } +} + +// video-overlay.js +interface VideoOverlayExampleState { + play: boolean; +} + +export class VideoOverlayExample extends Component { + state = { + play: true, + }; + + onTogglePlay = () => { + this.setState({ play: !this.state.play }); + } + + render() { + return ( + + + + + ); + } +} + // wms-tile-layer.js interface WMSTileLayerExampleState { lat: number; diff --git a/types/react-map-gl/index.d.ts b/types/react-map-gl/index.d.ts index 4d147d3611..e0b25765de 100644 --- a/types/react-map-gl/index.d.ts +++ b/types/react-map-gl/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-map-gl 4.0 +// Type definitions for react-map-gl 4.1 // Project: https://github.com/uber/react-map-gl#readme // Definitions by: Robert Imig // Fabio Berta +// Sander Siim // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 @@ -226,6 +227,7 @@ export interface InteractiveMapProps extends StaticMapProps { keyboard?: boolean; onHover?: (event: PointerEvent) => void; onClick?: (event: PointerEvent) => void; + onNativeClick?: (event: PointerEvent) => void; onDblClick?: (event: PointerEvent) => void; onContextMenu?: (event: PointerEvent) => void; onMouseDown?: (event: PointerEvent) => void; @@ -308,6 +310,25 @@ export interface NavigationControlProps extends BaseControlProps { export class NavigationControl extends BaseControl {} +export interface FullscreenControlProps extends BaseControlProps { + className?: string; + container?: HTMLElement | null; +} + +export class FullscreenControl extends BaseControl {} + +export interface GeolocateControlProps extends BaseControlProps { + className?: string; + positionOptions?: MapboxGL.PositionOptions; + fitBoundsOptions?: MapboxGL.FitBoundsOptions; + trackUserLocation?: boolean; + showUserLocation?: boolean; + onViewStateChange?: (info: ViewStateChangeInfo) => void; + onViewportChange?: (viewState: ViewState) => void; +} + +export class GeolocateControl extends BaseControl {} + export interface DraggableControlProps extends BaseControlProps { draggable?: boolean; onDrag?: (event: DragEvent) => void; diff --git a/types/react-map-gl/react-map-gl-tests.tsx b/types/react-map-gl/react-map-gl-tests.tsx index c9024287c9..17179fb0d6 100644 --- a/types/react-map-gl/react-map-gl-tests.tsx +++ b/types/react-map-gl/react-map-gl-tests.tsx @@ -5,6 +5,8 @@ import { CanvasOverlay, SVGOverlay, HTMLOverlay, + FullscreenControl, + GeolocateControl, CanvasRedrawOptions, HTMLRedrawOptions, SVGRedrawOptions, @@ -37,6 +39,8 @@ class MyMap extends React.Component<{}, State> { width={400} ref={this.setRefInteractive} > + + { const { diff --git a/types/react-mdl/tslint.json b/types/react-mdl/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-mdl/tslint.json +++ b/types/react-mdl/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-medium-image-zoom/index.d.ts b/types/react-medium-image-zoom/index.d.ts new file mode 100644 index 0000000000..b3e9fcf14e --- /dev/null +++ b/types/react-medium-image-zoom/index.d.ts @@ -0,0 +1,43 @@ +// Type definitions for react-medium-image-zoom 3.0 +// Project: https://github.com/rpearce/react-medium-image-zoom#readme +// Definitions by: James Bellamy +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import * as React from "react"; + +export interface ImageZoom_Image { + src: string; + alt?: string; + className?: string; + style?: object; +} + +export interface ImageZoom_ZoomImage { + src?: string; + alt?: string; + className?: string; + style?: object; +} + +export interface ImageZoomDefaultStyles { + zoomContainer?: object; + overlay?: object; + image?: object; + zoomImage?: object; +} + +export interface ImageZoomProps { + image: ImageZoom_Image; + zoomImage?: ImageZoom_ZoomImage; + zoomMargin?: number; + isZoomed?: boolean; + shouldHandleZoom?: () => boolean; + shouldReplaceImage?: boolean; + shouldRespectMaxDimension?: boolean; + defaultStyles?: ImageZoomDefaultStyles; + onZoom?: () => object; + onUnzoom?: () => object; +} + +export default class ImageZoom extends React.Component {} diff --git a/types/react-medium-image-zoom/react-medium-image-zoom-tests.tsx b/types/react-medium-image-zoom/react-medium-image-zoom-tests.tsx new file mode 100644 index 0000000000..45d3ef1138 --- /dev/null +++ b/types/react-medium-image-zoom/react-medium-image-zoom-tests.tsx @@ -0,0 +1,23 @@ +import * as React from "react"; +import ImageZoom from "react-medium-image-zoom"; + +const component: React.FC = () => { + return ( +

+ +
+ ); +}; + +export default component; diff --git a/types/react-medium-image-zoom/tsconfig.json b/types/react-medium-image-zoom/tsconfig.json new file mode 100644 index 0000000000..4b1dd42ee0 --- /dev/null +++ b/types/react-medium-image-zoom/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-medium-image-zoom-tests.tsx" + ] +} diff --git a/types/p-cancelable/tslint.json b/types/react-medium-image-zoom/tslint.json similarity index 100% rename from types/p-cancelable/tslint.json rename to types/react-medium-image-zoom/tslint.json diff --git a/types/react-mixin/tslint.json b/types/react-mixin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-mixin/tslint.json +++ b/types/react-mixin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-motion-slider/tslint.json b/types/react-motion-slider/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-motion-slider/tslint.json +++ b/types/react-motion-slider/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-motion/tslint.json b/types/react-motion/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-motion/tslint.json +++ b/types/react-motion/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-native-canvas/index.d.ts b/types/react-native-canvas/index.d.ts new file mode 100644 index 0000000000..1c1f973102 --- /dev/null +++ b/types/react-native-canvas/index.d.ts @@ -0,0 +1,206 @@ +// Type definitions for react-native-canvas 0.1 +// Project: https://github.com/iddan/react-native-canvas#readme +// Definitions by: hmajid2301 +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.1 + +import * as React from "react"; +import { StyleProp, ViewStyle } from "react-native"; + +export interface CanvasProps { + baseUrl?: string; + originWhitelist?: string[]; + ref: (canvas: Canvas) => any; + style?: StyleProp; +} + +export interface CanvasRenderingContext2D { + fillStyle: string; + font: string; + globalAlpha: number; + globalCompositionOperation: string; + linecap: string; + lineDashOffset: number; + lineJoin: string; + lineWidth: number; + miterLimit: number; + shadowBlur: number; + shadowColor: string; + shadowOffsetX: number; + shadowOffsetY: number; + strokeStyle: string; + textAlign: string; + arc: ( + x: number, + y: number, + r: number, + sAngle: number, + eAngle: number, + counterClockwise?: number + ) => void; + arcTo: (x1: number, y1: number, x2: number, y2: number, r: number) => void; + beginPath: () => void; + bezierCurveTo: ( + cp1x: number, + cp1y: number, + cp2x: number, + cp2y: number, + x: number, + y: number + ) => void; + clearRect: (x: number, y: number, width: number, height: number) => void; + clip: () => void; + closePath: () => void; + createImageData: ( + // + width: number, + height: number, + imageData: ImageData + ) => void; + createLinearGradient: ( + x0: number, + yo: number, + x1: number, + y1: number + ) => void; + createPattern: () => void; + createRadialGradient: ( + x0: number, + y0: number, + r0: number, + x1: number, + y1: number, + r1: number + ) => void; + drawFocusIfNeeded: (html: HTMLElement) => void; + drawImage: ( + image: Image, + dx: number, + dy: number, + sx?: number, + sy?: number, + sWidth?: number, + sHeight?: number, + dWidth?: number, + dHeight?: number + ) => void; + drawWidgetAsOnScreen: (window: any) => void; + drawWindow: ( + window: any, + x: number, + y: number, + w: number, + h: number, + bgColor: string, + flags?: any + ) => void; // + fill: (Path2D: Path2D, fillRule?: any) => void; + fillRect: (x: number, y: number, width: number, height: number) => void; + fillText: (text: string, x: number, y: number, maxWidth?: number) => void; + ellipse: ( + x: number, + y: number, + radiusX: number, + radiusY: number, + rotation: number, + startAngle: number, + endAngle: number, + anticlockwise?: boolean + ) => void; + getImageData: (sx: number, sy: number, sw: number, sh: number) => ImageData; + getLineDash: () => number[]; + isPointInPath: ( + x: number, + y: number, + fillRule: any, + path: Path2D + ) => boolean; + isPointInStroke: (x: number, y: number, path: Path2D) => boolean; + lineTo: (x: number, y: number) => void; + measureText: (text: string) => any; + moveTo: (x: number, y: number) => void; + putImageData: ( + imageData: ImageData, + dx: number, + dy: number, + dirtyX?: number, + dirtyY?: number, + dirtyWidth?: number, + dirtyHeight?: number + ) => void; + quadraticCurveTo: (cpx: number, cpy: number, x: number, y: number) => void; + rect: (x: number, y: number, width: number, height: number) => void; + restore: () => void; + rotate: (angle: number) => void; + save: () => void; + scale: (x: number, y: number) => void; + setLineDash: (segments: number[]) => void; + setTransform: ( + a: number, + b: number, + c: number, + d: number, + e: number, + f: number + ) => void; + stroke: (path: Path2D) => void; + strokeRect: (x: number, y: number, width: number, height: number) => void; + strokeText: (text: string, x: number, y: number, maxWidth?: number) => void; + transform: ( + a: number, + b: number, + c: number, + d: number, + e: number, + f: number + ) => void; + translate: (x: number, y: number) => void; +} + +export default class Canvas extends React.Component { + width: number; + height: number; + toDataURL: () => string; + getContext: (context: string) => CanvasRenderingContext2D; +} + +export class Image { + constructor(canvas: Canvas, height?: number, width?: number); + crossOrigin: string | undefined; + height: number; + width: number; + src: string; + addEventListener: (event: string, func: (...args: any) => any) => void; +} + +export class ImageData { + constructor(canvas: Canvas, data: number[], height: number, width: number); + readonly data: number[]; + readonly height: number; + readonly width: number; +} + +export class Path2D { + constructor(canvas: Canvas, ...args: any); + addPath: ( + path: Path2D, + transform?: { + a: number; + b: number; + c: number; + d: number; + e: number; + f: number; + } + ) => void; + + closePath: CanvasRenderingContext2D["closePath"]; + moveTo: CanvasRenderingContext2D["moveTo"]; + lineTo: CanvasRenderingContext2D["lineTo"]; + bezierCurveTo: CanvasRenderingContext2D["bezierCurveTo"]; + quadraticCurveTo: CanvasRenderingContext2D["quadraticCurveTo"]; + arc: CanvasRenderingContext2D["arc"]; + arcTo: CanvasRenderingContext2D["arcTo"]; + ellipse: CanvasRenderingContext2D["ellipse"]; + rect: CanvasRenderingContext2D["rect"]; +} diff --git a/types/react-native-canvas/react-native-canvas-tests.tsx b/types/react-native-canvas/react-native-canvas-tests.tsx new file mode 100644 index 0000000000..4b5227231b --- /dev/null +++ b/types/react-native-canvas/react-native-canvas-tests.tsx @@ -0,0 +1,52 @@ +import * as React from "react"; +import { View } from "react-native"; +import Canvas, { + Image as CanvasImage, + Path2D, + ImageData +} from "react-native-canvas"; + +class CanvasTest extends React.Component { + render() { + return ( + + + + ); + } + + handleCanvas = (canvas: Canvas) => { + canvas.width = 100; + canvas.height = 100; + + const context = canvas.getContext("2d"); + context.fillStyle = "purple"; + context.fillRect(0, 0, 100, 100); + + const ellipse = new Path2D(canvas); + ellipse.ellipse(50, 50, 25, 35, (45 * Math.PI) / 180, 0, 2 * Math.PI); + context.fillStyle = "purple"; + context.fill(ellipse); + + const image = new CanvasImage(canvas); + canvas.width = 100; + canvas.height = 100; + + image.src = + "https://upload.wikimedia.org/wikipedia/commons/6/63/Biho_Takashi._Bat_Before_the_Moon%2C_ca._1910.jpg"; + image.addEventListener("load", () => { + context.drawImage(image, 0, 0, 100, 100); + }); + + const imageData = context.getImageData(0, 0, 100, 100); + const data = Object.values(imageData.data); + const length = Object.keys(data).length; + for (let i = 0; i < length; i += 4) { + data[i] = 0; + data[i + 1] = 0; + data[i + 2] = 0; + } + const imgData = new ImageData(canvas, data, 100, 100); + context.putImageData(imgData, 0, 0); + } +} diff --git a/types/react-native-canvas/tsconfig.json b/types/react-native-canvas/tsconfig.json new file mode 100644 index 0000000000..a86d644a9f --- /dev/null +++ b/types/react-native-canvas/tsconfig.json @@ -0,0 +1,17 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": ["es6", "es2017"], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": ["../"], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react-native" + }, + "files": ["index.d.ts", "react-native-canvas-tests.tsx"] +} diff --git a/types/p-catch-if/tslint.json b/types/react-native-canvas/tslint.json similarity index 100% rename from types/p-catch-if/tslint.json rename to types/react-native-canvas/tslint.json diff --git a/types/react-native-orientation/tslint.json b/types/react-native-orientation/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-native-orientation/tslint.json +++ b/types/react-native-orientation/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-native-share/index.d.ts b/types/react-native-share/index.d.ts index bf382a8b2c..7ea5025a6e 100644 --- a/types/react-native-share/index.d.ts +++ b/types/react-native-share/index.d.ts @@ -23,7 +23,7 @@ interface ShareSingleReturn { } interface Options { - url: string; + url?: string; urls?: string[]; type?: string; message?: string; diff --git a/types/react-native-sortable-list/tslint.json b/types/react-native-sortable-list/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-native-sortable-list/tslint.json +++ b/types/react-native-sortable-list/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-native-tab-navigator/index.d.ts b/types/react-native-tab-navigator/index.d.ts index 1586b7279a..7ee7a52cf2 100644 --- a/types/react-native-tab-navigator/index.d.ts +++ b/types/react-native-tab-navigator/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for react-native-tab-navigator 0.3 // Project: https://github.com/exponentjs/react-native-tab-navigator#readme -// Definitions by: My Self +// Definitions by: Kyle Roach // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 diff --git a/types/react-native-tab-view/index.d.ts b/types/react-native-tab-view/index.d.ts index a6e6b27735..43517fa20b 100644 --- a/types/react-native-tab-view/index.d.ts +++ b/types/react-native-tab-view/index.d.ts @@ -212,6 +212,8 @@ export type TabBarProps = SceneRendererProps< renderBadge?: (scene: Scene) => ReactNode onTabPress?: (scene: Scene) => void onTabLongPress?: (scene: Scene) => void + activeColor?: string + inactiveColor?: string pressColor?: string pressOpacity?: number scrollEnabled?: boolean diff --git a/types/react-native-touch-id/tslint.json b/types/react-native-touch-id/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-native-touch-id/tslint.json +++ b/types/react-native-touch-id/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-native-video/index.d.ts b/types/react-native-video/index.d.ts index 4ce9bf9b2d..88e19ae7a9 100644 --- a/types/react-native-video/index.d.ts +++ b/types/react-native-video/index.d.ts @@ -57,7 +57,8 @@ export interface VideoProperties extends ViewProps { /* Wrapper component */ // Opaque type returned by require('./video.mp4') source: { uri?: string } | number; - resizeMode?: string; + resizeMode?: "stretch" | "contain" | "cover" | "none"; // via Image#resizeMode + posterResizeMode?: "stretch" | "contain" | "cover" | "none"; // via Image#resizeMode poster?: string; repeat?: boolean; paused?: boolean; @@ -92,7 +93,7 @@ export interface VideoProperties extends ViewProps { onReadyForDisplay?(): void; onPlaybackStalled?(): void; onPlaybackResume?(): void; - onPlaybackRateChange?(): void; + onPlaybackRateChange?(data: { playbackRate: number }): void; onAudioFocusChanged?(): void; onAudioBecomingNoisy?(): void; selectedTextTrack?: { diff --git a/types/react-native-video/react-native-video-tests.tsx b/types/react-native-video/react-native-video-tests.tsx index 2df7edfccd..d747c9890b 100644 --- a/types/react-native-video/react-native-video-tests.tsx +++ b/types/react-native-video/react-native-video-tests.tsx @@ -9,4 +9,6 @@ import Video from 'react-native-video'; console.log(data.canPlayFastForward, data.canPlayReverse, data.canPlaySlowForward, data.canPlaySlowReverse, data.canStepBackward, data.canStepForward, data.currentTime, data.duration, data.naturalSize.height, data.naturalSize.width, data.naturalSize.orientation); }} + onPlaybackRateChange={({playbackRate}) => console.log(playbackRate)} + posterResizeMode={"cover"} />; diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts index a96ffd41eb..1c6d6437d9 100644 --- a/types/react-native/index.d.ts +++ b/types/react-native/index.d.ts @@ -17,6 +17,7 @@ // Ryan Nickel // Souvik Ghosh // Cheng Gibson +// Saransh Kataria // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -903,6 +904,14 @@ export interface TextProps extends TextPropsIOS, TextPropsAndroid, Accessibility * Used to reference react managed views from native code. */ nativeID?: string; + + /** + * Specifies largest possible scale a font can reach when allowFontScaling is enabled. Possible values: + * - null/undefined (default): inherit from the parent node or the global default (0) + * - 0: no max, ignore parent/global default + * - >= 1: sets the maxFontSizeMultiplier of this node to this value + */ + maxFontSizeMultiplier?: number | null; } /** @@ -1134,6 +1143,11 @@ export interface TextInputAndroidProps { * The color of the textInput underline. */ underlineColorAndroid?: string; + + /** + * Vertically align text when `multiline` is set to true + */ + textAlignVertical?: "auto" | "top" | "bottom" | "center"; } export type KeyboardType = "default" | "email-address" | "numeric" | "phone-pad"; @@ -1427,6 +1441,14 @@ export interface TextInputProps extends ViewProps, TextInputIOSProps, TextInputA * or set/update maxLength to prevent unwanted edits without flicker. */ value?: string; + + /** + * Specifies largest possible scale a font can reach when allowFontScaling is enabled. Possible values: + * - null/undefined (default): inherit from the parent node or the global default (0) + * - 0: no max, ignore parent/global default + * - >= 1: sets the maxFontSizeMultiplier of this node to this value + */ + maxFontSizeMultiplier?: number | null; } /** @@ -9297,9 +9319,11 @@ export const PointPropType: React.Validator; export const ViewPropTypes: React.ValidationMap; declare global { - type ReactNativeRequireFunction = (name: string) => any; + interface NodeRequire { + (id: string): any; + } - var require: ReactNativeRequireFunction; + var require: NodeRequire; /** * Console polyfill diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx index 622e2b28c8..49e1bab1ac 100644 --- a/types/react-native/test/index.tsx +++ b/types/react-native/test/index.tsx @@ -648,7 +648,7 @@ class TextInputTest extends React.Component<{}, { username: string }> { - + ); } @@ -834,6 +834,8 @@ const NativeIDTest = () => ( ); +const MaxFontSizeMultiplierTest = () => Text; + const ShareTest = () => { Share.share( { title: "title", message: "message" }, diff --git a/types/react-navigation/index.d.ts b/types/react-navigation/index.d.ts index f2b0b968fb..9b2aee84e2 100644 --- a/types/react-navigation/index.d.ts +++ b/types/react-navigation/index.d.ts @@ -872,10 +872,6 @@ export interface StackNavigatorConfig } // Return createNavigationContainer -export function StackNavigator( - routeConfigMap: NavigationRouteConfigMap, - stackConfig?: StackNavigatorConfig -): NavigationContainer; export function createStackNavigator( routeConfigMap: NavigationRouteConfigMap, @@ -892,11 +888,6 @@ export interface SwitchNavigatorConfig { // Return createNavigationContainer export type _SwitchNavigatorConfig = NavigationSwitchRouterConfig; -export function SwitchNavigator( - routeConfigMap: NavigationRouteConfigMap, - switchConfig?: SwitchNavigatorConfig -): NavigationContainer; - export function createSwitchNavigator( routeConfigMap: NavigationRouteConfigMap, switchConfig?: SwitchNavigatorConfig @@ -962,11 +953,6 @@ export interface DrawerNavigatorConfig drawerLockMode?: DrawerLockMode; } -export function DrawerNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawerConfig?: DrawerNavigatorConfig -): NavigationContainer; - export function createDrawerNavigator( routeConfigMap: NavigationRouteConfigMap, drawerConfig?: DrawerNavigatorConfig @@ -1021,15 +1007,6 @@ export interface BottomTabNavigatorConfig } // From navigators/TabNavigator.js -export function TabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; - -export function createTabNavigator( - routeConfigMap: NavigationRouteConfigMap, - drawConfig?: TabNavigatorConfig -): NavigationContainer; export function createBottomTabNavigator( routeConfigMap: NavigationRouteConfigMap, diff --git a/types/react-navigation/react-navigation-tests.tsx b/types/react-navigation/react-navigation-tests.tsx index 777a8fa9f3..2f7c65f9cd 100644 --- a/types/react-navigation/react-navigation-tests.tsx +++ b/types/react-navigation/react-navigation-tests.tsx @@ -36,7 +36,7 @@ import { createSwitchNavigator, SwitchNavigatorConfig, TabBarTop, - createTabNavigator, + createMaterialTopTabNavigator, TabNavigatorConfig, Transitioner, HeaderBackButton, @@ -245,7 +245,7 @@ const tabNavigatorConfigWithNavigationOptions: TabNavigatorConfig = { }, }; -const BasicTabNavigator = createTabNavigator( +const BasicTabNavigator = createMaterialTopTabNavigator( routeConfigMap, tabNavigatorConfig, ); diff --git a/types/react-notification-system/tslint.json b/types/react-notification-system/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-notification-system/tslint.json +++ b/types/react-notification-system/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-onclickoutside/index.d.ts b/types/react-onclickoutside/index.d.ts index fd31f35869..02fd4eebe4 100644 --- a/types/react-onclickoutside/index.d.ts +++ b/types/react-onclickoutside/index.d.ts @@ -2,11 +2,14 @@ // Project: https://github.com/Pomax/react-onclickoutside // Definitions by: Karol Janyst // Boris Sergeyev +// Thomas Levy // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 import * as React from "react"; +export {}; + export interface HandleClickOutside { handleClickOutside: React.MouseEventHandler; } @@ -38,7 +41,25 @@ export interface ClickOutComponentClass

extends React.ComponentClass

{ export type OnClickOutProps

= WithoutInjectedClickOutProps

& AdditionalProps; -export default function OnClickOut

( - component: ComponentConstructor

| ClickOutComponentClass

, - config?: ConfigObject -): React.ComponentClass>; +interface WrapperClass { + new (): WrapperInstance; +} + +interface WrapperInstance + extends React.Component>> { + getInstance(): C extends typeof React.Component ? InstanceType : never; +} + +type PropsOf = T extends ( + props: infer P, + context?: any +) => React.ReactElement | null // Try to infer for SFCs + ? P + : T extends new (props: infer P, context?: any) => React.Component // Otherwise try to infer for classes + ? P + : never; + +export default function OnClickOut< + C extends ComponentConstructor

| ClickOutComponentClass

, + P = PropsOf +>(component: C, config?: ConfigObject): WrapperClass; diff --git a/types/react-onclickoutside/react-onclickoutside-tests.tsx b/types/react-onclickoutside/react-onclickoutside-tests.tsx index e7ee43e30d..21732498e8 100644 --- a/types/react-onclickoutside/react-onclickoutside-tests.tsx +++ b/types/react-onclickoutside/react-onclickoutside-tests.tsx @@ -48,6 +48,10 @@ class TestComponent extends React.Component<{ disableOnClickOutside(): void; ena console.log('this.handleClickOutside'); } + logProps = () => { + console.log(this.props); + } + render() { this.props.disableOnClickOutside(); this.props.enableOnClickOutside(); @@ -58,12 +62,18 @@ class TestComponent extends React.Component<{ disableOnClickOutside(): void; ena } const WrappedComponent = onClickOutside(TestComponent); +const wrappedComponentRef: React.RefObject> = React.createRef(); render( , document.getElementById("main") ); + +if (wrappedComponentRef.current) { + wrappedComponentRef.current.getInstance().logProps(); +} diff --git a/types/react-props-decorators/tslint.json b/types/react-props-decorators/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-props-decorators/tslint.json +++ b/types/react-props-decorators/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-redux-i18n/tslint.json b/types/react-redux-i18n/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-redux-i18n/tslint.json +++ b/types/react-redux-i18n/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-redux-toastr/tslint.json b/types/react-redux-toastr/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-redux-toastr/tslint.json +++ b/types/react-redux-toastr/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-redux/index.d.ts b/types/react-redux/index.d.ts index 5adeb43612..f97fd11b9d 100644 --- a/types/react-redux/index.d.ts +++ b/types/react-redux/index.d.ts @@ -6,7 +6,6 @@ // Frank Tan // Nicholas Boll // Dibyo Majumdar -// Prashant Deva // Thomas Charlat // Valentin Descamps // Johann Rakotoharisoa @@ -44,6 +43,8 @@ import { Store } from 'redux'; +import hoistNonReactStatics = require('hoist-non-react-statics'); + // Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html export type Omit = Pick>; @@ -96,7 +97,10 @@ export type GetProps = C extends ComponentType ? P : never; // Applies LibraryManagedAttributes (proper handling of defaultProps // and propTypes), as well as defines WrappedComponent. -export type ConnectedComponentClass = ComponentClass> & { +export type ConnectedComponentClass< + C extends ComponentType, + P +> = ComponentClass> & hoistNonReactStatics.NonReactStatics & { WrappedComponent: C; }; diff --git a/types/react-redux/package.json b/types/react-redux/package.json index 7f5b19d45b..e9c8c9b9f8 100644 --- a/types/react-redux/package.json +++ b/types/react-redux/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { + "@types/hoist-non-react-statics": "^3.3.0", "redux": "^4.0.0" } } diff --git a/types/react-redux/react-redux-tests.tsx b/types/react-redux/react-redux-tests.tsx index ee5b9c1d94..085874a523 100644 --- a/types/react-redux/react-redux-tests.tsx +++ b/types/react-redux/react-redux-tests.tsx @@ -1167,6 +1167,48 @@ function TestLibraryManagedAttributes() { { }} />; } +function TestNonReactStatics() { + interface OwnProps { + bar: number; + } + + interface MapStateProps { + foo: string; + } + + class Component extends React.Component { + static defaultProps = { + bar: 0, + }; + + static meaningOfLife = 42; + + render() { + return

; + } + } + + function mapStateToProps(state: any): MapStateProps { + return { + foo: 'foo', + }; + } + + Component.meaningOfLife; + Component.defaultProps.bar; + + const ConnectedComponent = connect(mapStateToProps)(Component); + + // This is a non-React static and should be hoisted as-is. + ConnectedComponent.meaningOfLife; + + // This is a React static, so it's not hoisted. + // However, ConnectedComponent is still a ComponentClass, which specifies `defaultProps` + // as an optional static member. We can force an error (and assert that `defaultProps` + // wasn't hoisted) by reaching into the `defaultProps` object without a null check. + ConnectedComponent.defaultProps.bar; // $ExpectError +} + function TestProviderContext() { const store: Store = createStore((state = {}) => state); const nullContext = React.createContext(null); diff --git a/types/react-request/react-request-tests.tsx b/types/react-request/react-request-tests.tsx index 6a4ff71212..5e5edf31d2 100644 --- a/types/react-request/react-request-tests.tsx +++ b/types/react-request/react-request-tests.tsx @@ -8,13 +8,16 @@ interface ServerResponse { export default class BasicReactRequest extends React.Component { render() { return url='/api/server'> - {({ fetching, failed, data, response }) => { + {({ fetching, failed, data, response, doFetch }) => { if (fetching || !response) { return

Loading...

; } if (failed) { return

Failed to load

; } + if (!data) { + doFetch(); + } return

{data ? data.foo : 'data was null'}

; }} ; diff --git a/types/react-router-bootstrap/tslint.json b/types/react-router-bootstrap/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-router-bootstrap/tslint.json +++ b/types/react-router-bootstrap/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-router-config/index.d.ts b/types/react-router-config/index.d.ts index 0dc1544ca6..bf719c5760 100644 --- a/types/react-router-config/index.d.ts +++ b/types/react-router-config/index.d.ts @@ -15,6 +15,7 @@ export interface RouteConfigComponentProps> | React.ComponentType; path?: string; diff --git a/types/react-router/index.d.ts b/types/react-router/index.d.ts index 6ed1f19bd0..62c80aef8f 100644 --- a/types/react-router/index.d.ts +++ b/types/react-router/index.d.ts @@ -20,6 +20,7 @@ // Duong Tran // Ben Smith // Wesley Tsai +// Sebastian Silbermann // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -124,8 +125,8 @@ export interface match { url: string; } -// Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html -export type Omit = Pick>; +// Omit taken from https://github.com/Microsoft/TypeScript/issues/28339#issuecomment-467220238 +export type Omit = T extends any ? Pick> : never; export function matchPath(pathname: string, props: string | RouteProps, parent?: match | null): match | null; diff --git a/types/react-router/test/WithRouter.tsx b/types/react-router/test/WithRouter.tsx index 4db65a32bd..5782b08429 100644 --- a/types/react-router/test/WithRouter.tsx +++ b/types/react-router/test/WithRouter.tsx @@ -22,3 +22,31 @@ const WithRouterTestFunction = () => ( ); const WithRouterTestClass = () => ; + +// union props +{ + interface Book { + kind: 'book'; + author: string; + } + + interface Magazine { + kind: 'magazine'; + issue: number; + } + + type SomethingToRead = (Book | Magazine) & RouteComponentProps; + + const Readable: React.SFC = props => { + if (props.kind === 'magazine') { + return
magazine #{props.issue}
; + } + + return
magazine #{props.author}
; + }; + + const RoutedReadable = withRouter(Readable); + + ; + ; // $ExpectError +} diff --git a/types/react-scroll-into-view-if-needed/index.d.ts b/types/react-scroll-into-view-if-needed/index.d.ts new file mode 100644 index 0000000000..2522833fbd --- /dev/null +++ b/types/react-scroll-into-view-if-needed/index.d.ts @@ -0,0 +1,21 @@ +// Type definitions for react-scroll-into-view-if-needed 2.1 +// Project: https://github.com/icd2k3/react-scroll-into-view-if-needed#readme +// Definitions by: Angus Fretwell +// Allan Pope +// Jonathan Ly +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.9 + +import * as React from 'react'; +import * as ScrollIntoViewIfNeeded from 'scroll-into-view-if-needed'; + +export interface ReactScrollIntoViewIfNeededProps + extends React.HTMLProps { + options?: ScrollIntoViewIfNeeded.Options; + active?: boolean; + elementType?: keyof JSX.IntrinsicElements; +} + +export default class ReactScrollIntoViewIfNeeded extends React.Component< + ReactScrollIntoViewIfNeededProps +> {} diff --git a/types/react-scroll-into-view-if-needed/package.json b/types/react-scroll-into-view-if-needed/package.json new file mode 100644 index 0000000000..bc0a926e27 --- /dev/null +++ b/types/react-scroll-into-view-if-needed/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "scroll-into-view-if-needed": "*" + } +} diff --git a/types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx b/types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx new file mode 100644 index 0000000000..562615e74c --- /dev/null +++ b/types/react-scroll-into-view-if-needed/react-scroll-into-view-if-needed-tests.tsx @@ -0,0 +1,52 @@ +import * as React from 'react'; +import ReactScrollIntoViewIfNeeded from 'react-scroll-into-view-if-needed'; + +const validOptions = { + block: 'start', + scrollMode: 'if-needed', + skipOverflowHiddenElements: true +}; + +const invalidOptions = { + invalidOption: 'foobar' +}; + +() => ( + + Children + +); + +() => ( + + Children + +); + +() => ( + + Children + +); + +() => ( + + Children + +); diff --git a/types/del/tsconfig.json b/types/react-scroll-into-view-if-needed/tsconfig.json similarity index 65% rename from types/del/tsconfig.json rename to types/react-scroll-into-view-if-needed/tsconfig.json index 6143d08346..cfa539dc78 100644 --- a/types/del/tsconfig.json +++ b/types/react-scroll-into-view-if-needed/tsconfig.json @@ -1,23 +1,17 @@ { "compilerOptions": { "module": "commonjs", - "lib": [ - "es6" - ], + "lib": ["es6", "dom"], + "jsx": "react", "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": true, "strictFunctionTypes": true, + "strictNullChecks": true, "baseUrl": "../", - "typeRoots": [ - "../" - ], + "typeRoots": ["../"], "types": [], "noEmit": true, "forceConsistentCasingInFileNames": true }, - "files": [ - "index.d.ts", - "del-tests.ts" - ] -} \ No newline at end of file + "files": ["index.d.ts", "react-scroll-into-view-if-needed-tests.tsx"] +} diff --git a/types/p-debounce/tslint.json b/types/react-scroll-into-view-if-needed/tslint.json similarity index 100% rename from types/p-debounce/tslint.json rename to types/react-scroll-into-view-if-needed/tslint.json diff --git a/types/react-scrollable-anchor/index.d.ts b/types/react-scrollable-anchor/index.d.ts new file mode 100644 index 0000000000..ea495dd0f7 --- /dev/null +++ b/types/react-scrollable-anchor/index.d.ts @@ -0,0 +1,24 @@ +// Type definitions for react-scrollable-anchor 0.6 +// Project: https://github.com/gabergg/react-scrollable-anchor +// Definitions by: Antoine DOUBOVETZKY +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +export interface ScrollableAnchorProps { + id: string; + children?: React.ReactNode; +} + +export interface ConfigureAnchorsOptions { + offset?: number; + scrollDuration?: number; + keepLastAnchorHash?: boolean; +} + +export default class ScrollableAnchor extends React.Component { } +export function goToTop(): void; +export function configureAnchors(options: ConfigureAnchorsOptions): void; +export function goToAnchor(anchorId: string, saveHashUpdate?: boolean): void; +export function removeHash(): void; diff --git a/types/react-scrollable-anchor/react-scrollable-anchor-tests.tsx b/types/react-scrollable-anchor/react-scrollable-anchor-tests.tsx new file mode 100644 index 0000000000..984a01f741 --- /dev/null +++ b/types/react-scrollable-anchor/react-scrollable-anchor-tests.tsx @@ -0,0 +1,47 @@ +import * as React from 'react'; +import ScrollableAnchor, { goToAnchor, goToTop, removeHash, configureAnchors } from "react-scrollable-anchor"; + +/* + * goToAnchor + */ +// $ExpectType void +goToAnchor("one"); +// $ExpectError +goToAnchor(1); + +/* + * goToTop + */ +// $ExpectType void +goToTop(); +// $ExpectError +goToTop(1); + +/* + * removeHash + */ +// $ExpectType void +removeHash(); +// $ExpectError +removeHash(1); + +/* + * configureAnchors + */ +// $ExpectType void +configureAnchors({ offset: 500, scrollDuration: 1000, keepLastAnchorHash: true }); +// $ExpectError +configureAnchors(); +// $ExpectError +configureAnchors({ wrongKey: 1 }); +// $ExpectError +configureAnchors({ offset: 'string' }); +// $ExpectError +configureAnchors({ scrollDuration: 'string' }); +// $ExpectError +configureAnchors({ keepLastAnchorHash: 3 }); + +// $ExpectError +
Test
; + +
Test
; diff --git a/types/react-scrollable-anchor/tsconfig.json b/types/react-scrollable-anchor/tsconfig.json new file mode 100644 index 0000000000..198bad7412 --- /dev/null +++ b/types/react-scrollable-anchor/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "jsx": "react", + "noImplicitAny": true, + "strictFunctionTypes": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-scrollable-anchor-tests.tsx" + ] +} diff --git a/types/p-each-series/tslint.json b/types/react-scrollable-anchor/tslint.json similarity index 100% rename from types/p-each-series/tslint.json rename to types/react-scrollable-anchor/tslint.json diff --git a/types/react-scrollbar/tslint.json b/types/react-scrollbar/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-scrollbar/tslint.json +++ b/types/react-scrollbar/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-select/lib/Select.d.ts b/types/react-select/lib/Select.d.ts index 11853f6be9..57fef3bb9c 100644 --- a/types/react-select/lib/Select.d.ts +++ b/types/react-select/lib/Select.d.ts @@ -50,7 +50,9 @@ export interface FormatOptionLabelMeta { selectValue: ValueType; } -export interface Props { +export type SelectComponentsProps = { [key in string]: any }; + +export interface Props extends SelectComponentsProps { /* Aria label (for assistive tech) */ 'aria-label'?: string; /* HTML ID of an element that should be used as the label (for assistive tech) */ diff --git a/types/react-select/lib/components/Option.d.ts b/types/react-select/lib/components/Option.d.ts index d7d20ec325..c770d91afa 100644 --- a/types/react-select/lib/components/Option.d.ts +++ b/types/react-select/lib/components/Option.d.ts @@ -15,6 +15,7 @@ interface InnerProps { id: string; key: string; onClick: MouseEventHandler; + onMouseMove: MouseEventHandler; onMouseOver: MouseEventHandler; tabIndex: number; } diff --git a/types/react-sortable-tree/package.json b/types/react-sortable-tree/package.json index 2e009d2f82..41eb88b180 100644 --- a/types/react-sortable-tree/package.json +++ b/types/react-sortable-tree/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "react-dnd": "^5.0.0" + "react-dnd": "5 || 6 || 7" } } diff --git a/types/react-spinkit/tslint.json b/types/react-spinkit/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-spinkit/tslint.json +++ b/types/react-spinkit/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-swf/tslint.json b/types/react-swf/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-swf/tslint.json +++ b/types/react-swf/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-swipeable/index.d.ts b/types/react-swipeable/index.d.ts index fc6326deae..7a53884bd3 100644 --- a/types/react-swipeable/index.d.ts +++ b/types/react-swipeable/index.d.ts @@ -1,8 +1,9 @@ -// Type definitions for react-swipeable 4.2 +// Type definitions for react-swipeable 4.3 // Project: https://github.com/dogfessional/react-swipeable // Definitions by: Giedrius Grabauskas // Konstantin Vasilev // Hiroki Horiuchi +// Adam Bowles // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -36,6 +37,7 @@ declare namespace ReactSwipeable { nodeName?: string; trackMouse?: boolean; disabled?: boolean; + rotationAngle?: number; innerRef?: React.Ref; children?: React.ReactNode; } diff --git a/types/react-swipeable/react-swipeable-tests.tsx b/types/react-swipeable/react-swipeable-tests.tsx index 87294f001e..0479a7d3d5 100644 --- a/types/react-swipeable/react-swipeable-tests.tsx +++ b/types/react-swipeable/react-swipeable-tests.tsx @@ -39,6 +39,7 @@ class SampleComponent extends React.PureComponent { disabled innerRef={this.swipeRef} onClick={this.handleClick} + rotationAngle={0} >
This element can be swiped diff --git a/types/react-table/index.d.ts b/types/react-table/index.d.ts index 6aad7c3c8c..6327eb6128 100644 --- a/types/react-table/index.d.ts +++ b/types/react-table/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-table 6.7 +// Type definitions for react-table 6.8 // Project: https://github.com/react-tools/react-table // Definitions by: Roy Xue , // Pavel Sakalo , @@ -42,21 +42,19 @@ export interface Filter { value: any; pivotId?: string; } -/** NOTE: to many configuration ways (only true values are confusing) */ + export interface SortingRule { id: string; - sort?: 'desc' | 'asc'; - asc?: true; - desc?: true; + desc: boolean; } export interface TableProps extends - Partial, - Partial, - Partial, - Partial, - Partial, - Partial { + TextProps, + ComponentDecoratorProps, + ControlledStateCallbackProps, + PivotingProps, + ControlledStateOverrideProps, + ComponentProps { /** Default: [] */ data: D[]; diff --git a/types/react-tagcloud/tslint.json b/types/react-tagcloud/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-tagcloud/tslint.json +++ b/types/react-tagcloud/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-tap-event-plugin/tslint.json b/types/react-tap-event-plugin/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-tap-event-plugin/tslint.json +++ b/types/react-tap-event-plugin/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-test-renderer/tslint.json b/types/react-test-renderer/tslint.json index c4fd1ce0bb..1946fe8602 100644 --- a/types/react-test-renderer/tslint.json +++ b/types/react-test-renderer/tslint.json @@ -2,6 +2,7 @@ "extends": "dtslint/dt.json", "rules": { "dt-header": false, + "npm-naming": false, "no-unnecessary-generics": false } } diff --git a/types/react-text-truncate/index.d.ts b/types/react-text-truncate/index.d.ts new file mode 100644 index 0000000000..21b4c537a1 --- /dev/null +++ b/types/react-text-truncate/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for react-text-truncate 0.14 +// Project: https://github.com/ShinyChang/react-text-truncate +// Definitions by: Adrien Antoine +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +import * as React from 'react'; + +export interface TextTruncateProps { + containerClassName?: string; + element?: string; + line?: number | boolean; + onCalculated?: () => void; + onTruncated?: () => void; + onToggled?: (truncated: boolean) => void; + text?: string; + textElement?: React.ReactNode; + textTruncateChild?: React.ReactNode; + truncateText?: string; + maxCalculateTimes?: number; +} + +declare class TextTruncate extends React.Component {} + +export default TextTruncate; diff --git a/types/react-text-truncate/react-text-truncate-tests.tsx b/types/react-text-truncate/react-text-truncate-tests.tsx new file mode 100644 index 0000000000..b5c77ee28f --- /dev/null +++ b/types/react-text-truncate/react-text-truncate-tests.tsx @@ -0,0 +1,18 @@ +import * as React from 'react'; +import TextTruncate from 'react-text-truncate'; + +const TruncatedText = () => ( + {}} + onTruncated={() => {}} + onToggled={(truncate: boolean) => {}} + textElement={
} + textTruncateChild={
} + truncateText="..." + maxCalculateTimes={5} + /> +); diff --git a/types/react-text-truncate/tsconfig.json b/types/react-text-truncate/tsconfig.json new file mode 100644 index 0000000000..9dd3530bc3 --- /dev/null +++ b/types/react-text-truncate/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "jsx": "react", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "react-text-truncate-tests.tsx" + ] +} diff --git a/types/p-event/tslint.json b/types/react-text-truncate/tslint.json similarity index 100% rename from types/p-event/tslint.json rename to types/react-text-truncate/tslint.json diff --git a/types/react-textarea-autosize/tslint.json b/types/react-textarea-autosize/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-textarea-autosize/tslint.json +++ b/types/react-textarea-autosize/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-tooltip/index.d.ts b/types/react-tooltip/index.d.ts index aba9cdf734..6818d36a5e 100644 --- a/types/react-tooltip/index.d.ts +++ b/types/react-tooltip/index.d.ts @@ -107,6 +107,7 @@ declare namespace ReactTooltip { class?: string; watchWindow?: boolean; sanitizeHtmlOptions?: SanitizeHtmlOptions; + clickable?: boolean; } } diff --git a/types/react-user-tour/tslint.json b/types/react-user-tour/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/react-user-tour/tslint.json +++ b/types/react-user-tour/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/react-virtualized/dist/es/Table.d.ts b/types/react-virtualized/dist/es/Table.d.ts index b66fac389b..d63d593b6e 100644 --- a/types/react-virtualized/dist/es/Table.d.ts +++ b/types/react-virtualized/dist/es/Table.d.ts @@ -183,11 +183,7 @@ export class Column extends Component { } export type RowMouseEventHandlerParams = { - rowData: { - columnData: object; - id: string; - index: number; - }; + rowData: any index: number; event: React.MouseEvent; }; diff --git a/types/react-virtualized/index.d.ts b/types/react-virtualized/index.d.ts index c105c4db2f..1fd2fb0b4f 100644 --- a/types/react-virtualized/index.d.ts +++ b/types/react-virtualized/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for react-virtualized 9.18 +// Type definitions for react-virtualized 9.21 // Project: https://github.com/bvaughn/react-virtualized // Definitions by: Kalle Ott // John Gunther diff --git a/types/react-widgets/lib/Multiselect.d.ts b/types/react-widgets/lib/Multiselect.d.ts index 56a2753d3e..afafdfcb12 100644 --- a/types/react-widgets/lib/Multiselect.d.ts +++ b/types/react-widgets/lib/Multiselect.d.ts @@ -1,12 +1,14 @@ -import * as React from 'react'; -import { ReactWidgetsCommonDropdownProps, AutoFocus } from './CommonProps'; +import * as React from "react"; +import { ReactWidgetsCommonDropdownProps, AutoFocus } from "./CommonProps"; -interface MultiselectProps extends ReactWidgetsCommonDropdownProps, AutoFocus { +interface MultiselectProps + extends ReactWidgetsCommonDropdownProps, + AutoFocus { /** * Enables the list option creation UI. onFilter will only the UI when actively filtering for a list item. * @default 'onFilter' */ - allowCreate?: boolean | 'onFilter'; + allowCreate?: boolean | "onFilter"; /** * The current values of the Multiselect. The value should can null, or an array of * valueField values, or an array of objects (such as a few items in the data array) @@ -20,20 +22,26 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps void; + onChange?: ( + dataItems: any[], + metadata: { + dataItem: any; + action: "insert" | "remove"; + originalEvent?: any; + lastValue?: any[]; + searchTerm?: string; + } + ) => void; /** * This handler fires when an item has been selected from the list. It fires before the * onChange handler, and fires regardless of whether the value has actually changed */ - onSelect?: (value: any, metadata: { - originalEvent: any; - }) => void; + onSelect?: ( + value: any, + metadata: { + originalEvent: any; + } + ) => void; /** * This handler fires when the user chooses to create a new tag, not in the data list. It is * up to the widget parent to implement creation logic, a common implementation is shown @@ -100,11 +108,14 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps void; + onSearch?: ( + searchTerm: string, + metadata: { + action: "clear" | "input"; + lastSearchTerm?: string; + originalEvent?: any; + } + ) => void; /** * Whether or not the Multiselect is open. When unset (undefined) the Multiselect will * handle the opening and closing internally. The defaultOpen prop can be used to set an @@ -124,7 +135,12 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps boolean); + filter?: + | false + | "startsWith" + | "endsWith" + | "contains" + | ((dataItem: any, searchTerm: string) => boolean); /** * Use in conjunction with the filter prop. Filter the list without regard for case. This * only applies to non function values for filter. @@ -167,6 +183,11 @@ interface MultiselectProps extends ReactWidgetsCommonDropdownProps{props.value}; @@ -18,105 +26,97 @@ function listComponent(props: { value: string }) { class Test extends React.Component> { render() { return ( -
- - - - - - - +
+ + + + + + + +
+
+ + + + + + + +
+
+ + + + + +
+
+ + + + + + + +
+
+ + + } + /> + + + + + + + +
+
+ } + /> +
-
- - - - - - - -
-
- - - - - -
-
- - - - - - - -
-
- - - - } - /> - - - - - - -
-
- } /> -
-
); } } diff --git a/types/react-window/index.d.ts b/types/react-window/index.d.ts index 810661d387..2f4eda08df 100644 --- a/types/react-window/index.d.ts +++ b/types/react-window/index.d.ts @@ -1,7 +1,8 @@ -// Type definitions for react-window 1.5 +// Type definitions for react-window 1.7 // Project: https://github.com/bvaughn/react-window/, http://react-window.now.sh // Definitions by: Martynas Kadiša // Alex Guerra +// John Gozde // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -395,17 +396,19 @@ export class FixedSizeGrid extends Component { * Scroll to the specified item. * * By default, the Grid will scroll as little as possible to ensure the item is visible. - * You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are: + * You can control the alignment of the item though by specifying an `align` property. Acceptable values are: * * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) * - center - Center align the item within the grid. * - end - Align the item to the bottom, right hand side of the grid. * - start - Align the item to the top, left hand of the grid. + * + * If either `columnIndex` or `rowIndex` are omitted, `scrollLeft` or `scrollTop` will be unchanged (respectively). */ scrollToItem(params: { align?: Align; - columnIndex: number; - rowIndex: number; + columnIndex?: number; + rowIndex?: number; }): void; } @@ -418,17 +421,19 @@ export class VariableSizeGrid extends Component { * Scroll to the specified item. * * By default, the Grid will scroll as little as possible to ensure the item is visible. - * You can control the alignment of the item though by specifying a second alignment parameter. Acceptable values are: + * You can control the alignment of the item though by specifying an `align` property. Acceptable values are: * * - auto (default) - Scroll as little as possible to ensure the item is visible. (If the item is already visible, it won't scroll at all.) * - center - Center align the item within the grid. * - end - Align the item to the bottom, right hand side of the grid. * - start - Align the item to the top, left hand of the grid. + * + * If either `columnIndex` or `rowIndex` are omitted, `scrollLeft` or `scrollTop` will be unchanged (respectively). */ scrollToItem(params: { align?: Align; - columnIndex: number; - rowIndex: number; + columnIndex?: number; + rowIndex?: number; }): void; /** * VariableSizeGrid caches offsets and measurements for each column index for performance purposes. diff --git a/types/react-window/react-window-tests.tsx b/types/react-window/react-window-tests.tsx index febd9ae500..62549f3380 100644 --- a/types/react-window/react-window-tests.tsx +++ b/types/react-window/react-window-tests.tsx @@ -218,3 +218,67 @@ class RowWithShouldComponentUpdate extends React.Component< return
Row {index}
; } } + +const fixedRef = React.createRef(); +const FixedSizeGridTestRefs: React.SFC = () => ( + + {({ style, columnIndex, rowIndex }) => ( +
+ Test {rowIndex} {columnIndex} +
+ )} +
+); + +if (fixedRef.current) { + fixedRef.current.scrollTo({ scrollLeft: 0, scrollTop: 0}); + fixedRef.current.scrollToItem({}); + fixedRef.current.scrollToItem({ align: "auto" }); + fixedRef.current.scrollToItem({ rowIndex: 0 }); + fixedRef.current.scrollToItem({ columnIndex: 0 }); + fixedRef.current.scrollToItem({ rowIndex: 0, columnIndex: 0 }); + fixedRef.current.scrollToItem({ align: "start", rowIndex: 0, columnIndex: 0 }); +} + +const variableRef = React.createRef(); +const VariableSizeGridTestRefs: React.SFC = () => ( + 0} + ref={variableRef} + rowCount={0} + rowHeight={index => 0} + height={0} + width={0} + > + {({ style, columnIndex, rowIndex }) => ( +
+ Test {rowIndex} {columnIndex} +
+ )} +
+); + +if (variableRef.current) { + variableRef.current.scrollTo({ scrollLeft: 0, scrollTop: 0}); + variableRef.current.scrollToItem({}); + variableRef.current.scrollToItem({ align: "auto" }); + variableRef.current.scrollToItem({ rowIndex: 0 }); + variableRef.current.scrollToItem({ columnIndex: 0 }); + variableRef.current.scrollToItem({ rowIndex: 0, columnIndex: 0 }); + variableRef.current.scrollToItem({ align: "start", rowIndex: 0, columnIndex: 0 }); + variableRef.current.resetAfterColumnIndex(0); + variableRef.current.resetAfterColumnIndex(0, true); + variableRef.current.resetAfterRowIndex(0); + variableRef.current.resetAfterRowIndex(0, false); + variableRef.current.resetAfterIndices({ columnIndex: 0, rowIndex: 0 }); + variableRef.current.resetAfterIndices({ columnIndex: 0, rowIndex: 0, shouldForceUpdate: true }); +} diff --git a/types/react/index.d.ts b/types/react/index.d.ts index a2dd9ee144..973c87ec1f 100644 --- a/types/react/index.d.ts +++ b/types/react/index.d.ts @@ -20,7 +20,7 @@ // Frank Li // Jessica Franco // Paul Sherman -// Sunil Pai +// Saransh Kataria // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -426,7 +426,7 @@ declare namespace React { // always pass children as variadic arguments to `createElement`. // In the future, if we can define its call signature conditionally // on the existence of `children` in `P`, then we should remove this. - readonly props: Readonly>; + readonly props: Readonly

& Readonly<{ children?: ReactNode }>; state: Readonly; /** * @deprecated @@ -1777,6 +1777,7 @@ declare namespace React { rel?: string; target?: string; type?: string; + referrerPolicy?: string; } // tslint:disable-next-line:no-empty-interface diff --git a/types/react/tslint.json b/types/react/tslint.json index d2c103b50c..b68a2adfe2 100644 --- a/types/react/tslint.json +++ b/types/react/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "no-any-union": false, "no-empty-interface": false, "no-object-literal-type-assertion": false, diff --git a/types/react/v15/index.d.ts b/types/react/v15/index.d.ts index 512fb5a0a7..d4f6300588 100644 --- a/types/react/v15/index.d.ts +++ b/types/react/v15/index.d.ts @@ -2648,7 +2648,7 @@ declare namespace React { autoComplete?: string; autoFocus?: boolean; autoPlay?: boolean; - capture?: boolean; + capture?: boolean | string; cellPadding?: number | string; cellSpacing?: number | string; charSet?: string; @@ -2879,7 +2879,7 @@ declare namespace React { alt?: string; autoComplete?: string; autoFocus?: boolean; - capture?: boolean; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute + capture?: boolean | string; // https://www.w3.org/TR/html-media-capture/#the-capture-attribute checked?: boolean; crossOrigin?: string; disabled?: boolean; diff --git a/types/reactcss/tslint.json b/types/reactcss/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/reactcss/tslint.json +++ b/types/reactcss/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/read-chunk/index.d.ts b/types/read-chunk/index.d.ts deleted file mode 100644 index d11a7a334b..0000000000 --- a/types/read-chunk/index.d.ts +++ /dev/null @@ -1,29 +0,0 @@ -// Type definitions for read-chunk v2.1.0 -// Project: https://github.com/sindresorhus/read-chunk -// Definitions by: crispybee -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped - -/// - -export = ReadChunk; - - /** - * Asynchronous: Reads a chunk from a file. Returns a Promise. - * @param {string} filePath The path to the file. - * @param {number} startingPosition Position to start reading. - * @param {number} length Number of bytes to read. - * @return {Promise} Returns a Promise. - */ -declare function ReadChunk(filePath: string, startingPosition: number, length: number): Promise; - -declare namespace ReadChunk { - /** - * Synchronous: Reads a chunk from a file. Returns a Buffer. - * @param {string} filePath The path to the file. - * @param {number} startingPosition Position to start reading. - * @param {number} length Number of bytes to read. - * @return {Buffer} Returns a Buffer. - */ - function sync(filePath: string, startingPosition: number, length: number): Buffer; -} - diff --git a/types/read-chunk/read-chunk-tests.ts b/types/read-chunk/read-chunk-tests.ts deleted file mode 100644 index 187d1a02b1..0000000000 --- a/types/read-chunk/read-chunk-tests.ts +++ /dev/null @@ -1,9 +0,0 @@ -import readChunk = require('read-chunk'); - -let chunk: Buffer = readChunk.sync('foo.txt', 1, 3); - -readChunk('foo.txt', 1, 3).then(value => { - console.log(value); -}).catch(error => { - console.log(error); -}); diff --git a/types/read-chunk/tsconfig.json b/types/read-chunk/tsconfig.json deleted file mode 100644 index 041ee0f648..0000000000 --- a/types/read-chunk/tsconfig.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "compilerOptions": { - "module": "commonjs", - "lib": [ - "es6" - ], - "noImplicitAny": true, - "noImplicitThis": true, - "strictNullChecks": true, - "strictFunctionTypes": true, - "baseUrl": "../", - "typeRoots": [ - "../" - ], - "types": [], - "noEmit": true, - "forceConsistentCasingInFileNames": true - }, - "files": [ - "index.d.ts", - "read-chunk-tests.ts" - ] -} \ No newline at end of file diff --git a/types/read-chunk/tslint.json b/types/read-chunk/tslint.json deleted file mode 100644 index a41bf5d19a..0000000000 --- a/types/read-chunk/tslint.json +++ /dev/null @@ -1,79 +0,0 @@ -{ - "extends": "dtslint/dt.json", - "rules": { - "adjacent-overload-signatures": false, - "array-type": false, - "arrow-return-shorthand": false, - "ban-types": false, - "callable-types": false, - "comment-format": false, - "dt-header": false, - "eofline": false, - "export-just-namespace": false, - "import-spacing": false, - "interface-name": false, - "interface-over-type-literal": false, - "jsdoc-format": false, - "max-line-length": false, - "member-access": false, - "new-parens": false, - "no-any-union": false, - "no-boolean-literal-compare": false, - "no-conditional-assignment": false, - "no-consecutive-blank-lines": false, - "no-construct": false, - "no-declare-current-package": false, - "no-duplicate-imports": false, - "no-duplicate-variable": false, - "no-empty-interface": false, - "no-for-in-array": false, - "no-inferrable-types": false, - "no-internal-module": false, - "no-irregular-whitespace": false, - "no-mergeable-namespace": false, - "no-misused-new": false, - "no-namespace": false, - "no-object-literal-type-assertion": false, - "no-padding": false, - "no-redundant-jsdoc": false, - "no-redundant-jsdoc-2": false, - "no-redundant-undefined": false, - "no-reference-import": false, - "no-relative-import-in-test": false, - "no-self-import": false, - "no-single-declare-module": false, - "no-string-throw": false, - "no-unnecessary-callback-wrapper": false, - "no-unnecessary-class": false, - "no-unnecessary-generics": false, - "no-unnecessary-qualifier": false, - "no-unnecessary-type-assertion": false, - "no-useless-files": false, - "no-var-keyword": false, - "no-var-requires": false, - "no-void-expression": false, - "no-trailing-whitespace": false, - "object-literal-key-quotes": false, - "object-literal-shorthand": false, - "one-line": false, - "one-variable-per-declaration": false, - "only-arrow-functions": false, - "prefer-conditional-expression": false, - "prefer-const": false, - "prefer-declare-function": false, - "prefer-for-of": false, - "prefer-method-signature": false, - "prefer-template": false, - "radix": false, - "semicolon": false, - "space-before-function-paren": false, - "space-within-parens": false, - "strict-export-declare-modifiers": false, - "trim-file": false, - "triple-equals": false, - "typedef-whitespace": false, - "unified-signatures": false, - "void-return": false, - "whitespace": false - } -} diff --git a/types/read-pkg/index.d.ts b/types/read-pkg/index.d.ts index 5e5b57c445..ba10fee4b9 100644 --- a/types/read-pkg/index.d.ts +++ b/types/read-pkg/index.d.ts @@ -1,15 +1,13 @@ -// Type definitions for read-pkg 3.0 +// Type definitions for read-pkg 4.0 // Project: https://github.com/sindresorhus/read-pkg -// Definitions by: Jeff Dickey +// Definitions by: Jeff Dickey , Richard Smith // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped import normalize = require('normalize-package-data'); declare namespace ReadPkg { - function sync(path: string, options: Options & {normalize: false}): {[k: string]: any}; function sync(options: Options & {normalize: false}): {[k: string]: any}; function sync(options?: Options): normalize.Package; - function sync(path?: string, options?: Options): normalize.Package; interface Options { /** @@ -18,14 +16,18 @@ declare namespace ReadPkg { * @default true */ normalize?: boolean; + /** + * Current working directory + * + * @default process.cwd() + */ + cwd?: string; } type Package = normalize.Package; } -declare function ReadPkg(path: string, options: ReadPkg.Options & {normalize: false}): Promise<{[k: string]: any}>; declare function ReadPkg(options: ReadPkg.Options & {normalize: false}): Promise<{[k: string]: any}>; declare function ReadPkg(options?: ReadPkg.Options): Promise; -declare function ReadPkg(path?: string, options?: ReadPkg.Options): Promise; export = ReadPkg; diff --git a/types/read-pkg/read-pkg-tests.ts b/types/read-pkg/read-pkg-tests.ts index a82f953eab..b39c578862 100644 --- a/types/read-pkg/read-pkg-tests.ts +++ b/types/read-pkg/read-pkg-tests.ts @@ -3,7 +3,8 @@ import ReadPkg = require('read-pkg'); ReadPkg().then(pkg => pkg.name); // $ExpectType Promise ReadPkg({normalize: true}).then(pkg => pkg.name); // $ExpectType Promise ReadPkg({normalize: false}).then(pkg => pkg['name']); // $ExpectType Promise +ReadPkg({cwd: './foo'}).then(pkg => pkg.name); // $ExpectType Promise ReadPkg.sync().name; // $ExpectType string ReadPkg.sync({normalize: true}).name; // $ExpectType string ReadPkg.sync({normalize: false})['name']; // $ExpectType any -ReadPkg.sync('package.json', {normalize: false})['name']; // $ExpectType any +ReadPkg.sync({cwd: './foo'}).name; // $ExpectType string diff --git a/types/read/tslint.json b/types/read/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/read/tslint.json +++ b/types/read/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/readdir-stream/tslint.json b/types/readdir-stream/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/readdir-stream/tslint.json +++ b/types/readdir-stream/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/recharts/index.d.ts b/types/recharts/index.d.ts index 44f97c933b..56ffd20265 100644 --- a/types/recharts/index.d.ts +++ b/types/recharts/index.d.ts @@ -13,6 +13,7 @@ // Andrew Palugniok // Robert Stigsson // Kosaku Kurino +// Leon Ng // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.8 @@ -219,7 +220,7 @@ export interface BarProps extends EventAttributes, Partial | object; // see label section at http://recharts.org/#/en-US/api/Bar - label?: boolean | Label | React.SFC | React.ReactElement | ContentRenderer; + label?: boolean | Label | LabelProps | React.SFC | React.ReactElement | ContentRenderer; } export class Bar extends React.Component { } diff --git a/types/recompose/tslint.json b/types/recompose/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/recompose/tslint.json +++ b/types/recompose/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/reconnectingwebsocket/index.d.ts b/types/reconnectingwebsocket/index.d.ts index c07dec7474..e05052c24f 100644 --- a/types/reconnectingwebsocket/index.d.ts +++ b/types/reconnectingwebsocket/index.d.ts @@ -3,19 +3,21 @@ // Definitions by: Nicholas Guarracino // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export interface Options { - automaticOpen?: boolean; - binaryType?: 'blob' | 'arraybuffer'; - debug?: boolean; - maxReconnectAttempts?: number | null; - maxReconnectInterval?: number; - reconnectDecay?: number; - reconnectInterval?: number; - timeoutInterval?: number; +declare namespace ReconnectingWebSocket { + interface Options { + automaticOpen?: boolean; + binaryType?: 'blob' | 'arraybuffer'; + debug?: boolean; + maxReconnectAttempts?: number | null; + maxReconnectInterval?: number; + reconnectDecay?: number; + reconnectInterval?: number; + timeoutInterval?: number; + } } -export default class ReconnectingWebSocket { - constructor(url: string, protocols?: string[], options?: Options); +declare class ReconnectingWebSocket { + constructor(url: string, protocols?: string[], options?: ReconnectingWebSocket.Options); static debugAll: boolean; @@ -41,3 +43,4 @@ export default class ReconnectingWebSocket { reconnectAttempts: number; url: string; } +export = ReconnectingWebSocket; diff --git a/types/reconnectingwebsocket/reconnectingwebsocket-tests.ts b/types/reconnectingwebsocket/reconnectingwebsocket-tests.ts index 300055a062..b3572a4ae5 100644 --- a/types/reconnectingwebsocket/reconnectingwebsocket-tests.ts +++ b/types/reconnectingwebsocket/reconnectingwebsocket-tests.ts @@ -1,6 +1,6 @@ -import ReconnectingWebSocket, { Options } from "reconnectingwebsocket"; +import ReconnectingWebSocket = require("reconnectingwebsocket"); -const options: Options = { +const options: ReconnectingWebSocket.Options = { automaticOpen: false, binaryType: "blob", debug: false, diff --git a/types/recorder-js/index.d.ts b/types/recorder-js/index.d.ts index 6cc672492c..7bc03e65e9 100644 --- a/types/recorder-js/index.d.ts +++ b/types/recorder-js/index.d.ts @@ -4,7 +4,7 @@ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 -export default Recorder; +export = Recorder; declare class Recorder { constructor(audioContext: AudioContext, config?: Recorder.RecorderConfig); diff --git a/types/recorder-js/recorder-js-tests.ts b/types/recorder-js/recorder-js-tests.ts index 2dee4a08ab..d7374f787c 100644 --- a/types/recorder-js/recorder-js-tests.ts +++ b/types/recorder-js/recorder-js-tests.ts @@ -1,7 +1,7 @@ // The following code comes from: // https://www.npmjs.com/package/recorder-js#usage -import Recorder from 'recorder-js'; +import Recorder = require('recorder-js'); const audioContext = new AudioContext(); let isRecording = false; diff --git a/types/redis-scripto/tslint.json b/types/redis-scripto/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redis-scripto/tslint.json +++ b/types/redis-scripto/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redis/index.d.ts b/types/redis/index.d.ts index eae16b7ff1..3548be95b9 100644 --- a/types/redis/index.d.ts +++ b/types/redis/index.d.ts @@ -10,6 +10,7 @@ // Pirasis Leelatanon // Stanislav Dzhus // Jake Ferrante +// Adebayo Opesanya // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // Imported from: https://github.com/types/npm-redis diff --git a/types/redis/package.json b/types/redis/package.json new file mode 100644 index 0000000000..c1f0c68752 --- /dev/null +++ b/types/redis/package.json @@ -0,0 +1,11 @@ +{ + "private": true, + "types": "index", + "typesVersions": { + ">=3.1.0-0": { + "*": [ + "ts3.1/*" + ] + } + } +} \ No newline at end of file diff --git a/types/redis/redis-tests.ts b/types/redis/redis-tests.ts index fb5a97987d..16e690ca46 100644 --- a/types/redis/redis-tests.ts +++ b/types/redis/redis-tests.ts @@ -20,8 +20,8 @@ redis.print(err, value); // ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- const options: redis.ClientOpts = { - host: "localhost", - port: 6379, + host: 'localhost', + port: 6379, }; let client: redis.RedisClient = redis.createClient(num, str, options); @@ -90,6 +90,8 @@ client.incr(str, resCallback); client.hgetall(str, resCallback); client.hmset(str, value, okCallback); client.hmset(str, str, str, str, str, okCallback); +client.hmset(str, [str, str, str, str]); +client.hmset(str, [str, value, str, value], okCallback); // Publish / Subscribe client.publish(str, value); @@ -115,8 +117,8 @@ client.duplicate(); // Pipeline client.cork(); -client.set("abc", "fff", strCallback); -client.get("abc", resCallback); +client.set('abc', 'fff', strCallback); +client.get('abc', resCallback); client.uncork(); // Add command diff --git a/types/redis/ts3.1/index.d.ts b/types/redis/ts3.1/index.d.ts new file mode 100644 index 0000000000..d69332f3de --- /dev/null +++ b/types/redis/ts3.1/index.d.ts @@ -0,0 +1,1235 @@ +/// + +import { EventEmitter } from 'events'; +import { Duplex } from 'stream'; + +export interface RetryStrategyOptions { + error: NodeJS.ErrnoException; + total_retry_time: number; + times_connected: number; + attempt: number; +} + +export type RetryStrategy = (options: RetryStrategyOptions) => number | Error; + +export interface ClientOpts { + host?: string; + port?: number; + path?: string; + url?: string; + parser?: string; + string_numbers?: boolean; + return_buffers?: boolean; + detect_buffers?: boolean; + socket_keepalive?: boolean; + no_ready_check?: boolean; + enable_offline_queue?: boolean; + retry_max_delay?: number; + connect_timeout?: number; + max_attempts?: number; + retry_unfulfilled_commands?: boolean; + auth_pass?: string; + password?: string; + db?: string | number; + family?: string; + rename_commands?: { [command: string]: string } | null; + tls?: any; + prefix?: string; + retry_strategy?: RetryStrategy; +} + +export type Callback = (err: Error | null, reply: T) => void; + +export interface ServerInfo { + redis_version: string; + versions: number[]; +} + +export interface OverloadedCommand { + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (arg1: T, arg2: T | T[], cb?: Callback): R; + (arg1: T | T[], cb?: Callback): R; + (...args: Array>): R; +} + +export interface OverloadedKeyCommand { + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, cb?: Callback): R; + (key: string, arg1: T | T[], cb?: Callback): R; + (key: string, ...args: Array>): R; + (...args: Array>): R; +} + +export interface OverloadedListCommand { + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (arg1: T, arg2: T, cb?: Callback): R; + (arg1: T | T[], cb?: Callback): R; + (...args: Array>): R; +} + +export interface OverloadedSetCommand { + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, arg6: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, arg5: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, arg4: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, arg3: T, cb?: Callback): R; + (key: string, arg1: T, arg2: T, cb?: Callback): R; + (key: string, arg1: T | { [key: string]: T } | T[], cb?: Callback): R; + (key: string, ...args: Array>): R; + (args: [string, ...T[]], cb?: Callback): R; +} + +export interface OverloadedLastCommand { + (arg1: T1, arg2: T1, arg3: T1, arg4: T1, arg5: T1, arg6: T2, cb?: Callback): R; + (arg1: T1, arg2: T1, arg3: T1, arg4: T1, arg5: T2, cb?: Callback): R; + (arg1: T1, arg2: T1, arg3: T1, arg4: T2, cb?: Callback): R; + (arg1: T1, arg2: T1, arg3: T2, cb?: Callback): R; + (arg1: T1, arg2: T2 | Array, cb?: Callback): R; + (args: Array, cb?: Callback): R; + (...args: Array>): R; +} + +export interface Commands { + /** + * Listen for all requests received by the server in real time. + */ + monitor(cb?: Callback): R; + MONITOR(cb?: Callback): R; + + /** + * Get information and statistics about the server. + */ + info(cb?: Callback): R; + info(section?: string | string[], cb?: Callback): R; + INFO(cb?: Callback): R; + INFO(section?: string | string[], cb?: Callback): R; + + /** + * Ping the server. + */ + ping(callback?: Callback): R; + ping(message: string, callback?: Callback): R; + PING(callback?: Callback): R; + PING(message: string, callback?: Callback): R; + + /** + * Post a message to a channel. + */ + publish(channel: string, value: string, cb?: Callback): R; + PUBLISH(channel: string, value: string, cb?: Callback): R; + + /** + * Authenticate to the server. + */ + auth(password: string, callback?: Callback): R; + AUTH(password: string, callback?: Callback): R; + + /** + * KILL - Kill the connection of a client. + * LIST - Get the list of client connections. + * GETNAME - Get the current connection name. + * PAUSE - Stop processing commands from clients for some time. + * REPLY - Instruct the server whether to reply to commands. + * SETNAME - Set the current connection name. + */ + client: OverloadedCommand; + CLIENT: OverloadedCommand; + + /** + * Set multiple hash fields to multiple values. + */ + hmset: OverloadedSetCommand; + HMSET: OverloadedSetCommand; + + /** + * Listen for messages published to the given channels. + */ + subscribe: OverloadedListCommand; + SUBSCRIBE: OverloadedListCommand; + + /** + * Stop listening for messages posted to the given channels. + */ + unsubscribe: OverloadedListCommand; + UNSUBSCRIBE: OverloadedListCommand; + + /** + * Listen for messages published to channels matching the given patterns. + */ + psubscribe: OverloadedListCommand; + PSUBSCRIBE: OverloadedListCommand; + + /** + * Stop listening for messages posted to channels matching the given patterns. + */ + punsubscribe: OverloadedListCommand; + PUNSUBSCRIBE: OverloadedListCommand; + + /** + * Append a value to a key. + */ + append(key: string, value: string, cb?: Callback): R; + APPEND(key: string, value: string, cb?: Callback): R; + + /** + * Asynchronously rewrite the append-only file. + */ + bgrewriteaof(cb?: Callback<'OK'>): R; + BGREWRITEAOF(cb?: Callback<'OK'>): R; + + /** + * Asynchronously save the dataset to disk. + */ + bgsave(cb?: Callback): R; + BGSAVE(cb?: Callback): R; + + /** + * Count set bits in a string. + */ + bitcount(key: string, cb?: Callback): R; + bitcount(key: string, start: number, end: number, cb?: Callback): R; + BITCOUNT(key: string, cb?: Callback): R; + BITCOUNT(key: string, start: number, end: number, cb?: Callback): R; + + /** + * Perform arbitrary bitfield integer operations on strings. + */ + bitfield: OverloadedKeyCommand; + BITFIELD: OverloadedKeyCommand; + + /** + * Perform bitwise operations between strings. + */ + bitop(operation: string, destkey: string, key1: string, key2: string, key3: string, cb?: Callback): R; + bitop(operation: string, destkey: string, key1: string, key2: string, cb?: Callback): R; + bitop(operation: string, destkey: string, key: string, cb?: Callback): R; + bitop(operation: string, destkey: string, ...args: Array>): R; + BITOP(operation: string, destkey: string, key1: string, key2: string, key3: string, cb?: Callback): R; + BITOP(operation: string, destkey: string, key1: string, key2: string, cb?: Callback): R; + BITOP(operation: string, destkey: string, key: string, cb?: Callback): R; + BITOP(operation: string, destkey: string, ...args: Array>): R; + + /** + * Find first bit set or clear in a string. + */ + bitpos(key: string, bit: number, start: number, end: number, cb?: Callback): R; + bitpos(key: string, bit: number, start: number, cb?: Callback): R; + bitpos(key: string, bit: number, cb?: Callback): R; + BITPOS(key: string, bit: number, start: number, end: number, cb?: Callback): R; + BITPOS(key: string, bit: number, start: number, cb?: Callback): R; + BITPOS(key: string, bit: number, cb?: Callback): R; + + /** + * Remove and get the first element in a list, or block until one is available. + */ + blpop: OverloadedLastCommand; + BLPOP: OverloadedLastCommand; + + /** + * Remove and get the last element in a list, or block until one is available. + */ + brpop: OverloadedLastCommand; + BRPOP: OverloadedLastCommand; + + /** + * Pop a value from a list, push it to another list and return it; or block until one is available. + */ + brpoplpush(source: string, destination: string, timeout: number, cb?: Callback): R; + BRPOPLPUSH(source: string, destination: string, timeout: number, cb?: Callback): R; + + /** + * ADDSLOTS - Assign new hash slots to receiving node. + * COUNT-FAILURE-REPORTS - Return the number of failure reports active for a given node. + * COUNTKEYSINSLOT - Return the number of local keys in the specified hash slot. + * DELSLOTS - Set hash slots as unbound in receiving node. + * FAILOVER - Forces a slave to perform a manual failover of its master. + * FORGET - Remove a node from the nodes table. + * GETKEYSINSLOT - Return local key names in the specified hash slot. + * INFO - Provides info about Redis Cluster node state. + * KEYSLOT - Returns the hash slot of the specified key. + * MEET - Force a node cluster to handshake with another node. + * NODES - Get cluster config for the node. + * REPLICATE - Reconfigure a node as a slave of the specified master node. + * RESET - Reset a Redis Cluster node. + * SAVECONFIG - Forces the node to save cluster state on disk. + * SET-CONFIG-EPOCH - Set the configuration epoch in a new node. + * SETSLOT - Bind a hash slot to a specified node. + * SLAVES - List slave nodes of the specified master node. + * SLOTS - Get array of Cluster slot to node mappings. + */ + cluster: OverloadedCommand; + CLUSTER: OverloadedCommand; + + /** + * Get array of Redis command details. + * + * COUNT - Get total number of Redis commands. + * GETKEYS - Extract keys given a full Redis command. + * INFO - Get array of specific REdis command details. + */ + command(cb?: Callback>): R; + COMMAND(cb?: Callback>): R; + + /** + * Get array of Redis command details. + * + * COUNT - Get array of Redis command details. + * GETKEYS - Extract keys given a full Redis command. + * INFO - Get array of specific Redis command details. + * GET - Get the value of a configuration parameter. + * REWRITE - Rewrite the configuration file with the in memory configuration. + * SET - Set a configuration parameter to the given value. + * RESETSTAT - Reset the stats returned by INFO. + */ + config: OverloadedCommand; + CONFIG: OverloadedCommand; + + /** + * Return the number of keys in the selected database. + */ + dbsize(cb?: Callback): R; + DBSIZE(cb?: Callback): R; + + /** + * OBJECT - Get debugging information about a key. + * SEGFAULT - Make the server crash. + */ + debug: OverloadedCommand; + DEBUG: OverloadedCommand; + + /** + * Decrement the integer value of a key by one. + */ + decr(key: string, cb?: Callback): R; + DECR(key: string, cb?: Callback): R; + + /** + * Decrement the integer value of a key by the given number. + */ + decrby(key: string, decrement: number, cb?: Callback): R; + DECRBY(key: string, decrement: number, cb?: Callback): R; + + /** + * Delete a key. + */ + del: OverloadedCommand; + DEL: OverloadedCommand; + + /** + * Discard all commands issued after MULTI. + */ + discard(cb?: Callback<'OK'>): R; + DISCARD(cb?: Callback<'OK'>): R; + + /** + * Return a serialized version of the value stored at the specified key. + */ + dump(key: string, cb?: Callback): R; + DUMP(key: string, cb?: Callback): R; + + /** + * Echo the given string. + */ + echo(message: T, cb?: Callback): R; + ECHO(message: T, cb?: Callback): R; + + /** + * Execute a Lua script server side. + */ + eval: OverloadedCommand; + EVAL: OverloadedCommand; + + /** + * Execute a Lue script server side. + */ + evalsha: OverloadedCommand; + EVALSHA: OverloadedCommand; + + /** + * Determine if a key exists. + */ + exists: OverloadedCommand; + EXISTS: OverloadedCommand; + + /** + * Set a key's time to live in seconds. + */ + expire(key: string, seconds: number, cb?: Callback): R; + EXPIRE(key: string, seconds: number, cb?: Callback): R; + + /** + * Set the expiration for a key as a UNIX timestamp. + */ + expireat(key: string, timestamp: number, cb?: Callback): R; + EXPIREAT(key: string, timestamp: number, cb?: Callback): R; + + /** + * Remove all keys from all databases. + */ + flushall(cb?: Callback): R; + FLUSHALL(cb?: Callback): R; + + /** + * Remove all keys from the current database. + */ + flushdb(cb?: Callback<'OK'>): R; + FLUSHDB(cb?: Callback<'OK'>): R; + + /** + * Add one or more geospatial items in the geospatial index represented using a sorted set. + */ + geoadd: OverloadedKeyCommand; + GEOADD: OverloadedKeyCommand; + + /** + * Returns members of a geospatial index as standard geohash strings. + */ + geohash: OverloadedKeyCommand; + GEOHASH: OverloadedKeyCommand; + + /** + * Returns longitude and latitude of members of a geospatial index. + */ + geopos: OverloadedKeyCommand, R>; + GEOPOS: OverloadedKeyCommand, R>; + + /** + * Returns the distance between two members of a geospatial index. + */ + geodist: OverloadedKeyCommand; + GEODIST: OverloadedKeyCommand; + + /** + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a point. + */ + georadius: OverloadedKeyCommand, R>; + GEORADIUS: OverloadedKeyCommand, R>; + + /** + * Query a sorted set representing a geospatial index to fetch members matching a given maximum distance from a member. + */ + georadiusbymember: OverloadedKeyCommand, R>; + GEORADIUSBYMEMBER: OverloadedKeyCommand, R>; + + /** + * Get the value of a key. + */ + get(key: string, cb?: Callback): R; + GET(key: string, cb?: Callback): R; + + /** + * Returns the bit value at offset in the string value stored at key. + */ + getbit(key: string, offset: number, cb?: Callback): R; + GETBIT(key: string, offset: number, cb?: Callback): R; + + /** + * Get a substring of the string stored at a key. + */ + getrange(key: string, start: number, end: number, cb?: Callback): R; + GETRANGE(key: string, start: number, end: number, cb?: Callback): R; + + /** + * Set the string value of a key and return its old value. + */ + getset(key: string, value: string, cb?: Callback): R; + GETSET(key: string, value: string, cb?: Callback): R; + + /** + * Delete on or more hash fields. + */ + hdel: OverloadedKeyCommand; + HDEL: OverloadedKeyCommand; + + /** + * Determine if a hash field exists. + */ + hexists(key: string, field: string, cb?: Callback): R; + HEXISTS(key: string, field: string, cb?: Callback): R; + + /** + * Get the value of a hash field. + */ + hget(key: string, field: string, cb?: Callback): R; + HGET(key: string, field: string, cb?: Callback): R; + + /** + * Get all fields and values in a hash. + */ + hgetall(key: string, cb?: Callback<{ [key: string]: string }>): R; + HGETALL(key: string, cb?: Callback<{ [key: string]: string }>): R; + + /** + * Increment the integer value of a hash field by the given number. + */ + hincrby(key: string, field: string, increment: number, cb?: Callback): R; + HINCRBY(key: string, field: string, increment: number, cb?: Callback): R; + + /** + * Increment the float value of a hash field by the given amount. + */ + hincrbyfloat(key: string, field: string, increment: number, cb?: Callback): R; + HINCRBYFLOAT(key: string, field: string, increment: number, cb?: Callback): R; + + /** + * Get all the fields of a hash. + */ + hkeys(key: string, cb?: Callback): R; + HKEYS(key: string, cb?: Callback): R; + + /** + * Get the number of fields in a hash. + */ + hlen(key: string, cb?: Callback): R; + HLEN(key: string, cb?: Callback): R; + + /** + * Get the values of all the given hash fields. + */ + hmget: OverloadedKeyCommand; + HMGET: OverloadedKeyCommand; + + /** + * Set the string value of a hash field. + */ + hset(key: string, field: string, value: string, cb?: Callback): R; + HSET(key: string, field: string, value: string, cb?: Callback): R; + + /** + * Set the value of a hash field, only if the field does not exist. + */ + hsetnx(key: string, field: string, value: string, cb?: Callback): R; + HSETNX(key: string, field: string, value: string, cb?: Callback): R; + + /** + * Get the length of the value of a hash field. + */ + hstrlen(key: string, field: string, cb?: Callback): R; + HSTRLEN(key: string, field: string, cb?: Callback): R; + + /** + * Get all the values of a hash. + */ + hvals(key: string, cb?: Callback): R; + HVALS(key: string, cb?: Callback): R; + + /** + * Increment the integer value of a key by one. + */ + incr(key: string, cb?: Callback): R; + INCR(key: string, cb?: Callback): R; + + /** + * Increment the integer value of a key by the given amount. + */ + incrby(key: string, increment: number, cb?: Callback): R; + INCRBY(key: string, increment: number, cb?: Callback): R; + + /** + * Increment the float value of a key by the given amount. + */ + incrbyfloat(key: string, increment: number, cb?: Callback): R; + INCRBYFLOAT(key: string, increment: number, cb?: Callback): R; + + /** + * Find all keys matching the given pattern. + */ + keys(pattern: string, cb?: Callback): R; + KEYS(pattern: string, cb?: Callback): R; + + /** + * Get the UNIX time stamp of the last successful save to disk. + */ + lastsave(cb?: Callback): R; + LASTSAVE(cb?: Callback): R; + + /** + * Get an element from a list by its index. + */ + lindex(key: string, index: number, cb?: Callback): R; + LINDEX(key: string, index: number, cb?: Callback): R; + + /** + * Insert an element before or after another element in a list. + */ + linsert(key: string, dir: 'BEFORE' | 'AFTER', pivot: string, value: string, cb?: Callback): R; + LINSERT(key: string, dir: 'BEFORE' | 'AFTER', pivot: string, value: string, cb?: Callback): R; + + /** + * Get the length of a list. + */ + llen(key: string, cb?: Callback): R; + LLEN(key: string, cb?: Callback): R; + + /** + * Remove and get the first element in a list. + */ + lpop(key: string, cb?: Callback): R; + LPOP(key: string, cb?: Callback): R; + + /** + * Prepend one or multiple values to a list. + */ + lpush: OverloadedKeyCommand; + LPUSH: OverloadedKeyCommand; + + /** + * Prepend a value to a list, only if the list exists. + */ + lpushx(key: string, value: string, cb?: Callback): R; + LPUSHX(key: string, value: string, cb?: Callback): R; + + /** + * Get a range of elements from a list. + */ + lrange(key: string, start: number, stop: number, cb?: Callback): R; + LRANGE(key: string, start: number, stop: number, cb?: Callback): R; + + /** + * Remove elements from a list. + */ + lrem(key: string, count: number, value: string, cb?: Callback): R; + LREM(key: string, count: number, value: string, cb?: Callback): R; + + /** + * Set the value of an element in a list by its index. + */ + lset(key: string, index: number, value: string, cb?: Callback<'OK'>): R; + LSET(key: string, index: number, value: string, cb?: Callback<'OK'>): R; + + /** + * Trim a list to the specified range. + */ + ltrim(key: string, start: number, stop: number, cb?: Callback<'OK'>): R; + LTRIM(key: string, start: number, stop: number, cb?: Callback<'OK'>): R; + + /** + * Get the values of all given keys. + */ + mget: OverloadedCommand; + MGET: OverloadedCommand; + + /** + * Atomically tranfer a key from a Redis instance to another one. + */ + migrate: OverloadedCommand; + MIGRATE: OverloadedCommand; + + /** + * Move a key to another database. + */ + move(key: string, db: string | number): R; + MOVE(key: string, db: string | number): R; + + /** + * Set multiple keys to multiple values. + */ + mset: OverloadedCommand; + MSET: OverloadedCommand; + + /** + * Set multiple keys to multiple values, only if none of the keys exist. + */ + msetnx: OverloadedCommand; + MSETNX: OverloadedCommand; + + /** + * Inspect the internals of Redis objects. + */ + object: OverloadedCommand; + OBJECT: OverloadedCommand; + + /** + * Remove the expiration from a key. + */ + persist(key: string, cb?: Callback): R; + PERSIST(key: string, cb?: Callback): R; + + /** + * Remove a key's time to live in milliseconds. + */ + pexpire(key: string, milliseconds: number, cb?: Callback): R; + PEXPIRE(key: string, milliseconds: number, cb?: Callback): R; + + /** + * Set the expiration for a key as a UNIX timestamp specified in milliseconds. + */ + pexpireat(key: string, millisecondsTimestamp: number, cb?: Callback): R; + PEXPIREAT(key: string, millisecondsTimestamp: number, cb?: Callback): R; + + /** + * Adds the specified elements to the specified HyperLogLog. + */ + pfadd: OverloadedKeyCommand; + PFADD: OverloadedKeyCommand; + + /** + * Return the approximated cardinality of the set(s) observed by the HyperLogLog at key(s). + */ + pfcount: OverloadedCommand; + PFCOUNT: OverloadedCommand; + + /** + * Merge N different HyperLogLogs into a single one. + */ + pfmerge: OverloadedCommand; + PFMERGE: OverloadedCommand; + + /** + * Set the value and expiration in milliseconds of a key. + */ + psetex(key: string, milliseconds: number, value: string, cb?: Callback<'OK'>): R; + PSETEX(key: string, milliseconds: number, value: string, cb?: Callback<'OK'>): R; + + /** + * Inspect the state of the Pub/Sub subsytem. + */ + pubsub: OverloadedCommand; + PUBSUB: OverloadedCommand; + + /** + * Get the time to live for a key in milliseconds. + */ + pttl(key: string, cb?: Callback): R; + PTTL(key: string, cb?: Callback): R; + + /** + * Close the connection. + */ + quit(cb?: Callback<'OK'>): R; + QUIT(cb?: Callback<'OK'>): R; + + /** + * Return a random key from the keyspace. + */ + randomkey(cb?: Callback): R; + RANDOMKEY(cb?: Callback): R; + + /** + * Enables read queries for a connection to a cluster slave node. + */ + readonly(cb?: Callback): R; + READONLY(cb?: Callback): R; + + /** + * Disables read queries for a connection to cluster slave node. + */ + readwrite(cb?: Callback): R; + READWRITE(cb?: Callback): R; + + /** + * Rename a key. + */ + rename(key: string, newkey: string, cb?: Callback<'OK'>): R; + RENAME(key: string, newkey: string, cb?: Callback<'OK'>): R; + + /** + * Rename a key, only if the new key does not exist. + */ + renamenx(key: string, newkey: string, cb?: Callback): R; + RENAMENX(key: string, newkey: string, cb?: Callback): R; + + /** + * Create a key using the provided serialized value, previously obtained using DUMP. + */ + restore(key: string, ttl: number, serializedValue: string, cb?: Callback<'OK'>): R; + RESTORE(key: string, ttl: number, serializedValue: string, cb?: Callback<'OK'>): R; + + /** + * Return the role of the instance in the context of replication. + */ + role(cb?: Callback<[string, number, Array<[string, string, string]>]>): R; + ROLE(cb?: Callback<[string, number, Array<[string, string, string]>]>): R; + + /** + * Remove and get the last element in a list. + */ + rpop(key: string, cb?: Callback): R; + RPOP(key: string, cb?: Callback): R; + + /** + * Remove the last element in a list, prepend it to another list and return it. + */ + rpoplpush(source: string, destination: string, cb?: Callback): R; + RPOPLPUSH(source: string, destination: string, cb?: Callback): R; + + /** + * Append one or multiple values to a list. + */ + rpush: OverloadedKeyCommand; + RPUSH: OverloadedKeyCommand; + + /** + * Append a value to a list, only if the list exists. + */ + rpushx(key: string, value: string, cb?: Callback): R; + RPUSHX(key: string, value: string, cb?: Callback): R; + + /** + * Append one or multiple members to a set. + */ + sadd: OverloadedKeyCommand; + SADD: OverloadedKeyCommand; + + /** + * Synchronously save the dataset to disk. + */ + save(cb?: Callback): R; + SAVE(cb?: Callback): R; + + /** + * Get the number of members in a set. + */ + scard(key: string, cb?: Callback): R; + SCARD(key: string, cb?: Callback): R; + + /** + * DEBUG - Set the debug mode for executed scripts. + * EXISTS - Check existence of scripts in the script cache. + * FLUSH - Remove all scripts from the script cache. + * KILL - Kill the script currently in execution. + * LOAD - Load the specified Lua script into the script cache. + */ + script: OverloadedCommand; + SCRIPT: OverloadedCommand; + + /** + * Subtract multiple sets. + */ + sdiff: OverloadedCommand; + SDIFF: OverloadedCommand; + + /** + * Subtract multiple sets and store the resulting set in a key. + */ + sdiffstore: OverloadedKeyCommand; + SDIFFSTORE: OverloadedKeyCommand; + + /** + * Change the selected database for the current connection. + */ + select(index: number | string, cb?: Callback): R; + SELECT(index: number | string, cb?: Callback): R; + + /** + * Set the string value of a key. + */ + set(key: string, value: string, cb?: Callback<'OK'>): R; + set(key: string, value: string, flag: string, cb?: Callback<'OK'>): R; + set(key: string, value: string, mode: string, duration: number, cb?: Callback<'OK' | undefined>): R; + set(key: string, value: string, mode: string, duration: number, flag: string, cb?: Callback<'OK' | undefined>): R; + SET(key: string, value: string, cb?: Callback<'OK'>): R; + SET(key: string, value: string, flag: string, cb?: Callback<'OK'>): R; + SET(key: string, value: string, mode: string, duration: number, cb?: Callback<'OK' | undefined>): R; + SET(key: string, value: string, mode: string, duration: number, flag: string, cb?: Callback<'OK' | undefined>): R; + + /** + * Sets or clears the bit at offset in the string value stored at key. + */ + setbit(key: string, offset: number, value: string, cb?: Callback): R; + SETBIT(key: string, offset: number, value: string, cb?: Callback): R; + + /** + * Set the value and expiration of a key. + */ + setex(key: string, seconds: number, value: string, cb?: Callback): R; + SETEX(key: string, seconds: number, value: string, cb?: Callback): R; + + /** + * Set the value of a key, only if the key does not exist. + */ + setnx(key: string, value: string, cb?: Callback): R; + SETNX(key: string, value: string, cb?: Callback): R; + + /** + * Overwrite part of a string at key starting at the specified offset. + */ + setrange(key: string, offset: number, value: string, cb?: Callback): R; + SETRANGE(key: string, offset: number, value: string, cb?: Callback): R; + + /** + * Synchronously save the dataset to disk and then shut down the server. + */ + shutdown: OverloadedCommand; + SHUTDOWN: OverloadedCommand; + + /** + * Intersect multiple sets. + */ + sinter: OverloadedKeyCommand; + SINTER: OverloadedKeyCommand; + + /** + * Intersect multiple sets and store the resulting set in a key. + */ + sinterstore: OverloadedCommand; + SINTERSTORE: OverloadedCommand; + + /** + * Determine if a given value is a member of a set. + */ + sismember(key: string, member: string, cb?: Callback): R; + SISMEMBER(key: string, member: string, cb?: Callback): R; + + /** + * Make the server a slave of another instance, or promote it as master. + */ + slaveof(host: string, port: string | number, cb?: Callback): R; + SLAVEOF(host: string, port: string | number, cb?: Callback): R; + + /** + * Manages the Redis slow queries log. + */ + slowlog: OverloadedCommand, R>; + SLOWLOG: OverloadedCommand, R>; + + /** + * Get all the members in a set. + */ + smembers(key: string, cb?: Callback): R; + SMEMBERS(key: string, cb?: Callback): R; + + /** + * Move a member from one set to another. + */ + smove(source: string, destination: string, member: string, cb?: Callback): R; + SMOVE(source: string, destination: string, member: string, cb?: Callback): R; + + /** + * Sort the elements in a list, set or sorted set. + */ + sort: OverloadedCommand; + SORT: OverloadedCommand; + + /** + * Remove and return one or multiple random members from a set. + */ + spop(key: string, cb?: Callback): R; + spop(key: string, count: number, cb?: Callback): R; + SPOP(key: string, cb?: Callback): R; + SPOP(key: string, count: number, cb?: Callback): R; + + /** + * Get one or multiple random members from a set. + */ + srandmember(key: string, cb?: Callback): R; + srandmember(key: string, count: number, cb?: Callback): R; + SRANDMEMBER(key: string, cb?: Callback): R; + SRANDMEMBER(key: string, count: number, cb?: Callback): R; + + /** + * Remove one or more members from a set. + */ + srem: OverloadedKeyCommand; + SREM: OverloadedKeyCommand; + + /** + * Get the length of the value stored in a key. + */ + strlen(key: string, cb?: Callback): R; + STRLEN(key: string, cb?: Callback): R; + + /** + * Add multiple sets. + */ + sunion: OverloadedCommand; + SUNION: OverloadedCommand; + + /** + * Add multiple sets and store the resulting set in a key. + */ + sunionstore: OverloadedCommand; + SUNIONSTORE: OverloadedCommand; + + /** + * Internal command used for replication. + */ + sync(cb?: Callback): R; + SYNC(cb?: Callback): R; + + /** + * Return the current server time. + */ + time(cb?: Callback<[string, string]>): R; + TIME(cb?: Callback<[string, string]>): R; + + /** + * Get the time to live for a key. + */ + ttl(key: string, cb?: Callback): R; + TTL(key: string, cb?: Callback): R; + + /** + * Determine the type stored at key. + */ + type(key: string, cb?: Callback): R; + TYPE(key: string, cb?: Callback): R; + + /** + * Forget about all watched keys. + */ + unwatch(cb?: Callback<'OK'>): R; + UNWATCH(cb?: Callback<'OK'>): R; + + /** + * Wait for the synchronous replication of all the write commands sent in the context of the current connection. + */ + wait(numslaves: number, timeout: number, cb?: Callback): R; + WAIT(numslaves: number, timeout: number, cb?: Callback): R; + + /** + * Watch the given keys to determine execution of the MULTI/EXEC block. + */ + watch: OverloadedCommand; + WATCH: OverloadedCommand; + + /** + * Add one or more members to a sorted set, or update its score if it already exists. + */ + zadd: OverloadedKeyCommand; + ZADD: OverloadedKeyCommand; + + /** + * Get the number of members in a sorted set. + */ + zcard(key: string, cb?: Callback): R; + ZCARD(key: string, cb?: Callback): R; + + /** + * Count the members in a sorted set with scores between the given values. + */ + zcount(key: string, min: number | string, max: number | string, cb?: Callback): R; + ZCOUNT(key: string, min: number | string, max: number | string, cb?: Callback): R; + + /** + * Increment the score of a member in a sorted set. + */ + zincrby(key: string, increment: number, member: string, cb?: Callback): R; + ZINCRBY(key: string, increment: number, member: string, cb?: Callback): R; + + /** + * Intersect multiple sorted sets and store the resulting sorted set in a new key. + */ + zinterstore: OverloadedCommand; + ZINTERSTORE: OverloadedCommand; + + /** + * Count the number of members in a sorted set between a given lexicographic range. + */ + zlexcount(key: string, min: string, max: string, cb?: Callback): R; + ZLEXCOUNT(key: string, min: string, max: string, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by index. + */ + zrange(key: string, start: number, stop: number, cb?: Callback): R; + zrange(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + ZRANGE(key: string, start: number, stop: number, cb?: Callback): R; + ZRANGE(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by lexicographical range. + */ + zrangebylex(key: string, min: string, max: string, cb?: Callback): R; + zrangebylex(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZRANGEBYLEX(key: string, min: string, max: string, cb?: Callback): R; + ZRANGEBYLEX(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by lexicographical range, ordered from higher to lower strings. + */ + zrevrangebylex(key: string, min: string, max: string, cb?: Callback): R; + zrevrangebylex(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZREVRANGEBYLEX(key: string, min: string, max: string, cb?: Callback): R; + ZREVRANGEBYLEX(key: string, min: string, max: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by score. + */ + zrangebyscore(key: string, min: number | string, max: number | string, cb?: Callback): R; + zrangebyscore(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + zrangebyscore(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + zrangebyscore(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + ZRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Determine the index of a member in a sorted set. + */ + zrank(key: string, member: string, cb?: Callback): R; + ZRANK(key: string, member: string, cb?: Callback): R; + + /** + * Remove one or more members from a sorted set. + */ + zrem: OverloadedKeyCommand; + ZREM: OverloadedKeyCommand; + + /** + * Remove all members in a sorted set between the given lexicographical range. + */ + zremrangebylex(key: string, min: string, max: string, cb?: Callback): R; + ZREMRANGEBYLEX(key: string, min: string, max: string, cb?: Callback): R; + + /** + * Remove all members in a sorted set within the given indexes. + */ + zremrangebyrank(key: string, start: number, stop: number, cb?: Callback): R; + ZREMRANGEBYRANK(key: string, start: number, stop: number, cb?: Callback): R; + + /** + * Remove all members in a sorted set within the given indexes. + */ + zremrangebyscore(key: string, min: string | number, max: string | number, cb?: Callback): R; + ZREMRANGEBYSCORE(key: string, min: string | number, max: string | number, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by index, with scores ordered from high to low. + */ + zrevrange(key: string, start: number, stop: number, cb?: Callback): R; + zrevrange(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + ZREVRANGE(key: string, start: number, stop: number, cb?: Callback): R; + ZREVRANGE(key: string, start: number, stop: number, withscores: string, cb?: Callback): R; + + /** + * Return a range of members in a sorted set, by score, with scores ordered from high to low. + */ + zrevrangebyscore(key: string, min: number | string, max: number | string, cb?: Callback): R; + zrevrangebyscore(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + zrevrangebyscore(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + zrevrangebyscore(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, limit: string, offset: number, count: number, cb?: Callback): R; + ZREVRANGEBYSCORE(key: string, min: number | string, max: number | string, withscores: string, limit: string, offset: number, count: number, cb?: Callback): R; + + /** + * Determine the index of a member in a sorted set, with scores ordered from high to low. + */ + zrevrank(key: string, member: string, cb?: Callback): R; + ZREVRANK(key: string, member: string, cb?: Callback): R; + + /** + * Get the score associated with the given member in a sorted set. + */ + zscore(key: string, member: string, cb?: Callback): R; + ZSCORE(key: string, member: string, cb?: Callback): R; + + /** + * Add multiple sorted sets and store the resulting sorted set in a new key. + */ + zunionstore: OverloadedCommand; + ZUNIONSTORE: OverloadedCommand; + + /** + * Incrementally iterate the keys space. + */ + scan: OverloadedCommand; + SCAN: OverloadedCommand; + + /** + * Incrementally iterate Set elements. + */ + sscan: OverloadedKeyCommand; + SSCAN: OverloadedKeyCommand; + + /** + * Incrementally iterate hash fields and associated values. + */ + hscan: OverloadedKeyCommand; + HSCAN: OverloadedKeyCommand; + + /** + * Incrementally iterate sorted sets elements and associated scores. + */ + zscan: OverloadedKeyCommand; + ZSCAN: OverloadedKeyCommand; +} + +export const RedisClient: new (options: ClientOpts) => RedisClient; + +export interface RedisClient extends Commands, EventEmitter { + connected: boolean; + command_queue_length: number; + offline_queue_length: number; + retry_delay: number; + retry_backoff: number; + command_queue: any[]; + offline_queue: any[]; + connection_id: number; + server_info: ServerInfo; + stream: Duplex; + + on(event: 'message' | 'message_buffer', listener: (channel: string, message: string) => void): this; + on(event: 'pmessage' | 'pmessage_buffer', listener: (pattern: string, channel: string, message: string) => void): this; + on(event: 'subscribe' | 'unsubscribe', listener: (channel: string, count: number) => void): this; + on(event: 'psubscribe' | 'punsubscribe', listener: (pattern: string, count: number) => void): this; + on(event: string, listener: (...args: any[]) => void): this; + + /** + * Client methods. + */ + + end(flush?: boolean): void; + unref(): void; + + cork(): void; + uncork(): void; + + duplicate(options?: ClientOpts, cb?: Callback): RedisClient; + + sendCommand(command: string, cb?: Callback): boolean; + sendCommand(command: string, args?: any[], cb?: Callback): boolean; + send_command(command: string, cb?: Callback): boolean; + send_command(command: string, args?: any[], cb?: Callback): boolean; + + addCommand(command: string): void; + add_command(command: string): void; + + /** + * Mark the start of a transaction block. + */ + multi(args?: Array>>): Multi; + MULTI(args?: Array>>): Multi; + + batch(args?: Array>>): Multi; + BATCH(args?: Array>>): Multi; +} + +export const Multi: new () => Multi; + +export interface Multi extends Commands { + exec(cb?: Callback): boolean; + EXEC(cb?: Callback): boolean; + + exec_atomic(cb?: Callback): boolean; + EXEC_ATOMIC(cb?: Callback): boolean; +} + +export let debug_mode: boolean; + +export function createClient(port: number, host?: string, options?: ClientOpts): RedisClient; +export function createClient(unix_socket: string, options?: ClientOpts): RedisClient; +export function createClient(redis_url: string, options?: ClientOpts): RedisClient; +export function createClient(options?: ClientOpts): RedisClient; + +export function print(err: Error | null, reply: any): void; + +export class RedisError extends Error { } +export class ReplyError extends RedisError { } +export class AbortError extends RedisError { } +export class ParserError extends RedisError { + offset: number; + buffer: Buffer; +} +export class AggregateError extends AbortError { } diff --git a/types/redis/ts3.1/redis-tests.ts b/types/redis/ts3.1/redis-tests.ts new file mode 100644 index 0000000000..e2a0a37acf --- /dev/null +++ b/types/redis/ts3.1/redis-tests.ts @@ -0,0 +1,142 @@ +import redis = require('redis'); + +const value: any = 'any value'; +const commandArr: any[][] = []; +const num = 0; +const str = 'any string'; +const err: Error = new Error(); +const args: any[] = []; +const resCallback: (err: Error | null, res: any) => void = () => {}; +const numCallback: (err: Error | null, res: number) => void = () => {}; +const strCallback: (err: Error | null, res: string) => void = () => {}; +const okCallback: (err: Error | null, res: 'OK') => void = () => {}; +const messageHandler: (channel: string, message: any) => void = () => {}; + +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- + +const debug_mode: boolean = redis.debug_mode; +redis.print(err, value); + +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- + +const options: redis.ClientOpts = { + host: 'localhost', + port: 6379, +}; +let client: redis.RedisClient = redis.createClient(num, str, options); + +// Test the `retry_strategy` property +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- +function retryStrategyNumber(options: redis.RetryStrategyOptions): number { + // Ensure that the properties of RetryStrategyOptions are resilient to breaking change. + // If the properties of the interface changes, the variables below will also need to be adapted. + const error: Error = options.error; + const total_retry_time: number = options.total_retry_time; + const times_connected: number = options.times_connected; + const attempt: number = options.attempt; + return 5000; +} +function retryStrategyError(options: redis.RetryStrategyOptions): Error { + return new Error('Foo'); +} +client = redis.createClient({ + retry_strategy: retryStrategyNumber +}); +client = redis.createClient({ + retry_strategy: retryStrategyError +}); +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- + +const connected: boolean = client.connected; +const retry_delay: number = client.retry_delay; +const retry_backoff: number = client.retry_backoff; +const command_queue: any[] = client.command_queue; +const offline_queue: any[] = client.offline_queue; +const info: redis.ServerInfo = client.server_info; + +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- + +client.end(true); + +// Connection (http://redis.io/commands#connection) +client.auth(str, resCallback); +client.ping(strCallback); +client.unref(); + +// Strings (http://redis.io/commands#strings) +client.append(str, str, numCallback); +client.bitcount(str, numCallback); +client.bitcount(str, num, num, numCallback); +client.set(str, str, okCallback); +client.get(str, strCallback); +client.exists(str, numCallback); + +// Event handlers +client.on(str, messageHandler); +client.once(str, messageHandler); + +// ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- ---- + +// some of the bulk methods +client.get('test'); +client.get('test', resCallback); +client.set('test', 'test'); +client.set('test', 'test', okCallback); +client.mset(args, resCallback); + +client.incr(str, resCallback); + +// Friendlier hash commands +client.hgetall(str, resCallback); +client.hmset(str, value, okCallback); +client.hmset(str, str, str, str, str, okCallback); +client.hmset([str, str, str, str, str], okCallback); +client.hmset([str, str, str, str, str]); +client.hmset(str, [str, str, str, str]); +client.hmset(str, [str, value, str, value], okCallback); + +// Publish / Subscribe +client.publish(str, value); +client.subscribe(str); + +// Multi +client.multi() + .scard(str) + .smembers(str) + .keys('*', resCallback) + .dbsize() + .exec(resCallback); + +client.multi([['get', 'test']]).exec(); + +// Monitor mode +client.monitor(resCallback); + +// Send command +client.send_command(str, args, resCallback); +// Duplicate +client.duplicate(); + +// Pipeline +client.cork(); +client.set('abc', 'fff', strCallback); +client.get('abc', resCallback); +client.uncork(); + +// Add command +client.add_command('my command'); +client.addCommand('my other command'); + +// redis.print as callback +client.set(str, str, redis.print); +client.get(str, redis.print); + +// increase-by-float reply a string +client.incrbyfloat('a', 1.5, (error, value) => value.startsWith('1')); +client.INCRBYFLOAT('a', 1.5, (error, value) => value.startsWith('1')); +client.hincrbyfloat('a', 'b', 1.5, (error, value) => value.startsWith('1')); +client.HINCRBYFLOAT('a', 'b', 1.5, (error, value) => value.startsWith('1')); +client.zincrby('a', 1, 'b', strCallback); +client.ZINCRBY('a', 1, 'b', strCallback); + +client.flushdb(okCallback); diff --git a/types/decamelize/tsconfig.json b/types/redis/ts3.1/tsconfig.json similarity index 84% rename from types/decamelize/tsconfig.json rename to types/redis/ts3.1/tsconfig.json index 54bea1b020..eb55ed1d6f 100644 --- a/types/decamelize/tsconfig.json +++ b/types/redis/ts3.1/tsconfig.json @@ -8,9 +8,9 @@ "noImplicitThis": true, "strictNullChecks": true, "strictFunctionTypes": true, - "baseUrl": "../", + "baseUrl": "../../", "typeRoots": [ - "../" + "../../" ], "types": [], "noEmit": true, @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "decamelize-tests.ts" + "redis-tests.ts" ] } \ No newline at end of file diff --git a/types/p-event/v1/tslint.json b/types/redis/ts3.1/tslint.json similarity index 100% rename from types/p-event/v1/tslint.json rename to types/redis/ts3.1/tslint.json diff --git a/types/redux-action-utils/tslint.json b/types/redux-action-utils/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-action-utils/tslint.json +++ b/types/redux-action-utils/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-actions/index.d.ts b/types/redux-actions/index.d.ts index 6891563ab9..fd92441573 100644 --- a/types/redux-actions/index.d.ts +++ b/types/redux-actions/index.d.ts @@ -1,10 +1,11 @@ -// Type definitions for redux-actions 2.3 +// Type definitions for redux-actions 2.6 // Project: https://github.com/redux-utilities/redux-actions // Definitions by: Jack Hsu , // Alex Gorbatchev , // Alec Hill // Alexey Pelykh // Thiago de Andrade +// Ziyu // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.2 @@ -17,7 +18,7 @@ export interface BaseAction { } export interface Action extends BaseAction { - payload?: Payload; + payload: Payload; error?: boolean; } @@ -66,6 +67,10 @@ export type Reducer = (state: State, action: Action) => export type ReducerMeta = (state: State, action: ActionMeta) => State; +export type ReduxCompatibleReducer = (state: State | undefined, action: Action) => State; + +export type ReduxCompatibleReducerMeta = (state: State | undefined, action: ActionMeta) => State; + /** argument inferring borrowed from lodash definitions */ export type ActionFunction0 = () => R; export type ActionFunction1 = (t1: T1) => R; @@ -148,13 +153,13 @@ export function handleAction( actionType: string | ActionFunctions | CombinedActionType, reducer: Reducer | ReducerNextThrow, initialState: State -): Reducer; +): ReduxCompatibleReducer; export function handleAction( actionType: string | ActionWithMetaFunctions | CombinedActionType, reducer: ReducerMeta | ReducerNextThrowMeta, initialState: State -): Reducer; +): ReduxCompatibleReducerMeta; export interface Options { prefix?: string; @@ -165,19 +170,19 @@ export function handleActions( reducerMap: ReducerMap, initialState: StateAndPayload, options?: Options -): Reducer; +): ReduxCompatibleReducer; export function handleActions( reducerMap: ReducerMap, initialState: State, options?: Options -): Reducer; +): ReduxCompatibleReducer; export function handleActions( reducerMap: ReducerMapMeta, initialState: State, options?: Options -): ReducerMeta; +): ReduxCompatibleReducerMeta; // https://github.com/redux-utilities/redux-actions/blob/v2.3.0/src/combineActions.js#L21 export function combineActions(...actionTypes: Array | string | symbol>): CombinedActionType; diff --git a/types/redux-actions/redux-actions-tests.ts b/types/redux-actions/redux-actions-tests.ts index 207e4746b7..27f33a2843 100644 --- a/types/redux-actions/redux-actions-tests.ts +++ b/types/redux-actions/redux-actions-tests.ts @@ -1,7 +1,6 @@ import * as ReduxActions from 'redux-actions'; let state: number; -const minimalAction: ReduxActions.BaseAction = { type: 'INCREMENT' }; const incrementAction: () => ReduxActions.Action = ReduxActions.createAction( 'INCREMENT', () => 1 @@ -11,14 +10,13 @@ const multiplyAction: (...args: number[]) => ReduxActions.Action = Redux 'MULTIPLY' ); -const action: ReduxActions.Action = incrementAction(); - const actionHandler = ReduxActions.handleAction( 'INCREMENT', (state: number, action: ReduxActions.Action) => state + action.payload, 0 ); +state = actionHandler(undefined, incrementAction()); state = actionHandler(0, incrementAction()); const actionHandlerWithReduceMap = ReduxActions.handleAction( @@ -31,6 +29,7 @@ const actionHandlerWithReduceMap = ReduxActions.handleAction( 0 ); +state = actionHandlerWithReduceMap(undefined, multiplyAction(10)); state = actionHandlerWithReduceMap(0, multiplyAction(10)); const actionsHandler = ReduxActions.handleActions({ @@ -38,7 +37,8 @@ const actionsHandler = ReduxActions.handleActions({ MULTIPLY: (state: number, action: ReduxActions.Action) => state * action.payload }, 0); -state = actionsHandler(0, { type: 'INCREMENT' }); +state = actionsHandler(undefined, incrementAction()); +state = actionsHandler(0, incrementAction()); const actionsHandlerWithInitialState = ReduxActions.handleActions({ INCREMENT: { @@ -49,7 +49,8 @@ const actionsHandlerWithInitialState = ReduxActions.handleActions({ } }, 0); -state = actionsHandlerWithInitialState(0, { type: 'INCREMENT' }); +state = actionsHandlerWithInitialState(undefined, incrementAction()); +state = actionsHandlerWithInitialState(0, incrementAction()); const actionsHandlerWithRecursiveReducerMap = ReduxActions.handleActions({ ADJUST: { @@ -58,6 +59,7 @@ const actionsHandlerWithRecursiveReducerMap = ReduxActions.handleActions) => state * action.payload }, 0, {prefix: 'TEST'}); -state = actionsHandlerWithOptions(0, { type: 'TEST/INCREMENT' }); +state = actionsHandlerWithOptions(undefined, { type: 'TEST/INCREMENT', payload: 1 }); +state = actionsHandlerWithOptions(0, { type: 'TEST/INCREMENT', payload: 1 }); const actionsHandlerWithRecursiveReducerMapAndOptions = ReduxActions.handleActions({ ADJUST: { @@ -74,6 +77,7 @@ const actionsHandlerWithRecursiveReducerMapAndOptions = ReduxActions.handleActio } }, 0, {namespace: '--'}); +state = actionsHandlerWithRecursiveReducerMapAndOptions(undefined, { type: 'ADJUST--UP', payload: 1 }); state = actionsHandlerWithRecursiveReducerMapAndOptions(0, { type: 'ADJUST--UP', payload: 1 }); // ---------------------------------------------------------------------------------------------------- @@ -117,6 +121,7 @@ const typedActionHandler = ReduxActions.handleAction( const actionNoArgs = typedIncrementAction(); actionNoArgs.payload.increase = 1; +typedState = typedActionHandler(undefined, actionNoArgs); typedState = typedActionHandler({ value: 0 }, actionNoArgs); const typedIncrementAction1TypedArg: (value: number) => @@ -144,6 +149,7 @@ const typedActionHandlerReducerMap = ReduxActions.handleActions( {value: 1} ); +typedState = typedActionHandlerReducerMap(undefined, actionFrom1Arg); typedState = typedActionHandlerReducerMap({ value: 0 }, actionFrom1Arg); const typedIncrementByActionWithMetaAnyArgs: (...args: any[]) => ReduxActions.ActionMeta = @@ -167,6 +173,7 @@ const typedActionHandlerWithMeta = ReduxActions.handleAction( @@ -181,6 +188,7 @@ const typedActionHandlerReducerMetaMap = ReduxActions.handleActions ReduxActions.ActionMeta = diff --git a/types/redux-actions/tsconfig.json b/types/redux-actions/tsconfig.json index ea4f7f1a53..8a88909508 100644 --- a/types/redux-actions/tsconfig.json +++ b/types/redux-actions/tsconfig.json @@ -6,7 +6,7 @@ ], "noImplicitAny": true, "noImplicitThis": true, - "strictNullChecks": false, + "strictNullChecks": true, "strictFunctionTypes": false, "baseUrl": "../", "typeRoots": [ diff --git a/types/redux-batched-subscribe/index.d.ts b/types/redux-batched-subscribe/index.d.ts index e3f5345591..aacb421eda 100644 --- a/types/redux-batched-subscribe/index.d.ts +++ b/types/redux-batched-subscribe/index.d.ts @@ -1,11 +1,17 @@ // Type definitions for redux-batched-subscribe 0.1 // Project: https://github.com/tappleby/redux-batched-subscribe // Definitions by: Dibyo Majumdar +// Aziz Khambati // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 -import { GenericStoreEnhancer } from 'redux'; +import { Store, StoreEnhancer } from 'redux'; export type NotifyFunction = () => void; export type BatchFunction = (notify: NotifyFunction) => void; -export function batchedSubscribe(batch: BatchFunction): GenericStoreEnhancer; +export interface StoreExtension { + subscribeImmediate: Store["subscribe"]; +} + +export function batchedSubscribe(batch: BatchFunction): StoreEnhancer; diff --git a/types/redux-batched-subscribe/package.json b/types/redux-batched-subscribe/package.json index f5b5c699de..7f5b19d45b 100644 --- a/types/redux-batched-subscribe/package.json +++ b/types/redux-batched-subscribe/package.json @@ -1,6 +1,6 @@ { "private": true, "dependencies": { - "redux": ">=1.0.0 <4.0.0" + "redux": "^4.0.0" } } diff --git a/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts b/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts index 6fa3e891b3..d46f8af7d3 100644 --- a/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts +++ b/types/redux-batched-subscribe/redux-batched-subscribe-tests.ts @@ -23,7 +23,13 @@ const asyncNotify: BatchFunction = (() => { }; })(); -const store: Store = createStore( +const store = createStore( rootReducer, batchedSubscribe(asyncNotify) ); + +const unsubscribe = store.subscribeImmediate(() => { + store.getState(); +}); + +unsubscribe(); diff --git a/types/redux-debounced/tslint.json b/types/redux-debounced/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-debounced/tslint.json +++ b/types/redux-debounced/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-devtools-dock-monitor/tslint.json b/types/redux-devtools-dock-monitor/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-devtools-dock-monitor/tslint.json +++ b/types/redux-devtools-dock-monitor/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-devtools-log-monitor/tslint.json b/types/redux-devtools-log-monitor/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-devtools-log-monitor/tslint.json +++ b/types/redux-devtools-log-monitor/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-devtools/tslint.json b/types/redux-devtools/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-devtools/tslint.json +++ b/types/redux-devtools/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-form/index.d.ts b/types/redux-form/index.d.ts index 08d077875a..7005abf1de 100644 --- a/types/redux-form/index.d.ts +++ b/types/redux-form/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for redux-form 7.5 +// Type definitions for redux-form 8.1 // Project: https://github.com/erikras/redux-form, https://redux-form.com // Definitions by: Carson Full // Daniel Lytkin @@ -13,6 +13,8 @@ // Kamil Wojcik // Mohamed Shaaban // Ethan Setnik +// Walter Barbagallo +// Kota Marusue // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 3.0 import { diff --git a/types/redux-form/lib/Field.d.ts b/types/redux-form/lib/Field.d.ts index 194a322408..f0e1c0a6cc 100644 --- a/types/redux-form/lib/Field.d.ts +++ b/types/redux-form/lib/Field.d.ts @@ -44,7 +44,7 @@ export interface BaseFieldProps

extends Partial { parse?: Parser; validate?: Validator | Validator[]; warn?: Validator | Validator[]; - withRef?: boolean; + forwardRef?: boolean; immutableProps?: string[]; } diff --git a/types/redux-form/lib/FieldArray.d.ts b/types/redux-form/lib/FieldArray.d.ts index a4599b5e97..026e75633f 100644 --- a/types/redux-form/lib/FieldArray.d.ts +++ b/types/redux-form/lib/FieldArray.d.ts @@ -6,7 +6,7 @@ export interface BaseFieldArrayProps

{ component: ComponentType

; validate?: Validator | Validator[]; warn?: Validator | Validator[]; - withRef?: boolean; + forwardRef?: boolean; props?: P; rerenderOnEveryChange?: boolean; } @@ -40,7 +40,7 @@ export interface FieldArrayFieldsProps { length: number; map(callback: FieldIterate): R[]; pop(): FieldValue; - push(value: FieldValue): void; + push(value?: FieldValue): void; remove(index: number): void; shift(): FieldValue; swap(indexA: number, indexB: number): void; diff --git a/types/redux-form/lib/Fields.d.ts b/types/redux-form/lib/Fields.d.ts index f5ec106852..93b7fbcc74 100644 --- a/types/redux-form/lib/Fields.d.ts +++ b/types/redux-form/lib/Fields.d.ts @@ -1,5 +1,10 @@ import { Component, ComponentType } from "react"; -import { Formatter, Parser, WrappedFieldProps } from "../index"; +import { Formatter, Parser, WrappedFieldProps, Validator } from "../index"; + +export type FieldsWarnerOrValidator = + | Validator + | Validator[] + | { [name: string]: Validator | Validator[] }; interface BaseFieldsProps

{ names: string[]; @@ -7,7 +12,9 @@ interface BaseFieldsProps

{ format?: Formatter | null; props?: P; parse?: Parser; - withRef?: boolean; + forwardRef?: boolean; + validate?: FieldsWarnerOrValidator; + warn?: FieldsWarnerOrValidator; } export interface GenericFields

extends Component & P> { diff --git a/types/redux-form/lib/FormName.d.ts b/types/redux-form/lib/FormName.d.ts index 6cfc6f3708..501035fdf4 100644 --- a/types/redux-form/lib/FormName.d.ts +++ b/types/redux-form/lib/FormName.d.ts @@ -1,7 +1,7 @@ import { ReactNode, StatelessComponent } from "react"; export interface FormNameProps { - children: (props: { form: string }) => ReactNode; + children: (props: { form: string, sectionPrefix?: string }) => ReactNode; } export const FormName: StatelessComponent; diff --git a/types/redux-form/lib/actions.d.ts b/types/redux-form/lib/actions.d.ts index 955d3d3f5e..85fec56908 100644 --- a/types/redux-form/lib/actions.d.ts +++ b/types/redux-form/lib/actions.d.ts @@ -36,11 +36,11 @@ export declare function registerField(form: string, name: string, type: FieldTyp export declare function reset(form: string): FormAction; export declare function resetSection(form: string, ...sections: string[]): FormAction; export declare function startAsyncValidation(form: string): FormAction; -export declare function stopAsyncValidation(form: string, errors?: FormErrors): FormAction; +export declare function stopAsyncValidation(form: string, errors?: FormErrors): FormAction; export declare function setSubmitFailed(form: string, ...fields: string[]): FormAction; export declare function setSubmitSucceeded(form: string, ...fields: string[]): FormAction; export declare function startSubmit(form: string): FormAction; -export declare function stopSubmit(form: string, errors?: FormErrors): FormAction; +export declare function stopSubmit(form: string, errors?: FormErrors): FormAction; export declare function submit(form: string): FormAction; export declare function clearSubmit(form: string): FormAction; export declare function clearSubmitErrors(form: string): FormAction; @@ -49,8 +49,8 @@ export declare function clearFields(form: string, keepTouched: boolean, persiste export declare function touch(form: string, ...fields: string[]): FormAction; export declare function unregisterField(form: string, name: string): FormAction; export declare function untouch(form: string, ...fields: string[]): FormAction; -export declare function updateSyncErrors(from: string, syncErrors: FormErrors, error: T): FormAction; -export declare function updateSyncWarnings(form: string, syncWarnings: FormWarnings, warning: T): FormAction; +export declare function updateSyncErrors(from: string, syncErrors: FormErrors, error: T): FormAction; +export declare function updateSyncWarnings(form: string, syncWarnings: FormWarnings, warning: T): FormAction; declare const actions: { arrayInsert: typeof arrayInsert, diff --git a/types/redux-form/redux-form-tests.tsx b/types/redux-form/redux-form-tests.tsx index 8ad71bbc42..2fa2e8efa1 100644 --- a/types/redux-form/redux-form-tests.tsx +++ b/types/redux-form/redux-form-tests.tsx @@ -422,7 +422,11 @@ class FormNameTest extends React.Component { render() { return ( - {({ form }) => Form Name is: {form}} + {({ form, sectionPrefix }) => ( + + Form name is {form} and section prefix is {sectionPrefix} + + )} ); } diff --git a/types/redux-form/tsconfig.json b/types/redux-form/tsconfig.json index ea57d2a38a..a7c3f2ede4 100644 --- a/types/redux-form/tsconfig.json +++ b/types/redux-form/tsconfig.json @@ -29,6 +29,7 @@ "lib/Fields.d.ts", "lib/FieldArray.d.ts", "lib/Form.d.ts", + "lib/FormName.d.ts", "lib/FormSection.d.ts", "lib/formValues.d.ts", "lib/formValueSelector.d.ts", @@ -37,4 +38,4 @@ "lib/selectors.d.ts", "lib/SubmissionError.d.ts" ] -} \ No newline at end of file +} diff --git a/types/redux-form/v7/immutable/index.d.ts b/types/redux-form/v7/immutable/index.d.ts new file mode 100644 index 0000000000..2ce6164232 --- /dev/null +++ b/types/redux-form/v7/immutable/index.d.ts @@ -0,0 +1,30 @@ +export { + Field, + FieldArray, + Fields, + Form, + FormName, + FormSection, + reduxForm, + reducer, + formValueSelector, + getFormAsyncErrors, + getFormInitialValues, + getFormMeta, + getFormNames, + getFormSubmitErrors, + getFormSyncErrors, + getFormSyncWarnings, + getFormValues, + hasSubmitFailed, + hasSubmitSucceeded, + isDirty, + isInvalid, + isPristine, + isSubmitting, + isAsyncValidating, + isValid, + SubmissionError, + startSubmit, + stopSubmit, +} from '../'; diff --git a/types/redux-form/v7/index.d.ts b/types/redux-form/v7/index.d.ts new file mode 100644 index 0000000000..08d077875a --- /dev/null +++ b/types/redux-form/v7/index.d.ts @@ -0,0 +1,62 @@ +// Type definitions for redux-form 7.5 +// Project: https://github.com/erikras/redux-form, https://redux-form.com +// Definitions by: Carson Full +// Daniel Lytkin +// Karol Janyst +// Luka Zakrajsek +// Alex Young +// Anton Novik +// Huw Martin +// Ethan Resnick +// Tim de Koning +// Maddi Joyce +// Kamil Wojcik +// Mohamed Shaaban +// Ethan Setnik +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 +import { + ComponentClass, + StatelessComponent, + ReactElement +} from "react"; + +export type FieldType = "Field" | "FieldArray"; + +export interface ErrorOther { + _error?: T; +} + +export type FormErrors = { + [P in keyof FormData]?: ReactElement | T; +} & ErrorOther; + +export interface WarningOther { + _warning?: T; +} + +export type FormWarnings = { + [P in keyof FormData]?: ReactElement | string | WarningOther; +}; + +export interface RegisteredFieldState { + name: string; + type: FieldType; +} + +export type Omit = Pick; + +export * from "./lib/reduxForm"; +export * from "./lib/Field"; +export * from "./lib/Fields"; +export * from "./lib/FieldArray"; +export * from "./lib/Form"; +export * from "./lib/FormName"; +export * from "./lib/FormSection"; +export * from "./lib/formValues"; +export * from "./lib/formValueSelector"; +export * from "./lib/reducer"; +export * from "./lib/SubmissionError"; +export * from "./lib/actions"; +export * from "./lib/actionTypes"; +export * from "./lib/selectors"; diff --git a/types/redux-form/v7/lib/Field.d.ts b/types/redux-form/v7/lib/Field.d.ts new file mode 100644 index 0000000000..194a322408 --- /dev/null +++ b/types/redux-form/v7/lib/Field.d.ts @@ -0,0 +1,103 @@ +import { + Component, + ComponentType, + ReactElement, + ChangeEvent, + DragEvent, + FocusEvent, + InputHTMLAttributes, + SelectHTMLAttributes, + TextareaHTMLAttributes +} from "react"; +import { Dispatch } from "redux"; + +export type Normalizer = (value: any, previousValue?: any, allValues?: any, previousAllValues?: any) => any; +export type Formatter = (value: any, name: string) => any; +export type Parser = (value: any, name: string) => any; +export type Validator = (value: any, allValues?: any, props?: any, name?: any) => any; + +export type EventHandler = (event: Event, name?: string) => void; +export type EventWithDataHandler = (event?: Event, newValue?: any, previousValue?: any, name?: string) => void; + +export interface EventOrValueHandler extends EventHandler { + (value: any): void; +} + +export interface CommonFieldInputProps { + name: string; + onDragStart: EventHandler>; + onDrop: EventHandler>; + onFocus: EventHandler>; +} + +export interface CommonFieldProps extends CommonFieldInputProps { + onBlur: EventWithDataHandler>; + onChange: EventWithDataHandler>; +} + +export interface BaseFieldProps

extends Partial { + name: string; + component?: ComponentType | "input" | "select" | "textarea"; + format?: Formatter | null; + normalize?: Normalizer; + props?: P; + parse?: Parser; + validate?: Validator | Validator[]; + warn?: Validator | Validator[]; + withRef?: boolean; + immutableProps?: string[]; +} + +export interface GenericField

extends Component & P> { + dirty: boolean; + name: string; + pristine: boolean; + value: any; + getRenderedComponent(): Component; +} + +export type GenericFieldHTMLAttributes = + InputHTMLAttributes | + SelectHTMLAttributes | + TextareaHTMLAttributes; + +export class Field

extends Component

{ + dirty: boolean; + name: string; + pristine: boolean; + value: any; + getRenderedComponent(): Component; +} + +export interface WrappedFieldProps { + input: WrappedFieldInputProps; + meta: WrappedFieldMetaProps; +} + +export interface WrappedFieldInputProps extends CommonFieldInputProps { + checked?: boolean; + value: any; + onBlur: EventOrValueHandler>; + onChange: EventOrValueHandler>; +} + +export interface WrappedFieldMetaProps { + active?: boolean; + autofilled: boolean; + asyncValidating: boolean; + dirty: boolean; + dispatch: Dispatch; + error?: any; + form: string; + initial: any; + invalid: boolean; + pristine: boolean; + submitting: boolean; + submitFailed: boolean; + touched: boolean; + valid: boolean; + visited: boolean; + warning?: any; +} + +export default Field; diff --git a/types/redux-form/v7/lib/FieldArray.d.ts b/types/redux-form/v7/lib/FieldArray.d.ts new file mode 100644 index 0000000000..a4599b5e97 --- /dev/null +++ b/types/redux-form/v7/lib/FieldArray.d.ts @@ -0,0 +1,61 @@ +import { Component, ComponentType } from "react"; +import { Validator } from "../index"; + +export interface BaseFieldArrayProps

{ + name: string; + component: ComponentType

; + validate?: Validator | Validator[]; + warn?: Validator | Validator[]; + withRef?: boolean; + props?: P; + rerenderOnEveryChange?: boolean; +} + +export interface GenericFieldArray extends Component & Partial

> { + name: string; + valid: boolean; + getRenderedComponent(): Component & P>; +} + +export class FieldArray

extends Component & Partial

> implements GenericFieldArray { + name: string; + valid: boolean; + getRenderedComponent(): Component & P>; +} + +export interface WrappedFieldArrayProps { + fields: FieldArrayFieldsProps; + meta: FieldArrayMetaProps; +} + +export type FieldIterate = (name: string, index: number, fields: FieldArrayFieldsProps) => R; + +export interface FieldArrayFieldsProps { + forEach(callback: FieldIterate): void; + get(index: number): FieldValue; + getAll(): FieldValue[]; + removeAll(): void; + insert(index: number, value: FieldValue): void; + name: string; + length: number; + map(callback: FieldIterate): R[]; + pop(): FieldValue; + push(value: FieldValue): void; + remove(index: number): void; + shift(): FieldValue; + swap(indexA: number, indexB: number): void; + move(from: number, to: number): void; + unshift(value: FieldValue): void; +} + +export interface FieldArrayMetaProps { + dirty: boolean; + error?: any; + form: string; + invalid: boolean; + pristine: boolean; + submitFailed: boolean; + submitting: boolean; + valid: boolean; + warning?: any; +} diff --git a/types/redux-form/v7/lib/Fields.d.ts b/types/redux-form/v7/lib/Fields.d.ts new file mode 100644 index 0000000000..f5ec106852 --- /dev/null +++ b/types/redux-form/v7/lib/Fields.d.ts @@ -0,0 +1,31 @@ +import { Component, ComponentType } from "react"; +import { Formatter, Parser, WrappedFieldProps } from "../index"; + +interface BaseFieldsProps

{ + names: string[]; + component?: ComponentType; + format?: Formatter | null; + props?: P; + parse?: Parser; + withRef?: boolean; +} + +export interface GenericFields

extends Component & P> { + dirty: boolean; + names: string[]; + pristine: boolean; + values: { [name: string]: any }; + getRenderedComponent(): Component; +} + +export class Fields

extends Component & P> implements GenericFields

{ + dirty: boolean; + names: string[]; + pristine: boolean; + values: { [name: string]: any }; + getRenderedComponent(): Component; +} + +interface WrappedFieldsProps { + [name: string]: WrappedFieldsProps & WrappedFieldProps; +} diff --git a/types/redux-form/v7/lib/Form.d.ts b/types/redux-form/v7/lib/Form.d.ts new file mode 100644 index 0000000000..0eee944be5 --- /dev/null +++ b/types/redux-form/v7/lib/Form.d.ts @@ -0,0 +1,12 @@ +import { Component, FormHTMLAttributes, FormEvent, FormEventHandler } from "react"; +import { FormProps, FormErrors, FormSubmitHandler, Omit } from "../index"; + +interface FormSubmitProp { + onSubmit?: FormSubmitHandler; +} + +export type FormProps = Omit, "onSubmit"> & FormSubmitProp; + +export class GenericForm extends Component> {} + +export class Form extends Component> implements GenericForm {} diff --git a/types/redux-form/v7/lib/FormName.d.ts b/types/redux-form/v7/lib/FormName.d.ts new file mode 100644 index 0000000000..6cfc6f3708 --- /dev/null +++ b/types/redux-form/v7/lib/FormName.d.ts @@ -0,0 +1,9 @@ +import { ReactNode, StatelessComponent } from "react"; + +export interface FormNameProps { + children: (props: { form: string }) => ReactNode; +} + +export const FormName: StatelessComponent; + +export default FormName; diff --git a/types/redux-form/v7/lib/FormSection.d.ts b/types/redux-form/v7/lib/FormSection.d.ts new file mode 100644 index 0000000000..bed9ba765b --- /dev/null +++ b/types/redux-form/v7/lib/FormSection.d.ts @@ -0,0 +1,10 @@ +import { Component, ComponentType } from "react"; + +export interface FormSectionProps

{ + name: string; + component?: ComponentType

; +} + +export declare class FormSection

extends Component & P> {} + +export default FormSection; diff --git a/types/redux-form/v7/lib/SubmissionError.d.ts b/types/redux-form/v7/lib/SubmissionError.d.ts new file mode 100644 index 0000000000..50695f34d0 --- /dev/null +++ b/types/redux-form/v7/lib/SubmissionError.d.ts @@ -0,0 +1,7 @@ +import { FormErrors } from "../index"; + +export declare class SubmissionError extends Error { + constructor(errors?: FormErrors); +} + +export default SubmissionError; diff --git a/types/redux-form/v7/lib/actionTypes.d.ts b/types/redux-form/v7/lib/actionTypes.d.ts new file mode 100644 index 0000000000..7718ba74ab --- /dev/null +++ b/types/redux-form/v7/lib/actionTypes.d.ts @@ -0,0 +1,39 @@ +export interface ActionTypes { + ARRAY_INSERT: string; + ARRAY_MOVE: string; + ARRAY_POP: string; + ARRAY_PUSH: string; + ARRAY_REMOVE: string; + ARRAY_REMOVE_ALL: string; + ARRAY_SHIFT: string; + ARRAY_SPLICE: string; + ARRAY_UNSHIFT: string; + ARRAY_SWAP: string; + AUTOFILL: string; + BLUR: string; + CHANGE: string; + CLEAR_SUBMIT: string; + CLEAR_SUBMIT_ERRORS: string; + CLEAR_ASYNC_ERROR: string; + CLEAR_FIELDS: string; + DESTROY: string; + FOCUS: string; + INITIALIZE: string; + REGISTER_FIELD: string; + RESET: string; + RESET_SECTION: string; + SET_SUBMIT_FAILED: string; + SET_SUBMIT_SUCCEEDED: string; + START_ASYNC_VALIDATION: string; + START_SUBMIT: string; + STOP_ASYNC_VALIDATION: string; + STOP_SUBMIT: string; + SUBMIT: string; + TOUCH: string; + UNREGISTER_FIELD: string; + UNTOUCH: string; + UPDATE_SYNC_ERRORS: string; + UPDATE_SYNC_WARNINGS: string; +} + +export const actionTypes: ActionTypes; diff --git a/types/redux-form/v7/lib/actions.d.ts b/types/redux-form/v7/lib/actions.d.ts new file mode 100644 index 0000000000..955d3d3f5e --- /dev/null +++ b/types/redux-form/v7/lib/actions.d.ts @@ -0,0 +1,92 @@ +import { Action } from "redux"; +import { FormErrors, FormWarnings, FieldType } from "../index"; + +export interface FormAction extends Action { + meta?: any; + payload?: any; + error?: any; +} + +export declare function arrayInsert(form: string, field: string, index: number, value: any): FormAction; +export declare function arrayMove(form: string, field: string, from: number, to: number): FormAction; +export declare function arrayPop(form: string, field: string): FormAction; +export declare function arrayPush(form: string, field: string, value: any): FormAction; +export declare function arrayRemove(form: string, field: string, index: number): FormAction; +export declare function arrayRemoveAll(form: string, field: string): FormAction; +export declare function arrayShift(form: string, field: string): FormAction; +export declare function arraySplice(form: string, field: string, index: number, removeNum: number, value: any): FormAction; +export declare function arraySwap(form: string, field: string, indexA: number, indexB: number): FormAction; +export declare function arrayUnshift(form: string, field: string, value: any): FormAction; +export declare function autofill(form: string, field: string, value: any): FormAction; +export declare function blur(form: string, field: string, value: any, touch?: boolean): FormAction; +export declare function change(form: string, field: string, value: any, touch?: boolean, persistentSubmitErrors?: boolean): FormAction; +export declare function destroy(...form: string[]): FormAction; +export declare function focus(form: string, field: string): FormAction; + +export interface InitializeOptions { + keepDirty: boolean; + keepSubmitSucceeded: boolean; + updateUnregisteredFields: boolean; + keepValues: boolean; +} + +export declare function initialize(form: string, data: any, keepDirty?: boolean, options?: Partial): FormAction; +export declare function initialize(form: string, data: any, options?: Partial): FormAction; +export declare function registerField(form: string, name: string, type: FieldType): FormAction; +export declare function reset(form: string): FormAction; +export declare function resetSection(form: string, ...sections: string[]): FormAction; +export declare function startAsyncValidation(form: string): FormAction; +export declare function stopAsyncValidation(form: string, errors?: FormErrors): FormAction; +export declare function setSubmitFailed(form: string, ...fields: string[]): FormAction; +export declare function setSubmitSucceeded(form: string, ...fields: string[]): FormAction; +export declare function startSubmit(form: string): FormAction; +export declare function stopSubmit(form: string, errors?: FormErrors): FormAction; +export declare function submit(form: string): FormAction; +export declare function clearSubmit(form: string): FormAction; +export declare function clearSubmitErrors(form: string): FormAction; +export declare function clearAsyncError(form: string, field: string): FormAction; +export declare function clearFields(form: string, keepTouched: boolean, persistentSubmitErrors: boolean, ...fields: string[]): FormAction; +export declare function touch(form: string, ...fields: string[]): FormAction; +export declare function unregisterField(form: string, name: string): FormAction; +export declare function untouch(form: string, ...fields: string[]): FormAction; +export declare function updateSyncErrors(from: string, syncErrors: FormErrors, error: T): FormAction; +export declare function updateSyncWarnings(form: string, syncWarnings: FormWarnings, warning: T): FormAction; + +declare const actions: { + arrayInsert: typeof arrayInsert, + arrayMove: typeof arrayMove, + arrayPop: typeof arrayPop, + arrayPush: typeof arrayPush, + arrayRemove: typeof arrayRemove, + arrayRemoveAll: typeof arrayRemoveAll, + arrayShift: typeof arrayShift, + arraySplice: typeof arraySplice, + arraySwap: typeof arraySwap, + arrayUnshift: typeof arrayUnshift, + autofill: typeof autofill, + blur: typeof blur, + change: typeof change, + clearSubmit: typeof clearSubmit, + clearSubmitErrors: typeof clearSubmitErrors, + clearAsyncError: typeof clearAsyncError, + clearFields: typeof clearFields, + destroy: typeof destroy, + focus: typeof focus, + initialize: typeof initialize, + registerField: typeof registerField, + reset: typeof reset, + startAsyncValidation: typeof startAsyncValidation, + startSubmit: typeof startSubmit, + stopAsyncValidation: typeof stopAsyncValidation, + stopSubmit: typeof stopSubmit, + submit: typeof submit, + setSubmitFailed: typeof setSubmitFailed, + setSubmitSucceeded: typeof setSubmitSucceeded, + touch: typeof touch, + unregisterField: typeof unregisterField, + untouch: typeof untouch, + updateSyncErrors: typeof updateSyncErrors, + updateSyncWarnings: typeof updateSyncWarnings +}; + +export default actions; diff --git a/types/redux-form/v7/lib/formValueSelector.d.ts b/types/redux-form/v7/lib/formValueSelector.d.ts new file mode 100644 index 0000000000..e13ffd3c5d --- /dev/null +++ b/types/redux-form/v7/lib/formValueSelector.d.ts @@ -0,0 +1,8 @@ +import { FormStateMap } from "../index"; + +export function formValueSelector( + form: string, + getFormState?: (state: State) => FormStateMap +): (state: State, ...field: string[]) => any; + +export default formValueSelector; diff --git a/types/redux-form/v7/lib/formValues.d.ts b/types/redux-form/v7/lib/formValues.d.ts new file mode 100644 index 0000000000..1052f8533e --- /dev/null +++ b/types/redux-form/v7/lib/formValues.d.ts @@ -0,0 +1,13 @@ +import { ComponentClass, ComponentType } from "react"; +import { InjectedFormProps } from "../index"; + +export function formValues< + Values, + P = {} +>(obj: Values): (component: ComponentType

) => ComponentClass

; + +export function formValues< + FormData = {}, + K extends keyof FormData = keyof FormData, + P = {} +>(...names: K[]): (component: ComponentType

>) => ComponentClass

>; diff --git a/types/redux-form/v7/lib/reducer.d.ts b/types/redux-form/v7/lib/reducer.d.ts new file mode 100644 index 0000000000..f2ee374cf2 --- /dev/null +++ b/types/redux-form/v7/lib/reducer.d.ts @@ -0,0 +1,42 @@ +import { Reducer } from "redux"; +import { FieldType } from "../index"; + +export interface FormReducer extends Reducer { + plugin(reducers: FormReducerMapObject): Reducer; +} + +export const reducer: FormReducer; + +export interface FormReducerMapObject { + // and `` to make it compatible with redux@3 + // tslint:disable-next-line use-default-type-parameter + [formName: string]: Reducer; +} + +export interface FormStateMap { + [formName: string]: FormState; +} + +export interface FormState { + registeredFields: RegisteredFieldState[]; + fields?: {[name: string]: FieldState}; + values?: { [fieldName: string]: any }; + active?: string; + anyTouched?: boolean; + submitting?: boolean; + submitErrors?: { [fieldName: string]: string }; + submitFailed?: boolean; +} + +export interface RegisteredFieldState { + name: string; + type: FieldType; +} + +export interface FieldState { + active?: boolean; + touched?: boolean; + visited?: boolean; +} + +export default reducer; diff --git a/types/redux-form/v7/lib/reduxForm.d.ts b/types/redux-form/v7/lib/reduxForm.d.ts new file mode 100644 index 0000000000..e37214f5d0 --- /dev/null +++ b/types/redux-form/v7/lib/reduxForm.d.ts @@ -0,0 +1,164 @@ +import { + Component, + ComponentClass, + ComponentType, + ReactElement, + SyntheticEvent, + StatelessComponent, + FormEventHandler +} from "react"; +import { Dispatch } from "redux"; +import { + FormErrors, + ErrorOther, + FormWarnings, + WarningOther, + RegisteredFieldState, + FormStateMap +} from "../index"; + +export type FormSubmitHandler = + (values: FormData, dispatch: Dispatch, props: P) => void | FormErrors | Promise; + +export type GetFormState = (state: any) => FormStateMap; +export interface SubmitHandler { + ( + submit: FormSubmitHandler, + props?: InjectedFormProps, + valid?: boolean, + asyncValidate?: any, + fields?: string[] + ): any; + (event: SyntheticEvent): void; +} + +export interface ValidateCallback { + values: FormData; + nextProps: P & InjectedFormProps; + props: P & InjectedFormProps; + initialRender: boolean; + structure: any; +} + +export interface AsyncValidateCallback { + asyncErrors?: FormErrors; + initialized: boolean; + trigger: "blur" | "submit"; + blurredField?: string; + pristine: boolean; + syncValidationPasses: boolean; +} + +export interface InjectedArrayProps { + insert(field: string, index: number, value: any): void; + move(field: string, from: number, to: number): void; + pop(field: string): void; + push(field: string, value: any): void; + remove(field: string, index: number): void; + removeAll(field: string): void; + shift(field: string): void; + splice(field: string, index: number, removeNum: number, value: any): void; + swap(field: string, indexA: number, indexB: number): void; + unshift(field: string, value: any): void; +} + +export interface RegisteredField { + count: number; + name: string; + type: "Field" | "FieldArray"; +} + +export interface InjectedFormProps { + anyTouched: boolean; + array: InjectedArrayProps; + asyncValidate(): void; + asyncValidating: string | boolean; + autofill(field: string, value: any): void; + blur(field: string, value: any): void; + change(field: string, value: any): void; + clearAsyncError(field: string): void; + destroy(): void; + dirty: boolean; + error: ErrorType; + form: string; + handleSubmit: SubmitHandler; + initialize(data: Partial): void; + initialized: boolean; + initialValues: Partial; + invalid: boolean; + pristine: boolean; + reset(): void; + submitFailed: boolean; + submitSucceeded: boolean; + submitting: boolean; + touch(...field: string[]): void; + untouch(...field: string[]): void; + valid: boolean; + warning: any; + registeredFields: { [name: string]: RegisteredField }; +} + +export interface ConfigProps { + form: string; + asyncBlurFields?: string[]; + asyncChangeFields?: string[]; + asyncValidate?(values: FormData, dispatch: Dispatch, props: P & InjectedFormProps, blurredField: string): Promise; + destroyOnUnmount?: boolean; + enableReinitialize?: boolean; + forceUnregisterOnUnmount?: boolean; + getFormState?: GetFormState; + immutableProps?: string[]; + initialValues?: Partial; + keepDirtyOnReinitialize?: boolean; + updateUnregisteredFields?: boolean; + onChange?(values: Partial, dispatch: Dispatch, props: P & InjectedFormProps, previousValues: Partial): void; + onSubmit?: FormSubmitHandler, ErrorType> | SubmitHandler, ErrorType>; + onSubmitFail?( + errors: FormErrors | undefined, + dispatch: Dispatch, + submitError: any, + props: P & InjectedFormProps + ): void; + onSubmitSuccess?(result: any, dispatch: Dispatch, props: P & InjectedFormProps): void; + propNamespace?: string; + pure?: boolean; + shouldValidate?(params: ValidateCallback): boolean; + shouldError?(params: ValidateCallback): boolean; + shouldWarn?(params: ValidateCallback): boolean; + shouldAsyncValidate?(params: AsyncValidateCallback): boolean; + touchOnBlur?: boolean; + touchOnChange?: boolean; + persistentSubmitErrors?: boolean; + validate?(values: FormData, props: P & InjectedFormProps): FormErrors; + warn?(values: FormData, props: P & InjectedFormProps): FormWarnings; +} + +export interface FormInstance extends Component

{ + dirty: boolean; + invalid: boolean; + pristine: boolean; + registeredFields: RegisteredFieldState[]; + reset(): void; + resetSection(...sections: string[]): void; + submit(): Promise; + valid: boolean; + values: Partial; + wrappedInstance: ReactElement

>; +} + +export interface DecoratedComponentClass { + new(props?: P, context?: any): FormInstance; +} + +export type FormDecorator = + (component: ComponentType

>) => DecoratedComponentClass; + +export declare function reduxForm( + config: ConfigProps +): FormDecorator>, ErrorType>; + +export declare function reduxForm( + config: Partial> +): FormDecorator, ErrorType>; + +export default reduxForm; diff --git a/types/redux-form/v7/lib/selectors.d.ts b/types/redux-form/v7/lib/selectors.d.ts new file mode 100644 index 0000000000..c97d99859b --- /dev/null +++ b/types/redux-form/v7/lib/selectors.d.ts @@ -0,0 +1,25 @@ +import { FormErrors, GetFormState } from "../index"; + +export type DataSelector = (formName: string, getFormState?: GetFormState) => (state: State) => FormData; +export type ErrorSelector = (formName: string, getFormState?: GetFormState) => (state: State) => FormErrors; +export type BooleanSelector = (formName: string, getFormState?: GetFormState) => (state: State) => boolean; +export type NamesSelector = (getFormState?: GetFormState) => (state: State) => string[]; +export type FormOrFieldsBooleanSelector = (formName: string, getFormState?: GetFormState) => (state: State, ...fields: string[]) => boolean; + +export const getFormValues: DataSelector; +export const getFormInitialValues: DataSelector; +export const getFormSyncErrors: ErrorSelector; +export const getFormMeta: DataSelector; +export const getFormAsyncErrors: ErrorSelector; +export const getFormSyncWarnings: ErrorSelector; +export const getFormSubmitErrors: ErrorSelector; +export const getFormError: ErrorSelector; +export const getFormNames: NamesSelector; +export const isDirty: FormOrFieldsBooleanSelector; +export const isPristine: FormOrFieldsBooleanSelector; +export const isValid: BooleanSelector; +export const isInvalid: BooleanSelector; +export const isSubmitting: BooleanSelector; +export const isAsyncValidating: BooleanSelector; +export const hasSubmitSucceeded: BooleanSelector; +export const hasSubmitFailed: BooleanSelector; diff --git a/types/redux-form/v7/package.json b/types/redux-form/v7/package.json new file mode 100644 index 0000000000..998f8e9b38 --- /dev/null +++ b/types/redux-form/v7/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "redux": "^3.6.0 || ^4.0.0" + } +} diff --git a/types/redux-form/v7/redux-form-tests.tsx b/types/redux-form/v7/redux-form-tests.tsx new file mode 100644 index 0000000000..8ad71bbc42 --- /dev/null +++ b/types/redux-form/v7/redux-form-tests.tsx @@ -0,0 +1,464 @@ +import * as React from 'react'; +import { Action, Dispatch } from "redux"; +import { + reduxForm, + InjectedFormProps, + Form, + FormName, + GenericForm, + FormSection, + formValues, + formValueSelector, + Field, + GenericField, + WrappedFieldProps, + Fields, + GenericFields, + WrappedFieldsProps, + FieldArray, + GenericFieldArray, + WrappedFieldArrayProps, + BaseFieldProps, + reducer, + FormAction, + actionTypes, + submit, + SubmissionError, + FieldArrayFieldsProps +} from "redux-form"; + +import { + Field as ImmutableField, + reduxForm as immutableReduxForm, + startSubmit as immutableStartSubmit, + stopSubmit as immutableStopSubmit +} from "redux-form/immutable"; + +import LibField, { + WrappedFieldProps as LibWrappedFieldProps +} from "redux-form/lib/Field"; +import libReducer from "redux-form/lib/reducer"; +import LibFormSection from "redux-form/lib/FormSection"; +import libFormValueSelector from "redux-form/lib/formValueSelector"; +import libReduxForm from "redux-form/lib/reduxForm"; +import libActions from "redux-form/lib/actions"; +import LibSubmissionError from "redux-form/lib/SubmissionError"; + +/* Decorated components */ +interface TestFormData { + foo: string; +} + +/* Some tests only make sense with multiple values */ +interface MultivalueFormData { + foo: string; + bar?: string; + fizz: string; +} + +interface TestFormComponentProps { + baz: string; +} + +type InjectedProps = InjectedFormProps; + +class TestFormComponent extends React.Component { + render() { + const { form, initialValues, error } = this.props; + const foo = initialValues.foo; + const errorIsString = error + 'test'; + return null; + } +} + +const TestFormRequired = reduxForm({})(TestFormComponent); +const TestForm = reduxForm({ form : "test" })(TestFormComponent); +const TestFormImmRequired = immutableReduxForm({})(TestFormComponent); +const TestFormImm = immutableReduxForm({ form : "test" })(TestFormComponent); + +const TestFormStatelessComponent: React.StatelessComponent = ({ form, initialValues }) => { + const foo = initialValues.foo; + return null; +}; + +const TestFormStatelessRequired = reduxForm({})(TestFormStatelessComponent); +const TestFormStateless = reduxForm({ form : "test" })(TestFormStatelessComponent); + +/* formValues decorator */ + +const ItemList = formValues("foo")( + ({ foo }) => { + return null; + } +); + +const ItemListObj = formValues({ fooBar : "foo" })( + ({ fooBar }) => { + return null; + } +); + +/* Custom FormSection */ + +interface MyFormSectionProps { + foo: string; +} + +const MyFormSection: React.StatelessComponent = ({ children, foo }) => null; + +/* Custom Field */ + +interface MyFieldCustomProps { + foo: string; +} +type MyFieldProps = MyFieldCustomProps & WrappedFieldProps; +const MyField: React.StatelessComponent = ({ + children, + input, + meta, + foo +}) => { + input.onBlur("value"); + input.onBlur({} as React.SyntheticEvent); + + input.onChange("value"); + input.onChange({} as React.SyntheticEvent); + + input.onDragStart({} as React.DragEvent); + + input.onDrop({} as React.DragEvent); + + input.onFocus({} as React.FocusEvent); + return null; +}; +const FieldCustom = Field as new () => GenericField; + +type FieldProps = BaseFieldProps & MyFieldCustomProps; +const FieldCustomComp: React.StatelessComponent = props => ( + +); + +const MyFieldImm: React.StatelessComponent = ({ + children, + input, + meta, + foo +}) => null; +const FieldImmutableCustom = ImmutableField as new () => GenericField; + +/* Custom Fields */ + +interface MyFieldsCustomProps { + foo: string; +} +type MyFieldsProps = MyFieldsCustomProps & WrappedFieldsProps; +const MyFields: React.StatelessComponent = ({ + children, + foo +}) => null; +const FieldsCustom = Fields as new () => GenericFields; + +/* FieldArray */ + +const MyArrayField: React.StatelessComponent = ({ + children +}) => null; + +/* Custom FieldArray */ + +interface MyFieldValue { + num: number; +} +interface MyFieldArrayCustomProps { + foo: string; +} + +const MyCustomArrayField: React.StatelessComponent = ({ + children, + foo +}) => null; + +type MyFieldArrayProps = MyFieldArrayCustomProps & WrappedFieldArrayProps; +const MyFieldArray: React.StatelessComponent = ({ + children, + fields +}) => null; +const FieldArrayCustom = FieldArray as new () => GenericFieldArray; + +/* Tests */ +const TestForms: React.StatelessComponent = () => { + return ( +

+ + + + + + + + +
+ ); +}; + +// Specifying form data type is not required here, but is recommended to avoid confusion +const testFormWithValidationDecorator = reduxForm({ + form: "testWithValidation", + validate: (values, props) => { + return { + foo: "Bad foo" + }; + } +}); + +// Specifying form data type is not required here, but is recommended to avoid confusion +const testFormWithInitialValuesDecorator = reduxForm({ + form: "testWithValidation", + initialValues: { + foo: "A Foo is here" + } +}); + +// Specifying form data type *is* required here, because type inference will guess the type of +// the form data type parameter to be {foo: string}. The result of validate does not contain "foo" +const testFormWithInitialValuesAndValidationDecorator = reduxForm({ + form: "testWithValidation", + initialValues: { + foo: "A Foo is here" + }, + validate: (values, props) => { + return { + bar: "Bad foo" + }; + } +}); + +const testFormWithChangeFunctionDecorator = reduxForm({ + form: "testWithValidation", + onChange: (values: Partial, + dispatch: Dispatch, + props: TestFormComponentProps & InjectedFormProps, + previousValues: Partial) => {} +}); + +type TestProps = {} & InjectedFormProps; +const Test = reduxForm({ + form : "test" +})( + class Test extends React.Component { + handleSubmitForm = (values: Partial, dispatch: Dispatch, props: {}) => {}; + + render() { + const { handleSubmit } = this.props; + const FormCustom = Form as new () => GenericForm; + + return ( +
+ + + name="my-section" + component={MyFormSection} + foo="hello" + /> + + + + + + + + + {}} + onBlur={(event, newValue, previousValue, fieldName) => {}} + /> + + + + + + + + + + + + null } + /> + + null } + foo="bar" + /> + + + name="field9" + component={ MyArrayField } + /> + + + + +
+ ); + } + } +); + +reducer({}, { + type: "ACTION" +}); + +reducer.plugin({ + myForm: (state: any, action: FormAction) => { + if (action.type === actionTypes.CHANGE && action.meta.form === "securitySettings") { + return { + ...state, + values: { + ...state.values, + downloadLinkAutoPassword: true, + }, + }; + } else { + return state; + } + } +}); + +try { + throw new SubmissionError({_error: "Submission failed."}); +} catch (error) { + if (!(error instanceof SubmissionError)) { + throw new Error("SubmissionError not imported correctly"); + } +} + +/* Test using versions imported directly/as defaults from lib */ +const DefaultField = ( + +); + +libReducer({}, { + type: "ACTION" +}); + +const DefaultFormSection = ( + +); + +const TestLibFormRequired = libReduxForm({})(TestFormComponent); +const TestLibForm = libReduxForm({ form : "test" })(TestFormComponent); + +const testSubmit = submit("test"); +const testLibSubmit = libActions.submit("test"); + +try { + throw new LibSubmissionError({_error: "Submission failed."}); +} catch (error) { + if (!(error instanceof LibSubmissionError)) { + throw new Error("SubmissionError from lib not imported correctly"); + } +} + +/* Test handleSubmit prop using as onSubmit handler */ +type HandleSubmitTestProps = {} & InjectedFormProps; +const HandleSubmitTestForm = reduxForm({ + form : "test" +})( + (props: HandleSubmitTestProps) =>
+); + +class HandleSubmitTest extends React.Component { + handleSubmit = (values: Partial, dispatch: Dispatch, props: {}) => {}; + render() { + return ; + } +} + +class FormNameTest extends React.Component { + render() { + return ( + + {({ form }) => Form Name is: {form}} + + ); + } +} + +// Test SubmissionError with custom error format +// See https://github.com/DefinitelyTyped/DefinitelyTyped/pull/26494 +// Note: explicit parameters not needed in TS 2.7 +new LibSubmissionError<{ myField: any }, string[]>({ + _error: ["First form-level error", "Second form-level error"], + myField: ["Field-level error"] +}); + +new SubmissionError({ + _error: ["First form-level error", "Second form-level error"] +}); + +// Test forms with custom error format. +const HandleSubmitTestForm2 = reduxForm({ form : "test" })( + (props: InjectedFormProps) => +); + +class HandleSubmitTest2 extends React.Component { + handleSubmit = (values: Partial, dispatch: Dispatch, props: {}) => {}; + render() { + return ; + } +} + +type InjectedProps2 = InjectedFormProps; +class TestFormComponent2 extends React.Component { + render() { + const { error, initialValues, handleSubmit } = this.props; + error.concat(['error is a string array']); + + handleSubmit((values) => ({ foo: ['string'], _error: [] })); + return null; + } +} diff --git a/types/redux-form/v7/tsconfig.json b/types/redux-form/v7/tsconfig.json new file mode 100644 index 0000000000..19b1709823 --- /dev/null +++ b/types/redux-form/v7/tsconfig.json @@ -0,0 +1,48 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6", + "dom" + ], + "experimentalDecorators": true, + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../../", + "jsx": "react", + "typeRoots": [ + "../../" + ], + "types": [], + "paths": { + "redux-form": [ + "redux-form/v7" + ], + "redux-form/*": [ + "redux-form/v7/*" + ] + }, + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "redux-form-tests.tsx", + "immutable/index.d.ts", + "lib/actions.d.ts", + "lib/actionTypes.d.ts", + "lib/Field.d.ts", + "lib/Fields.d.ts", + "lib/FieldArray.d.ts", + "lib/Form.d.ts", + "lib/FormSection.d.ts", + "lib/formValues.d.ts", + "lib/formValueSelector.d.ts", + "lib/reducer.d.ts", + "lib/reduxForm.d.ts", + "lib/selectors.d.ts", + "lib/SubmissionError.d.ts" + ] +} diff --git a/types/tabris-plugin-firebase/tslint.json b/types/redux-form/v7/tslint.json similarity index 67% rename from types/tabris-plugin-firebase/tslint.json rename to types/redux-form/v7/tslint.json index 4c4fc86ace..f3568a0139 100644 --- a/types/tabris-plugin-firebase/tslint.json +++ b/types/redux-form/v7/tslint.json @@ -1,6 +1,7 @@ { "extends": "dtslint/dt.json", "rules": { + "no-object-literal-type-assertion": false, "strict-export-declare-modifiers": false } } diff --git a/types/redux-immutable/tslint.json b/types/redux-immutable/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-immutable/tslint.json +++ b/types/redux-immutable/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-mock-store/tslint.json b/types/redux-mock-store/tslint.json index 3337f86cdc..9b99cce699 100644 --- a/types/redux-mock-store/tslint.json +++ b/types/redux-mock-store/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODO "dt-header": false, + "npm-naming": false, "no-unnecessary-generics": false } } \ No newline at end of file diff --git a/types/redux-optimistic-ui/tslint.json b/types/redux-optimistic-ui/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-optimistic-ui/tslint.json +++ b/types/redux-optimistic-ui/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-promise-middleware/tslint.json b/types/redux-promise-middleware/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-promise-middleware/tslint.json +++ b/types/redux-promise-middleware/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-promise/tslint.json b/types/redux-promise/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-promise/tslint.json +++ b/types/redux-promise/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-recycle/tslint.json b/types/redux-recycle/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-recycle/tslint.json +++ b/types/redux-recycle/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-router/tslint.json b/types/redux-router/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-router/tslint.json +++ b/types/redux-router/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/redux-seamless-immutable/index.d.ts b/types/redux-seamless-immutable/index.d.ts new file mode 100644 index 0000000000..63cd632676 --- /dev/null +++ b/types/redux-seamless-immutable/index.d.ts @@ -0,0 +1,16 @@ +// Type definitions for redux-seamless-immutable 0.4 +// Project: https://github.com/eadmundo/redux-seamless-immutable +// Definitions by: Leandro Soares +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.3 + +import { Reducer, Action } from "redux"; +import { Immutable } from "seamless-immutable"; + +export interface SeamlessReducers { + [reducerName: string]: Reducer; +} + +export function combineReducers(reducers: SeamlessReducers): Reducer; +export function routerReducer(state: T, action: Action): T; +export function stateTransformer(state: Immutable): T; diff --git a/types/redux-seamless-immutable/package.json b/types/redux-seamless-immutable/package.json new file mode 100644 index 0000000000..457ab3d31e --- /dev/null +++ b/types/redux-seamless-immutable/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "redux": "^4.0.1" + } +} \ No newline at end of file diff --git a/types/redux-seamless-immutable/redux-seamless-immutable-tests.ts b/types/redux-seamless-immutable/redux-seamless-immutable-tests.ts new file mode 100644 index 0000000000..cde40cd261 --- /dev/null +++ b/types/redux-seamless-immutable/redux-seamless-immutable-tests.ts @@ -0,0 +1,42 @@ +import { combineReducers, routerReducer, stateTransformer } from "redux-seamless-immutable"; +import { createStore, applyMiddleware, Action } from "redux"; +import { createLogger } from "redux-logger"; + +interface State { + prop1: boolean; + prop2: string; +} + +type GenericActionPayload = Action & { + payload: string; +}; + +function reducer1(state: State, action: GenericActionPayload): State { + const payload = action.payload; + return state; +} + +function reducer2(state: State, action: GenericActionPayload): State { + const payload = action.payload; + return state; +} + +// Test `combineReducers` and `routerReducer` +const combined = combineReducers({ + reducer1, + reducer2, + routerReducer +}); + +// Test `stateTransformer` +const loggerMiddleware = createLogger({ + stateTransformer +}); + +// Test integration with `createStore` +const store = createStore( + combined, + applyMiddleware( + loggerMiddleware + ) +); diff --git a/types/cp-file/tsconfig.json b/types/redux-seamless-immutable/tsconfig.json similarity index 91% rename from types/cp-file/tsconfig.json rename to types/redux-seamless-immutable/tsconfig.json index 12138d0002..c5cea671f6 100644 --- a/types/cp-file/tsconfig.json +++ b/types/redux-seamless-immutable/tsconfig.json @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "cp-file-tests.ts" + "redux-seamless-immutable-tests.ts" ] } \ No newline at end of file diff --git a/types/redux-seamless-immutable/tslint.json b/types/redux-seamless-immutable/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/redux-seamless-immutable/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/redux-sentry-middleware/index.d.ts b/types/redux-sentry-middleware/index.d.ts index 5713391dd3..5b57ae5bbb 100644 --- a/types/redux-sentry-middleware/index.d.ts +++ b/types/redux-sentry-middleware/index.d.ts @@ -7,15 +7,18 @@ import { Action, Middleware } from "redux"; import * as Sentry from "@sentry/browser"; -export interface SentryMiddlewareOptions { - breadcrumbDataFromAction?: (action: Action) => any; - actionTransformer?: (action: Action) => Action; - stateTransformer?: (state: T) => T; - breadcrumbCategory?: string; - filterBreadcrumbActions?: (action: Action) => boolean; - getUserContext?: (state: T) => Sentry.User; - getTags?: (state: T) => Sentry.SentryEvent['tags']; +declare namespace createSentryMiddleware { + interface Options { + breadcrumbDataFromAction?: (action: Action) => any; + actionTransformer?: (action: Action) => Action; + stateTransformer?: (state: T) => T; + breadcrumbCategory?: string; + filterBreadcrumbActions?: (action: Action) => boolean; + getUserContext?: (state: T) => Sentry.User; + getTags?: (state: T) => Sentry.SentryEvent['tags']; + } } // tslint:disable-next-line: no-unnecessary-generics -export default function createSentryMiddleware(sentry: typeof Sentry, options?: SentryMiddlewareOptions): Middleware; +declare function createSentryMiddleware(sentry: typeof Sentry, options?: createSentryMiddleware.Options): Middleware; +export = createSentryMiddleware; diff --git a/types/redux-sentry-middleware/redux-sentry-middleware-tests.ts b/types/redux-sentry-middleware/redux-sentry-middleware-tests.ts index b72fb01b7f..f888029467 100644 --- a/types/redux-sentry-middleware/redux-sentry-middleware-tests.ts +++ b/types/redux-sentry-middleware/redux-sentry-middleware-tests.ts @@ -1,5 +1,5 @@ import * as Sentry from "@sentry/browser"; -import createSentryMiddleware from "redux-sentry-middleware"; +import createSentryMiddleware = require("redux-sentry-middleware"); import { applyMiddleware, createStore } from "redux"; const middleware = createSentryMiddleware(Sentry); diff --git a/types/redux-shortcuts/index.d.ts b/types/redux-shortcuts/index.d.ts index 6b3ab667fb..7b1752e486 100644 --- a/types/redux-shortcuts/index.d.ts +++ b/types/redux-shortcuts/index.d.ts @@ -7,7 +7,7 @@ import { ActionCreator, Action, Dispatch } from "redux"; import Mousetrap = require('mousetrap'); -export {Mousetrap}; +export { Mousetrap }; export const mousetrap: MousetrapInstance; export function bindShortcut( diff --git a/types/redux-storage-engine-jsurl/index.d.ts b/types/redux-storage-engine-jsurl/index.d.ts index c5c0dbe4c5..f3b4254e07 100644 --- a/types/redux-storage-engine-jsurl/index.d.ts +++ b/types/redux-storage-engine-jsurl/index.d.ts @@ -5,4 +5,5 @@ import { StorageEngine } from 'redux-storage'; -export default function createEngine(): StorageEngine; +export = createEngine; +declare function createEngine(): StorageEngine; diff --git a/types/redux-storage-engine-jsurl/redux-storage-engine-jsurl-tests.ts b/types/redux-storage-engine-jsurl/redux-storage-engine-jsurl-tests.ts index 6bddc3518d..3e23a4e73e 100644 --- a/types/redux-storage-engine-jsurl/redux-storage-engine-jsurl-tests.ts +++ b/types/redux-storage-engine-jsurl/redux-storage-engine-jsurl-tests.ts @@ -1,5 +1,5 @@ import { createLoader } from "redux-storage"; -import createUrlEngine from "redux-storage-engine-jsurl"; +import createUrlEngine = require("redux-storage-engine-jsurl"); const urlStorageEngine = createUrlEngine(); diff --git a/types/redux-storage/tslint.json b/types/redux-storage/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/redux-storage/tslint.json +++ b/types/redux-storage/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref-array-di/tslint.json b/types/ref-array-di/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref-array-di/tslint.json +++ b/types/ref-array-di/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref-array/tslint.json b/types/ref-array/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref-array/tslint.json +++ b/types/ref-array/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref-napi/tslint.json b/types/ref-napi/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref-napi/tslint.json +++ b/types/ref-napi/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref-struct-di/tslint.json b/types/ref-struct-di/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref-struct-di/tslint.json +++ b/types/ref-struct-di/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref-struct/tslint.json b/types/ref-struct/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref-struct/tslint.json +++ b/types/ref-struct/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref-union-di/tslint.json b/types/ref-union-di/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref-union-di/tslint.json +++ b/types/ref-union-di/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref-union/tslint.json b/types/ref-union/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref-union/tslint.json +++ b/types/ref-union/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/ref/tslint.json b/types/ref/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/ref/tslint.json +++ b/types/ref/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/relateurl/tslint.json b/types/relateurl/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/relateurl/tslint.json +++ b/types/relateurl/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/remarkable/lib/index.d.ts b/types/remarkable/lib/index.d.ts index 48e3aa6772..c2c9b13511 100644 --- a/types/remarkable/lib/index.d.ts +++ b/types/remarkable/lib/index.d.ts @@ -104,6 +104,11 @@ declare namespace Remarkable { */ linkify?: boolean; + /** + * Set target to open link in + */ + linkTarget?: string; + /** * Enable some language-neutral replacement + quotes beautification. */ diff --git a/types/remarkable/remarkable-tests.ts b/types/remarkable/remarkable-tests.ts index 9c12632e69..c908af5f2a 100644 --- a/types/remarkable/remarkable-tests.ts +++ b/types/remarkable/remarkable-tests.ts @@ -19,6 +19,7 @@ export class RemarkableTest { breaks: false, langPrefix: "language-", linkify: false, + linkTarget: "_blank", typographer: false, quotes: "“”‘’", highlight(/*str, lang*/) { return ""; }, diff --git a/types/repeat-element/index.d.ts b/types/repeat-element/index.d.ts new file mode 100644 index 0000000000..2c3cd5d633 --- /dev/null +++ b/types/repeat-element/index.d.ts @@ -0,0 +1,12 @@ +// Type definitions for repeat-element 1.1 +// Project: https://github.com/jonschlinkert/repeat-element +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/** + * Create an array by repeating the given value n times. + */ +declare function repeat(element: unknown, num: number): unknown[]; + +export = repeat; diff --git a/types/repeat-element/repeat-element-tests.ts b/types/repeat-element/repeat-element-tests.ts new file mode 100644 index 0000000000..b76b7b4b7e --- /dev/null +++ b/types/repeat-element/repeat-element-tests.ts @@ -0,0 +1,9 @@ +import repeat = require("repeat-element"); + +repeat(5, 5); + +repeat({some: 'object'}, 5); + +repeat('a', 5); + +repeat(null, 5); diff --git a/types/repeat-element/tsconfig.json b/types/repeat-element/tsconfig.json new file mode 100644 index 0000000000..6e7674eafd --- /dev/null +++ b/types/repeat-element/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "repeat-element-tests.ts" + ] +} diff --git a/types/repeat-element/tslint.json b/types/repeat-element/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/repeat-element/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/repeat-string/index.d.ts b/types/repeat-string/index.d.ts new file mode 100644 index 0000000000..5664484e22 --- /dev/null +++ b/types/repeat-string/index.d.ts @@ -0,0 +1,11 @@ +// Type definitions for repeat-string 1.6 +// Project: https://github.com/jonschlinkert/repeat-string +// Definitions by: Adam Zerella +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +/** + * Repeat the given `string` the specified `number` of times. + */ +declare function repeat(str: string, num: number): string; + +export = repeat; diff --git a/types/repeat-string/repeat-string-tests.ts b/types/repeat-string/repeat-string-tests.ts new file mode 100644 index 0000000000..c2692d7569 --- /dev/null +++ b/types/repeat-string/repeat-string-tests.ts @@ -0,0 +1,3 @@ +import Repeat = require("repeat-string"); + +Repeat('A', 5); diff --git a/types/repeat-string/tsconfig.json b/types/repeat-string/tsconfig.json new file mode 100644 index 0000000000..a56114d84f --- /dev/null +++ b/types/repeat-string/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "strictFunctionTypes": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [ + + ], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "repeat-string-tests.ts" + ] +} diff --git a/types/repeat-string/tslint.json b/types/repeat-string/tslint.json new file mode 100644 index 0000000000..e60c15844f --- /dev/null +++ b/types/repeat-string/tslint.json @@ -0,0 +1,3 @@ +{ + "extends": "dtslint/dt.json" +} \ No newline at end of file diff --git a/types/replace-ext/tslint.json b/types/replace-ext/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/replace-ext/tslint.json +++ b/types/replace-ext/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/request-ip/tslint.json b/types/request-ip/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/request-ip/tslint.json +++ b/types/request-ip/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/require-directory/index.d.ts b/types/require-directory/index.d.ts index bd2b520865..5d45f66f00 100644 --- a/types/require-directory/index.d.ts +++ b/types/require-directory/index.d.ts @@ -1,6 +1,6 @@ // Type definitions for require-directory 2.1 // Project: https://github.com/troygoode/node-require-directory/ -// Definitions by: My Self +// Definitions by: Ihor Chulinda // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.4 /// diff --git a/types/requirejs-domready/tslint.json b/types/requirejs-domready/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/requirejs-domready/tslint.json +++ b/types/requirejs-domready/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/requirejs/tslint.json b/types/requirejs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/requirejs/tslint.json +++ b/types/requirejs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/resemblejs/tslint.json b/types/resemblejs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/resemblejs/tslint.json +++ b/types/resemblejs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/reserved-words/index.d.ts b/types/reserved-words/index.d.ts new file mode 100644 index 0000000000..b01b539324 --- /dev/null +++ b/types/reserved-words/index.d.ts @@ -0,0 +1,40 @@ +// Type definitions for reserved-words 0.1 +// Project: https://github.com/zxqfox/reserved-words#readme +// Definitions by: Spencer Miskoviak +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +export type Dialect = + | "es3" + | 3 + | "es5" + | 5 + | "es2015" + | 6 + | "es7" + | 7 + | "es6" + | "next"; + +export interface Keywords { + [index: string]: { + [index: string]: true; + }; +} + +export const KEYWORDS: Keywords; + +/** + * Checks a word for being a reserved word and returns true if the provided + * identifier string is a reserved word in some ECMAScript dialect. + * + * @param word word to check + * @param dialect dialect or version + * @param strict strict mode additionally checks whether word is a keyword or + * future reserved word under strict mode. + */ +export function check( + word: string, + dialect?: Dialect, + strict?: boolean +): boolean; diff --git a/types/reserved-words/reserved-words-tests.ts b/types/reserved-words/reserved-words-tests.ts new file mode 100644 index 0000000000..b664d12871 --- /dev/null +++ b/types/reserved-words/reserved-words-tests.ts @@ -0,0 +1,24 @@ +import { check, Dialect, KEYWORDS } from "reserved-words"; + +const dialect: Dialect = "es3"; + +// $ExpectType boolean +check("while"); + +// $ExpectType boolean +check("while", "es6"); + +// $ExpectType boolean +check("while", "es6", true); + +// $ExpectType boolean +check("yield", 3); + +// $ExpectError +check("yield", 1); + +// $ExpectError +check("yield", "es4"); + +// $ExpectType true +KEYWORDS["6-strict"]["break"]; diff --git a/types/reserved-words/tsconfig.json b/types/reserved-words/tsconfig.json new file mode 100644 index 0000000000..104c0d9ca9 --- /dev/null +++ b/types/reserved-words/tsconfig.json @@ -0,0 +1,23 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "reserved-words-tests.ts" + ] +} diff --git a/types/p-every/tslint.json b/types/reserved-words/tslint.json similarity index 100% rename from types/p-every/tslint.json rename to types/reserved-words/tslint.json diff --git a/types/resize-observer-browser/index.d.ts b/types/resize-observer-browser/index.d.ts new file mode 100644 index 0000000000..5e585f81e5 --- /dev/null +++ b/types/resize-observer-browser/index.d.ts @@ -0,0 +1,25 @@ +// Type definitions for non-npm package resize-observer-browser 0.1 +// Project: https://developer.mozilla.org/en-US/docs/Web/API/ResizeObserver, https://developers.google.com/web/updates/2016/10/resizeobserver, https://wicg.github.io/ResizeObserver/ +// Definitions by: Chives +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.7 + +declare global { + interface Window { + ResizeObserver: typeof ResizeObserver; + } +} + +export class ResizeObserver { + constructor(callback: ResizeObserverCallback); + disconnect(): void; + observe(target: Element): void; + unobserve(target: Element): void; +} + +export type ResizeObserverCallback = (entries: ReadonlyArray) => void; + +export interface ResizeObserverEntry { + readonly target: Element; + readonly contentRect: DOMRectReadOnly; +} diff --git a/types/resize-observer-browser/test/resize-observer-browser-global.tests.ts b/types/resize-observer-browser/test/resize-observer-browser-global.tests.ts new file mode 100644 index 0000000000..6398b979fe --- /dev/null +++ b/types/resize-observer-browser/test/resize-observer-browser-global.tests.ts @@ -0,0 +1,11 @@ +function resizeObserverCreatesViaWindow(): void { + const resizeObserver = new window.ResizeObserver((entries) => { + const div = document.getElementById('display-div')!; + const rect = entries[0].contentRect; + div.textContent = `${rect.left} ${rect.right}`; + }); + const div = document.getElementById('resized-div')!; + resizeObserver.observe(div); + resizeObserver.unobserve(div); + resizeObserver.disconnect(); +} diff --git a/types/resize-observer-browser/test/resize-observer-browser-module.tests.ts b/types/resize-observer-browser/test/resize-observer-browser-module.tests.ts new file mode 100644 index 0000000000..5596f13870 --- /dev/null +++ b/types/resize-observer-browser/test/resize-observer-browser-module.tests.ts @@ -0,0 +1,13 @@ +import { ResizeObserver } from "resize-observer-browser"; + +function resizeObserverCreates(): void { + const resizeObserver: ResizeObserver = new ResizeObserver((entries) => { + const div = document.getElementById('display-div')!; + const rect = entries[0].contentRect; + div.textContent = `${rect.left} ${rect.right}`; + }); + const div = document.getElementById('resized-div')!; + resizeObserver.observe(div); + resizeObserver.unobserve(div); + resizeObserver.disconnect(); +} diff --git a/types/resize-observer-browser/tsconfig.json b/types/resize-observer-browser/tsconfig.json new file mode 100644 index 0000000000..69a030695e --- /dev/null +++ b/types/resize-observer-browser/tsconfig.json @@ -0,0 +1,25 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "dom", + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictFunctionTypes": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true + }, + "files": [ + "index.d.ts", + "test/resize-observer-browser-global.tests.ts", + "test/resize-observer-browser-module.tests.ts" + ] +} diff --git a/types/p-limit/tslint.json b/types/resize-observer-browser/tslint.json similarity index 100% rename from types/p-limit/tslint.json rename to types/resize-observer-browser/tslint.json diff --git a/types/resolve-options/index.d.ts b/types/resolve-options/index.d.ts new file mode 100644 index 0000000000..d2b8610011 --- /dev/null +++ b/types/resolve-options/index.d.ts @@ -0,0 +1,36 @@ +// Type definitions for resolve-options 1.1 +// Project: https://github.com/gulpjs/resolve-options +// Definitions by: Przemysław Struciński +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.8 + +interface Options { + cwd?: string | ((...args: any[]) => string); + buffer?: boolean | ((...args: any[]) => boolean); + read?: boolean | ((...args: any[]) => boolean); + base?: string | ((...args: any[]) => string); + since?: Date | number | ((...args: any[]) => Date | number); + passthrough?: boolean | ((...args: any[]) => boolean); + allowEmpty?: boolean | ((...args: any[]) => boolean); + mode?: string | number | ((...args: any[]) => string | number); + dirMode?: string | number | ((...args: any[]) => string | number); + overwrite?: boolean | ((...args: any[]) => boolean); + deep?: boolean | ((...args: any[]) => boolean); +} + +interface ConfigItem { + type: string | string[]; + default?: any; +} + +interface Resolver { + resolve: (key: string) => number | string | boolean | Date | undefined | null; +} + +interface Config { + [par: string]: ConfigItem; +} + +declare function createResolver(config: Config, options: Options): Resolver; + +export = createResolver; diff --git a/types/resolve-options/resolve-options-tests.ts b/types/resolve-options/resolve-options-tests.ts new file mode 100644 index 0000000000..86b28241a6 --- /dev/null +++ b/types/resolve-options/resolve-options-tests.ts @@ -0,0 +1,32 @@ +import resolveOptions = require("resolve-options"); + +const config = { + cwd: { + default: "C/test", + type: 'string' + }, + read: { + type: 'boolean' + }, + since: { + type: ['date', 'number'] + }, + sourcemaps: { + default: false, + type: 'boolean' + }, + }; + + const options = { + read() { + return true; + }, + since: Date.now(), + sourcemaps: true, + }; + + const resolver = resolveOptions(config, options); + + const cwd = resolver.resolve('cwd'); + const sourcemaps = resolver.resolve('sourcemaps'); + const read = resolver.resolve('read'); diff --git a/types/resolve-options/tsconfig.json b/types/resolve-options/tsconfig.json new file mode 100644 index 0000000000..3d410dd3c4 --- /dev/null +++ b/types/resolve-options/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", + "resolve-options-tests.ts" + ] +} diff --git a/types/p-locate/tslint.json b/types/resolve-options/tslint.json similarity index 100% rename from types/p-locate/tslint.json rename to types/resolve-options/tslint.json diff --git a/types/resolve/tslint.json b/types/resolve/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/resolve/tslint.json +++ b/types/resolve/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/response-time/tslint.json b/types/response-time/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/response-time/tslint.json +++ b/types/response-time/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rest/tslint.json b/types/rest/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rest/tslint.json +++ b/types/rest/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/restangular/tslint.json b/types/restangular/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/restangular/tslint.json +++ b/types/restangular/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/restful.js/tslint.json b/types/restful.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/restful.js/tslint.json +++ b/types/restful.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/restify/index.d.ts b/types/restify/index.d.ts index 5dad7503b6..0df229f1cc 100644 --- a/types/restify/index.d.ts +++ b/types/restify/index.d.ts @@ -1,5 +1,5 @@ // Type definitions for restify 7.2 -// Project: https://github.com/restify/node-restify, http://restifyjs.com +// Project: https://github.com/restify/node-restify, http://restify.com // Definitions by: Bret Little // Steve Hipwell // Leandro Almeida diff --git a/types/restler/tslint.json b/types/restler/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/restler/tslint.json +++ b/types/restler/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/resumablejs/index.d.ts b/types/resumablejs/index.d.ts index c87d669a07..45047b7cf7 100644 --- a/types/resumablejs/index.d.ts +++ b/types/resumablejs/index.d.ts @@ -1,6 +1,7 @@ // Type definitions for Resumable.js v1.0.2 // Project: https://github.com/23/resumable.js // Definitions by: Daniel McAssey +// Kenneth Kidmose Johnsen // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped declare namespace Resumable { @@ -213,7 +214,7 @@ declare namespace Resumable { /** * Look up a ResumableFile object by its unique identifier. **/ - getFromUniqueIdentifier(uniqueIdentifier: string): void; + getFromUniqueIdentifier(uniqueIdentifier: string): ResumableFile; /** * Returns the total size of the upload in bytes. **/ diff --git a/types/resumablejs/tslint.json b/types/resumablejs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/resumablejs/tslint.json +++ b/types/resumablejs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rethinkdb/tslint.json b/types/rethinkdb/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rethinkdb/tslint.json +++ b/types/rethinkdb/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/retinajs/index.d.ts b/types/retinajs/index.d.ts new file mode 100644 index 0000000000..7d02ebc90b --- /dev/null +++ b/types/retinajs/index.d.ts @@ -0,0 +1,42 @@ +// Type definitions for retinajs 2.1 +// Project: https://github.com/strues/retinajs +// Definitions by: senjyouhara +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export = retinajs.retina; + +export as namespace retinajs; + +declare namespace retinajs { + // var hasWindow: boolean; + + // var environment: number; + + // var srcReplace: RegExp; + + // var inlineReplace: RegExp; + + // var selector: string; + + // var processedAttr: string; + + // var processedAttr: string; + + // function arrayify(object: any): any[]; + + // function chooseCap(cap: number | string): number; + + // function forceOriginalDimensions(image: any): any; + + // function setSourceIfAvailable(image: any, retinaURL: string): void; + + // function dynamicSwapImage(image: any, src: string): void; + + // function manualSwapImage(image: any, hdsrc: string): void; + + // function getImages(images: any[] | null): any[]; + + // function cleanBgImg(img: any): any; + + function retina(images?: any): void; +} diff --git a/types/retinajs/retinajs-tests.ts b/types/retinajs/retinajs-tests.ts new file mode 100644 index 0000000000..382f843e60 --- /dev/null +++ b/types/retinajs/retinajs-tests.ts @@ -0,0 +1,3 @@ +import retina = require("retinajs"); + +retina(); diff --git a/types/retinajs/tsconfig.json b/types/retinajs/tsconfig.json new file mode 100644 index 0000000000..c022eaf6cc --- /dev/null +++ b/types/retinajs/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", + "retinajs-tests.ts" + ] +} diff --git a/types/p-log/tslint.json b/types/retinajs/tslint.json similarity index 100% rename from types/p-log/tslint.json rename to types/retinajs/tslint.json diff --git a/types/revalidator/index.d.ts b/types/revalidator/index.d.ts index dd249d2afc..ec172c2be2 100644 --- a/types/revalidator/index.d.ts +++ b/types/revalidator/index.d.ts @@ -88,6 +88,8 @@ declare module Revalidator { conform?: (value: any, data?: T) => boolean; /**Value is valid only if the dependent value is valid */ dependencies?: string; + /**Property to describe items for type: 'array' */ + items?: ISchema|JSONSchema } } @@ -95,4 +97,4 @@ declare var revalidator: Revalidator.RevalidatorStatic; declare module "revalidator" { export = revalidator; -} \ No newline at end of file +} diff --git a/types/revalidator/tslint.json b/types/revalidator/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/revalidator/tslint.json +++ b/types/revalidator/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/reveal/tslint.json b/types/reveal/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/reveal/tslint.json +++ b/types/reveal/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rickshaw/tslint.json b/types/rickshaw/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rickshaw/tslint.json +++ b/types/rickshaw/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/riot-api-nodejs/tslint.json b/types/riot-api-nodejs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/riot-api-nodejs/tslint.json +++ b/types/riot-api-nodejs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/riot-games-api/tslint.json b/types/riot-games-api/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/riot-games-api/tslint.json +++ b/types/riot-games-api/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/riot-route/index.d.ts b/types/riot-route/index.d.ts index 453bb185fa..a771b3096d 100644 --- a/types/riot-route/index.d.ts +++ b/types/riot-route/index.d.ts @@ -6,4 +6,4 @@ import route from './lib/index'; -export default route; +export = route; diff --git a/types/riot-route/riot-route-tests.ts b/types/riot-route/riot-route-tests.ts index fab6a2b0df..496c8c7fb4 100644 --- a/types/riot-route/riot-route-tests.ts +++ b/types/riot-route/riot-route-tests.ts @@ -1,4 +1,4 @@ -import { default as route } from 'riot-route'; +import route = require('riot-route'); import routeFromTag from 'riot-route/lib/tag'; /* () */ diff --git a/types/riotcontrol/tslint.json b/types/riotcontrol/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/riotcontrol/tslint.json +++ b/types/riotcontrol/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/riotjs/tslint.json b/types/riotjs/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/riotjs/tslint.json +++ b/types/riotjs/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rison/tslint.json b/types/rison/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rison/tslint.json +++ b/types/rison/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/roarr/index.d.ts b/types/roarr/index.d.ts new file mode 100644 index 0000000000..7b64597146 --- /dev/null +++ b/types/roarr/index.d.ts @@ -0,0 +1,296 @@ +// Type definitions for roarr 2.13 +// Project: https://github.com/gajus/roarr#readme +// Definitions by: Philip Saxton +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export as namespace log; + +export default log; + +declare let log: Roarr.RoarrType; + +declare namespace Roarr { + interface MessageContextType { + logLevel?: number; + [name: string]: any; + } + + interface SprintfArgumentType { toString(): string; } + + interface RoarrType { + ( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + ( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + /** + * Creates a child logger appending the provided context object to the previous logger context. + * + * @param context + * @example + * import Roarr from 'roarr'; + * + * const log = Roarr.child({ module: "myModule" }); + * + * log.debug("My Message"); + * // {"context":{"logLevel":20},"Message":"My Message","sequence":0,"time":1531914529921,"version":"1.0.0"} + * + * @see https://www.npmjs.com/package/roarr#child + */ + child(context: MessageContextType): RoarrType; + + /** + * Returns the current context. + */ + getContext(): MessageContextType; + + /** + * Convenience method for logging a message with logLevel context property value set to 10 (LogLevel.Trace) + * + * @example + * import Roarr from 'roarr'; + * + * const log = Roarr; + * + * log.trace('foo'); + * // {"context":{"logLevel":10},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} + * + * @see https://www.npmjs.com/package/roarr#trace + */ + trace( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + trace( + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + /** + * Convenience method for logging a message with logLevel context property value set to 20 (LogLevel.Debug) + * + * @example + * import Roarr from 'roarr'; + * + * const log = Roarr; + * + * log.debug('foo'); + * // {"context":{"logLevel":20},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} + * + * @see https://www.npmjs.com/package/roarr#trace + */ + debug( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + debug( + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + /** + * Convenience method for logging a message with logLevel context property value set to 30 (LogLevel.Info) + * + * @example + * import Roarr from 'roarr'; + * + * const log = Roarr; + * + * log.info('foo'); + * // {"context":{"logLevel":30},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} + * + * @see https://www.npmjs.com/package/roarr#trace + */ + info( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + info( + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + /** + * Convenience method for logging a message with logLevel context property value set to 40 (LogLevel.Warn) + * + * @example + * import Roarr from 'roarr'; + * + * const log = Roarr; + * + * log.warn('foo'); + * // {"context":{"logLevel":40},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} + * + * @see https://www.npmjs.com/package/roarr#trace + */ + warn( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + warn( + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + /** + * Convenience method for logging a message with logLevel context property value set to 50 (LogLevel.Error) + * + * @example + * import Roarr from 'roarr'; + * + * const log = Roarr; + * + * log.error('foo'); + * // {"context":{"logLevel":50},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} + * + * @see https://www.npmjs.com/package/roarr#trace + */ + error( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + error( + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + /** + * Convenience method for logging a message with logLevel context property value set to 60 (LogLevel.Fatal) + * + * @example + * import Roarr from 'roarr'; + * + * const log = Roarr; + * + * log.fatal('foo'); + * // {"context":{"logLevel":60},"message":"foo","sequence":0,"time":1506776210000,"version":"1.0.0"} + * + * @see https://www.npmjs.com/package/roarr#trace + */ + fatal( + context: MessageContextType, + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + + fatal( + message: string, + _0?: SprintfArgumentType, + _1?: SprintfArgumentType, + _2?: SprintfArgumentType, + _3?: SprintfArgumentType, + _4?: SprintfArgumentType, + _5?: SprintfArgumentType, + _6?: SprintfArgumentType, + _7?: SprintfArgumentType + ): void; + } +} diff --git a/types/roarr/roarr-tests.ts b/types/roarr/roarr-tests.ts new file mode 100644 index 0000000000..0e0129ddc2 --- /dev/null +++ b/types/roarr/roarr-tests.ts @@ -0,0 +1,17 @@ +import Roarr from "roarr"; + +const log = Roarr.child({ module: "roarr-tests" }); + +log({ logLevel: 10 }, "Simple log statement"); +log.trace("Trace log statement"); +log.trace({ context: "trace" }, "Trace log statement"); +log.debug("Debug log statement"); +log.debug({ context: "debug" }, "Debug log statement"); +log.info("Info log statement"); +log.info({ context: "info" }, "Info log statement"); +log.warn("Warn log statement"); +log.warn({ context: "warn" }, "Warn log statement"); +log.error("Error log statement"); +log.error({ context: "error" }, "Error log statement"); +log.fatal("Fatal log statement"); +log.fatal({ context: "fatal" }, "Fatal log statement"); diff --git a/types/mem/tsconfig.json b/types/roarr/tsconfig.json similarity index 80% rename from types/mem/tsconfig.json rename to types/roarr/tsconfig.json index 3545985694..ce5385f894 100644 --- a/types/mem/tsconfig.json +++ b/types/roarr/tsconfig.json @@ -5,9 +5,9 @@ "es6" ], "noImplicitAny": true, - "noImplicitThis": true, + "noImplicitThis": true, + "strictFunctionTypes": true, "strictNullChecks": true, - "strictFunctionTypes": true, "baseUrl": "../", "typeRoots": [ "../" @@ -18,6 +18,6 @@ }, "files": [ "index.d.ts", - "mem-tests.ts" + "roarr-tests.ts" ] -} \ No newline at end of file +} diff --git a/types/p-map-series/tslint.json b/types/roarr/tslint.json similarity index 100% rename from types/p-map-series/tslint.json rename to types/roarr/tslint.json diff --git a/types/rollup-plugin-buble/index.d.ts b/types/rollup-plugin-buble/index.d.ts index d6e3414346..ea108ae618 100644 --- a/types/rollup-plugin-buble/index.d.ts +++ b/types/rollup-plugin-buble/index.d.ts @@ -9,10 +9,13 @@ import { Plugin } from 'rollup'; import { TransformOptions } from 'buble'; -export interface Options extends TransformOptions { - // Every files will be parsed by default, but you can specify which files to include or exclude - include?: Array | string | RegExp | null; - exclude?: Array | string | RegExp | null; +declare namespace buble { + interface Options extends TransformOptions { + // Every files will be parsed by default, but you can specify which files to include or exclude + include?: Array | string | RegExp | null; + exclude?: Array | string | RegExp | null; + } } -export default function buble(options?: Options): Plugin; +export = buble; +declare function buble(options?: buble.Options): Plugin; diff --git a/types/rollup-plugin-buble/rollup-plugin-buble-tests.ts b/types/rollup-plugin-buble/rollup-plugin-buble-tests.ts index d020539f8b..faf6597e51 100644 --- a/types/rollup-plugin-buble/rollup-plugin-buble-tests.ts +++ b/types/rollup-plugin-buble/rollup-plugin-buble-tests.ts @@ -1,4 +1,4 @@ -import buble from 'rollup-plugin-buble'; +import buble = require('rollup-plugin-buble'); // No options (default) (() => { diff --git a/types/rollup-plugin-delete/package.json b/types/rollup-plugin-delete/package.json index 272f65edde..8971fd5346 100644 --- a/types/rollup-plugin-delete/package.json +++ b/types/rollup-plugin-delete/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { - "rollup": ">=0.60.0" + "del": "*", + "rollup": ">=0.60.0 <1.2.0" } } diff --git a/types/rollup-plugin-json/index.d.ts b/types/rollup-plugin-json/index.d.ts index b6b61b25e5..c906d90e8a 100644 --- a/types/rollup-plugin-json/index.d.ts +++ b/types/rollup-plugin-json/index.d.ts @@ -8,22 +8,25 @@ /// import { Plugin } from 'rollup'; -export interface Options { - /** - * All JSON files will be parsed by default, but you can also specifically include/exclude files - */ - include?: string | string[]; - exclude?: string | string[]; - /** - * for tree-shaking, properties will be declared as variables, using either `var` or `const` - * @default false - */ - preferConst?: boolean; - /** - * specify indentation for the generated default export — defaults to '\t' - * @default '\t' - */ - indent?: string; +declare namespace json { + interface Options { + /** + * All JSON files will be parsed by default, but you can also specifically include/exclude files + */ + include?: string | string[]; + exclude?: string | string[]; + /** + * for tree-shaking, properties will be declared as variables, using either `var` or `const` + * @default false + */ + preferConst?: boolean; + /** + * specify indentation for the generated default export — defaults to '\t' + * @default '\t' + */ + indent?: string; + } } -export default function json(options?: Options): Plugin; +declare function json(options?: json.Options): Plugin; +export = json; diff --git a/types/rollup-plugin-json/rollup-plugin-json-tests.ts b/types/rollup-plugin-json/rollup-plugin-json-tests.ts index 32e7b26b7a..ed3ddc2b72 100644 --- a/types/rollup-plugin-json/rollup-plugin-json-tests.ts +++ b/types/rollup-plugin-json/rollup-plugin-json-tests.ts @@ -1,4 +1,4 @@ -import json from 'rollup-plugin-json'; +import json = require('rollup-plugin-json'); json(); // $ExpectType Plugin diff --git a/types/rollup-plugin-node-builtins/index.d.ts b/types/rollup-plugin-node-builtins/index.d.ts index e839485ac9..936a276b02 100644 --- a/types/rollup-plugin-node-builtins/index.d.ts +++ b/types/rollup-plugin-node-builtins/index.d.ts @@ -8,9 +8,12 @@ import { Plugin } from 'rollup'; -export interface Options { - crypto?: boolean; - fs?: boolean; +declare namespace builtins { + interface Options { + crypto?: boolean; + fs?: boolean; + } } -export default function builtins(options?: Options): Plugin; +export = builtins; +declare function builtins(options?: builtins.Options): Plugin; diff --git a/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts b/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts index 53e488cd00..2533cbbae2 100644 --- a/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts +++ b/types/rollup-plugin-node-builtins/rollup-plugin-node-builtins-tests.ts @@ -1,4 +1,4 @@ -import builtins from 'rollup-plugin-node-builtins'; +import builtins = require('rollup-plugin-node-builtins'); // No options (default) (() => { diff --git a/types/rollup-plugin-sourcemaps/index.d.ts b/types/rollup-plugin-sourcemaps/index.d.ts index d477648bb0..8ec039d7ac 100644 --- a/types/rollup-plugin-sourcemaps/index.d.ts +++ b/types/rollup-plugin-sourcemaps/index.d.ts @@ -7,13 +7,16 @@ /// import { Plugin } from 'rollup'; -export type ReadFileCallback = (err: NodeJS.ErrnoException, data: string) => void; -export type ReadFileFunction = (file: string | Buffer | number, encoding: string, callback: ReadFileCallback) => void; +declare namespace sourcemaps { + type ReadFileCallback = (err: NodeJS.ErrnoException, data: string) => void; + type ReadFileFunction = (file: string | Buffer | number, encoding: string, callback: ReadFileCallback) => void; -export interface Options { - include?: Array | string | RegExp | null; - exclude?: Array | string | RegExp | null; - readFile?: ReadFileFunction; + interface Options { + include?: Array | string | RegExp | null; + exclude?: Array | string | RegExp | null; + readFile?: ReadFileFunction; + } } -export default function sourcemaps(options?: Options): Plugin; +export = sourcemaps; +declare function sourcemaps(options?: sourcemaps.Options): Plugin; diff --git a/types/rollup-plugin-sourcemaps/rollup-plugin-sourcemaps-tests.ts b/types/rollup-plugin-sourcemaps/rollup-plugin-sourcemaps-tests.ts index 2fc5cf75b9..c302baf5d2 100644 --- a/types/rollup-plugin-sourcemaps/rollup-plugin-sourcemaps-tests.ts +++ b/types/rollup-plugin-sourcemaps/rollup-plugin-sourcemaps-tests.ts @@ -1,4 +1,4 @@ -import sourcemaps from 'rollup-plugin-sourcemaps'; +import sourcemaps = require('rollup-plugin-sourcemaps'); import * as fs from 'fs'; // $ExpectType Plugin diff --git a/types/rosie/tslint.json b/types/rosie/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rosie/tslint.json +++ b/types/rosie/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/roslib/tslint.json b/types/roslib/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/roslib/tslint.json +++ b/types/roslib/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/routie/tslint.json b/types/routie/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/routie/tslint.json +++ b/types/routie/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rox-react-native/index.d.ts b/types/rox-react-native/index.d.ts new file mode 100644 index 0000000000..d44d7c5c00 --- /dev/null +++ b/types/rox-react-native/index.d.ts @@ -0,0 +1,229 @@ +// Type definitions for rox-react-native 4.5 +// Project: https://rollout.io +// Definitions by: ahanriat +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 3.0 + +/** + * DISCLAIMER: + * + * Those type definition are based on the Javascript browser documentation + * as well as using and reversing the React-Native SDK + * + * Important note: Dedicated React-Native documentation as well as open source + * SDK are supposed to come. + */ + +export {}; + +export interface RoxContainer { + [key: string]: Flag | Configuration | Variant; +} + +/** + * The register function should be called before the call to Rox.setup() + * + * https://support.rollout.io/docs/javascript-browser-api#section-register + */ +export function register(namespace: string, roxContainer: RoxContainer): void; + +/** + * Initiate connection with Rox servers for the application identified by the application key. + * The registered containers will be synced and Rox entities will get the appropriate values. + * + * https://support.rollout.io/docs/javascript-browser-api#section-setup + */ +export function setup( + apiKey: string, + options?: RoxSetupOptions +): Promise; + +export interface RoxSetupOptions { + version?: string; + // https://support.rollout.io/docs/javascript-browser-api#section-configurationfetchedhandler + configurationFetchedHandler?(fetcherResult: RoxFetcherResult): void; + debugLevel?: 'verbose'; + // https://support.rollout.io/docs/javascript-browser-api#section-using-the-impressionhandler-option + impressionHandler?( + reporting: RoxReporting, + experiment: RoxExperiment, + context: unknown + ): void; + platform?: string; + freeze?: 'untilLaunch' | 'none'; +} + +export interface RoxFetcherResult { + fetcherStatus: + | 'APPLIED_FROM_EMBEDDED' + | 'APPLIED_FROM_CACHE' + | 'APPLIED_FROM_NETWORK' + | 'ERROR_FETCH_FAILED'; + creationDate: Date; + hasChanges: boolean; + errorDetails?: string; +} + +export interface RoxReporting { + name: string; + value: string; +} + +export interface RoxExperiment { + identifier: string; // experiment id + name: string; + isArchived: boolean; + labels: string[]; // experiment's labels. assigned from dashboard +} + +/** + * Note that you might have to call unfreeze after setting custom properties such as email after login + * https://support.rollout.io/docs/custom-properties + */ +export function setCustomNumberProperty( + name: string, + value: number | (() => number) +): void; +export function setCustomStringProperty( + name: string, + value: string | (() => string) +): void; +export function setCustomBooleanProperty( + name: string, + value: boolean | (() => boolean) +): void; + +/** + * Unfreeze the state of all flags in code + * Calling this function will unfreeze all flags, and using a flag will return it’s most updated value + * + * https://support.rollout.io/docs/flags-update-flow#section-flag-unfreeze + * https://support.rollout.io/docs/javascript-browser-api#section-unfreeze + */ +export function unfreeze(namespace?: string): void; + +/** + * Pulls the latest configuration and flag values down from the Rollout servers + * + * https://support.rollout.io/docs/javascript-browser-api#section-fetch + */ +export function fetch(): Promise; + +/** + * Default is untilForeground + * + * https://support.rollout.io/docs/flags-update-flow#section-flag-freeze-level + */ +export type RoxFlagFreezeLevel = 'none' | 'untilForeground' | 'untilLaunch'; +export interface RoxFlagOptions { + freeze?: RoxFlagFreezeLevel; +} + +/** + * Creates a new Flag + * https://support.rollout.io/docs/javascript-browser-api#section--rox-flag- + */ +export class Flag { + constructor(defaultValue: boolean, options?: RoxFlagOptions); + + // The name of the Flag + name: string; + + // Returns true when the flag is enabled + isEnabled(): boolean; + + getNameDetails(): RoxNameDetails; + + // Unlock the Flag value from changes from the last time it was freezed + unfreeze(): void; +} + +/** + * Used to create and manage Rollout feature flags that determine different predefined values + * + * https://support.rollout.io/docs/javascript-browser-api#section--rox-variant- + */ +export class Variant { + constructor(defaultValue: T, options: T[], name?: string); + + // The name of the Flag + name: string; + + // Returns the current value of the Variant, accounting for value overrides + getValue(): T; + + getNameDetails(): RoxNameDetails; + + // Unlock the Flag value from changes from the last time it was freezed + unfreeze(): void; +} + +interface RoxNameDetails { + name: string; + namespace: string; +} + +/** + * manages a remote configuration setting with a value of type string, boolean, or number. + * The constructor sets the default value for the remote configuration setting + * + * https://support.rollout.io/docs/javascript-browser-api#section--rox-configuration- + */ +export class Configuration { + constructor(defaultValue: T); + + // The name of the Configuration + name: string; + + // Returns the current value of the Configuration, accounting for value overrides + getValue(): T; + + // Unlock the Configuration value from changes from the last time it was freezed + unfreeze(): void; +} + +/** + * Override: Should only be used for development purposes (QA - Feature dev - e2e) + * + * When you override an existing flag value using the Rox.overrides.setOverride method, + * the SDK will disregard existing configuration coming from the dashboard and will + * serialize the override on disk this value will be loaded and override the flag + * right after you call Rox.setup. To clear the override from the cache you need to + * call the Rox.overrides.clearOverride method + * + * https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides- + */ +export interface RoxOverrides { + /** + * Sets an override value on a specific flag, this function accepts two parameters flag name ( + * full flag name including namespace) and desired value (from type String). + * This function also saves the override value on the local device disk, + * so it is "remembered" for the next the SDK is loaded to production. + * + * https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides-setoverride- + * + * Note that for boolean flag we still give the value as a string. + */ + setOverride( + nameSpacedFlagName: string, + value: string | 'false' | 'true' + ): void; + + /** + * Clears the override value from the flag (and the disk). + * + * https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides-clearoverride- + */ + clearOverride(nameSpacedFlagName: string): void; + + getOriginalValue(nameSpacedFlagName: string): string; + + /** + * full flag name including namespace + * + * https://support.rollout.io/docs/javascript-browser-api#section--rox-overrides-hasoverride- + */ + hasOverride(nameSpacedFlagName: string): boolean; +} + +export const overrides: RoxOverrides; diff --git a/types/rox-react-native/rox-react-native-tests.ts b/types/rox-react-native/rox-react-native-tests.ts new file mode 100644 index 0000000000..03dd29e362 --- /dev/null +++ b/types/rox-react-native/rox-react-native-tests.ts @@ -0,0 +1,33 @@ +import * as Rox from 'rox-react-native'; + +const flags = { + superFlag: new Rox.Flag(false) +}; + +const variants = { + superVariant: new Rox.Variant('value1', ['value1', 'value2']) +}; + +const configurations = { + superConfiguration: new Rox.Configuration('☀️') +}; + +// The register function should be called before the call to Rox.setup() +Rox.register('default', { ...configurations, ...variants, ...flags }); +Rox.setup('ROLLOUT_IO_KEY', { + impressionHandler +}).then(linkTargetGroupAttributes); + +function linkTargetGroupAttributes() { + Rox.setCustomStringProperty('id', 'someId'); + Rox.setCustomBooleanProperty('thisIsATest', true); + Rox.setCustomNumberProperty('aNumberProperty', 17); +} + +function impressionHandler( + reporting: Rox.RoxReporting, + experiment?: Rox.RoxExperiment +) { + // If there is no experiment it means that the user has not been enrolled + // or that the reporting is not used yet +} diff --git a/types/rox-react-native/tsconfig.json b/types/rox-react-native/tsconfig.json new file mode 100644 index 0000000000..22b82ef058 --- /dev/null +++ b/types/rox-react-native/tsconfig.json @@ -0,0 +1,24 @@ +{ + "compilerOptions": { + "module": "commonjs", + "lib": [ + "es6" + ], + "noImplicitAny": true, + "noImplicitThis": true, + "strictNullChecks": true, + "baseUrl": "../", + "typeRoots": [ + "../" + ], + "types": [], + "noEmit": true, + "forceConsistentCasingInFileNames": true, + "jsx": "react", + "strictFunctionTypes": true + }, + "files": [ + "index.d.ts", + "rox-react-native-tests.ts" + ] +} diff --git a/types/get-stream/tslint.json b/types/rox-react-native/tslint.json similarity index 54% rename from types/get-stream/tslint.json rename to types/rox-react-native/tslint.json index 71ee04c4e1..82403bc9ec 100644 --- a/types/get-stream/tslint.json +++ b/types/rox-react-native/tslint.json @@ -1,6 +1,6 @@ { "extends": "dtslint/dt.json", "rules": { - "no-unnecessary-generics": false + "file-name-casing": [true, "kebab-case"] } } diff --git a/types/royalslider/tslint.json b/types/royalslider/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/royalslider/tslint.json +++ b/types/royalslider/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rpio/tslint.json b/types/rpio/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rpio/tslint.json +++ b/types/rpio/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rsmq-worker/tslint.json b/types/rsmq-worker/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rsmq-worker/tslint.json +++ b/types/rsmq-worker/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rsmq/tslint.json b/types/rsmq/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rsmq/tslint.json +++ b/types/rsmq/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rss/tslint.json b/types/rss/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rss/tslint.json +++ b/types/rss/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rsvp/tslint.json b/types/rsvp/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rsvp/tslint.json +++ b/types/rsvp/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rsync/tslint.json b/types/rsync/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rsync/tslint.json +++ b/types/rsync/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rtree/tslint.json b/types/rtree/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rtree/tslint.json +++ b/types/rtree/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/run-sequence/tslint.json b/types/run-sequence/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/run-sequence/tslint.json +++ b/types/run-sequence/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rx-angular/tslint.json b/types/rx-angular/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rx-angular/tslint.json +++ b/types/rx-angular/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rx-core-binding/tslint.json b/types/rx-core-binding/tslint.json index 9bd93a98fd..84f4d93abb 100644 --- a/types/rx-core-binding/tslint.json +++ b/types/rx-core-binding/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "no-declare-current-package": false, "no-empty-interface": false, "interface-name": false, diff --git a/types/rx-core/tslint.json b/types/rx-core/tslint.json index af05206613..ed19039904 100644 --- a/types/rx-core/tslint.json +++ b/types/rx-core/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "unified-signatures": false, "no-declare-current-package": false, "no-empty-interface": false, diff --git a/types/rx-jquery/tslint.json b/types/rx-jquery/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rx-jquery/tslint.json +++ b/types/rx-jquery/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rx-lite-aggregates/tslint.json b/types/rx-lite-aggregates/tslint.json index 3043cd814e..5b5adfb0bd 100644 --- a/types/rx-lite-aggregates/tslint.json +++ b/types/rx-lite-aggregates/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODO "dt-header": false, + "npm-naming": false, "unified-signatures": false, "no-declare-current-package": false, "no-single-declare-module": false diff --git a/types/rx-lite-coincidence/tslint.json b/types/rx-lite-coincidence/tslint.json index 0651031b32..b84945c7b5 100644 --- a/types/rx-lite-coincidence/tslint.json +++ b/types/rx-lite-coincidence/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "unified-signatures": false, "no-declare-current-package": false, "no-single-declare-module": false, diff --git a/types/rx-lite-time/tslint.json b/types/rx-lite-time/tslint.json index 0651031b32..b84945c7b5 100644 --- a/types/rx-lite-time/tslint.json +++ b/types/rx-lite-time/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "unified-signatures": false, "no-declare-current-package": false, "no-single-declare-module": false, diff --git a/types/rx-lite-virtualtime/tslint.json b/types/rx-lite-virtualtime/tslint.json index d132ae15db..fe197d7c2b 100644 --- a/types/rx-lite-virtualtime/tslint.json +++ b/types/rx-lite-virtualtime/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "interface-name": false, "no-declare-current-package": false, "no-empty-interface": false, diff --git a/types/rx-lite/tslint.json b/types/rx-lite/tslint.json index 21bc7a553d..f653226b64 100644 --- a/types/rx-lite/tslint.json +++ b/types/rx-lite/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "unified-signatures": false, "no-declare-current-package": false, "no-empty-interface": false, diff --git a/types/rx-node/tslint.json b/types/rx-node/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rx-node/tslint.json +++ b/types/rx-node/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rx.wamp/rx.wamp-tests.ts b/types/rx.wamp/rx.wamp-tests.ts index 741b8e0de9..16a24c7e51 100644 --- a/types/rx.wamp/rx.wamp-tests.ts +++ b/types/rx.wamp/rx.wamp-tests.ts @@ -8,7 +8,7 @@ function nodeJS(session: autobahn.Session) { } function connection() { - var connectionSubscription = Rx.Observable.fromConnection({ url: "ws://localhost:9000" }) + var connectionSubscription = Rx.Observable.fromConnection({ url: "ws://localhost:9000", realm: "realm1" }) .subscribe(session => console.log("A new session was created")); //Close our current connection and don't retry @@ -32,11 +32,11 @@ function subscribe_to_topics(session: autobahn.Session, options: autobahn.ISubsc } function new_in_version3(onResult: Rx.Observer) { - Rx.Observable.subscribeAsObservable(Rx.Observable.fromConnection({ url: "ws://myconnectionurl:9090" }), "wamp.my.foo", undefined, onResult); + Rx.Observable.subscribeAsObservable(Rx.Observable.fromConnection({ url: "ws://myconnectionurl:9090", realm: "realm1" }), "wamp.my.foo", undefined, onResult); } function new_in_version5(fooObserver: Rx.Observer) { - var connection = Rx.Observable.fromConnection({ url: "ws://myconnectionurl:9090" }); + var connection = Rx.Observable.fromConnection({ url: "ws://myconnectionurl:9090", realm: "realm1" }); //You can subscribe to as many items as you want var subscriber = diff --git a/types/rx.wamp/tslint.json b/types/rx.wamp/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/rx.wamp/tslint.json +++ b/types/rx.wamp/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/rx/tslint.json b/types/rx/tslint.json index 6d192e7cef..3a5b262091 100644 --- a/types/rx/tslint.json +++ b/types/rx/tslint.json @@ -3,6 +3,7 @@ "rules": { // TODOs "dt-header": false, + "npm-naming": false, "no-declare-current-package": false, "no-single-declare-module": false } diff --git a/types/s3-uploader/tslint.json b/types/s3-uploader/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/s3-uploader/tslint.json +++ b/types/s3-uploader/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/s3rver/tslint.json b/types/s3rver/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/s3rver/tslint.json +++ b/types/s3rver/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/safari-extension-content/tslint.json b/types/safari-extension-content/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/safari-extension-content/tslint.json +++ b/types/safari-extension-content/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/safari-extension/tslint.json b/types/safari-extension/tslint.json index d67ffb3a73..6c7fd03ccd 100644 --- a/types/safari-extension/tslint.json +++ b/types/safari-extension/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sails.io.js/tslint.json b/types/sails.io.js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sails.io.js/tslint.json +++ b/types/sails.io.js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/saml2-js/tslint.json b/types/saml2-js/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/saml2-js/tslint.json +++ b/types/saml2-js/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/samlp/tslint.json b/types/samlp/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/samlp/tslint.json +++ b/types/samlp/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sammy/tslint.json b/types/sammy/tslint.json index 67293bd146..0a7abf97f8 100644 --- a/types/sammy/tslint.json +++ b/types/sammy/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sandboxed-module/tslint.json b/types/sandboxed-module/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sandboxed-module/tslint.json +++ b/types/sandboxed-module/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sanitize-filename/tslint.json b/types/sanitize-filename/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sanitize-filename/tslint.json +++ b/types/sanitize-filename/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sanitize-html/tslint.json b/types/sanitize-html/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sanitize-html/tslint.json +++ b/types/sanitize-html/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sanitizer/tslint.json b/types/sanitizer/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sanitizer/tslint.json +++ b/types/sanitizer/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sass-graph/tslint.json b/types/sass-graph/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sass-graph/tslint.json +++ b/types/sass-graph/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sat/tslint.json b/types/sat/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sat/tslint.json +++ b/types/sat/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/satnav/tslint.json b/types/satnav/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/satnav/tslint.json +++ b/types/satnav/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/sax/tslint.json b/types/sax/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/sax/tslint.json +++ b/types/sax/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/saywhen/saywhen-tests.ts b/types/saywhen/saywhen-tests.ts index a253308156..3eb72825fe 100644 --- a/types/saywhen/saywhen-tests.ts +++ b/types/saywhen/saywhen-tests.ts @@ -1,7 +1,17 @@ import when = require('saywhen'); -when(jasmine.createSpy('test')); // $ExpectType CallHandler -when(jasmine.createSpy('test')).isCalled; // $ExpectType Proxy +// This interface is needed to get around the fact that the new jasmine +// `createSpy` method takes a generic type while the old typings don't. +// That means that in Typescript 3.0 the spy will be `Spy` and in 3.1 it +// will be `Spy`. This interface matches both and is +// what dtslint will expect the type to be. +interface JasmineSpy extends jasmine.Spy { + (...params: any[]): any; +} +const spy: JasmineSpy = jasmine.createSpy('test'); + +when(spy); // $ExpectType CallHandler +when(spy).isCalled; // $ExpectType Proxy when.captor(); // $ExpectType MatcherProxy<{}> when.captor(jasmine.any(Number)); // $ExpectType MatcherProxy diff --git a/types/sc-hot-reboot/package.json b/types/sc-hot-reboot/package.json new file mode 100644 index 0000000000..a0e2ec3c5c --- /dev/null +++ b/types/sc-hot-reboot/package.json @@ -0,0 +1,6 @@ +{ + "private": true, + "dependencies": { + "chokidar": "^2.1.2" + } +} diff --git a/types/scalike/tslint.json b/types/scalike/tslint.json index a41bf5d19a..3d59f55fda 100644 --- a/types/scalike/tslint.json +++ b/types/scalike/tslint.json @@ -8,6 +8,7 @@ "callable-types": false, "comment-format": false, "dt-header": false, + "npm-naming": false, "eofline": false, "export-just-namespace": false, "import-spacing": false, diff --git a/types/schwifty/package.json b/types/schwifty/package.json index 01df4a95e3..4361a26f8b 100644 --- a/types/schwifty/package.json +++ b/types/schwifty/package.json @@ -1,6 +1,7 @@ { "private": true, "dependencies": { + "knex": "^0.16.1", "objection": "^1.1.9" } } diff --git a/types/screenfull/index.d.ts b/types/screenfull/index.d.ts deleted file mode 100644 index 2c7b93e453..0000000000 --- a/types/screenfull/index.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -// Type definitions for screenfull.js 4.0 -// Project: https://github.com/sindresorhus/screenfull.js -// Definitions by: Ilia Choly -// lionelb -// Joel Shepherd -// BendingBender -// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -// TypeScript Version: 2.5 - -export = screenfull; -export as namespace screenfull; - -declare const screenfull: screenfull.Screenfull | false; - -declare namespace screenfull { - interface Screenfull { - /** - * Returns a boolean whether fullscreen is active. - */ - readonly isFullscreen: boolean; - /** - * Returns the element currently in fullscreen, otherwise `null`. - */ - readonly element: Element | null; - /** - * Returns a boolean whether you are allowed to enter fullscreen. If your page is inside an `